From d6f5e8a2400605fb07005d0a291ddac7b0ae40be Mon Sep 17 00:00:00 2001
From: Vela 4RVCW;ZnZV{0AA}F+`(2_=bNQXU944h5Mzc@5PaniNu*5}
zT3)GFfk
4RVCW;ZnZV{0AA}F+`(2_=bNQXU944h5Mzc@5PaniNu*5}
zT3)GFfk
-外观跟着 Meta 的 Muse 走:接近纯白和接近纯黑的底色,一种蓝色作强调,智能体的气泡是灰色、你的是浅蓝色,聊天顶部有一只小龙,姿势跟着智能体正在做的事变,底下是一条带五个图标的悬浮栏。字体是 [Figtree](https://github.com/erikdkennedy/figtree)(OFL),已内置。这些选择背后的研究在 [design.md](design.md)。
+外观跟着 Meta 的 Muse 走:接近纯白和接近纯黑的底色,一种蓝色作强调,智能体的气泡是灰色、你的是浅蓝色,聊天顶部有一只小龙,姿势跟着智能体正在做的事变,底下是一枚带五个图标的毛玻璃悬浮药丸栏。字体是 [Figtree](https://github.com/erikdkennedy/figtree)(OFL),已内置。这些选择背后的研究在 [design.md](design.md)。
## 装到手机上 {#getting-it-onto-your-phone}
@@ -48,7 +48,7 @@ nanomuse serve --port 9000 --no-qr
## 屏幕上有什么 {#what-is-on-the-screen}
-五个标签页(聊天、动态、点子、目标、资源库)加上形象后面的一个菜单。
+五个标签页(聊天、动态、点子、目标、资源库)加上形象后面的一个菜单。手机宽度下,这五个放在一枚圆角药丸里,悬浮在底边上方 12 px 处,只有图标、没有文字,和 Android 应用画的是同一条栏:药丸半透明,把身后的内容模糊掉,边上有一圈细线;当前标签页显示填充的图形,底下垫一块淡蓝色的指示块,其余的保持灰色描边。各个页面和聊天的输入框都会让开它。宽窗口下,以及桌面应用在任何宽度下,由侧栏代替这条栏。
**聊天。** 一个主要聊天,加上旁聊(右上角的「对话」按钮)。消息一边生成一边流进来。工具调用显示成小标签:点一下看参数和输出。智能体写的文件显示成构件卡片,在应用里就能打开。哨兵(Sentinel)需要你拿主意时出现一张审批卡片;智能体需要信息时出现一张提问卡片。智能体干活时输入框一直开着;你这时发的任何东西都会在下一次调用模型之前并进正在进行的这一轮。
diff --git a/docs/zh/design.md b/docs/zh/design.md
index df806763f..022197a7c 100644
--- a/docs/zh/design.md
+++ b/docs/zh/design.md
@@ -27,7 +27,7 @@
| 灰色 / 浅蓝色气泡,工具用小标签,审批用卡片 | 一样;小标签点开是工具调用,卡片上是哨兵(Sentinel)写的摘要和范围按钮(一次、本次对话、总是;手机上是一次、本聊天、总是) | `web/src/screens/ChatScreen.tsx`、`web/src/components/` |
| 会换姿势的毛绒玩偶 | **小熊猫**,一个实时绘制的 SVG,每种状态一个姿势;六只毛绒玩偶(Sunny、Moss、Sky、Fox、Bolt、Plum)和一个 emoji 作为备选 | `web/src/components/RedPanda.tsx`、`web/public/avatars/` |
| 形象下面是名字和状态;点开面板 | 同样的头部;面板里是大图的形象、状态、*停止*、四个按钮(审批、活动、权限、日程)以及记忆、技能、连接、设置几行 | `web/src/components/MuseSheet.tsx` |
-| 五图标悬浮栏 | 同样的五个:聊天、动态、点子、目标、资源库 | `web/src/App.tsx` |
+| 五图标悬浮栏 | 同样的五个:聊天、动态、点子、目标、资源库,放在底边上方 12 px 的一枚毛玻璃药丸里,半透明、带模糊和一圈细线边;当前标签页的填充图形垫在一块淡蓝色指示块上(`accent-soft`),其余的用 `muted` 描边。宽窗口下由侧栏代替 | `web/src/App.tsx` |
| 很少的动效 | 玩偶和 emoji 的呼吸 / 摇摆 / 蹦跳;小熊猫自己的姿势;`prefers-reduced-motion` 下全部关闭 | `web/src/index.css`、`RedPanda.css` |
## 小熊猫 {#the-red-panda}
diff --git a/nanomuse/server/static/assets/AccountScreen-DvBFnisI.js b/nanomuse/server/static/assets/AccountScreen-bHMDrVr5.js
similarity index 99%
rename from nanomuse/server/static/assets/AccountScreen-DvBFnisI.js
rename to nanomuse/server/static/assets/AccountScreen-bHMDrVr5.js
index f09e63f6c..18b7955ab 100644
--- a/nanomuse/server/static/assets/AccountScreen-DvBFnisI.js
+++ b/nanomuse/server/static/assets/AccountScreen-bHMDrVr5.js
@@ -1 +1 @@
-import{E as e,J as t,K as n,Q as r,R as i,Y as a,b as o,f as s,k as c,q as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{A as d,s as f,t as p}from"./StarNudge-DjXecvWj.js";import{n as m}from"./external-link-Xj5fjR8v.js";import{a as h,i as g}from"./Form-DwKuBk1V.js";import{t as _}from"./clapperboard-BokpXv9J.js";import{t as v}from"./database-zap-CzaFBl6C.js";import{t as y}from"./image-crWy0a06.js";import{$ as b,A as x,G as S,J as C,K as w,V as T,ct as E,gt as D,ot as O,t as k,ut as A}from"./index-BjYzdKkG.js";import{t as j}from"./BackBar-Dli0L0O_.js";var M=t(`gift`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]),N=r(a(),1),P=o();function F(){let{state:e,toast:t,setTab:r}=s(),i=n(),a=e.hub?.account??null,[o,c]=(0,N.useState)(null),[l,d]=(0,N.useState)(null),[m,h]=(0,N.useState)(null),[g,_]=(0,N.useState)(!1),v=!!a?.signed_in,y=f(),b=async()=>{if(v){_(!0);try{let[e,t,n]=await Promise.all([u.cloudMe(),u.cloudSessions(),u.cloudEvents(40)]);c(e),d(t.sessions),h(n.events)}catch(e){t(e.message)}finally{_(!1)}}};return(0,N.useEffect)(()=>{b()},[v,a?.has_password]),(0,P.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,P.jsx)(j,{title:i(`Account`),description:i(v?`nanoMuse Cloud · one account for all your devices`:`Sign in to nanoMuse Cloud`)}),(0,P.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-4`,children:v?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(L,{account:a,me:o}),o&&(0,P.jsx)(p,{moment:`signed_in`}),o&&(0,P.jsx)(R,{me:o,onChanged:()=>void b()}),o?.invite?.code&&(0,P.jsx)(B,{invite:o.invite}),o&&(0,P.jsx)(H,{me:o}),o&&(0,P.jsx)(z,{me:o}),(0,P.jsx)(W,{account:a,onChanged:()=>void b()}),(0,P.jsx)(G,{sessions:l,loading:g,onChanged:()=>void b()}),m&&m.length>0&&(0,P.jsx)(q,{events:m}),(0,P.jsx)(J,{account:a,onDone:()=>r(`chat`)})]}):(0,P.jsxs)(I,{children:[(0,P.jsx)(`p`,{className:`text-[13.5px] text-muted leading-relaxed`,children:i(`Free. One account for all your devices, with a model and ¥{allowance} of use to start; a code the first time, a password afterwards if you like.`,{allowance:(y.allowance_cny??10).toFixed(0)})}),(0,P.jsx)(k,{onSignedIn:()=>t(i(`Signed in to nanoMuse Cloud.`))})]})})]})}function I({title:t,children:n,tone:r}){return(0,P.jsxs)(`section`,{className:e(`rounded-3xl border p-4 space-y-3 shadow-sm`,r===`danger`?`border-rose-500/25 bg-rose-500/[0.04]`:`border-border/70 bg-surface`),children:[t&&(0,P.jsx)(`h2`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted`,children:t}),n]})}function L({account:e,me:t}){let r=n(),a=e?.hint??``,o=t?.account.created_at?new Date(t.account.created_at*1e3):null;return(0,P.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-border/70 bg-surface p-5 shadow-sm`,children:[(0,P.jsx)(`div`,{className:`pointer-events-none absolute -right-16 -top-20 h-48 w-48 rounded-full bg-accent/15 blur-3xl`}),(0,P.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,P.jsx)(`div`,{className:`flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-accent to-sky-400 text-[22px] font-bold text-white shadow-md`,children:(a.replace(/[^a-z0-9]/gi,``).slice(0,1)||`n`).toUpperCase()}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[18px] font-semibold tracking-tight`,children:a}),(0,P.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[12.5px] text-muted`,children:[(0,P.jsx)(`span`,{children:e?.channel===`phone`||e?.channel===`sms`?r(`Mobile number`):r(`E-mail`)}),o&&(0,P.jsxs)(`span`,{children:[`· `,r(`since {date}`,{date:o.toLocaleDateString(i())})]}),t?.account.member&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/12 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,P.jsx)(w,{size:11}),` `,r(`Unlimited`)]})]})]})]}),e?.account_id&&(0,P.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-3 rounded-2xl bg-surface-2/70 px-3 py-2 text-[12px]`,children:[(0,P.jsx)(`span`,{className:`text-muted`,children:r(`Account id`)}),(0,P.jsx)(`code`,{className:`truncate font-mono text-[11.5px] text-fg/80`,children:e.account_id})]})]})}function R({me:t,onChanged:r}){let i=n(),a=t.spend,o=a.grant??a.daily_cap??0,s=a.grant===void 0?a.today:a.total,c=a.left??(a.unlimited?null:Math.max(0,o-s)),l=!a.unlimited&&o>0,u=l?Math.min(100,Math.round(s/o*100)):0,f=a.usd_cny??0,p=e=>f>0?` ≈ $${(e/f).toFixed(2)}`:``,m=l&&(c??0)<=0,h=l&&!m&&(a.warn??u>=80),g={left:c,grant:o,invite_url:t.invite?.url,invite_bonus_cny:a.invite_bonus_cny??t.invite?.bonus_cny,invitee_bonus_cny:a.invitee_bonus_cny??t.invite?.invitee_bonus_cny,own_key_docs:a.own_key_docs,guidance:a.guidance};return(0,P.jsxs)(I,{title:i(`Free allowance`),children:[(0,P.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-[28px] font-bold tracking-tight leading-none`,children:l?(0,P.jsxs)(P.Fragment,{children:[`¥`,(c??0).toFixed(2),(0,P.jsxs)(`span`,{className:`text-[14px] font-medium text-muted`,children:[` `,i(`left of ¥{grant}`,{grant:o.toFixed(0)})]})]}):(0,P.jsxs)(P.Fragment,{children:[`¥`,s.toFixed(2)]})}),(0,P.jsx)(`div`,{className:`mt-1 text-[12.5px] text-muted`,children:l?i(`¥{spent} used{usd}; the allowance does not reset.`,{spent:s.toFixed(2),usd:p(s)}):i(`No limit on this account.`)})]}),(0,P.jsxs)(`div`,{className:`text-right text-[12.5px] text-muted`,children:[(0,P.jsx)(`div`,{children:i(`All time`)}),(0,P.jsxs)(`div`,{className:`text-[15px] font-semibold text-fg`,children:[`¥`,a.total.toFixed(2)]}),f>0&&(0,P.jsxs)(`div`,{className:`text-[11.5px]`,children:[`≈ $`,(a.total/f).toFixed(2)]})]})]}),l&&(0,P.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-2`,children:(0,P.jsx)(`div`,{className:e(`h-full rounded-full transition-all`,u>=100?`bg-rose-500`:u>=80?`bg-amber-500`:`bg-accent`),style:{width:`${u}%`}})}),l&&(0,P.jsxs)(`p`,{className:`text-[12.5px] text-muted`,children:[i(`¥{allowance} to start, +¥{invite} for each friend you invite, and +¥{invite} for them; after that, your own key keeps the model going.`,{allowance:(a.allowance_cny??10).toFixed(0),invite:(g.invite_bonus_cny??5).toFixed(0)}),` `,!m&&!h&&d(i,{signed_in:!0,channel:t.account.channel,region:t.account.region})]}),(m||h)&&(0,P.jsx)(x,{info:g,exhausted:m,onChanged:r})]})}function z({me:e}){let t=n(),{setTab:r}=s(),i=e.contribute??{on:!1,samples:0};return(0,P.jsx)(I,{title:t(`Data controls`),children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>{window.location.hash=`data`,r(`you`)},className:`flex w-full items-center gap-3 text-left`,children:[(0,P.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-fg`,children:(0,P.jsx)(v,{size:18})}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block text-[14px] font-medium`,children:t(`Help improve nanoMuse's AI models`)}),(0,P.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[i.on?t(`On`):t(`Off`),i.samples>0&&` · ${t(`{n} turns kept so far`,{n:String(i.samples)})}`]})]}),(0,P.jsx)(`span`,{className:`text-[13px] font-medium text-accent`,children:t(`Open`)})]})})}function B({invite:t}){let r=n(),{toast:i}=s(),a=t.url||`https://nanomuse.cn/web/?invite=${t.code}`,o=t.earned_cny??t.invites*t.bonus_cny,c=async e=>{try{await navigator.clipboard.writeText(e),i(r(`Copied`))}catch{i(e)}},l=async()=>{let e=r(`Try nanoMuse with me, a fully open-source personal agent, free to use. Sign up with my code {code}: {link}`,{code:t.code,link:a}),n=navigator;if(n.share)try{await n.share({text:e});return}catch{}await c(e)};return(0,P.jsxs)(I,{title:r(`Invite a friend`),children:[(0,P.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:r(`Each new person who signs up with your code adds ¥{bonus} to your allowance, and ¥{bonus} to theirs. It never expires.`,{bonus:t.bonus_cny.toFixed(0)})}),(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-2xl bg-surface-2/70 px-3 py-2`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-[11px] text-muted`,children:r(`Your code`)}),(0,P.jsx)(`code`,{className:`font-mono text-[18px] font-semibold tracking-[0.2em]`,children:t.code})]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void c(t.code),className:e(h,`inline-flex items-center gap-1.5`),children:[(0,P.jsx)(D,{size:14}),` `,r(`Copy`)]})]}),(0,P.jsxs)(`div`,{className:`flex gap-2`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void l(),className:e(g,`inline-flex flex-1 items-center justify-center gap-1.5 py-2.5`),children:[(0,P.jsx)(C,{size:14}),` `,r(`Share the link`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void c(a),className:e(h,`inline-flex items-center gap-1.5`),children:[(0,P.jsx)(M,{size:14}),` `,r(`Copy the link`)]})]}),(0,P.jsxs)(`p`,{className:`text-[12.5px] text-muted`,children:[r(`{n} friends joined`,{n:String(t.invites)}),o>0&&(0,P.jsxs)(P.Fragment,{children:[` · `,r(`¥{amount} added by invitations`,{amount:o.toFixed(0)})]})]})]})}var V={chat:{label:`Chat`,icon:(0,P.jsx)(O,{size:15}),tone:`bg-accent`},image:{label:`Pictures`,icon:(0,P.jsx)(y,{size:15}),tone:`bg-violet-500`},video:{label:`Clips`,icon:(0,P.jsx)(_,{size:15}),tone:`bg-pink-500`},realtime:{label:`Calls`,icon:(0,P.jsx)(b,{size:15}),tone:`bg-emerald-500`}};function H({me:t}){let r=n(),[i,a]=(0,N.useState)(`today`),o=i===`today`?t.usage.today.by_kind:t.usage.total.by_kind,s=t.usage.kinds.length?t.usage.kinds:[`chat`,`image`,`video`,`realtime`],c=new Map(o.map(e=>[e.kind,e])),l=o.reduce((e,t)=>e+t.cost_cny,0),u=t.usage.total.by_model.slice(0,8);return(0,P.jsxs)(I,{title:r(`Usage`),children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:r(`Every kind of use is counted, not just the chat model.`)}),(0,P.jsx)(`div`,{className:`flex rounded-full bg-surface-2/80 p-0.5 text-[12px] font-medium`,children:[`today`,`total`].map(t=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>a(t),className:e(`rounded-full px-2.5 py-1 transition`,i===t?`bg-surface shadow-sm`:`text-muted`),children:r(t===`today`?`Today`:`All time`)},t))})]}),l>0&&(0,P.jsx)(`div`,{className:`flex h-2.5 overflow-hidden rounded-full bg-surface-2`,children:s.map(t=>{let n=c.get(t);return!n||n.cost_cny<=0?null:(0,P.jsx)(`div`,{className:e(`h-full`,V[t]?.tone??`bg-fg/40`),style:{width:`${n.cost_cny/l*100}%`},title:r(V[t]?.label??t)},t)})}),(0,P.jsx)(`ul`,{className:`grid grid-cols-2 gap-2`,children:s.map(t=>{let n=c.get(t),i=V[t];return(0,P.jsxs)(`li`,{className:`rounded-2xl bg-surface-2/60 p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12.5px] text-muted`,children:[(0,P.jsx)(`span`,{className:e(`flex h-5 w-5 items-center justify-center rounded-md text-white`,i?.tone??`bg-fg/40`),children:i?.icon}),r(i?.label??t)]}),(0,P.jsxs)(`div`,{className:`mt-1.5 text-[17px] font-semibold tracking-tight`,children:[`¥`,(n?.cost_cny??0).toFixed(2)]}),(0,P.jsx)(`div`,{className:`text-[11.5px] text-muted`,children:n?t===`realtime`?r(`{n} answers · {tokens} tokens`,{n:n.requests,tokens:U(n.prompt_tokens+n.completion_tokens)}):t===`chat`?r(`{n} requests · {tokens} tokens`,{n:n.requests,tokens:U(n.prompt_tokens+n.completion_tokens)}):r(`{n} requests`,{n:n.requests}):r(`Nothing yet`)})]},t)})}),u.length>0&&(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`mb-1.5 text-[12px] font-medium text-muted`,children:r(`By model, all time`)}),(0,P.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-2xl border border-border/60`,children:u.map(t=>(0,P.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 text-[12.5px]`,children:[(0,P.jsx)(`span`,{className:e(`h-2 w-2 shrink-0 rounded-full`,V[t.kind]?.tone??`bg-fg/40`)}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:t.model}),(0,P.jsx)(`span`,{className:`text-muted`,children:U(t.prompt_tokens+t.completion_tokens)}),(0,P.jsxs)(`span`,{className:`w-16 text-right font-medium`,children:[`¥`,t.cost_cny.toFixed(2)]})]},`${t.model}-${t.kind}`))})]})]})}function U(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e)}function W({account:t,onChanged:r}){let i=n(),{toast:a}=s(),o=!!t?.has_password,[c,d]=(0,N.useState)(!1),[f,p]=(0,N.useState)(``),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(``),[y,b]=(0,N.useState)(!1),[x,S]=(0,N.useState)(null),C=async(e=!1)=>{if(!(!e&&(h.length<8||h!==_))){b(!0),S(null);try{await u.cloudPassword(e?``:h,o?f:void 0),a(i(e?`Password removed.`:o?`Password changed.`:`Password set.`)),d(!1),p(``),g(``),v(``),r()}catch(e){S(i(e.message))}finally{b(!1)}}};return(0,P.jsxs)(I,{title:i(`Password`),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(`span`,{className:e(`flex h-9 w-9 items-center justify-center rounded-xl`,o?`bg-emerald-500/12 text-emerald-600 dark:text-emerald-300`:`bg-surface-2 text-muted`),children:(0,P.jsx)(A,{size:17})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1 text-[13.5px]`,children:[(0,P.jsx)(`div`,{className:`font-medium`,children:i(o?`A password is set`:`No password yet`)}),(0,P.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:i(o?`Sign in with it on a new device, or with a code as before.`:`Optional. With one, a new device can sign in without waiting for a code.`)})]}),!c&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:e(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`shrink-0 px-3 py-2 text-[13px]`),children:i(o?`Change`:`Set`)})]}),c&&(0,P.jsxs)(`form`,{className:`space-y-2.5`,onSubmit:e=>{e.preventDefault(),C()},children:[o&&(0,P.jsx)(`input`,{type:`password`,value:f,onChange:e=>p(e.target.value),placeholder:i(`Current password`),autoComplete:`current-password`,className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,P.jsx)(`input`,{type:`password`,value:h,onChange:e=>g(e.target.value),placeholder:i(`New password (8 characters or more)`),autoComplete:`new-password`,autoFocus:!0,className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,P.jsx)(`input`,{type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:i(`Once more`),autoComplete:`new-password`,className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),_&&h!==_&&(0,P.jsx)(`p`,{className:`text-[12px] text-rose-600 dark:text-rose-300`,children:i(`The two do not match.`)}),x&&(0,P.jsx)(`p`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:x}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsxs)(`button`,{type:`submit`,disabled:y||h.length<8||h!==_||o&&!f,className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1`),children:[y?(0,P.jsx)(l,{size:15,className:`animate-spin`}):(0,P.jsx)(m,{size:15}),` `,i(o?`Change password`:`Set password`)]}),o&&(0,P.jsx)(`button`,{type:`button`,disabled:y||!f,onClick:()=>void C(!0),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:i(`Remove`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>d(!1),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:i(`Cancel`)})]})]})]})}function G({sessions:e,loading:t,onChanged:r}){let a=n(),{toast:o}=s(),[d,f]=(0,N.useState)(null),p=async e=>{if(window.confirm(a(`Sign out {device}? It will need to sign in again.`,{device:e.device||e.prefix}))){f(e.prefix);try{await u.cloudRevokeSession(e.prefix),r()}catch(e){o(e.message)}finally{f(null)}}};return(0,P.jsx)(I,{title:a(`Signed in on`),children:e?(0,P.jsx)(`ul`,{className:`divide-y divide-border/60`,children:e.map(e=>(0,P.jsxs)(`li`,{className:`flex items-center gap-3 py-2.5`,children:[(0,P.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-fg/70`,children:(0,P.jsx)(S,{size:17})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-[13.5px] font-medium`,children:[(0,P.jsx)(`span`,{className:`truncate`,children:e.device||a(`Unnamed device`)}),e.current&&(0,P.jsx)(`span`,{className:`rounded-full bg-accent/12 px-2 py-0.5 text-[10.5px] font-semibold text-accent`,children:a(`This one`)})]}),(0,P.jsxs)(`div`,{className:`truncate text-[12px] text-muted`,children:[e.via===`password`?a(`password`):a(`code`),` · `,a(`since {date}`,{date:new Date(e.created_at*1e3).toLocaleDateString(i())}),e.last_used_at?` · ${a(`used {when}`,{when:c(e.last_used_at)})}`:``]})]}),!e.current&&(0,P.jsx)(`button`,{type:`button`,disabled:d!==null,onClick:()=>void p(e),className:`rounded-full px-3 py-1.5 text-[12.5px] font-medium text-rose-600 hover:bg-rose-500/10 dark:text-rose-300`,children:d===e.prefix?(0,P.jsx)(l,{size:14,className:`animate-spin`}):a(`Sign out`)})]},e.prefix))}):(0,P.jsx)(`div`,{className:`flex justify-center py-3 text-muted`,children:t?(0,P.jsx)(l,{size:18,className:`animate-spin`}):null})})}var K={"account.created":`Account created`,"sign_in.code":`Signed in with a code`,"sign_in.password":`Signed in with the password`,"sign_in.failed":`A sign-in attempt failed`,sign_out:`Signed out`,"sign_out.all":`Signed out everywhere`,"password.set":`Password set`,"password.changed":`Password changed`,"password.cleared":`Password removed`,"budget.refused":`A request was refused: the allowance is used up`,"call.ended":`Call ended`,"upstream.error":`The model provider returned an error`,"credit.granted":`Allowance added`,"pool.set":`Allowance adjusted`,"invite.accepted":`Signed up with a friend's code`,"invite.used":`A friend signed up with your code`,"invite.unknown":`An invite code was not recognised`,"contribute.default":`Data controls: on for new accounts`,"contribute.on":`Data controls: help improve turned on`,"contribute.off":`Data controls: help improve turned off`,"contribute.deleted":`Data controls: kept conversations deleted`,"profile.put":`Agent's name and look saved`,"profile.clear":`Agent's name and look cleared`};function q({events:e}){let t=n(),[r,i]=(0,N.useState)(!1),a=r?e:e.slice(0,6);return(0,P.jsxs)(I,{title:t(`Recent activity`),children:[(0,P.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,n)=>(0,P.jsxs)(`li`,{className:`flex gap-3 text-[12.5px]`,children:[(0,P.jsx)(`span`,{className:`w-[74px] shrink-0 text-muted`,children:c(e.ts)}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:t(K[e.kind]??e.kind)}),e.detail&&(0,P.jsx)(`span`,{className:`ml-1.5 break-all text-muted`,children:e.detail})]})]},`${e.ts}-${n}`))}),e.length>6&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`text-[12.5px] font-medium text-accent`,children:r?t(`Show less`):t(`Show all {n}`,{n:e.length})})]})}function J({account:t,onDone:r}){let i=n(),{toast:a}=s(),[o,c]=(0,N.useState)(null),d=async e=>{let t=i(e===`here`?`Sign out of nanoMuse Cloud on this device? The hub and the Cloud model stop working here until you sign in again.`:e===`all`?`Sign out on every device, including this one?`:`Delete the account? The relay forgets your identifier, your devices and your usage. This cannot be undone.`);if(window.confirm(t)&&(e!==`delete`||window.confirm(i(`Really delete it?`)))){c(e);try{e===`here`?await u.cloudSignOut():e===`all`?await u.cloudSignOutAll(!0):await u.cloudDelete(),a(i(e===`delete`?`Account deleted.`:`Signed out.`)),r()}catch(e){a(e.message)}finally{c(null)}}};return(0,P.jsxs)(I,{tone:`danger`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsxs)(`button`,{type:`button`,disabled:o!==null,onClick:()=>void d(`here`),className:e(h,`flex-1`),children:[o===`here`?(0,P.jsx)(l,{size:15,className:`animate-spin`}):(0,P.jsx)(E,{size:15}),` `,i(`Sign out`)]}),(0,P.jsxs)(`button`,{type:`button`,disabled:o!==null,onClick:()=>void d(`all`),className:e(h,`flex-1`),children:[o===`all`?(0,P.jsx)(l,{size:15,className:`animate-spin`}):(0,P.jsx)(S,{size:15}),` `,i(`Sign out everywhere`)]})]}),(0,P.jsxs)(`button`,{type:`button`,disabled:o!==null,onClick:()=>void d(`delete`),className:`flex w-full items-center justify-center gap-1.5 rounded-2xl py-2 text-[13px] font-medium text-rose-600 hover:bg-rose-500/10 dark:text-rose-300`,children:[o===`delete`?(0,P.jsx)(l,{size:15,className:`animate-spin`}):(0,P.jsx)(T,{size:15}),` `,i(`Delete the account`)]}),t?.is_model&&(0,P.jsx)(`p`,{className:`text-center text-[11.5px] text-muted`,children:i(`The Cloud model is in use; after signing out, pick another under Connections.`)})]})}export{F as AccountScreen};
\ No newline at end of file
+import{E as e,J as t,K as n,Q as r,R as i,Y as a,b as o,f as s,k as c,q as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{A as d,s as f,t as p}from"./StarNudge-DjXecvWj.js";import{n as m}from"./external-link-Xj5fjR8v.js";import{a as h,i as g}from"./Form-DwKuBk1V.js";import{t as _}from"./clapperboard-BokpXv9J.js";import{t as v}from"./database-zap-CzaFBl6C.js";import{t as y}from"./image-crWy0a06.js";import{$ as b,A as x,G as S,J as C,K as w,V as T,ct as E,gt as D,ot as O,t as k,ut as A}from"./index-CIdGZ5PB.js";import{t as j}from"./BackBar-Dl56jHZM.js";var M=t(`gift`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]),N=r(a(),1),P=o();function F(){let{state:e,toast:t,setTab:r}=s(),i=n(),a=e.hub?.account??null,[o,c]=(0,N.useState)(null),[l,d]=(0,N.useState)(null),[m,h]=(0,N.useState)(null),[g,_]=(0,N.useState)(!1),v=!!a?.signed_in,y=f(),b=async()=>{if(v){_(!0);try{let[e,t,n]=await Promise.all([u.cloudMe(),u.cloudSessions(),u.cloudEvents(40)]);c(e),d(t.sessions),h(n.events)}catch(e){t(e.message)}finally{_(!1)}}};return(0,N.useEffect)(()=>{b()},[v,a?.has_password]),(0,P.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,P.jsx)(j,{title:i(`Account`),description:i(v?`nanoMuse Cloud · one account for all your devices`:`Sign in to nanoMuse Cloud`)}),(0,P.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-4`,children:v?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(L,{account:a,me:o}),o&&(0,P.jsx)(p,{moment:`signed_in`}),o&&(0,P.jsx)(R,{me:o,onChanged:()=>void b()}),o?.invite?.code&&(0,P.jsx)(B,{invite:o.invite}),o&&(0,P.jsx)(H,{me:o}),o&&(0,P.jsx)(z,{me:o}),(0,P.jsx)(W,{account:a,onChanged:()=>void b()}),(0,P.jsx)(G,{sessions:l,loading:g,onChanged:()=>void b()}),m&&m.length>0&&(0,P.jsx)(q,{events:m}),(0,P.jsx)(J,{account:a,onDone:()=>r(`chat`)})]}):(0,P.jsxs)(I,{children:[(0,P.jsx)(`p`,{className:`text-[13.5px] text-muted leading-relaxed`,children:i(`Free. One account for all your devices, with a model and ¥{allowance} of use to start; a code the first time, a password afterwards if you like.`,{allowance:(y.allowance_cny??10).toFixed(0)})}),(0,P.jsx)(k,{onSignedIn:()=>t(i(`Signed in to nanoMuse Cloud.`))})]})})]})}function I({title:t,children:n,tone:r}){return(0,P.jsxs)(`section`,{className:e(`rounded-3xl border p-4 space-y-3 shadow-sm`,r===`danger`?`border-rose-500/25 bg-rose-500/[0.04]`:`border-border/70 bg-surface`),children:[t&&(0,P.jsx)(`h2`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted`,children:t}),n]})}function L({account:e,me:t}){let r=n(),a=e?.hint??``,o=t?.account.created_at?new Date(t.account.created_at*1e3):null;return(0,P.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-border/70 bg-surface p-5 shadow-sm`,children:[(0,P.jsx)(`div`,{className:`pointer-events-none absolute -right-16 -top-20 h-48 w-48 rounded-full bg-accent/15 blur-3xl`}),(0,P.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,P.jsx)(`div`,{className:`flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-accent to-sky-400 text-[22px] font-bold text-white shadow-md`,children:(a.replace(/[^a-z0-9]/gi,``).slice(0,1)||`n`).toUpperCase()}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[18px] font-semibold tracking-tight`,children:a}),(0,P.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[12.5px] text-muted`,children:[(0,P.jsx)(`span`,{children:e?.channel===`phone`||e?.channel===`sms`?r(`Mobile number`):r(`E-mail`)}),o&&(0,P.jsxs)(`span`,{children:[`· `,r(`since {date}`,{date:o.toLocaleDateString(i())})]}),t?.account.member&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/12 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,P.jsx)(w,{size:11}),` `,r(`Unlimited`)]})]})]})]}),e?.account_id&&(0,P.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-3 rounded-2xl bg-surface-2/70 px-3 py-2 text-[12px]`,children:[(0,P.jsx)(`span`,{className:`text-muted`,children:r(`Account id`)}),(0,P.jsx)(`code`,{className:`truncate font-mono text-[11.5px] text-fg/80`,children:e.account_id})]})]})}function R({me:t,onChanged:r}){let i=n(),a=t.spend,o=a.grant??a.daily_cap??0,s=a.grant===void 0?a.today:a.total,c=a.left??(a.unlimited?null:Math.max(0,o-s)),l=!a.unlimited&&o>0,u=l?Math.min(100,Math.round(s/o*100)):0,f=a.usd_cny??0,p=e=>f>0?` ≈ $${(e/f).toFixed(2)}`:``,m=l&&(c??0)<=0,h=l&&!m&&(a.warn??u>=80),g={left:c,grant:o,invite_url:t.invite?.url,invite_bonus_cny:a.invite_bonus_cny??t.invite?.bonus_cny,invitee_bonus_cny:a.invitee_bonus_cny??t.invite?.invitee_bonus_cny,own_key_docs:a.own_key_docs,guidance:a.guidance};return(0,P.jsxs)(I,{title:i(`Free allowance`),children:[(0,P.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-[28px] font-bold tracking-tight leading-none`,children:l?(0,P.jsxs)(P.Fragment,{children:[`¥`,(c??0).toFixed(2),(0,P.jsxs)(`span`,{className:`text-[14px] font-medium text-muted`,children:[` `,i(`left of ¥{grant}`,{grant:o.toFixed(0)})]})]}):(0,P.jsxs)(P.Fragment,{children:[`¥`,s.toFixed(2)]})}),(0,P.jsx)(`div`,{className:`mt-1 text-[12.5px] text-muted`,children:l?i(`¥{spent} used{usd}; the allowance does not reset.`,{spent:s.toFixed(2),usd:p(s)}):i(`No limit on this account.`)})]}),(0,P.jsxs)(`div`,{className:`text-right text-[12.5px] text-muted`,children:[(0,P.jsx)(`div`,{children:i(`All time`)}),(0,P.jsxs)(`div`,{className:`text-[15px] font-semibold text-fg`,children:[`¥`,a.total.toFixed(2)]}),f>0&&(0,P.jsxs)(`div`,{className:`text-[11.5px]`,children:[`≈ $`,(a.total/f).toFixed(2)]})]})]}),l&&(0,P.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-2`,children:(0,P.jsx)(`div`,{className:e(`h-full rounded-full transition-all`,u>=100?`bg-rose-500`:u>=80?`bg-amber-500`:`bg-accent`),style:{width:`${u}%`}})}),l&&(0,P.jsxs)(`p`,{className:`text-[12.5px] text-muted`,children:[i(`¥{allowance} to start, +¥{invite} for each friend you invite, and +¥{invite} for them; after that, your own key keeps the model going.`,{allowance:(a.allowance_cny??10).toFixed(0),invite:(g.invite_bonus_cny??5).toFixed(0)}),` `,!m&&!h&&d(i,{signed_in:!0,channel:t.account.channel,region:t.account.region})]}),(m||h)&&(0,P.jsx)(x,{info:g,exhausted:m,onChanged:r})]})}function z({me:e}){let t=n(),{setTab:r}=s(),i=e.contribute??{on:!1,samples:0};return(0,P.jsx)(I,{title:t(`Data controls`),children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>{window.location.hash=`data`,r(`you`)},className:`flex w-full items-center gap-3 text-left`,children:[(0,P.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-fg`,children:(0,P.jsx)(v,{size:18})}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block text-[14px] font-medium`,children:t(`Help improve nanoMuse's AI models`)}),(0,P.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[i.on?t(`On`):t(`Off`),i.samples>0&&` · ${t(`{n} turns kept so far`,{n:String(i.samples)})}`]})]}),(0,P.jsx)(`span`,{className:`text-[13px] font-medium text-accent`,children:t(`Open`)})]})})}function B({invite:t}){let r=n(),{toast:i}=s(),a=t.url||`https://nanomuse.cn/web/?invite=${t.code}`,o=t.earned_cny??t.invites*t.bonus_cny,c=async e=>{try{await navigator.clipboard.writeText(e),i(r(`Copied`))}catch{i(e)}},l=async()=>{let e=r(`Try nanoMuse with me, a fully open-source personal agent, free to use. Sign up with my code {code}: {link}`,{code:t.code,link:a}),n=navigator;if(n.share)try{await n.share({text:e});return}catch{}await c(e)};return(0,P.jsxs)(I,{title:r(`Invite a friend`),children:[(0,P.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:r(`Each new person who signs up with your code adds ¥{bonus} to your allowance, and ¥{bonus} to theirs. It never expires.`,{bonus:t.bonus_cny.toFixed(0)})}),(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-2xl bg-surface-2/70 px-3 py-2`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`text-[11px] text-muted`,children:r(`Your code`)}),(0,P.jsx)(`code`,{className:`font-mono text-[18px] font-semibold tracking-[0.2em]`,children:t.code})]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void c(t.code),className:e(h,`inline-flex items-center gap-1.5`),children:[(0,P.jsx)(D,{size:14}),` `,r(`Copy`)]})]}),(0,P.jsxs)(`div`,{className:`flex gap-2`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void l(),className:e(g,`inline-flex flex-1 items-center justify-center gap-1.5 py-2.5`),children:[(0,P.jsx)(C,{size:14}),` `,r(`Share the link`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void c(a),className:e(h,`inline-flex items-center gap-1.5`),children:[(0,P.jsx)(M,{size:14}),` `,r(`Copy the link`)]})]}),(0,P.jsxs)(`p`,{className:`text-[12.5px] text-muted`,children:[r(`{n} friends joined`,{n:String(t.invites)}),o>0&&(0,P.jsxs)(P.Fragment,{children:[` · `,r(`¥{amount} added by invitations`,{amount:o.toFixed(0)})]})]})]})}var V={chat:{label:`Chat`,icon:(0,P.jsx)(O,{size:15}),tone:`bg-accent`},image:{label:`Pictures`,icon:(0,P.jsx)(y,{size:15}),tone:`bg-violet-500`},video:{label:`Clips`,icon:(0,P.jsx)(_,{size:15}),tone:`bg-pink-500`},realtime:{label:`Calls`,icon:(0,P.jsx)(b,{size:15}),tone:`bg-emerald-500`}};function H({me:t}){let r=n(),[i,a]=(0,N.useState)(`today`),o=i===`today`?t.usage.today.by_kind:t.usage.total.by_kind,s=t.usage.kinds.length?t.usage.kinds:[`chat`,`image`,`video`,`realtime`],c=new Map(o.map(e=>[e.kind,e])),l=o.reduce((e,t)=>e+t.cost_cny,0),u=t.usage.total.by_model.slice(0,8);return(0,P.jsxs)(I,{title:r(`Usage`),children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:r(`Every kind of use is counted, not just the chat model.`)}),(0,P.jsx)(`div`,{className:`flex rounded-full bg-surface-2/80 p-0.5 text-[12px] font-medium`,children:[`today`,`total`].map(t=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>a(t),className:e(`rounded-full px-2.5 py-1 transition`,i===t?`bg-surface shadow-sm`:`text-muted`),children:r(t===`today`?`Today`:`All time`)},t))})]}),l>0&&(0,P.jsx)(`div`,{className:`flex h-2.5 overflow-hidden rounded-full bg-surface-2`,children:s.map(t=>{let n=c.get(t);return!n||n.cost_cny<=0?null:(0,P.jsx)(`div`,{className:e(`h-full`,V[t]?.tone??`bg-fg/40`),style:{width:`${n.cost_cny/l*100}%`},title:r(V[t]?.label??t)},t)})}),(0,P.jsx)(`ul`,{className:`grid grid-cols-2 gap-2`,children:s.map(t=>{let n=c.get(t),i=V[t];return(0,P.jsxs)(`li`,{className:`rounded-2xl bg-surface-2/60 p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12.5px] text-muted`,children:[(0,P.jsx)(`span`,{className:e(`flex h-5 w-5 items-center justify-center rounded-md text-white`,i?.tone??`bg-fg/40`),children:i?.icon}),r(i?.label??t)]}),(0,P.jsxs)(`div`,{className:`mt-1.5 text-[17px] font-semibold tracking-tight`,children:[`¥`,(n?.cost_cny??0).toFixed(2)]}),(0,P.jsx)(`div`,{className:`text-[11.5px] text-muted`,children:n?t===`realtime`?r(`{n} answers · {tokens} tokens`,{n:n.requests,tokens:U(n.prompt_tokens+n.completion_tokens)}):t===`chat`?r(`{n} requests · {tokens} tokens`,{n:n.requests,tokens:U(n.prompt_tokens+n.completion_tokens)}):r(`{n} requests`,{n:n.requests}):r(`Nothing yet`)})]},t)})}),u.length>0&&(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:`mb-1.5 text-[12px] font-medium text-muted`,children:r(`By model, all time`)}),(0,P.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-2xl border border-border/60`,children:u.map(t=>(0,P.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 text-[12.5px]`,children:[(0,P.jsx)(`span`,{className:e(`h-2 w-2 shrink-0 rounded-full`,V[t.kind]?.tone??`bg-fg/40`)}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:t.model}),(0,P.jsx)(`span`,{className:`text-muted`,children:U(t.prompt_tokens+t.completion_tokens)}),(0,P.jsxs)(`span`,{className:`w-16 text-right font-medium`,children:[`¥`,t.cost_cny.toFixed(2)]})]},`${t.model}-${t.kind}`))})]})]})}function U(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e)}function W({account:t,onChanged:r}){let i=n(),{toast:a}=s(),o=!!t?.has_password,[c,d]=(0,N.useState)(!1),[f,p]=(0,N.useState)(``),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(``),[y,b]=(0,N.useState)(!1),[x,S]=(0,N.useState)(null),C=async(e=!1)=>{if(!(!e&&(h.length<8||h!==_))){b(!0),S(null);try{await u.cloudPassword(e?``:h,o?f:void 0),a(i(e?`Password removed.`:o?`Password changed.`:`Password set.`)),d(!1),p(``),g(``),v(``),r()}catch(e){S(i(e.message))}finally{b(!1)}}};return(0,P.jsxs)(I,{title:i(`Password`),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(`span`,{className:e(`flex h-9 w-9 items-center justify-center rounded-xl`,o?`bg-emerald-500/12 text-emerald-600 dark:text-emerald-300`:`bg-surface-2 text-muted`),children:(0,P.jsx)(A,{size:17})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1 text-[13.5px]`,children:[(0,P.jsx)(`div`,{className:`font-medium`,children:i(o?`A password is set`:`No password yet`)}),(0,P.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:i(o?`Sign in with it on a new device, or with a code as before.`:`Optional. With one, a new device can sign in without waiting for a code.`)})]}),!c&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:e(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`shrink-0 px-3 py-2 text-[13px]`),children:i(o?`Change`:`Set`)})]}),c&&(0,P.jsxs)(`form`,{className:`space-y-2.5`,onSubmit:e=>{e.preventDefault(),C()},children:[o&&(0,P.jsx)(`input`,{type:`password`,value:f,onChange:e=>p(e.target.value),placeholder:i(`Current password`),autoComplete:`current-password`,className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,P.jsx)(`input`,{type:`password`,value:h,onChange:e=>g(e.target.value),placeholder:i(`New password (8 characters or more)`),autoComplete:`new-password`,autoFocus:!0,className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,P.jsx)(`input`,{type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:i(`Once more`),autoComplete:`new-password`,className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),_&&h!==_&&(0,P.jsx)(`p`,{className:`text-[12px] text-rose-600 dark:text-rose-300`,children:i(`The two do not match.`)}),x&&(0,P.jsx)(`p`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:x}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsxs)(`button`,{type:`submit`,disabled:y||h.length<8||h!==_||o&&!f,className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1`),children:[y?(0,P.jsx)(l,{size:15,className:`animate-spin`}):(0,P.jsx)(m,{size:15}),` `,i(o?`Change password`:`Set password`)]}),o&&(0,P.jsx)(`button`,{type:`button`,disabled:y||!f,onClick:()=>void C(!0),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:i(`Remove`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>d(!1),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:i(`Cancel`)})]})]})]})}function G({sessions:e,loading:t,onChanged:r}){let a=n(),{toast:o}=s(),[d,f]=(0,N.useState)(null),p=async e=>{if(window.confirm(a(`Sign out {device}? It will need to sign in again.`,{device:e.device||e.prefix}))){f(e.prefix);try{await u.cloudRevokeSession(e.prefix),r()}catch(e){o(e.message)}finally{f(null)}}};return(0,P.jsx)(I,{title:a(`Signed in on`),children:e?(0,P.jsx)(`ul`,{className:`divide-y divide-border/60`,children:e.map(e=>(0,P.jsxs)(`li`,{className:`flex items-center gap-3 py-2.5`,children:[(0,P.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-fg/70`,children:(0,P.jsx)(S,{size:17})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-[13.5px] font-medium`,children:[(0,P.jsx)(`span`,{className:`truncate`,children:e.device||a(`Unnamed device`)}),e.current&&(0,P.jsx)(`span`,{className:`rounded-full bg-accent/12 px-2 py-0.5 text-[10.5px] font-semibold text-accent`,children:a(`This one`)})]}),(0,P.jsxs)(`div`,{className:`truncate text-[12px] text-muted`,children:[e.via===`password`?a(`password`):a(`code`),` · `,a(`since {date}`,{date:new Date(e.created_at*1e3).toLocaleDateString(i())}),e.last_used_at?` · ${a(`used {when}`,{when:c(e.last_used_at)})}`:``]})]}),!e.current&&(0,P.jsx)(`button`,{type:`button`,disabled:d!==null,onClick:()=>void p(e),className:`rounded-full px-3 py-1.5 text-[12.5px] font-medium text-rose-600 hover:bg-rose-500/10 dark:text-rose-300`,children:d===e.prefix?(0,P.jsx)(l,{size:14,className:`animate-spin`}):a(`Sign out`)})]},e.prefix))}):(0,P.jsx)(`div`,{className:`flex justify-center py-3 text-muted`,children:t?(0,P.jsx)(l,{size:18,className:`animate-spin`}):null})})}var K={"account.created":`Account created`,"sign_in.code":`Signed in with a code`,"sign_in.password":`Signed in with the password`,"sign_in.failed":`A sign-in attempt failed`,sign_out:`Signed out`,"sign_out.all":`Signed out everywhere`,"password.set":`Password set`,"password.changed":`Password changed`,"password.cleared":`Password removed`,"budget.refused":`A request was refused: the allowance is used up`,"call.ended":`Call ended`,"upstream.error":`The model provider returned an error`,"credit.granted":`Allowance added`,"pool.set":`Allowance adjusted`,"invite.accepted":`Signed up with a friend's code`,"invite.used":`A friend signed up with your code`,"invite.unknown":`An invite code was not recognised`,"contribute.default":`Data controls: on for new accounts`,"contribute.on":`Data controls: help improve turned on`,"contribute.off":`Data controls: help improve turned off`,"contribute.deleted":`Data controls: kept conversations deleted`,"profile.put":`Agent's name and look saved`,"profile.clear":`Agent's name and look cleared`};function q({events:e}){let t=n(),[r,i]=(0,N.useState)(!1),a=r?e:e.slice(0,6);return(0,P.jsxs)(I,{title:t(`Recent activity`),children:[(0,P.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,n)=>(0,P.jsxs)(`li`,{className:`flex gap-3 text-[12.5px]`,children:[(0,P.jsx)(`span`,{className:`w-[74px] shrink-0 text-muted`,children:c(e.ts)}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:t(K[e.kind]??e.kind)}),e.detail&&(0,P.jsx)(`span`,{className:`ml-1.5 break-all text-muted`,children:e.detail})]})]},`${e.ts}-${n}`))}),e.length>6&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`text-[12.5px] font-medium text-accent`,children:r?t(`Show less`):t(`Show all {n}`,{n:e.length})})]})}function J({account:t,onDone:r}){let i=n(),{toast:a}=s(),[o,c]=(0,N.useState)(null),d=async e=>{let t=i(e===`here`?`Sign out of nanoMuse Cloud on this device? The hub and the Cloud model stop working here until you sign in again.`:e===`all`?`Sign out on every device, including this one?`:`Delete the account? The relay forgets your identifier, your devices and your usage. This cannot be undone.`);if(window.confirm(t)&&(e!==`delete`||window.confirm(i(`Really delete it?`)))){c(e);try{e===`here`?await u.cloudSignOut():e===`all`?await u.cloudSignOutAll(!0):await u.cloudDelete(),a(i(e===`delete`?`Account deleted.`:`Signed out.`)),r()}catch(e){a(e.message)}finally{c(null)}}};return(0,P.jsxs)(I,{tone:`danger`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsxs)(`button`,{type:`button`,disabled:o!==null,onClick:()=>void d(`here`),className:e(h,`flex-1`),children:[o===`here`?(0,P.jsx)(l,{size:15,className:`animate-spin`}):(0,P.jsx)(E,{size:15}),` `,i(`Sign out`)]}),(0,P.jsxs)(`button`,{type:`button`,disabled:o!==null,onClick:()=>void d(`all`),className:e(h,`flex-1`),children:[o===`all`?(0,P.jsx)(l,{size:15,className:`animate-spin`}):(0,P.jsx)(S,{size:15}),` `,i(`Sign out everywhere`)]})]}),(0,P.jsxs)(`button`,{type:`button`,disabled:o!==null,onClick:()=>void d(`delete`),className:`flex w-full items-center justify-center gap-1.5 rounded-2xl py-2 text-[13px] font-medium text-rose-600 hover:bg-rose-500/10 dark:text-rose-300`,children:[o===`delete`?(0,P.jsx)(l,{size:15,className:`animate-spin`}):(0,P.jsx)(T,{size:15}),` `,i(`Delete the account`)]}),t?.is_model&&(0,P.jsx)(`p`,{className:`text-center text-[11.5px] text-muted`,children:i(`The Cloud model is in use; after signing out, pick another under Connections.`)})]})}export{F as AccountScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/AvatarPicker-oSjVM8L3.js b/nanomuse/server/static/assets/AvatarPicker-gR2knlot.js
similarity index 97%
rename from nanomuse/server/static/assets/AvatarPicker-oSjVM8L3.js
rename to nanomuse/server/static/assets/AvatarPicker-gR2knlot.js
index a709c2f4b..19d48a512 100644
--- a/nanomuse/server/static/assets/AvatarPicker-oSjVM8L3.js
+++ b/nanomuse/server/static/assets/AvatarPicker-gR2knlot.js
@@ -1 +1 @@
-import{E as e,K as t,a as n,b as r,c as i,s as a,u as o}from"./MuseHeader-Pw-NI98v.js";import{n as s}from"./external-link-Xj5fjR8v.js";import{W as c}from"./index-BjYzdKkG.js";var l=r(),u=[`✨`,`🌙`,`🪐`,`🌿`,`🔥`,`🌊`,`🦉`,`🦊`,`🐙`,`🎯`,`🧭`,`💎`,`🍀`,`🎈`,`🤖`,`🧠`],d=[`#0064d4`,`#7c3aed`,`#0891b2`,`#059669`,`#d97706`,`#dc2626`,`#db2777`,`#4b5563`],f=[{id:`muse`,label:`3D toy (Muse)`},{id:`flat`,label:`Flat`},{id:`clay`,label:`3D clay`},{id:`watercolor`,label:`Watercolour`},{id:`pixel`,label:`Pixel`},{id:`line`,label:`Line`},{id:`sticker`,label:`Sticker`}];function p({value:r,onChange:f,onStudio:p}){let m=t(),h=r.avatar===``,g=!h&&!i(r.avatar)?r.avatar:null,_=`ring-[2.5px] ring-accent ring-offset-2 ring-offset-bg`,v=`relative h-[72px] w-[72px] shrink-0 overflow-hidden rounded-full transition`;return(0,l.jsxs)(`div`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,l.jsx)(`button`,{type:`button`,"aria-label":m(`The dragon`),"aria-pressed":r.avatar===n,onClick:()=>f({...r,avatar:n}),className:e(v,`bg-[#f1efeb]`,r.avatar===`dragon`?_:`opacity-90 hover:opacity-100`),children:(0,l.jsx)(`img`,{src:a(r.avatar===`dragon`?`happy`:`idle`),alt:``,draggable:!1,className:`h-full w-full object-cover`})}),g&&(0,l.jsx)(`button`,{type:`button`,"aria-label":m(`The face drawn for you`),"aria-pressed":!0,className:e(v,`bg-surface-2`,_),children:(0,l.jsx)(`img`,{src:o(g,`happy`),alt:``,draggable:!1,className:`h-full w-full object-cover`})}),p&&(0,l.jsx)(`button`,{type:`button`,"aria-label":m(`Avatar studio`),onClick:p,className:e(v,`flex items-center justify-center border border-dashed border-border text-accent hover:bg-surface-2`),children:(0,l.jsx)(c,{size:22})}),(0,l.jsx)(`button`,{type:`button`,"aria-label":m(`An emoji instead`),"aria-pressed":h,onClick:()=>f({...r,avatar:``}),className:e(`flex h-[72px] w-[72px] shrink-0 items-center justify-center rounded-full text-[26px] transition`,h?_:`opacity-90 hover:opacity-100`),style:{background:`linear-gradient(135deg, ${r.color}, color-mix(in srgb, ${r.color} 60%, #ffffff))`},children:r.emoji})]}),h&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`grid grid-cols-8 gap-1.5`,children:u.map(t=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>f({...r,emoji:t}),className:e(`flex aspect-square items-center justify-center rounded-2xl bg-surface-2 text-[22px]`,r.emoji===t&&`ring-2 ring-accent`),children:t},t))}),(0,l.jsx)(`div`,{className:`flex gap-2`,children:d.map(e=>(0,l.jsx)(`button`,{type:`button`,"aria-label":e,onClick:()=>f({...r,color:e}),className:`flex h-8 w-8 items-center justify-center rounded-full text-white`,style:{background:e},children:r.color===e&&(0,l.jsx)(s,{size:16})},e))})]})]})}export{f as n,p as r,d as t};
\ No newline at end of file
+import{E as e,K as t,a as n,b as r,c as i,s as a,u as o}from"./MuseHeader-Pw-NI98v.js";import{n as s}from"./external-link-Xj5fjR8v.js";import{W as c}from"./index-CIdGZ5PB.js";var l=r(),u=[`✨`,`🌙`,`🪐`,`🌿`,`🔥`,`🌊`,`🦉`,`🦊`,`🐙`,`🎯`,`🧭`,`💎`,`🍀`,`🎈`,`🤖`,`🧠`],d=[`#0064d4`,`#7c3aed`,`#0891b2`,`#059669`,`#d97706`,`#dc2626`,`#db2777`,`#4b5563`],f=[{id:`muse`,label:`3D toy (Muse)`},{id:`flat`,label:`Flat`},{id:`clay`,label:`3D clay`},{id:`watercolor`,label:`Watercolour`},{id:`pixel`,label:`Pixel`},{id:`line`,label:`Line`},{id:`sticker`,label:`Sticker`}];function p({value:r,onChange:f,onStudio:p}){let m=t(),h=r.avatar===``,g=!h&&!i(r.avatar)?r.avatar:null,_=`ring-[2.5px] ring-accent ring-offset-2 ring-offset-bg`,v=`relative h-[72px] w-[72px] shrink-0 overflow-hidden rounded-full transition`;return(0,l.jsxs)(`div`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,l.jsx)(`button`,{type:`button`,"aria-label":m(`The dragon`),"aria-pressed":r.avatar===n,onClick:()=>f({...r,avatar:n}),className:e(v,`bg-[#f1efeb]`,r.avatar===`dragon`?_:`opacity-90 hover:opacity-100`),children:(0,l.jsx)(`img`,{src:a(r.avatar===`dragon`?`happy`:`idle`),alt:``,draggable:!1,className:`h-full w-full object-cover`})}),g&&(0,l.jsx)(`button`,{type:`button`,"aria-label":m(`The face drawn for you`),"aria-pressed":!0,className:e(v,`bg-surface-2`,_),children:(0,l.jsx)(`img`,{src:o(g,`happy`),alt:``,draggable:!1,className:`h-full w-full object-cover`})}),p&&(0,l.jsx)(`button`,{type:`button`,"aria-label":m(`Avatar studio`),onClick:p,className:e(v,`flex items-center justify-center border border-dashed border-border text-accent hover:bg-surface-2`),children:(0,l.jsx)(c,{size:22})}),(0,l.jsx)(`button`,{type:`button`,"aria-label":m(`An emoji instead`),"aria-pressed":h,onClick:()=>f({...r,avatar:``}),className:e(`flex h-[72px] w-[72px] shrink-0 items-center justify-center rounded-full text-[26px] transition`,h?_:`opacity-90 hover:opacity-100`),style:{background:`linear-gradient(135deg, ${r.color}, color-mix(in srgb, ${r.color} 60%, #ffffff))`},children:r.emoji})]}),h&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`grid grid-cols-8 gap-1.5`,children:u.map(t=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>f({...r,emoji:t}),className:e(`flex aspect-square items-center justify-center rounded-2xl bg-surface-2 text-[22px]`,r.emoji===t&&`ring-2 ring-accent`),children:t},t))}),(0,l.jsx)(`div`,{className:`flex gap-2`,children:d.map(e=>(0,l.jsx)(`button`,{type:`button`,"aria-label":e,onClick:()=>f({...r,color:e}),className:`flex h-8 w-8 items-center justify-center rounded-full text-white`,style:{background:e},children:r.color===e&&(0,l.jsx)(s,{size:16})},e))})]})]})}export{f as n,p as r,d as t};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/AvatarStudioScreen-C1Q0sV3j.js b/nanomuse/server/static/assets/AvatarStudioScreen-DD2X0R8P.js
similarity index 99%
rename from nanomuse/server/static/assets/AvatarStudioScreen-C1Q0sV3j.js
rename to nanomuse/server/static/assets/AvatarStudioScreen-DD2X0R8P.js
index 9d70cefbb..7a2e367df 100644
--- a/nanomuse/server/static/assets/AvatarStudioScreen-C1Q0sV3j.js
+++ b/nanomuse/server/static/assets/AvatarStudioScreen-DD2X0R8P.js
@@ -1 +1 @@
-import{E as e,K as t,L as n,Q as r,S as i,Y as a,a as o,b as s,c,f as l,l as u,o as d,q as f,r as p,s as m,u as h,x as g}from"./MuseHeader-Pw-NI98v.js";import{C as _,t as v,w as y}from"./StarNudge-DjXecvWj.js";import{n as b}from"./external-link-Xj5fjR8v.js";import{i as x,o as S}from"./Form-DwKuBk1V.js";import{t as ee}from"./refresh-cw-BKgIzslL.js";import{W as C,ht as te}from"./index-BjYzdKkG.js";import{t as ne}from"./BackBar-Dli0L0O_.js";import{n as w}from"./AvatarPicker-oSjVM8L3.js";var T=r(a(),1),E=s(),D=[`idle`,`working`,`waiting`,`happy`,`error`],O={idle:`Idle`,working:`Working`,waiting:`Waiting for you`,happy:`Done`,error:`Something went wrong`},re=4,k=`a round, custard-yellow baby dragon with small orange horns and folded little wings`;function A(){let{state:r,setTab:a,toast:s,draft:u,refreshSettings:d}=l(),m=t(),h=r.profile,O=h?.name??`nanoMuse`,[A,oe]=(0,T.useState)(null),[M,se]=(0,T.useState)(``),[N,ce]=(0,T.useState)(`muse`),[P,F]=(0,T.useState)(null),[I,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(!1),[B,V]=(0,T.useState)(``),H=r.studio??A?.current??null,U=H?.stage??``,W=U===`drawing`,G=H?.candidates??[],K=(U===`drawing`||U===`choose`)&&G.length>0,le=()=>g.avatarView().then(oe,e=>s(e.message));(0,T.useEffect)(()=>{le()},[h?.avatar,r.settings?.llm.model,r.connectionsVersion]),(0,T.useEffect)(()=>{U!==`choose`&&F(null)},[U]);let q=async(e,t)=>{L(e),V(``);try{await t()}catch(e){V(e.message)}finally{L(null)}},ue=()=>q(`draw`,async()=>{let e=M.trim()||k,t=await g.avatarBegin(e,``,N);if(t.available===!1)throw Error(y(m,`image`,_(r.hub?.account),n()));t.cost?.cloud===!1&&t.session&&await g.avatarStart(t.session)}),de=()=>q(`reset`,async()=>{await g.updateSettings({profile:{avatar:o}}),await d(),s(m(`Back to the built-in look.`))}),J=A?.face??null,fe=!!h?.avatar&&!c(h.avatar),Y=H&&(U===`posing`||U===`animating`||U===`done`)&&H.face===h?.avatar,pe=Y?Object.keys(H.moods??{}).length:0,me=Y?Object.keys(H.clips??{}).length:0,X=Y?(H.errors??[]).filter(e=>!/clip/.test(e)).length:0,Z=H?.cost??{},Q=Z.clips?m(`{n} pictures and {c} clips`,{n:Z.pictures??8,c:Z.clips}):m(`{n} pictures`,{n:Z.pictures??8}),he=(()=>{if(Z.error)return m(`The cost could not be checked: {error}`,{error:Z.error});if(typeof Z.cny!=`number`)return m(`Checking the cost…`);if(Z.unlimited)return m(`About ¥{cny} for {what}; your account has no limit.`,{cny:Z.cny.toFixed(2),what:Q});let e=typeof Z.left_cny==`number`?Z.left_cny.toFixed(2):`?`;return Z.affordable===!1?m(`About ¥{cny} for {what}, more than the ¥{left} left in your allowance.`,{cny:Z.cny.toFixed(2),what:Q,left:e}):m(`About ¥{cny} for {what}; ¥{left} left in your allowance.`,{cny:Z.cny.toFixed(2),what:Q,left:e})})(),$=e=>w.find(t=>t.id===e)?.label,ge=A?.cloud?`nanoMuse Cloud`:ie(A?.host??``,m);return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(ne,{title:m(`Avatar studio`),description:m(`Draw a look with your image model; it moves with what it is doing.`),actions:(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(p,{small:!0,onClick:()=>z(e=>!e),label:m(`More`),expanded:R,children:(0,E.jsx)(te,{size:20})}),R&&(0,E.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 w-56 overflow-hidden rounded-2xl border border-border/70 bg-surface py-1 text-[14px] shadow-lg`,children:[(0,E.jsx)(j,{label:m(`Name & style`),onClick:()=>{z(!1),a(`you`)}}),(0,E.jsx)(j,{label:m(`Image model`),onClick:()=>{z(!1),a(`connections`)}}),fe&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(j,{label:m(`Redraw the poses`),onClick:()=>{z(!1),q(`moods`,()=>g.avatarMoods())}}),(0,E.jsx)(j,{label:m(`Back to the built-in look`),danger:!0,onClick:()=>{z(!1),de()}})]})]})]})}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-5`,onClick:()=>R&&z(!1),children:[(0,E.jsxs)(`div`,{className:`flex flex-col items-center pt-2 text-center`,children:[(0,E.jsx)(ae,{avatar:h?.avatar,emoji:h?.emoji,color:h?.color,name:O}),J&&(0,E.jsx)(`div`,{className:`mt-0.5 max-w-sm text-[12.5px] text-muted`,children:[J.description,$(J.style)&&m($(J.style))].filter(Boolean).join(` · `)}),Y&&(0,E.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 text-[13px] text-muted`,children:[U===`posing`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(f,{size:14,className:`animate-spin text-accent`}),(0,E.jsx)(`span`,{children:m(`Drawing the poses… {done}/{total}`,{done:pe,total:D.length})})]}),U===`animating`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(f,{size:14,className:`animate-spin text-accent`}),(0,E.jsx)(`span`,{children:m(`The new look is on; making the clips… {done}/{total}`,{done:me,total:re})})]}),U===`done`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{children:X===0?m(`All five poses are in.`):m(`{done} of {total} poses are in; the rest show the main picture.`,{done:D.length-X,total:D.length})}),X>0&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>void q(`moods`,()=>g.avatarMoods()),className:`font-medium text-accent`,children:m(`Retry`)})]})]})]}),U===`done`&&X===0&&(0,E.jsx)(v,{moment:`new_look`}),(0,E.jsxs)(`section`,{className:`rounded-3xl border border-border/70 bg-surface p-4 shadow-sm space-y-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-[17px] font-semibold`,children:m(`Describe a new look`)}),(0,E.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-snug text-muted`,children:m(`One sentence is enough: what it is, what it wears, its air. Pick a style and your image model draws four to choose from.`)})]}),(0,E.jsx)(`textarea`,{value:M,onChange:e=>se(e.target.value),rows:2,maxLength:200,placeholder:m(k),className:`w-full resize-none rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:w.map(t=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>ce(t.id),className:e(`rounded-full px-3 py-1.5 text-[13px] font-medium transition`,N===t.id?`bg-fg text-bg`:`bg-surface-2 text-fg hover:bg-border/60`),children:m(t.label)},t.id))}),(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null||W||A?.available===!1,onClick:()=>void ue(),className:e(x,`w-full rounded-full py-3`),children:[W||I===`draw`?(0,E.jsx)(f,{size:16,className:`animate-spin`}):(0,E.jsx)(C,{size:16}),m(W?`Drawing…`:K||U===`choose`?`Draw four more`:`Draw four`)]}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>a(`connections`),className:`flex w-full items-center justify-between gap-3 py-1 text-left text-[12.5px] text-muted`,children:[(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:A===null?`…`:A.available?m(`Drawn by {provider} · {model}`,{provider:ge,model:A.image_model||`—`}):y(m,`image`,_(r.hub?.account),n())}),(0,E.jsx)(`span`,{className:`shrink-0 font-medium text-accent`,children:m(`Change model`)})]}),B&&(0,E.jsx)(`p`,{className:`text-[13px] text-rose-600 dark:text-rose-300`,children:B})]}),U===`estimate`&&H&&(0,E.jsxs)(`section`,{className:`rounded-3xl border border-accent/50 bg-surface p-4 shadow-sm space-y-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:m(`A new look for {name}`,{name:O})}),(0,E.jsx)(`p`,{className:`mt-0.5 text-[13px] text-muted`,children:H.description})]}),(0,E.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:he}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null||typeof Z.cny!=`number`&&!Z.error,onClick:()=>void q(`start`,()=>g.avatarStart(H.session)),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`rounded-full`),children:[I===`start`?(0,E.jsx)(f,{size:14,className:`animate-spin`}):(0,E.jsx)(C,{size:14}),` `,m(`Draw`)]}),(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null,onClick:()=>void q(`cancel`,()=>g.avatarCancel(H.session)),className:e(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`rounded-full`),children:[(0,E.jsx)(S,{size:14}),` `,m(`Not now`)]})]})]}),K&&H&&(0,E.jsxs)(`section`,{className:`space-y-3 px-1`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-[17px] font-semibold`,children:m(`Pick one`)}),(0,E.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-snug text-muted`,children:m(`Draw four more any time; the old ones stay until you do.`)})]}),(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 wide:grid-cols-4`,children:G.map((t,n)=>(0,E.jsxs)(`button`,{type:`button`,disabled:!t||U!==`choose`,onClick:()=>F(e=>e===n?null:n),"aria-label":m(`Candidate {n}`,{n:n+1}),"aria-pressed":P===n,className:e(`relative aspect-square overflow-hidden rounded-[20px] bg-[#f1efeb] transition`,P===n?`ring-[3px] ring-accent`:t&&U===`choose`?`hover:ring-2 hover:ring-accent/60`:``),children:[t?(0,E.jsx)(`img`,{src:i(t),alt:``,draggable:!1,className:`h-full w-full object-cover`}):(0,E.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center text-muted`,children:W?(0,E.jsx)(f,{size:22,className:`animate-spin`}):(0,E.jsx)(S,{size:18,className:`opacity-50`})}),P===n&&(0,E.jsx)(`span`,{className:`absolute right-2 top-2 flex h-7 w-7 items-center justify-center rounded-full bg-accent text-accent-fg shadow`,children:(0,E.jsx)(b,{size:16})})]},n))}),H.errors&&H.errors.length>0&&U===`choose`&&(0,E.jsx)(`p`,{className:`text-[12.5px] text-rose-600 dark:text-rose-300`,children:m(H.errors[0])}),P!==null&&U===`choose`&&(0,E.jsxs)(`div`,{className:`space-y-1.5 pt-1`,children:[(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null,onClick:()=>void q(`choose`,()=>g.avatarChoose(H.session,P)),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`w-full rounded-full py-3`),children:[I===`choose`?(0,E.jsx)(f,{size:16,className:`animate-spin`}):(0,E.jsx)(b,{size:16}),` `,m(`Use this one`)]}),(0,E.jsx)(`p`,{className:`text-center text-[12px] leading-snug text-muted`,children:m(`Next, its poses are drawn from it in the background: working, waiting for you, done, something wrong.`)})]}),U===`choose`&&(0,E.jsx)(`button`,{type:`button`,disabled:I!==null,onClick:()=>void q(`cancel`,()=>g.avatarCancel(H.session)),className:`w-full py-1 text-center text-[13px] text-muted`,children:m(`Keep the current look`)})]}),U===`failed`&&H&&(0,E.jsxs)(`section`,{className:`rounded-3xl border border-border/70 bg-surface p-4 shadow-sm space-y-2`,children:[(0,E.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:m(`That did not work`)}),(0,E.jsx)(`p`,{className:`text-[13px] text-muted`,children:m(H.message||`Nothing came back.`)}),(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null,onClick:()=>void q(`retry`,()=>g.avatarStart(H.session)),className:e(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`rounded-full`),children:[(0,E.jsx)(ee,{size:14}),` `,m(`Try again`)]})]}),(0,E.jsx)(`p`,{className:`px-1 text-[12px] leading-snug text-muted`,children:m(`The pictures stay in this computer's workspace under avatar/. Each new look asks your provider for eight pictures (four to choose from and four poses) and four short clips where there is a video model.`)}),(0,E.jsx)(`p`,{className:`px-1 text-[12px] leading-snug text-muted`,children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>{u(m(`Change your avatar to `)),a(`chat`)},className:`font-medium text-accent`,children:m(`Or just say it in the chat: “change your avatar to a corgi”.`)})})]})]})}function ie(e,t){return e?/dashscope|aliyuncs/.test(e)?t(`Alibaba Cloud Bailian`):/openai\.com/.test(e)?`OpenAI`:/deepseek/.test(e)?`DeepSeek`:/moonshot/.test(e)?`Moonshot`:/bigmodel|zhipu/.test(e)?t(`Zhipu`):/siliconflow/.test(e)?`SiliconFlow`:/volces|ark/.test(e)?t(`Volcano Ark`):/openrouter/.test(e)?`OpenRouter`:/googleapis/.test(e)?`Gemini`:/x\.ai/.test(e)?`xAI`:/^(127\.0\.0\.1|localhost)/.test(e)?t(`this computer`):e:`—`}function j({label:t,onClick:n,danger:r=!1}){return(0,E.jsx)(`button`,{type:`button`,onClick:n,className:e(`block w-full px-4 py-2.5 text-left hover:bg-surface-2`,r?`text-rose-600 dark:text-rose-300`:``),children:t})}function ae({avatar:e,emoji:n,color:r,name:i}){let a=t(),[o,s]=(0,T.useState)(0),l=D[o%D.length],f=(0,T.useRef)(0);(0,T.useEffect)(()=>(f.current=window.setTimeout(()=>s(e=>(e+1)%D.length),l===`idle`?2600:2e3),()=>window.clearTimeout(f.current)),[o,l]);let p=c(e),g=!p&&e?e:null,_=p?m(l):g?h(g,l):``,v=p?d(l):g?u(g,l):null,[y,b]=(0,T.useState)(()=>new Set),x=v&&!y.has(v)?v:null;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:`avatar-pop h-[148px] w-[148px] overflow-hidden rounded-full`,style:_?{background:`#f1efeb`}:{background:`linear-gradient(135deg, ${r??`#0064d4`}, color-mix(in srgb, ${r??`#0064d4`} 60%, #ffffff))`},children:x?(0,E.jsx)(`video`,{src:x,poster:_,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,disablePictureInPicture:!0,onError:()=>b(e=>new Set(e).add(x)),className:`h-full w-full object-cover`},x):_?(0,E.jsx)(`img`,{src:_,alt:``,draggable:!1,className:`h-full w-full object-cover`}):(0,E.jsx)(`span`,{className:`flex h-full w-full items-center justify-center text-[64px] leading-none`,children:n??`✨`})},e),(0,E.jsx)(`div`,{className:`mt-3 text-[20px] font-semibold tracking-tight`,children:i}),(0,E.jsx)(`div`,{className:`mt-1 text-[13px] text-muted`,children:a(O[l])})]})}export{A as AvatarStudioScreen};
\ No newline at end of file
+import{E as e,K as t,L as n,Q as r,S as i,Y as a,a as o,b as s,c,f as l,l as u,o as d,q as f,r as p,s as m,u as h,x as g}from"./MuseHeader-Pw-NI98v.js";import{C as _,t as v,w as y}from"./StarNudge-DjXecvWj.js";import{n as b}from"./external-link-Xj5fjR8v.js";import{i as x,o as S}from"./Form-DwKuBk1V.js";import{t as ee}from"./refresh-cw-BKgIzslL.js";import{W as C,ht as te}from"./index-CIdGZ5PB.js";import{t as ne}from"./BackBar-Dl56jHZM.js";import{n as w}from"./AvatarPicker-gR2knlot.js";var T=r(a(),1),E=s(),D=[`idle`,`working`,`waiting`,`happy`,`error`],O={idle:`Idle`,working:`Working`,waiting:`Waiting for you`,happy:`Done`,error:`Something went wrong`},re=4,k=`a round, custard-yellow baby dragon with small orange horns and folded little wings`;function A(){let{state:r,setTab:a,toast:s,draft:u,refreshSettings:d}=l(),m=t(),h=r.profile,O=h?.name??`nanoMuse`,[A,oe]=(0,T.useState)(null),[M,se]=(0,T.useState)(``),[N,ce]=(0,T.useState)(`muse`),[P,F]=(0,T.useState)(null),[I,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(!1),[B,V]=(0,T.useState)(``),H=r.studio??A?.current??null,U=H?.stage??``,W=U===`drawing`,G=H?.candidates??[],K=(U===`drawing`||U===`choose`)&&G.length>0,le=()=>g.avatarView().then(oe,e=>s(e.message));(0,T.useEffect)(()=>{le()},[h?.avatar,r.settings?.llm.model,r.connectionsVersion]),(0,T.useEffect)(()=>{U!==`choose`&&F(null)},[U]);let q=async(e,t)=>{L(e),V(``);try{await t()}catch(e){V(e.message)}finally{L(null)}},ue=()=>q(`draw`,async()=>{let e=M.trim()||k,t=await g.avatarBegin(e,``,N);if(t.available===!1)throw Error(y(m,`image`,_(r.hub?.account),n()));t.cost?.cloud===!1&&t.session&&await g.avatarStart(t.session)}),de=()=>q(`reset`,async()=>{await g.updateSettings({profile:{avatar:o}}),await d(),s(m(`Back to the built-in look.`))}),J=A?.face??null,fe=!!h?.avatar&&!c(h.avatar),Y=H&&(U===`posing`||U===`animating`||U===`done`)&&H.face===h?.avatar,pe=Y?Object.keys(H.moods??{}).length:0,me=Y?Object.keys(H.clips??{}).length:0,X=Y?(H.errors??[]).filter(e=>!/clip/.test(e)).length:0,Z=H?.cost??{},Q=Z.clips?m(`{n} pictures and {c} clips`,{n:Z.pictures??8,c:Z.clips}):m(`{n} pictures`,{n:Z.pictures??8}),he=(()=>{if(Z.error)return m(`The cost could not be checked: {error}`,{error:Z.error});if(typeof Z.cny!=`number`)return m(`Checking the cost…`);if(Z.unlimited)return m(`About ¥{cny} for {what}; your account has no limit.`,{cny:Z.cny.toFixed(2),what:Q});let e=typeof Z.left_cny==`number`?Z.left_cny.toFixed(2):`?`;return Z.affordable===!1?m(`About ¥{cny} for {what}, more than the ¥{left} left in your allowance.`,{cny:Z.cny.toFixed(2),what:Q,left:e}):m(`About ¥{cny} for {what}; ¥{left} left in your allowance.`,{cny:Z.cny.toFixed(2),what:Q,left:e})})(),$=e=>w.find(t=>t.id===e)?.label,ge=A?.cloud?`nanoMuse Cloud`:ie(A?.host??``,m);return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(ne,{title:m(`Avatar studio`),description:m(`Draw a look with your image model; it moves with what it is doing.`),actions:(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(p,{small:!0,onClick:()=>z(e=>!e),label:m(`More`),expanded:R,children:(0,E.jsx)(te,{size:20})}),R&&(0,E.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 w-56 overflow-hidden rounded-2xl border border-border/70 bg-surface py-1 text-[14px] shadow-lg`,children:[(0,E.jsx)(j,{label:m(`Name & style`),onClick:()=>{z(!1),a(`you`)}}),(0,E.jsx)(j,{label:m(`Image model`),onClick:()=>{z(!1),a(`connections`)}}),fe&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(j,{label:m(`Redraw the poses`),onClick:()=>{z(!1),q(`moods`,()=>g.avatarMoods())}}),(0,E.jsx)(j,{label:m(`Back to the built-in look`),danger:!0,onClick:()=>{z(!1),de()}})]})]})]})}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-5`,onClick:()=>R&&z(!1),children:[(0,E.jsxs)(`div`,{className:`flex flex-col items-center pt-2 text-center`,children:[(0,E.jsx)(ae,{avatar:h?.avatar,emoji:h?.emoji,color:h?.color,name:O}),J&&(0,E.jsx)(`div`,{className:`mt-0.5 max-w-sm text-[12.5px] text-muted`,children:[J.description,$(J.style)&&m($(J.style))].filter(Boolean).join(` · `)}),Y&&(0,E.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 text-[13px] text-muted`,children:[U===`posing`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(f,{size:14,className:`animate-spin text-accent`}),(0,E.jsx)(`span`,{children:m(`Drawing the poses… {done}/{total}`,{done:pe,total:D.length})})]}),U===`animating`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(f,{size:14,className:`animate-spin text-accent`}),(0,E.jsx)(`span`,{children:m(`The new look is on; making the clips… {done}/{total}`,{done:me,total:re})})]}),U===`done`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{children:X===0?m(`All five poses are in.`):m(`{done} of {total} poses are in; the rest show the main picture.`,{done:D.length-X,total:D.length})}),X>0&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>void q(`moods`,()=>g.avatarMoods()),className:`font-medium text-accent`,children:m(`Retry`)})]})]})]}),U===`done`&&X===0&&(0,E.jsx)(v,{moment:`new_look`}),(0,E.jsxs)(`section`,{className:`rounded-3xl border border-border/70 bg-surface p-4 shadow-sm space-y-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-[17px] font-semibold`,children:m(`Describe a new look`)}),(0,E.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-snug text-muted`,children:m(`One sentence is enough: what it is, what it wears, its air. Pick a style and your image model draws four to choose from.`)})]}),(0,E.jsx)(`textarea`,{value:M,onChange:e=>se(e.target.value),rows:2,maxLength:200,placeholder:m(k),className:`w-full resize-none rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:w.map(t=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>ce(t.id),className:e(`rounded-full px-3 py-1.5 text-[13px] font-medium transition`,N===t.id?`bg-fg text-bg`:`bg-surface-2 text-fg hover:bg-border/60`),children:m(t.label)},t.id))}),(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null||W||A?.available===!1,onClick:()=>void ue(),className:e(x,`w-full rounded-full py-3`),children:[W||I===`draw`?(0,E.jsx)(f,{size:16,className:`animate-spin`}):(0,E.jsx)(C,{size:16}),m(W?`Drawing…`:K||U===`choose`?`Draw four more`:`Draw four`)]}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>a(`connections`),className:`flex w-full items-center justify-between gap-3 py-1 text-left text-[12.5px] text-muted`,children:[(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:A===null?`…`:A.available?m(`Drawn by {provider} · {model}`,{provider:ge,model:A.image_model||`—`}):y(m,`image`,_(r.hub?.account),n())}),(0,E.jsx)(`span`,{className:`shrink-0 font-medium text-accent`,children:m(`Change model`)})]}),B&&(0,E.jsx)(`p`,{className:`text-[13px] text-rose-600 dark:text-rose-300`,children:B})]}),U===`estimate`&&H&&(0,E.jsxs)(`section`,{className:`rounded-3xl border border-accent/50 bg-surface p-4 shadow-sm space-y-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:m(`A new look for {name}`,{name:O})}),(0,E.jsx)(`p`,{className:`mt-0.5 text-[13px] text-muted`,children:H.description})]}),(0,E.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:he}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null||typeof Z.cny!=`number`&&!Z.error,onClick:()=>void q(`start`,()=>g.avatarStart(H.session)),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`rounded-full`),children:[I===`start`?(0,E.jsx)(f,{size:14,className:`animate-spin`}):(0,E.jsx)(C,{size:14}),` `,m(`Draw`)]}),(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null,onClick:()=>void q(`cancel`,()=>g.avatarCancel(H.session)),className:e(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`rounded-full`),children:[(0,E.jsx)(S,{size:14}),` `,m(`Not now`)]})]})]}),K&&H&&(0,E.jsxs)(`section`,{className:`space-y-3 px-1`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-[17px] font-semibold`,children:m(`Pick one`)}),(0,E.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-snug text-muted`,children:m(`Draw four more any time; the old ones stay until you do.`)})]}),(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 wide:grid-cols-4`,children:G.map((t,n)=>(0,E.jsxs)(`button`,{type:`button`,disabled:!t||U!==`choose`,onClick:()=>F(e=>e===n?null:n),"aria-label":m(`Candidate {n}`,{n:n+1}),"aria-pressed":P===n,className:e(`relative aspect-square overflow-hidden rounded-[20px] bg-[#f1efeb] transition`,P===n?`ring-[3px] ring-accent`:t&&U===`choose`?`hover:ring-2 hover:ring-accent/60`:``),children:[t?(0,E.jsx)(`img`,{src:i(t),alt:``,draggable:!1,className:`h-full w-full object-cover`}):(0,E.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center text-muted`,children:W?(0,E.jsx)(f,{size:22,className:`animate-spin`}):(0,E.jsx)(S,{size:18,className:`opacity-50`})}),P===n&&(0,E.jsx)(`span`,{className:`absolute right-2 top-2 flex h-7 w-7 items-center justify-center rounded-full bg-accent text-accent-fg shadow`,children:(0,E.jsx)(b,{size:16})})]},n))}),H.errors&&H.errors.length>0&&U===`choose`&&(0,E.jsx)(`p`,{className:`text-[12.5px] text-rose-600 dark:text-rose-300`,children:m(H.errors[0])}),P!==null&&U===`choose`&&(0,E.jsxs)(`div`,{className:`space-y-1.5 pt-1`,children:[(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null,onClick:()=>void q(`choose`,()=>g.avatarChoose(H.session,P)),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`w-full rounded-full py-3`),children:[I===`choose`?(0,E.jsx)(f,{size:16,className:`animate-spin`}):(0,E.jsx)(b,{size:16}),` `,m(`Use this one`)]}),(0,E.jsx)(`p`,{className:`text-center text-[12px] leading-snug text-muted`,children:m(`Next, its poses are drawn from it in the background: working, waiting for you, done, something wrong.`)})]}),U===`choose`&&(0,E.jsx)(`button`,{type:`button`,disabled:I!==null,onClick:()=>void q(`cancel`,()=>g.avatarCancel(H.session)),className:`w-full py-1 text-center text-[13px] text-muted`,children:m(`Keep the current look`)})]}),U===`failed`&&H&&(0,E.jsxs)(`section`,{className:`rounded-3xl border border-border/70 bg-surface p-4 shadow-sm space-y-2`,children:[(0,E.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:m(`That did not work`)}),(0,E.jsx)(`p`,{className:`text-[13px] text-muted`,children:m(H.message||`Nothing came back.`)}),(0,E.jsxs)(`button`,{type:`button`,disabled:I!==null,onClick:()=>void q(`retry`,()=>g.avatarStart(H.session)),className:e(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`rounded-full`),children:[(0,E.jsx)(ee,{size:14}),` `,m(`Try again`)]})]}),(0,E.jsx)(`p`,{className:`px-1 text-[12px] leading-snug text-muted`,children:m(`The pictures stay in this computer's workspace under avatar/. Each new look asks your provider for eight pictures (four to choose from and four poses) and four short clips where there is a video model.`)}),(0,E.jsx)(`p`,{className:`px-1 text-[12px] leading-snug text-muted`,children:(0,E.jsx)(`button`,{type:`button`,onClick:()=>{u(m(`Change your avatar to `)),a(`chat`)},className:`font-medium text-accent`,children:m(`Or just say it in the chat: “change your avatar to a corgi”.`)})})]})]})}function ie(e,t){return e?/dashscope|aliyuncs/.test(e)?t(`Alibaba Cloud Bailian`):/openai\.com/.test(e)?`OpenAI`:/deepseek/.test(e)?`DeepSeek`:/moonshot/.test(e)?`Moonshot`:/bigmodel|zhipu/.test(e)?t(`Zhipu`):/siliconflow/.test(e)?`SiliconFlow`:/volces|ark/.test(e)?t(`Volcano Ark`):/openrouter/.test(e)?`OpenRouter`:/googleapis/.test(e)?`Gemini`:/x\.ai/.test(e)?`xAI`:/^(127\.0\.0\.1|localhost)/.test(e)?t(`this computer`):e:`—`}function j({label:t,onClick:n,danger:r=!1}){return(0,E.jsx)(`button`,{type:`button`,onClick:n,className:e(`block w-full px-4 py-2.5 text-left hover:bg-surface-2`,r?`text-rose-600 dark:text-rose-300`:``),children:t})}function ae({avatar:e,emoji:n,color:r,name:i}){let a=t(),[o,s]=(0,T.useState)(0),l=D[o%D.length],f=(0,T.useRef)(0);(0,T.useEffect)(()=>(f.current=window.setTimeout(()=>s(e=>(e+1)%D.length),l===`idle`?2600:2e3),()=>window.clearTimeout(f.current)),[o,l]);let p=c(e),g=!p&&e?e:null,_=p?m(l):g?h(g,l):``,v=p?d(l):g?u(g,l):null,[y,b]=(0,T.useState)(()=>new Set),x=v&&!y.has(v)?v:null;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:`avatar-pop h-[148px] w-[148px] overflow-hidden rounded-full`,style:_?{background:`#f1efeb`}:{background:`linear-gradient(135deg, ${r??`#0064d4`}, color-mix(in srgb, ${r??`#0064d4`} 60%, #ffffff))`},children:x?(0,E.jsx)(`video`,{src:x,poster:_,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,disablePictureInPicture:!0,onError:()=>b(e=>new Set(e).add(x)),className:`h-full w-full object-cover`},x):_?(0,E.jsx)(`img`,{src:_,alt:``,draggable:!1,className:`h-full w-full object-cover`}):(0,E.jsx)(`span`,{className:`flex h-full w-full items-center justify-center text-[64px] leading-none`,children:n??`✨`})},e),(0,E.jsx)(`div`,{className:`mt-3 text-[20px] font-semibold tracking-tight`,children:i}),(0,E.jsx)(`div`,{className:`mt-1 text-[13px] text-muted`,children:a(O[l])})]})}export{A as AvatarStudioScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/BackBar-Dli0L0O_.js b/nanomuse/server/static/assets/BackBar-Dl56jHZM.js
similarity index 92%
rename from nanomuse/server/static/assets/BackBar-Dli0L0O_.js
rename to nanomuse/server/static/assets/BackBar-Dl56jHZM.js
index 650184c79..b084e5e81 100644
--- a/nanomuse/server/static/assets/BackBar-Dli0L0O_.js
+++ b/nanomuse/server/static/assets/BackBar-Dl56jHZM.js
@@ -1 +1 @@
-import{K as e,b as t,f as n,r}from"./MuseHeader-Pw-NI98v.js";import{Dt as i}from"./index-BjYzdKkG.js";var a=t();function o({title:t,description:o,actions:s,onBack:c,backLabel:l}){let{setTab:u}=n(),d=e();return(0,a.jsxs)(`header`,{className:`safe-top shrink-0`,children:[(0,a.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-3`,children:[(0,a.jsx)(`div`,{className:`absolute left-3 top-1/2 -translate-y-1/2`,children:(0,a.jsx)(r,{small:!0,onClick:c??(()=>u(`chat`)),label:l??d(`Back`),children:(0,a.jsx)(i,{size:20})})}),(0,a.jsx)(`h1`,{className:`max-w-[calc(100%-128px)] truncate text-[17px] font-semibold leading-[22px]`,children:t}),s&&(0,a.jsx)(`div`,{className:`absolute right-3 top-1/2 flex -translate-y-1/2 items-center gap-2`,children:s})]}),o&&(0,a.jsx)(`p`,{className:`px-5 pb-2 text-[13px] leading-[18px] text-muted`,children:o})]})}export{o as t};
\ No newline at end of file
+import{K as e,b as t,f as n,r}from"./MuseHeader-Pw-NI98v.js";import{Dt as i}from"./index-CIdGZ5PB.js";var a=t();function o({title:t,description:o,actions:s,onBack:c,backLabel:l}){let{setTab:u}=n(),d=e();return(0,a.jsxs)(`header`,{className:`safe-top shrink-0`,children:[(0,a.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-3`,children:[(0,a.jsx)(`div`,{className:`absolute left-3 top-1/2 -translate-y-1/2`,children:(0,a.jsx)(r,{small:!0,onClick:c??(()=>u(`chat`)),label:l??d(`Back`),children:(0,a.jsx)(i,{size:20})})}),(0,a.jsx)(`h1`,{className:`max-w-[calc(100%-128px)] truncate text-[17px] font-semibold leading-[22px]`,children:t}),s&&(0,a.jsx)(`div`,{className:`absolute right-3 top-1/2 flex -translate-y-1/2 items-center gap-2`,children:s})]}),o&&(0,a.jsx)(`p`,{className:`px-5 pb-2 text-[13px] leading-[18px] text-muted`,children:o})]})}export{o as t};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/ChannelsScreen-Bt6eBqvc.js b/nanomuse/server/static/assets/ChannelsScreen-mBzj7BLf.js
similarity index 99%
rename from nanomuse/server/static/assets/ChannelsScreen-Bt6eBqvc.js
rename to nanomuse/server/static/assets/ChannelsScreen-mBzj7BLf.js
index eb8c6755e..c43a8d030 100644
--- a/nanomuse/server/static/assets/ChannelsScreen-Bt6eBqvc.js
+++ b/nanomuse/server/static/assets/ChannelsScreen-mBzj7BLf.js
@@ -1,2 +1,2 @@
-import{E as e,J as t,K as n,Q as r,Y as i,b as a,f as o,q as s,w as c}from"./MuseHeader-Pw-NI98v.js";import{n as l,t as u}from"./external-link-Xj5fjR8v.js";import{a as d,i as f,o as p,r as m}from"./Form-DwKuBk1V.js";import{t as h}from"./refresh-cw-BKgIzslL.js";import{C as g,V as _,Y as v,a as y,at as b,c as x,i as S,l as C,o as w,s as T}from"./index-BjYzdKkG.js";import{t as E}from"./BackBar-Dli0L0O_.js";var D=t(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),O=r(i(),1),k=(e,t)=>({method:e,body:JSON.stringify(t)}),A=encodeURIComponent,j={view:()=>c(`/api/channels`),update:(e,t)=>c(`/api/channels/${A(e)}`,k(`PUT`,t)),reload:()=>c(`/api/channels/reload`,{method:`POST`}),test:(e,t=``)=>c(`/api/channels/${A(e)}/test`,k(`POST`,{chat_id:t})),approve:e=>c(`/api/channels/pairing/${A(e)}/approve`,{method:`POST`}),deny:e=>c(`/api/channels/pairing/${A(e)}/deny`,{method:`POST`}),setDeliver:(e,t,n)=>c(`/api/channels/${A(e)}/chats/${A(t)}`,k(`PUT`,{deliver:n})),removeChat:(e,t)=>c(`/api/channels/${A(e)}/chats/${A(t)}`,{method:`DELETE`}),loginBegin:(e,t)=>c(`/api/channels/${A(e)}/login`,k(`POST`,{domain:t})),loginPoll:(e,t)=>c(`/api/channels/${A(e)}/login/${A(t)}`),deliver:e=>c(`/api/channels/deliver`,k(`POST`,{text:e}))},M=a(),N={feishu:[`In the Feishu developer console create a custom app and add the Bot capability.`,`Permissions: im:message, im:message.p2p_msg:readonly, im:message.group_at_msg:readonly, im:resource.`,`Events & callbacks: subscription mode Long connection; add im.message.receive_v1; callback mode Long connection; add card.action.trigger.`,`Copy App ID and App Secret from Credentials & Basic Info, then publish a version.`],dingtalk:[`In the DingTalk developer console create an internal app and add the Robot capability.`,`Set the message receive mode to Stream.`,`Copy Client ID (AppKey) and Client Secret (AppSecret) from Credentials & Basic Info.`,`Add the robot send-message permission and publish the version.`],wecom:[`In the WeCom admin console open Intelligent robot and create a robot in API mode with a long connection.`,`Copy the Bot ID and Secret.`,`Add the robot to the chats where it should listen.`],telegram:[`In Telegram talk to @BotFather, send /newbot and copy the token.`,`Direct messages work at once. For a group, add the bot to it; with Group Privacy on it only hears @-mentions and replies.`,`If api.telegram.org is out of reach from this computer, set a proxy below.`]},P={telegram:(0,M.jsx)(v,{size:20})};function F(e,t){let n=t.status.state;return e(n===`off`?`Off`:n===`unconfigured`?`Needs settings`:n===`missing_sdk`?`Not installed`:n===`connecting`?`Connecting…`:n===`connected`?`Connected`:`Error`)}function I({state:t}){return(0,M.jsx)(`span`,{"aria-hidden":!0,className:e(`inline-block h-2 w-2 rounded-full`,t===`connected`?`bg-emerald-500`:t===`error`?`bg-red-500`:t===`connecting`?`bg-amber-400`:`bg-border`)})}function L(){let{toast:e}=o(),t=n(),[r,i]=(0,O.useState)(null),[a,c]=(0,O.useState)(null),l=async()=>{try{i(await j.view()),c(null)}catch(e){c(e.message||`Could not load.`)}};(0,O.useEffect)(()=>{l();let e=window.setInterval(()=>void l(),5e3),t=()=>void l();return window.addEventListener(`focus`,t),()=>{window.clearInterval(e),window.removeEventListener(`focus`,t)}},[]);let u=async(t,n)=>{try{i(await t()),n&&e(n)}catch(t){e(t.message)}};return(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsx)(E,{title:t(`Chat apps`),description:t(`Talk to your Muse from the chat apps you already use. Nothing needs a public address: each app keeps a long connection open.`)}),(0,M.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-8`,children:[r===null&&a&&(0,M.jsx)(g,{message:a,onRetry:()=>void l()}),r===null&&!a&&(0,M.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,M.jsx)(s,{className:`animate-spin`,size:20})}),r&&r.pending.length>0&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(x,{children:t(`Waiting for a yes`)}),(0,M.jsx)(y,{children:r.pending.map((e,t)=>(0,M.jsxs)(`div`,{children:[t>0&&(0,M.jsx)(w,{inset:16}),(0,M.jsx)(R,{p:e,label:r.channels.find(t=>t.name===e.channel)?.label??e.channel,onApprove:()=>u(()=>j.approve(e.code)),onDeny:()=>u(()=>j.deny(e.code))})]},e.code))})]}),r?.channels.map(e=>(0,M.jsx)(z,{c:e,run:u,reload:l},e.name)),r&&(0,M.jsx)(S,{children:t(`Each chat is one conversation of your Muse; its replies stream back as they are written.`)})]})]})}function R({p:t,label:r,onApprove:i,onDeny:a}){let o=n(),s=t.sender_name||t.sender_id;return(0,M.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`p`,{className:`truncate text-[15px]`,children:o(`{name} wrote to the bot. Approve to let them talk to your Muse.`,{name:`${s} · ${r}`})}),(0,M.jsx)(`p`,{className:`text-[13px] text-muted`,children:o(`Code {code}`,{code:t.code})})]}),(0,M.jsxs)(`button`,{type:`button`,className:e(f,`px-3 py-2`),onClick:i,"aria-label":o(`Approve`),children:[(0,M.jsx)(l,{size:16}),` `,o(`Approve`)]}),(0,M.jsx)(`button`,{type:`button`,className:e(d,`px-3 py-2`),onClick:a,"aria-label":o(`Deny`),children:(0,M.jsx)(p,{size:16})})]})}function z({c:t,run:r,reload:i}){let a=n(),{toast:s}=o(),[c,l]=(0,O.useState)(!1),[d,f]=(0,O.useState)({}),[p,m]=(0,O.useState)([]),[g,v]=(0,O.useState)(null),[E,k]=(0,O.useState)(!1),[A,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)(!1),[V,H]=(0,O.useState)(null),[U,W]=(0,O.useState)(``),[G,K]=(0,O.useState)(!1),q=(0,O.useRef)(null),J=Object.keys(d).length>0||g!==null,Y=g??t.allow_from.join(`
+import{E as e,J as t,K as n,Q as r,Y as i,b as a,f as o,q as s,w as c}from"./MuseHeader-Pw-NI98v.js";import{n as l,t as u}from"./external-link-Xj5fjR8v.js";import{a as d,i as f,o as p,r as m}from"./Form-DwKuBk1V.js";import{t as h}from"./refresh-cw-BKgIzslL.js";import{C as g,V as _,Y as v,a as y,at as b,c as x,i as S,l as C,o as w,s as T}from"./index-CIdGZ5PB.js";import{t as E}from"./BackBar-Dl56jHZM.js";var D=t(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),O=r(i(),1),k=(e,t)=>({method:e,body:JSON.stringify(t)}),A=encodeURIComponent,j={view:()=>c(`/api/channels`),update:(e,t)=>c(`/api/channels/${A(e)}`,k(`PUT`,t)),reload:()=>c(`/api/channels/reload`,{method:`POST`}),test:(e,t=``)=>c(`/api/channels/${A(e)}/test`,k(`POST`,{chat_id:t})),approve:e=>c(`/api/channels/pairing/${A(e)}/approve`,{method:`POST`}),deny:e=>c(`/api/channels/pairing/${A(e)}/deny`,{method:`POST`}),setDeliver:(e,t,n)=>c(`/api/channels/${A(e)}/chats/${A(t)}`,k(`PUT`,{deliver:n})),removeChat:(e,t)=>c(`/api/channels/${A(e)}/chats/${A(t)}`,{method:`DELETE`}),loginBegin:(e,t)=>c(`/api/channels/${A(e)}/login`,k(`POST`,{domain:t})),loginPoll:(e,t)=>c(`/api/channels/${A(e)}/login/${A(t)}`),deliver:e=>c(`/api/channels/deliver`,k(`POST`,{text:e}))},M=a(),N={feishu:[`In the Feishu developer console create a custom app and add the Bot capability.`,`Permissions: im:message, im:message.p2p_msg:readonly, im:message.group_at_msg:readonly, im:resource.`,`Events & callbacks: subscription mode Long connection; add im.message.receive_v1; callback mode Long connection; add card.action.trigger.`,`Copy App ID and App Secret from Credentials & Basic Info, then publish a version.`],dingtalk:[`In the DingTalk developer console create an internal app and add the Robot capability.`,`Set the message receive mode to Stream.`,`Copy Client ID (AppKey) and Client Secret (AppSecret) from Credentials & Basic Info.`,`Add the robot send-message permission and publish the version.`],wecom:[`In the WeCom admin console open Intelligent robot and create a robot in API mode with a long connection.`,`Copy the Bot ID and Secret.`,`Add the robot to the chats where it should listen.`],telegram:[`In Telegram talk to @BotFather, send /newbot and copy the token.`,`Direct messages work at once. For a group, add the bot to it; with Group Privacy on it only hears @-mentions and replies.`,`If api.telegram.org is out of reach from this computer, set a proxy below.`]},P={telegram:(0,M.jsx)(v,{size:20})};function F(e,t){let n=t.status.state;return e(n===`off`?`Off`:n===`unconfigured`?`Needs settings`:n===`missing_sdk`?`Not installed`:n===`connecting`?`Connecting…`:n===`connected`?`Connected`:`Error`)}function I({state:t}){return(0,M.jsx)(`span`,{"aria-hidden":!0,className:e(`inline-block h-2 w-2 rounded-full`,t===`connected`?`bg-emerald-500`:t===`error`?`bg-red-500`:t===`connecting`?`bg-amber-400`:`bg-border`)})}function L(){let{toast:e}=o(),t=n(),[r,i]=(0,O.useState)(null),[a,c]=(0,O.useState)(null),l=async()=>{try{i(await j.view()),c(null)}catch(e){c(e.message||`Could not load.`)}};(0,O.useEffect)(()=>{l();let e=window.setInterval(()=>void l(),5e3),t=()=>void l();return window.addEventListener(`focus`,t),()=>{window.clearInterval(e),window.removeEventListener(`focus`,t)}},[]);let u=async(t,n)=>{try{i(await t()),n&&e(n)}catch(t){e(t.message)}};return(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsx)(E,{title:t(`Chat apps`),description:t(`Talk to your Muse from the chat apps you already use. Nothing needs a public address: each app keeps a long connection open.`)}),(0,M.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-8`,children:[r===null&&a&&(0,M.jsx)(g,{message:a,onRetry:()=>void l()}),r===null&&!a&&(0,M.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,M.jsx)(s,{className:`animate-spin`,size:20})}),r&&r.pending.length>0&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(x,{children:t(`Waiting for a yes`)}),(0,M.jsx)(y,{children:r.pending.map((e,t)=>(0,M.jsxs)(`div`,{children:[t>0&&(0,M.jsx)(w,{inset:16}),(0,M.jsx)(R,{p:e,label:r.channels.find(t=>t.name===e.channel)?.label??e.channel,onApprove:()=>u(()=>j.approve(e.code)),onDeny:()=>u(()=>j.deny(e.code))})]},e.code))})]}),r?.channels.map(e=>(0,M.jsx)(z,{c:e,run:u,reload:l},e.name)),r&&(0,M.jsx)(S,{children:t(`Each chat is one conversation of your Muse; its replies stream back as they are written.`)})]})]})}function R({p:t,label:r,onApprove:i,onDeny:a}){let o=n(),s=t.sender_name||t.sender_id;return(0,M.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`p`,{className:`truncate text-[15px]`,children:o(`{name} wrote to the bot. Approve to let them talk to your Muse.`,{name:`${s} · ${r}`})}),(0,M.jsx)(`p`,{className:`text-[13px] text-muted`,children:o(`Code {code}`,{code:t.code})})]}),(0,M.jsxs)(`button`,{type:`button`,className:e(f,`px-3 py-2`),onClick:i,"aria-label":o(`Approve`),children:[(0,M.jsx)(l,{size:16}),` `,o(`Approve`)]}),(0,M.jsx)(`button`,{type:`button`,className:e(d,`px-3 py-2`),onClick:a,"aria-label":o(`Deny`),children:(0,M.jsx)(p,{size:16})})]})}function z({c:t,run:r,reload:i}){let a=n(),{toast:s}=o(),[c,l]=(0,O.useState)(!1),[d,f]=(0,O.useState)({}),[p,m]=(0,O.useState)([]),[g,v]=(0,O.useState)(null),[E,k]=(0,O.useState)(!1),[A,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)(!1),[V,H]=(0,O.useState)(null),[U,W]=(0,O.useState)(``),[G,K]=(0,O.useState)(!1),q=(0,O.useRef)(null),J=Object.keys(d).length>0||g!==null,Y=g??t.allow_from.join(`
`),X=async()=>{k(!0);try{let e={},n={};for(let[e,r]of Object.entries(d))(t.fields.find(t=>t.key===e)?.kind!==`secret`||r!==``||p.includes(e))&&(n[e]=r);Object.keys(n).length&&(e.settings=n),g!==null&&(e.allow_from=g.split(/[\n,]/).map(e=>e.trim()).filter(Boolean)),await r(()=>j.update(t.name,e),a(`Saved.`)),f({}),m([]),v(null)}finally{k(!1)}},Z=async()=>{L(!0);try{let e=await j.test(t.name);s(e.detail)}catch(e){s(e.message)}finally{L(!1)}},Q=()=>{q.current!==null&&window.clearTimeout(q.current),q.current=null};(0,O.useEffect)(()=>Q,[]);let $=async()=>{W(``);try{let e=await j.loginBegin(t.name,G?`lark`:`feishu`);H(e);let n=Date.now(),r=async()=>{try{let r=await j.loginPoll(t.name,e.device_code);if(r.status===`succeeded`){H(null),W(a(`The bot was created and is connecting.`)),await i();return}if(r.status===`failed`||Date.now()-n>e.expires_in*1e3){H(null),W(a(`The login did not finish ({error}).`,{error:r.error??`expired`}));return}}catch(e){H(null),W(e.message);return}q.current=window.setTimeout(()=>void r(),Math.max(2,e.interval)*1e3)};q.current=window.setTimeout(()=>void r(),Math.max(2,e.interval)*1e3)}catch(e){s(e.message)}},ee=()=>{Q(),H(null)},te=t.fields.filter(e=>e.required&&(e.kind===`secret`?!e.has_value:!e.value)).map(e=>e.label);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(x,{children:t.label}),(0,M.jsxs)(y,{children:[(0,M.jsx)(T,{icon:P[t.name]??(0,M.jsx)(b,{size:20}),label:t.label,value:F(a,t),trailing:(0,M.jsx)(I,{state:t.status.state}),onClick:()=>l(e=>!e)}),(0,M.jsx)(w,{}),(0,M.jsx)(C,{label:a(`Switched on`),checked:t.enabled,disabled:!t.sdk_available&&!t.enabled,onChange:e=>void r(()=>j.update(t.name,{enabled:e}))}),t.status.state===`error`&&t.status.detail&&(0,M.jsx)(`p`,{className:`px-4 pb-3 text-[13px] leading-[18px] text-red-600 dark:text-red-400`,children:t.status.detail}),t.status.state===`unconfigured`&&(0,M.jsxs)(`p`,{className:`px-4 pb-3 text-[13px] leading-[18px] text-muted`,children:[a(`Missing`),`: `,t.status.detail||te.join(`, `)]}),!t.sdk_available&&(0,M.jsxs)(`div`,{className:`px-4 pb-3 text-[13px] leading-[18px] text-muted`,children:[a(`Install on the computer running nanoMuse, then switch it on again:`),(0,M.jsx)(`code`,{className:`mt-1 block select-all rounded-lg bg-surface-2 px-2 py-1 text-[12.5px] text-fg`,children:t.install})]}),(c||t.enabled)&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(w,{inset:16}),(0,M.jsxs)(`div`,{className:`space-y-3 px-4 py-3`,children:[t.fields.map(e=>(0,M.jsx)(B,{f:e,value:d[e.key],onChange:t=>{f(n=>({...n,[e.key]:t})),t!==``&&m(t=>t.filter(t=>t!==e.key))},onClear:()=>{f(t=>({...t,[e.key]:``})),m(t=>t.includes(e.key)?t:[...t,e.key])}},e.key)),(0,M.jsxs)(`label`,{className:`block`,children:[(0,M.jsx)(`span`,{className:`mb-1 block text-[13px] text-muted`,children:a(`In groups, reply`)}),(0,M.jsxs)(`select`,{className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,value:t.group_policy,onChange:e=>void r(()=>j.update(t.name,{group_policy:e.target.value})),children:[(0,M.jsx)(`option`,{value:`mention`,children:a(`only when @-mentioned`)}),(0,M.jsx)(`option`,{value:`open`,children:a(`to every message`)})]})]}),(0,M.jsxs)(`label`,{className:`block`,children:[(0,M.jsx)(`span`,{className:`mb-1 block text-[13px] text-muted`,children:a(`Always allowed (ids, one per line)`)}),(0,M.jsx)(`textarea`,{className:e(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`min-h-[56px] font-mono text-[13px]`),value:Y,onChange:e=>v(e.target.value),rows:2}),(0,M.jsx)(`span`,{className:`mt-1 block text-[12.5px] leading-[17px] text-muted`,children:a(`People listed here never need a pairing code. A lone * lets anyone in; do that only on a bot nobody else can reach.`)})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,M.jsx)(`button`,{type:`button`,className:`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,disabled:!J||E,onClick:()=>void X(),children:a(E?`Saving`:`Save`)}),(0,M.jsxs)(`button`,{type:`button`,className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,disabled:A||t.status.state!==`connected`,onClick:()=>void Z(),children:[(0,M.jsx)(h,{size:14,className:A?`animate-spin`:``}),` `,a(A?`Sending`:`Send a test message`)]}),t.name===`feishu`&&!V&&(0,M.jsxs)(`button`,{type:`button`,className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,onClick:()=>void $(),children:[(0,M.jsx)(D,{size:14}),` `,a(`Create the bot by QR code`)]}),(0,M.jsx)(`button`,{type:`button`,className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,onClick:()=>z(e=>!e),"aria-expanded":R,children:a(`Set up`)})]}),t.name===`feishu`&&!V&&(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px] text-muted`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:G,onChange:e=>K(e.target.checked)}),a(`Lark (international) instead of 飞书`)]}),V&&(0,M.jsxs)(`div`,{className:`rounded-2xl bg-surface-2 p-3 text-center`,children:[V.qr_png?(0,M.jsx)(`img`,{src:`data:image/png;base64,${V.qr_png}`,alt:`QR`,className:`mx-auto h-44 w-44 rounded-lg bg-white p-1`}):null,(0,M.jsx)(`p`,{className:`mt-2 text-[13px] text-muted`,children:a(`Scan with Feishu, confirm the new bot, and the App ID and Secret are saved for you.`)}),(0,M.jsx)(`p`,{className:`text-[13px] text-muted`,children:a(`Waiting for the scan…`)}),(0,M.jsxs)(`div`,{className:`mt-2 flex justify-center gap-2`,children:[(0,M.jsxs)(`a`,{href:V.url,target:`_blank`,rel:`noreferrer`,className:e(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`px-3 py-1.5`),children:[(0,M.jsx)(u,{size:14}),` `,a(`Open in Feishu`)]}),(0,M.jsx)(`button`,{type:`button`,className:e(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`px-3 py-1.5`),onClick:ee,children:a(`Cancel`)})]})]}),U&&(0,M.jsx)(`p`,{className:`text-[13px] text-muted`,children:U}),R&&(0,M.jsxs)(`div`,{className:`rounded-2xl bg-surface-2 p-3 text-[13.5px] leading-[19px]`,children:[(0,M.jsx)(`ol`,{className:`list-decimal space-y-1 pl-5`,children:(N[t.name]??[]).map(e=>(0,M.jsx)(`li`,{children:a(e)},e))}),(0,M.jsxs)(`p`,{className:`mt-2 text-muted`,children:[a(`Then write to the bot from the app. The first message gets a pairing code; approve it here or run`),` `,(0,M.jsx)(`code`,{className:`rounded bg-surface px-1`,children:`nanomuse channels approve `})]}),t.console_url&&(0,M.jsxs)(`a`,{href:t.console_url,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-accent underline-offset-2 hover:underline`,children:[(0,M.jsx)(u,{size:14}),` `,a(`Open the console`)]})]})]}),(0,M.jsx)(w,{inset:16}),(0,M.jsx)(`p`,{className:`px-4 pt-3 text-[13px] text-muted`,children:a(`Paired chats`)}),t.paired.length===0?(0,M.jsx)(`p`,{className:`px-4 pb-3 pt-1 text-[13px] leading-[18px] text-muted`,children:a(`Nobody yet. Write to the bot from the app; a pairing code comes back, approve it here.`)}):t.paired.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center`,children:[(0,M.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,M.jsx)(C,{label:e.sender_name||e.sender_id,value:a(`Deliver here`),checked:e.deliver,onChange:n=>void r(()=>j.setDeliver(t.name,e.sender_id,n))})}),(0,M.jsx)(`button`,{type:`button`,className:`mr-3 rounded-full p-2 text-muted hover:bg-surface-2`,"aria-label":a(`Remove`),onClick:()=>{window.confirm(a(`Remove {name}? They will need a new pairing code.`,{name:e.sender_name||e.sender_id}))&&r(()=>j.removeChat(t.name,e.sender_id))},children:(0,M.jsx)(_,{size:16})})]},e.sender_id))]})]}),(c||t.enabled)&&t.paired.length>0&&(0,M.jsx)(S,{children:a(`Chats with “deliver here” on also get what the Muse does on its own: check-ins, reminders, the results of background work, and the questions it needs answered.`)})]})}function B({f:t,value:r,onChange:i,onClear:a}){let o=n();if(t.kind===`choice`)return(0,M.jsxs)(`label`,{className:`block`,children:[(0,M.jsx)(`span`,{className:`mb-1 block text-[13px] text-muted`,children:t.label}),(0,M.jsx)(`select`,{className:m,value:r??String(t.value??t.default),onChange:e=>i(e.target.value),children:t.choices.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))}),t.help&&(0,M.jsx)(`span`,{className:`mt-1 block text-[12.5px] text-muted`,children:t.help})]});let s=t.kind===`secret`;return(0,M.jsxs)(`label`,{className:`block`,children:[(0,M.jsxs)(`span`,{className:`mb-1 block text-[13px] text-muted`,children:[t.label,t.required?` *`:``]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(`input`,{type:s?`password`:`text`,autoComplete:`off`,className:m,value:r??(s?``:String(t.value??``)),placeholder:s&&t.has_value?o(`Set; leave blank to keep`):t.help,onChange:e=>i(e.target.value)}),s&&t.has_value&&(0,M.jsx)(`button`,{type:`button`,className:e(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`shrink-0 px-3`),onClick:a,title:o(`Clear the saved value`),"aria-label":o(`Clear the saved value`),children:(0,M.jsx)(p,{size:14})})]}),t.help&&!s&&(0,M.jsx)(`span`,{className:`mt-1 block text-[12.5px] text-muted`,children:t.help})]})}export{L as ChannelsScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/CloudCard-CdydxD3H.js b/nanomuse/server/static/assets/CloudCard-CtVHK0qc.js
similarity index 97%
rename from nanomuse/server/static/assets/CloudCard-CdydxD3H.js
rename to nanomuse/server/static/assets/CloudCard-CtVHK0qc.js
index fd11cb7bb..312716703 100644
--- a/nanomuse/server/static/assets/CloudCard-CdydxD3H.js
+++ b/nanomuse/server/static/assets/CloudCard-CtVHK0qc.js
@@ -1 +1 @@
-import{K as e,Q as t,Y as n,b as r,f as i,q as a,x as o}from"./MuseHeader-Pw-NI98v.js";import{a as s,t as c}from"./Form-DwKuBk1V.js";import{ct as l,l as u,t as d,vt as f}from"./index-BjYzdKkG.js";var p=t(n(),1),m=r();function h({account:t,onChange:n,compact:r=!1,useAsModel:h=!1}){let{toast:_}=i(),v=e(),[y,b]=(0,p.useState)(r||!t?.signed_in),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),T=!!t?.signed_in,E=async()=>{S(`model`),w(null);try{await o.cloudUseAsModel(),_(v(`The Cloud model is in use.`)),n()}catch(e){w(v(e.message))}finally{S(null)}},D=t?.models!==!1,O=async e=>{S(`switch`),w(null);try{await o.cloudModels(e),n()}catch(e){w(v(e.message))}finally{S(null)}},k=async()=>{if(window.confirm(v(`Sign out of nanoMuse Cloud on this device? The hub and the Cloud model stop working here until you sign in again.`))){S(`out`);try{await o.cloudSignOut(),n()}catch(e){_(e.message)}finally{S(null)}}},A=T?{text:v(`Signed in`),tone:`ok`}:{text:v(`Not signed in`),tone:`off`},j=T?t?.is_model?v(`{hint} · model and hub`,{hint:t.hint}):v(`{hint} · hub`,{hint:t?.hint??``}):v(`Free. One account for all your devices, and a model to start with.`);return(0,m.jsx)(c,{icon:(0,m.jsx)(f,{size:20}),title:v(`nanoMuse Cloud`),summary:j,status:A,open:y,onToggle:r?void 0:()=>b(e=>!e),children:T?(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`p`,{className:`text-[13px] text-muted leading-relaxed`,children:v(`Signed in as {hint}. Your devices meet here; the Cloud model comes with a free allowance.`,{hint:t?.hint??``})}),(0,m.jsx)(`div`,{className:`-mx-4 border-y border-border/60`,children:(0,m.jsx)(u,{label:v(`Use nanoMuse Cloud models`),checked:D,disabled:x!==null,onChange:e=>void O(e)})}),(0,m.jsx)(`p`,{className:`text-[12.5px] text-muted leading-relaxed`,children:v(D?`nanoMuse Cloud is one of the sources for the chat, the hands, pictures and clips; what runs on it comes off your allowance.`:`Off: nothing runs on nanoMuse Cloud unless you choose it yourself. You stay signed in for sync and your devices.`)}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!t?.is_model&&(0,m.jsxs)(`button`,{type:`button`,disabled:x!==null,onClick:()=>void E(),className:`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,children:[x===`model`?(0,m.jsx)(a,{size:15,className:`animate-spin`}):null,` `,v(`Use the Cloud model`)]}),(0,m.jsxs)(`button`,{type:`button`,disabled:x!==null,onClick:()=>void k(),className:s,children:[(0,m.jsx)(l,{size:15}),` `,v(`Sign out`)]})]}),C&&(0,m.jsx)(g,{text:C})]}):(0,m.jsx)(d,{useAsModel:h,autoFocus:!1,onSignedIn:()=>{_(v(`Signed in to nanoMuse Cloud.`)),n()}})})}function g({text:e}){return(0,m.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:e})}export{h as t};
\ No newline at end of file
+import{K as e,Q as t,Y as n,b as r,f as i,q as a,x as o}from"./MuseHeader-Pw-NI98v.js";import{a as s,t as c}from"./Form-DwKuBk1V.js";import{ct as l,l as u,t as d,vt as f}from"./index-CIdGZ5PB.js";var p=t(n(),1),m=r();function h({account:t,onChange:n,compact:r=!1,useAsModel:h=!1}){let{toast:_}=i(),v=e(),[y,b]=(0,p.useState)(r||!t?.signed_in),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),T=!!t?.signed_in,E=async()=>{S(`model`),w(null);try{await o.cloudUseAsModel(),_(v(`The Cloud model is in use.`)),n()}catch(e){w(v(e.message))}finally{S(null)}},D=t?.models!==!1,O=async e=>{S(`switch`),w(null);try{await o.cloudModels(e),n()}catch(e){w(v(e.message))}finally{S(null)}},k=async()=>{if(window.confirm(v(`Sign out of nanoMuse Cloud on this device? The hub and the Cloud model stop working here until you sign in again.`))){S(`out`);try{await o.cloudSignOut(),n()}catch(e){_(e.message)}finally{S(null)}}},A=T?{text:v(`Signed in`),tone:`ok`}:{text:v(`Not signed in`),tone:`off`},j=T?t?.is_model?v(`{hint} · model and hub`,{hint:t.hint}):v(`{hint} · hub`,{hint:t?.hint??``}):v(`Free. One account for all your devices, and a model to start with.`);return(0,m.jsx)(c,{icon:(0,m.jsx)(f,{size:20}),title:v(`nanoMuse Cloud`),summary:j,status:A,open:y,onToggle:r?void 0:()=>b(e=>!e),children:T?(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`p`,{className:`text-[13px] text-muted leading-relaxed`,children:v(`Signed in as {hint}. Your devices meet here; the Cloud model comes with a free allowance.`,{hint:t?.hint??``})}),(0,m.jsx)(`div`,{className:`-mx-4 border-y border-border/60`,children:(0,m.jsx)(u,{label:v(`Use nanoMuse Cloud models`),checked:D,disabled:x!==null,onChange:e=>void O(e)})}),(0,m.jsx)(`p`,{className:`text-[12.5px] text-muted leading-relaxed`,children:v(D?`nanoMuse Cloud is one of the sources for the chat, the hands, pictures and clips; what runs on it comes off your allowance.`:`Off: nothing runs on nanoMuse Cloud unless you choose it yourself. You stay signed in for sync and your devices.`)}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!t?.is_model&&(0,m.jsxs)(`button`,{type:`button`,disabled:x!==null,onClick:()=>void E(),className:`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,children:[x===`model`?(0,m.jsx)(a,{size:15,className:`animate-spin`}):null,` `,v(`Use the Cloud model`)]}),(0,m.jsxs)(`button`,{type:`button`,disabled:x!==null,onClick:()=>void k(),className:s,children:[(0,m.jsx)(l,{size:15}),` `,v(`Sign out`)]})]}),C&&(0,m.jsx)(g,{text:C})]}):(0,m.jsx)(d,{useAsModel:h,autoFocus:!1,onSignedIn:()=>{_(v(`Signed in to nanoMuse Cloud.`)),n()}})})}function g({text:e}){return(0,m.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:e})}export{h as t};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/CodingScreen-CTT5Jjn2.js b/nanomuse/server/static/assets/CodingScreen-C_tutsx0.js
similarity index 99%
rename from nanomuse/server/static/assets/CodingScreen-CTT5Jjn2.js
rename to nanomuse/server/static/assets/CodingScreen-C_tutsx0.js
index 0b4ec8c48..c7daae17b 100644
--- a/nanomuse/server/static/assets/CodingScreen-CTT5Jjn2.js
+++ b/nanomuse/server/static/assets/CodingScreen-C_tutsx0.js
@@ -1,3 +1,3 @@
-import{E as e,J as t,K as n,Q as r,Y as i,b as a,f as o,k as s,q as c,r as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{a as d,i as f,r as p}from"./Form-DwKuBk1V.js";import{t as m}from"./refresh-cw-BKgIzslL.js";import{Ct as h,F as g,H as _,Tt as v,U as y,Z as b,bt as x,it as S,w as C,z as w}from"./index-BjYzdKkG.js";import{t as T}from"./BackBar-Dli0L0O_.js";var E=t(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),D=r(i(),1),O=a(),k={cursor:{label:`Cursor`,tone:`from-slate-700 to-slate-900`,glyph:`C`},codex:{label:`Codex`,tone:`from-emerald-500 to-teal-700`,glyph:`X`},claude:{label:`Claude Code`,tone:`from-orange-400 to-amber-600`,glyph:`A`}};function A(){let{state:t,toast:r}=o(),i=n(),[a,d]=(0,D.useState)(``),[f,p]=(0,D.useState)(null),[h,g]=(0,D.useState)([]),[_,v]=(0,D.useState)(null),[C,w]=(0,D.useState)(``),[A,M]=(0,D.useState)(!1),[F,V]=(0,D.useState)(null),[H,U]=(0,D.useState)(null),[W,G]=(0,D.useState)(null),K=(0,D.useMemo)(()=>(t.hub?.devices??[]).filter(e=>!e.this&&e.online&&e.kind!==`web`&&(e.actions??[]).includes(`coding.sessions`)),[t.hub?.devices]),q=(0,D.useCallback)(async()=>{M(!0),V(null);try{let[e,t]=await Promise.all([u.coding(a),u.codingSessions({device:a,limit:40})]);p(e.agents),g(e.runs??[]),v(t.sessions)}catch(e){V(e.message),p([]),v([])}finally{M(!1)}},[a]);(0,D.useEffect)(()=>{q()},[q]);let J=Object.values(t.codingLive),Y=J.filter(e=>e.run.status!==`running`).length;(0,D.useEffect)(()=>{Y&&q()},[Y]);let X=(_??[]).filter(e=>(!C||e.agent===C)&&(e.messages>0||e.status===`running`)),Z=(f??[]).filter(e=>e.installed),Q=new Set(J.filter(e=>e.run.status===`running`&&(e.run.device??``)===(a?z(K,a):``)).map(e=>e.run.session_id||e.run.asked_session_id));return(0,O.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,O.jsx)(T,{title:i(`Coding agents`),description:i(`Cursor, Codex and Claude Code: see what they are doing, and tell them things from anywhere.`),actions:(0,O.jsx)(l,{small:!0,onClick:()=>void q(),label:i(`Refresh`),children:(0,O.jsx)(m,{size:18,className:A?`animate-spin`:``})})}),(0,O.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-4`,children:[(K.length>0||a)&&(0,O.jsxs)(`div`,{className:`no-scrollbar -mx-4 flex gap-2 overflow-x-auto px-4`,children:[(0,O.jsx)(R,{active:!a,onClick:()=>d(``),icon:(0,O.jsx)(y,{size:14}),label:t.hub?.device?.name?i(`This one · {name}`,{name:t.hub.device.name}):i(`This computer`)}),K.map(e=>(0,O.jsx)(R,{active:a===e.id,onClick:()=>d(e.id),icon:(0,O.jsx)(S,{size:14}),label:e.name},e.id))]}),f&&(0,O.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:f.map(t=>{let n=k[t.id];return(0,O.jsxs)(`button`,{type:`button`,disabled:!t.installed,onClick:()=>w(e=>e===t.id?``:t.id),className:e(`rounded-3xl border p-3 text-left transition`,C===t.id?`border-accent/40 bg-accent/5`:`border-border/70 bg-surface`,!t.installed&&`opacity-45`),children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(I,{agent:t.id,size:30}),t.running>0&&(0,O.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full bg-emerald-500/12 px-1.5 py-0.5 text-[10.5px] font-semibold text-emerald-700 dark:text-emerald-300`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-500`}),` `,t.running]})]}),(0,O.jsx)(`div`,{className:`mt-2 truncate text-[13.5px] font-semibold`,children:n?.label??t.name}),(0,O.jsx)(`div`,{className:`truncate text-[11.5px] text-muted`,children:t.installed?t.cli?t.version||i(`installed`):i(`chats only`):i(`not found`)})]},t.id)})}),F&&(0,O.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:F}),J.filter(e=>e.run.status===`running`).length>0&&(0,O.jsxs)(`section`,{className:`space-y-2`,children:[(0,O.jsx)(`h2`,{className:`px-1 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:i(`Working now`)}),J.filter(e=>e.run.status===`running`).map(e=>(0,O.jsx)(N,{live:e,onOpen:()=>U({agent:e.run.agent,id:e.run.session_id||e.run.asked_session_id||``})},e.run.id))]}),(0,O.jsxs)(`section`,{className:`space-y-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,O.jsx)(`h2`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted`,children:C?i(`{agent} chats`,{agent:k[C]?.label??C}):i(`Recent chats`)}),Z.some(e=>e.cli)&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>G(C&&Z.find(e=>e.id===C&&e.cli)?C:Z.find(e=>e.cli)?.id??null),className:`flex items-center gap-1 text-[12.5px] font-medium text-accent`,children:[(0,O.jsx)(b,{size:14}),` `,i(`New chat`)]})]}),_===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,O.jsx)(c,{size:20,className:`animate-spin`})}):X.length===0?(0,O.jsx)(`div`,{className:`rounded-3xl border border-dashed border-border/80 px-4 py-8 text-center text-[13.5px] text-muted`,children:f&&f.every(e=>!e.installed)?i(`No coding agent found on this computer. Install Cursor, Codex or Claude Code and their chats appear here.`):i(`No chats yet.`)}):(0,O.jsx)(`ul`,{className:`divide-y divide-border/60 overflow-hidden rounded-3xl border border-border/70 bg-surface`,children:X.map(e=>(0,O.jsx)(`li`,{children:(0,O.jsxs)(`button`,{type:`button`,onClick:()=>U({agent:e.agent,id:e.id}),className:`flex w-full items-center gap-3 px-3.5 py-3 text-left hover:bg-surface-2/60 active:bg-surface-2`,children:[(0,O.jsx)(I,{agent:e.agent,size:34}),(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`truncate text-[14.5px] font-medium`,children:e.title||i(`Untitled chat`)}),(0,O.jsx)(L,{status:Q.has(e.id)?`running`:e.status})]}),(0,O.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 truncate text-[12px] text-muted`,children:[e.workspace&&(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,O.jsx)(E,{size:11}),` `,(0,O.jsx)(`span`,{className:`truncate`,children:B(e.workspace)})]}),(0,O.jsxs)(`span`,{children:[`· `,s(e.updated_at)]}),(0,O.jsxs)(`span`,{children:[`· `,i(`{n} messages`,{n:e.messages})]})]})]}),(0,O.jsx)(x,{size:16,className:`shrink-0 text-muted`})]})},`${e.agent}-${e.id}`))})]}),h.filter(e=>e.status!==`running`).length>0&&(0,O.jsxs)(`section`,{className:`space-y-2`,children:[(0,O.jsx)(`h2`,{className:`px-1 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:i(`Sent through nanoMuse`)}),(0,O.jsx)(`ul`,{className:`divide-y divide-border/60 overflow-hidden rounded-3xl border border-border/70 bg-surface`,children:h.filter(e=>e.status!==`running`).slice(0,8).map(e=>(0,O.jsxs)(`li`,{className:`flex items-center gap-3 px-3.5 py-2.5`,children:[(0,O.jsx)(I,{agent:e.agent,size:28}),(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`span`,{className:`block truncate text-[13.5px]`,children:e.text}),(0,O.jsxs)(`span`,{className:`block truncate text-[11.5px] text-muted`,children:[e.status===`done`?i(`done`):e.status===`failed`?i(`failed`):i(`stopped`),` · `,s(e.started_at),e.tools?` · ${i(`{n} steps`,{n:e.tools})}`:``,e.error?` · ${e.error}`:``]})]}),e.session_id&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>U({agent:e.agent,id:e.session_id}),className:`text-[12.5px] font-medium text-accent`,children:i(`Open`)})]},e.id))})]})]}),H&&(0,O.jsx)(j,{agent:H.agent,id:H.id,device:a,deviceLabel:a?z(K,a):``,onClose:()=>U(null)}),W&&(0,O.jsx)(P,{agent:W,agents:Z.filter(e=>e.cli),device:a,onClose:()=>G(null),onStarted:e=>{G(null),r(i(`Sent to {agent}.`,{agent:k[e.agent]?.label??e.agent}))}})]})}function j({agent:t,id:r,device:i,deviceLabel:a,onClose:s}){let{state:l,toast:d}=o(),f=n(),[m,h]=(0,D.useState)(null),[y,b]=(0,D.useState)(null),[x,S]=(0,D.useState)(``),[w,T]=(0,D.useState)(!1),E=(0,D.useRef)(null),A=(0,D.useCallback)(async()=>{try{h(await u.codingSession(t,r,i)),b(null)}catch(e){b(e.message)}},[t,r,i]);(0,D.useEffect)(()=>{A()},[A]);let j=Object.values(l.codingLive).filter(e=>e.run.agent===t&&(e.run.session_id===r||e.run.asked_session_id===r)),N=j.find(e=>e.run.status===`running`),P=j.filter(e=>e.run.status!==`running`).length;(0,D.useEffect)(()=>{P&&A()},[P]),(0,D.useEffect)(()=>{let e=E.current;e&&(e.scrollTop=e.scrollHeight)},[m?.transcript?.length,N?.events.length,N?.current.length]);let L=async()=>{let e=x.trim();if(e&&!w){T(!0);try{await u.codingSend({agent:t,text:e,session_id:r,workspace:m?.workspace??``,device:i}),S(``)}catch(e){d(e.message)}finally{T(!1)}}},R=k[t],z=m?.transcript??[],V=!!m||!!N,H=!!m&&!m.resumable&&!N;return(0,O.jsx)(C,{open:!0,onClose:s,title:(0,O.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[(0,O.jsx)(I,{agent:t,size:30}),(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:`block truncate`,children:m?.title||R?.label||t}),(0,O.jsxs)(`span`,{className:`block truncate text-[12px] font-normal text-muted`,children:[a?`${a} · `:``,m?.workspace?B(m.workspace):R?.label,m?.source&&m.source!==`ide`&&m.source!==`cli`?` · ${m.source}`:``]})]})]}),footer:(0,O.jsxs)(O.Fragment,{children:[H&&(0,O.jsx)(`p`,{className:`mb-1.5 px-1 text-[11.5px] leading-snug text-muted`,children:f(`Made in the IDE: your message starts a new chat in the same workspace, with the last exchange quoted.`)}),(0,O.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),L()},children:[(0,O.jsx)(`textarea`,{value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},rows:1,disabled:!V||!!N,placeholder:N?f(`{agent} is working…`,{agent:R?.label??t}):m?H?f(`Continue in a new chat…`):f(`Tell {agent}…`,{agent:R?.label??t}):`…`,className:e(p,`max-h-32 min-h-[44px] resize-none py-2.5`)}),N?(0,O.jsx)(`button`,{type:`button`,onClick:()=>void u.codingStop(N.run.id,i).catch(e=>d(e.message)),"aria-label":f(`Stop`),className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-rose-500 text-white`,children:(0,O.jsx)(_,{size:16})}):(0,O.jsx)(`button`,{type:`submit`,disabled:!x.trim()||w||!V,"aria-label":f(`Send`),className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-accent text-white disabled:opacity-40`,children:w?(0,O.jsx)(c,{size:16,className:`animate-spin`}):(0,O.jsx)(v,{size:18})})]})]}),children:(0,O.jsxs)(`div`,{ref:E,className:`space-y-2.5 py-1`,children:[y&&(0,O.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:y}),!m&&!y&&(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,O.jsx)(c,{size:20,className:`animate-spin`})}),z.map((e,n)=>(0,O.jsx)(F,{who:e.role===`user`?`you`:`agent`,agent:t,children:e.role===`user`?(0,O.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e.text}):(0,O.jsx)(g,{text:e.text})},n)),j.filter(e=>!(e.run.status===`done`&&(e.run.resumed||!e.run.asked_session_id)&&z.some(t=>t.role===`user`&&t.text.trim()===e.run.text.trim()))).map(e=>(0,O.jsx)(M,{live:e,agent:t,hideFinishedText:z.length>0&&e.run.status===`done`},e.run.id)),m&&z.length===0&&j.length===0&&(0,O.jsx)(`p`,{className:`py-6 text-center text-[13px] text-muted`,children:f(`Nothing readable in this chat yet.`)})]})})}function M({live:e,agent:t,hideFinishedText:r}){let i=n(),{run:a,events:o,current:s}=e,l=o.filter(e=>e.kind===`tool`),u=k[t];return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(F,{who:`you`,agent:t,badge:i(`via nanoMuse`),children:(0,O.jsx)(`span`,{className:`whitespace-pre-wrap`,children:a.text})}),(l.length>0||a.status===`running`)&&(0,O.jsxs)(`div`,{className:`mx-1 rounded-2xl border border-border/60 bg-surface-2/40 px-3 py-2 text-[12.5px]`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium text-fg/80`,children:[a.status===`running`?(0,O.jsx)(c,{size:13,className:`animate-spin text-accent`}):(0,O.jsx)(w,{size:13,className:`text-muted`}),a.status===`running`?i(`{agent} is working…`,{agent:u?.label??t}):i(`{n} steps`,{n:l.length}),a.device&&(0,O.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-muted`,children:[(0,O.jsx)(S,{size:11}),` `,a.device]})]}),l.length>0&&(0,O.jsx)(`ul`,{className:`mt-1.5 max-h-28 space-y-0.5 overflow-y-auto font-mono text-[11.5px] text-muted`,children:l.slice(-12).map((e,t)=>(0,O.jsx)(`li`,{className:`truncate`,children:e.text},t))})]}),(s||a.output&&!r)&&(0,O.jsxs)(F,{who:`agent`,agent:t,children:[(0,O.jsx)(g,{text:a.status===`running`?(a.output?a.output+`
+import{E as e,J as t,K as n,Q as r,Y as i,b as a,f as o,k as s,q as c,r as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{a as d,i as f,r as p}from"./Form-DwKuBk1V.js";import{t as m}from"./refresh-cw-BKgIzslL.js";import{Ct as h,F as g,H as _,Tt as v,U as y,Z as b,bt as x,it as S,w as C,z as w}from"./index-CIdGZ5PB.js";import{t as T}from"./BackBar-Dl56jHZM.js";var E=t(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),D=r(i(),1),O=a(),k={cursor:{label:`Cursor`,tone:`from-slate-700 to-slate-900`,glyph:`C`},codex:{label:`Codex`,tone:`from-emerald-500 to-teal-700`,glyph:`X`},claude:{label:`Claude Code`,tone:`from-orange-400 to-amber-600`,glyph:`A`}};function A(){let{state:t,toast:r}=o(),i=n(),[a,d]=(0,D.useState)(``),[f,p]=(0,D.useState)(null),[h,g]=(0,D.useState)([]),[_,v]=(0,D.useState)(null),[C,w]=(0,D.useState)(``),[A,M]=(0,D.useState)(!1),[F,V]=(0,D.useState)(null),[H,U]=(0,D.useState)(null),[W,G]=(0,D.useState)(null),K=(0,D.useMemo)(()=>(t.hub?.devices??[]).filter(e=>!e.this&&e.online&&e.kind!==`web`&&(e.actions??[]).includes(`coding.sessions`)),[t.hub?.devices]),q=(0,D.useCallback)(async()=>{M(!0),V(null);try{let[e,t]=await Promise.all([u.coding(a),u.codingSessions({device:a,limit:40})]);p(e.agents),g(e.runs??[]),v(t.sessions)}catch(e){V(e.message),p([]),v([])}finally{M(!1)}},[a]);(0,D.useEffect)(()=>{q()},[q]);let J=Object.values(t.codingLive),Y=J.filter(e=>e.run.status!==`running`).length;(0,D.useEffect)(()=>{Y&&q()},[Y]);let X=(_??[]).filter(e=>(!C||e.agent===C)&&(e.messages>0||e.status===`running`)),Z=(f??[]).filter(e=>e.installed),Q=new Set(J.filter(e=>e.run.status===`running`&&(e.run.device??``)===(a?z(K,a):``)).map(e=>e.run.session_id||e.run.asked_session_id));return(0,O.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,O.jsx)(T,{title:i(`Coding agents`),description:i(`Cursor, Codex and Claude Code: see what they are doing, and tell them things from anywhere.`),actions:(0,O.jsx)(l,{small:!0,onClick:()=>void q(),label:i(`Refresh`),children:(0,O.jsx)(m,{size:18,className:A?`animate-spin`:``})})}),(0,O.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-4`,children:[(K.length>0||a)&&(0,O.jsxs)(`div`,{className:`no-scrollbar -mx-4 flex gap-2 overflow-x-auto px-4`,children:[(0,O.jsx)(R,{active:!a,onClick:()=>d(``),icon:(0,O.jsx)(y,{size:14}),label:t.hub?.device?.name?i(`This one · {name}`,{name:t.hub.device.name}):i(`This computer`)}),K.map(e=>(0,O.jsx)(R,{active:a===e.id,onClick:()=>d(e.id),icon:(0,O.jsx)(S,{size:14}),label:e.name},e.id))]}),f&&(0,O.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:f.map(t=>{let n=k[t.id];return(0,O.jsxs)(`button`,{type:`button`,disabled:!t.installed,onClick:()=>w(e=>e===t.id?``:t.id),className:e(`rounded-3xl border p-3 text-left transition`,C===t.id?`border-accent/40 bg-accent/5`:`border-border/70 bg-surface`,!t.installed&&`opacity-45`),children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsx)(I,{agent:t.id,size:30}),t.running>0&&(0,O.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full bg-emerald-500/12 px-1.5 py-0.5 text-[10.5px] font-semibold text-emerald-700 dark:text-emerald-300`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-500`}),` `,t.running]})]}),(0,O.jsx)(`div`,{className:`mt-2 truncate text-[13.5px] font-semibold`,children:n?.label??t.name}),(0,O.jsx)(`div`,{className:`truncate text-[11.5px] text-muted`,children:t.installed?t.cli?t.version||i(`installed`):i(`chats only`):i(`not found`)})]},t.id)})}),F&&(0,O.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:F}),J.filter(e=>e.run.status===`running`).length>0&&(0,O.jsxs)(`section`,{className:`space-y-2`,children:[(0,O.jsx)(`h2`,{className:`px-1 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:i(`Working now`)}),J.filter(e=>e.run.status===`running`).map(e=>(0,O.jsx)(N,{live:e,onOpen:()=>U({agent:e.run.agent,id:e.run.session_id||e.run.asked_session_id||``})},e.run.id))]}),(0,O.jsxs)(`section`,{className:`space-y-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,O.jsx)(`h2`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted`,children:C?i(`{agent} chats`,{agent:k[C]?.label??C}):i(`Recent chats`)}),Z.some(e=>e.cli)&&(0,O.jsxs)(`button`,{type:`button`,onClick:()=>G(C&&Z.find(e=>e.id===C&&e.cli)?C:Z.find(e=>e.cli)?.id??null),className:`flex items-center gap-1 text-[12.5px] font-medium text-accent`,children:[(0,O.jsx)(b,{size:14}),` `,i(`New chat`)]})]}),_===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,O.jsx)(c,{size:20,className:`animate-spin`})}):X.length===0?(0,O.jsx)(`div`,{className:`rounded-3xl border border-dashed border-border/80 px-4 py-8 text-center text-[13.5px] text-muted`,children:f&&f.every(e=>!e.installed)?i(`No coding agent found on this computer. Install Cursor, Codex or Claude Code and their chats appear here.`):i(`No chats yet.`)}):(0,O.jsx)(`ul`,{className:`divide-y divide-border/60 overflow-hidden rounded-3xl border border-border/70 bg-surface`,children:X.map(e=>(0,O.jsx)(`li`,{children:(0,O.jsxs)(`button`,{type:`button`,onClick:()=>U({agent:e.agent,id:e.id}),className:`flex w-full items-center gap-3 px-3.5 py-3 text-left hover:bg-surface-2/60 active:bg-surface-2`,children:[(0,O.jsx)(I,{agent:e.agent,size:34}),(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`truncate text-[14.5px] font-medium`,children:e.title||i(`Untitled chat`)}),(0,O.jsx)(L,{status:Q.has(e.id)?`running`:e.status})]}),(0,O.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 truncate text-[12px] text-muted`,children:[e.workspace&&(0,O.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,O.jsx)(E,{size:11}),` `,(0,O.jsx)(`span`,{className:`truncate`,children:B(e.workspace)})]}),(0,O.jsxs)(`span`,{children:[`· `,s(e.updated_at)]}),(0,O.jsxs)(`span`,{children:[`· `,i(`{n} messages`,{n:e.messages})]})]})]}),(0,O.jsx)(x,{size:16,className:`shrink-0 text-muted`})]})},`${e.agent}-${e.id}`))})]}),h.filter(e=>e.status!==`running`).length>0&&(0,O.jsxs)(`section`,{className:`space-y-2`,children:[(0,O.jsx)(`h2`,{className:`px-1 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:i(`Sent through nanoMuse`)}),(0,O.jsx)(`ul`,{className:`divide-y divide-border/60 overflow-hidden rounded-3xl border border-border/70 bg-surface`,children:h.filter(e=>e.status!==`running`).slice(0,8).map(e=>(0,O.jsxs)(`li`,{className:`flex items-center gap-3 px-3.5 py-2.5`,children:[(0,O.jsx)(I,{agent:e.agent,size:28}),(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`span`,{className:`block truncate text-[13.5px]`,children:e.text}),(0,O.jsxs)(`span`,{className:`block truncate text-[11.5px] text-muted`,children:[e.status===`done`?i(`done`):e.status===`failed`?i(`failed`):i(`stopped`),` · `,s(e.started_at),e.tools?` · ${i(`{n} steps`,{n:e.tools})}`:``,e.error?` · ${e.error}`:``]})]}),e.session_id&&(0,O.jsx)(`button`,{type:`button`,onClick:()=>U({agent:e.agent,id:e.session_id}),className:`text-[12.5px] font-medium text-accent`,children:i(`Open`)})]},e.id))})]})]}),H&&(0,O.jsx)(j,{agent:H.agent,id:H.id,device:a,deviceLabel:a?z(K,a):``,onClose:()=>U(null)}),W&&(0,O.jsx)(P,{agent:W,agents:Z.filter(e=>e.cli),device:a,onClose:()=>G(null),onStarted:e=>{G(null),r(i(`Sent to {agent}.`,{agent:k[e.agent]?.label??e.agent}))}})]})}function j({agent:t,id:r,device:i,deviceLabel:a,onClose:s}){let{state:l,toast:d}=o(),f=n(),[m,h]=(0,D.useState)(null),[y,b]=(0,D.useState)(null),[x,S]=(0,D.useState)(``),[w,T]=(0,D.useState)(!1),E=(0,D.useRef)(null),A=(0,D.useCallback)(async()=>{try{h(await u.codingSession(t,r,i)),b(null)}catch(e){b(e.message)}},[t,r,i]);(0,D.useEffect)(()=>{A()},[A]);let j=Object.values(l.codingLive).filter(e=>e.run.agent===t&&(e.run.session_id===r||e.run.asked_session_id===r)),N=j.find(e=>e.run.status===`running`),P=j.filter(e=>e.run.status!==`running`).length;(0,D.useEffect)(()=>{P&&A()},[P]),(0,D.useEffect)(()=>{let e=E.current;e&&(e.scrollTop=e.scrollHeight)},[m?.transcript?.length,N?.events.length,N?.current.length]);let L=async()=>{let e=x.trim();if(e&&!w){T(!0);try{await u.codingSend({agent:t,text:e,session_id:r,workspace:m?.workspace??``,device:i}),S(``)}catch(e){d(e.message)}finally{T(!1)}}},R=k[t],z=m?.transcript??[],V=!!m||!!N,H=!!m&&!m.resumable&&!N;return(0,O.jsx)(C,{open:!0,onClose:s,title:(0,O.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[(0,O.jsx)(I,{agent:t,size:30}),(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:`block truncate`,children:m?.title||R?.label||t}),(0,O.jsxs)(`span`,{className:`block truncate text-[12px] font-normal text-muted`,children:[a?`${a} · `:``,m?.workspace?B(m.workspace):R?.label,m?.source&&m.source!==`ide`&&m.source!==`cli`?` · ${m.source}`:``]})]})]}),footer:(0,O.jsxs)(O.Fragment,{children:[H&&(0,O.jsx)(`p`,{className:`mb-1.5 px-1 text-[11.5px] leading-snug text-muted`,children:f(`Made in the IDE: your message starts a new chat in the same workspace, with the last exchange quoted.`)}),(0,O.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),L()},children:[(0,O.jsx)(`textarea`,{value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},rows:1,disabled:!V||!!N,placeholder:N?f(`{agent} is working…`,{agent:R?.label??t}):m?H?f(`Continue in a new chat…`):f(`Tell {agent}…`,{agent:R?.label??t}):`…`,className:e(p,`max-h-32 min-h-[44px] resize-none py-2.5`)}),N?(0,O.jsx)(`button`,{type:`button`,onClick:()=>void u.codingStop(N.run.id,i).catch(e=>d(e.message)),"aria-label":f(`Stop`),className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-rose-500 text-white`,children:(0,O.jsx)(_,{size:16})}):(0,O.jsx)(`button`,{type:`submit`,disabled:!x.trim()||w||!V,"aria-label":f(`Send`),className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-accent text-white disabled:opacity-40`,children:w?(0,O.jsx)(c,{size:16,className:`animate-spin`}):(0,O.jsx)(v,{size:18})})]})]}),children:(0,O.jsxs)(`div`,{ref:E,className:`space-y-2.5 py-1`,children:[y&&(0,O.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:y}),!m&&!y&&(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,O.jsx)(c,{size:20,className:`animate-spin`})}),z.map((e,n)=>(0,O.jsx)(F,{who:e.role===`user`?`you`:`agent`,agent:t,children:e.role===`user`?(0,O.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e.text}):(0,O.jsx)(g,{text:e.text})},n)),j.filter(e=>!(e.run.status===`done`&&(e.run.resumed||!e.run.asked_session_id)&&z.some(t=>t.role===`user`&&t.text.trim()===e.run.text.trim()))).map(e=>(0,O.jsx)(M,{live:e,agent:t,hideFinishedText:z.length>0&&e.run.status===`done`},e.run.id)),m&&z.length===0&&j.length===0&&(0,O.jsx)(`p`,{className:`py-6 text-center text-[13px] text-muted`,children:f(`Nothing readable in this chat yet.`)})]})})}function M({live:e,agent:t,hideFinishedText:r}){let i=n(),{run:a,events:o,current:s}=e,l=o.filter(e=>e.kind===`tool`),u=k[t];return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(F,{who:`you`,agent:t,badge:i(`via nanoMuse`),children:(0,O.jsx)(`span`,{className:`whitespace-pre-wrap`,children:a.text})}),(l.length>0||a.status===`running`)&&(0,O.jsxs)(`div`,{className:`mx-1 rounded-2xl border border-border/60 bg-surface-2/40 px-3 py-2 text-[12.5px]`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium text-fg/80`,children:[a.status===`running`?(0,O.jsx)(c,{size:13,className:`animate-spin text-accent`}):(0,O.jsx)(w,{size:13,className:`text-muted`}),a.status===`running`?i(`{agent} is working…`,{agent:u?.label??t}):i(`{n} steps`,{n:l.length}),a.device&&(0,O.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-muted`,children:[(0,O.jsx)(S,{size:11}),` `,a.device]})]}),l.length>0&&(0,O.jsx)(`ul`,{className:`mt-1.5 max-h-28 space-y-0.5 overflow-y-auto font-mono text-[11.5px] text-muted`,children:l.slice(-12).map((e,t)=>(0,O.jsx)(`li`,{className:`truncate`,children:e.text},t))})]}),(s||a.output&&!r)&&(0,O.jsxs)(F,{who:`agent`,agent:t,children:[(0,O.jsx)(g,{text:a.status===`running`?(a.output?a.output+`
`:``)+s:a.output}),a.status===`running`&&(0,O.jsx)(`span`,{className:`ml-1 inline-block h-3.5 w-1 animate-pulse bg-accent align-middle`})]}),a.status===`failed`&&(0,O.jsx)(`div`,{className:`mx-1 rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:a.error||i(`failed`)}),a.status===`stopped`&&(0,O.jsx)(`div`,{className:`mx-1 text-center text-[12px] text-muted`,children:i(`stopped`)}),!a.resumed&&a.asked_session_id&&a.status!==`running`&&(0,O.jsx)(`div`,{className:`mx-1 text-center text-[12px] text-muted`,children:i(`Continued as a new chat: the agent could not reopen the old one.`)})]})}function N({live:e,onOpen:t}){let r=n(),{run:i,events:a,current:o}=e,s=[...a].reverse().find(e=>e.kind===`tool`);return(0,O.jsxs)(`button`,{type:`button`,onClick:t,className:`flex w-full items-center gap-3 rounded-3xl border border-accent/25 bg-accent/5 px-3.5 py-3 text-left`,children:[(0,O.jsx)(I,{agent:i.agent,size:34}),(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`span`,{className:`block truncate text-[14px] font-medium`,children:i.text}),(0,O.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 truncate text-[12px] text-muted`,children:[(0,O.jsx)(c,{size:11,className:`animate-spin text-accent`}),(0,O.jsx)(`span`,{className:`truncate`,children:o.slice(-80)||s?.text||r(`starting…`)})]})]}),i.device&&(0,O.jsx)(S,{size:14,className:`shrink-0 text-muted`})]})}function P({agent:t,agents:r,device:i,onClose:a,onStarted:s}){let{toast:l}=o(),m=n(),[h,g]=(0,D.useState)(t),[_,y]=(0,D.useState)(``),[b,x]=(0,D.useState)(``),[S,w]=(0,D.useState)(!1),[T,E]=(0,D.useState)([]);(0,D.useEffect)(()=>{u.codingSessions({agent:h,device:i,limit:30}).then(e=>E(Array.from(new Set(e.sessions.map(e=>e.workspace).filter(Boolean))).slice(0,6))).catch(()=>E([]))},[h,i]);let A=async()=>{if(b.trim()&&!S){w(!0);try{s(await u.codingSend({agent:h,text:b.trim(),workspace:_.trim(),device:i}))}catch(e){l(e.message)}finally{w(!1)}}};return(0,O.jsx)(C,{open:!0,onClose:a,title:m(`New chat`),footer:(0,O.jsxs)(`button`,{type:`button`,disabled:!b.trim()||S,onClick:()=>void A(),className:e(f,`w-full py-3`),children:[S?(0,O.jsx)(c,{size:15,className:`animate-spin`}):(0,O.jsx)(v,{size:15}),` `,m(`Send to {agent}`,{agent:k[h]?.label??h})]}),children:(0,O.jsxs)(`div`,{className:`space-y-4 py-1`,children:[(0,O.jsx)(`div`,{className:`grid grid-cols-3 gap-1 rounded-2xl bg-surface-2/70 p-1 text-[13px] font-medium`,children:r.map(t=>(0,O.jsxs)(`button`,{type:`button`,onClick:()=>g(t.id),className:e(`flex items-center justify-center gap-1.5 rounded-xl px-2 py-2 transition`,h===t.id?`bg-surface text-fg shadow-sm`:`text-muted`),children:[(0,O.jsx)(I,{agent:t.id,size:18}),` `,k[t.id]?.label??t.name]},t.id))}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:`text-[12px] text-muted`,children:m(`Project folder`)}),(0,O.jsx)(`input`,{value:_,onChange:e=>y(e.target.value),placeholder:`/home/you/project`,className:e(p,`mt-1 font-mono text-[13px]`)}),T.length>0&&(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:T.map(t=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>y(t),className:e(`rounded-full border px-2.5 py-1 text-[12px]`,_===t?`border-accent/40 bg-accent/10 text-accent`:`border-border text-muted`),children:B(t)},t))})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`label`,{className:`text-[12px] text-muted`,children:m(`What to do`)}),(0,O.jsx)(`textarea`,{value:b,onChange:e=>x(e.target.value),rows:4,autoFocus:!0,placeholder:m(`Add tests for the parser and run them`),className:e(p,`mt-1 resize-none`)})]}),(0,O.jsx)(`p`,{className:`text-[12px] text-muted`,children:m(`The agent runs on that computer with its own permissions; nanoMuse only carries the message and brings the answer back.`)}),(0,O.jsx)(`button`,{type:`button`,onClick:a,className:e(d,`w-full`),children:m(`Cancel`)})]})})}function F({who:t,agent:n,badge:r,children:i}){return(0,O.jsxs)(`div`,{className:e(`flex`,t===`you`?`justify-end`:`justify-start`),children:[t===`agent`&&(0,O.jsx)(I,{agent:n,size:24,className:`mr-2 mt-1 shrink-0`}),(0,O.jsxs)(`div`,{className:e(`max-w-[86%] rounded-3xl px-3.5 py-2 text-[14px] leading-relaxed`,t===`you`?`rounded-br-lg bg-bubble-user text-bubble-user-fg`:`rounded-bl-lg bg-surface-2`),children:[r&&(0,O.jsx)(`div`,{className:`mb-0.5 text-[10.5px] font-semibold uppercase tracking-wide text-fg/45`,children:r}),(0,O.jsx)(`div`,{className:`md break-words`,children:i})]})]})}function I({agent:t,size:n=28,className:r}){let i=k[t];return(0,O.jsx)(`span`,{className:e(`flex shrink-0 items-center justify-center rounded-xl bg-gradient-to-br font-bold text-white shadow-sm`,i?.tone??`from-slate-400 to-slate-600`,r),style:{width:n,height:n,fontSize:Math.round(n*.46)},"aria-hidden":!0,children:i?.glyph??(0,O.jsx)(h,{size:Math.round(n*.55)})})}function L({status:e}){let t=n();return e===`running`?(0,O.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 rounded-full bg-emerald-500/12 px-2 py-0.5 text-[10.5px] font-semibold text-emerald-700 dark:text-emerald-300`,children:[(0,O.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-500`}),` `,t(`working`)]}):e===`active`?(0,O.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-accent`,title:t(`active`)}):null}function R({active:t,onClick:n,icon:r,label:i}){return(0,O.jsxs)(`button`,{type:`button`,onClick:n,className:e(`flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-[12.5px] font-medium transition`,t?`border-fg bg-fg text-bg`:`border-border bg-surface text-fg/75`),children:[r,` `,i]})}function z(e,t){return e.find(e=>e.id===t)?.name??t}function B(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}export{A as CodingScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/ConnectionsScreen-0U0bXAf7.js b/nanomuse/server/static/assets/ConnectionsScreen-CMt7GOff.js
similarity index 99%
rename from nanomuse/server/static/assets/ConnectionsScreen-0U0bXAf7.js
rename to nanomuse/server/static/assets/ConnectionsScreen-CMt7GOff.js
index 5de2928c2..5c97b83c3 100644
--- a/nanomuse/server/static/assets/ConnectionsScreen-0U0bXAf7.js
+++ b/nanomuse/server/static/assets/ConnectionsScreen-CMt7GOff.js
@@ -1 +1 @@
-import{A as e,E as t,J as n,K as r,L as i,Q as a,Y as o,b as s,f as c,q as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{C as d,O as f,S as p,b as m,f as h,g,h as _,k as v,m as y,v as b,w as x,x as S}from"./StarNudge-DjXecvWj.js";import{n as C,t as w}from"./external-link-Xj5fjR8v.js";import{a as T,c as E,i as D,r as O,s as k,t as A}from"./Form-DwKuBk1V.js";import{t as j}from"./clapperboard-BokpXv9J.js";import{t as M}from"./image-crWy0a06.js";import{t as N}from"./plug-Bj_5EEV3.js";import{t as P}from"./refresh-cw-BKgIzslL.js";import{Ct as F,E as I,G as L,N as ee,P as te,T as R,V as z,X as B,Z as V,j as H,lt as U,pt as ne,st as re,ut as ie,xt as ae}from"./index-BjYzdKkG.js";import{t as oe}from"./BackBar-Dli0L0O_.js";import{t as se}from"./CloudCard-CdydxD3H.js";var ce=n(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),W=n(`contact`,[[`path`,{d:`M16 2v2`,key:`scm5qe`}],[`path`,{d:`M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2`,key:`1waht3`}],[`path`,{d:`M8 2v2`,key:`pbkmx`}],[`circle`,{cx:`12`,cy:`11`,r:`3`,key:`itu57m`}],[`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,key:`12vinp`}]]),le=n(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ue=n(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),de=n(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),fe=n(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),G=a(o(),1);function pe(e,t){let n=t.trim().toLowerCase();return!n||e.id.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)}function me(e,t){let n=e.default&&e.rows.some(t=>t.id===e.default)?e.default:e.rows.find(e=>e.recommended)?.id,r=t&&t.group===e.key?t.id:void 0,i=[];for(let t of[n,r]){if(!t||i.some(e=>e.id===t))continue;let n=e.rows.find(e=>e.id===t);n&&i.push(n)}return[...i,...e.rows.filter(e=>!i.includes(e))]}function he(e){return e.reduce((e,t)=>e+t.rows.length,0)}function ge(e){return he(e)>8}function _e(e,{current:t,query:n=``,expanded:r}={}){let i=n.trim().length>0,a=[];for(let o of e){let e=me(o,t);if(i){let t=e.filter(e=>pe(e,n));t.length&&a.push({key:o.key,label:o.label,rows:t,more:0});continue}e.length>8&&!r?.has(o.key)?a.push({key:o.key,label:o.label,rows:e.slice(0,8),more:e.length-8}):a.push({key:o.key,label:o.label,rows:e,more:0})}return a}var K=s(),q=`flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-[14px] hover:bg-surface-2 focus:bg-surface-2 focus:outline-none`;function ve({label:e,text:n,heads:i=[],headValue:a,tail:o,groups:s,current:c,disabled:l,onHead:u,onPick:d,onTail:f,rowText:p}){let m=r(),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(()=>new Set),[x,S]=(0,G.useState)(!1),w=(0,G.useRef)(null),T=(0,G.useRef)(null),D=ge(s),k=(0,G.useCallback)((e=!1)=>{g(!1),v(``),b(new Set),S(e)},[]);(0,G.useEffect)(()=>{!h&&x&&(S(!1),w.current?.focus())},[h,x]),(0,G.useEffect)(()=>{if(!h)return;let e=e=>{let t=e.target;T.current?.contains(t)||w.current?.contains(t)||k()},t=e=>{e.key===`Escape`&&(e.stopPropagation(),k(!0))};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`keydown`,t,!0),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,t,!0)}},[h,k]),(0,G.useEffect)(()=>{h&&T.current&&(T.current.querySelector(`input`)??T.current.querySelector(`[aria-selected="true"]`)??T.current.querySelector(`[data-row]`))?.focus()},[h]);let A=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=[...e.currentTarget.closest(`[role="listbox"]`)?.querySelectorAll(`[data-row]`)??[]];if(!t.length)return;e.preventDefault();let n=t.indexOf(e.target);t[e.key===`ArrowDown`?n<0?0:Math.min(t.length-1,n+1):n<0?t.length-1:Math.max(0,n-1)]?.focus()},j=_e(s,{current:c,query:_,expanded:y}),M=_.trim().length>0,N=(e,n,r,i,a)=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-row":``,title:a,onClick:i,onKeyDown:A,className:t(q,n&&`text-accent font-medium`),children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r}),n&&(0,K.jsx)(C,{size:15,className:`shrink-0`})]},e);return(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsxs)(`button`,{ref:w,type:`button`,disabled:l,"aria-label":e,"aria-haspopup":`listbox`,"aria-expanded":h,title:n,onClick:()=>h?k():g(!0),className:t(O,`flex items-center gap-2 text-left text-fg disabled:opacity-50`),children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,K.jsx)(E,{size:16,className:`shrink-0 text-muted`})]}),h&&(0,K.jsxs)(`div`,{ref:T,role:`listbox`,"aria-label":e,className:`absolute left-0 right-0 top-full z-30 mt-1 flex max-h-[60vh] flex-col overflow-hidden rounded-2xl border border-border bg-surface p-1.5 shadow-xl`,children:[i.length>0&&(0,K.jsx)(`div`,{className:`mb-1 flex flex-col border-b border-border pb-1`,children:i.map(e=>N(`head:${e.value}`,a===e.value,e.label,()=>{u?.(e.value),k(!0)}))}),D&&(0,K.jsxs)(`label`,{className:`mb-1.5 flex items-center gap-2 rounded-xl bg-surface-2 px-3 py-2 text-muted focus-within:ring-2 focus-within:ring-accent/40`,children:[(0,K.jsx)(B,{size:15,className:`shrink-0`}),(0,K.jsx)(`input`,{type:`search`,value:_,onChange:e=>v(e.target.value),onKeyDown:A,placeholder:m(`Search models`),"aria-label":m(`Search models`),autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 bg-transparent text-[14px] text-fg outline-none placeholder:text-muted`})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[M&&j.length===0&&(0,K.jsx)(`div`,{className:`px-3 py-2.5 text-[13.5px] text-muted`,children:m(`No model matches`)}),j.map(e=>(0,K.jsxs)(`div`,{role:`group`,"aria-label":e.label,className:`[&+&]:mt-1.5`,children:[(0,K.jsx)(`div`,{className:`truncate px-3 pb-0.5 pt-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted`,children:e.label}),e.rows.map(t=>N(`${e.key}:${t.id}`,c?.group===e.key&&c.id===t.id,p?p(t):t.name,()=>{d(e.key,t),k(!0)},t.id)),e.more>0&&(0,K.jsx)(`button`,{type:`button`,"data-row":``,onKeyDown:A,onClick:()=>b(t=>new Set([...t,e.key])),className:t(q,`text-[13px] text-accent`),children:m(`Show {n} more`,{n:e.more})})]},e.key))]}),o&&!M&&(0,K.jsx)(`div`,{className:`mt-1 border-t border-border pt-1`,children:N(`tail`,!1,o,()=>{f?.(),k(!0)})})]})]})}var ye=`nanomuse_cloud`,be=`{{vault:NANOMUSE_CLOUD_KEY}}`,xe=`custom`,J=[`openai`,`openai_responses`];function Y(e){try{return new URL(e).hostname.toLowerCase()}catch{return``}}function X(e,t,n=h){if(e&&!J.includes(e))return n.find(t=>t.id===e)??null;let r=Y(t);if(!r)return null;let i=e=>[e.base_url,e.base_url_global].map(e=>Y(e??``)).filter(Boolean);return n.find(e=>i(e).includes(r))||(n.find(e=>i(e).some(e=>{let t=e.indexOf(`.`);return t>0&&r.endsWith(e.slice(t))}))??null)}function Se(e,t,n=``,r=h){if(e===`nanomuse_cloud`)return`nanoMuse Cloud`;if(e===`chatgpt`)return`ChatGPT`;let i=r.find(t=>t.id===e);return i&&e!==`custom`?S(i,t):Y(n)||e}function Ce(e,t,n=h){if(!e.effective_provider)return``;let r=Se(e.effective_provider,t,e.base_url,n);return e.effective_model?`${r} · ${e.effective_model}`:r}function we(e,t,n,r=h){let i=e.effective_model??``;if(!i)return``;let a=(e,t)=>Se(X(e,t,r)?.id??(J.includes(e)?`custom`:e),n,t,r),o;return o=e.effective_source===`cloud`?`nanoMuse Cloud`:e.effective_source===`gui`&&(e.provider_id||e.base_url||!J.includes(e.provider||`openai`))?e.provider_id?Se(e.provider_id,n,e.base_url,r):a(e.provider,e.base_url):t.cloud?`nanoMuse Cloud`:a(t.provider,t.base_url),`${o} · ${i}`}function Te(e,t){let n=t.list??h,r=[];t.signedIn&&r.push({value:ye,label:`nanoMuse Cloud`,group:`cloud`,needsKey:!1,entry:null});let i=t.chat.cloud?null:X(t.chat.provider,t.chat.base_url,n);i&&i.capabilities.includes(e)&&r.push({value:i.id,label:S(i,t.locale),group:`chat`,needsKey:!1,entry:i});for(let a of p(t.region,e,n))a.id!==i?.id&&r.push({value:a.id,label:S(a,t.locale),group:`add`,needsKey:!0,entry:a});return r.push({value:xe,label:``,group:`add`,needsKey:!1,entry:null}),r}function Ee(e,t){return e.configured?t&&e.base_url&&Y(e.base_url)===Y(t)?ye:e.provider_id||`custom`:``}var De=`nanomuse_cloud`;function Oe(){let{state:e}=c(),[t,n]=(0,G.useState)(null),[i,a]=(0,G.useState)(null),o=e.profile?.name??`nanoMuse`,s=r(),d=(0,G.useCallback)(async()=>{try{n(await u.connections()),a(null)}catch(e){a(s(e.message))}},[s]);return(0,G.useEffect)(()=>{d()},[d,e.connectionsVersion]),(0,K.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,K.jsx)(oe,{title:s(`Connections`),description:s(`What {name} can reach; keys stay in the vault on this machine.`,{name:o})}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-4`,children:[i&&(0,K.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 text-rose-700 dark:text-rose-300 p-3 text-[13.5px]`,children:i}),!t&&!i&&(0,K.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,K.jsx)(l,{className:`animate-spin`,size:20})}),t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Z,{data:t,onChange:d}),t.image&&(0,K.jsx)(ke,{slot:`image`,data:t,onChange:d}),t.video&&(0,K.jsx)(ke,{slot:`video`,data:t,onChange:d}),(0,K.jsx)(se,{account:e.hub?.account??null,onChange:d}),t.embeddings.memory_enabled&&(0,K.jsx)(Ae,{data:t,onChange:d}),(0,K.jsx)(je,{data:t,onChange:d}),(0,K.jsx)(Ne,{data:t,onChange:d}),(0,K.jsx)(Fe,{data:t,onChange:d}),(0,K.jsx)(Ie,{data:t,onChange:d}),(0,K.jsx)(Q,{data:t,onChange:d}),(0,K.jsx)(Le,{data:t,onChange:d}),(0,K.jsx)(Re,{data:t,onChange:d}),(0,K.jsx)(ze,{data:t,onChange:d})]})]})]})}function Z({data:e,onChange:n,compact:a}){let{toast:o,state:s}=c(),p=r(),[m,g]=(0,G.useState)(!!a),j=e.providers,M=!!s.hub?.account?.any_model,P=Object.entries(j).find(([t,n])=>t!==`custom`&&n.base_url&&e.llm.base_url.startsWith(n.base_url)&&n.provider===e.llm.provider)?.[0]??Object.entries(j).find(([t,n])=>t!==`custom`&&n.base_url&&e.llm.base_url.startsWith(n.base_url))?.[0]??(e.llm.base_url?`custom`:`deepseek`),[I,L]=(0,G.useState)(P),[R,z]=(0,G.useState)(e.llm.model),[B,V]=(0,G.useState)(e.llm.base_url),[H,ne]=(0,G.useState)(``),[re,ie]=(0,G.useState)(!1),[ae,oe]=(0,G.useState)(!1),[se,ce]=(0,G.useState)(e.llm.key_source===`none`&&!!j[P]?.key_optional),[W,de]=(0,G.useState)(e.llm.tool_mode||`auto`),[fe,pe]=(0,G.useState)(e.llm.proxy??``),[me,he]=(0,G.useState)(!1),[ge,_e]=(0,G.useState)(!1),[q,ye]=(0,G.useState)(null),[be,xe]=(0,G.useState)(!1),[J,Y]=(0,G.useState)(e.gui?.model??``),[X,Se]=(0,G.useState)({list:j[P]?.models??[],image:[],video:[],menu:[],catalog:[],imageCatalog:[],videoCatalog:[],vision:[],gui:j[P]?.gui_models??[],source:`catalogue`}),[Ce,Te]=(0,G.useState)(!1),[Ee,Oe]=(0,G.useState)(!1);(0,G.useEffect)(()=>{z(e.llm.model),V(e.llm.base_url),de(e.llm.tool_mode||`auto`),pe(e.llm.proxy??``),he(!1),Y(e.gui?.model??``),L(P)},[e.llm,e.gui?.model]);let Z=j[I],ke=I===`custom`||!Z?.base_url?B:Z.base_url;(0,G.useEffect)(()=>{if(!m)return;let e=!0,t=setTimeout(()=>{Se(e=>({...e,source:`loading`})),u.llmModels({preset:I,base_url:ke,api_key:H||void 0}).then(t=>{e&&(Se({list:t.models,image:t.image_models??[],video:t.video_models??[],menu:t.menu??[],catalog:t.catalog??[],imageCatalog:t.image_catalog??[],videoCatalog:t.video_catalog??[],vision:t.vision??[],gui:t.gui??j[I]?.gui_models??[],source:t.source}),t.source===`live`&&t.models.length&&!Ce&&z(e=>t.models.includes(e)?e:t.models[0]))}).catch(()=>e&&Se({list:Z?.models??[],image:[],video:[],menu:[],catalog:[],imageCatalog:[],videoCatalog:[],vision:[],gui:Z?.gui_models??[],source:`catalogue`}))},H?600:150);return()=>{e=!1,clearTimeout(t)}},[m,I,ke,H]);let Ae=t=>{L(t);let n=j[t];n&&(n.base_url?V(n.base_url):j[I]?.base_url&&V(``),(!R||Object.values(j).some(e=>e.models?.includes(R)))&&n.models?.length&&!n.models.includes(R)&&z(n.models[0]),Se({list:n.models??[],image:[],video:[],menu:[],catalog:[],imageCatalog:[],videoCatalog:[],vision:[],gui:n.gui_models??[],source:`catalogue`}),(!e.gui?.model||Object.values(j).some(t=>t.gui_model===e.gui?.model))&&Y(n.cloud?``:n.gui_model??``),Oe(!1),Te(!1),ce(!1))};(0,G.useEffect)(()=>{let e=ee();e&&j[e]&&(g(!0),Ae(e))},[]);let je=!!Z?.no_key||se&&!!Z?.key_optional,Me=e.llm.cloud?{text:p(`Your account's model`),tone:`ok`}:e.llm.key_source===`none`&&!j[P]?.no_key&&!j[P]?.key_optional?{text:p(`No key yet`),tone:`warn`}:e.llm.key_source===`missing`?{text:p(`Key missing from vault`),tone:`warn`}:{text:e.llm.key_source===`vault`?p(`Key in vault`):e.llm.key_source===`config`?p(`Key from config`):p(`No key needed`),tone:`ok`},Ne=async()=>{_e(!0),ye(null);try{Z?.cloud?await u.cloudUseAsModel(R.trim()):await u.setLLM({provider:Z?.provider??`openai`,model:R.trim(),base_url:ke.trim(),tool_mode:W,api_key:H||(je?``:null),proxy:me&&e.llm.proxy!==void 0?fe.trim():null}),J.trim()!==(e.gui?.model??``)&&await u.setGui({model:J.trim()}),ne(``),b(),o(p(`Model saved`)),n(),a||g(!1)}catch(e){o(e.message)}finally{_e(!1)}},Pe=async()=>{xe(!0);try{ye(await u.testLLM())}catch(e){ye({ok:!1,error:e.message})}finally{xe(!1)}},Fe=[{id:`cloud`,title:p(`Your account`),ids:[]},{id:`openai`,title:p(`OpenAI-compatible · Chat Completions`),ids:[]},{id:`responses`,title:p(`Responses API`),ids:[]},{id:`local`,title:p(`Local or your own endpoint`),ids:[]}];for(let[e,t]of Object.entries(j))(Fe.find(e=>e.id===(t.group??`openai`))??Fe[0]).ids.push(e);for(let e of Fe)e.ids=v(e.ids,j,s.hub?.account);let Ie=I===`custom`||!Z?.base_url,Q=Z?.cloud?null:h.find(e=>e.id===y(I))??null,Le=d(s.hub?.account),Re=i(),ze=e=>!!Q&&!Q.user_capabilities&&!Q.capabilities.includes(e),Ve=j[De],Ge=Z?.cloud?X.gui[0]??Z.gui_model??``:Q&&!Q.user_capabilities?Q.capabilities.includes(`vision`)?Q.defaults.hands||R.trim():Ve?.gui_model??R.trim():R.trim(),Ke=!Z?.cloud&&ze(`vision`)&&!!Ve,qe=e.gui?we(e.gui,e.llm,Re):``,Je=Array.from(new Set([...Z?.cloud?X.gui:[],...Z?.gui_model?[Z.gui_model]:[],...X.list.filter(e=>X.vision.includes(e)||f(e)===!0)])).filter(Boolean),Ye=Z?.cloud?`nanoMuse Cloud`:Q?S(Q,Re):We(ke)||I,Xe=Z?.cloud?X.gui[0]??Z.gui_model??``:Q?.defaults.hands??Z?.gui_model??``,Ze=[{key:`hands`,label:Ye,rows:Je.map(e=>({id:e,name:e})),...Xe?{default:Xe}:{}}],Qe=Ie&&/^https?:\/\/[^/]+\/?$/.test(B.trim());return(0,K.jsxs)(A,{icon:(0,K.jsx)(F,{size:19}),title:p(`Chat model`),summary:e.llm.cloud?`nanoMuse Cloud · ${e.llm.model||`—`}`:`${e.llm.model||`—`}${e.llm.base_url?` · ${We(e.llm.base_url)}`:``}`,status:Me,open:m,onToggle:a?void 0:()=>g(!m),children:[(0,K.jsx)($,{label:p(`Provider`),children:(0,K.jsxs)(`div`,{className:`space-y-2.5`,children:[Fe.filter(e=>e.ids.length).map(e=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[11px] uppercase tracking-wide text-muted`,children:e.title}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.ids.map(e=>{let n=j[e];return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Ae(e),className:t(`rounded-2xl px-3 py-1.5 text-left border leading-tight`,I===e?`border-accent bg-accent/10 text-accent`:`border-border text-muted`),children:[(0,K.jsx)(`span`,{className:t(`block text-[13px]`,I===e&&`font-medium`),children:n.label}),n.subtitle&&(0,K.jsx)(`span`,{className:`block text-[10.5px] opacity-80`,children:p(n.subtitle)})]},e)})})]},e.id)),Q&&(0,K.jsxs)(`p`,{className:`text-[12px] text-muted`,children:[(0,K.jsx)(`span`,{className:`font-medium text-fg`,children:S(Q,Re)}),` · `,_(p,Q.capabilities),`. `,Re===`zh-CN`?Q.note_zh:Q.note]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>oe(!ae),className:`inline-flex items-center gap-1.5 text-[12.5px] text-accent`,children:[(0,K.jsx)(U,{size:13}),` `,p(`Or sign in with a ChatGPT plan`),` `,ae?(0,K.jsx)(k,{size:13}):(0,K.jsx)(E,{size:13})]}),ae&&(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(te,{compact:!0,onChanged:()=>{n()}})})]})]})}),Ie&&(0,K.jsx)($,{label:p(`Base URL`),hint:p(Qe?`/v1 is added when the URL has no path.`:`The endpoint that serves /chat/completions, for example http://127.0.0.1:8000/v1.`),children:(0,K.jsx)(`input`,{value:B,onChange:e=>V(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:`https://host/v1`,inputMode:`url`,autoCapitalize:`off`})}),(0,K.jsxs)($,{label:p(`Chat model`),hint:Z?.cloud&&M&&X.catalog.length?p(`{n} models your account may use: the menu first, then everything else the provider lists under the Cloud key. Pick one; the ones beyond the menu are priced as the dearest menu model of their kind.`,{n:X.list.length}):Z?.cloud&&M?p(`Your account may name any model the provider has, not only these: type its id (a chat model here, a picture or clip model below) and it goes through as typed.`):X.source===`live`?p(`{n} models from the endpoint`,{n:X.list.length}):X.source===`loading`?p(`Asking the endpoint…`):X.list.length?p(`Could not list the endpoint's models; these are the usual ones.`):void 0,children:[Z?.cloud&&X.catalog.length>0&&!Ee&&(!R||X.list.includes(R))?(0,K.jsxs)(`select`,{value:R,onChange:e=>{if(e.target.value===Be){Oe(!0);return}z(e.target.value),Te(!0)},className:t(O,`text-fg`),children:[!R&&(0,K.jsx)(`option`,{value:``,children:p(`model name`)}),(0,K.jsx)(`optgroup`,{label:p(`Menu`),children:X.menu.map(e=>(0,K.jsx)(`option`,{value:e,children:X.vision.includes(e)?`${e} · ${p(`reads pictures`)}`:e},e))}),(0,K.jsx)(`optgroup`,{label:p(`More models on your account`),children:X.catalog.map(e=>(0,K.jsx)(`option`,{value:e,children:X.vision.includes(e)?`${e} · ${p(`reads pictures`)}`:e},e))}),(0,K.jsx)(`option`,{value:Be,children:p(`Type a model id…`)})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`input`,{list:`om-models`,value:R,onChange:e=>{z(e.target.value),Te(!0)},className:O,placeholder:p(`model name`),autoCapitalize:`off`,autoCorrect:`off`,autoFocus:Ee}),(0,K.jsx)(`datalist`,{id:`om-models`,children:X.list.map(e=>(0,K.jsx)(`option`,{value:e},e))}),Z?.cloud&&X.catalog.length>0&&(0,K.jsx)(`button`,{type:`button`,className:`mt-1.5 text-[12px] text-accent`,onClick:()=>{Oe(!1),X.list.includes(R)||z(X.menu[0]??X.list[0]??``)},children:p(`Pick from the list`)})]}),X.list.length>0&&(0,K.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:(X.menu.length?X.menu:X.list).slice(0,8).map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>z(e),className:t(`rounded-full px-2.5 py-1 text-[12px] border`,R===e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:e},e))})]}),(0,K.jsxs)($,{label:p(`Hands model`),hint:Z?.cloud?p(`The model that looks at screens when the hands run: the phone, this computer, a page the browser cannot read. Your account's hands model is {model}; the chat model above is a different pick.`,{model:Ge||`—`}):Ke?p(`The model that looks at screens when the hands run. This provider has no model that sees, so the hands use your account's, {model}, unless you pick one here.`,{model:Ge||`—`}):p(`The model that looks at screens when the hands run: a small, fast one that takes pictures, on the same endpoint and key. Default: this provider's own hands model.`),children:[(0,K.jsx)(ve,{label:p(`Hands model`),text:J?`${Ye} · ${J}`:p(`Automatic`),heads:[{value:``,label:p(`Automatic`)}],headValue:J?void 0:``,groups:Ze,current:J?{group:`hands`,id:J}:void 0,onHead:()=>Y(``),onPick:(e,t)=>Y(t.id)}),qe&&(0,K.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:p(`Currently {value}`,{value:qe})}),!Z?.cloud&&R.trim()&&!J&&f(R.trim())===!1&&(0,K.jsx)(`div`,{className:`mt-1.5 text-[12px] text-amber-700 dark:text-amber-300`,children:p(`{model} does not take pictures, so the hands would be blind with it. Pick a model that sees for them.`,{model:R.trim()})}),ze(`vision`)&&!Ke&&(0,K.jsxs)(`div`,{className:`mt-1.5 text-[12px] text-amber-700 dark:text-amber-300`,children:[x(p,`vision`,Le,Re),` `,(0,K.jsx)(He,{})]})]}),!Z?.no_key&&(0,K.jsxs)($,{label:p(`API key`),hint:se&&Z?.key_optional?p(`No key will be sent.`):e.llm.key_source===`vault`&&I===P?p(`A key is in the vault. Leave blank to keep it.`):p(`Stored encrypted in the vault as LLM_API_KEY.`),children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(`input`,{type:re?`text`:`password`,value:H,onChange:e=>ne(e.target.value),disabled:se&&!!Z?.key_optional,className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`pr-10 disabled:opacity-50`),placeholder:e.llm.key_source===`vault`&&I===P?`••••••••`:Z?.key_hint||`sk-…`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>ie(!re),"aria-label":p(re?`Hide key`:`Show key`),className:`absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-1.5 text-muted`,children:re?(0,K.jsx)(le,{size:16}):(0,K.jsx)(ue,{size:16})})]}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 text-[12px]`,children:[Z?.key_url?(0,K.jsxs)(`a`,{href:Z.key_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-accent`,children:[p(`Get a key from {vendor}`,{vendor:Z.label}),` `,(0,K.jsx)(w,{size:12})]}):(0,K.jsx)(`span`,{}),Z?.key_optional&&(0,K.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:se,onChange:e=>ce(e.target.checked),className:`accent-accent`}),` `,p(`No key`)]})]})]}),(0,K.jsx)($,{label:p(`Tool calling`),hint:p(`Auto uses the API's function calling and falls back to describing tools in the prompt when the endpoint rejects them. Prompt: for endpoints that silently ignore tools.`),children:(0,K.jsx)(`div`,{className:`flex gap-1.5`,children:[`auto`,`native`,`prompt`].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>de(e),className:t(`rounded-full px-3 py-1.5 text-[13px] border`,W===e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:e},e))})}),!Z?.cloud&&e.llm.proxy!==void 0&&(0,K.jsx)($,{label:p(`Proxy (optional)`),hint:p(`Only this provider's requests go through it. nanoMuse Cloud never does.`),children:(0,K.jsx)(`input`,{className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,value:fe,onChange:e=>{pe(e.target.value),he(!0)},onFocus:()=>fe.includes(`••••`)&&!me&&pe(``),onBlur:()=>!me&&pe(e.llm.proxy??``),placeholder:`http://host:port / socks5://host:port`,autoComplete:`off`,spellCheck:!1})}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:ge||!R.trim()||Ie&&!B.trim(),onClick:()=>void Ne(),className:D,children:[ge?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),` `,p(`Save`)]}),(0,K.jsxs)(`button`,{type:`button`,disabled:be,onClick:()=>void Pe(),className:T,children:[be?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,p(`Test`)]})]}),q&&(0,K.jsx)(Ue,{result:q,okText:p(`Replied "{reply}" in {ms} ms`,{reply:q.reply??``,ms:q.ms??0})})]})}function ke({slot:e,data:n,onChange:a}){let{toast:o,state:s}=c(),f=r(),p=n[e],h=e,v=s.hub?.account??null,y=!!v?.signed_in,T=d(v),E=i(),k=n.providers[De]?.base_url??``,N=Te(h,{signedIn:y,chat:{provider:n.llm.provider,base_url:n.llm.base_url,cloud:!!n.llm.cloud},region:T,locale:E}),P=Ee(p,k),[F,I]=(0,G.useState)(!1),[L,ee]=(0,G.useState)(P),[te,R]=(0,G.useState)(p.model),[z,B]=(0,G.useState)(p.base_url),[H,U]=(0,G.useState)(``),[ne,re]=(0,G.useState)(!1),[ie,ae]=(0,G.useState)(!1),[oe,se]=(0,G.useState)({list:[],more:[],source:`catalogue`});(0,G.useEffect)(()=>{ee(P),R(p.model),B(p.base_url),U(``)},[p]);let ce=N.find(e=>e.value===L)??null,W=ce?.entry??null,de=W?g(W,T):null,fe=L===`nanomuse_cloud`?k:L===`custom`?z.trim():de?.base_url??``,pe=P===L&&P!==``&&(p.key_source===`vault`||p.key_source===`config`),me=!!ce?.needsKey&&!H&&!pe,he=L===`nanomuse_cloud`?oe.list[0]??``:W?.defaults[e]??``;(0,G.useEffect)(()=>{if(!F||!L||L!==`nanomuse_cloud`&&!fe){se({list:[],more:[],source:`catalogue`});return}let t=!0,n=setTimeout(()=>{se(e=>({...e,source:`loading`})),u.llmModels(L===`nanomuse_cloud`?{preset:De}:{preset:W?m(W.id):``,base_url:fe,api_key:H||void 0}).then(n=>{if(!t)return;let r=(e===`image`?n.image_models:n.video_models)??[],i=(e===`image`?n.image_catalog:n.video_catalog)??[];se({list:r.filter(e=>!i.includes(e)),more:i,source:n.source})}).catch(()=>t&&se({list:[],more:[],source:`catalogue`}))},H?600:150);return()=>{t=!1,clearTimeout(n)}},[F,L,fe,H]);let ge=f(e===`image`?`Making pictures`:`Making clips`),_e=f(e===`image`?`Portraits of your Muse.`:`Short clips of your Muse.`),q=Ce(p,E),ve=x(f,h,T,E),ye=p.effective_provider?p.effective_source===`cloud`?{text:f(`Your account`),tone:`ok`}:p.effective_source===`chat`?{text:f(`The chat model's provider`),tone:`ok`}:{text:f(`Your key`),tone:`ok`}:{text:f(`Not set up`),tone:`warn`},xe=async()=>{ae(!0);try{L?L===`nanomuse_cloud`?await u.setMedia(e,{provider:`openai`,base_url:k,model:te.trim(),api_key:be}):L===`custom`?await u.setMedia(e,{provider:`openai`,base_url:z.trim(),model:te.trim(),api_key:H||null}):await u.setMedia(e,{provider:L,base_url:``,model:te.trim(),api_key:H||(ce?.group===`chat`?``:null)}):await u.setMedia(e,{provider:``,model:``,base_url:``,api_key:``}),U(``),b(),o(f(`Saved`)),a(),I(!1)}catch(e){o(e.message)}finally{ae(!1)}},J=e=>f(e===`cloud`?`Your account`:e===`chat`?`The chat model's provider`:`Add a provider`),Y=[`cloud`,`chat`,`add`].map(e=>({g:e,items:N.filter(t=>t.group===e)})).filter(e=>e.items.length),X=e===`image`?`IMAGE_API_KEY`:`VIDEO_API_KEY`;return(0,K.jsxs)(A,{icon:e===`image`?(0,K.jsx)(M,{size:19}):(0,K.jsx)(j,{size:19}),title:ge,summary:q||ve,status:ye,open:F,onToggle:()=>I(!F),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:_e}),(0,K.jsxs)($,{label:f(`Provider`),hint:!q&&!L?ve:void 0,children:[(0,K.jsxs)(`select`,{value:L,onChange:e=>{ee(e.target.value),R(``),U(``)},className:t(O,`text-fg`),children:[(0,K.jsx)(`option`,{value:``,children:f(`Automatic`)}),Y.map(({g:e,items:t})=>(0,K.jsx)(`optgroup`,{label:J(e),children:t.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.value===`custom`?f(`Other OpenAI-compatible endpoint`):e.label},e.value))},e))]}),q&&(0,K.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:f(`Currently {value}`,{value:q})}),!q&&!L&&(0,K.jsxs)(`button`,{type:`button`,className:`mt-1.5 inline-flex items-center gap-1 text-[12.5px] text-accent`,onClick:()=>ee(N.find(e=>e.group===`add`)?.value??``),children:[(0,K.jsx)(V,{size:13}),` `,f(`Add a provider`)]}),W&&(0,K.jsxs)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:[(0,K.jsx)(`span`,{className:`font-medium text-fg`,children:S(W,E)}),` · `,_(f,W.capabilities),`. `,E===`zh-CN`?W.note_zh:W.note]})]}),L===`custom`&&(0,K.jsx)($,{label:f(`Base URL`),hint:f(`The endpoint that serves /images/generations, for example https://host/v1.`),children:(0,K.jsx)(`input`,{value:z,onChange:e=>B(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:`https://host/v1`,inputMode:`url`,autoCapitalize:`off`})}),L&&(0,K.jsx)(Ve,{label:f(e===`image`?`Picture model`:`Clip model`),provider:L===`nanomuse_cloud`?`nanoMuse Cloud`:L===`custom`?We(z)||f(`Other OpenAI-compatible endpoint`):ce?.label??L,value:te,options:oe.list,more:oe.more,onChange:R,other:L!==`nanomuse_cloud`||!!v?.any_model,placeholder:he||void 0}),L&&L!==`nanomuse_cloud`&&ce?.group!==`chat`&&(0,K.jsxs)($,{label:f(`API key`),hint:pe?f(`A key is in the vault. Leave blank to keep it.`):f(`Stored encrypted in the vault as {name}.`,{name:X}),children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(`input`,{type:ne?`text`:`password`,value:H,onChange:e=>U(e.target.value),className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`pr-10`),placeholder:pe?`••••••••`:W?.key_hint||`sk-…`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>re(!ne),"aria-label":f(ne?`Hide key`:`Show key`),className:`absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-1.5 text-muted`,children:ne?(0,K.jsx)(le,{size:16}):(0,K.jsx)(ue,{size:16})})]}),de?.key_url&&(0,K.jsxs)(`a`,{href:de.key_url,target:`_blank`,rel:`noreferrer`,className:`mt-1.5 inline-flex items-center gap-1 text-[12px] text-accent`,children:[f(`Get a key from {vendor}`,{vendor:W?S(W,E):``}),` `,(0,K.jsx)(w,{size:12})]})]}),ce?.group===`chat`&&(0,K.jsx)(`p`,{className:`text-[12px] text-muted`,children:f(`Uses the chat model's key.`)}),(0,K.jsx)(`div`,{className:`flex gap-2 pt-1`,children:(0,K.jsxs)(`button`,{type:`button`,disabled:ie||me||L===`custom`&&!z.trim(),onClick:()=>void xe(),className:D,children:[ie?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),` `,f(`Save`)]})})]})}function Ae({data:e,onChange:n}){let{toast:i}=c(),a=r(),o=e.embeddings,[s,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(o.mode),[m,h]=(0,G.useState)(!!o.base_url),[g,_]=(0,G.useState)(o.base_url),[v,y]=(0,G.useState)(o.model),[b,x]=(0,G.useState)(``),[S,w]=(0,G.useState)(!1),[E,O]=(0,G.useState)(null),[k,j]=(0,G.useState)(!1);(0,G.useEffect)(()=>{p(o.mode),h(!!o.base_url),_(o.base_url),y(o.model)},[e.embeddings]);let M=o.mode===`off`?{text:a(`Off`),tone:`off`}:o.available===!0?{text:a(`On`),tone:`ok`}:o.available===!1?{text:o.mode===`on`?a(`Not reachable`):a(`By keyword`),tone:`warn`}:{text:a(`Not tried yet`),tone:`off`},P=o.mode===`off`?a(`Keyword recall only`):o.available===!0?a(`{model} · {n} of {total} memories indexed`,{model:o.model||o.default_model,n:o.indexed,total:o.total}):o.available===!1?o.reason:a(`{model} at {host}`,{model:o.model||o.default_model,host:We(o.effective_base_url)}),F=async()=>{w(!0),O(null);try{await u.setEmbeddings({mode:f,base_url:m?g.trim():``,model:v.trim(),api_key:m?b||void 0:``}),x(``),i(a(`Saved`)),n()}catch(e){i(e.message)}finally{w(!1)}},I=async()=>{j(!0);try{O(await u.testEmbeddings()),n()}catch(e){O({ok:!1,error:e.message})}finally{j(!1)}},L=e=>t(`rounded-full px-3 py-1.5 text-[13px] border`,e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`);return(0,K.jsxs)(A,{icon:(0,K.jsx)(ce,{size:19}),title:a(`Recall by meaning`),summary:P,status:M,open:s,onToggle:()=>d(!s),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted leading-snug`,children:a(`Memories are embedded once and a message finds the ones that mean the same thing, in any language: “写邮件给房东” finds “the landlord is Bob Li”. Keyword recall stays; the two are fused.`)}),(0,K.jsx)($,{label:a(`Mode`),hint:a(`Auto uses the model's endpoint when it has embeddings and falls back to keywords when it does not. On insists and warns. Off: keywords only.`),children:(0,K.jsx)(`div`,{className:`flex gap-1.5`,children:[`auto`,`on`,`off`].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:L(f===e),children:a(e===`auto`?`Auto`:e===`on`?`On`:`Off`)},e))})}),f!==`off`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{label:a(`Endpoint`),hint:a(m?`Any OpenAI-compatible /embeddings: Ollama with an embedding model pulled, OpenAI, a gateway.`:`The model's endpoint and key. DeepSeek has no embeddings; pick another endpoint.`),children:(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:L(!m),children:a(`Same as the model`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{h(!0),g||_(`http://127.0.0.1:11434/v1`)},className:L(m),children:a(`Another endpoint`)})]})}),m&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{label:a(`Base URL`),children:(0,K.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:`http://127.0.0.1:11434/v1`,inputMode:`url`})}),(0,K.jsx)($,{label:a(`API key`),hint:o.key_source===`vault`?a(`A key is in the vault. Leave blank to keep it.`):a(`Stored encrypted in the vault as EMBEDDINGS_API_KEY. Ollama needs none.`),children:(0,K.jsx)(`input`,{type:`password`,value:b,onChange:e=>x(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:o.key_source===`vault`?`••••••••`:`sk-…`,autoComplete:`off`})})]}),(0,K.jsx)($,{label:a(`Embedding model`),hint:a(`Blank uses the endpoint's default: {model}. On Ollama: ollama pull qwen3-embedding:0.6b (reads Chinese and English).`,{model:o.default_model}),children:(0,K.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:o.default_model,autoComplete:`off`})})]}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:S||m&&!/^https?:\/\//.test(g.trim()),onClick:()=>void F(),className:D,children:[S?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),` `,a(`Save`)]}),(0,K.jsxs)(`button`,{type:`button`,disabled:k||o.mode===`off`,onClick:()=>void I(),className:T,children:[k?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,a(`Test`)]})]}),E&&(0,K.jsx)(Ue,{result:E,okText:a(`{model} · {dims} dims · {n} memories indexed · {ms} ms`,{model:E.model??``,dims:E.dims??0,n:E.indexed??0,ms:E.ms??0})})]})}function je({data:e,onChange:n}){let{toast:i}=c(),a=r(),o=e.search,[s,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(o.provider),[m,h]=(0,G.useState)(o.base_url),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(null),[S,w]=(0,G.useState)(!1);(0,G.useEffect)(()=>{p(o.provider),h(o.base_url)},[e.search]);let E=o.providers.find(e=>e.id===o.provider),O=o.providers.find(e=>e.id===f),k=!!O?.needs_key,j=o.configured?{text:a(`On`),tone:`ok`}:{text:a(`Not set up`),tone:`warn`},M=o.configured?o.provider===`searxng`?a(`{provider} at {host}`,{provider:E?.label??o.provider,host:We(o.base_url)}):E?.label??o.provider:a(`{provider} needs {what}; searches use DuckDuckGo until then`,{provider:E?.label??o.provider,what:E?.needs_key?a(`a key`):a(`an instance URL`)}),P=async()=>{y(!0),x(null);try{await u.setSearch({provider:f,base_url:f===`searxng`?m.trim():``,api_key:k?g||void 0:``}),_(``),i(a(`Saved`)),n()}catch(e){i(e.message)}finally{y(!1)}},F=async()=>{w(!0);try{x(await u.testSearch())}catch(e){x({ok:!1,error:e.message})}finally{w(!1)}},I=e=>t(`rounded-full px-3 py-1.5 text-[13px] border`,e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),L=f!==`searxng`||/^https?:\/\//.test(m.trim());return(0,K.jsxs)(A,{icon:(0,K.jsx)(B,{size:19}),title:a(`Web search`),summary:M,status:j,open:s,onToggle:()=>d(!s),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted leading-snug`,children:a(`DuckDuckGo needs nothing, but it is scraped and rate-limits now and then. For searches that always work, use a provider with an API. Whichever you pick, a failed search falls back to DuckDuckGo with a note.`)}),(0,K.jsx)($,{label:a(`Provider`),children:(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.providers.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>p(e.id),className:I(f===e.id),children:e.label},e.id))})}),k&&(0,K.jsxs)($,{label:a(`API key`),hint:o.key_source===`vault`&&o.provider===f?a(`A key is in the vault. Leave blank to keep it.`):a(`Stored encrypted in the vault as SEARCH_API_KEY.`),children:[(0,K.jsx)(`input`,{type:`password`,value:g,onChange:e=>_(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:o.key_source===`vault`&&o.provider===f?`••••••••`:`…`,autoComplete:`off`}),O?.keys_url&&(0,K.jsx)(`a`,{href:O.keys_url,target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-block text-[12px] text-accent`,children:a(`Get a key from {label}`,{label:O.label})})]}),f===`searxng`&&(0,K.jsx)($,{label:a(`Instance URL`),hint:a(`A SearXNG you run, with the JSON format enabled in its settings.`),children:(0,K.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:`http://127.0.0.1:8080`,inputMode:`url`})}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:v||!L,onClick:()=>void P(),className:D,children:[v?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),` `,a(`Save`)]}),(0,K.jsxs)(`button`,{type:`button`,disabled:S,onClick:()=>void F(),className:T,children:[S?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,a(`Test`)]})]}),b&&(0,K.jsx)(Ue,{result:b,okText:a(`{provider} · {n} results · {ms} ms`,{provider:b.provider??``,n:b.results??0,ms:b.ms??0})})]})}var Me=[{id:`gmail`,label:`Gmail`,imap:`imap.gmail.com`,smtp:`smtp.gmail.com`,port:587,starttls:!0},{id:`outlook`,label:`Outlook`,imap:`outlook.office365.com`,smtp:`smtp.office365.com`,port:587,starttls:!0},{id:`icloud`,label:`iCloud`,imap:`imap.mail.me.com`,smtp:`smtp.mail.me.com`,port:587,starttls:!0},{id:`qq`,label:`QQ`,imap:`imap.qq.com`,smtp:`smtp.qq.com`,port:587,starttls:!0},{id:`163`,label:`163`,imap:`imap.163.com`,smtp:`smtp.163.com`,port:465,starttls:!1},{id:`fastmail`,label:`Fastmail`,imap:`imap.fastmail.com`,smtp:`smtp.fastmail.com`,port:587,starttls:!0}];function Ne({data:e,onChange:n,compact:i}){let{toast:a}=c(),o=r(),s=e.email,[d,f]=(0,G.useState)(!!i),[p,m]=(0,G.useState)(s.address),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(s.imap_host),[y,b]=(0,G.useState)(s.imap_port),[x,S]=(0,G.useState)(s.smtp_host),[C,w]=(0,G.useState)(s.smtp_port),[T,E]=(0,G.useState)(s.smtp_starttls),[k,j]=(0,G.useState)(null),[M,P]=(0,G.useState)(null);(0,G.useEffect)(()=>{m(s.address),v(s.imap_host),b(s.imap_port),S(s.smtp_host),w(s.smtp_port),E(s.smtp_starttls)},[s]);let F=e=>{v(e.imap),b(993),S(e.smtp),w(e.port),E(e.starttls)},I=async()=>{j(`save`),P(null);try{await u.setEmail({enabled:!0,address:p.trim(),password:h||void 0,imap_host:_.trim(),imap_port:y,smtp_host:x.trim(),smtp_port:C,smtp_starttls:T}),g(``);let e=await u.testEmail();P(e),a(e.ok?o(`Email connected`):o(`Saved, but the test failed`)),n()}catch(e){a(e.message)}finally{j(null)}},L=async()=>{j(`off`);try{await u.disconnectEmail(),P(null),a(o(`Email disconnected`)),n()}catch(e){a(e.message)}finally{j(null)}},ee=s.enabled&&s.configured?{text:o(`Connected`),tone:`ok`}:s.enabled?{text:o(`Incomplete`),tone:`warn`}:{text:o(`Not connected`),tone:`off`};return(0,K.jsxs)(A,{icon:(0,K.jsx)(re,{size:19}),title:o(`Email`),summary:s.configured&&s.enabled?`${s.address} · ${o(`reads and sends`)}`:o(`Read your inbox, draft and send mail`),status:ee,open:d,onToggle:i?void 0:()=>f(!d),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted -mt-1`,children:o(`Reading is a moderate action; sending always asks you first. Use an app password where your provider offers one.`)}),(0,K.jsx)($,{label:o(`Provider`),children:(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Me.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>F(e),className:t(`rounded-full px-3 py-1.5 text-[13px] border`,_===e.imap?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:e.label},e.id))})}),(0,K.jsx)($,{label:o(`Address`),children:(0,K.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),className:O,placeholder:`you@example.com`,inputMode:`email`,autoComplete:`off`})}),(0,K.jsx)($,{label:o(`Password`),hint:s.password_set?o(`A password is in the vault. Leave blank to keep it.`):o(`Stored encrypted in the vault as EMAIL_PASSWORD.`),children:(0,K.jsx)(`input`,{type:`password`,value:h,onChange:e=>g(e.target.value),className:O,placeholder:s.password_set?`••••••••`:o(`app password`),autoComplete:`off`})}),(0,K.jsxs)(`div`,{className:`grid grid-cols-[1fr_84px] gap-2`,children:[(0,K.jsx)($,{label:o(`IMAP server`),children:(0,K.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:O,placeholder:`imap.example.com`})}),(0,K.jsx)($,{label:o(`Port`),children:(0,K.jsx)(`input`,{type:`number`,value:y,onChange:e=>b(Number(e.target.value)),className:O})}),(0,K.jsx)($,{label:o(`SMTP server`),children:(0,K.jsx)(`input`,{value:x,onChange:e=>S(e.target.value),className:O,placeholder:`smtp.example.com`})}),(0,K.jsx)($,{label:o(`Port`),children:(0,K.jsx)(`input`,{type:`number`,value:C,onChange:e=>w(Number(e.target.value)),className:O})})]}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-[13.5px]`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:T,onChange:e=>E(e.target.checked),className:`accent-[var(--om-accent)]`}),` `,o(`STARTTLS for SMTP (off for port 465)`)]}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:k!==null||!p.trim()||!_.trim()||!x.trim()||!h&&!s.password_set,onClick:()=>void I(),className:D,children:[k===`save`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,s.configured?o(`Save & test`):o(`Connect`)]}),s.enabled&&(0,K.jsxs)(`button`,{type:`button`,disabled:k!==null,onClick:()=>void L(),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:[k===`off`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(de,{size:16}),` `,o(`Disconnect`)]})]}),M&&(0,K.jsx)(Ue,{result:M,okText:o(`Signed in · {n} messages in the inbox`,{n:M.inbox??`?`})})]})}var Pe=[{id:`google`,label:`Google`,hint:`Settings → your calendar → Integrate calendar → Secret address in iCal format`},{id:`outlook`,label:`Outlook`,hint:`Settings → Calendar → Shared calendars → Publish a calendar → ICS link`},{id:`icloud`,label:`iCloud`,hint:`Share Calendar → Public Calendar → copy the webcal:// link`},{id:`fastmail`,label:`Fastmail`,hint:`Settings → Calendars → Export → Calendar URL`},{id:`file`,label:`.ics file`,hint:`A path on the machine where nanoMuse runs, for example ~/calendar.ics`}];function Fe({data:n,onChange:i,compact:a}){let{toast:o}=c(),s=r(),d=n.calendar,[f,p]=(0,G.useState)(!!a),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(null),[S,w]=(0,G.useState)(d.day_start),[E,k]=(0,G.useState)(d.day_end),[j,M]=(0,G.useState)(null),[F,I]=(0,G.useState)(null);(0,G.useEffect)(()=>{w(d.day_start),k(d.day_end)},[d.day_start,d.day_end]);let L=async()=>{M(`add`),I(null);try{let e=await u.addCalendarFeed(g.trim(),v.trim());if(e.error)o(s(`Added, but it could not be read: {error}`,{error:e.error}));else{let t=e.feeds.find(e=>e.name===g.trim());o(`${s(`Calendar connected`)} · ${U(t?.events??0)}`),_(``),y(``),h(!1)}i()}catch(e){o(e.message)}finally{M(null)}},ee=async e=>{M(e);try{await u.removeCalendarFeed(e),i()}catch(e){o(e.message)}finally{M(null)}},te=async()=>{M(`hours`);try{await u.setCalendar({day_start:S,day_end:E}),o(s(`Saved`)),i()}catch(e){o(e.message)}finally{M(null)}},R=async()=>{M(`test`);try{I(await u.testCalendar()),i()}catch(e){o(e.message)}finally{M(null)}},B=d.feeds.reduce((e,t)=>e+t.events,0),H=d.feeds.filter(e=>e.error).length,U=e=>e===1?s(`1 event`):s(`{n} events`,{n:e}),ne=d.configured?H?{text:s(`{n} not reading`,{n:H}),tone:`warn`}:{text:s(`Connected`),tone:`ok`}:{text:s(`Not connected`),tone:`off`};return(0,K.jsxs)(A,{icon:(0,K.jsx)(ae,{size:19}),title:s(`Calendar`),summary:d.configured?d.feeds.length===1?`${d.feeds[0].name} · ${U(B)}`:`${s(`{n} calendars`,{n:d.feeds.length})} · ${U(B)}`:s(`Your agenda, free time, and events it can draft`),status:ne,open:f,onToggle:a?void 0:()=>p(!f),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted -mt-1`,children:s(`Reads your calendar from its private .ics link; the link stays in the vault. It never changes your calendar; an event it proposes comes as a file you add with a tap.`)}),d.feeds.length>0&&(0,K.jsx)(`ul`,{className:`space-y-1.5`,children:d.feeds.map(n=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:t(`h-2 w-2 rounded-full`,n.error?`bg-rose-500`:n.fetched_at?`bg-emerald-500`:`bg-amber-500`)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:n.name}),(0,K.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[n.error?n.error:n.fetched_at?`${U(n.events)} · ${s(`read {when}`,{when:e(n.fetched_at)})}`:s(`not read yet`),!n.from_app&&` · ${s(`from config.toml`)}`]})]}),n.from_app&&(0,K.jsx)(`button`,{type:`button`,"aria-label":s(`Remove`),disabled:j===n.name,onClick:()=>void ee(n.name),className:`p-1.5 rounded-full text-muted hover:bg-surface-2`,children:j===n.name?(0,K.jsx)(l,{size:15,className:`animate-spin`}):(0,K.jsx)(z,{size:15})})]},n.name))}),m?(0,K.jsxs)(`div`,{className:`space-y-2.5 rounded-2xl border border-border/70 p-3`,children:[(0,K.jsxs)($,{label:s(`Where is the link?`),children:[(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Pe.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>x(b===e.id?null:e.id),className:t(`rounded-full px-3 py-1.5 text-[13px] border`,b===e.id?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:s(e.label)},e.id))}),b&&(0,K.jsx)(`div`,{className:`mt-1.5 text-[11.5px] text-muted leading-snug`,children:s(Pe.find(e=>e.id===b).hint)})]}),(0,K.jsx)($,{label:s(`Name`),children:(0,K.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:O,placeholder:s(`Work`)})}),(0,K.jsx)($,{label:s(`Private .ics link or file path`),hint:s(`Stored encrypted in the vault as CALENDAR_{name}.`,{name:g.trim().toUpperCase().replace(/[^A-Z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`NAME`})+` `+s(`nanoMuse fetches whatever address you put here, from this machine; only paste links you trust.`),children:(0,K.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),className:O,placeholder:`https://calendar.google.com/calendar/ical/…/basic.ics`,inputMode:`url`,autoComplete:`off`})}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:j===`add`||!g.trim()||!v.trim(),onClick:()=>void L(),className:D,children:[j===`add`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,s(`Connect`)]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:T,children:s(`Cancel`)})]})]}):(0,K.jsxs)(`button`,{type:`button`,onClick:()=>h(!0),className:T,children:[(0,K.jsx)(V,{size:16}),` `,s(`Add a calendar`)]}),d.configured&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{label:s(`Working hours`),hint:s(`Free time is looked for inside these hours.`),children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`time`,value:S,onChange:e=>w(e.target.value),className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`w-auto`)}),(0,K.jsx)(`span`,{className:`text-muted`,children:`–`}),(0,K.jsx)(`input`,{type:`time`,value:E,onChange:e=>k(e.target.value),className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`w-auto`)}),(S!==d.day_start||E!==d.day_end)&&(0,K.jsx)(`button`,{type:`button`,disabled:j===`hours`,onClick:()=>void te(),className:t(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`px-3`),"aria-label":s(`Save`),children:j===`hours`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16})})]})}),(0,K.jsxs)(`button`,{type:`button`,disabled:j===`test`,onClick:()=>void R(),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:[j===`test`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(P,{size:16}),` `,s(`Read again`)]}),F&&(0,K.jsx)(Ue,{result:F,okText:d.feeds.length===1?U(F.events??0):`${U(F.events??0)} · ${s(`{n} calendars`,{n:d.feeds.length})}`})]})]})}function Ie({data:n,onChange:i,compact:a}){let{toast:o}=c(),s=r(),d=n.contacts,[f,p]=(0,G.useState)(!!a),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(null),[w,E]=(0,G.useState)(``),[k,j]=(0,G.useState)(null),M=(0,G.useRef)(null),F=e=>e===1?s(`1 person`):s(`{n} people`,{n:e}),I=(e,t)=>{if(e.error)o(s(`Added, but it could not be read: {error}`,{error:e.error}));else{let n=e.sources.find(e=>e.name===t);o(`${s(`Address book connected`)} · ${F(n?.contacts??0)}`),_(``),y(``),h(!1)}i()},L=async()=>{x(`add`),C(null);try{I(await u.addContactsSource(g.trim(),v.trim()),g.trim())}catch(e){o(e.message)}finally{x(null)}},ee=async e=>{x(`upload`),C(null);try{let t=(g.trim()||e.name.replace(/\.vcf$/i,``)||`Imported`).slice(0,40);I(await u.importContacts(t,await e.text()),t)}catch(e){o(e.message)}finally{x(null),M.current&&(M.current.value=``)}},te=async e=>{x(e);try{await u.removeContactsSource(e),i()}catch(e){o(e.message)}finally{x(null)}},R=async()=>{x(`test`);try{C(await u.testContacts()),i()}catch(e){o(e.message)}finally{x(null)}};(0,G.useEffect)(()=>{if(!w.trim()){j(null);return}let e=setTimeout(()=>{u.contacts(w.trim(),5).then(e=>j(e.people)).catch(()=>j([]))},250);return()=>clearTimeout(e)},[w]);let H=d.sources.filter(e=>e.error).length,U=d.enabled?d.configured?H?{text:s(`{n} not reading`,{n:H}),tone:`warn`}:{text:s(`Connected`),tone:`ok`}:{text:s(`Not connected`),tone:`off`}:{text:s(`Off`),tone:`off`};return(0,K.jsxs)(A,{icon:(0,K.jsx)(W,{size:19}),title:s(`Contacts`),summary:d.configured?d.sources.length===0?`${F(d.count)} · ${s(`told to it in chat`)}`:`${F(d.count)} · ${d.sources.length===1?d.sources[0].name:s(`{n} address books`,{n:d.sources.length})}`:s(`Who is who, so it never guesses an address`),status:U,open:f,onToggle:a?void 0:()=>p(!f),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted -mt-1`,children:s(`Import a .vcf export from Google Contacts, iCloud, Outlook or your phone, or paste a link to one. People you mention in chat go into its own book. It looks people up before writing to them and warns when an address is unknown.`)}),(d.sources.length>0||d.own>0)&&(0,K.jsxs)(`ul`,{className:`space-y-1.5`,children:[d.own>0&&(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-500`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:s(`My contacts`)}),(0,K.jsx)(`div`,{className:`text-[11.5px] text-muted truncate`,children:`${F(d.own)} · ${s(`added in chat`)}`})]})]}),d.sources.map(n=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:t(`h-2 w-2 rounded-full`,n.error?`bg-rose-500`:n.fetched_at?`bg-emerald-500`:`bg-amber-500`)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:n.name}),(0,K.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[n.error?n.error:n.fetched_at?`${F(n.contacts)} · ${s(`read {when}`,{when:e(n.fetched_at)})}`:s(`not read yet`),!n.from_app&&` · ${s(`from config.toml`)}`]})]}),n.from_app&&(0,K.jsx)(`button`,{type:`button`,"aria-label":s(`Remove`),disabled:b===n.name,onClick:()=>void te(n.name),className:`p-1.5 rounded-full text-muted hover:bg-surface-2`,children:b===n.name?(0,K.jsx)(l,{size:15,className:`animate-spin`}):(0,K.jsx)(z,{size:15})})]},n.name))]}),m?(0,K.jsxs)(`div`,{className:`space-y-2.5 rounded-2xl border border-border/70 p-3`,children:[(0,K.jsx)($,{label:s(`Name`),children:(0,K.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:O,placeholder:s(`iPhone`)})}),(0,K.jsxs)($,{label:s(`A .vcf file from your phone or computer`),hint:s(`Google Contacts: Export → vCard. iPhone: Contacts → select all → Share → Save to Files. Outlook: People → Manage → Export.`),children:[(0,K.jsx)(`input`,{ref:M,type:`file`,accept:`.vcf,text/vcard,text/x-vcard`,className:`hidden`,onChange:e=>e.target.files?.[0]&&void ee(e.target.files[0])}),(0,K.jsxs)(`button`,{type:`button`,disabled:b===`upload`,onClick:()=>M.current?.click(),className:T,children:[b===`upload`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(fe,{size:16}),` `,s(`Choose a .vcf file`)]})]}),(0,K.jsx)($,{label:s(`Or a link / path to one`),hint:s(`A link is stored encrypted in the vault as CONTACTS_{name}.`,{name:g.trim().toUpperCase().replace(/[^A-Z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`NAME`})+` `+s(`nanoMuse fetches whatever address you put here, from this machine; only paste links you trust.`),children:(0,K.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),className:O,placeholder:`https://… /contacts.vcf`,inputMode:`url`,autoComplete:`off`})}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:b===`add`||!g.trim()||!v.trim(),onClick:()=>void L(),className:D,children:[b===`add`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,s(`Connect`)]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:T,children:s(`Cancel`)})]})]}):(0,K.jsxs)(`button`,{type:`button`,onClick:()=>h(!0),className:T,children:[(0,K.jsx)(V,{size:16}),` `,s(`Add an address book`)]}),d.configured&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(B,{size:15,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted`}),(0,K.jsx)(`input`,{value:w,onChange:e=>E(e.target.value),className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`pl-9`),placeholder:s(`Find someone, as the agent would`),autoComplete:`off`})]}),k!==null&&(0,K.jsxs)(`ul`,{className:`space-y-1`,children:[k.length===0&&(0,K.jsx)(`li`,{className:`text-[12.5px] text-muted px-1`,children:s(`No one matches.`)}),k.map(e=>(0,K.jsxs)(`li`,{className:`rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`text-[13.5px] font-medium`,children:[e.name,e.org&&(0,K.jsxs)(`span`,{className:`text-muted font-normal`,children:[` · `,e.org]})]}),(0,K.jsx)(`div`,{className:`text-[12px] text-muted break-words`,children:[...e.emails,...e.phones].join(` · `)})]},e.id))]}),d.sources.length>0&&(0,K.jsxs)(`button`,{type:`button`,disabled:b===`test`,onClick:()=>void R(),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:[b===`test`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(P,{size:16}),` `,s(`Read again`)]}),S&&(0,K.jsx)(Ue,{result:S,okText:F(S.contacts??0)})]})]})}function Q({data:e,onChange:n}){let{toast:i}=c(),a=r(),o=e.browser,[s,l]=(0,G.useState)(!1),d=async()=>{l(!0);try{await u.setBrowser(!o.enabled),n()}catch(e){i(e.message)}finally{l(!1)}};return(0,K.jsx)(A,{icon:(0,K.jsx)(ne,{size:19}),title:a(`Browser`),summary:o.available?a(`Open pages, click, fill forms, screenshot`):a(`Playwright is not installed on the server`),status:o.enabled&&o.available?{text:a(`On`),tone:`ok`}:o.enabled?{text:a(`Unavailable`),tone:`warn`}:{text:a(`Off`),tone:`off`},open:!1,trailing:(0,K.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o.enabled,disabled:s,onClick:()=>void d(),className:t(`relative h-7 w-12 shrink-0 rounded-full transition`,o.enabled?`bg-accent`:`bg-surface-2 border border-border`),children:(0,K.jsx)(`span`,{className:t(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,o.enabled?`left-[22px]`:`left-0.5`)})}),children:!o.available&&(0,K.jsxs)(`p`,{className:`text-[12.5px] text-muted`,children:[a(`Install it where the server runs:`),` `,(0,K.jsx)(`code`,{className:`rounded bg-surface-2 px-1`,children:`pip install "nanomuse[browser]" && playwright install chromium`})]})})}function Le({data:e,onChange:n}){let{toast:i}=c(),a=r(),o=e.gui,[s,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(o.model),[g,_]=(0,G.useState)(o.base_url),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(null);(0,G.useEffect)(()=>{h(o.model),_(o.base_url)},[o.model,o.base_url]);let S=async()=>{p(!0);try{await u.setGui({enabled:!o.enabled}),n()}catch(e){i(e.message)}finally{p(!1)}},w=async()=>{p(!0),x(null);try{await u.setGui({model:m.trim(),base_url:g.trim(),...v?{api_key:v.trim()}:{}}),y(``),n(),x(await u.testGui())}catch(e){i(e.message)}finally{p(!1)}},T=o.phone,[E,k]=(0,G.useState)(R),j=(0,G.useRef)(E);(0,G.useEffect)(()=>{if(!s)return;let e=()=>{let e=R();e!==j.current&&(j.current=e,k(e),setTimeout(n,400))};return e(),document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,e)}},[s,n]);let M=T.connected?a(`{name} is connected`,{name:T.device?.name??a(`A phone`)}):o.enabled?a(`No phone connected. Open the app on the phone`):a(`Tap, type and swipe in the apps on your phone`);return(0,K.jsxs)(A,{icon:(0,K.jsx)(L,{size:19}),title:a(`Phone`),summary:M,status:o.enabled&&T.connected?{text:a(`On`),tone:`ok`}:o.enabled?{text:a(`Waiting`),tone:`warn`}:{text:a(`Off`),tone:`off`},open:s,onToggle:()=>d(e=>!e),children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`text-[13px] leading-snug`,children:[(0,K.jsx)(`div`,{className:`font-medium`,children:a(`Operate the phone`)}),(0,K.jsx)(`div`,{className:`text-[12px] text-muted`,children:a(`When on, the agent can read the screen and act in the apps on the connected phone: 12306, WeChat, Alipay… It asks before paying, sending or deleting.`)})]}),(0,K.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o.enabled,disabled:f,onClick:()=>void S(),className:t(`relative h-7 w-12 shrink-0 rounded-full transition`,o.enabled?`bg-accent`:`bg-surface-2 border border-border`),children:(0,K.jsx)(`span`,{className:t(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,o.enabled?`left-[22px]`:`left-0.5`)})})]}),E!==null&&(0,K.jsxs)(`div`,{className:`rounded-2xl bg-surface-2 px-3 py-2.5 text-[12.5px] leading-snug space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:a(`This phone`)}),(0,K.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,E===`on`&&`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`,E===`off`&&`bg-amber-500/15 text-amber-700 dark:text-amber-300`,E===`unsupported`&&`bg-surface text-muted`),children:a(E===`on`?`Ready`:E===`off`?`Not yet`:`Not on this Android`)})]}),E===`unsupported`&&(0,K.jsx)(`div`,{className:`text-muted`,children:a(`Operating the screen needs Android 11 or newer; this phone can still be used for everything else.`)}),E===`off`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`text-muted`,children:a(`Turn on the nanoMuse accessibility service; that is how it sees the screen and taps for you, only while a task runs, with a Stop button on screen.`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-0.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>I()?.openAccessibilitySettings?.(),className:`rounded-full bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white`,children:a(`Open Accessibility settings`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>I()?.openAppSettings?.(),className:`rounded-full border border-border px-3 py-1.5 text-[12.5px]`,children:a(`App settings`)})]}),(0,K.jsx)(`div`,{className:`text-muted`,children:a(`Greyed out with “Restricted setting”? Android 13+ does that for apps installed from a download: in App settings tap ⋮ → Allow restricted settings, then come back.`)})]}),E===`on`&&(0,K.jsx)(`div`,{className:`text-muted`,children:a(`Android may switch the service off after an update or a battery clean-up; if the phone stops answering, come back here.`)})]}),T.connected&&T.device&&(0,K.jsxs)(`div`,{className:`rounded-2xl bg-surface-2 px-3 py-2 text-[12.5px] text-muted`,children:[a(`{name} ({platform}), {n} apps`,{name:T.device.name,platform:T.device.platform,n:String(T.device.apps)}),T.last_screen&&(0,K.jsxs)(K.Fragment,{children:[` `,`·`,` `,a(`last seen in {app}`,{app:T.last_screen.app_name||T.last_screen.app})]})]}),(0,K.jsx)(`div`,{className:`text-[12px] text-muted leading-snug`,children:a(`The operator's model looks at screens step by step: a small, fast model that takes pictures. The Hands model row under Chat model picks one on the same endpoint and key; the fields here are for a different endpoint. Empty = {model}.`,{model:o.default_model||a(`the chat model`)})}),(0,K.jsx)($,{label:a(`Model`),children:(0,K.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:o.default_model||a(`same as the chat model`),className:O})}),(0,K.jsx)($,{label:a(`Base URL`),children:(0,K.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),placeholder:a(`same as the chat model`),className:O})}),(0,K.jsx)($,{label:a(`API key`),hint:o.key_source===`vault`?a(`A key is in the vault; leave empty to keep it.`):o.key_source===`config`?a(`Set in config.toml.`):a(`Leave empty to use the main model's key.`),children:(0,K.jsx)(`input`,{type:`password`,value:v,onChange:e=>y(e.target.value),placeholder:`sk-…`,className:O,autoComplete:`off`})}),(0,K.jsxs)(`button`,{type:`button`,disabled:f,onClick:()=>void w(),className:D,children:[f?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),a(`Save and test`)]}),b&&(0,K.jsx)(Ue,{result:b,okText:a(`The operator's model answers.`)})]})}function Re({data:e,onChange:n}){let{toast:i}=c(),a=r(),[o,s]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(`moderate`),[x,S]=(0,G.useState)(null),C=async()=>{S(`add`);try{let e=h.trim().split(/\s+/).filter(Boolean);await u.addMCP({name:p.trim(),command:e[0]??null,args:e.slice(1),url:_.trim()||null,risk:y}),m(``),g(``),v(``),f(!1),i(a(`Server connected`)),n()}catch(e){i(e.message)}finally{S(null)}},w=async e=>{S(e);try{await u.removeMCP(e),n()}catch(e){i(e.message)}finally{S(null)}},E=e.mcp.filter(e=>e.connected).length,k=(e.shared??[]).filter(e=>e.enabled&&!e.here),j=e=>{m(e.id),v(e.url),g(``),f(!0),s(!0)};return(0,K.jsxs)(A,{icon:(0,K.jsx)(N,{size:19}),title:a(`MCP servers`),summary:e.mcp.length?a(`{n} of {total} connected · {tools} tools`,{n:E,total:e.mcp.length,tools:e.mcp.reduce((e,t)=>e+t.tools,0)}):a(`Add tools from any Model Context Protocol server`),status:e.mcp.length?{text:a(`{n} on`,{n:E}),tone:E?`ok`:`warn`}:{text:a(`None`),tone:`off`},open:o,onToggle:()=>s(!o),children:[e.mcp.length>0&&(0,K.jsx)(`ul`,{className:`space-y-1.5`,children:e.mcp.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:t(`h-2 w-2 rounded-full`,e.connected?`bg-emerald-500`:`bg-rose-500`)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:e.builtin?a(`This phone`):e.name}),(0,K.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[e.builtin?a(`clipboard, notifications, calendar, contacts, location, alarms, photos`):e.url??[e.command,...e.args].join(` `),` ·`,` `,a(`{n} tools`,{n:e.tools}),` · `,a(e.risk),!e.from_app&&!e.builtin&&` · ${a(`from config.toml`)}`]})]}),e.from_app&&(0,K.jsx)(`button`,{type:`button`,"aria-label":a(`Remove`),disabled:x===e.name,onClick:()=>void w(e.name),className:`p-1.5 rounded-full text-muted hover:bg-surface-2`,children:x===e.name?(0,K.jsx)(l,{size:15,className:`animate-spin`}):(0,K.jsx)(z,{size:15})})]},e.name))}),k.length>0&&(0,K.jsx)(`ul`,{className:`space-y-1.5`,children:k.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl border border-dashed border-border/70 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-border`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:e.label||e.id}),(0,K.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[a(`Connected on {device}; sign in here to use it on this device`,{device:e.device||e.device_id}),e.url?` · ${e.url}`:``]})]}),e.url&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>j(e),className:t(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`py-1.5 text-[12.5px]`),children:a(`Sign in here`)})]},`${e.device_id}:${e.id}`))}),d?(0,K.jsxs)(`div`,{className:`space-y-2.5 rounded-2xl border border-border/70 p-3`,children:[(0,K.jsx)($,{label:a(`Name`),children:(0,K.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),className:O,placeholder:`filesystem`})}),(0,K.jsx)($,{label:a(`Command`),hint:a(`Run locally over stdio, for example: npx -y @modelcontextprotocol/server-filesystem ./workspace`),children:(0,K.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),className:O,placeholder:`npx -y @modelcontextprotocol/server-…`})}),(0,K.jsx)($,{label:a(`or URL`),hint:a(`A remote server over Streamable HTTP.`),children:(0,K.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:O,placeholder:`https://host/mcp`,inputMode:`url`})}),(0,K.jsx)($,{label:a(`Risk of its tools`),hint:a(`Decides when the Sentinel asks you before a call.`),children:(0,K.jsx)(`div`,{className:`flex gap-1.5`,children:[`safe`,`moderate`,`high`].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>b(e),className:t(`rounded-full px-3 py-1.5 text-[13px] border`,y===e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:a(e)},e))})}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:x===`add`||!p.trim()||!(h.trim()||_.trim()),onClick:()=>void C(),className:D,children:[x===`add`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,a(`Connect`)]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>f(!1),className:T,children:a(`Cancel`)})]})]}):(0,K.jsxs)(`button`,{type:`button`,onClick:()=>f(!0),className:T,children:[(0,K.jsx)(V,{size:16}),` `,a(`Add a server`)]})]})}function ze({data:e,onChange:n}){let{toast:i}=c(),a=r(),[o,s]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(null),_=async()=>{g(`add`);try{await u.vaultSet(d.trim(),p),f(``),m(``),i(a(`Stored in the vault`)),n()}catch(e){i(e.message)}finally{g(null)}},v=async e=>{g(e);try{await u.vaultDelete(e),n()}catch(e){i(e.message)}finally{g(null)}};return(0,K.jsxs)(A,{icon:(0,K.jsx)(ie,{size:19}),title:a(`Vault`),summary:e.vault.length?a(`{n} secrets · encrypted on your machine`,{n:e.vault.length}):a(`Encrypted secrets the model never sees`),status:{text:`${e.vault.length}`,tone:`off`},open:o,onToggle:()=>s(!o),children:[(0,K.jsxs)(`p`,{className:`text-[12.5px] text-muted -mt-1`,children:[a(`Refer to a secret as`),` `,(0,K.jsx)(`code`,{className:`rounded bg-surface-2 px-1`,children:`{{vault:NAME}}`}),` `,a(`in a tool call or config: the value is filled in after the Sentinel approves and is redacted from everything the model reads.`)]}),e.vault.length>0&&(0,K.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,children:e.vault.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-1 rounded-full bg-surface-2 pl-3 pr-1 py-1 text-[12.5px] font-mono`,children:[e,(0,K.jsx)(`button`,{type:`button`,"aria-label":a(`Delete {name}`,{name:e}),disabled:h===e,onClick:()=>void v(e),className:`p-1 rounded-full text-muted hover:text-rose-500`,children:h===e?(0,K.jsx)(l,{size:13,className:`animate-spin`}):(0,K.jsx)(z,{size:13})})]},e))}),(0,K.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_auto] gap-2 items-end`,children:[(0,K.jsx)($,{label:a(`Name`),children:(0,K.jsx)(`input`,{value:d,onChange:e=>f(e.target.value.toUpperCase().replace(/[^A-Z0-9_.-]/g,`_`)),className:t(O,`font-mono`),placeholder:`GITHUB_TOKEN`})}),(0,K.jsx)($,{label:a(`Value`),children:(0,K.jsx)(`input`,{type:`password`,value:p,onChange:e=>m(e.target.value),className:O,placeholder:a(`secret`),autoComplete:`off`})}),(0,K.jsx)(`button`,{type:`button`,disabled:h===`add`||!d||!p,onClick:()=>void _(),className:t(D,`px-3`),"aria-label":a(`Store`),children:h===`add`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(V,{size:16})})]})]})}var Be=`\0other`;function Ve({label:e,provider:n,value:i,options:a,more:o=[],onChange:s,other:c=!0,placeholder:l}){let u=r(),d=a.includes(i)||o.includes(i),[f,p]=(0,G.useState)(!1),m=l?u(`Automatic · {model}`,{model:l}):u(`Automatic`),h=e=>e.map(e=>({id:e,name:e})),g=o.length?[{key:`menu`,label:u(`Menu`),rows:h(a),...l?{default:l}:{}},{key:`more`,label:u(`More models on your account`),rows:h(o)}]:[{key:`list`,label:n,rows:h(a),...l?{default:l}:{}}],_=i&&d?{group:a.includes(i)?g[0].key:`more`,id:i}:void 0;return(0,K.jsxs)(`div`,{className:`block text-[12.5px] text-muted`,children:[(0,K.jsx)(`span`,{className:`block mb-1`,children:e}),(a.length||o.length)&&(d||!i)&&!f?(0,K.jsx)(ve,{label:e,text:i?`${n} · ${i}`:m,heads:[{value:``,label:m}],headValue:i?void 0:``,groups:g,current:_,onHead:()=>s(``),onPick:(e,t)=>s(t.id),tail:c?u(`Other model…`):void 0,onTail:()=>{p(!0),s(``)}}):(0,K.jsx)(`input`,{value:i,onChange:e=>s(e.target.value),placeholder:m,"aria-label":e,className:t(O,`text-fg`),spellCheck:!1})]})}function He(){let e=r();return(0,K.jsxs)(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-accent`,children:[e(`How`),` `,(0,K.jsx)(w,{size:11})]})}function $({label:e,hint:t,children:n}){return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[12px] text-muted`,children:e}),(0,K.jsx)(`div`,{className:`mt-1`,children:n}),t&&(0,K.jsx)(`div`,{className:`mt-1 text-[11.5px] text-muted leading-snug`,children:t})]})}function Ue({result:e,okText:n}){let i=r(),[a,o]=(0,G.useState)(!1),s=!e.ok&&e.detail&&e.detail!==e.error?e.detail:null;return(0,K.jsxs)(`div`,{className:t(`rounded-2xl px-3 py-2 text-[12.5px]`,e.ok?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:`bg-rose-500/12 text-rose-700 dark:text-rose-300`),children:[e.ok?n:i(e.error??`The model provider did not answer.`),s&&(0,K.jsxs)(K.Fragment,{children:[` `,(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`underline decoration-dotted underline-offset-2 opacity-70 hover:opacity-100`,children:i(a?`Hide details`:`Details`)}),a&&(0,K.jsx)(`div`,{className:`mt-1.5 break-all font-mono text-[11px] opacity-80`,children:s})]})]})}function We(e){try{return new URL(e).host}catch{return e}}export{Fe as CalendarCard,Oe as ConnectionsScreen,Ie as ContactsCard,Ne as EmailCard,Z as ModelCard};
\ No newline at end of file
+import{A as e,E as t,J as n,K as r,L as i,Q as a,Y as o,b as s,f as c,q as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{C as d,O as f,S as p,b as m,f as h,g,h as _,k as v,m as y,v as b,w as x,x as S}from"./StarNudge-DjXecvWj.js";import{n as C,t as w}from"./external-link-Xj5fjR8v.js";import{a as T,c as E,i as D,r as O,s as k,t as A}from"./Form-DwKuBk1V.js";import{t as j}from"./clapperboard-BokpXv9J.js";import{t as M}from"./image-crWy0a06.js";import{t as N}from"./plug-Bj_5EEV3.js";import{t as P}from"./refresh-cw-BKgIzslL.js";import{Ct as F,E as I,G as L,N as ee,P as te,T as R,V as z,X as B,Z as V,j as H,lt as U,pt as ne,st as re,ut as ie,xt as ae}from"./index-CIdGZ5PB.js";import{t as oe}from"./BackBar-Dl56jHZM.js";import{t as se}from"./CloudCard-CtVHK0qc.js";var ce=n(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),W=n(`contact`,[[`path`,{d:`M16 2v2`,key:`scm5qe`}],[`path`,{d:`M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2`,key:`1waht3`}],[`path`,{d:`M8 2v2`,key:`pbkmx`}],[`circle`,{cx:`12`,cy:`11`,r:`3`,key:`itu57m`}],[`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,key:`12vinp`}]]),le=n(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ue=n(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),de=n(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),fe=n(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),G=a(o(),1);function pe(e,t){let n=t.trim().toLowerCase();return!n||e.id.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)}function me(e,t){let n=e.default&&e.rows.some(t=>t.id===e.default)?e.default:e.rows.find(e=>e.recommended)?.id,r=t&&t.group===e.key?t.id:void 0,i=[];for(let t of[n,r]){if(!t||i.some(e=>e.id===t))continue;let n=e.rows.find(e=>e.id===t);n&&i.push(n)}return[...i,...e.rows.filter(e=>!i.includes(e))]}function he(e){return e.reduce((e,t)=>e+t.rows.length,0)}function ge(e){return he(e)>8}function _e(e,{current:t,query:n=``,expanded:r}={}){let i=n.trim().length>0,a=[];for(let o of e){let e=me(o,t);if(i){let t=e.filter(e=>pe(e,n));t.length&&a.push({key:o.key,label:o.label,rows:t,more:0});continue}e.length>8&&!r?.has(o.key)?a.push({key:o.key,label:o.label,rows:e.slice(0,8),more:e.length-8}):a.push({key:o.key,label:o.label,rows:e,more:0})}return a}var K=s(),q=`flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-[14px] hover:bg-surface-2 focus:bg-surface-2 focus:outline-none`;function ve({label:e,text:n,heads:i=[],headValue:a,tail:o,groups:s,current:c,disabled:l,onHead:u,onPick:d,onTail:f,rowText:p}){let m=r(),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(()=>new Set),[x,S]=(0,G.useState)(!1),w=(0,G.useRef)(null),T=(0,G.useRef)(null),D=ge(s),k=(0,G.useCallback)((e=!1)=>{g(!1),v(``),b(new Set),S(e)},[]);(0,G.useEffect)(()=>{!h&&x&&(S(!1),w.current?.focus())},[h,x]),(0,G.useEffect)(()=>{if(!h)return;let e=e=>{let t=e.target;T.current?.contains(t)||w.current?.contains(t)||k()},t=e=>{e.key===`Escape`&&(e.stopPropagation(),k(!0))};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`keydown`,t,!0),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,t,!0)}},[h,k]),(0,G.useEffect)(()=>{h&&T.current&&(T.current.querySelector(`input`)??T.current.querySelector(`[aria-selected="true"]`)??T.current.querySelector(`[data-row]`))?.focus()},[h]);let A=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=[...e.currentTarget.closest(`[role="listbox"]`)?.querySelectorAll(`[data-row]`)??[]];if(!t.length)return;e.preventDefault();let n=t.indexOf(e.target);t[e.key===`ArrowDown`?n<0?0:Math.min(t.length-1,n+1):n<0?t.length-1:Math.max(0,n-1)]?.focus()},j=_e(s,{current:c,query:_,expanded:y}),M=_.trim().length>0,N=(e,n,r,i,a)=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-row":``,title:a,onClick:i,onKeyDown:A,className:t(q,n&&`text-accent font-medium`),children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r}),n&&(0,K.jsx)(C,{size:15,className:`shrink-0`})]},e);return(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsxs)(`button`,{ref:w,type:`button`,disabled:l,"aria-label":e,"aria-haspopup":`listbox`,"aria-expanded":h,title:n,onClick:()=>h?k():g(!0),className:t(O,`flex items-center gap-2 text-left text-fg disabled:opacity-50`),children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,K.jsx)(E,{size:16,className:`shrink-0 text-muted`})]}),h&&(0,K.jsxs)(`div`,{ref:T,role:`listbox`,"aria-label":e,className:`absolute left-0 right-0 top-full z-30 mt-1 flex max-h-[60vh] flex-col overflow-hidden rounded-2xl border border-border bg-surface p-1.5 shadow-xl`,children:[i.length>0&&(0,K.jsx)(`div`,{className:`mb-1 flex flex-col border-b border-border pb-1`,children:i.map(e=>N(`head:${e.value}`,a===e.value,e.label,()=>{u?.(e.value),k(!0)}))}),D&&(0,K.jsxs)(`label`,{className:`mb-1.5 flex items-center gap-2 rounded-xl bg-surface-2 px-3 py-2 text-muted focus-within:ring-2 focus-within:ring-accent/40`,children:[(0,K.jsx)(B,{size:15,className:`shrink-0`}),(0,K.jsx)(`input`,{type:`search`,value:_,onChange:e=>v(e.target.value),onKeyDown:A,placeholder:m(`Search models`),"aria-label":m(`Search models`),autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 bg-transparent text-[14px] text-fg outline-none placeholder:text-muted`})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[M&&j.length===0&&(0,K.jsx)(`div`,{className:`px-3 py-2.5 text-[13.5px] text-muted`,children:m(`No model matches`)}),j.map(e=>(0,K.jsxs)(`div`,{role:`group`,"aria-label":e.label,className:`[&+&]:mt-1.5`,children:[(0,K.jsx)(`div`,{className:`truncate px-3 pb-0.5 pt-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted`,children:e.label}),e.rows.map(t=>N(`${e.key}:${t.id}`,c?.group===e.key&&c.id===t.id,p?p(t):t.name,()=>{d(e.key,t),k(!0)},t.id)),e.more>0&&(0,K.jsx)(`button`,{type:`button`,"data-row":``,onKeyDown:A,onClick:()=>b(t=>new Set([...t,e.key])),className:t(q,`text-[13px] text-accent`),children:m(`Show {n} more`,{n:e.more})})]},e.key))]}),o&&!M&&(0,K.jsx)(`div`,{className:`mt-1 border-t border-border pt-1`,children:N(`tail`,!1,o,()=>{f?.(),k(!0)})})]})]})}var ye=`nanomuse_cloud`,be=`{{vault:NANOMUSE_CLOUD_KEY}}`,xe=`custom`,J=[`openai`,`openai_responses`];function Y(e){try{return new URL(e).hostname.toLowerCase()}catch{return``}}function X(e,t,n=h){if(e&&!J.includes(e))return n.find(t=>t.id===e)??null;let r=Y(t);if(!r)return null;let i=e=>[e.base_url,e.base_url_global].map(e=>Y(e??``)).filter(Boolean);return n.find(e=>i(e).includes(r))||(n.find(e=>i(e).some(e=>{let t=e.indexOf(`.`);return t>0&&r.endsWith(e.slice(t))}))??null)}function Se(e,t,n=``,r=h){if(e===`nanomuse_cloud`)return`nanoMuse Cloud`;if(e===`chatgpt`)return`ChatGPT`;let i=r.find(t=>t.id===e);return i&&e!==`custom`?S(i,t):Y(n)||e}function Ce(e,t,n=h){if(!e.effective_provider)return``;let r=Se(e.effective_provider,t,e.base_url,n);return e.effective_model?`${r} · ${e.effective_model}`:r}function we(e,t,n,r=h){let i=e.effective_model??``;if(!i)return``;let a=(e,t)=>Se(X(e,t,r)?.id??(J.includes(e)?`custom`:e),n,t,r),o;return o=e.effective_source===`cloud`?`nanoMuse Cloud`:e.effective_source===`gui`&&(e.provider_id||e.base_url||!J.includes(e.provider||`openai`))?e.provider_id?Se(e.provider_id,n,e.base_url,r):a(e.provider,e.base_url):t.cloud?`nanoMuse Cloud`:a(t.provider,t.base_url),`${o} · ${i}`}function Te(e,t){let n=t.list??h,r=[];t.signedIn&&r.push({value:ye,label:`nanoMuse Cloud`,group:`cloud`,needsKey:!1,entry:null});let i=t.chat.cloud?null:X(t.chat.provider,t.chat.base_url,n);i&&i.capabilities.includes(e)&&r.push({value:i.id,label:S(i,t.locale),group:`chat`,needsKey:!1,entry:i});for(let a of p(t.region,e,n))a.id!==i?.id&&r.push({value:a.id,label:S(a,t.locale),group:`add`,needsKey:!0,entry:a});return r.push({value:xe,label:``,group:`add`,needsKey:!1,entry:null}),r}function Ee(e,t){return e.configured?t&&e.base_url&&Y(e.base_url)===Y(t)?ye:e.provider_id||`custom`:``}var De=`nanomuse_cloud`;function Oe(){let{state:e}=c(),[t,n]=(0,G.useState)(null),[i,a]=(0,G.useState)(null),o=e.profile?.name??`nanoMuse`,s=r(),d=(0,G.useCallback)(async()=>{try{n(await u.connections()),a(null)}catch(e){a(s(e.message))}},[s]);return(0,G.useEffect)(()=>{d()},[d,e.connectionsVersion]),(0,K.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,K.jsx)(oe,{title:s(`Connections`),description:s(`What {name} can reach; keys stay in the vault on this machine.`,{name:o})}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-4`,children:[i&&(0,K.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 text-rose-700 dark:text-rose-300 p-3 text-[13.5px]`,children:i}),!t&&!i&&(0,K.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,K.jsx)(l,{className:`animate-spin`,size:20})}),t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Z,{data:t,onChange:d}),t.image&&(0,K.jsx)(ke,{slot:`image`,data:t,onChange:d}),t.video&&(0,K.jsx)(ke,{slot:`video`,data:t,onChange:d}),(0,K.jsx)(se,{account:e.hub?.account??null,onChange:d}),t.embeddings.memory_enabled&&(0,K.jsx)(Ae,{data:t,onChange:d}),(0,K.jsx)(je,{data:t,onChange:d}),(0,K.jsx)(Ne,{data:t,onChange:d}),(0,K.jsx)(Fe,{data:t,onChange:d}),(0,K.jsx)(Ie,{data:t,onChange:d}),(0,K.jsx)(Q,{data:t,onChange:d}),(0,K.jsx)(Le,{data:t,onChange:d}),(0,K.jsx)(Re,{data:t,onChange:d}),(0,K.jsx)(ze,{data:t,onChange:d})]})]})]})}function Z({data:e,onChange:n,compact:a}){let{toast:o,state:s}=c(),p=r(),[m,g]=(0,G.useState)(!!a),j=e.providers,M=!!s.hub?.account?.any_model,P=Object.entries(j).find(([t,n])=>t!==`custom`&&n.base_url&&e.llm.base_url.startsWith(n.base_url)&&n.provider===e.llm.provider)?.[0]??Object.entries(j).find(([t,n])=>t!==`custom`&&n.base_url&&e.llm.base_url.startsWith(n.base_url))?.[0]??(e.llm.base_url?`custom`:`deepseek`),[I,L]=(0,G.useState)(P),[R,z]=(0,G.useState)(e.llm.model),[B,V]=(0,G.useState)(e.llm.base_url),[H,ne]=(0,G.useState)(``),[re,ie]=(0,G.useState)(!1),[ae,oe]=(0,G.useState)(!1),[se,ce]=(0,G.useState)(e.llm.key_source===`none`&&!!j[P]?.key_optional),[W,de]=(0,G.useState)(e.llm.tool_mode||`auto`),[fe,pe]=(0,G.useState)(e.llm.proxy??``),[me,he]=(0,G.useState)(!1),[ge,_e]=(0,G.useState)(!1),[q,ye]=(0,G.useState)(null),[be,xe]=(0,G.useState)(!1),[J,Y]=(0,G.useState)(e.gui?.model??``),[X,Se]=(0,G.useState)({list:j[P]?.models??[],image:[],video:[],menu:[],catalog:[],imageCatalog:[],videoCatalog:[],vision:[],gui:j[P]?.gui_models??[],source:`catalogue`}),[Ce,Te]=(0,G.useState)(!1),[Ee,Oe]=(0,G.useState)(!1);(0,G.useEffect)(()=>{z(e.llm.model),V(e.llm.base_url),de(e.llm.tool_mode||`auto`),pe(e.llm.proxy??``),he(!1),Y(e.gui?.model??``),L(P)},[e.llm,e.gui?.model]);let Z=j[I],ke=I===`custom`||!Z?.base_url?B:Z.base_url;(0,G.useEffect)(()=>{if(!m)return;let e=!0,t=setTimeout(()=>{Se(e=>({...e,source:`loading`})),u.llmModels({preset:I,base_url:ke,api_key:H||void 0}).then(t=>{e&&(Se({list:t.models,image:t.image_models??[],video:t.video_models??[],menu:t.menu??[],catalog:t.catalog??[],imageCatalog:t.image_catalog??[],videoCatalog:t.video_catalog??[],vision:t.vision??[],gui:t.gui??j[I]?.gui_models??[],source:t.source}),t.source===`live`&&t.models.length&&!Ce&&z(e=>t.models.includes(e)?e:t.models[0]))}).catch(()=>e&&Se({list:Z?.models??[],image:[],video:[],menu:[],catalog:[],imageCatalog:[],videoCatalog:[],vision:[],gui:Z?.gui_models??[],source:`catalogue`}))},H?600:150);return()=>{e=!1,clearTimeout(t)}},[m,I,ke,H]);let Ae=t=>{L(t);let n=j[t];n&&(n.base_url?V(n.base_url):j[I]?.base_url&&V(``),(!R||Object.values(j).some(e=>e.models?.includes(R)))&&n.models?.length&&!n.models.includes(R)&&z(n.models[0]),Se({list:n.models??[],image:[],video:[],menu:[],catalog:[],imageCatalog:[],videoCatalog:[],vision:[],gui:n.gui_models??[],source:`catalogue`}),(!e.gui?.model||Object.values(j).some(t=>t.gui_model===e.gui?.model))&&Y(n.cloud?``:n.gui_model??``),Oe(!1),Te(!1),ce(!1))};(0,G.useEffect)(()=>{let e=ee();e&&j[e]&&(g(!0),Ae(e))},[]);let je=!!Z?.no_key||se&&!!Z?.key_optional,Me=e.llm.cloud?{text:p(`Your account's model`),tone:`ok`}:e.llm.key_source===`none`&&!j[P]?.no_key&&!j[P]?.key_optional?{text:p(`No key yet`),tone:`warn`}:e.llm.key_source===`missing`?{text:p(`Key missing from vault`),tone:`warn`}:{text:e.llm.key_source===`vault`?p(`Key in vault`):e.llm.key_source===`config`?p(`Key from config`):p(`No key needed`),tone:`ok`},Ne=async()=>{_e(!0),ye(null);try{Z?.cloud?await u.cloudUseAsModel(R.trim()):await u.setLLM({provider:Z?.provider??`openai`,model:R.trim(),base_url:ke.trim(),tool_mode:W,api_key:H||(je?``:null),proxy:me&&e.llm.proxy!==void 0?fe.trim():null}),J.trim()!==(e.gui?.model??``)&&await u.setGui({model:J.trim()}),ne(``),b(),o(p(`Model saved`)),n(),a||g(!1)}catch(e){o(e.message)}finally{_e(!1)}},Pe=async()=>{xe(!0);try{ye(await u.testLLM())}catch(e){ye({ok:!1,error:e.message})}finally{xe(!1)}},Fe=[{id:`cloud`,title:p(`Your account`),ids:[]},{id:`openai`,title:p(`OpenAI-compatible · Chat Completions`),ids:[]},{id:`responses`,title:p(`Responses API`),ids:[]},{id:`local`,title:p(`Local or your own endpoint`),ids:[]}];for(let[e,t]of Object.entries(j))(Fe.find(e=>e.id===(t.group??`openai`))??Fe[0]).ids.push(e);for(let e of Fe)e.ids=v(e.ids,j,s.hub?.account);let Ie=I===`custom`||!Z?.base_url,Q=Z?.cloud?null:h.find(e=>e.id===y(I))??null,Le=d(s.hub?.account),Re=i(),ze=e=>!!Q&&!Q.user_capabilities&&!Q.capabilities.includes(e),Ve=j[De],Ge=Z?.cloud?X.gui[0]??Z.gui_model??``:Q&&!Q.user_capabilities?Q.capabilities.includes(`vision`)?Q.defaults.hands||R.trim():Ve?.gui_model??R.trim():R.trim(),Ke=!Z?.cloud&&ze(`vision`)&&!!Ve,qe=e.gui?we(e.gui,e.llm,Re):``,Je=Array.from(new Set([...Z?.cloud?X.gui:[],...Z?.gui_model?[Z.gui_model]:[],...X.list.filter(e=>X.vision.includes(e)||f(e)===!0)])).filter(Boolean),Ye=Z?.cloud?`nanoMuse Cloud`:Q?S(Q,Re):We(ke)||I,Xe=Z?.cloud?X.gui[0]??Z.gui_model??``:Q?.defaults.hands??Z?.gui_model??``,Ze=[{key:`hands`,label:Ye,rows:Je.map(e=>({id:e,name:e})),...Xe?{default:Xe}:{}}],Qe=Ie&&/^https?:\/\/[^/]+\/?$/.test(B.trim());return(0,K.jsxs)(A,{icon:(0,K.jsx)(F,{size:19}),title:p(`Chat model`),summary:e.llm.cloud?`nanoMuse Cloud · ${e.llm.model||`—`}`:`${e.llm.model||`—`}${e.llm.base_url?` · ${We(e.llm.base_url)}`:``}`,status:Me,open:m,onToggle:a?void 0:()=>g(!m),children:[(0,K.jsx)($,{label:p(`Provider`),children:(0,K.jsxs)(`div`,{className:`space-y-2.5`,children:[Fe.filter(e=>e.ids.length).map(e=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[11px] uppercase tracking-wide text-muted`,children:e.title}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.ids.map(e=>{let n=j[e];return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Ae(e),className:t(`rounded-2xl px-3 py-1.5 text-left border leading-tight`,I===e?`border-accent bg-accent/10 text-accent`:`border-border text-muted`),children:[(0,K.jsx)(`span`,{className:t(`block text-[13px]`,I===e&&`font-medium`),children:n.label}),n.subtitle&&(0,K.jsx)(`span`,{className:`block text-[10.5px] opacity-80`,children:p(n.subtitle)})]},e)})})]},e.id)),Q&&(0,K.jsxs)(`p`,{className:`text-[12px] text-muted`,children:[(0,K.jsx)(`span`,{className:`font-medium text-fg`,children:S(Q,Re)}),` · `,_(p,Q.capabilities),`. `,Re===`zh-CN`?Q.note_zh:Q.note]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>oe(!ae),className:`inline-flex items-center gap-1.5 text-[12.5px] text-accent`,children:[(0,K.jsx)(U,{size:13}),` `,p(`Or sign in with a ChatGPT plan`),` `,ae?(0,K.jsx)(k,{size:13}):(0,K.jsx)(E,{size:13})]}),ae&&(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(te,{compact:!0,onChanged:()=>{n()}})})]})]})}),Ie&&(0,K.jsx)($,{label:p(`Base URL`),hint:p(Qe?`/v1 is added when the URL has no path.`:`The endpoint that serves /chat/completions, for example http://127.0.0.1:8000/v1.`),children:(0,K.jsx)(`input`,{value:B,onChange:e=>V(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:`https://host/v1`,inputMode:`url`,autoCapitalize:`off`})}),(0,K.jsxs)($,{label:p(`Chat model`),hint:Z?.cloud&&M&&X.catalog.length?p(`{n} models your account may use: the menu first, then everything else the provider lists under the Cloud key. Pick one; the ones beyond the menu are priced as the dearest menu model of their kind.`,{n:X.list.length}):Z?.cloud&&M?p(`Your account may name any model the provider has, not only these: type its id (a chat model here, a picture or clip model below) and it goes through as typed.`):X.source===`live`?p(`{n} models from the endpoint`,{n:X.list.length}):X.source===`loading`?p(`Asking the endpoint…`):X.list.length?p(`Could not list the endpoint's models; these are the usual ones.`):void 0,children:[Z?.cloud&&X.catalog.length>0&&!Ee&&(!R||X.list.includes(R))?(0,K.jsxs)(`select`,{value:R,onChange:e=>{if(e.target.value===Be){Oe(!0);return}z(e.target.value),Te(!0)},className:t(O,`text-fg`),children:[!R&&(0,K.jsx)(`option`,{value:``,children:p(`model name`)}),(0,K.jsx)(`optgroup`,{label:p(`Menu`),children:X.menu.map(e=>(0,K.jsx)(`option`,{value:e,children:X.vision.includes(e)?`${e} · ${p(`reads pictures`)}`:e},e))}),(0,K.jsx)(`optgroup`,{label:p(`More models on your account`),children:X.catalog.map(e=>(0,K.jsx)(`option`,{value:e,children:X.vision.includes(e)?`${e} · ${p(`reads pictures`)}`:e},e))}),(0,K.jsx)(`option`,{value:Be,children:p(`Type a model id…`)})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`input`,{list:`om-models`,value:R,onChange:e=>{z(e.target.value),Te(!0)},className:O,placeholder:p(`model name`),autoCapitalize:`off`,autoCorrect:`off`,autoFocus:Ee}),(0,K.jsx)(`datalist`,{id:`om-models`,children:X.list.map(e=>(0,K.jsx)(`option`,{value:e},e))}),Z?.cloud&&X.catalog.length>0&&(0,K.jsx)(`button`,{type:`button`,className:`mt-1.5 text-[12px] text-accent`,onClick:()=>{Oe(!1),X.list.includes(R)||z(X.menu[0]??X.list[0]??``)},children:p(`Pick from the list`)})]}),X.list.length>0&&(0,K.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:(X.menu.length?X.menu:X.list).slice(0,8).map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>z(e),className:t(`rounded-full px-2.5 py-1 text-[12px] border`,R===e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:e},e))})]}),(0,K.jsxs)($,{label:p(`Hands model`),hint:Z?.cloud?p(`The model that looks at screens when the hands run: the phone, this computer, a page the browser cannot read. Your account's hands model is {model}; the chat model above is a different pick.`,{model:Ge||`—`}):Ke?p(`The model that looks at screens when the hands run. This provider has no model that sees, so the hands use your account's, {model}, unless you pick one here.`,{model:Ge||`—`}):p(`The model that looks at screens when the hands run: a small, fast one that takes pictures, on the same endpoint and key. Default: this provider's own hands model.`),children:[(0,K.jsx)(ve,{label:p(`Hands model`),text:J?`${Ye} · ${J}`:p(`Automatic`),heads:[{value:``,label:p(`Automatic`)}],headValue:J?void 0:``,groups:Ze,current:J?{group:`hands`,id:J}:void 0,onHead:()=>Y(``),onPick:(e,t)=>Y(t.id)}),qe&&(0,K.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:p(`Currently {value}`,{value:qe})}),!Z?.cloud&&R.trim()&&!J&&f(R.trim())===!1&&(0,K.jsx)(`div`,{className:`mt-1.5 text-[12px] text-amber-700 dark:text-amber-300`,children:p(`{model} does not take pictures, so the hands would be blind with it. Pick a model that sees for them.`,{model:R.trim()})}),ze(`vision`)&&!Ke&&(0,K.jsxs)(`div`,{className:`mt-1.5 text-[12px] text-amber-700 dark:text-amber-300`,children:[x(p,`vision`,Le,Re),` `,(0,K.jsx)(He,{})]})]}),!Z?.no_key&&(0,K.jsxs)($,{label:p(`API key`),hint:se&&Z?.key_optional?p(`No key will be sent.`):e.llm.key_source===`vault`&&I===P?p(`A key is in the vault. Leave blank to keep it.`):p(`Stored encrypted in the vault as LLM_API_KEY.`),children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(`input`,{type:re?`text`:`password`,value:H,onChange:e=>ne(e.target.value),disabled:se&&!!Z?.key_optional,className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`pr-10 disabled:opacity-50`),placeholder:e.llm.key_source===`vault`&&I===P?`••••••••`:Z?.key_hint||`sk-…`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>ie(!re),"aria-label":p(re?`Hide key`:`Show key`),className:`absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-1.5 text-muted`,children:re?(0,K.jsx)(le,{size:16}):(0,K.jsx)(ue,{size:16})})]}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 text-[12px]`,children:[Z?.key_url?(0,K.jsxs)(`a`,{href:Z.key_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-accent`,children:[p(`Get a key from {vendor}`,{vendor:Z.label}),` `,(0,K.jsx)(w,{size:12})]}):(0,K.jsx)(`span`,{}),Z?.key_optional&&(0,K.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:se,onChange:e=>ce(e.target.checked),className:`accent-accent`}),` `,p(`No key`)]})]})]}),(0,K.jsx)($,{label:p(`Tool calling`),hint:p(`Auto uses the API's function calling and falls back to describing tools in the prompt when the endpoint rejects them. Prompt: for endpoints that silently ignore tools.`),children:(0,K.jsx)(`div`,{className:`flex gap-1.5`,children:[`auto`,`native`,`prompt`].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>de(e),className:t(`rounded-full px-3 py-1.5 text-[13px] border`,W===e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:e},e))})}),!Z?.cloud&&e.llm.proxy!==void 0&&(0,K.jsx)($,{label:p(`Proxy (optional)`),hint:p(`Only this provider's requests go through it. nanoMuse Cloud never does.`),children:(0,K.jsx)(`input`,{className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,value:fe,onChange:e=>{pe(e.target.value),he(!0)},onFocus:()=>fe.includes(`••••`)&&!me&&pe(``),onBlur:()=>!me&&pe(e.llm.proxy??``),placeholder:`http://host:port / socks5://host:port`,autoComplete:`off`,spellCheck:!1})}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:ge||!R.trim()||Ie&&!B.trim(),onClick:()=>void Ne(),className:D,children:[ge?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),` `,p(`Save`)]}),(0,K.jsxs)(`button`,{type:`button`,disabled:be,onClick:()=>void Pe(),className:T,children:[be?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,p(`Test`)]})]}),q&&(0,K.jsx)(Ue,{result:q,okText:p(`Replied "{reply}" in {ms} ms`,{reply:q.reply??``,ms:q.ms??0})})]})}function ke({slot:e,data:n,onChange:a}){let{toast:o,state:s}=c(),f=r(),p=n[e],h=e,v=s.hub?.account??null,y=!!v?.signed_in,T=d(v),E=i(),k=n.providers[De]?.base_url??``,N=Te(h,{signedIn:y,chat:{provider:n.llm.provider,base_url:n.llm.base_url,cloud:!!n.llm.cloud},region:T,locale:E}),P=Ee(p,k),[F,I]=(0,G.useState)(!1),[L,ee]=(0,G.useState)(P),[te,R]=(0,G.useState)(p.model),[z,B]=(0,G.useState)(p.base_url),[H,U]=(0,G.useState)(``),[ne,re]=(0,G.useState)(!1),[ie,ae]=(0,G.useState)(!1),[oe,se]=(0,G.useState)({list:[],more:[],source:`catalogue`});(0,G.useEffect)(()=>{ee(P),R(p.model),B(p.base_url),U(``)},[p]);let ce=N.find(e=>e.value===L)??null,W=ce?.entry??null,de=W?g(W,T):null,fe=L===`nanomuse_cloud`?k:L===`custom`?z.trim():de?.base_url??``,pe=P===L&&P!==``&&(p.key_source===`vault`||p.key_source===`config`),me=!!ce?.needsKey&&!H&&!pe,he=L===`nanomuse_cloud`?oe.list[0]??``:W?.defaults[e]??``;(0,G.useEffect)(()=>{if(!F||!L||L!==`nanomuse_cloud`&&!fe){se({list:[],more:[],source:`catalogue`});return}let t=!0,n=setTimeout(()=>{se(e=>({...e,source:`loading`})),u.llmModels(L===`nanomuse_cloud`?{preset:De}:{preset:W?m(W.id):``,base_url:fe,api_key:H||void 0}).then(n=>{if(!t)return;let r=(e===`image`?n.image_models:n.video_models)??[],i=(e===`image`?n.image_catalog:n.video_catalog)??[];se({list:r.filter(e=>!i.includes(e)),more:i,source:n.source})}).catch(()=>t&&se({list:[],more:[],source:`catalogue`}))},H?600:150);return()=>{t=!1,clearTimeout(n)}},[F,L,fe,H]);let ge=f(e===`image`?`Making pictures`:`Making clips`),_e=f(e===`image`?`Portraits of your Muse.`:`Short clips of your Muse.`),q=Ce(p,E),ve=x(f,h,T,E),ye=p.effective_provider?p.effective_source===`cloud`?{text:f(`Your account`),tone:`ok`}:p.effective_source===`chat`?{text:f(`The chat model's provider`),tone:`ok`}:{text:f(`Your key`),tone:`ok`}:{text:f(`Not set up`),tone:`warn`},xe=async()=>{ae(!0);try{L?L===`nanomuse_cloud`?await u.setMedia(e,{provider:`openai`,base_url:k,model:te.trim(),api_key:be}):L===`custom`?await u.setMedia(e,{provider:`openai`,base_url:z.trim(),model:te.trim(),api_key:H||null}):await u.setMedia(e,{provider:L,base_url:``,model:te.trim(),api_key:H||(ce?.group===`chat`?``:null)}):await u.setMedia(e,{provider:``,model:``,base_url:``,api_key:``}),U(``),b(),o(f(`Saved`)),a(),I(!1)}catch(e){o(e.message)}finally{ae(!1)}},J=e=>f(e===`cloud`?`Your account`:e===`chat`?`The chat model's provider`:`Add a provider`),Y=[`cloud`,`chat`,`add`].map(e=>({g:e,items:N.filter(t=>t.group===e)})).filter(e=>e.items.length),X=e===`image`?`IMAGE_API_KEY`:`VIDEO_API_KEY`;return(0,K.jsxs)(A,{icon:e===`image`?(0,K.jsx)(M,{size:19}):(0,K.jsx)(j,{size:19}),title:ge,summary:q||ve,status:ye,open:F,onToggle:()=>I(!F),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:_e}),(0,K.jsxs)($,{label:f(`Provider`),hint:!q&&!L?ve:void 0,children:[(0,K.jsxs)(`select`,{value:L,onChange:e=>{ee(e.target.value),R(``),U(``)},className:t(O,`text-fg`),children:[(0,K.jsx)(`option`,{value:``,children:f(`Automatic`)}),Y.map(({g:e,items:t})=>(0,K.jsx)(`optgroup`,{label:J(e),children:t.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.value===`custom`?f(`Other OpenAI-compatible endpoint`):e.label},e.value))},e))]}),q&&(0,K.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:f(`Currently {value}`,{value:q})}),!q&&!L&&(0,K.jsxs)(`button`,{type:`button`,className:`mt-1.5 inline-flex items-center gap-1 text-[12.5px] text-accent`,onClick:()=>ee(N.find(e=>e.group===`add`)?.value??``),children:[(0,K.jsx)(V,{size:13}),` `,f(`Add a provider`)]}),W&&(0,K.jsxs)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:[(0,K.jsx)(`span`,{className:`font-medium text-fg`,children:S(W,E)}),` · `,_(f,W.capabilities),`. `,E===`zh-CN`?W.note_zh:W.note]})]}),L===`custom`&&(0,K.jsx)($,{label:f(`Base URL`),hint:f(`The endpoint that serves /images/generations, for example https://host/v1.`),children:(0,K.jsx)(`input`,{value:z,onChange:e=>B(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:`https://host/v1`,inputMode:`url`,autoCapitalize:`off`})}),L&&(0,K.jsx)(Ve,{label:f(e===`image`?`Picture model`:`Clip model`),provider:L===`nanomuse_cloud`?`nanoMuse Cloud`:L===`custom`?We(z)||f(`Other OpenAI-compatible endpoint`):ce?.label??L,value:te,options:oe.list,more:oe.more,onChange:R,other:L!==`nanomuse_cloud`||!!v?.any_model,placeholder:he||void 0}),L&&L!==`nanomuse_cloud`&&ce?.group!==`chat`&&(0,K.jsxs)($,{label:f(`API key`),hint:pe?f(`A key is in the vault. Leave blank to keep it.`):f(`Stored encrypted in the vault as {name}.`,{name:X}),children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(`input`,{type:ne?`text`:`password`,value:H,onChange:e=>U(e.target.value),className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`pr-10`),placeholder:pe?`••••••••`:W?.key_hint||`sk-…`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>re(!ne),"aria-label":f(ne?`Hide key`:`Show key`),className:`absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-1.5 text-muted`,children:ne?(0,K.jsx)(le,{size:16}):(0,K.jsx)(ue,{size:16})})]}),de?.key_url&&(0,K.jsxs)(`a`,{href:de.key_url,target:`_blank`,rel:`noreferrer`,className:`mt-1.5 inline-flex items-center gap-1 text-[12px] text-accent`,children:[f(`Get a key from {vendor}`,{vendor:W?S(W,E):``}),` `,(0,K.jsx)(w,{size:12})]})]}),ce?.group===`chat`&&(0,K.jsx)(`p`,{className:`text-[12px] text-muted`,children:f(`Uses the chat model's key.`)}),(0,K.jsx)(`div`,{className:`flex gap-2 pt-1`,children:(0,K.jsxs)(`button`,{type:`button`,disabled:ie||me||L===`custom`&&!z.trim(),onClick:()=>void xe(),className:D,children:[ie?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),` `,f(`Save`)]})})]})}function Ae({data:e,onChange:n}){let{toast:i}=c(),a=r(),o=e.embeddings,[s,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(o.mode),[m,h]=(0,G.useState)(!!o.base_url),[g,_]=(0,G.useState)(o.base_url),[v,y]=(0,G.useState)(o.model),[b,x]=(0,G.useState)(``),[S,w]=(0,G.useState)(!1),[E,O]=(0,G.useState)(null),[k,j]=(0,G.useState)(!1);(0,G.useEffect)(()=>{p(o.mode),h(!!o.base_url),_(o.base_url),y(o.model)},[e.embeddings]);let M=o.mode===`off`?{text:a(`Off`),tone:`off`}:o.available===!0?{text:a(`On`),tone:`ok`}:o.available===!1?{text:o.mode===`on`?a(`Not reachable`):a(`By keyword`),tone:`warn`}:{text:a(`Not tried yet`),tone:`off`},P=o.mode===`off`?a(`Keyword recall only`):o.available===!0?a(`{model} · {n} of {total} memories indexed`,{model:o.model||o.default_model,n:o.indexed,total:o.total}):o.available===!1?o.reason:a(`{model} at {host}`,{model:o.model||o.default_model,host:We(o.effective_base_url)}),F=async()=>{w(!0),O(null);try{await u.setEmbeddings({mode:f,base_url:m?g.trim():``,model:v.trim(),api_key:m?b||void 0:``}),x(``),i(a(`Saved`)),n()}catch(e){i(e.message)}finally{w(!1)}},I=async()=>{j(!0);try{O(await u.testEmbeddings()),n()}catch(e){O({ok:!1,error:e.message})}finally{j(!1)}},L=e=>t(`rounded-full px-3 py-1.5 text-[13px] border`,e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`);return(0,K.jsxs)(A,{icon:(0,K.jsx)(ce,{size:19}),title:a(`Recall by meaning`),summary:P,status:M,open:s,onToggle:()=>d(!s),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted leading-snug`,children:a(`Memories are embedded once and a message finds the ones that mean the same thing, in any language: “写邮件给房东” finds “the landlord is Bob Li”. Keyword recall stays; the two are fused.`)}),(0,K.jsx)($,{label:a(`Mode`),hint:a(`Auto uses the model's endpoint when it has embeddings and falls back to keywords when it does not. On insists and warns. Off: keywords only.`),children:(0,K.jsx)(`div`,{className:`flex gap-1.5`,children:[`auto`,`on`,`off`].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:L(f===e),children:a(e===`auto`?`Auto`:e===`on`?`On`:`Off`)},e))})}),f!==`off`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{label:a(`Endpoint`),hint:a(m?`Any OpenAI-compatible /embeddings: Ollama with an embedding model pulled, OpenAI, a gateway.`:`The model's endpoint and key. DeepSeek has no embeddings; pick another endpoint.`),children:(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:L(!m),children:a(`Same as the model`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{h(!0),g||_(`http://127.0.0.1:11434/v1`)},className:L(m),children:a(`Another endpoint`)})]})}),m&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{label:a(`Base URL`),children:(0,K.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:`http://127.0.0.1:11434/v1`,inputMode:`url`})}),(0,K.jsx)($,{label:a(`API key`),hint:o.key_source===`vault`?a(`A key is in the vault. Leave blank to keep it.`):a(`Stored encrypted in the vault as EMBEDDINGS_API_KEY. Ollama needs none.`),children:(0,K.jsx)(`input`,{type:`password`,value:b,onChange:e=>x(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:o.key_source===`vault`?`••••••••`:`sk-…`,autoComplete:`off`})})]}),(0,K.jsx)($,{label:a(`Embedding model`),hint:a(`Blank uses the endpoint's default: {model}. On Ollama: ollama pull qwen3-embedding:0.6b (reads Chinese and English).`,{model:o.default_model}),children:(0,K.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:o.default_model,autoComplete:`off`})})]}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:S||m&&!/^https?:\/\//.test(g.trim()),onClick:()=>void F(),className:D,children:[S?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),` `,a(`Save`)]}),(0,K.jsxs)(`button`,{type:`button`,disabled:k||o.mode===`off`,onClick:()=>void I(),className:T,children:[k?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,a(`Test`)]})]}),E&&(0,K.jsx)(Ue,{result:E,okText:a(`{model} · {dims} dims · {n} memories indexed · {ms} ms`,{model:E.model??``,dims:E.dims??0,n:E.indexed??0,ms:E.ms??0})})]})}function je({data:e,onChange:n}){let{toast:i}=c(),a=r(),o=e.search,[s,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(o.provider),[m,h]=(0,G.useState)(o.base_url),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(null),[S,w]=(0,G.useState)(!1);(0,G.useEffect)(()=>{p(o.provider),h(o.base_url)},[e.search]);let E=o.providers.find(e=>e.id===o.provider),O=o.providers.find(e=>e.id===f),k=!!O?.needs_key,j=o.configured?{text:a(`On`),tone:`ok`}:{text:a(`Not set up`),tone:`warn`},M=o.configured?o.provider===`searxng`?a(`{provider} at {host}`,{provider:E?.label??o.provider,host:We(o.base_url)}):E?.label??o.provider:a(`{provider} needs {what}; searches use DuckDuckGo until then`,{provider:E?.label??o.provider,what:E?.needs_key?a(`a key`):a(`an instance URL`)}),P=async()=>{y(!0),x(null);try{await u.setSearch({provider:f,base_url:f===`searxng`?m.trim():``,api_key:k?g||void 0:``}),_(``),i(a(`Saved`)),n()}catch(e){i(e.message)}finally{y(!1)}},F=async()=>{w(!0);try{x(await u.testSearch())}catch(e){x({ok:!1,error:e.message})}finally{w(!1)}},I=e=>t(`rounded-full px-3 py-1.5 text-[13px] border`,e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),L=f!==`searxng`||/^https?:\/\//.test(m.trim());return(0,K.jsxs)(A,{icon:(0,K.jsx)(B,{size:19}),title:a(`Web search`),summary:M,status:j,open:s,onToggle:()=>d(!s),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted leading-snug`,children:a(`DuckDuckGo needs nothing, but it is scraped and rate-limits now and then. For searches that always work, use a provider with an API. Whichever you pick, a failed search falls back to DuckDuckGo with a note.`)}),(0,K.jsx)($,{label:a(`Provider`),children:(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.providers.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>p(e.id),className:I(f===e.id),children:e.label},e.id))})}),k&&(0,K.jsxs)($,{label:a(`API key`),hint:o.key_source===`vault`&&o.provider===f?a(`A key is in the vault. Leave blank to keep it.`):a(`Stored encrypted in the vault as SEARCH_API_KEY.`),children:[(0,K.jsx)(`input`,{type:`password`,value:g,onChange:e=>_(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:o.key_source===`vault`&&o.provider===f?`••••••••`:`…`,autoComplete:`off`}),O?.keys_url&&(0,K.jsx)(`a`,{href:O.keys_url,target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-block text-[12px] text-accent`,children:a(`Get a key from {label}`,{label:O.label})})]}),f===`searxng`&&(0,K.jsx)($,{label:a(`Instance URL`),hint:a(`A SearXNG you run, with the JSON format enabled in its settings.`),children:(0,K.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,placeholder:`http://127.0.0.1:8080`,inputMode:`url`})}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:v||!L,onClick:()=>void P(),className:D,children:[v?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),` `,a(`Save`)]}),(0,K.jsxs)(`button`,{type:`button`,disabled:S,onClick:()=>void F(),className:T,children:[S?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,a(`Test`)]})]}),b&&(0,K.jsx)(Ue,{result:b,okText:a(`{provider} · {n} results · {ms} ms`,{provider:b.provider??``,n:b.results??0,ms:b.ms??0})})]})}var Me=[{id:`gmail`,label:`Gmail`,imap:`imap.gmail.com`,smtp:`smtp.gmail.com`,port:587,starttls:!0},{id:`outlook`,label:`Outlook`,imap:`outlook.office365.com`,smtp:`smtp.office365.com`,port:587,starttls:!0},{id:`icloud`,label:`iCloud`,imap:`imap.mail.me.com`,smtp:`smtp.mail.me.com`,port:587,starttls:!0},{id:`qq`,label:`QQ`,imap:`imap.qq.com`,smtp:`smtp.qq.com`,port:587,starttls:!0},{id:`163`,label:`163`,imap:`imap.163.com`,smtp:`smtp.163.com`,port:465,starttls:!1},{id:`fastmail`,label:`Fastmail`,imap:`imap.fastmail.com`,smtp:`smtp.fastmail.com`,port:587,starttls:!0}];function Ne({data:e,onChange:n,compact:i}){let{toast:a}=c(),o=r(),s=e.email,[d,f]=(0,G.useState)(!!i),[p,m]=(0,G.useState)(s.address),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(s.imap_host),[y,b]=(0,G.useState)(s.imap_port),[x,S]=(0,G.useState)(s.smtp_host),[C,w]=(0,G.useState)(s.smtp_port),[T,E]=(0,G.useState)(s.smtp_starttls),[k,j]=(0,G.useState)(null),[M,P]=(0,G.useState)(null);(0,G.useEffect)(()=>{m(s.address),v(s.imap_host),b(s.imap_port),S(s.smtp_host),w(s.smtp_port),E(s.smtp_starttls)},[s]);let F=e=>{v(e.imap),b(993),S(e.smtp),w(e.port),E(e.starttls)},I=async()=>{j(`save`),P(null);try{await u.setEmail({enabled:!0,address:p.trim(),password:h||void 0,imap_host:_.trim(),imap_port:y,smtp_host:x.trim(),smtp_port:C,smtp_starttls:T}),g(``);let e=await u.testEmail();P(e),a(e.ok?o(`Email connected`):o(`Saved, but the test failed`)),n()}catch(e){a(e.message)}finally{j(null)}},L=async()=>{j(`off`);try{await u.disconnectEmail(),P(null),a(o(`Email disconnected`)),n()}catch(e){a(e.message)}finally{j(null)}},ee=s.enabled&&s.configured?{text:o(`Connected`),tone:`ok`}:s.enabled?{text:o(`Incomplete`),tone:`warn`}:{text:o(`Not connected`),tone:`off`};return(0,K.jsxs)(A,{icon:(0,K.jsx)(re,{size:19}),title:o(`Email`),summary:s.configured&&s.enabled?`${s.address} · ${o(`reads and sends`)}`:o(`Read your inbox, draft and send mail`),status:ee,open:d,onToggle:i?void 0:()=>f(!d),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted -mt-1`,children:o(`Reading is a moderate action; sending always asks you first. Use an app password where your provider offers one.`)}),(0,K.jsx)($,{label:o(`Provider`),children:(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Me.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>F(e),className:t(`rounded-full px-3 py-1.5 text-[13px] border`,_===e.imap?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:e.label},e.id))})}),(0,K.jsx)($,{label:o(`Address`),children:(0,K.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),className:O,placeholder:`you@example.com`,inputMode:`email`,autoComplete:`off`})}),(0,K.jsx)($,{label:o(`Password`),hint:s.password_set?o(`A password is in the vault. Leave blank to keep it.`):o(`Stored encrypted in the vault as EMAIL_PASSWORD.`),children:(0,K.jsx)(`input`,{type:`password`,value:h,onChange:e=>g(e.target.value),className:O,placeholder:s.password_set?`••••••••`:o(`app password`),autoComplete:`off`})}),(0,K.jsxs)(`div`,{className:`grid grid-cols-[1fr_84px] gap-2`,children:[(0,K.jsx)($,{label:o(`IMAP server`),children:(0,K.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:O,placeholder:`imap.example.com`})}),(0,K.jsx)($,{label:o(`Port`),children:(0,K.jsx)(`input`,{type:`number`,value:y,onChange:e=>b(Number(e.target.value)),className:O})}),(0,K.jsx)($,{label:o(`SMTP server`),children:(0,K.jsx)(`input`,{value:x,onChange:e=>S(e.target.value),className:O,placeholder:`smtp.example.com`})}),(0,K.jsx)($,{label:o(`Port`),children:(0,K.jsx)(`input`,{type:`number`,value:C,onChange:e=>w(Number(e.target.value)),className:O})})]}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-[13.5px]`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:T,onChange:e=>E(e.target.checked),className:`accent-[var(--om-accent)]`}),` `,o(`STARTTLS for SMTP (off for port 465)`)]}),(0,K.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:k!==null||!p.trim()||!_.trim()||!x.trim()||!h&&!s.password_set,onClick:()=>void I(),className:D,children:[k===`save`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,s.configured?o(`Save & test`):o(`Connect`)]}),s.enabled&&(0,K.jsxs)(`button`,{type:`button`,disabled:k!==null,onClick:()=>void L(),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:[k===`off`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(de,{size:16}),` `,o(`Disconnect`)]})]}),M&&(0,K.jsx)(Ue,{result:M,okText:o(`Signed in · {n} messages in the inbox`,{n:M.inbox??`?`})})]})}var Pe=[{id:`google`,label:`Google`,hint:`Settings → your calendar → Integrate calendar → Secret address in iCal format`},{id:`outlook`,label:`Outlook`,hint:`Settings → Calendar → Shared calendars → Publish a calendar → ICS link`},{id:`icloud`,label:`iCloud`,hint:`Share Calendar → Public Calendar → copy the webcal:// link`},{id:`fastmail`,label:`Fastmail`,hint:`Settings → Calendars → Export → Calendar URL`},{id:`file`,label:`.ics file`,hint:`A path on the machine where nanoMuse runs, for example ~/calendar.ics`}];function Fe({data:n,onChange:i,compact:a}){let{toast:o}=c(),s=r(),d=n.calendar,[f,p]=(0,G.useState)(!!a),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(null),[S,w]=(0,G.useState)(d.day_start),[E,k]=(0,G.useState)(d.day_end),[j,M]=(0,G.useState)(null),[F,I]=(0,G.useState)(null);(0,G.useEffect)(()=>{w(d.day_start),k(d.day_end)},[d.day_start,d.day_end]);let L=async()=>{M(`add`),I(null);try{let e=await u.addCalendarFeed(g.trim(),v.trim());if(e.error)o(s(`Added, but it could not be read: {error}`,{error:e.error}));else{let t=e.feeds.find(e=>e.name===g.trim());o(`${s(`Calendar connected`)} · ${U(t?.events??0)}`),_(``),y(``),h(!1)}i()}catch(e){o(e.message)}finally{M(null)}},ee=async e=>{M(e);try{await u.removeCalendarFeed(e),i()}catch(e){o(e.message)}finally{M(null)}},te=async()=>{M(`hours`);try{await u.setCalendar({day_start:S,day_end:E}),o(s(`Saved`)),i()}catch(e){o(e.message)}finally{M(null)}},R=async()=>{M(`test`);try{I(await u.testCalendar()),i()}catch(e){o(e.message)}finally{M(null)}},B=d.feeds.reduce((e,t)=>e+t.events,0),H=d.feeds.filter(e=>e.error).length,U=e=>e===1?s(`1 event`):s(`{n} events`,{n:e}),ne=d.configured?H?{text:s(`{n} not reading`,{n:H}),tone:`warn`}:{text:s(`Connected`),tone:`ok`}:{text:s(`Not connected`),tone:`off`};return(0,K.jsxs)(A,{icon:(0,K.jsx)(ae,{size:19}),title:s(`Calendar`),summary:d.configured?d.feeds.length===1?`${d.feeds[0].name} · ${U(B)}`:`${s(`{n} calendars`,{n:d.feeds.length})} · ${U(B)}`:s(`Your agenda, free time, and events it can draft`),status:ne,open:f,onToggle:a?void 0:()=>p(!f),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted -mt-1`,children:s(`Reads your calendar from its private .ics link; the link stays in the vault. It never changes your calendar; an event it proposes comes as a file you add with a tap.`)}),d.feeds.length>0&&(0,K.jsx)(`ul`,{className:`space-y-1.5`,children:d.feeds.map(n=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:t(`h-2 w-2 rounded-full`,n.error?`bg-rose-500`:n.fetched_at?`bg-emerald-500`:`bg-amber-500`)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:n.name}),(0,K.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[n.error?n.error:n.fetched_at?`${U(n.events)} · ${s(`read {when}`,{when:e(n.fetched_at)})}`:s(`not read yet`),!n.from_app&&` · ${s(`from config.toml`)}`]})]}),n.from_app&&(0,K.jsx)(`button`,{type:`button`,"aria-label":s(`Remove`),disabled:j===n.name,onClick:()=>void ee(n.name),className:`p-1.5 rounded-full text-muted hover:bg-surface-2`,children:j===n.name?(0,K.jsx)(l,{size:15,className:`animate-spin`}):(0,K.jsx)(z,{size:15})})]},n.name))}),m?(0,K.jsxs)(`div`,{className:`space-y-2.5 rounded-2xl border border-border/70 p-3`,children:[(0,K.jsxs)($,{label:s(`Where is the link?`),children:[(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Pe.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>x(b===e.id?null:e.id),className:t(`rounded-full px-3 py-1.5 text-[13px] border`,b===e.id?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:s(e.label)},e.id))}),b&&(0,K.jsx)(`div`,{className:`mt-1.5 text-[11.5px] text-muted leading-snug`,children:s(Pe.find(e=>e.id===b).hint)})]}),(0,K.jsx)($,{label:s(`Name`),children:(0,K.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:O,placeholder:s(`Work`)})}),(0,K.jsx)($,{label:s(`Private .ics link or file path`),hint:s(`Stored encrypted in the vault as CALENDAR_{name}.`,{name:g.trim().toUpperCase().replace(/[^A-Z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`NAME`})+` `+s(`nanoMuse fetches whatever address you put here, from this machine; only paste links you trust.`),children:(0,K.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),className:O,placeholder:`https://calendar.google.com/calendar/ical/…/basic.ics`,inputMode:`url`,autoComplete:`off`})}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:j===`add`||!g.trim()||!v.trim(),onClick:()=>void L(),className:D,children:[j===`add`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,s(`Connect`)]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:T,children:s(`Cancel`)})]})]}):(0,K.jsxs)(`button`,{type:`button`,onClick:()=>h(!0),className:T,children:[(0,K.jsx)(V,{size:16}),` `,s(`Add a calendar`)]}),d.configured&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{label:s(`Working hours`),hint:s(`Free time is looked for inside these hours.`),children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`time`,value:S,onChange:e=>w(e.target.value),className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`w-auto`)}),(0,K.jsx)(`span`,{className:`text-muted`,children:`–`}),(0,K.jsx)(`input`,{type:`time`,value:E,onChange:e=>k(e.target.value),className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`w-auto`)}),(S!==d.day_start||E!==d.day_end)&&(0,K.jsx)(`button`,{type:`button`,disabled:j===`hours`,onClick:()=>void te(),className:t(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`px-3`),"aria-label":s(`Save`),children:j===`hours`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16})})]})}),(0,K.jsxs)(`button`,{type:`button`,disabled:j===`test`,onClick:()=>void R(),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:[j===`test`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(P,{size:16}),` `,s(`Read again`)]}),F&&(0,K.jsx)(Ue,{result:F,okText:d.feeds.length===1?U(F.events??0):`${U(F.events??0)} · ${s(`{n} calendars`,{n:d.feeds.length})}`})]})]})}function Ie({data:n,onChange:i,compact:a}){let{toast:o}=c(),s=r(),d=n.contacts,[f,p]=(0,G.useState)(!!a),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(null),[w,E]=(0,G.useState)(``),[k,j]=(0,G.useState)(null),M=(0,G.useRef)(null),F=e=>e===1?s(`1 person`):s(`{n} people`,{n:e}),I=(e,t)=>{if(e.error)o(s(`Added, but it could not be read: {error}`,{error:e.error}));else{let n=e.sources.find(e=>e.name===t);o(`${s(`Address book connected`)} · ${F(n?.contacts??0)}`),_(``),y(``),h(!1)}i()},L=async()=>{x(`add`),C(null);try{I(await u.addContactsSource(g.trim(),v.trim()),g.trim())}catch(e){o(e.message)}finally{x(null)}},ee=async e=>{x(`upload`),C(null);try{let t=(g.trim()||e.name.replace(/\.vcf$/i,``)||`Imported`).slice(0,40);I(await u.importContacts(t,await e.text()),t)}catch(e){o(e.message)}finally{x(null),M.current&&(M.current.value=``)}},te=async e=>{x(e);try{await u.removeContactsSource(e),i()}catch(e){o(e.message)}finally{x(null)}},R=async()=>{x(`test`);try{C(await u.testContacts()),i()}catch(e){o(e.message)}finally{x(null)}};(0,G.useEffect)(()=>{if(!w.trim()){j(null);return}let e=setTimeout(()=>{u.contacts(w.trim(),5).then(e=>j(e.people)).catch(()=>j([]))},250);return()=>clearTimeout(e)},[w]);let H=d.sources.filter(e=>e.error).length,U=d.enabled?d.configured?H?{text:s(`{n} not reading`,{n:H}),tone:`warn`}:{text:s(`Connected`),tone:`ok`}:{text:s(`Not connected`),tone:`off`}:{text:s(`Off`),tone:`off`};return(0,K.jsxs)(A,{icon:(0,K.jsx)(W,{size:19}),title:s(`Contacts`),summary:d.configured?d.sources.length===0?`${F(d.count)} · ${s(`told to it in chat`)}`:`${F(d.count)} · ${d.sources.length===1?d.sources[0].name:s(`{n} address books`,{n:d.sources.length})}`:s(`Who is who, so it never guesses an address`),status:U,open:f,onToggle:a?void 0:()=>p(!f),children:[(0,K.jsx)(`p`,{className:`text-[12.5px] text-muted -mt-1`,children:s(`Import a .vcf export from Google Contacts, iCloud, Outlook or your phone, or paste a link to one. People you mention in chat go into its own book. It looks people up before writing to them and warns when an address is unknown.`)}),(d.sources.length>0||d.own>0)&&(0,K.jsxs)(`ul`,{className:`space-y-1.5`,children:[d.own>0&&(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-500`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:s(`My contacts`)}),(0,K.jsx)(`div`,{className:`text-[11.5px] text-muted truncate`,children:`${F(d.own)} · ${s(`added in chat`)}`})]})]}),d.sources.map(n=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:t(`h-2 w-2 rounded-full`,n.error?`bg-rose-500`:n.fetched_at?`bg-emerald-500`:`bg-amber-500`)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:n.name}),(0,K.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[n.error?n.error:n.fetched_at?`${F(n.contacts)} · ${s(`read {when}`,{when:e(n.fetched_at)})}`:s(`not read yet`),!n.from_app&&` · ${s(`from config.toml`)}`]})]}),n.from_app&&(0,K.jsx)(`button`,{type:`button`,"aria-label":s(`Remove`),disabled:b===n.name,onClick:()=>void te(n.name),className:`p-1.5 rounded-full text-muted hover:bg-surface-2`,children:b===n.name?(0,K.jsx)(l,{size:15,className:`animate-spin`}):(0,K.jsx)(z,{size:15})})]},n.name))]}),m?(0,K.jsxs)(`div`,{className:`space-y-2.5 rounded-2xl border border-border/70 p-3`,children:[(0,K.jsx)($,{label:s(`Name`),children:(0,K.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:O,placeholder:s(`iPhone`)})}),(0,K.jsxs)($,{label:s(`A .vcf file from your phone or computer`),hint:s(`Google Contacts: Export → vCard. iPhone: Contacts → select all → Share → Save to Files. Outlook: People → Manage → Export.`),children:[(0,K.jsx)(`input`,{ref:M,type:`file`,accept:`.vcf,text/vcard,text/x-vcard`,className:`hidden`,onChange:e=>e.target.files?.[0]&&void ee(e.target.files[0])}),(0,K.jsxs)(`button`,{type:`button`,disabled:b===`upload`,onClick:()=>M.current?.click(),className:T,children:[b===`upload`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(fe,{size:16}),` `,s(`Choose a .vcf file`)]})]}),(0,K.jsx)($,{label:s(`Or a link / path to one`),hint:s(`A link is stored encrypted in the vault as CONTACTS_{name}.`,{name:g.trim().toUpperCase().replace(/[^A-Z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`NAME`})+` `+s(`nanoMuse fetches whatever address you put here, from this machine; only paste links you trust.`),children:(0,K.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),className:O,placeholder:`https://… /contacts.vcf`,inputMode:`url`,autoComplete:`off`})}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:b===`add`||!g.trim()||!v.trim(),onClick:()=>void L(),className:D,children:[b===`add`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,s(`Connect`)]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:T,children:s(`Cancel`)})]})]}):(0,K.jsxs)(`button`,{type:`button`,onClick:()=>h(!0),className:T,children:[(0,K.jsx)(V,{size:16}),` `,s(`Add an address book`)]}),d.configured&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(B,{size:15,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted`}),(0,K.jsx)(`input`,{value:w,onChange:e=>E(e.target.value),className:t(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`pl-9`),placeholder:s(`Find someone, as the agent would`),autoComplete:`off`})]}),k!==null&&(0,K.jsxs)(`ul`,{className:`space-y-1`,children:[k.length===0&&(0,K.jsx)(`li`,{className:`text-[12.5px] text-muted px-1`,children:s(`No one matches.`)}),k.map(e=>(0,K.jsxs)(`li`,{className:`rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`text-[13.5px] font-medium`,children:[e.name,e.org&&(0,K.jsxs)(`span`,{className:`text-muted font-normal`,children:[` · `,e.org]})]}),(0,K.jsx)(`div`,{className:`text-[12px] text-muted break-words`,children:[...e.emails,...e.phones].join(` · `)})]},e.id))]}),d.sources.length>0&&(0,K.jsxs)(`button`,{type:`button`,disabled:b===`test`,onClick:()=>void R(),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:[b===`test`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(P,{size:16}),` `,s(`Read again`)]}),S&&(0,K.jsx)(Ue,{result:S,okText:F(S.contacts??0)})]})]})}function Q({data:e,onChange:n}){let{toast:i}=c(),a=r(),o=e.browser,[s,l]=(0,G.useState)(!1),d=async()=>{l(!0);try{await u.setBrowser(!o.enabled),n()}catch(e){i(e.message)}finally{l(!1)}};return(0,K.jsx)(A,{icon:(0,K.jsx)(ne,{size:19}),title:a(`Browser`),summary:o.available?a(`Open pages, click, fill forms, screenshot`):a(`Playwright is not installed on the server`),status:o.enabled&&o.available?{text:a(`On`),tone:`ok`}:o.enabled?{text:a(`Unavailable`),tone:`warn`}:{text:a(`Off`),tone:`off`},open:!1,trailing:(0,K.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o.enabled,disabled:s,onClick:()=>void d(),className:t(`relative h-7 w-12 shrink-0 rounded-full transition`,o.enabled?`bg-accent`:`bg-surface-2 border border-border`),children:(0,K.jsx)(`span`,{className:t(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,o.enabled?`left-[22px]`:`left-0.5`)})}),children:!o.available&&(0,K.jsxs)(`p`,{className:`text-[12.5px] text-muted`,children:[a(`Install it where the server runs:`),` `,(0,K.jsx)(`code`,{className:`rounded bg-surface-2 px-1`,children:`pip install "nanomuse[browser]" && playwright install chromium`})]})})}function Le({data:e,onChange:n}){let{toast:i}=c(),a=r(),o=e.gui,[s,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(o.model),[g,_]=(0,G.useState)(o.base_url),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(null);(0,G.useEffect)(()=>{h(o.model),_(o.base_url)},[o.model,o.base_url]);let S=async()=>{p(!0);try{await u.setGui({enabled:!o.enabled}),n()}catch(e){i(e.message)}finally{p(!1)}},w=async()=>{p(!0),x(null);try{await u.setGui({model:m.trim(),base_url:g.trim(),...v?{api_key:v.trim()}:{}}),y(``),n(),x(await u.testGui())}catch(e){i(e.message)}finally{p(!1)}},T=o.phone,[E,k]=(0,G.useState)(R),j=(0,G.useRef)(E);(0,G.useEffect)(()=>{if(!s)return;let e=()=>{let e=R();e!==j.current&&(j.current=e,k(e),setTimeout(n,400))};return e(),document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,e)}},[s,n]);let M=T.connected?a(`{name} is connected`,{name:T.device?.name??a(`A phone`)}):o.enabled?a(`No phone connected. Open the app on the phone`):a(`Tap, type and swipe in the apps on your phone`);return(0,K.jsxs)(A,{icon:(0,K.jsx)(L,{size:19}),title:a(`Phone`),summary:M,status:o.enabled&&T.connected?{text:a(`On`),tone:`ok`}:o.enabled?{text:a(`Waiting`),tone:`warn`}:{text:a(`Off`),tone:`off`},open:s,onToggle:()=>d(e=>!e),children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`text-[13px] leading-snug`,children:[(0,K.jsx)(`div`,{className:`font-medium`,children:a(`Operate the phone`)}),(0,K.jsx)(`div`,{className:`text-[12px] text-muted`,children:a(`When on, the agent can read the screen and act in the apps on the connected phone: 12306, WeChat, Alipay… It asks before paying, sending or deleting.`)})]}),(0,K.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o.enabled,disabled:f,onClick:()=>void S(),className:t(`relative h-7 w-12 shrink-0 rounded-full transition`,o.enabled?`bg-accent`:`bg-surface-2 border border-border`),children:(0,K.jsx)(`span`,{className:t(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,o.enabled?`left-[22px]`:`left-0.5`)})})]}),E!==null&&(0,K.jsxs)(`div`,{className:`rounded-2xl bg-surface-2 px-3 py-2.5 text-[12.5px] leading-snug space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:a(`This phone`)}),(0,K.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,E===`on`&&`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`,E===`off`&&`bg-amber-500/15 text-amber-700 dark:text-amber-300`,E===`unsupported`&&`bg-surface text-muted`),children:a(E===`on`?`Ready`:E===`off`?`Not yet`:`Not on this Android`)})]}),E===`unsupported`&&(0,K.jsx)(`div`,{className:`text-muted`,children:a(`Operating the screen needs Android 11 or newer; this phone can still be used for everything else.`)}),E===`off`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`text-muted`,children:a(`Turn on the nanoMuse accessibility service; that is how it sees the screen and taps for you, only while a task runs, with a Stop button on screen.`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-0.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>I()?.openAccessibilitySettings?.(),className:`rounded-full bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white`,children:a(`Open Accessibility settings`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>I()?.openAppSettings?.(),className:`rounded-full border border-border px-3 py-1.5 text-[12.5px]`,children:a(`App settings`)})]}),(0,K.jsx)(`div`,{className:`text-muted`,children:a(`Greyed out with “Restricted setting”? Android 13+ does that for apps installed from a download: in App settings tap ⋮ → Allow restricted settings, then come back.`)})]}),E===`on`&&(0,K.jsx)(`div`,{className:`text-muted`,children:a(`Android may switch the service off after an update or a battery clean-up; if the phone stops answering, come back here.`)})]}),T.connected&&T.device&&(0,K.jsxs)(`div`,{className:`rounded-2xl bg-surface-2 px-3 py-2 text-[12.5px] text-muted`,children:[a(`{name} ({platform}), {n} apps`,{name:T.device.name,platform:T.device.platform,n:String(T.device.apps)}),T.last_screen&&(0,K.jsxs)(K.Fragment,{children:[` `,`·`,` `,a(`last seen in {app}`,{app:T.last_screen.app_name||T.last_screen.app})]})]}),(0,K.jsx)(`div`,{className:`text-[12px] text-muted leading-snug`,children:a(`The operator's model looks at screens step by step: a small, fast model that takes pictures. The Hands model row under Chat model picks one on the same endpoint and key; the fields here are for a different endpoint. Empty = {model}.`,{model:o.default_model||a(`the chat model`)})}),(0,K.jsx)($,{label:a(`Model`),children:(0,K.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:o.default_model||a(`same as the chat model`),className:O})}),(0,K.jsx)($,{label:a(`Base URL`),children:(0,K.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),placeholder:a(`same as the chat model`),className:O})}),(0,K.jsx)($,{label:a(`API key`),hint:o.key_source===`vault`?a(`A key is in the vault; leave empty to keep it.`):o.key_source===`config`?a(`Set in config.toml.`):a(`Leave empty to use the main model's key.`),children:(0,K.jsx)(`input`,{type:`password`,value:v,onChange:e=>y(e.target.value),placeholder:`sk-…`,className:O,autoComplete:`off`})}),(0,K.jsxs)(`button`,{type:`button`,disabled:f,onClick:()=>void w(),className:D,children:[f?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(C,{size:16}),a(`Save and test`)]}),b&&(0,K.jsx)(Ue,{result:b,okText:a(`The operator's model answers.`)})]})}function Re({data:e,onChange:n}){let{toast:i}=c(),a=r(),[o,s]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(`moderate`),[x,S]=(0,G.useState)(null),C=async()=>{S(`add`);try{let e=h.trim().split(/\s+/).filter(Boolean);await u.addMCP({name:p.trim(),command:e[0]??null,args:e.slice(1),url:_.trim()||null,risk:y}),m(``),g(``),v(``),f(!1),i(a(`Server connected`)),n()}catch(e){i(e.message)}finally{S(null)}},w=async e=>{S(e);try{await u.removeMCP(e),n()}catch(e){i(e.message)}finally{S(null)}},E=e.mcp.filter(e=>e.connected).length,k=(e.shared??[]).filter(e=>e.enabled&&!e.here),j=e=>{m(e.id),v(e.url),g(``),f(!0),s(!0)};return(0,K.jsxs)(A,{icon:(0,K.jsx)(N,{size:19}),title:a(`MCP servers`),summary:e.mcp.length?a(`{n} of {total} connected · {tools} tools`,{n:E,total:e.mcp.length,tools:e.mcp.reduce((e,t)=>e+t.tools,0)}):a(`Add tools from any Model Context Protocol server`),status:e.mcp.length?{text:a(`{n} on`,{n:E}),tone:E?`ok`:`warn`}:{text:a(`None`),tone:`off`},open:o,onToggle:()=>s(!o),children:[e.mcp.length>0&&(0,K.jsx)(`ul`,{className:`space-y-1.5`,children:e.mcp.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:t(`h-2 w-2 rounded-full`,e.connected?`bg-emerald-500`:`bg-rose-500`)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:e.builtin?a(`This phone`):e.name}),(0,K.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[e.builtin?a(`clipboard, notifications, calendar, contacts, location, alarms, photos`):e.url??[e.command,...e.args].join(` `),` ·`,` `,a(`{n} tools`,{n:e.tools}),` · `,a(e.risk),!e.from_app&&!e.builtin&&` · ${a(`from config.toml`)}`]})]}),e.from_app&&(0,K.jsx)(`button`,{type:`button`,"aria-label":a(`Remove`),disabled:x===e.name,onClick:()=>void w(e.name),className:`p-1.5 rounded-full text-muted hover:bg-surface-2`,children:x===e.name?(0,K.jsx)(l,{size:15,className:`animate-spin`}):(0,K.jsx)(z,{size:15})})]},e.name))}),k.length>0&&(0,K.jsx)(`ul`,{className:`space-y-1.5`,children:k.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl border border-dashed border-border/70 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-border`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:e.label||e.id}),(0,K.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[a(`Connected on {device}; sign in here to use it on this device`,{device:e.device||e.device_id}),e.url?` · ${e.url}`:``]})]}),e.url&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>j(e),className:t(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`py-1.5 text-[12.5px]`),children:a(`Sign in here`)})]},`${e.device_id}:${e.id}`))}),d?(0,K.jsxs)(`div`,{className:`space-y-2.5 rounded-2xl border border-border/70 p-3`,children:[(0,K.jsx)($,{label:a(`Name`),children:(0,K.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),className:O,placeholder:`filesystem`})}),(0,K.jsx)($,{label:a(`Command`),hint:a(`Run locally over stdio, for example: npx -y @modelcontextprotocol/server-filesystem ./workspace`),children:(0,K.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),className:O,placeholder:`npx -y @modelcontextprotocol/server-…`})}),(0,K.jsx)($,{label:a(`or URL`),hint:a(`A remote server over Streamable HTTP.`),children:(0,K.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:O,placeholder:`https://host/mcp`,inputMode:`url`})}),(0,K.jsx)($,{label:a(`Risk of its tools`),hint:a(`Decides when the Sentinel asks you before a call.`),children:(0,K.jsx)(`div`,{className:`flex gap-1.5`,children:[`safe`,`moderate`,`high`].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>b(e),className:t(`rounded-full px-3 py-1.5 text-[13px] border`,y===e?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:a(e)},e))})}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:x===`add`||!p.trim()||!(h.trim()||_.trim()),onClick:()=>void C(),className:D,children:[x===`add`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(N,{size:16}),` `,a(`Connect`)]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>f(!1),className:T,children:a(`Cancel`)})]})]}):(0,K.jsxs)(`button`,{type:`button`,onClick:()=>f(!0),className:T,children:[(0,K.jsx)(V,{size:16}),` `,a(`Add a server`)]})]})}function ze({data:e,onChange:n}){let{toast:i}=c(),a=r(),[o,s]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(null),_=async()=>{g(`add`);try{await u.vaultSet(d.trim(),p),f(``),m(``),i(a(`Stored in the vault`)),n()}catch(e){i(e.message)}finally{g(null)}},v=async e=>{g(e);try{await u.vaultDelete(e),n()}catch(e){i(e.message)}finally{g(null)}};return(0,K.jsxs)(A,{icon:(0,K.jsx)(ie,{size:19}),title:a(`Vault`),summary:e.vault.length?a(`{n} secrets · encrypted on your machine`,{n:e.vault.length}):a(`Encrypted secrets the model never sees`),status:{text:`${e.vault.length}`,tone:`off`},open:o,onToggle:()=>s(!o),children:[(0,K.jsxs)(`p`,{className:`text-[12.5px] text-muted -mt-1`,children:[a(`Refer to a secret as`),` `,(0,K.jsx)(`code`,{className:`rounded bg-surface-2 px-1`,children:`{{vault:NAME}}`}),` `,a(`in a tool call or config: the value is filled in after the Sentinel approves and is redacted from everything the model reads.`)]}),e.vault.length>0&&(0,K.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,children:e.vault.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-1 rounded-full bg-surface-2 pl-3 pr-1 py-1 text-[12.5px] font-mono`,children:[e,(0,K.jsx)(`button`,{type:`button`,"aria-label":a(`Delete {name}`,{name:e}),disabled:h===e,onClick:()=>void v(e),className:`p-1 rounded-full text-muted hover:text-rose-500`,children:h===e?(0,K.jsx)(l,{size:13,className:`animate-spin`}):(0,K.jsx)(z,{size:13})})]},e))}),(0,K.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_auto] gap-2 items-end`,children:[(0,K.jsx)($,{label:a(`Name`),children:(0,K.jsx)(`input`,{value:d,onChange:e=>f(e.target.value.toUpperCase().replace(/[^A-Z0-9_.-]/g,`_`)),className:t(O,`font-mono`),placeholder:`GITHUB_TOKEN`})}),(0,K.jsx)($,{label:a(`Value`),children:(0,K.jsx)(`input`,{type:`password`,value:p,onChange:e=>m(e.target.value),className:O,placeholder:a(`secret`),autoComplete:`off`})}),(0,K.jsx)(`button`,{type:`button`,disabled:h===`add`||!d||!p,onClick:()=>void _(),className:t(D,`px-3`),"aria-label":a(`Store`),children:h===`add`?(0,K.jsx)(l,{size:16,className:`animate-spin`}):(0,K.jsx)(V,{size:16})})]})]})}var Be=`\0other`;function Ve({label:e,provider:n,value:i,options:a,more:o=[],onChange:s,other:c=!0,placeholder:l}){let u=r(),d=a.includes(i)||o.includes(i),[f,p]=(0,G.useState)(!1),m=l?u(`Automatic · {model}`,{model:l}):u(`Automatic`),h=e=>e.map(e=>({id:e,name:e})),g=o.length?[{key:`menu`,label:u(`Menu`),rows:h(a),...l?{default:l}:{}},{key:`more`,label:u(`More models on your account`),rows:h(o)}]:[{key:`list`,label:n,rows:h(a),...l?{default:l}:{}}],_=i&&d?{group:a.includes(i)?g[0].key:`more`,id:i}:void 0;return(0,K.jsxs)(`div`,{className:`block text-[12.5px] text-muted`,children:[(0,K.jsx)(`span`,{className:`block mb-1`,children:e}),(a.length||o.length)&&(d||!i)&&!f?(0,K.jsx)(ve,{label:e,text:i?`${n} · ${i}`:m,heads:[{value:``,label:m}],headValue:i?void 0:``,groups:g,current:_,onHead:()=>s(``),onPick:(e,t)=>s(t.id),tail:c?u(`Other model…`):void 0,onTail:()=>{p(!0),s(``)}}):(0,K.jsx)(`input`,{value:i,onChange:e=>s(e.target.value),placeholder:m,"aria-label":e,className:t(O,`text-fg`),spellCheck:!1})]})}function He(){let e=r();return(0,K.jsxs)(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-accent`,children:[e(`How`),` `,(0,K.jsx)(w,{size:11})]})}function $({label:e,hint:t,children:n}){return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[12px] text-muted`,children:e}),(0,K.jsx)(`div`,{className:`mt-1`,children:n}),t&&(0,K.jsx)(`div`,{className:`mt-1 text-[11.5px] text-muted leading-snug`,children:t})]})}function Ue({result:e,okText:n}){let i=r(),[a,o]=(0,G.useState)(!1),s=!e.ok&&e.detail&&e.detail!==e.error?e.detail:null;return(0,K.jsxs)(`div`,{className:t(`rounded-2xl px-3 py-2 text-[12.5px]`,e.ok?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:`bg-rose-500/12 text-rose-700 dark:text-rose-300`),children:[e.ok?n:i(e.error??`The model provider did not answer.`),s&&(0,K.jsxs)(K.Fragment,{children:[` `,(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`underline decoration-dotted underline-offset-2 opacity-70 hover:opacity-100`,children:i(a?`Hide details`:`Details`)}),a&&(0,K.jsx)(`div`,{className:`mt-1.5 break-all font-mono text-[11px] opacity-80`,children:s})]})]})}function We(e){try{return new URL(e).host}catch{return e}}export{Fe as CalendarCard,Oe as ConnectionsScreen,Ie as ContactsCard,Ne as EmailCard,Z as ModelCard};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/DevicesScreen-P67eLmyB.js b/nanomuse/server/static/assets/DevicesScreen-g6FUY327.js
similarity index 99%
rename from nanomuse/server/static/assets/DevicesScreen-P67eLmyB.js
rename to nanomuse/server/static/assets/DevicesScreen-g6FUY327.js
index 999d0d3b3..64daca63e 100644
--- a/nanomuse/server/static/assets/DevicesScreen-P67eLmyB.js
+++ b/nanomuse/server/static/assets/DevicesScreen-g6FUY327.js
@@ -1 +1 @@
-import{A as e,E as t,J as n,K as r,Q as i,Y as a,b as o,f as s,x as c}from"./MuseHeader-Pw-NI98v.js";import{n as l}from"./external-link-Xj5fjR8v.js";import{o as u}from"./Form-DwKuBk1V.js";import{t as d}from"./refresh-cw-BKgIzslL.js";import{G as f,H as p,a as m,at as h,et as g,ft as _,ht as v,i as y,l as b,o as x,pt as S,s as C}from"./index-BjYzdKkG.js";import{t as w}from"./BackBar-Dli0L0O_.js";import{t as T}from"./CloudCard-CdydxD3H.js";var E=n(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),D=n(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),O=i(a(),1),k=o(),A=`https://nanomuse.cn/dl/`;function j(){let{state:e,dispatch:n,openThread:i,setTab:a,toast:o}=s(),l=r(),u=e.hub,f=e.hands,[p,m]=(0,O.useState)(!1),h=async()=>{try{let[e,t]=await Promise.all([c.hub(),c.hands()]);n({type:`ws`,msg:{kind:`hub`,hub:e}}),n({type:`ws`,msg:{kind:`hands_state`,hands:t}})}catch{}};(0,O.useEffect)(()=>{h()},[]);let g=async()=>{m(!0),await h(),m(!1)},_=async e=>{try{let t=await c.askDevice(e.id);n({type:`ws`,msg:{kind:`thread`,thread:t.thread}}),i(t.thread.id),a(`chat`)}catch(e){o(e.message)}},v=e=>{window.confirm(l(`Forget {name}? It can join again by signing in.`,{name:e.name}))&&c.forgetDevice(e.id).then(e=>n({type:`ws`,msg:{kind:`hub`,hub:e}})).catch(e=>o(e.message))},y=(u?.devices??[]).filter(e=>!e.this&&e.kind!==`web`),b=!!u?.account.signed_in,x=u?.state===`connected`,S=y.length+(u&&x?1:0),C=y.filter(e=>e.online).length+(u&&x?1:0);return(0,k.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,k.jsx)(w,{title:l(`Devices`),actions:(0,k.jsx)(`button`,{type:`button`,onClick:()=>void g(),"aria-label":l(`Refresh`),title:l(`Refresh`),className:`flex h-9 w-9 items-center justify-center rounded-full text-muted hover:bg-surface-2 hover:text-fg`,children:(0,k.jsx)(d,{size:17,className:t(p&&`animate-spin`)})})}),(0,k.jsxs)(`div`,{className:`@container flex-1 overflow-y-auto pb-8`,children:[(0,k.jsxs)(`div`,{className:`px-5 pb-4 pt-1`,children:[(0,k.jsx)(`p`,{className:`text-[14px] leading-[20px] text-muted`,children:l(`Every device signed in to your account is a Muse of its own, on the same conversations. Type @ and a device's name in the chat to hand it work; a computer lends its hands.`)}),u&&b&&S>0&&(0,k.jsxs)(`p`,{className:`mt-1.5 text-[12.5px] font-medium uppercase tracking-wide text-muted/80`,children:[S===1?l(`1 device`):l(`{n} devices`,{n:S}),` · `,l(`{n} online`,{n:C})]})]}),(0,k.jsx)(`div`,{className:`px-4 pb-3`,children:(0,k.jsx)(T,{account:u?.account??null,onChange:()=>void h()})}),u&&(0,k.jsxs)(`div`,{className:`px-4`,children:[(0,k.jsx)(M,{children:l(`This device`)}),(0,k.jsx)(H,{hub:u,hands:f??void 0,onChange:()=>void h()})]}),(0,k.jsxs)(`div`,{className:`px-4 pt-4`,children:[(0,k.jsx)(M,{children:l(`Other devices`)}),y.length===0?(0,k.jsx)(G,{hub:u??void 0,signedIn:b}):(0,k.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @2xl:grid-cols-2`,children:y.map(e=>(0,k.jsx)(U,{device:e,onAsk:()=>void _(e),onForget:()=>v(e)},e.id))}),(0,k.jsx)(`p`,{className:`px-1 pt-3 text-[12.5px] leading-[18px] text-muted`,children:l(`A chat addressed to a device runs there; you see every step here and answer its approvals.`)})]}),f&&!f.reason?.includes(`phone`)&&(0,k.jsxs)(`div`,{className:`pt-4`,children:[(0,k.jsx)(`div`,{className:`px-4`,children:(0,k.jsx)(M,{children:l(`Hands`)})}),(0,k.jsx)(K,{hands:f,onChange:()=>void h()})]})]})]})}function M({children:e}){return(0,k.jsx)(`p`,{className:`px-1 pb-2 text-[12.5px] font-medium uppercase tracking-wide text-muted/80`,children:e})}function N({children:e}){return(0,k.jsx)(`p`,{className:`px-4 pb-3 text-[12.5px] leading-[18px] text-muted`,children:e})}function P({children:e,className:n}){return(0,k.jsx)(`div`,{className:t(`relative rounded-2xl border border-border/70 bg-surface p-4`,n),children:e})}function F({kind:e,online:n}){return(0,k.jsx)(`span`,{className:t(`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl`,n?`bg-accent/10 text-accent`:`bg-surface-2 text-muted`),"aria-hidden":!0,children:q(e,22)})}function I({online:e}){return(0,k.jsx)(`span`,{"aria-hidden":!0,className:t(`inline-block h-2 w-2 shrink-0 rounded-full`,e?`bg-[#2fb344]`:`bg-muted/35`)})}function L(e){if(e==null||e===``)return``;let t=typeof e==`number`?e:/^\d+(\.\d+)?$/.test(e)?Number(e):NaN;return Number.isFinite(t)?new Date(t*1e3).toISOString():String(e)}function R(t,n){let r=L(t.last_seen),i=e(r);return t.online?r&&Date.now()-new Date(r).getTime()<12e4?`${n(`Online`)} · ${n(`just now`)}`:n(`Online`):i?n(`Last seen {when}`,{when:i}):n(`Offline`)}function z(e,t,n=[]){let r=new Set(e??[]),i=[...n];return r.has(`task`)&&i.push(t(`Tasks`)),r.has(`shell`)&&i.push(t(`Commands`)),(r.has(`files`)||r.has(`file.get`)||r.has(`file.put`))&&i.push(t(`Files`)),r.has(`screen`)&&i.push(t(`Screenshot`)),r.has(`open`)&&i.push(t(`Open links`)),[...r].some(e=>e.startsWith(`coding.`))&&i.push(t(`Coding agents`)),r.has(`notify`)&&i.push(t(`Notifications`)),i}function B({items:e}){return e.length===0?null:(0,k.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,k.jsx)(`span`,{className:`rounded-full bg-surface-2 px-2.5 py-1 text-[12px] font-medium text-fg/80`,children:e},e))})}function V(e){return[e.os||``,e.version||``].filter(Boolean).join(` · `)}function H({hub:e,hands:t,onChange:n}){let{dispatch:i,toast:a}=s(),o=r(),[d,f]=(0,O.useState)(!1),[p,m]=(0,O.useState)(e.device.name),[h,_]=(0,O.useState)(!1),v=e.account.signed_in,y=e.state===`connected`,S=e.devices.find(e=>e.this),C=async e=>{_(!0);try{let t=await c.updateHub(e);i({type:`ws`,msg:{kind:`hub`,hub:t}}),n()}catch(e){a(e.message)}finally{_(!1)}},w=v?e.enabled?y?o(`Online`):e.state===`refused`?o(`Refused`):o(`Connecting…`):o(`Off`):o(`Signed out`),T=z(e.device.actions,o,t?.enabled&&t.available?[o(`Hands`)]:[]);return(0,k.jsxs)(P,{children:[(0,k.jsxs)(`div`,{className:`flex items-start gap-3.5`,children:[(0,k.jsx)(F,{kind:e.device.kind,online:y}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[d?(0,k.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),p.trim()&&C({name:p.trim()}).then(()=>f(!1))},children:[(0,k.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),maxLength:60,autoFocus:!0,"aria-label":o(`This device's name`),placeholder:o(`A name your other devices will see`),className:`h-9 min-w-0 flex-1 rounded-xl bg-surface-2 px-3 text-[15px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,k.jsx)(`button`,{type:`submit`,disabled:h||!p.trim(),"aria-label":o(`Save`),className:`flex h-9 w-9 items-center justify-center rounded-full bg-accent text-accent-fg disabled:opacity-40`,children:(0,k.jsx)(l,{size:16})}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>f(!1),"aria-label":o(`Cancel`),className:`flex h-9 w-9 items-center justify-center rounded-full bg-surface-2 text-muted`,children:(0,k.jsx)(u,{size:16})})]}):(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,k.jsx)(`span`,{className:`truncate text-[16px] font-semibold leading-[22px]`,children:e.device.name}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>{m(e.device.name),f(!0)},"aria-label":o(`Rename this device`),title:o(`Rename this device`),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted hover:bg-surface-2 hover:text-fg`,children:(0,k.jsx)(g,{size:13})})]}),(0,k.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1.5 text-[13px] leading-[18px] text-muted`,children:[(0,k.jsx)(I,{online:y}),(0,k.jsx)(`span`,{className:`truncate`,children:[w,V(S??{})].filter(Boolean).join(` · `)})]}),T.length>0&&(0,k.jsx)(`div`,{className:`mt-3`,children:(0,k.jsx)(B,{items:T})})]})]}),(0,k.jsxs)(`div`,{className:`-mx-4 -mb-2 mt-4 border-t border-border/60`,children:[(0,k.jsx)(b,{label:o(`Join the hub`),checked:e.enabled&&v,disabled:!v||h,onChange:e=>void C({enabled:e})}),(0,k.jsx)(N,{children:o(v?`Reachable by your other devices while this runs.`:`Sign in first.`)}),(0,k.jsx)(x,{inset:16}),(0,k.jsx)(b,{label:o(`My other devices may operate it`),checked:e.remote_control,disabled:h,onChange:e=>void C({remote_control:e})}),(0,k.jsx)(N,{children:o(`They can run commands, read files and see its screen here; each step still goes through the Sentinel.`)})]}),(e.state===`refused`||e.state===`disconnected`)&&e.detail&&(0,k.jsx)(`div`,{className:`mt-3 rounded-xl bg-amber-500/12 px-3 py-2 text-[12.5px] text-amber-700 dark:text-amber-300`,children:e.detail})]})}function U({device:e,onAsk:t,onForget:n}){let i=r(),a=z(e.actions,i),o=e.online&&(e.actions??[]).includes(`task`);return(0,k.jsxs)(P,{className:`flex flex-col gap-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-start gap-3.5`,children:[(0,k.jsx)(F,{kind:e.kind,online:e.online}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`p`,{className:`truncate text-[16px] font-semibold leading-[22px]`,children:e.name}),(0,k.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1.5 text-[13px] leading-[18px] text-muted`,children:[(0,k.jsx)(I,{online:e.online}),(0,k.jsx)(`span`,{className:`truncate`,children:[R(e,i),V(e)].filter(Boolean).join(` · `)})]})]}),(0,k.jsx)(W,{label:i(`More about {name}`,{name:e.name}),items:[{label:i(`Forget this device`),onClick:n,danger:!0}]})]}),(0,k.jsx)(B,{items:a}),o&&(0,k.jsx)(`p`,{className:`text-[12.5px] leading-[18px] text-muted`,children:i(`Type @{name} in the chat to hand it work.`,{name:e.name})}),e.online&&(0,k.jsxs)(`button`,{type:`button`,onClick:t,className:`flex h-9 w-fit items-center gap-1.5 rounded-full bg-accent/10 px-3.5 text-[13.5px] font-medium text-accent hover:bg-accent/15`,children:[(0,k.jsx)(h,{size:14}),` `,i(`Ask`)]})]})}function W({label:e,items:n}){let[r,i]=(0,O.useState)(!1),a=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(!r)return;let e=e=>{a.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&i(!1)};return window.addEventListener(`pointerdown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`pointerdown`,e),window.removeEventListener(`keydown`,t)}},[r]),(0,k.jsxs)(`div`,{ref:a,className:`relative -mr-1.5 -mt-1`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-label":e,"aria-haspopup":`menu`,"aria-expanded":r,className:`flex h-8 w-8 items-center justify-center rounded-full text-muted hover:bg-surface-2 hover:text-fg`,children:(0,k.jsx)(v,{size:18})}),r&&(0,k.jsx)(`ul`,{role:`menu`,className:`absolute right-0 top-9 z-30 min-w-[180px] overflow-hidden rounded-2xl border border-border bg-surface py-1 shadow-xl`,children:n.map(e=>(0,k.jsx)(`li`,{children:(0,k.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{i(!1),e.onClick()},className:t(`w-full px-4 py-2.5 text-left text-[14px] hover:bg-surface-2`,e.danger&&`text-red-600 dark:text-red-400`),children:e.label})},e.label))})]})}function G({hub:e,signedIn:t}){let n=r(),i=t&&e?.state===`connected`;return(0,k.jsxs)(P,{className:`flex flex-col gap-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-start gap-3.5`,children:[(0,k.jsx)(`span`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-muted`,"aria-hidden":!0,children:(0,k.jsx)(f,{size:22})}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`p`,{className:`text-[15px] font-semibold leading-[20px]`,children:n(i?`Add a device`:`No other device yet`)}),(0,k.jsx)(`p`,{className:`mt-1 text-[13px] leading-[18px] text-muted`,children:t?i?e?.account.hint?n(`Install nanoMuse on your phone, Mac or PC and sign in as {hint}; it appears here on its own.`,{hint:e.account.hint}):n(`Install nanoMuse on your phone, Mac or PC and sign in with the same account; it appears here on its own.`):J(e?.state??``,n):n(`Sign in above to see them.`)})]})]}),i&&(0,k.jsx)(`a`,{href:A,target:`_blank`,rel:`noopener noreferrer`,className:`flex h-9 w-fit items-center gap-1.5 rounded-full bg-accent/10 px-3.5 text-[13.5px] font-medium text-accent hover:bg-accent/15`,children:n(`Get the apps`)})]})}function K({hands:e,onChange:n}){let{dispatch:i,toast:a,state:o}=s(),l=r(),[u,d]=(0,O.useState)(!1),f=o.profile?.name??`nanoMuse`,h=async e=>{d(!0);try{let t=await c.setHands(e);i({type:`ws`,msg:{kind:`hands_state`,hands:t}}),n()}catch(e){a(e.message)}finally{d(!1)}},g=e.task_active?l(`Working`):e.enabled?e.available?l(`On`):l(`Unavailable`):l(`Off`);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(m,{className:`border border-border/70`,children:[(0,k.jsx)(b,{icon:(0,k.jsx)(_,{size:22}),label:l(`Hands on this computer`),value:g,checked:e.enabled,disabled:u,onChange:e=>void h({enabled:e})}),(0,k.jsx)(y,{className:`pb-3 pt-0`,children:e.task_active?e.task_text||l(`On the screen now`):e.available?l(`It looks at a screenshot and clicks by position; paying, sending and deleting ask you first.`):e.reason||l(`Nothing can drive this screen yet.`)}),(0,k.jsx)(x,{inset:16}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-[13px] text-muted`,children:[(0,k.jsxs)(`span`,{children:[l(`Driver`),`:`]}),[`auto`,`desktop`,`pyautogui`,`xdotool`].map(n=>(0,k.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void h({backend:n}),className:t(`rounded-full px-2.5 py-1`,(e.backend??`auto`)===n||n===`auto`&&!e.backend?`bg-fg text-bg`:`bg-surface-2 text-fg`),children:n},n))]}),(e.device?.platform===`darwin`||e.window?.available)&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(x,{inset:16}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-4 py-3 text-[13px] text-muted`,children:[(0,k.jsxs)(`span`,{children:[l(`Where`),`:`]}),[`auto`,`window`,`screen`].map(n=>(0,k.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void h({mode:n}),className:t(`rounded-full px-2.5 py-1`,(e.mode??`auto`)===n?`bg-fg text-bg`:`bg-surface-2 text-fg`),children:l(n===`auto`?`Auto`:n===`window`?`One window`:`Whole screen`)},n))]}),(0,k.jsx)(y,{className:`pb-3 pt-0`,children:e.window?.active&&e.window.app?l(`Working in {app}'s window; the mouse stays yours.`,{app:e.window.app}):e.window?.reason&&(e.mode??`auto`)!==`screen`?l(`On the whole screen for now: {reason}`,{reason:e.window.reason}):l(`One window: the hands work inside the app they were given, send clicks and keys to it alone and leave your mouse alone. Whole screen: the system mouse, like other platforms. Auto picks one window as soon as an app is named.`)})]}),e.task_active&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(x,{inset:16}),(0,k.jsx)(C,{icon:(0,k.jsx)(p,{size:18,fill:`currentColor`}),label:l(`Stop the hands`),onClick:()=>void c.stopHands().catch(e=>a(e.message)),chevron:!1})]})]}),e.enabled&&e.device?.platform===`darwin`&&(0,k.jsx)(y,{children:l(`On a Mac, allow nanoMuse under System Settings → Privacy & Security → Accessibility and Screen Recording when macOS asks; without them clicks do nothing and the screenshot is black. The first action in each app asks you once ("Let {name} use Safari?") and the answer is kept under Permissions.`,{name:f})})]})}function q(e,t=18){switch(e){case`phone`:return(0,k.jsx)(f,{size:t});case`computer`:return(0,k.jsx)(E,{size:t});case`web`:return(0,k.jsx)(S,{size:t});default:return(0,k.jsx)(D,{size:t})}}function J(e,t){switch(e){case`connected`:return t(`On the hub`);case`connecting`:case`disconnected`:return t(`Connecting to the hub…`);case`refused`:return t(`The hub refused this device. Sign in again.`);case`signed_out`:return t(`Not signed in.`);case`off`:case`stopped`:return t(`The hub is off on this device.`);default:return e}}export{j as DevicesScreen};
\ No newline at end of file
+import{A as e,E as t,J as n,K as r,Q as i,Y as a,b as o,f as s,x as c}from"./MuseHeader-Pw-NI98v.js";import{n as l}from"./external-link-Xj5fjR8v.js";import{o as u}from"./Form-DwKuBk1V.js";import{t as d}from"./refresh-cw-BKgIzslL.js";import{G as f,H as p,a as m,at as h,et as g,ft as _,ht as v,i as y,l as b,o as x,pt as S,s as C}from"./index-CIdGZ5PB.js";import{t as w}from"./BackBar-Dl56jHZM.js";import{t as T}from"./CloudCard-CtVHK0qc.js";var E=n(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),D=n(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),O=i(a(),1),k=o(),A=`https://nanomuse.cn/dl/`;function j(){let{state:e,dispatch:n,openThread:i,setTab:a,toast:o}=s(),l=r(),u=e.hub,f=e.hands,[p,m]=(0,O.useState)(!1),h=async()=>{try{let[e,t]=await Promise.all([c.hub(),c.hands()]);n({type:`ws`,msg:{kind:`hub`,hub:e}}),n({type:`ws`,msg:{kind:`hands_state`,hands:t}})}catch{}};(0,O.useEffect)(()=>{h()},[]);let g=async()=>{m(!0),await h(),m(!1)},_=async e=>{try{let t=await c.askDevice(e.id);n({type:`ws`,msg:{kind:`thread`,thread:t.thread}}),i(t.thread.id),a(`chat`)}catch(e){o(e.message)}},v=e=>{window.confirm(l(`Forget {name}? It can join again by signing in.`,{name:e.name}))&&c.forgetDevice(e.id).then(e=>n({type:`ws`,msg:{kind:`hub`,hub:e}})).catch(e=>o(e.message))},y=(u?.devices??[]).filter(e=>!e.this&&e.kind!==`web`),b=!!u?.account.signed_in,x=u?.state===`connected`,S=y.length+(u&&x?1:0),C=y.filter(e=>e.online).length+(u&&x?1:0);return(0,k.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,k.jsx)(w,{title:l(`Devices`),actions:(0,k.jsx)(`button`,{type:`button`,onClick:()=>void g(),"aria-label":l(`Refresh`),title:l(`Refresh`),className:`flex h-9 w-9 items-center justify-center rounded-full text-muted hover:bg-surface-2 hover:text-fg`,children:(0,k.jsx)(d,{size:17,className:t(p&&`animate-spin`)})})}),(0,k.jsxs)(`div`,{className:`@container flex-1 overflow-y-auto pb-8`,children:[(0,k.jsxs)(`div`,{className:`px-5 pb-4 pt-1`,children:[(0,k.jsx)(`p`,{className:`text-[14px] leading-[20px] text-muted`,children:l(`Every device signed in to your account is a Muse of its own, on the same conversations. Type @ and a device's name in the chat to hand it work; a computer lends its hands.`)}),u&&b&&S>0&&(0,k.jsxs)(`p`,{className:`mt-1.5 text-[12.5px] font-medium uppercase tracking-wide text-muted/80`,children:[S===1?l(`1 device`):l(`{n} devices`,{n:S}),` · `,l(`{n} online`,{n:C})]})]}),(0,k.jsx)(`div`,{className:`px-4 pb-3`,children:(0,k.jsx)(T,{account:u?.account??null,onChange:()=>void h()})}),u&&(0,k.jsxs)(`div`,{className:`px-4`,children:[(0,k.jsx)(M,{children:l(`This device`)}),(0,k.jsx)(H,{hub:u,hands:f??void 0,onChange:()=>void h()})]}),(0,k.jsxs)(`div`,{className:`px-4 pt-4`,children:[(0,k.jsx)(M,{children:l(`Other devices`)}),y.length===0?(0,k.jsx)(G,{hub:u??void 0,signedIn:b}):(0,k.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @2xl:grid-cols-2`,children:y.map(e=>(0,k.jsx)(U,{device:e,onAsk:()=>void _(e),onForget:()=>v(e)},e.id))}),(0,k.jsx)(`p`,{className:`px-1 pt-3 text-[12.5px] leading-[18px] text-muted`,children:l(`A chat addressed to a device runs there; you see every step here and answer its approvals.`)})]}),f&&!f.reason?.includes(`phone`)&&(0,k.jsxs)(`div`,{className:`pt-4`,children:[(0,k.jsx)(`div`,{className:`px-4`,children:(0,k.jsx)(M,{children:l(`Hands`)})}),(0,k.jsx)(K,{hands:f,onChange:()=>void h()})]})]})]})}function M({children:e}){return(0,k.jsx)(`p`,{className:`px-1 pb-2 text-[12.5px] font-medium uppercase tracking-wide text-muted/80`,children:e})}function N({children:e}){return(0,k.jsx)(`p`,{className:`px-4 pb-3 text-[12.5px] leading-[18px] text-muted`,children:e})}function P({children:e,className:n}){return(0,k.jsx)(`div`,{className:t(`relative rounded-2xl border border-border/70 bg-surface p-4`,n),children:e})}function F({kind:e,online:n}){return(0,k.jsx)(`span`,{className:t(`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl`,n?`bg-accent/10 text-accent`:`bg-surface-2 text-muted`),"aria-hidden":!0,children:q(e,22)})}function I({online:e}){return(0,k.jsx)(`span`,{"aria-hidden":!0,className:t(`inline-block h-2 w-2 shrink-0 rounded-full`,e?`bg-[#2fb344]`:`bg-muted/35`)})}function L(e){if(e==null||e===``)return``;let t=typeof e==`number`?e:/^\d+(\.\d+)?$/.test(e)?Number(e):NaN;return Number.isFinite(t)?new Date(t*1e3).toISOString():String(e)}function R(t,n){let r=L(t.last_seen),i=e(r);return t.online?r&&Date.now()-new Date(r).getTime()<12e4?`${n(`Online`)} · ${n(`just now`)}`:n(`Online`):i?n(`Last seen {when}`,{when:i}):n(`Offline`)}function z(e,t,n=[]){let r=new Set(e??[]),i=[...n];return r.has(`task`)&&i.push(t(`Tasks`)),r.has(`shell`)&&i.push(t(`Commands`)),(r.has(`files`)||r.has(`file.get`)||r.has(`file.put`))&&i.push(t(`Files`)),r.has(`screen`)&&i.push(t(`Screenshot`)),r.has(`open`)&&i.push(t(`Open links`)),[...r].some(e=>e.startsWith(`coding.`))&&i.push(t(`Coding agents`)),r.has(`notify`)&&i.push(t(`Notifications`)),i}function B({items:e}){return e.length===0?null:(0,k.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,k.jsx)(`span`,{className:`rounded-full bg-surface-2 px-2.5 py-1 text-[12px] font-medium text-fg/80`,children:e},e))})}function V(e){return[e.os||``,e.version||``].filter(Boolean).join(` · `)}function H({hub:e,hands:t,onChange:n}){let{dispatch:i,toast:a}=s(),o=r(),[d,f]=(0,O.useState)(!1),[p,m]=(0,O.useState)(e.device.name),[h,_]=(0,O.useState)(!1),v=e.account.signed_in,y=e.state===`connected`,S=e.devices.find(e=>e.this),C=async e=>{_(!0);try{let t=await c.updateHub(e);i({type:`ws`,msg:{kind:`hub`,hub:t}}),n()}catch(e){a(e.message)}finally{_(!1)}},w=v?e.enabled?y?o(`Online`):e.state===`refused`?o(`Refused`):o(`Connecting…`):o(`Off`):o(`Signed out`),T=z(e.device.actions,o,t?.enabled&&t.available?[o(`Hands`)]:[]);return(0,k.jsxs)(P,{children:[(0,k.jsxs)(`div`,{className:`flex items-start gap-3.5`,children:[(0,k.jsx)(F,{kind:e.device.kind,online:y}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[d?(0,k.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),p.trim()&&C({name:p.trim()}).then(()=>f(!1))},children:[(0,k.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),maxLength:60,autoFocus:!0,"aria-label":o(`This device's name`),placeholder:o(`A name your other devices will see`),className:`h-9 min-w-0 flex-1 rounded-xl bg-surface-2 px-3 text-[15px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,k.jsx)(`button`,{type:`submit`,disabled:h||!p.trim(),"aria-label":o(`Save`),className:`flex h-9 w-9 items-center justify-center rounded-full bg-accent text-accent-fg disabled:opacity-40`,children:(0,k.jsx)(l,{size:16})}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>f(!1),"aria-label":o(`Cancel`),className:`flex h-9 w-9 items-center justify-center rounded-full bg-surface-2 text-muted`,children:(0,k.jsx)(u,{size:16})})]}):(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,k.jsx)(`span`,{className:`truncate text-[16px] font-semibold leading-[22px]`,children:e.device.name}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>{m(e.device.name),f(!0)},"aria-label":o(`Rename this device`),title:o(`Rename this device`),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted hover:bg-surface-2 hover:text-fg`,children:(0,k.jsx)(g,{size:13})})]}),(0,k.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1.5 text-[13px] leading-[18px] text-muted`,children:[(0,k.jsx)(I,{online:y}),(0,k.jsx)(`span`,{className:`truncate`,children:[w,V(S??{})].filter(Boolean).join(` · `)})]}),T.length>0&&(0,k.jsx)(`div`,{className:`mt-3`,children:(0,k.jsx)(B,{items:T})})]})]}),(0,k.jsxs)(`div`,{className:`-mx-4 -mb-2 mt-4 border-t border-border/60`,children:[(0,k.jsx)(b,{label:o(`Join the hub`),checked:e.enabled&&v,disabled:!v||h,onChange:e=>void C({enabled:e})}),(0,k.jsx)(N,{children:o(v?`Reachable by your other devices while this runs.`:`Sign in first.`)}),(0,k.jsx)(x,{inset:16}),(0,k.jsx)(b,{label:o(`My other devices may operate it`),checked:e.remote_control,disabled:h,onChange:e=>void C({remote_control:e})}),(0,k.jsx)(N,{children:o(`They can run commands, read files and see its screen here; each step still goes through the Sentinel.`)})]}),(e.state===`refused`||e.state===`disconnected`)&&e.detail&&(0,k.jsx)(`div`,{className:`mt-3 rounded-xl bg-amber-500/12 px-3 py-2 text-[12.5px] text-amber-700 dark:text-amber-300`,children:e.detail})]})}function U({device:e,onAsk:t,onForget:n}){let i=r(),a=z(e.actions,i),o=e.online&&(e.actions??[]).includes(`task`);return(0,k.jsxs)(P,{className:`flex flex-col gap-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-start gap-3.5`,children:[(0,k.jsx)(F,{kind:e.kind,online:e.online}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`p`,{className:`truncate text-[16px] font-semibold leading-[22px]`,children:e.name}),(0,k.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1.5 text-[13px] leading-[18px] text-muted`,children:[(0,k.jsx)(I,{online:e.online}),(0,k.jsx)(`span`,{className:`truncate`,children:[R(e,i),V(e)].filter(Boolean).join(` · `)})]})]}),(0,k.jsx)(W,{label:i(`More about {name}`,{name:e.name}),items:[{label:i(`Forget this device`),onClick:n,danger:!0}]})]}),(0,k.jsx)(B,{items:a}),o&&(0,k.jsx)(`p`,{className:`text-[12.5px] leading-[18px] text-muted`,children:i(`Type @{name} in the chat to hand it work.`,{name:e.name})}),e.online&&(0,k.jsxs)(`button`,{type:`button`,onClick:t,className:`flex h-9 w-fit items-center gap-1.5 rounded-full bg-accent/10 px-3.5 text-[13.5px] font-medium text-accent hover:bg-accent/15`,children:[(0,k.jsx)(h,{size:14}),` `,i(`Ask`)]})]})}function W({label:e,items:n}){let[r,i]=(0,O.useState)(!1),a=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(!r)return;let e=e=>{a.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&i(!1)};return window.addEventListener(`pointerdown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`pointerdown`,e),window.removeEventListener(`keydown`,t)}},[r]),(0,k.jsxs)(`div`,{ref:a,className:`relative -mr-1.5 -mt-1`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-label":e,"aria-haspopup":`menu`,"aria-expanded":r,className:`flex h-8 w-8 items-center justify-center rounded-full text-muted hover:bg-surface-2 hover:text-fg`,children:(0,k.jsx)(v,{size:18})}),r&&(0,k.jsx)(`ul`,{role:`menu`,className:`absolute right-0 top-9 z-30 min-w-[180px] overflow-hidden rounded-2xl border border-border bg-surface py-1 shadow-xl`,children:n.map(e=>(0,k.jsx)(`li`,{children:(0,k.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{i(!1),e.onClick()},className:t(`w-full px-4 py-2.5 text-left text-[14px] hover:bg-surface-2`,e.danger&&`text-red-600 dark:text-red-400`),children:e.label})},e.label))})]})}function G({hub:e,signedIn:t}){let n=r(),i=t&&e?.state===`connected`;return(0,k.jsxs)(P,{className:`flex flex-col gap-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-start gap-3.5`,children:[(0,k.jsx)(`span`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-muted`,"aria-hidden":!0,children:(0,k.jsx)(f,{size:22})}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`p`,{className:`text-[15px] font-semibold leading-[20px]`,children:n(i?`Add a device`:`No other device yet`)}),(0,k.jsx)(`p`,{className:`mt-1 text-[13px] leading-[18px] text-muted`,children:t?i?e?.account.hint?n(`Install nanoMuse on your phone, Mac or PC and sign in as {hint}; it appears here on its own.`,{hint:e.account.hint}):n(`Install nanoMuse on your phone, Mac or PC and sign in with the same account; it appears here on its own.`):J(e?.state??``,n):n(`Sign in above to see them.`)})]})]}),i&&(0,k.jsx)(`a`,{href:A,target:`_blank`,rel:`noopener noreferrer`,className:`flex h-9 w-fit items-center gap-1.5 rounded-full bg-accent/10 px-3.5 text-[13.5px] font-medium text-accent hover:bg-accent/15`,children:n(`Get the apps`)})]})}function K({hands:e,onChange:n}){let{dispatch:i,toast:a,state:o}=s(),l=r(),[u,d]=(0,O.useState)(!1),f=o.profile?.name??`nanoMuse`,h=async e=>{d(!0);try{let t=await c.setHands(e);i({type:`ws`,msg:{kind:`hands_state`,hands:t}}),n()}catch(e){a(e.message)}finally{d(!1)}},g=e.task_active?l(`Working`):e.enabled?e.available?l(`On`):l(`Unavailable`):l(`Off`);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(m,{className:`border border-border/70`,children:[(0,k.jsx)(b,{icon:(0,k.jsx)(_,{size:22}),label:l(`Hands on this computer`),value:g,checked:e.enabled,disabled:u,onChange:e=>void h({enabled:e})}),(0,k.jsx)(y,{className:`pb-3 pt-0`,children:e.task_active?e.task_text||l(`On the screen now`):e.available?l(`It looks at a screenshot and clicks by position; paying, sending and deleting ask you first.`):e.reason||l(`Nothing can drive this screen yet.`)}),(0,k.jsx)(x,{inset:16}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-[13px] text-muted`,children:[(0,k.jsxs)(`span`,{children:[l(`Driver`),`:`]}),[`auto`,`desktop`,`pyautogui`,`xdotool`].map(n=>(0,k.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void h({backend:n}),className:t(`rounded-full px-2.5 py-1`,(e.backend??`auto`)===n||n===`auto`&&!e.backend?`bg-fg text-bg`:`bg-surface-2 text-fg`),children:n},n))]}),(e.device?.platform===`darwin`||e.window?.available)&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(x,{inset:16}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-4 py-3 text-[13px] text-muted`,children:[(0,k.jsxs)(`span`,{children:[l(`Where`),`:`]}),[`auto`,`window`,`screen`].map(n=>(0,k.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void h({mode:n}),className:t(`rounded-full px-2.5 py-1`,(e.mode??`auto`)===n?`bg-fg text-bg`:`bg-surface-2 text-fg`),children:l(n===`auto`?`Auto`:n===`window`?`One window`:`Whole screen`)},n))]}),(0,k.jsx)(y,{className:`pb-3 pt-0`,children:e.window?.active&&e.window.app?l(`Working in {app}'s window; the mouse stays yours.`,{app:e.window.app}):e.window?.reason&&(e.mode??`auto`)!==`screen`?l(`On the whole screen for now: {reason}`,{reason:e.window.reason}):l(`One window: the hands work inside the app they were given, send clicks and keys to it alone and leave your mouse alone. Whole screen: the system mouse, like other platforms. Auto picks one window as soon as an app is named.`)})]}),e.task_active&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(x,{inset:16}),(0,k.jsx)(C,{icon:(0,k.jsx)(p,{size:18,fill:`currentColor`}),label:l(`Stop the hands`),onClick:()=>void c.stopHands().catch(e=>a(e.message)),chevron:!1})]})]}),e.enabled&&e.device?.platform===`darwin`&&(0,k.jsx)(y,{children:l(`On a Mac, allow nanoMuse under System Settings → Privacy & Security → Accessibility and Screen Recording when macOS asks; without them clicks do nothing and the screenshot is black. The first action in each app asks you once ("Let {name} use Safari?") and the answer is kept under Permissions.`,{name:f})})]})}function q(e,t=18){switch(e){case`phone`:return(0,k.jsx)(f,{size:t});case`computer`:return(0,k.jsx)(E,{size:t});case`web`:return(0,k.jsx)(S,{size:t});default:return(0,k.jsx)(D,{size:t})}}function J(e,t){switch(e){case`connected`:return t(`On the hub`);case`connecting`:case`disconnected`:return t(`Connecting to the hub…`);case`refused`:return t(`The hub refused this device. Sign in again.`);case`signed_out`:return t(`Not signed in.`);case`off`:case`stopped`:return t(`The hub is off on this device.`);default:return e}}export{j as DevicesScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/GoalsScreen-BGb02qG6.js b/nanomuse/server/static/assets/GoalsScreen-Dp2fRaLA.js
similarity index 99%
rename from nanomuse/server/static/assets/GoalsScreen-BGb02qG6.js
rename to nanomuse/server/static/assets/GoalsScreen-Dp2fRaLA.js
index 6773bc051..2973d5d55 100644
--- a/nanomuse/server/static/assets/GoalsScreen-BGb02qG6.js
+++ b/nanomuse/server/static/assets/GoalsScreen-Dp2fRaLA.js
@@ -1,2 +1,2 @@
-import{A as e,E as t,J as n,K as r,N as i,Q as a,Y as o,b as s,f as c,r as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{t as d}from"./StarNudge-DjXecvWj.js";import{H as f,Q as p,S as m,V as h,W as g,Z as _,_ as v,b as y,f as b,g as x,h as S,m as C,ot as w,p as T,v as E,w as D,wt as O,x as k,xt as A,y as j}from"./index-BjYzdKkG.js";var M=n(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]),N=n(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),P=n(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),F=n(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),I=n(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),L=n(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),R=n(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),z=n(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),B=n(`square-check`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),V=a(o(),1),H=s(),U={pending:e=>(0,H.jsx)(I,{...e}),in_progress:e=>(0,H.jsx)(P,{...e,className:t(e.className,`text-accent`)}),done:e=>(0,H.jsx)(N,{...e,className:t(e.className,`text-emerald-500`)}),blocked:e=>(0,H.jsx)(R,{...e,className:t(e.className,`text-rose-500`)}),skipped:e=>(0,H.jsx)(F,{...e,className:t(e.className,`text-muted`)})},W={pending:`done`,in_progress:`done`,done:`pending`,blocked:`pending`,skipped:`pending`};function G(){let{state:e,refreshGoals:t,send:n,openThread:i,toast:a}=c(),[o,s]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(null),[g,v]=(0,V.useState)(!1),y=(0,V.useRef)(null),x=e.profile?.name??`nanoMuse`,S=r();(0,V.useEffect)(()=>{t()},[t]);let T=e.goals.filter(e=>e.proposal&&e.status!==`cancelled`),E=[...e.goals.filter(e=>e.status===`active`),...e.goals.filter(e=>e.status===`paused`)],O=e.goals.filter(e=>e.status===`done`||e.status===`cancelled`),k=e.goals.find(e=>e.id===o)??null,A=async e=>{try{await u.advanceGoal(e.id),a(S(`{name} is working on “{title}” in the main chat`,{name:x,title:e.title})),i(`main`)}catch(e){a(e.message)}},[j,M]=(0,V.useState)(!1),N=async e=>{try{let n=e.status!==`done`;await u.patchGoal(e.id,{status:n?`done`:`active`}),n&&M(!0),t()}catch(e){a(e.message)}},P=e=>{h(null),n(`main`,S(`I'd like to create a {category} goal. Ask me a few short questions, one at a time (what exactly I want, why and by when, how often to check in), then create it with concrete steps using the goals tool.`,{category:S(e.label)})).catch(e=>a(e.message||S(`Could not send`))),i(`main`)};return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(b,{title:S(`Goals`),children:(0,H.jsx)(l,{small:!0,onClick:()=>p(!0),label:S(`New goal`),children:(0,H.jsx)(_,{size:22})})}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-6`,children:[T.length>0&&(0,H.jsxs)(`section`,{className:`px-4 pb-2`,children:[(0,H.jsx)(`div`,{className:`px-1 mb-2 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:S(`{name} suggests`,{name:x})}),(0,H.jsx)(`div`,{className:`space-y-2.5`,children:T.map(e=>(0,H.jsx)(Y,{goal:e,onChanged:t,onOpen:()=>s(e.id)},e.id))})]}),(0,H.jsx)(d,{moment:`goal_done`,due:j,className:`mx-4 mb-3`}),(0,H.jsx)(K,{label:S(`Tracking`),dot:!0,onAdd:()=>y.current?.scrollIntoView({behavior:`smooth`,block:`start`})}),E.length===0?(0,H.jsx)(`p`,{className:`px-5 pb-3 text-[13px] text-muted`,children:S(`Nothing tracked yet`)}):E.map(e=>(0,H.jsx)(J,{goal:e,onOpen:()=>s(e.id),onToggle:()=>void N(e)},e.id)),O.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`h-1.5`}),(0,H.jsx)(K,{label:S(`Finished`)}),(g?O:O.slice(0,2)).map(e=>(0,H.jsx)(J,{goal:e,onOpen:()=>s(e.id),onToggle:()=>void N(e)},e.id)),!g&&O.length>2&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>v(!0),className:`px-5 py-2 text-[13.5px] font-medium text-accent`,children:S(`Show {n} more`,{n:O.length-2})})]}),(0,H.jsxs)(`div`,{ref:y,className:`mt-2.5 border-t border-border/70 px-5 pt-3.5 pb-1.5`,children:[(0,H.jsx)(`h3`,{className:`text-[17px] font-semibold`,children:S(`Create a goal`)}),(0,H.jsx)(`p`,{className:`mt-1 text-[13px] leading-[18px] text-muted`,children:S(`Pick a category and tell me the goal you have in mind. I'll shape a plan with you and keep improving it as you go.`)})]}),C.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`flex h-[50px] w-full items-center gap-3.5 pl-5 pr-2 text-left active:bg-surface-2/70`,children:[(0,H.jsx)(`span`,{className:`text-fg`,children:e.icon({size:22})}),(0,H.jsx)(`span`,{className:`flex-1 text-[15px] font-medium`,children:S(e.label)}),(0,H.jsx)(`span`,{className:`flex h-10 w-10 items-center justify-center text-muted`,children:(0,H.jsx)(_,{size:22})})]},e.id))]}),(0,H.jsx)(Q,{goal:k,onClose:()=>s(null),onAdvance:A,onChanged:t}),(0,H.jsx)($,{open:f,onClose:()=>p(!1),onCreated:()=>{p(!1),t()}}),(0,H.jsx)(D,{open:m!==null,onClose:()=>h(null),children:m&&(0,H.jsxs)(`div`,{className:`px-1 pb-2`,children:[(0,H.jsx)(`h3`,{className:`text-[20px] font-bold`,children:S(`Create a {category} goal`,{category:S(m.label)})}),(0,H.jsx)(`p`,{className:`mt-3.5 text-[15px] leading-[22px]`,children:S(`First, we'll shape the goal together in the chat. I'll ask a few questions so I understand exactly what you're after.`)}),(0,H.jsx)(`p`,{className:`mt-3.5 text-[15px] leading-[22px]`,children:S(`Once it's set, I'll track your progress here.`)}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>P(m),className:`mt-6 flex h-[50px] w-full items-center justify-center gap-2 rounded-full bg-accent text-[16px] font-semibold text-accent-fg`,children:[(0,H.jsx)(w,{size:18}),` `,S(`Start`)]})]})})]})}function K({label:e,dot:n=!1,onAdd:r}){return(0,H.jsxs)(`div`,{className:`flex items-center pl-5 pr-2 pt-1`,children:[n&&(0,H.jsx)(`span`,{className:`mr-2.5 h-2 w-2 rounded-full bg-emerald-500`}),(0,H.jsx)(`span`,{className:t(`flex-1 text-[15px] font-semibold`,n&&`text-emerald-600 dark:text-emerald-400`),children:e}),r?(0,H.jsx)(`button`,{type:`button`,onClick:r,"aria-label":e,className:`flex h-10 w-10 items-center justify-center text-muted`,children:(0,H.jsx)(_,{size:22})}):(0,H.jsx)(`span`,{className:`h-10`})]})}function q({id:e,size:n=`sm`}){let i=r(),a=x(e);return a?(0,H.jsxs)(`span`,{className:t(`inline-flex items-center gap-1 rounded-full font-medium`,a.tone,n===`sm`?`px-2 py-0.5 text-[11.5px]`:`px-2.5 py-1 text-[12.5px]`),children:[a.icon({size:n===`sm`?11:13}),` `,i(a.label)]}):null}function J({goal:n,onOpen:i,onToggle:a}){let o=r(),s=n.status===`done`,c=n.progress.total?Math.round(n.progress.done/n.progress.total*100):0,l=E(n.due,n.overdue),u=n.next_step?o(`Next: {step}`,{step:n.next_step}):n.description||``,d=n.status===`paused`?o(`Paused`):n.status===`cancelled`?o(`Cancelled`):s?o(`Done`):n.check_in?v(n.check_in):o(`Updated {when}`,{when:e(n.updated_at)});return(0,H.jsxs)(`div`,{className:`flex items-start pl-[18px] pr-1 pt-2 pb-2.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:a,"aria-label":o(s?`Mark as not done`:`Mark as done`),className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center text-muted`,children:s?(0,H.jsx)(B,{size:22}):(0,H.jsx)(f,{size:22})}),(0,H.jsxs)(`button`,{type:`button`,onClick:i,className:`ml-2.5 min-w-0 flex-1 pt-[3px] text-left`,children:[(0,H.jsx)(`span`,{className:t(`line-clamp-2 block text-[15px] font-semibold leading-snug`,s&&`text-muted`),children:n.title}),u&&(0,H.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-[13px] leading-[18px] text-muted`,children:u}),(0,H.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-2 text-[12px] text-muted/80`,children:[(0,H.jsxs)(`span`,{className:`truncate`,children:[d,l&&n.status===`active`?` · ${l}`:``]}),c>0&&!s&&(0,H.jsxs)(`span`,{className:`shrink-0 font-medium text-emerald-600 dark:text-emerald-400`,children:[c,`%`]})]})]}),(0,H.jsx)(`button`,{type:`button`,onClick:i,"aria-label":o(`More`),className:`flex h-10 w-10 shrink-0 items-center justify-center text-muted`,children:(0,H.jsx)(L,{size:20})})]})}function Y({goal:e,onChanged:t,onOpen:n}){let{toast:i,state:a}=c(),[o,s]=(0,V.useState)(!1),l=a.profile?.name??`nanoMuse`,d=r(),f=e.proposal;if(!f)return null;let p=async n=>{s(!0);try{n?await u.acceptProposal(e.id):await u.dismissProposal(e.id),i(d(n?`Plan updated`:`Kept your plan`)),t()}catch(e){i(e.message)}finally{s(!1)}},m=e.steps.filter(e=>e.status===`done`||e.status===`skipped`).length;return(0,H.jsxs)(`div`,{className:`rounded-3xl border border-accent/30 bg-accent/5 px-4 py-3.5`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:n,className:`w-full text-left`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] font-semibold uppercase tracking-wide text-accent`,children:[(0,H.jsx)(g,{size:13}),` `,d(`Adjust the plan for “{title}”?`,{title:e.title})]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[14px] leading-snug`,children:f.reason}),(0,H.jsxs)(`div`,{className:`mt-2 text-[12px] text-muted`,children:[m>0&&(0,H.jsxs)(`span`,{children:[m===1?d(`Keeps the 1 step already done.`):d(`Keeps the {n} steps already done.`,{n:m}),` `]}),d(`New remaining steps:`)]}),(0,H.jsx)(`ol`,{className:`mt-1 space-y-0.5 text-[13.5px] list-decimal pl-5`,children:f.steps.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))})]}),(0,H.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>void p(!1),className:`flex-1 rounded-2xl border border-border py-2 text-[13.5px] font-medium disabled:opacity-50`,children:d(`Keep my plan`)}),(0,H.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>void p(!0),className:`flex-1 rounded-2xl bg-accent text-accent-fg py-2 text-[13.5px] font-medium disabled:opacity-50`,children:d(`Use {name}'s plan`,{name:l})})]})]})}function X({value:e,onChange:n}){let i=r();return(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:C.map(r=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e===r.id?``:r.id),className:t(`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[12.5px] font-medium transition border`,e===r.id?t(r.tone,`border-transparent ring-2 ring-accent/40`):`border-border text-muted`),children:[r.icon({size:12}),` `,i(r.label)]},r.id))})}function Z({value:e,onChange:n}){let i=r(),{cadence:a,anchor:o,time:s}=k(e),c=(e,t,r)=>n(j(e,t,r));return(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:T.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>c(e.id,e.id===`weekly`?o||`mon`:e.id===`monthly`?o||`1`:``,s),className:t(`rounded-full px-2.5 py-1 text-[12.5px] font-medium border transition`,a===e.id?`bg-accent text-accent-fg border-transparent`:`border-border text-muted`),children:i(e.label)},e.id))}),a&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-[13.5px]`,children:[a===`weekly`&&(0,H.jsx)(`select`,{value:o||`mon`,onChange:e=>c(a,e.target.value,s),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`,children:S.map(e=>(0,H.jsx)(`option`,{value:e,children:m(e)},e))}),a===`monthly`&&(0,H.jsx)(`select`,{value:o||`1`,onChange:e=>c(a,e.target.value,s),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`,children:Array.from({length:28},(e,t)=>String(t+1)).map(e=>(0,H.jsx)(`option`,{value:e,children:y(Number(e))},e))}),(0,H.jsx)(`span`,{className:`text-muted`,children:i(`at`)}),(0,H.jsx)(`input`,{type:`time`,value:s,onChange:e=>c(a,o,e.target.value||`09:00`),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`})]})]})}function Q({goal:n,onClose:a,onAdvance:o,onChanged:s}){let{toast:l,send:d,openThread:f,state:m}=c(),[g,y]=(0,V.useState)(``),[b,x]=(0,V.useState)(!1),S=m.profile?.name??`nanoMuse`,C=r(),w=async e=>{if(n)try{await u.patchGoal(n.id,e),s()}catch(e){l(e.message)}},T=async()=>{if(n&&g.trim())try{await u.addStep(n.id,g.trim()),y(``),s()}catch(e){l(e.message)}},k=async()=>{if(n)try{await u.checkInGoal(n.id),l(C(`{name} will check in with you in the main chat`,{name:S})),f(`main`),a()}catch(e){l(e.message)}},j=async()=>{if(n&&window.confirm(C(`Delete “{title}”?`,{title:n.title})))try{await u.deleteGoal(n.id),s(),a()}catch(e){l(e.message)}},N=n?E(n.due,n.overdue):``;return(0,H.jsx)(D,{open:!!n,onClose:a,title:n?.title,footer:n&&(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[n.status===`active`?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void w({status:`paused`}),className:`flex-1 rounded-2xl border border-border py-2.5 font-medium flex items-center justify-center gap-1.5`,children:[(0,H.jsx)(z,{size:16}),` `,C(`Pause`)]}):n.status===`paused`?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void w({status:`active`}),className:`flex-1 rounded-2xl border border-border py-2.5 font-medium flex items-center justify-center gap-1.5`,children:[(0,H.jsx)(p,{size:16}),` `,C(`Resume`)]}):null,n.status===`active`&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>o(n),className:`flex-1 rounded-2xl bg-accent text-accent-fg py-2.5 font-medium flex items-center justify-center gap-1.5`,children:[(0,H.jsx)(p,{size:16}),` `,C(`Work on it now`)]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void j(),"aria-label":C(`Delete goal`),className:`rounded-2xl border border-border px-3 text-muted hover:text-rose-500`,children:(0,H.jsx)(h,{size:18})})]}),children:n&&(0,H.jsxs)(`div`,{className:`space-y-4`,children:[n.proposal&&(0,H.jsx)(Y,{goal:n,onChanged:s,onOpen:()=>void 0}),n.description&&(0,H.jsx)(`p`,{className:`text-[14px] text-muted leading-snug`,children:n.description}),(0,H.jsx)(`div`,{className:`rounded-2xl bg-surface-2/60 px-3.5 py-3`,children:b?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:C(`Area of life`)}),(0,H.jsx)(X,{value:n.category,onChange:e=>void w({category:e})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:C(`Target date`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`date`,value:n.due,onChange:e=>void w({due:e.target.value}),className:`rounded-xl bg-surface px-2.5 py-1.5 text-[13.5px] outline-none`}),n.due&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>void w({due:``}),className:`text-[12.5px] text-muted`,children:C(`Clear`)})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:C(`Reminders from {name}`,{name:S})}),(0,H.jsx)(Z,{value:n.check_in,onChange:e=>void w({check_in:e})})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>x(!1),className:`text-[12.5px] text-accent font-medium`,children:C(`Done`)})]}):(0,H.jsxs)(`button`,{type:`button`,onClick:()=>x(!0),className:`w-full text-left`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[12.5px]`,children:[n.category?(0,H.jsx)(q,{id:n.category,size:`md`}):(0,H.jsx)(`span`,{className:`rounded-full border border-dashed border-border px-2.5 py-1 text-muted`,children:C(`No category`)}),(0,H.jsxs)(`span`,{className:t(`inline-flex items-center gap-1 rounded-full px-2.5 py-1`,n.overdue?`bg-rose-500/12 text-rose-600 dark:text-rose-300 font-medium`:`bg-surface text-muted`),children:[(0,H.jsx)(A,{size:13}),` `,N||C(`No target date`)]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface px-2.5 py-1 text-muted`,children:[(0,H.jsx)(O,{size:13}),` `,n.check_in?v(n.check_in):C(`No reminders`)]})]}),n.next_check_in&&n.status===`active`&&(0,H.jsxs)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:[C(`Next check-in {when}`,{when:e(n.next_check_in)}),` · `,i(n.next_check_in)]}),(0,H.jsx)(`div`,{className:`mt-1.5 text-[12px] text-accent font-medium`,children:C(`Edit`)})]})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-2`,children:[C(`Plan`),` · `,n.progress.done,`/`,n.progress.total]}),(0,H.jsx)(`ul`,{className:`space-y-1`,children:n.steps.map(e=>{let n=U[e.status];return(0,H.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl px-2 py-1.5 hover:bg-surface-2/60`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":C(`Mark step {n} {status}`,{n:e.idx,status:C(W[e.status])}),onClick:()=>void w({step_index:e.idx,step_status:W[e.status]}),className:`mt-0.5 text-muted`,children:(0,H.jsx)(n,{size:20})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:t(`text-[14.5px] leading-snug`,(e.status===`done`||e.status===`skipped`)&&`line-through text-muted`),children:[e.idx,`. `,e.title]}),e.note&&(0,H.jsx)(`div`,{className:`text-[12.5px] text-muted mt-0.5 whitespace-pre-wrap`,children:e.note})]})]},e.idx)})}),(0,H.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,H.jsx)(`input`,{value:g,onChange:e=>y(e.target.value),onKeyDown:e=>e.key===`Enter`&&void T(),placeholder:C(`Add a step`),className:`flex-1 rounded-2xl bg-surface-2 px-3.5 py-2 text-[14px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void T(),className:`rounded-2xl bg-surface-2 px-3 text-accent`,"aria-label":C(`Add step`),children:(0,H.jsx)(_,{size:18})})]})]}),n.notes&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:C(`Notes from {name}`,{name:S})}),(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap break-words text-[13px] leading-snug text-muted font-sans`,children:n.notes})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>{d(`main`,C(`About my goal “{title}” ({id}): what's the status, and what should we do next?`,{title:n.title,id:n.id})).catch(e=>l(e.message||C(`Could not send`))),f(`main`),a()},className:`text-[13.5px] text-accent font-medium`,children:C(`Discuss this goal in chat →`)}),n.status===`active`&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void k(),className:`text-[13.5px] text-accent font-medium inline-flex items-center gap-1`,children:[(0,H.jsx)(M,{size:14}),` `,C(`Check in with me now`)]})]})]})})}function $({open:e,onClose:t,onCreated:n}){let{toast:i,send:a,openThread:o,state:s}=c(),[l,d]=(0,V.useState)(``),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)(``),[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(``),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(!1),T=s.profile?.name??`nanoMuse`,E=r(),O=()=>{d(``),p(``),h(``),v(``),b(``),S(``)},k=async()=>{if(l.trim()){w(!0);try{await u.createGoal({title:l.trim(),description:f.trim(),steps:m.split(`
+import{A as e,E as t,J as n,K as r,N as i,Q as a,Y as o,b as s,f as c,r as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{t as d}from"./StarNudge-DjXecvWj.js";import{H as f,Q as p,S as m,V as h,W as g,Z as _,_ as v,b as y,f as b,g as x,h as S,m as C,ot as w,p as T,v as E,w as D,wt as O,x as k,xt as A,y as j}from"./index-CIdGZ5PB.js";var M=n(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]),N=n(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),P=n(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),F=n(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),I=n(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),L=n(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),R=n(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),z=n(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),B=n(`square-check`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),V=a(o(),1),H=s(),U={pending:e=>(0,H.jsx)(I,{...e}),in_progress:e=>(0,H.jsx)(P,{...e,className:t(e.className,`text-accent`)}),done:e=>(0,H.jsx)(N,{...e,className:t(e.className,`text-emerald-500`)}),blocked:e=>(0,H.jsx)(R,{...e,className:t(e.className,`text-rose-500`)}),skipped:e=>(0,H.jsx)(F,{...e,className:t(e.className,`text-muted`)})},W={pending:`done`,in_progress:`done`,done:`pending`,blocked:`pending`,skipped:`pending`};function G(){let{state:e,refreshGoals:t,send:n,openThread:i,toast:a}=c(),[o,s]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(null),[g,v]=(0,V.useState)(!1),y=(0,V.useRef)(null),x=e.profile?.name??`nanoMuse`,S=r();(0,V.useEffect)(()=>{t()},[t]);let T=e.goals.filter(e=>e.proposal&&e.status!==`cancelled`),E=[...e.goals.filter(e=>e.status===`active`),...e.goals.filter(e=>e.status===`paused`)],O=e.goals.filter(e=>e.status===`done`||e.status===`cancelled`),k=e.goals.find(e=>e.id===o)??null,A=async e=>{try{await u.advanceGoal(e.id),a(S(`{name} is working on “{title}” in the main chat`,{name:x,title:e.title})),i(`main`)}catch(e){a(e.message)}},[j,M]=(0,V.useState)(!1),N=async e=>{try{let n=e.status!==`done`;await u.patchGoal(e.id,{status:n?`done`:`active`}),n&&M(!0),t()}catch(e){a(e.message)}},P=e=>{h(null),n(`main`,S(`I'd like to create a {category} goal. Ask me a few short questions, one at a time (what exactly I want, why and by when, how often to check in), then create it with concrete steps using the goals tool.`,{category:S(e.label)})).catch(e=>a(e.message||S(`Could not send`))),i(`main`)};return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsx)(b,{title:S(`Goals`),children:(0,H.jsx)(l,{small:!0,onClick:()=>p(!0),label:S(`New goal`),children:(0,H.jsx)(_,{size:22})})}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-6`,children:[T.length>0&&(0,H.jsxs)(`section`,{className:`px-4 pb-2`,children:[(0,H.jsx)(`div`,{className:`px-1 mb-2 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:S(`{name} suggests`,{name:x})}),(0,H.jsx)(`div`,{className:`space-y-2.5`,children:T.map(e=>(0,H.jsx)(Y,{goal:e,onChanged:t,onOpen:()=>s(e.id)},e.id))})]}),(0,H.jsx)(d,{moment:`goal_done`,due:j,className:`mx-4 mb-3`}),(0,H.jsx)(K,{label:S(`Tracking`),dot:!0,onAdd:()=>y.current?.scrollIntoView({behavior:`smooth`,block:`start`})}),E.length===0?(0,H.jsx)(`p`,{className:`px-5 pb-3 text-[13px] text-muted`,children:S(`Nothing tracked yet`)}):E.map(e=>(0,H.jsx)(J,{goal:e,onOpen:()=>s(e.id),onToggle:()=>void N(e)},e.id)),O.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`h-1.5`}),(0,H.jsx)(K,{label:S(`Finished`)}),(g?O:O.slice(0,2)).map(e=>(0,H.jsx)(J,{goal:e,onOpen:()=>s(e.id),onToggle:()=>void N(e)},e.id)),!g&&O.length>2&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>v(!0),className:`px-5 py-2 text-[13.5px] font-medium text-accent`,children:S(`Show {n} more`,{n:O.length-2})})]}),(0,H.jsxs)(`div`,{ref:y,className:`mt-2.5 border-t border-border/70 px-5 pt-3.5 pb-1.5`,children:[(0,H.jsx)(`h3`,{className:`text-[17px] font-semibold`,children:S(`Create a goal`)}),(0,H.jsx)(`p`,{className:`mt-1 text-[13px] leading-[18px] text-muted`,children:S(`Pick a category and tell me the goal you have in mind. I'll shape a plan with you and keep improving it as you go.`)})]}),C.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`flex h-[50px] w-full items-center gap-3.5 pl-5 pr-2 text-left active:bg-surface-2/70`,children:[(0,H.jsx)(`span`,{className:`text-fg`,children:e.icon({size:22})}),(0,H.jsx)(`span`,{className:`flex-1 text-[15px] font-medium`,children:S(e.label)}),(0,H.jsx)(`span`,{className:`flex h-10 w-10 items-center justify-center text-muted`,children:(0,H.jsx)(_,{size:22})})]},e.id))]}),(0,H.jsx)(Q,{goal:k,onClose:()=>s(null),onAdvance:A,onChanged:t}),(0,H.jsx)($,{open:f,onClose:()=>p(!1),onCreated:()=>{p(!1),t()}}),(0,H.jsx)(D,{open:m!==null,onClose:()=>h(null),children:m&&(0,H.jsxs)(`div`,{className:`px-1 pb-2`,children:[(0,H.jsx)(`h3`,{className:`text-[20px] font-bold`,children:S(`Create a {category} goal`,{category:S(m.label)})}),(0,H.jsx)(`p`,{className:`mt-3.5 text-[15px] leading-[22px]`,children:S(`First, we'll shape the goal together in the chat. I'll ask a few questions so I understand exactly what you're after.`)}),(0,H.jsx)(`p`,{className:`mt-3.5 text-[15px] leading-[22px]`,children:S(`Once it's set, I'll track your progress here.`)}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>P(m),className:`mt-6 flex h-[50px] w-full items-center justify-center gap-2 rounded-full bg-accent text-[16px] font-semibold text-accent-fg`,children:[(0,H.jsx)(w,{size:18}),` `,S(`Start`)]})]})})]})}function K({label:e,dot:n=!1,onAdd:r}){return(0,H.jsxs)(`div`,{className:`flex items-center pl-5 pr-2 pt-1`,children:[n&&(0,H.jsx)(`span`,{className:`mr-2.5 h-2 w-2 rounded-full bg-emerald-500`}),(0,H.jsx)(`span`,{className:t(`flex-1 text-[15px] font-semibold`,n&&`text-emerald-600 dark:text-emerald-400`),children:e}),r?(0,H.jsx)(`button`,{type:`button`,onClick:r,"aria-label":e,className:`flex h-10 w-10 items-center justify-center text-muted`,children:(0,H.jsx)(_,{size:22})}):(0,H.jsx)(`span`,{className:`h-10`})]})}function q({id:e,size:n=`sm`}){let i=r(),a=x(e);return a?(0,H.jsxs)(`span`,{className:t(`inline-flex items-center gap-1 rounded-full font-medium`,a.tone,n===`sm`?`px-2 py-0.5 text-[11.5px]`:`px-2.5 py-1 text-[12.5px]`),children:[a.icon({size:n===`sm`?11:13}),` `,i(a.label)]}):null}function J({goal:n,onOpen:i,onToggle:a}){let o=r(),s=n.status===`done`,c=n.progress.total?Math.round(n.progress.done/n.progress.total*100):0,l=E(n.due,n.overdue),u=n.next_step?o(`Next: {step}`,{step:n.next_step}):n.description||``,d=n.status===`paused`?o(`Paused`):n.status===`cancelled`?o(`Cancelled`):s?o(`Done`):n.check_in?v(n.check_in):o(`Updated {when}`,{when:e(n.updated_at)});return(0,H.jsxs)(`div`,{className:`flex items-start pl-[18px] pr-1 pt-2 pb-2.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:a,"aria-label":o(s?`Mark as not done`:`Mark as done`),className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center text-muted`,children:s?(0,H.jsx)(B,{size:22}):(0,H.jsx)(f,{size:22})}),(0,H.jsxs)(`button`,{type:`button`,onClick:i,className:`ml-2.5 min-w-0 flex-1 pt-[3px] text-left`,children:[(0,H.jsx)(`span`,{className:t(`line-clamp-2 block text-[15px] font-semibold leading-snug`,s&&`text-muted`),children:n.title}),u&&(0,H.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-[13px] leading-[18px] text-muted`,children:u}),(0,H.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-2 text-[12px] text-muted/80`,children:[(0,H.jsxs)(`span`,{className:`truncate`,children:[d,l&&n.status===`active`?` · ${l}`:``]}),c>0&&!s&&(0,H.jsxs)(`span`,{className:`shrink-0 font-medium text-emerald-600 dark:text-emerald-400`,children:[c,`%`]})]})]}),(0,H.jsx)(`button`,{type:`button`,onClick:i,"aria-label":o(`More`),className:`flex h-10 w-10 shrink-0 items-center justify-center text-muted`,children:(0,H.jsx)(L,{size:20})})]})}function Y({goal:e,onChanged:t,onOpen:n}){let{toast:i,state:a}=c(),[o,s]=(0,V.useState)(!1),l=a.profile?.name??`nanoMuse`,d=r(),f=e.proposal;if(!f)return null;let p=async n=>{s(!0);try{n?await u.acceptProposal(e.id):await u.dismissProposal(e.id),i(d(n?`Plan updated`:`Kept your plan`)),t()}catch(e){i(e.message)}finally{s(!1)}},m=e.steps.filter(e=>e.status===`done`||e.status===`skipped`).length;return(0,H.jsxs)(`div`,{className:`rounded-3xl border border-accent/30 bg-accent/5 px-4 py-3.5`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:n,className:`w-full text-left`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] font-semibold uppercase tracking-wide text-accent`,children:[(0,H.jsx)(g,{size:13}),` `,d(`Adjust the plan for “{title}”?`,{title:e.title})]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[14px] leading-snug`,children:f.reason}),(0,H.jsxs)(`div`,{className:`mt-2 text-[12px] text-muted`,children:[m>0&&(0,H.jsxs)(`span`,{children:[m===1?d(`Keeps the 1 step already done.`):d(`Keeps the {n} steps already done.`,{n:m}),` `]}),d(`New remaining steps:`)]}),(0,H.jsx)(`ol`,{className:`mt-1 space-y-0.5 text-[13.5px] list-decimal pl-5`,children:f.steps.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))})]}),(0,H.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>void p(!1),className:`flex-1 rounded-2xl border border-border py-2 text-[13.5px] font-medium disabled:opacity-50`,children:d(`Keep my plan`)}),(0,H.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>void p(!0),className:`flex-1 rounded-2xl bg-accent text-accent-fg py-2 text-[13.5px] font-medium disabled:opacity-50`,children:d(`Use {name}'s plan`,{name:l})})]})]})}function X({value:e,onChange:n}){let i=r();return(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:C.map(r=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e===r.id?``:r.id),className:t(`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[12.5px] font-medium transition border`,e===r.id?t(r.tone,`border-transparent ring-2 ring-accent/40`):`border-border text-muted`),children:[r.icon({size:12}),` `,i(r.label)]},r.id))})}function Z({value:e,onChange:n}){let i=r(),{cadence:a,anchor:o,time:s}=k(e),c=(e,t,r)=>n(j(e,t,r));return(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:T.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>c(e.id,e.id===`weekly`?o||`mon`:e.id===`monthly`?o||`1`:``,s),className:t(`rounded-full px-2.5 py-1 text-[12.5px] font-medium border transition`,a===e.id?`bg-accent text-accent-fg border-transparent`:`border-border text-muted`),children:i(e.label)},e.id))}),a&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-[13.5px]`,children:[a===`weekly`&&(0,H.jsx)(`select`,{value:o||`mon`,onChange:e=>c(a,e.target.value,s),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`,children:S.map(e=>(0,H.jsx)(`option`,{value:e,children:m(e)},e))}),a===`monthly`&&(0,H.jsx)(`select`,{value:o||`1`,onChange:e=>c(a,e.target.value,s),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`,children:Array.from({length:28},(e,t)=>String(t+1)).map(e=>(0,H.jsx)(`option`,{value:e,children:y(Number(e))},e))}),(0,H.jsx)(`span`,{className:`text-muted`,children:i(`at`)}),(0,H.jsx)(`input`,{type:`time`,value:s,onChange:e=>c(a,o,e.target.value||`09:00`),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`})]})]})}function Q({goal:n,onClose:a,onAdvance:o,onChanged:s}){let{toast:l,send:d,openThread:f,state:m}=c(),[g,y]=(0,V.useState)(``),[b,x]=(0,V.useState)(!1),S=m.profile?.name??`nanoMuse`,C=r(),w=async e=>{if(n)try{await u.patchGoal(n.id,e),s()}catch(e){l(e.message)}},T=async()=>{if(n&&g.trim())try{await u.addStep(n.id,g.trim()),y(``),s()}catch(e){l(e.message)}},k=async()=>{if(n)try{await u.checkInGoal(n.id),l(C(`{name} will check in with you in the main chat`,{name:S})),f(`main`),a()}catch(e){l(e.message)}},j=async()=>{if(n&&window.confirm(C(`Delete “{title}”?`,{title:n.title})))try{await u.deleteGoal(n.id),s(),a()}catch(e){l(e.message)}},N=n?E(n.due,n.overdue):``;return(0,H.jsx)(D,{open:!!n,onClose:a,title:n?.title,footer:n&&(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[n.status===`active`?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void w({status:`paused`}),className:`flex-1 rounded-2xl border border-border py-2.5 font-medium flex items-center justify-center gap-1.5`,children:[(0,H.jsx)(z,{size:16}),` `,C(`Pause`)]}):n.status===`paused`?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void w({status:`active`}),className:`flex-1 rounded-2xl border border-border py-2.5 font-medium flex items-center justify-center gap-1.5`,children:[(0,H.jsx)(p,{size:16}),` `,C(`Resume`)]}):null,n.status===`active`&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>o(n),className:`flex-1 rounded-2xl bg-accent text-accent-fg py-2.5 font-medium flex items-center justify-center gap-1.5`,children:[(0,H.jsx)(p,{size:16}),` `,C(`Work on it now`)]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void j(),"aria-label":C(`Delete goal`),className:`rounded-2xl border border-border px-3 text-muted hover:text-rose-500`,children:(0,H.jsx)(h,{size:18})})]}),children:n&&(0,H.jsxs)(`div`,{className:`space-y-4`,children:[n.proposal&&(0,H.jsx)(Y,{goal:n,onChanged:s,onOpen:()=>void 0}),n.description&&(0,H.jsx)(`p`,{className:`text-[14px] text-muted leading-snug`,children:n.description}),(0,H.jsx)(`div`,{className:`rounded-2xl bg-surface-2/60 px-3.5 py-3`,children:b?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:C(`Area of life`)}),(0,H.jsx)(X,{value:n.category,onChange:e=>void w({category:e})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:C(`Target date`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`date`,value:n.due,onChange:e=>void w({due:e.target.value}),className:`rounded-xl bg-surface px-2.5 py-1.5 text-[13.5px] outline-none`}),n.due&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>void w({due:``}),className:`text-[12.5px] text-muted`,children:C(`Clear`)})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:C(`Reminders from {name}`,{name:S})}),(0,H.jsx)(Z,{value:n.check_in,onChange:e=>void w({check_in:e})})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>x(!1),className:`text-[12.5px] text-accent font-medium`,children:C(`Done`)})]}):(0,H.jsxs)(`button`,{type:`button`,onClick:()=>x(!0),className:`w-full text-left`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[12.5px]`,children:[n.category?(0,H.jsx)(q,{id:n.category,size:`md`}):(0,H.jsx)(`span`,{className:`rounded-full border border-dashed border-border px-2.5 py-1 text-muted`,children:C(`No category`)}),(0,H.jsxs)(`span`,{className:t(`inline-flex items-center gap-1 rounded-full px-2.5 py-1`,n.overdue?`bg-rose-500/12 text-rose-600 dark:text-rose-300 font-medium`:`bg-surface text-muted`),children:[(0,H.jsx)(A,{size:13}),` `,N||C(`No target date`)]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface px-2.5 py-1 text-muted`,children:[(0,H.jsx)(O,{size:13}),` `,n.check_in?v(n.check_in):C(`No reminders`)]})]}),n.next_check_in&&n.status===`active`&&(0,H.jsxs)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:[C(`Next check-in {when}`,{when:e(n.next_check_in)}),` · `,i(n.next_check_in)]}),(0,H.jsx)(`div`,{className:`mt-1.5 text-[12px] text-accent font-medium`,children:C(`Edit`)})]})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-2`,children:[C(`Plan`),` · `,n.progress.done,`/`,n.progress.total]}),(0,H.jsx)(`ul`,{className:`space-y-1`,children:n.steps.map(e=>{let n=U[e.status];return(0,H.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl px-2 py-1.5 hover:bg-surface-2/60`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":C(`Mark step {n} {status}`,{n:e.idx,status:C(W[e.status])}),onClick:()=>void w({step_index:e.idx,step_status:W[e.status]}),className:`mt-0.5 text-muted`,children:(0,H.jsx)(n,{size:20})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:t(`text-[14.5px] leading-snug`,(e.status===`done`||e.status===`skipped`)&&`line-through text-muted`),children:[e.idx,`. `,e.title]}),e.note&&(0,H.jsx)(`div`,{className:`text-[12.5px] text-muted mt-0.5 whitespace-pre-wrap`,children:e.note})]})]},e.idx)})}),(0,H.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,H.jsx)(`input`,{value:g,onChange:e=>y(e.target.value),onKeyDown:e=>e.key===`Enter`&&void T(),placeholder:C(`Add a step`),className:`flex-1 rounded-2xl bg-surface-2 px-3.5 py-2 text-[14px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void T(),className:`rounded-2xl bg-surface-2 px-3 text-accent`,"aria-label":C(`Add step`),children:(0,H.jsx)(_,{size:18})})]})]}),n.notes&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:C(`Notes from {name}`,{name:S})}),(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap break-words text-[13px] leading-snug text-muted font-sans`,children:n.notes})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>{d(`main`,C(`About my goal “{title}” ({id}): what's the status, and what should we do next?`,{title:n.title,id:n.id})).catch(e=>l(e.message||C(`Could not send`))),f(`main`),a()},className:`text-[13.5px] text-accent font-medium`,children:C(`Discuss this goal in chat →`)}),n.status===`active`&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void k(),className:`text-[13.5px] text-accent font-medium inline-flex items-center gap-1`,children:[(0,H.jsx)(M,{size:14}),` `,C(`Check in with me now`)]})]})]})})}function $({open:e,onClose:t,onCreated:n}){let{toast:i,send:a,openThread:o,state:s}=c(),[l,d]=(0,V.useState)(``),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)(``),[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(``),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(!1),T=s.profile?.name??`nanoMuse`,E=r(),O=()=>{d(``),p(``),h(``),v(``),b(``),S(``)},k=async()=>{if(l.trim()){w(!0);try{await u.createGoal({title:l.trim(),description:f.trim(),steps:m.split(`
`).map(e=>e.trim()).filter(Boolean),category:_,due:y,check_in:x}),O(),n()}catch(e){i(e.message)}finally{w(!1)}}};return(0,H.jsx)(D,{open:e,onClose:t,title:E(`New goal`),footer:(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{if(!l.trim())return;let e=[_?`category: ${_}`:``,y?`target date: ${y}`:``,x?`check_in "${x}"`:``].filter(Boolean);a(`main`,E(`Create a goal for me: "{title}"{description}{extras}. Break it into concrete steps with the goals tool, then tell me the plan.`,{title:l.trim(),description:f.trim()?` (${f.trim()})`:``,extras:e.length?` (${e.join(`, `)})`:``})).catch(e=>i(e.message||E(`Could not send`))),O(),t(),o(`main`)},disabled:!l.trim(),className:`flex-1 rounded-2xl border border-border py-2.5 font-medium disabled:opacity-50 flex items-center justify-center gap-1.5`,children:[(0,H.jsx)(g,{size:16}),` `,E(`Let {name} plan it`,{name:T})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void k(),disabled:!l.trim()||C,className:`flex-1 rounded-2xl bg-accent text-accent-fg py-2.5 font-medium disabled:opacity-50`,children:E(`Create`)})]}),children:(0,H.jsxs)(`div`,{className:`space-y-3.5`,children:[(0,H.jsx)(`input`,{value:l,onChange:e=>d(e.target.value),placeholder:E(`What do you want to achieve?`),className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[15px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:E(`Area of life`)}),(0,H.jsx)(X,{value:_,onChange:v})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted flex-1`,children:E(`Target date`)}),(0,H.jsx)(`input`,{type:`date`,value:y,onChange:e=>b(e.target.value),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 text-[13.5px] outline-none`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted mb-1.5`,children:E(`Reminders from {name}`,{name:T})}),(0,H.jsx)(Z,{value:x,onChange:S})]}),(0,H.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),placeholder:E(`Why it matters, constraints (optional)`),rows:2,className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14px] outline-none focus:ring-2 focus:ring-accent/40 resize-none`}),(0,H.jsx)(`textarea`,{value:m,onChange:e=>h(e.target.value),placeholder:E(`Steps, one per line (optional, or let {name} plan them)`,{name:T}),rows:3,className:`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14px] outline-none focus:ring-2 focus:ring-accent/40 resize-none`})]})})}export{G as GoalsScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/IdeasScreen-BVCFCRSV.js b/nanomuse/server/static/assets/IdeasScreen-CGfvq5H-.js
similarity index 99%
rename from nanomuse/server/static/assets/IdeasScreen-BVCFCRSV.js
rename to nanomuse/server/static/assets/IdeasScreen-CGfvq5H-.js
index 76de16b8a..8f582f3a2 100644
--- a/nanomuse/server/static/assets/IdeasScreen-BVCFCRSV.js
+++ b/nanomuse/server/static/assets/IdeasScreen-CGfvq5H-.js
@@ -1 +1 @@
-import{A as e,J as t,K as n,Q as r,W as i,Y as a,b as o,f as s,q as c,x as l}from"./MuseHeader-Pw-NI98v.js";import{t as u}from"./refresh-cw-BKgIzslL.js";import{f as d,m as f,ot as p,w as m,yt as h}from"./index-BjYzdKkG.js";var g=t(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),_=r(a(),1),v={sections:[{id:`travel`,title:`Travel`,ideas:[{id:`train-watch`,emoji:`🚄`,title:`Tell me where you're going and when; I'll watch for seats and lower fares.`,body:`I set up the lookup tools in my sandbox, check trains, classes and availability as often as you like, and tell you the moment something opens up. Booking and paying stay in your hands.`,kind:`GOAL`,category:`other`,prompt:`I want to watch a train route: ask me for the origin, destination, date and acceptable departure window, then set up a goal that checks availability regularly.`},{id:`trip-plan`,emoji:`🗺️`,title:`Name a city and a number of days; I'll plan an itinerary you can follow as is.`,body:`Weather, opening hours and travel time between stops go into a day-by-day plan saved to your Library. Change one sentence and I'll rearrange the rest.`,kind:`CHAT`,prompt:`Help me plan a trip. Ask me where, how many days, with whom, a rough budget and the style I like, then give me a day-by-day itinerary as a file.`},{id:`commute-brief`,emoji:`🚦`,title:`Before you leave each morning, I'll tell you the traffic, the weather and the first thing on your plate.`,body:`A morning routine: I check the weather where you are, the traffic on your commute, glance at your calendar and boil the morning down to three sentences.`,kind:`ROUTINE`,time:`07:30`,prompt:`Morning brief: check today's weather and commute traffic, read my calendar for today, and tell me in at most five sentences the three things that matter most and what to bring.`},{id:`parcel-track`,emoji:`📦`,title:`Send me a tracking number; I'll tell you where the parcel is and when it lands.`,body:`I follow the shipment through the carrier's tracking, tell you about every new scan, and remind you to keep the phone nearby on delivery day.`,kind:`CHAT`,prompt:`Help me track a parcel. Ask me for the tracking number and carrier, check the current status once, then set a routine that checks every morning and reminds me the day before delivery.`}]},{id:`work`,title:`Work`,ideas:[{id:`meeting-prep`,emoji:`📝`,title:`Ten minutes before a meeting, I'll have the background and the questions ready.`,body:`I read the meeting's title and attendees from your calendar, look through what we've discussed and what you've put in the Library, and hand you one page: purpose, talking points, three questions worth asking.`,kind:`ROUTINE`,time:`08:50`,prompt:`Look at the meetings on my calendar today and prepare a one-page brief for each: the purpose, the points I should make, and three questions worth asking.`},{id:`weekly-review`,emoji:`📊`,title:`Every Friday afternoon, I'll review what you did this week and what next week needs.`,body:`From our conversations, your calendar and the notes I keep, I list what got done, what didn't, and three priorities for next week, as a draft you can send.`,kind:`ROUTINE`,time:`17:00`,prompt:`Write my weekly review: from this week's conversations, my calendar and what you remember, list what was completed, what is still open, and three priorities for next week. Save it as a Markdown file.`},{id:`inbox-triage`,emoji:`📬`,title:`Dump a pile of messages or emails on me; I'll sort them and draft the replies.`,body:`Paste text or screenshots. I sort them into 'reply today', 'this week' and 'just so you know', and draft each reply so you only need to edit and send.`,kind:`CHAT`,prompt:`I'm handing you a batch of messages to triage: sort them into 'reply today / this week / just so you know' and draft a reply for each one that needs it. Ask me to paste the content first.`},{id:`doc-digest`,emoji:`📄`,title:`Long documents, PDFs, web pages: I'll read them and give you the three-minute version.`,body:`Drop the file in a shared folder or send me the link. You get the conclusions, the key numbers and the decisions you need to make; ask follow-ups any time.`,kind:`CHAT`,prompt:`I have something long for you to read and summarise: ask me for the file or link, then give me conclusions, key numbers and decisions I need to make, at most five bullets each.`}]},{id:`life`,title:`Everyday`,ideas:[{id:`price-watch`,emoji:`🏷️`,title:`Tell me what you want to buy; the moment it hits your price, you'll know.`,body:`I check the product page on a schedule, keep the price history, and notify you at your target. Ordering and paying are yours; I don't touch them.`,kind:`GOAL`,category:`finance`,prompt:`I want to watch the price of a product: ask me for the link or name, my target price and how often to check, then create a goal that alerts me when it drops.`},{id:`photo-sort`,emoji:`🖼️`,title:`Mount your photos and I'll sort screenshots and pictures by what's in them.`,body:`Once your gallery is mounted as a shared folder I look at each image (receipts, chat screenshots, landscapes, documents), file it into the right folder and note anything important.`,kind:`CHAT`,prompt:`Help me sort my photos: ask me to mount the gallery in Shared Folders first, then sort by content (receipts, screenshots, scenery, documents, other) and list what you did.`},{id:`meal-log`,emoji:`🥗`,title:`Photograph what you eat; I'll estimate the calories and keep the log.`,body:`A photo or a sentence is enough: I estimate nutrition and calories, log it in the day's memory, and give you a summary each evening with one small suggestion for tomorrow.`,kind:`CHAT`,prompt:`From now on, log my meals: whenever I send a photo or a description, estimate calories and nutrition and write it into today's memory. Tell me first how best to send them.`},{id:`subscriptions`,emoji:`🔁`,title:`Send me your bills; I'll list every subscription that charges you each month, and you decide which to stop.`,body:`Give me bill screenshots or statements. I list every recurring charge, its next date and the yearly total; you decide what to cancel and I walk you through each cancellation.`,kind:`CHAT`,prompt:`Audit my subscriptions: ask me for bill screenshots or statements, then list every recurring charge, its next billing date and the yearly total, and flag the ones I may not need.`}]},{id:`learn`,title:`Learning`,ideas:[{id:`daily-words`,emoji:`🔤`,title:`Five new words every morning, a quick quiz every night.`,body:`You pick the language and level; I pick words by theme with examples and a memory hook, quiz you in the evening, and bring back the ones you missed.`,kind:`ROUTINE`,time:`08:00`,prompt:`Daily vocabulary: pick five new words for me (ask which language, level and topics first), each with a definition, one example sentence and a memory hook, plus a review quiz on yesterday's words.`},{id:`study-plan`,emoji:`🎯`,title:`Something you want to learn? I'll break it into weekly chunks and keep you honest.`,body:`Tell me the goal and the hours you can spare; I lay out four to eight weeks, check progress weekly, and adjust the pace so you actually finish.`,kind:`GOAL`,category:`interests`,prompt:`I want to learn something new and stick with it: ask me what, my current level, hours per week and the timeframe, then create a goal with a weekly progress check.`},{id:`explain`,emoji:`💡`,title:`Send me a concept you don't get; I'll explain it with things you already know.`,body:`I ask what you already understand and start from there, then check with two quick questions and leave you a flashcard if you want one.`,kind:`CHAT`,prompt:`There's a concept I don't understand: ask me what it is and what related things I already know, explain it with analogies, then check with two short questions.`},{id:`reading-notes`,emoji:`📚`,title:`Finished a book? I'll turn it into notes you'll actually reread.`,body:`Tell me the highlights, or send the passages you marked. I write structured notes into your Library and remember what stayed with you.`,kind:`CHAT`,prompt:`Help me write notes on a book: ask me the title, the three things that struck me most and the quotes I want to keep, then save structured Markdown notes.`}]},{id:`family`,title:`Family & friends`,ideas:[{id:`birthdays`,emoji:`🎂`,title:`Birthdays and anniversaries: I remind you a week ahead, gift ideas included.`,body:`Give me names and dates and I keep them. A week before each one I remind you, with a few gift directions based on what you've told me about them.`,kind:`CHAT`,prompt:`Remember the birthdays and anniversaries of the people who matter to me: ask for the list and dates, store them in long-term memory, and set a routine that reminds me a week before each.`},{id:`keep-in-touch`,emoji:`💬`,title:`Lost touch with old friends? Once a week I'll suggest who to reach out to, and how to start.`,body:`Give me a list of people you want to stay close to. I rotate through them and write a natural opening line based on what you last talked about.`,kind:`ROUTINE`,time:`19:00`,prompt:`Weekly keep-in-touch: from my list of people I want to stay close to, pick the one I've gone longest without contacting, remind me, and write a natural opening line based on what I noted about our last conversation.`},{id:`family-calendar`,emoji:`📅`,title:`Tell me the family's plans and I'll put them on the calendar and catch clashes.`,body:`Kids' lessons, a parent's appointment, a weekend get-together: one sentence and it's in the calendar; if two things collide, I say so first.`,kind:`CHAT`,prompt:`Help me run the family calendar: I'll tell you plans as they come up; write them into the calendar, confirm each before creating it, and warn me about conflicts.`},{id:`gift-ideas`,emoji:`🎁`,title:`Describe the person and I'll give you gift ideas that aren't the obvious ones.`,body:`Budget, relationship, what they're into lately: three questions, then five directions with one line each on why it fits.`,kind:`CHAT`,prompt:`Help me think of a gift: ask who it's for, my budget, their interests and what's going on in their life, then give me five directions with one line of reasoning each.`}]},{id:`more`,title:`More ideas`,ideas:[{id:`id-renewal`,emoji:`🪪`,title:`Tell me when your documents expire; I'll book the renewal and prep the paperwork list.`,body:`Passport, licence, visa: I note the dates, remind you three months ahead, list the documents and the office, and look up appointment slots where I can.`,kind:`CHAT`,prompt:`Help me track document expiry: ask which documents I have and when they expire, store them in memory, and set a reminder three months ahead of each with the renewal checklist.`},{id:`personality-quiz`,emoji:`❓`,title:`Two small questions a day; after a week I'll tell you what I've noticed about you.`,body:`Light questions, quick answers. I keep them and, once a week, write a short observation about your preferences and rhythm so I understand you better.`,kind:`ROUTINE`,time:`21:00`,prompt:`Two questions a day: ask me two small questions about preferences, habits or how things are going (never repeat one), store the answers in memory; every Sunday add a short observation about my week.`},{id:`event-plan`,emoji:`🎉`,title:`Name the occasion; I'll plan the run of show and draft the invitation.`,body:`Birthday, team outing, family dinner: give me the headcount, budget and date, and you get a timeline, a shopping list and an invitation you can send as is.`,kind:`CHAT`,prompt:`Help me plan an event: ask me the occasion, date, headcount and budget, then give me a timeline, a to-do list and an invitation text I can send.`},{id:`phone-cleanup`,emoji:`🧹`,title:`Let me look through the sandbox and shared folders; I'll clear the junk and organise the rest.`,body:`I list the big files and duplicates, show you the list first and only act when you say so; anything worth keeping goes into the Library.`,kind:`CHAT`,prompt:`Help me tidy the workspace and shared folders: list large files, duplicates and files untouched for a long time, and give me the list. Do not delete anything before I confirm.`}]}]},y={sections:[{id:`travel`,title:`出行`,ideas:[{id:`train-watch`,emoji:`🚄`,title:`告诉我你要去哪、哪天走,我盯着 12306 的余票和低价票。`,body:`我会在沙盒里装好查询工具,按你说的频率查车次、席别和余票,有票或价格合适时马上通知你;订票和付款那一步留给你自己点。`,kind:`GOAL`,category:`other`,prompt:`我想盯一趟火车票:请先问我出发地、目的地、日期和可接受的车次时段,然后为我建一个定期检查余票的目标。`},{id:`trip-plan`,emoji:`🗺️`,title:`说一个城市和几天,我给你排一份能直接照着走的行程。`,body:`我会查天气、开放时间和两点之间的路程,把每天的顺序排顺,写成一份文件放进资源库;你改一句,我就重排。`,kind:`CHAT`,prompt:`帮我规划一次出行。先问我去哪、几天、和谁、预算大概多少、喜欢什么风格,再给我一份按天排好的行程文件。`},{id:`commute-brief`,emoji:`🚦`,title:`每天出门前,我告诉你今天的路况、天气和第一件事。`,body:`一条早间例程:查你所在城市的天气、通勤路线的路况,翻一下日历,把上午的安排浓缩成三句话推给你。`,kind:`ROUTINE`,time:`07:30`,prompt:`早间简报:查询今天的天气和通勤路况,读取我今天的日历安排,用不超过五句话告诉我今天最重要的三件事和出门要带的东西。`},{id:`parcel-track`,emoji:`📦`,title:`把快递单号发我,到哪了、什么时候到,我随时告诉你。`,body:`我会用快递查询接口跟踪包裹,有新的物流节点就更新你;派送当天提醒你留意电话。`,kind:`CHAT`,prompt:`帮我跟踪一个快递。先问我单号和快递公司,然后查一次当前进度,并设一个每天早上检查一次、到派送前一天提醒我的例程。`}]},{id:`work`,title:`工作`,ideas:[{id:`meeting-prep`,emoji:`📝`,title:`开会前十分钟,我把这场会的背景和该问的问题整理好。`,body:`读日历里的会议主题和参会人,翻我们聊过的相关内容和你放进资源库的资料,给你一页纸:目的、要点、三个值得问的问题。`,kind:`ROUTINE`,time:`08:50`,prompt:`查看我今天日历里接下来的会议,为每一场准备一页会前提纲:这场会的目的、需要我发言的要点、三个值得提出的问题。`},{id:`weekly-review`,emoji:`📊`,title:`每周五下午,我帮你回顾这一周做了什么,下周该抓什么。`,body:`从我们的对话、你的日历和我记下的备忘里,整理出本周完成的事、没做完的事和下周的三个重点,写成一份周报草稿。`,kind:`ROUTINE`,time:`17:00`,prompt:`写一份本周回顾:根据我们这周的对话、我的日历和你记住的事项,列出完成了什么、什么没做完、下周三个重点,保存为一份 Markdown 文件。`},{id:`inbox-triage`,emoji:`📬`,title:`把一堆消息或邮件丢给我,我分好轻重缓急,写好回复草稿。`,body:`粘贴文字或截图给我,我按“今天必须回、这周处理、只需知道”分类,把每条要回的先拟好一版,你改一改就能发。`,kind:`CHAT`,prompt:`我要把一批消息交给你整理:请按“今天必须回 / 这周处理 / 只需知道”分类,并为需要回复的每一条写好回复草稿。请先让我粘贴内容。`},{id:`doc-digest`,emoji:`📄`,title:`长文档、PDF、网页,我读完给你三分钟版本。`,body:`把文件放进共享文件夹或把链接发我,我提炼结论、关键数字和你需要做的决定,问题可以接着追问。`,kind:`CHAT`,prompt:`我有一份长内容需要你读并总结:请先让我提供文件或链接,然后给我结论、关键数字、需要我做的决定三部分,每部分不超过五条。`}]},{id:`life`,title:`生活`,ideas:[{id:`price-watch`,emoji:`🏷️`,title:`想买的东西告诉我,降到你说的价格我立刻告诉你。`,body:`我会定期去商品页看价格,记录走势;到价就通知你。下单和付款由你来点,我不会碰。`,kind:`GOAL`,category:`finance`,prompt:`我想盯一件商品的价格:请先问我商品链接或名称、目标价格和检查频率,然后建一个到价提醒我的目标。`},{id:`photo-sort`,emoji:`🖼️`,title:`把相册挂给我,我按内容给截图和照片分类整理。`,body:`在「共享文件夹」里挂载相册后,我会看图识别内容(票据、聊天截图、风景、证件),归到对应文件夹,重要的信息顺手记下来。`,kind:`CHAT`,prompt:`帮我整理照片:请先让我在共享文件夹里挂载相册目录,然后按内容(票据、截图、风景、证件、其他)分类整理,并把整理结果列给我。`},{id:`meal-log`,emoji:`🥗`,title:`拍下你吃的,我帮你估热量、记下每一餐。`,body:`发一张照片或一句话,我估算营养和热量,记进当天的日记;晚上给你一天的小结和明天的一个小建议。`,kind:`CHAT`,prompt:`从现在起帮我记录饮食:每次我发照片或描述,估算热量与营养并记入当天记忆;请先告诉我怎么发给你最方便。`},{id:`subscriptions`,emoji:`🔁`,title:`帮你把每月自动扣费的订阅列出来,看看哪些该停。`,body:`把账单截图或消费记录给我,我列出所有周期性扣费、下一次扣款日和一年花多少;你决定停哪个,退订的步骤我一步步陪你走。`,kind:`CHAT`,prompt:`帮我盘点订阅扣费:请先让我提供账单截图或记录,然后列出所有周期性扣费、下一次扣款日、年费合计,并标出可能不再需要的。`}]},{id:`learn`,title:`学习`,ideas:[{id:`daily-words`,emoji:`🔤`,title:`每天早上五个新词,晚上考你一遍。`,body:`你定语言和难度,我按主题挑词、给例句和记忆点,晚上出五道小题,错的第二天再来。`,kind:`ROUTINE`,time:`08:00`,prompt:`每日词汇:为我挑五个新词(先问我学什么语言、什么水平和感兴趣的主题),每个给释义、一个例句和一个记忆点,并附上昨天的复习题。`},{id:`study-plan`,emoji:`🎯`,title:`有个想学会的东西?我陪你拆成每周能做完的小块。`,body:`告诉我目标和每周能投入的时间,我排一份四到八周的计划,每周检查进度、调整难度,帮你坚持到最后。`,kind:`GOAL`,category:`interests`,prompt:`我想学一样新东西并坚持下去:请先问我想学什么、现在的水平、每周能投入多少时间和希望多久见效,然后帮我建一个每周检查进度的目标。`},{id:`explain`,emoji:`💡`,title:`看不懂的概念发给我,我用你熟悉的东西讲明白。`,body:`先问你已经懂什么,再从那里出发讲;讲完出两道题确认你真懂了,需要的话给你一张记忆卡。`,kind:`CHAT`,prompt:`我有一个不太懂的概念想让你讲明白:请先问我这个概念是什么、我已经了解哪些相关知识,然后用类比讲解,最后出两道小题检验。`},{id:`reading-notes`,emoji:`📚`,title:`读完一本书,我帮你整理成能重读的笔记。`,body:`你说重点和感受,或者把划线的句子发我,我整理成结构化笔记,存进资源库,并记住你的收获。`,kind:`CHAT`,prompt:`帮我整理一本书的读书笔记:请先问我书名、最触动我的三点和我想记住的引文,然后整理成结构化的 Markdown 笔记并保存。`}]},{id:`family`,title:`家庭与关系`,ideas:[{id:`birthdays`,emoji:`🎂`,title:`重要的人的生日和纪念日,我提前一周提醒,顺手想好礼物。`,body:`把名字和日期告诉我,我记住;到日子前一周提醒你,并根据你说过的 TA 的喜好给几个礼物方向。`,kind:`CHAT`,prompt:`帮我记住重要的人的生日和纪念日:请先问我名单和日期,记入长期记忆,并为每个日期设一个提前一周提醒我的例程。`},{id:`keep-in-touch`,emoji:`💬`,title:`老朋友太久没联系?我每周提醒你该找谁聊聊,帮你开个头。`,body:`你给我一份想保持联系的名单,我按间隔轮着提醒,并根据上次聊的内容帮你写一句自然的开场。`,kind:`ROUTINE`,time:`19:00`,prompt:`每周联系提醒:从我告诉你的“想保持联系的人”名单里,挑一位最近最久没联系的,提醒我,并根据我记录过的上次聊天内容写一句自然的开场白。`},{id:`family-calendar`,emoji:`📅`,title:`把全家的安排告诉我,我帮你排进日历、发现冲突。`,body:`孩子的课、家人的门诊、周末的聚会,说一句我就写进日历,时间撞了我先提醒你。`,kind:`CHAT`,prompt:`帮我管理家庭日程:我会陆续告诉你家人的安排,请写进日历,创建前先复述确认,发现时间冲突时提醒我。`},{id:`gift-ideas`,emoji:`🎁`,title:`说说 TA 是什么样的人,我给你几个不落俗套的礼物点子。`,body:`预算、关系、TA 最近在忙什么,三个问题之后我给你五个方向,每个附一句为什么合适。`,kind:`CHAT`,prompt:`帮我想礼物:请先问我送给谁、预算、TA 的兴趣和最近的生活状态,然后给我五个礼物方向,每个附一句理由。`}]},{id:`more`,title:`更多点子`,ideas:[{id:`id-renewal`,emoji:`🪪`,title:`告诉我证件到期时间,我提前预约续签,把材料清单准备好。`,body:`护照、驾照、签证,我记下到期日,提前三个月提醒,列出所需材料和办理地点,能预约的帮你查好时段。`,kind:`CHAT`,prompt:`帮我管理证件到期:请先问我有哪些证件和到期日期,记入长期记忆,并为每一个设置提前三个月的提醒,附上续办所需材料清单。`},{id:`personality-quiz`,emoji:`❓`,title:`每天两个小问题,一周后我告诉你我发现了什么样的你。`,body:`问题很轻,回答很快;我把答案记下来,每周整理成一段关于你偏好和节奏的观察,方便我更懂你。`,kind:`ROUTINE`,time:`21:00`,prompt:`每日两问:问我两个关于偏好、习惯或近况的小问题(不重复以前问过的),把回答记入记忆;每周日额外给我一段关于我这周状态的观察。`},{id:`event-plan`,emoji:`🎉`,title:`说个场合,我帮你安排流程、拟好邀请。`,body:`生日、团建、家宴,人数、预算和日期告诉我,我给你时间线、采购清单和一段可以直接发出去的邀请文字。`,kind:`CHAT`,prompt:`帮我策划一次活动:请先问我场合、日期、人数和预算,然后给我时间线、待办清单和一段可直接发送的邀请文字。`},{id:`phone-cleanup`,emoji:`🧹`,title:`让我看看沙盒和共享文件夹里有什么,清掉没用的、整理有用的。`,body:`我列出占空间的大文件和重复文件,先给你看清单,你点头我再动;重要的整理进资源库。`,kind:`CHAT`,prompt:`帮我整理工作区和共享文件夹:先列出大文件、重复文件和很久没动的文件,给我一份清单;在我确认之前不要删除任何东西。`}]}]};function b(e){return e.toLowerCase().startsWith(`zh`)?y:v}function x(e){return{id:e.id,emoji:e.emoji,title:e.title,detail:e.body,prompt:e.prompt,kind:e.kind.toLowerCase(),time:e.time,category:e.category}}var S=o(),C=[{id:`planning`,label:`Planning`,emoji:`🗓️`},{id:`goals`,label:`Goals`,emoji:`🎯`},{id:`research`,label:`Research`,emoji:`🔍`},{id:`money`,label:`Money`,emoji:`💰`},{id:`health`,label:`Health`,emoji:`🌿`},{id:`home`,label:`Home`,emoji:`🏠`},{id:`learning`,label:`Learning`,emoji:`📚`},{id:`people`,label:`People`,emoji:`👥`},{id:`files`,label:`Files & tools`,emoji:`📄`},{id:`fun`,label:`Just for you`,emoji:`🎈`}];function w(){let{state:t,send:r,openThread:a,toast:o}=s(),[v,y]=(0,_.useState)(null),[C,w]=(0,_.useState)(!1),E=t.profile?.name??`nanoMuse`,D=n(),O=i(),k=async(e=!1)=>{w(!0);try{let t=await l.ideas(e);y(t),t.error&&o(D(`Could not refresh ideas: {error}`,{error:t.error}))}catch(e){o(e.message)}finally{w(!1)}};(0,_.useEffect)(()=>{k(!1)},[]);let A=v?.source===`model`&&v.ideas.length>0,j=A?T(v.ideas):b(O).sections.map(e=>({id:e.id,title:e.title,ideas:e.ideas.map(x)})),[M,N]=(0,_.useState)(null),P=e=>{N(null),r(`main`,e.prompt).catch(e=>o(e.message||D(`Could not send`))),a(`main`)},F=async e=>{N(null);let t=e.time&&/^([01]\d|2[0-3]):[0-5]\d$/.test(e.time)?e.time:`09:00`;try{await l.createReminder({text:e.prompt,kind:`task`,repeat:`daily ${t}`}),o(D(`Routine set: every day at {time}. It is listed under Goals.`,{time:t}))}catch(e){o(e.message)}},I=e=>{N(null);let t=f.find(t=>t.id===e.category)??f[f.length-1],n=D(`I'd like to create a {category} goal. Ask me a few short questions, one at a time (what exactly I want, why and by when, how often to check in), then create it with concrete steps using the goals tool.`,{category:D(t.label)});r(`main`,`${n} ${e.prompt}`).catch(e=>o(e.message||D(`Could not send`))),a(`main`)},L=e=>e.kind===`routine`||e.kind===`goal`?e.kind:`chat`;return(0,S.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,S.jsx)(d,{title:D(`Ideas`),children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>void k(!0),disabled:C,"aria-label":D(`Refresh ideas`),className:`flex h-10 w-10 items-center justify-center rounded-full bg-surface text-fg shadow-[0_1px_4px_rgba(0,0,0,0.14)] disabled:opacity-60 dark:border dark:border-border dark:shadow-none`,children:C?(0,S.jsx)(c,{size:20,className:`animate-spin`}):(0,S.jsx)(u,{size:19})})}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-6`,children:[j.map(({id:e,title:t,ideas:n},r)=>(0,S.jsxs)(`section`,{children:[(r>0||!A)&&(0,S.jsx)(`h2`,{className:`px-5 pt-[22px] pb-1 text-[20px] font-bold`,children:A?D(t):t}),(0,S.jsx)(`ul`,{children:n.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>N({idea:e,emoji:e.emoji}),className:`flex w-full items-start gap-4 px-5 py-3.5 text-left active:bg-surface-2/70`,children:[(0,S.jsx)(`span`,{className:`flex w-10 shrink-0 justify-center text-[28px] leading-[34px]`,children:e.emoji}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,S.jsx)(`span`,{className:`block text-[16px] font-semibold leading-[22px]`,children:e.title}),e.detail&&(0,S.jsx)(`span`,{className:`line-clamp-4 block text-[13.5px] leading-[19px] text-muted`,children:e.detail})]})]}),(0,S.jsx)(`div`,{className:`ml-[76px] mr-5 border-b border-border/70`})]},e.title))})]},e)),v&&(0,S.jsx)(`div`,{className:`px-5 pt-4 text-[12.5px] text-muted`,children:v.source===`model`?D(`Generated {when}`,{when:e(v.generated_at)}):D(`Starter ideas. Refresh once {name} knows you better.`,{name:E})})]}),(0,S.jsx)(m,{open:M!==null,onClose:()=>N(null),children:M&&(0,S.jsxs)(`div`,{className:`px-1 pb-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(`span`,{className:`text-[30px] leading-none`,children:M.emoji}),(0,S.jsx)(`h3`,{className:`flex-1 text-[18px] font-bold leading-6`,children:M.idea.title})]}),M.idea.detail&&(0,S.jsx)(`p`,{className:`mt-3 text-[15px] leading-[22px]`,children:M.idea.detail}),(0,S.jsxs)(`div`,{className:`mt-3.5 flex items-center gap-1.5 text-[13px] text-muted`,children:[L(M.idea)===`routine`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(h,{size:16}),` `,D(`Creates a routine`),M.idea.time?` · ${M.idea.time}`:``]}),L(M.idea)===`goal`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(g,{size:16}),` `,D(`Creates a goal`)]}),L(M.idea)===`chat`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{size:16}),` `,D(`Starts a conversation`)]})]}),L(M.idea)===`routine`&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>void F(M.idea),className:`mt-[22px] flex h-[50px] w-full items-center justify-center gap-2 rounded-full bg-accent text-[16px] font-semibold text-accent-fg`,children:[(0,S.jsx)(h,{size:18}),` `,D(`Create routine`)]}),L(M.idea)===`goal`&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>I(M.idea),className:`mt-[22px] flex h-[50px] w-full items-center justify-center gap-2 rounded-full bg-accent text-[16px] font-semibold text-accent-fg`,children:[(0,S.jsx)(g,{size:18}),` `,D(`Start goal`)]}),L(M.idea)===`chat`&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>P(M.idea),className:`mt-[22px] flex h-[50px] w-full items-center justify-center gap-2 rounded-full bg-accent text-[16px] font-semibold text-accent-fg`,children:[(0,S.jsx)(p,{size:18}),` `,D(`Send to chat`)]})]})})]})}function T(e){let t=C[C.length-1],n=C.map(e=>({id:e.id,title:e.label,ideas:[]}));for(let r of e){let e=C.find(e=>e.id===(r.area||t.id))??t;(n.find(t=>t.id===e.id)??n[n.length-1]).ideas.push({...r,emoji:e.emoji})}return n.filter(e=>e.ideas.length>0)}export{w as IdeasScreen};
\ No newline at end of file
+import{A as e,J as t,K as n,Q as r,W as i,Y as a,b as o,f as s,q as c,x as l}from"./MuseHeader-Pw-NI98v.js";import{t as u}from"./refresh-cw-BKgIzslL.js";import{f as d,m as f,ot as p,w as m,yt as h}from"./index-CIdGZ5PB.js";var g=t(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),_=r(a(),1),v={sections:[{id:`travel`,title:`Travel`,ideas:[{id:`train-watch`,emoji:`🚄`,title:`Tell me where you're going and when; I'll watch for seats and lower fares.`,body:`I set up the lookup tools in my sandbox, check trains, classes and availability as often as you like, and tell you the moment something opens up. Booking and paying stay in your hands.`,kind:`GOAL`,category:`other`,prompt:`I want to watch a train route: ask me for the origin, destination, date and acceptable departure window, then set up a goal that checks availability regularly.`},{id:`trip-plan`,emoji:`🗺️`,title:`Name a city and a number of days; I'll plan an itinerary you can follow as is.`,body:`Weather, opening hours and travel time between stops go into a day-by-day plan saved to your Library. Change one sentence and I'll rearrange the rest.`,kind:`CHAT`,prompt:`Help me plan a trip. Ask me where, how many days, with whom, a rough budget and the style I like, then give me a day-by-day itinerary as a file.`},{id:`commute-brief`,emoji:`🚦`,title:`Before you leave each morning, I'll tell you the traffic, the weather and the first thing on your plate.`,body:`A morning routine: I check the weather where you are, the traffic on your commute, glance at your calendar and boil the morning down to three sentences.`,kind:`ROUTINE`,time:`07:30`,prompt:`Morning brief: check today's weather and commute traffic, read my calendar for today, and tell me in at most five sentences the three things that matter most and what to bring.`},{id:`parcel-track`,emoji:`📦`,title:`Send me a tracking number; I'll tell you where the parcel is and when it lands.`,body:`I follow the shipment through the carrier's tracking, tell you about every new scan, and remind you to keep the phone nearby on delivery day.`,kind:`CHAT`,prompt:`Help me track a parcel. Ask me for the tracking number and carrier, check the current status once, then set a routine that checks every morning and reminds me the day before delivery.`}]},{id:`work`,title:`Work`,ideas:[{id:`meeting-prep`,emoji:`📝`,title:`Ten minutes before a meeting, I'll have the background and the questions ready.`,body:`I read the meeting's title and attendees from your calendar, look through what we've discussed and what you've put in the Library, and hand you one page: purpose, talking points, three questions worth asking.`,kind:`ROUTINE`,time:`08:50`,prompt:`Look at the meetings on my calendar today and prepare a one-page brief for each: the purpose, the points I should make, and three questions worth asking.`},{id:`weekly-review`,emoji:`📊`,title:`Every Friday afternoon, I'll review what you did this week and what next week needs.`,body:`From our conversations, your calendar and the notes I keep, I list what got done, what didn't, and three priorities for next week, as a draft you can send.`,kind:`ROUTINE`,time:`17:00`,prompt:`Write my weekly review: from this week's conversations, my calendar and what you remember, list what was completed, what is still open, and three priorities for next week. Save it as a Markdown file.`},{id:`inbox-triage`,emoji:`📬`,title:`Dump a pile of messages or emails on me; I'll sort them and draft the replies.`,body:`Paste text or screenshots. I sort them into 'reply today', 'this week' and 'just so you know', and draft each reply so you only need to edit and send.`,kind:`CHAT`,prompt:`I'm handing you a batch of messages to triage: sort them into 'reply today / this week / just so you know' and draft a reply for each one that needs it. Ask me to paste the content first.`},{id:`doc-digest`,emoji:`📄`,title:`Long documents, PDFs, web pages: I'll read them and give you the three-minute version.`,body:`Drop the file in a shared folder or send me the link. You get the conclusions, the key numbers and the decisions you need to make; ask follow-ups any time.`,kind:`CHAT`,prompt:`I have something long for you to read and summarise: ask me for the file or link, then give me conclusions, key numbers and decisions I need to make, at most five bullets each.`}]},{id:`life`,title:`Everyday`,ideas:[{id:`price-watch`,emoji:`🏷️`,title:`Tell me what you want to buy; the moment it hits your price, you'll know.`,body:`I check the product page on a schedule, keep the price history, and notify you at your target. Ordering and paying are yours; I don't touch them.`,kind:`GOAL`,category:`finance`,prompt:`I want to watch the price of a product: ask me for the link or name, my target price and how often to check, then create a goal that alerts me when it drops.`},{id:`photo-sort`,emoji:`🖼️`,title:`Mount your photos and I'll sort screenshots and pictures by what's in them.`,body:`Once your gallery is mounted as a shared folder I look at each image (receipts, chat screenshots, landscapes, documents), file it into the right folder and note anything important.`,kind:`CHAT`,prompt:`Help me sort my photos: ask me to mount the gallery in Shared Folders first, then sort by content (receipts, screenshots, scenery, documents, other) and list what you did.`},{id:`meal-log`,emoji:`🥗`,title:`Photograph what you eat; I'll estimate the calories and keep the log.`,body:`A photo or a sentence is enough: I estimate nutrition and calories, log it in the day's memory, and give you a summary each evening with one small suggestion for tomorrow.`,kind:`CHAT`,prompt:`From now on, log my meals: whenever I send a photo or a description, estimate calories and nutrition and write it into today's memory. Tell me first how best to send them.`},{id:`subscriptions`,emoji:`🔁`,title:`Send me your bills; I'll list every subscription that charges you each month, and you decide which to stop.`,body:`Give me bill screenshots or statements. I list every recurring charge, its next date and the yearly total; you decide what to cancel and I walk you through each cancellation.`,kind:`CHAT`,prompt:`Audit my subscriptions: ask me for bill screenshots or statements, then list every recurring charge, its next billing date and the yearly total, and flag the ones I may not need.`}]},{id:`learn`,title:`Learning`,ideas:[{id:`daily-words`,emoji:`🔤`,title:`Five new words every morning, a quick quiz every night.`,body:`You pick the language and level; I pick words by theme with examples and a memory hook, quiz you in the evening, and bring back the ones you missed.`,kind:`ROUTINE`,time:`08:00`,prompt:`Daily vocabulary: pick five new words for me (ask which language, level and topics first), each with a definition, one example sentence and a memory hook, plus a review quiz on yesterday's words.`},{id:`study-plan`,emoji:`🎯`,title:`Something you want to learn? I'll break it into weekly chunks and keep you honest.`,body:`Tell me the goal and the hours you can spare; I lay out four to eight weeks, check progress weekly, and adjust the pace so you actually finish.`,kind:`GOAL`,category:`interests`,prompt:`I want to learn something new and stick with it: ask me what, my current level, hours per week and the timeframe, then create a goal with a weekly progress check.`},{id:`explain`,emoji:`💡`,title:`Send me a concept you don't get; I'll explain it with things you already know.`,body:`I ask what you already understand and start from there, then check with two quick questions and leave you a flashcard if you want one.`,kind:`CHAT`,prompt:`There's a concept I don't understand: ask me what it is and what related things I already know, explain it with analogies, then check with two short questions.`},{id:`reading-notes`,emoji:`📚`,title:`Finished a book? I'll turn it into notes you'll actually reread.`,body:`Tell me the highlights, or send the passages you marked. I write structured notes into your Library and remember what stayed with you.`,kind:`CHAT`,prompt:`Help me write notes on a book: ask me the title, the three things that struck me most and the quotes I want to keep, then save structured Markdown notes.`}]},{id:`family`,title:`Family & friends`,ideas:[{id:`birthdays`,emoji:`🎂`,title:`Birthdays and anniversaries: I remind you a week ahead, gift ideas included.`,body:`Give me names and dates and I keep them. A week before each one I remind you, with a few gift directions based on what you've told me about them.`,kind:`CHAT`,prompt:`Remember the birthdays and anniversaries of the people who matter to me: ask for the list and dates, store them in long-term memory, and set a routine that reminds me a week before each.`},{id:`keep-in-touch`,emoji:`💬`,title:`Lost touch with old friends? Once a week I'll suggest who to reach out to, and how to start.`,body:`Give me a list of people you want to stay close to. I rotate through them and write a natural opening line based on what you last talked about.`,kind:`ROUTINE`,time:`19:00`,prompt:`Weekly keep-in-touch: from my list of people I want to stay close to, pick the one I've gone longest without contacting, remind me, and write a natural opening line based on what I noted about our last conversation.`},{id:`family-calendar`,emoji:`📅`,title:`Tell me the family's plans and I'll put them on the calendar and catch clashes.`,body:`Kids' lessons, a parent's appointment, a weekend get-together: one sentence and it's in the calendar; if two things collide, I say so first.`,kind:`CHAT`,prompt:`Help me run the family calendar: I'll tell you plans as they come up; write them into the calendar, confirm each before creating it, and warn me about conflicts.`},{id:`gift-ideas`,emoji:`🎁`,title:`Describe the person and I'll give you gift ideas that aren't the obvious ones.`,body:`Budget, relationship, what they're into lately: three questions, then five directions with one line each on why it fits.`,kind:`CHAT`,prompt:`Help me think of a gift: ask who it's for, my budget, their interests and what's going on in their life, then give me five directions with one line of reasoning each.`}]},{id:`more`,title:`More ideas`,ideas:[{id:`id-renewal`,emoji:`🪪`,title:`Tell me when your documents expire; I'll book the renewal and prep the paperwork list.`,body:`Passport, licence, visa: I note the dates, remind you three months ahead, list the documents and the office, and look up appointment slots where I can.`,kind:`CHAT`,prompt:`Help me track document expiry: ask which documents I have and when they expire, store them in memory, and set a reminder three months ahead of each with the renewal checklist.`},{id:`personality-quiz`,emoji:`❓`,title:`Two small questions a day; after a week I'll tell you what I've noticed about you.`,body:`Light questions, quick answers. I keep them and, once a week, write a short observation about your preferences and rhythm so I understand you better.`,kind:`ROUTINE`,time:`21:00`,prompt:`Two questions a day: ask me two small questions about preferences, habits or how things are going (never repeat one), store the answers in memory; every Sunday add a short observation about my week.`},{id:`event-plan`,emoji:`🎉`,title:`Name the occasion; I'll plan the run of show and draft the invitation.`,body:`Birthday, team outing, family dinner: give me the headcount, budget and date, and you get a timeline, a shopping list and an invitation you can send as is.`,kind:`CHAT`,prompt:`Help me plan an event: ask me the occasion, date, headcount and budget, then give me a timeline, a to-do list and an invitation text I can send.`},{id:`phone-cleanup`,emoji:`🧹`,title:`Let me look through the sandbox and shared folders; I'll clear the junk and organise the rest.`,body:`I list the big files and duplicates, show you the list first and only act when you say so; anything worth keeping goes into the Library.`,kind:`CHAT`,prompt:`Help me tidy the workspace and shared folders: list large files, duplicates and files untouched for a long time, and give me the list. Do not delete anything before I confirm.`}]}]},y={sections:[{id:`travel`,title:`出行`,ideas:[{id:`train-watch`,emoji:`🚄`,title:`告诉我你要去哪、哪天走,我盯着 12306 的余票和低价票。`,body:`我会在沙盒里装好查询工具,按你说的频率查车次、席别和余票,有票或价格合适时马上通知你;订票和付款那一步留给你自己点。`,kind:`GOAL`,category:`other`,prompt:`我想盯一趟火车票:请先问我出发地、目的地、日期和可接受的车次时段,然后为我建一个定期检查余票的目标。`},{id:`trip-plan`,emoji:`🗺️`,title:`说一个城市和几天,我给你排一份能直接照着走的行程。`,body:`我会查天气、开放时间和两点之间的路程,把每天的顺序排顺,写成一份文件放进资源库;你改一句,我就重排。`,kind:`CHAT`,prompt:`帮我规划一次出行。先问我去哪、几天、和谁、预算大概多少、喜欢什么风格,再给我一份按天排好的行程文件。`},{id:`commute-brief`,emoji:`🚦`,title:`每天出门前,我告诉你今天的路况、天气和第一件事。`,body:`一条早间例程:查你所在城市的天气、通勤路线的路况,翻一下日历,把上午的安排浓缩成三句话推给你。`,kind:`ROUTINE`,time:`07:30`,prompt:`早间简报:查询今天的天气和通勤路况,读取我今天的日历安排,用不超过五句话告诉我今天最重要的三件事和出门要带的东西。`},{id:`parcel-track`,emoji:`📦`,title:`把快递单号发我,到哪了、什么时候到,我随时告诉你。`,body:`我会用快递查询接口跟踪包裹,有新的物流节点就更新你;派送当天提醒你留意电话。`,kind:`CHAT`,prompt:`帮我跟踪一个快递。先问我单号和快递公司,然后查一次当前进度,并设一个每天早上检查一次、到派送前一天提醒我的例程。`}]},{id:`work`,title:`工作`,ideas:[{id:`meeting-prep`,emoji:`📝`,title:`开会前十分钟,我把这场会的背景和该问的问题整理好。`,body:`读日历里的会议主题和参会人,翻我们聊过的相关内容和你放进资源库的资料,给你一页纸:目的、要点、三个值得问的问题。`,kind:`ROUTINE`,time:`08:50`,prompt:`查看我今天日历里接下来的会议,为每一场准备一页会前提纲:这场会的目的、需要我发言的要点、三个值得提出的问题。`},{id:`weekly-review`,emoji:`📊`,title:`每周五下午,我帮你回顾这一周做了什么,下周该抓什么。`,body:`从我们的对话、你的日历和我记下的备忘里,整理出本周完成的事、没做完的事和下周的三个重点,写成一份周报草稿。`,kind:`ROUTINE`,time:`17:00`,prompt:`写一份本周回顾:根据我们这周的对话、我的日历和你记住的事项,列出完成了什么、什么没做完、下周三个重点,保存为一份 Markdown 文件。`},{id:`inbox-triage`,emoji:`📬`,title:`把一堆消息或邮件丢给我,我分好轻重缓急,写好回复草稿。`,body:`粘贴文字或截图给我,我按“今天必须回、这周处理、只需知道”分类,把每条要回的先拟好一版,你改一改就能发。`,kind:`CHAT`,prompt:`我要把一批消息交给你整理:请按“今天必须回 / 这周处理 / 只需知道”分类,并为需要回复的每一条写好回复草稿。请先让我粘贴内容。`},{id:`doc-digest`,emoji:`📄`,title:`长文档、PDF、网页,我读完给你三分钟版本。`,body:`把文件放进共享文件夹或把链接发我,我提炼结论、关键数字和你需要做的决定,问题可以接着追问。`,kind:`CHAT`,prompt:`我有一份长内容需要你读并总结:请先让我提供文件或链接,然后给我结论、关键数字、需要我做的决定三部分,每部分不超过五条。`}]},{id:`life`,title:`生活`,ideas:[{id:`price-watch`,emoji:`🏷️`,title:`想买的东西告诉我,降到你说的价格我立刻告诉你。`,body:`我会定期去商品页看价格,记录走势;到价就通知你。下单和付款由你来点,我不会碰。`,kind:`GOAL`,category:`finance`,prompt:`我想盯一件商品的价格:请先问我商品链接或名称、目标价格和检查频率,然后建一个到价提醒我的目标。`},{id:`photo-sort`,emoji:`🖼️`,title:`把相册挂给我,我按内容给截图和照片分类整理。`,body:`在「共享文件夹」里挂载相册后,我会看图识别内容(票据、聊天截图、风景、证件),归到对应文件夹,重要的信息顺手记下来。`,kind:`CHAT`,prompt:`帮我整理照片:请先让我在共享文件夹里挂载相册目录,然后按内容(票据、截图、风景、证件、其他)分类整理,并把整理结果列给我。`},{id:`meal-log`,emoji:`🥗`,title:`拍下你吃的,我帮你估热量、记下每一餐。`,body:`发一张照片或一句话,我估算营养和热量,记进当天的日记;晚上给你一天的小结和明天的一个小建议。`,kind:`CHAT`,prompt:`从现在起帮我记录饮食:每次我发照片或描述,估算热量与营养并记入当天记忆;请先告诉我怎么发给你最方便。`},{id:`subscriptions`,emoji:`🔁`,title:`帮你把每月自动扣费的订阅列出来,看看哪些该停。`,body:`把账单截图或消费记录给我,我列出所有周期性扣费、下一次扣款日和一年花多少;你决定停哪个,退订的步骤我一步步陪你走。`,kind:`CHAT`,prompt:`帮我盘点订阅扣费:请先让我提供账单截图或记录,然后列出所有周期性扣费、下一次扣款日、年费合计,并标出可能不再需要的。`}]},{id:`learn`,title:`学习`,ideas:[{id:`daily-words`,emoji:`🔤`,title:`每天早上五个新词,晚上考你一遍。`,body:`你定语言和难度,我按主题挑词、给例句和记忆点,晚上出五道小题,错的第二天再来。`,kind:`ROUTINE`,time:`08:00`,prompt:`每日词汇:为我挑五个新词(先问我学什么语言、什么水平和感兴趣的主题),每个给释义、一个例句和一个记忆点,并附上昨天的复习题。`},{id:`study-plan`,emoji:`🎯`,title:`有个想学会的东西?我陪你拆成每周能做完的小块。`,body:`告诉我目标和每周能投入的时间,我排一份四到八周的计划,每周检查进度、调整难度,帮你坚持到最后。`,kind:`GOAL`,category:`interests`,prompt:`我想学一样新东西并坚持下去:请先问我想学什么、现在的水平、每周能投入多少时间和希望多久见效,然后帮我建一个每周检查进度的目标。`},{id:`explain`,emoji:`💡`,title:`看不懂的概念发给我,我用你熟悉的东西讲明白。`,body:`先问你已经懂什么,再从那里出发讲;讲完出两道题确认你真懂了,需要的话给你一张记忆卡。`,kind:`CHAT`,prompt:`我有一个不太懂的概念想让你讲明白:请先问我这个概念是什么、我已经了解哪些相关知识,然后用类比讲解,最后出两道小题检验。`},{id:`reading-notes`,emoji:`📚`,title:`读完一本书,我帮你整理成能重读的笔记。`,body:`你说重点和感受,或者把划线的句子发我,我整理成结构化笔记,存进资源库,并记住你的收获。`,kind:`CHAT`,prompt:`帮我整理一本书的读书笔记:请先问我书名、最触动我的三点和我想记住的引文,然后整理成结构化的 Markdown 笔记并保存。`}]},{id:`family`,title:`家庭与关系`,ideas:[{id:`birthdays`,emoji:`🎂`,title:`重要的人的生日和纪念日,我提前一周提醒,顺手想好礼物。`,body:`把名字和日期告诉我,我记住;到日子前一周提醒你,并根据你说过的 TA 的喜好给几个礼物方向。`,kind:`CHAT`,prompt:`帮我记住重要的人的生日和纪念日:请先问我名单和日期,记入长期记忆,并为每个日期设一个提前一周提醒我的例程。`},{id:`keep-in-touch`,emoji:`💬`,title:`老朋友太久没联系?我每周提醒你该找谁聊聊,帮你开个头。`,body:`你给我一份想保持联系的名单,我按间隔轮着提醒,并根据上次聊的内容帮你写一句自然的开场。`,kind:`ROUTINE`,time:`19:00`,prompt:`每周联系提醒:从我告诉你的“想保持联系的人”名单里,挑一位最近最久没联系的,提醒我,并根据我记录过的上次聊天内容写一句自然的开场白。`},{id:`family-calendar`,emoji:`📅`,title:`把全家的安排告诉我,我帮你排进日历、发现冲突。`,body:`孩子的课、家人的门诊、周末的聚会,说一句我就写进日历,时间撞了我先提醒你。`,kind:`CHAT`,prompt:`帮我管理家庭日程:我会陆续告诉你家人的安排,请写进日历,创建前先复述确认,发现时间冲突时提醒我。`},{id:`gift-ideas`,emoji:`🎁`,title:`说说 TA 是什么样的人,我给你几个不落俗套的礼物点子。`,body:`预算、关系、TA 最近在忙什么,三个问题之后我给你五个方向,每个附一句为什么合适。`,kind:`CHAT`,prompt:`帮我想礼物:请先问我送给谁、预算、TA 的兴趣和最近的生活状态,然后给我五个礼物方向,每个附一句理由。`}]},{id:`more`,title:`更多点子`,ideas:[{id:`id-renewal`,emoji:`🪪`,title:`告诉我证件到期时间,我提前预约续签,把材料清单准备好。`,body:`护照、驾照、签证,我记下到期日,提前三个月提醒,列出所需材料和办理地点,能预约的帮你查好时段。`,kind:`CHAT`,prompt:`帮我管理证件到期:请先问我有哪些证件和到期日期,记入长期记忆,并为每一个设置提前三个月的提醒,附上续办所需材料清单。`},{id:`personality-quiz`,emoji:`❓`,title:`每天两个小问题,一周后我告诉你我发现了什么样的你。`,body:`问题很轻,回答很快;我把答案记下来,每周整理成一段关于你偏好和节奏的观察,方便我更懂你。`,kind:`ROUTINE`,time:`21:00`,prompt:`每日两问:问我两个关于偏好、习惯或近况的小问题(不重复以前问过的),把回答记入记忆;每周日额外给我一段关于我这周状态的观察。`},{id:`event-plan`,emoji:`🎉`,title:`说个场合,我帮你安排流程、拟好邀请。`,body:`生日、团建、家宴,人数、预算和日期告诉我,我给你时间线、采购清单和一段可以直接发出去的邀请文字。`,kind:`CHAT`,prompt:`帮我策划一次活动:请先问我场合、日期、人数和预算,然后给我时间线、待办清单和一段可直接发送的邀请文字。`},{id:`phone-cleanup`,emoji:`🧹`,title:`让我看看沙盒和共享文件夹里有什么,清掉没用的、整理有用的。`,body:`我列出占空间的大文件和重复文件,先给你看清单,你点头我再动;重要的整理进资源库。`,kind:`CHAT`,prompt:`帮我整理工作区和共享文件夹:先列出大文件、重复文件和很久没动的文件,给我一份清单;在我确认之前不要删除任何东西。`}]}]};function b(e){return e.toLowerCase().startsWith(`zh`)?y:v}function x(e){return{id:e.id,emoji:e.emoji,title:e.title,detail:e.body,prompt:e.prompt,kind:e.kind.toLowerCase(),time:e.time,category:e.category}}var S=o(),C=[{id:`planning`,label:`Planning`,emoji:`🗓️`},{id:`goals`,label:`Goals`,emoji:`🎯`},{id:`research`,label:`Research`,emoji:`🔍`},{id:`money`,label:`Money`,emoji:`💰`},{id:`health`,label:`Health`,emoji:`🌿`},{id:`home`,label:`Home`,emoji:`🏠`},{id:`learning`,label:`Learning`,emoji:`📚`},{id:`people`,label:`People`,emoji:`👥`},{id:`files`,label:`Files & tools`,emoji:`📄`},{id:`fun`,label:`Just for you`,emoji:`🎈`}];function w(){let{state:t,send:r,openThread:a,toast:o}=s(),[v,y]=(0,_.useState)(null),[C,w]=(0,_.useState)(!1),E=t.profile?.name??`nanoMuse`,D=n(),O=i(),k=async(e=!1)=>{w(!0);try{let t=await l.ideas(e);y(t),t.error&&o(D(`Could not refresh ideas: {error}`,{error:t.error}))}catch(e){o(e.message)}finally{w(!1)}};(0,_.useEffect)(()=>{k(!1)},[]);let A=v?.source===`model`&&v.ideas.length>0,j=A?T(v.ideas):b(O).sections.map(e=>({id:e.id,title:e.title,ideas:e.ideas.map(x)})),[M,N]=(0,_.useState)(null),P=e=>{N(null),r(`main`,e.prompt).catch(e=>o(e.message||D(`Could not send`))),a(`main`)},F=async e=>{N(null);let t=e.time&&/^([01]\d|2[0-3]):[0-5]\d$/.test(e.time)?e.time:`09:00`;try{await l.createReminder({text:e.prompt,kind:`task`,repeat:`daily ${t}`}),o(D(`Routine set: every day at {time}. It is listed under Goals.`,{time:t}))}catch(e){o(e.message)}},I=e=>{N(null);let t=f.find(t=>t.id===e.category)??f[f.length-1],n=D(`I'd like to create a {category} goal. Ask me a few short questions, one at a time (what exactly I want, why and by when, how often to check in), then create it with concrete steps using the goals tool.`,{category:D(t.label)});r(`main`,`${n} ${e.prompt}`).catch(e=>o(e.message||D(`Could not send`))),a(`main`)},L=e=>e.kind===`routine`||e.kind===`goal`?e.kind:`chat`;return(0,S.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,S.jsx)(d,{title:D(`Ideas`),children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>void k(!0),disabled:C,"aria-label":D(`Refresh ideas`),className:`flex h-10 w-10 items-center justify-center rounded-full bg-surface text-fg shadow-[0_1px_4px_rgba(0,0,0,0.14)] disabled:opacity-60 dark:border dark:border-border dark:shadow-none`,children:C?(0,S.jsx)(c,{size:20,className:`animate-spin`}):(0,S.jsx)(u,{size:19})})}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-6`,children:[j.map(({id:e,title:t,ideas:n},r)=>(0,S.jsxs)(`section`,{children:[(r>0||!A)&&(0,S.jsx)(`h2`,{className:`px-5 pt-[22px] pb-1 text-[20px] font-bold`,children:A?D(t):t}),(0,S.jsx)(`ul`,{children:n.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>N({idea:e,emoji:e.emoji}),className:`flex w-full items-start gap-4 px-5 py-3.5 text-left active:bg-surface-2/70`,children:[(0,S.jsx)(`span`,{className:`flex w-10 shrink-0 justify-center text-[28px] leading-[34px]`,children:e.emoji}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,S.jsx)(`span`,{className:`block text-[16px] font-semibold leading-[22px]`,children:e.title}),e.detail&&(0,S.jsx)(`span`,{className:`line-clamp-4 block text-[13.5px] leading-[19px] text-muted`,children:e.detail})]})]}),(0,S.jsx)(`div`,{className:`ml-[76px] mr-5 border-b border-border/70`})]},e.title))})]},e)),v&&(0,S.jsx)(`div`,{className:`px-5 pt-4 text-[12.5px] text-muted`,children:v.source===`model`?D(`Generated {when}`,{when:e(v.generated_at)}):D(`Starter ideas. Refresh once {name} knows you better.`,{name:E})})]}),(0,S.jsx)(m,{open:M!==null,onClose:()=>N(null),children:M&&(0,S.jsxs)(`div`,{className:`px-1 pb-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(`span`,{className:`text-[30px] leading-none`,children:M.emoji}),(0,S.jsx)(`h3`,{className:`flex-1 text-[18px] font-bold leading-6`,children:M.idea.title})]}),M.idea.detail&&(0,S.jsx)(`p`,{className:`mt-3 text-[15px] leading-[22px]`,children:M.idea.detail}),(0,S.jsxs)(`div`,{className:`mt-3.5 flex items-center gap-1.5 text-[13px] text-muted`,children:[L(M.idea)===`routine`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(h,{size:16}),` `,D(`Creates a routine`),M.idea.time?` · ${M.idea.time}`:``]}),L(M.idea)===`goal`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(g,{size:16}),` `,D(`Creates a goal`)]}),L(M.idea)===`chat`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{size:16}),` `,D(`Starts a conversation`)]})]}),L(M.idea)===`routine`&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>void F(M.idea),className:`mt-[22px] flex h-[50px] w-full items-center justify-center gap-2 rounded-full bg-accent text-[16px] font-semibold text-accent-fg`,children:[(0,S.jsx)(h,{size:18}),` `,D(`Create routine`)]}),L(M.idea)===`goal`&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>I(M.idea),className:`mt-[22px] flex h-[50px] w-full items-center justify-center gap-2 rounded-full bg-accent text-[16px] font-semibold text-accent-fg`,children:[(0,S.jsx)(g,{size:18}),` `,D(`Start goal`)]}),L(M.idea)===`chat`&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>P(M.idea),className:`mt-[22px] flex h-[50px] w-full items-center justify-center gap-2 rounded-full bg-accent text-[16px] font-semibold text-accent-fg`,children:[(0,S.jsx)(p,{size:18}),` `,D(`Send to chat`)]})]})})]})}function T(e){let t=C[C.length-1],n=C.map(e=>({id:e.id,title:e.label,ideas:[]}));for(let r of e){let e=C.find(e=>e.id===(r.area||t.id))??t;(n.find(t=>t.id===e.id)??n[n.length-1]).ideas.push({...r,emoji:e.emoji})}return n.filter(e=>e.ideas.length>0)}export{w as IdeasScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/IdentityForm-Dhx4FiQY.js b/nanomuse/server/static/assets/IdentityForm-BTGczGT_.js
similarity index 97%
rename from nanomuse/server/static/assets/IdentityForm-Dhx4FiQY.js
rename to nanomuse/server/static/assets/IdentityForm-BTGczGT_.js
index bcc66917e..38f94da52 100644
--- a/nanomuse/server/static/assets/IdentityForm-Dhx4FiQY.js
+++ b/nanomuse/server/static/assets/IdentityForm-BTGczGT_.js
@@ -1 +1 @@
-import{E as e,J as t,K as n,Q as r,Y as i,b as a,i as o}from"./MuseHeader-Pw-NI98v.js";import{r as s}from"./AvatarPicker-oSjVM8L3.js";var c=t(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),l=r(i(),1),u=a(),d=[`Muse`,`Veda`,`Nova`,`Pip`,`Sage`,`Juno`,`Kit`,`Wren`,`Iris`,`Milo`,`Echo`,`Remy`,`Otto`,`Luna`,`Ari`,`Bea`,`Nico`,`Zed`,`小墨`,`阿柒`,`小满`,`知了`,`豆豆`,`小竹`],f=[`formal`,`casual`,`playful`,`concise`],p=[`short`,`detailed`,`bullets`],m={formal:`Formal`,casual:`Casual`,playful:`Playful`,concise:`Concise`},h={short:`Short replies`,detailed:`Detailed`,bullets:`Bullet points`};function g(e,t){let n=d.filter(t=>t!==e),r=[],i=t||1,a=[...n];for(;r.length<6&&a.length;)i=(i*9301+49297)%233280,r.push(a.splice(i%a.length,1)[0]);return r}function _({active:t,onClick:n,children:r}){return(0,u.jsx)(`button`,{type:`button`,onClick:n,className:e(`rounded-full px-3 py-1.5 text-[13px] border transition-colors`,t?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:r})}function v({value:t,onChange:r,suggestions:i=!0,askUserName:a=!0,inputCls:d,onStudio:v}){let y=n(),b=(0,l.useId)(),[x,S]=(0,l.useState)(7),C=(0,l.useMemo)(()=>g(t.name,x),[t.name,x]),w=e=>r({...t,...e}),T={...t,proactivity:`default`,proactive:!0,goal_interval_minutes:60,quiet_hours:``};return(0,u.jsxs)(`div`,{className:`space-y-5`,children:[(0,u.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,u.jsx)(o,{profile:T,size:72}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,u.jsx)(`div`,{children:(0,u.jsx)(`input`,{value:t.name,onChange:e=>w({name:e.target.value.slice(0,20)}),maxLength:20,className:e(d,`text-[17px] font-medium`),placeholder:`nanoMuse`,"aria-label":y(`Name`),autoCapitalize:`words`})}),(0,u.jsx)(`input`,{value:t.tagline,onChange:e=>w({tagline:e.target.value.slice(0,60)}),maxLength:60,className:e(d,`text-[14px]`),placeholder:y(`A line under the name, e.g. Your day, sorted.`),"aria-label":y(`Tagline`)})]})]}),i&&(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[C.map(e=>(0,u.jsx)(_,{active:t.name===e,onClick:()=>w({name:e}),children:e},e)),(0,u.jsx)(`button`,{type:`button`,onClick:()=>S(e=>e+1),"aria-label":y(`More names`),className:`rounded-full border border-border p-1.5 text-muted`,children:(0,u.jsx)(c,{size:14})})]}),(0,u.jsx)(s,{value:{avatar:t.avatar,emoji:t.emoji,color:t.color},onChange:e=>w(e),onStudio:v}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{className:`text-[12px] text-muted`,children:y(`Tone`)}),(0,u.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:f.map(e=>(0,u.jsx)(_,{active:t.tone===e,onClick:()=>w({tone:t.tone===e?``:e}),children:y(m[e])},e))})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{className:`text-[12px] text-muted`,children:y(`How much it says`)}),(0,u.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:p.map(e=>(0,u.jsx)(_,{active:t.communication===e,onClick:()=>w({communication:t.communication===e?``:e}),children:y(h[e])},e))})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`${b}-style`,className:`text-[12px] text-muted`,children:y(`Anything else about how it should be`)}),(0,u.jsx)(`textarea`,{id:`${b}-style`,value:t.style,onChange:e=>w({style:e.target.value}),rows:2,placeholder:y(`e.g. A little witty. Uses metric units. Never uses emoji.`),className:e(d,`mt-1 resize-none text-[14px]`)})]}),a&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`${b}-user`,className:`text-[12px] text-muted`,children:y(`What it calls you`)}),(0,u.jsx)(`input`,{id:`${b}-user`,value:t.user_name,onChange:e=>w({user_name:e.target.value}),maxLength:60,placeholder:y(`Your name`),className:e(d,`mt-1 text-[14px]`)})]})]})}function y(e,t,n){return{name:e?.name??`nanoMuse`,tagline:e?.tagline??``,avatar:e?.avatar??t,emoji:e?.emoji??`✨`,color:e?.color??n,tone:e?.tone??``,communication:e?.communication??``,style:e?.style??``,user_name:e?.user_name??``}}function b(e){return{...e,name:e.name.trim()||`nanoMuse`,tagline:e.tagline.trim(),style:e.style.trim(),user_name:e.user_name.trim()}}export{b as n,y as r,v as t};
\ No newline at end of file
+import{E as e,J as t,K as n,Q as r,Y as i,b as a,i as o}from"./MuseHeader-Pw-NI98v.js";import{r as s}from"./AvatarPicker-gR2knlot.js";var c=t(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),l=r(i(),1),u=a(),d=[`Muse`,`Veda`,`Nova`,`Pip`,`Sage`,`Juno`,`Kit`,`Wren`,`Iris`,`Milo`,`Echo`,`Remy`,`Otto`,`Luna`,`Ari`,`Bea`,`Nico`,`Zed`,`小墨`,`阿柒`,`小满`,`知了`,`豆豆`,`小竹`],f=[`formal`,`casual`,`playful`,`concise`],p=[`short`,`detailed`,`bullets`],m={formal:`Formal`,casual:`Casual`,playful:`Playful`,concise:`Concise`},h={short:`Short replies`,detailed:`Detailed`,bullets:`Bullet points`};function g(e,t){let n=d.filter(t=>t!==e),r=[],i=t||1,a=[...n];for(;r.length<6&&a.length;)i=(i*9301+49297)%233280,r.push(a.splice(i%a.length,1)[0]);return r}function _({active:t,onClick:n,children:r}){return(0,u.jsx)(`button`,{type:`button`,onClick:n,className:e(`rounded-full px-3 py-1.5 text-[13px] border transition-colors`,t?`border-accent bg-accent/10 text-accent font-medium`:`border-border text-muted`),children:r})}function v({value:t,onChange:r,suggestions:i=!0,askUserName:a=!0,inputCls:d,onStudio:v}){let y=n(),b=(0,l.useId)(),[x,S]=(0,l.useState)(7),C=(0,l.useMemo)(()=>g(t.name,x),[t.name,x]),w=e=>r({...t,...e}),T={...t,proactivity:`default`,proactive:!0,goal_interval_minutes:60,quiet_hours:``};return(0,u.jsxs)(`div`,{className:`space-y-5`,children:[(0,u.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,u.jsx)(o,{profile:T,size:72}),(0,u.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,u.jsx)(`div`,{children:(0,u.jsx)(`input`,{value:t.name,onChange:e=>w({name:e.target.value.slice(0,20)}),maxLength:20,className:e(d,`text-[17px] font-medium`),placeholder:`nanoMuse`,"aria-label":y(`Name`),autoCapitalize:`words`})}),(0,u.jsx)(`input`,{value:t.tagline,onChange:e=>w({tagline:e.target.value.slice(0,60)}),maxLength:60,className:e(d,`text-[14px]`),placeholder:y(`A line under the name, e.g. Your day, sorted.`),"aria-label":y(`Tagline`)})]})]}),i&&(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[C.map(e=>(0,u.jsx)(_,{active:t.name===e,onClick:()=>w({name:e}),children:e},e)),(0,u.jsx)(`button`,{type:`button`,onClick:()=>S(e=>e+1),"aria-label":y(`More names`),className:`rounded-full border border-border p-1.5 text-muted`,children:(0,u.jsx)(c,{size:14})})]}),(0,u.jsx)(s,{value:{avatar:t.avatar,emoji:t.emoji,color:t.color},onChange:e=>w(e),onStudio:v}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{className:`text-[12px] text-muted`,children:y(`Tone`)}),(0,u.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:f.map(e=>(0,u.jsx)(_,{active:t.tone===e,onClick:()=>w({tone:t.tone===e?``:e}),children:y(m[e])},e))})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{className:`text-[12px] text-muted`,children:y(`How much it says`)}),(0,u.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:p.map(e=>(0,u.jsx)(_,{active:t.communication===e,onClick:()=>w({communication:t.communication===e?``:e}),children:y(h[e])},e))})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`${b}-style`,className:`text-[12px] text-muted`,children:y(`Anything else about how it should be`)}),(0,u.jsx)(`textarea`,{id:`${b}-style`,value:t.style,onChange:e=>w({style:e.target.value}),rows:2,placeholder:y(`e.g. A little witty. Uses metric units. Never uses emoji.`),className:e(d,`mt-1 resize-none text-[14px]`)})]}),a&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`${b}-user`,className:`text-[12px] text-muted`,children:y(`What it calls you`)}),(0,u.jsx)(`input`,{id:`${b}-user`,value:t.user_name,onChange:e=>w({user_name:e.target.value}),maxLength:60,placeholder:y(`Your name`),className:e(d,`mt-1 text-[14px]`)})]})]})}function y(e,t,n){return{name:e?.name??`nanoMuse`,tagline:e?.tagline??``,avatar:e?.avatar??t,emoji:e?.emoji??`✨`,color:e?.color??n,tone:e?.tone??``,communication:e?.communication??``,style:e?.style??``,user_name:e?.user_name??``}}function b(e){return{...e,name:e.name.trim()||`nanoMuse`,tagline:e.tagline.trim(),style:e.style.trim(),user_name:e.user_name.trim()}}export{b as n,y as r,v as t};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/LibraryScreen-U8NV3qaf.js b/nanomuse/server/static/assets/LibraryScreen-B8JlrC_n.js
similarity index 98%
rename from nanomuse/server/static/assets/LibraryScreen-U8NV3qaf.js
rename to nanomuse/server/static/assets/LibraryScreen-B8JlrC_n.js
index 89f28dace..a5701e101 100644
--- a/nanomuse/server/static/assets/LibraryScreen-U8NV3qaf.js
+++ b/nanomuse/server/static/assets/LibraryScreen-B8JlrC_n.js
@@ -1 +1 @@
-import{D as e,E as t,J as n,K as r,Q as i,S as a,Y as o,b as s,f as c,q as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{C as d,I as f,X as p,_t as m,f as h,mt as g,pt as _,xt as v}from"./index-BjYzdKkG.js";var y=n(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),b=n(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),x=n(`library-big`,[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]),S=i(o(),1),C=s(),w=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`heic`,`mp3`,`wav`,`m4a`,`ogg`,`flac`,`mp4`,`mov`,`webm`,`mkv`]);function T(e){return w.has(e.toLowerCase().split(`.`).pop()??``)}function E(){let{state:e,openFile:t}=c(),[n,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null),[s,f]=(0,S.useState)(0),[m,g]=(0,S.useState)(0),[_,v]=(0,S.useState)(``),y=r(),b=Object.values(e.events).reduce((e,t)=>e+t.length,0);(0,S.useEffect)(()=>{let e=!0;return u.files(500).then(t=>{e&&(i(t),o(null))}).catch(t=>e&&o(t.message)),()=>{e=!1}},[b,e.feedVersion,s]);let w=(0,S.useMemo)(()=>{let e=_.trim().toLowerCase();return(n??[]).filter(t=>T(t.name)===(m===1)&&(!e||t.path.toLowerCase().includes(e)))},[n,m,_]);return(0,C.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,C.jsx)(h,{title:y(`Library`)}),(0,C.jsxs)(`div`,{className:`shrink-0 px-4 pt-1 pb-2.5`,children:[(0,C.jsx)(D,{labels:[y(`Artifacts`),y(`Media`)],selected:m,onSelect:e=>g(e)}),(n?.length??0)>8&&(0,C.jsxs)(`label`,{className:`mt-2.5 flex items-center gap-2 rounded-full bg-surface-2 px-3.5 py-2`,children:[(0,C.jsx)(p,{size:16,className:`text-muted`}),(0,C.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),placeholder:y(`Search files`),className:`flex-1 bg-transparent text-[14.5px] outline-none`})]})]}),(0,C.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-6`,children:[n===null&&a&&(0,C.jsx)(d,{message:a,onRetry:()=>f(e=>e+1)}),n===null&&!a&&(0,C.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,C.jsx)(l,{className:`animate-spin`,size:20})}),n!==null&&w.length===0&&(0,C.jsxs)(`div`,{className:`flex flex-col items-center px-8 pt-9 text-center`,children:[(0,C.jsx)(x,{size:34,className:`text-muted`}),(0,C.jsx)(`div`,{className:`mt-3.5 text-[16px] font-medium text-muted`,children:y(_?`No files match.`:m===0?`Nothing created yet`:`No media yet`)}),!_&&(0,C.jsx)(`p`,{className:`mt-1 text-[12px] text-muted`,children:y(m===0?`Documents, tables and pages I write for you will show up here.`:`Photos, screenshots and recordings I produce will show up here.`)})]}),(0,C.jsx)(`ul`,{children:w.map(e=>(0,C.jsx)(`li`,{children:(0,C.jsx)(O,{file:e,onOpen:()=>t(e.path)})},e.path))})]})]})}function D({labels:e,selected:n,onSelect:r}){return(0,C.jsx)(`div`,{role:`tablist`,className:`flex h-12 w-full rounded-full border border-border bg-surface p-1`,children:e.map((e,i)=>(0,C.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":i===n,onClick:()=>r(i),className:t(`flex-1 rounded-full text-[14px] font-semibold transition`,i===n?`bg-surface-2`:`bg-transparent`),children:e},e))})}function O({file:t,onOpen:n}){let r=e(t.name),i=r===`html`?(0,C.jsx)(_,{size:22}):r===`image`?(0,C.jsx)(y,{size:22}):r===`data`?(0,C.jsx)(b,{size:22}):r===`code`?(0,C.jsx)(m,{size:22}):r===`event`?(0,C.jsx)(v,{size:22}):(0,C.jsx)(g,{size:22}),o=t.path.includes(`/`)?t.path.slice(0,t.path.lastIndexOf(`/`)):``;return(0,C.jsxs)(`button`,{type:`button`,onClick:n,className:`flex w-full items-center gap-3.5 px-4 py-2 text-left active:bg-surface-2/70`,children:[(0,C.jsx)(`span`,{className:`flex h-[46px] w-[46px] shrink-0 items-center justify-center overflow-hidden rounded-[10px] bg-surface-2 text-muted`,children:r===`image`?(0,C.jsx)(`img`,{src:a(t.path),alt:``,loading:`lazy`,className:`h-full w-full object-cover`}):i}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,C.jsx)(`span`,{className:`block truncate text-[15px] font-medium`,children:t.name}),(0,C.jsx)(`span`,{className:`block truncate text-[12px] text-muted`,children:[f(t.modified),k(t.size),o].filter(Boolean).join(` · `)})]})]})}function k(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(+(e<10240))} KB`:`${(e/1024/1024).toFixed(1)} MB`}export{E as LibraryScreen};
\ No newline at end of file
+import{D as e,E as t,J as n,K as r,Q as i,S as a,Y as o,b as s,f as c,q as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{C as d,I as f,X as p,_t as m,f as h,mt as g,pt as _,xt as v}from"./index-CIdGZ5PB.js";var y=n(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),b=n(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),x=n(`library-big`,[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]),S=i(o(),1),C=s(),w=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`heic`,`mp3`,`wav`,`m4a`,`ogg`,`flac`,`mp4`,`mov`,`webm`,`mkv`]);function T(e){return w.has(e.toLowerCase().split(`.`).pop()??``)}function E(){let{state:e,openFile:t}=c(),[n,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null),[s,f]=(0,S.useState)(0),[m,g]=(0,S.useState)(0),[_,v]=(0,S.useState)(``),y=r(),b=Object.values(e.events).reduce((e,t)=>e+t.length,0);(0,S.useEffect)(()=>{let e=!0;return u.files(500).then(t=>{e&&(i(t),o(null))}).catch(t=>e&&o(t.message)),()=>{e=!1}},[b,e.feedVersion,s]);let w=(0,S.useMemo)(()=>{let e=_.trim().toLowerCase();return(n??[]).filter(t=>T(t.name)===(m===1)&&(!e||t.path.toLowerCase().includes(e)))},[n,m,_]);return(0,C.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,C.jsx)(h,{title:y(`Library`)}),(0,C.jsxs)(`div`,{className:`shrink-0 px-4 pt-1 pb-2.5`,children:[(0,C.jsx)(D,{labels:[y(`Artifacts`),y(`Media`)],selected:m,onSelect:e=>g(e)}),(n?.length??0)>8&&(0,C.jsxs)(`label`,{className:`mt-2.5 flex items-center gap-2 rounded-full bg-surface-2 px-3.5 py-2`,children:[(0,C.jsx)(p,{size:16,className:`text-muted`}),(0,C.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),placeholder:y(`Search files`),className:`flex-1 bg-transparent text-[14.5px] outline-none`})]})]}),(0,C.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-6`,children:[n===null&&a&&(0,C.jsx)(d,{message:a,onRetry:()=>f(e=>e+1)}),n===null&&!a&&(0,C.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,C.jsx)(l,{className:`animate-spin`,size:20})}),n!==null&&w.length===0&&(0,C.jsxs)(`div`,{className:`flex flex-col items-center px-8 pt-9 text-center`,children:[(0,C.jsx)(x,{size:34,className:`text-muted`}),(0,C.jsx)(`div`,{className:`mt-3.5 text-[16px] font-medium text-muted`,children:y(_?`No files match.`:m===0?`Nothing created yet`:`No media yet`)}),!_&&(0,C.jsx)(`p`,{className:`mt-1 text-[12px] text-muted`,children:y(m===0?`Documents, tables and pages I write for you will show up here.`:`Photos, screenshots and recordings I produce will show up here.`)})]}),(0,C.jsx)(`ul`,{children:w.map(e=>(0,C.jsx)(`li`,{children:(0,C.jsx)(O,{file:e,onOpen:()=>t(e.path)})},e.path))})]})]})}function D({labels:e,selected:n,onSelect:r}){return(0,C.jsx)(`div`,{role:`tablist`,className:`flex h-12 w-full rounded-full border border-border bg-surface p-1`,children:e.map((e,i)=>(0,C.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":i===n,onClick:()=>r(i),className:t(`flex-1 rounded-full text-[14px] font-semibold transition`,i===n?`bg-surface-2`:`bg-transparent`),children:e},e))})}function O({file:t,onOpen:n}){let r=e(t.name),i=r===`html`?(0,C.jsx)(_,{size:22}):r===`image`?(0,C.jsx)(y,{size:22}):r===`data`?(0,C.jsx)(b,{size:22}):r===`code`?(0,C.jsx)(m,{size:22}):r===`event`?(0,C.jsx)(v,{size:22}):(0,C.jsx)(g,{size:22}),o=t.path.includes(`/`)?t.path.slice(0,t.path.lastIndexOf(`/`)):``;return(0,C.jsxs)(`button`,{type:`button`,onClick:n,className:`flex w-full items-center gap-3.5 px-4 py-2 text-left active:bg-surface-2/70`,children:[(0,C.jsx)(`span`,{className:`flex h-[46px] w-[46px] shrink-0 items-center justify-center overflow-hidden rounded-[10px] bg-surface-2 text-muted`,children:r===`image`?(0,C.jsx)(`img`,{src:a(t.path),alt:``,loading:`lazy`,className:`h-full w-full object-cover`}):i}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,C.jsx)(`span`,{className:`block truncate text-[15px] font-medium`,children:t.name}),(0,C.jsx)(`span`,{className:`block truncate text-[12px] text-muted`,children:[f(t.modified),k(t.size),o].filter(Boolean).join(` · `)})]})]})}function k(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(+(e<10240))} KB`:`${(e/1024/1024).toFixed(1)} MB`}export{E as LibraryScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/MemoryScreen-B5a6LPAu.js b/nanomuse/server/static/assets/MemoryScreen-M8j03G3u.js
similarity index 98%
rename from nanomuse/server/static/assets/MemoryScreen-B5a6LPAu.js
rename to nanomuse/server/static/assets/MemoryScreen-M8j03G3u.js
index 6b9c43d78..c49d41a42 100644
--- a/nanomuse/server/static/assets/MemoryScreen-B5a6LPAu.js
+++ b/nanomuse/server/static/assets/MemoryScreen-M8j03G3u.js
@@ -1 +1 @@
-import{A as e,J as t,K as n,Q as r,Y as i,b as a,f as o,q as s,x as c}from"./MuseHeader-Pw-NI98v.js";import{C as l,St as u,V as d,W as f,Z as p}from"./index-BjYzdKkG.js";import{t as m}from"./BackBar-Dli0L0O_.js";var h=t(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),g=r(i(),1),_=a(),v=[`profile`,`preference`,`people`,`routine`,`constraint`,`general`];function y(){let{state:t,toast:r,openThread:i,setTab:a}=o(),[y,b]=(0,g.useState)(null),[x,S]=(0,g.useState)(null),[C,w]=(0,g.useState)([]),[T,E]=(0,g.useState)(``),[D,O]=(0,g.useState)(`profile`),[k,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)(!1),N=t.profile?.name??`nanoMuse`,P=n(),F=()=>Promise.all([c.memory().then(b),c.memoryChanges().then(w)]).then(()=>S(null)).catch(e=>y===null?S(e.message):r(e.message));(0,g.useEffect)(()=>{F()},[t.memoryVersion]);let I=(0,g.useMemo)(()=>{let e=new Map;for(let t of y??[])e.set(t.category,[...e.get(t.category)??[],t]);return[...e.entries()].sort((e,t)=>t[1].length-e[1].length)},[y]),L=async()=>{if(T.trim()){A(!0);try{await c.addMemory(T.trim(),D),E(``),await F()}catch(e){r(e.message)}finally{A(!1)}}},R=async e=>{if(window.confirm(P(`Forget “{text}”?`,{text:e.content.slice(0,60)})))try{await c.forgetMemory(e.id),b(t=>t?.filter(t=>t.id!==e.id)??t)}catch(e){r(e.message)}},z=async()=>{M(!0);try{let e=await c.tidyMemory();r(e.changed===0?P(`Nothing to tidy: {n} memories, all distinct.`,{n:e.considered}):P(`Tidied: {merged} merged, {dropped} dropped. Undo below if needed.`,{merged:e.merged.length,dropped:e.dropped.length})),await F()}catch(e){r(e.message)}finally{M(!1)}},B=async e=>{try{await c.restoreMemoryChange(e.id),await F()}catch(e){r(e.message)}};return(0,_.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,_.jsx)(m,{title:P(`Memory`),description:P(`What {name} remembers about you. Read it, add to it, or make {name} forget; nothing here is hidden from you.`,{name:N}),actions:(y?.length??0)>=2&&(0,_.jsxs)(`button`,{type:`button`,disabled:j,onClick:()=>void z(),title:P(`Merge lines that say the same thing and drop what was never a fact about you. Every change can be undone.`),className:`flex h-10 items-center gap-1.5 rounded-full bg-surface px-3.5 text-[13.5px] font-medium shadow-[0_1px_4px_rgba(0,0,0,0.14)] disabled:opacity-50 dark:border dark:border-border dark:shadow-none`,children:[(0,_.jsx)(f,{size:15,className:j?`animate-pulse text-accent`:`text-accent`}),P(j?`Tidying…`:`Tidy up`)]})}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-6 space-y-5`,children:[(0,_.jsxs)(`div`,{className:`rounded-3xl bg-surface border border-border/70 shadow-sm p-3.5 space-y-2.5`,children:[(0,_.jsx)(`textarea`,{value:T,onChange:e=>E(e.target.value),rows:2,placeholder:P(`Tell {name} something to remember, e.g. “I'm vegetarian” or “My sister's birthday is 14 May”`,{name:N}),className:`w-full resize-none rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`select`,{value:D,onChange:e=>O(e.target.value),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:v.map(e=>(0,_.jsx)(`option`,{value:e,children:P(e)},e))}),(0,_.jsx)(`div`,{className:`flex-1`}),(0,_.jsxs)(`button`,{type:`button`,disabled:!T.trim()||k,onClick:()=>void L(),className:`rounded-2xl bg-accent text-accent-fg px-3.5 py-2 text-[14px] font-medium flex items-center gap-1.5 disabled:opacity-50`,children:[(0,_.jsx)(p,{size:16}),` `,P(`Remember`)]})]})]}),y===null&&x&&(0,_.jsx)(l,{message:x,onRetry:()=>void F()}),y===null&&!x&&(0,_.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,_.jsx)(s,{className:`animate-spin`,size:20})}),y!==null&&y.length===0&&(0,_.jsxs)(`div`,{className:`rounded-3xl border border-dashed border-border p-6 text-center`,children:[(0,_.jsx)(u,{className:`mx-auto text-accent`}),(0,_.jsx)(`div`,{className:`mt-2 font-semibold`,children:P(`Nothing remembered yet`)}),(0,_.jsx)(`p`,{className:`mt-1 text-[13.5px] text-muted`,children:P(`{name} saves durable facts you share in chat (preferences, people, routines) and never secrets.`,{name:N})}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{i(`main`),a(`chat`)},className:`mt-3 rounded-full bg-accent px-4 py-2 text-[13.5px] font-semibold text-accent-fg`,children:P(`Tell {name} something to remember`,{name:N})})]}),I.map(([t,n])=>(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`div`,{className:`px-1 mb-2 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:[P(t),` · `,n.length]}),(0,_.jsx)(`ul`,{className:`rounded-3xl bg-surface border border-border/70 shadow-sm divide-y divide-border/70 overflow-hidden`,children:n.map(t=>(0,_.jsxs)(`li`,{className:`flex items-start gap-3 px-4 py-3`,children:[(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,_.jsx)(`div`,{className:`text-[14.5px] leading-snug break-words`,children:t.content}),(0,_.jsxs)(`div`,{className:`mt-0.5 text-[11.5px] text-muted`,children:[t.source===`user`?P(`added by you`):P(`saved by {name}`,{name:N}),` · `,e(t.created_at),t.updated_at?` · ${P(`updated {when}`,{when:e(t.updated_at)})}`:``]})]}),(0,_.jsx)(`button`,{type:`button`,"aria-label":P(`Forget`),onClick:()=>void R(t),className:`p-1.5 text-muted hover:text-rose-500`,children:(0,_.jsx)(d,{size:17})})]},t.id))})]},t)),C.length>0&&(0,_.jsxs)(`section`,{children:[(0,_.jsx)(`div`,{className:`px-1 mb-2 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:P(`Recent changes`)}),(0,_.jsx)(`ul`,{className:`rounded-3xl bg-surface border border-border/70 shadow-sm divide-y divide-border/70 overflow-hidden`,children:C.map(t=>(0,_.jsx)(`li`,{className:`px-4 py-3 ${t.restored?`opacity-60`:``}`,children:(0,_.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex-1 min-w-0 text-[13.5px] leading-snug`,children:[(0,_.jsxs)(`div`,{className:`text-muted`,children:[t.action===`merge`?P(`Merged`):t.action===`drop`?P(`Dropped`):P(`Updated`),t.reason?` · ${t.reason}`:``,` · `,e(t.at),t.restored?` · ${P(`restored`)}`:``]}),t.before.map(e=>(0,_.jsx)(`div`,{className:`break-words line-through text-muted`,children:e.content},e.id)),t.after&&(0,_.jsxs)(`div`,{className:`break-words`,children:[`→ `,t.after.content]})]}),!t.restored&&(0,_.jsxs)(`button`,{type:`button`,onClick:()=>void B(t),className:`shrink-0 rounded-xl bg-surface-2 px-2.5 py-1.5 text-[12.5px] font-medium flex items-center gap-1`,children:[(0,_.jsx)(h,{size:14}),` `,P(`Undo`)]})]})},t.id))})]})]})]})}export{y as MemoryScreen};
\ No newline at end of file
+import{A as e,J as t,K as n,Q as r,Y as i,b as a,f as o,q as s,x as c}from"./MuseHeader-Pw-NI98v.js";import{C as l,St as u,V as d,W as f,Z as p}from"./index-CIdGZ5PB.js";import{t as m}from"./BackBar-Dl56jHZM.js";var h=t(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),g=r(i(),1),_=a(),v=[`profile`,`preference`,`people`,`routine`,`constraint`,`general`];function y(){let{state:t,toast:r,openThread:i,setTab:a}=o(),[y,b]=(0,g.useState)(null),[x,S]=(0,g.useState)(null),[C,w]=(0,g.useState)([]),[T,E]=(0,g.useState)(``),[D,O]=(0,g.useState)(`profile`),[k,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)(!1),N=t.profile?.name??`nanoMuse`,P=n(),F=()=>Promise.all([c.memory().then(b),c.memoryChanges().then(w)]).then(()=>S(null)).catch(e=>y===null?S(e.message):r(e.message));(0,g.useEffect)(()=>{F()},[t.memoryVersion]);let I=(0,g.useMemo)(()=>{let e=new Map;for(let t of y??[])e.set(t.category,[...e.get(t.category)??[],t]);return[...e.entries()].sort((e,t)=>t[1].length-e[1].length)},[y]),L=async()=>{if(T.trim()){A(!0);try{await c.addMemory(T.trim(),D),E(``),await F()}catch(e){r(e.message)}finally{A(!1)}}},R=async e=>{if(window.confirm(P(`Forget “{text}”?`,{text:e.content.slice(0,60)})))try{await c.forgetMemory(e.id),b(t=>t?.filter(t=>t.id!==e.id)??t)}catch(e){r(e.message)}},z=async()=>{M(!0);try{let e=await c.tidyMemory();r(e.changed===0?P(`Nothing to tidy: {n} memories, all distinct.`,{n:e.considered}):P(`Tidied: {merged} merged, {dropped} dropped. Undo below if needed.`,{merged:e.merged.length,dropped:e.dropped.length})),await F()}catch(e){r(e.message)}finally{M(!1)}},B=async e=>{try{await c.restoreMemoryChange(e.id),await F()}catch(e){r(e.message)}};return(0,_.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,_.jsx)(m,{title:P(`Memory`),description:P(`What {name} remembers about you. Read it, add to it, or make {name} forget; nothing here is hidden from you.`,{name:N}),actions:(y?.length??0)>=2&&(0,_.jsxs)(`button`,{type:`button`,disabled:j,onClick:()=>void z(),title:P(`Merge lines that say the same thing and drop what was never a fact about you. Every change can be undone.`),className:`flex h-10 items-center gap-1.5 rounded-full bg-surface px-3.5 text-[13.5px] font-medium shadow-[0_1px_4px_rgba(0,0,0,0.14)] disabled:opacity-50 dark:border dark:border-border dark:shadow-none`,children:[(0,_.jsx)(f,{size:15,className:j?`animate-pulse text-accent`:`text-accent`}),P(j?`Tidying…`:`Tidy up`)]})}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-6 space-y-5`,children:[(0,_.jsxs)(`div`,{className:`rounded-3xl bg-surface border border-border/70 shadow-sm p-3.5 space-y-2.5`,children:[(0,_.jsx)(`textarea`,{value:T,onChange:e=>E(e.target.value),rows:2,placeholder:P(`Tell {name} something to remember, e.g. “I'm vegetarian” or “My sister's birthday is 14 May”`,{name:N}),className:`w-full resize-none rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`select`,{value:D,onChange:e=>O(e.target.value),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:v.map(e=>(0,_.jsx)(`option`,{value:e,children:P(e)},e))}),(0,_.jsx)(`div`,{className:`flex-1`}),(0,_.jsxs)(`button`,{type:`button`,disabled:!T.trim()||k,onClick:()=>void L(),className:`rounded-2xl bg-accent text-accent-fg px-3.5 py-2 text-[14px] font-medium flex items-center gap-1.5 disabled:opacity-50`,children:[(0,_.jsx)(p,{size:16}),` `,P(`Remember`)]})]})]}),y===null&&x&&(0,_.jsx)(l,{message:x,onRetry:()=>void F()}),y===null&&!x&&(0,_.jsx)(`div`,{className:`flex justify-center py-10 text-muted`,children:(0,_.jsx)(s,{className:`animate-spin`,size:20})}),y!==null&&y.length===0&&(0,_.jsxs)(`div`,{className:`rounded-3xl border border-dashed border-border p-6 text-center`,children:[(0,_.jsx)(u,{className:`mx-auto text-accent`}),(0,_.jsx)(`div`,{className:`mt-2 font-semibold`,children:P(`Nothing remembered yet`)}),(0,_.jsx)(`p`,{className:`mt-1 text-[13.5px] text-muted`,children:P(`{name} saves durable facts you share in chat (preferences, people, routines) and never secrets.`,{name:N})}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{i(`main`),a(`chat`)},className:`mt-3 rounded-full bg-accent px-4 py-2 text-[13.5px] font-semibold text-accent-fg`,children:P(`Tell {name} something to remember`,{name:N})})]}),I.map(([t,n])=>(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`div`,{className:`px-1 mb-2 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:[P(t),` · `,n.length]}),(0,_.jsx)(`ul`,{className:`rounded-3xl bg-surface border border-border/70 shadow-sm divide-y divide-border/70 overflow-hidden`,children:n.map(t=>(0,_.jsxs)(`li`,{className:`flex items-start gap-3 px-4 py-3`,children:[(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,_.jsx)(`div`,{className:`text-[14.5px] leading-snug break-words`,children:t.content}),(0,_.jsxs)(`div`,{className:`mt-0.5 text-[11.5px] text-muted`,children:[t.source===`user`?P(`added by you`):P(`saved by {name}`,{name:N}),` · `,e(t.created_at),t.updated_at?` · ${P(`updated {when}`,{when:e(t.updated_at)})}`:``]})]}),(0,_.jsx)(`button`,{type:`button`,"aria-label":P(`Forget`),onClick:()=>void R(t),className:`p-1.5 text-muted hover:text-rose-500`,children:(0,_.jsx)(d,{size:17})})]},t.id))})]},t)),C.length>0&&(0,_.jsxs)(`section`,{children:[(0,_.jsx)(`div`,{className:`px-1 mb-2 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:P(`Recent changes`)}),(0,_.jsx)(`ul`,{className:`rounded-3xl bg-surface border border-border/70 shadow-sm divide-y divide-border/70 overflow-hidden`,children:C.map(t=>(0,_.jsx)(`li`,{className:`px-4 py-3 ${t.restored?`opacity-60`:``}`,children:(0,_.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex-1 min-w-0 text-[13.5px] leading-snug`,children:[(0,_.jsxs)(`div`,{className:`text-muted`,children:[t.action===`merge`?P(`Merged`):t.action===`drop`?P(`Dropped`):P(`Updated`),t.reason?` · ${t.reason}`:``,` · `,e(t.at),t.restored?` · ${P(`restored`)}`:``]}),t.before.map(e=>(0,_.jsx)(`div`,{className:`break-words line-through text-muted`,children:e.content},e.id)),t.after&&(0,_.jsxs)(`div`,{className:`break-words`,children:[`→ `,t.after.content]})]}),!t.restored&&(0,_.jsxs)(`button`,{type:`button`,onClick:()=>void B(t),className:`shrink-0 rounded-xl bg-surface-2 px-2.5 py-1.5 text-[12.5px] font-medium flex items-center gap-1`,children:[(0,_.jsx)(h,{size:14}),` `,P(`Undo`)]})]})},t.id))})]})]})]})}export{y as MemoryScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/Onboarding-rP8qAahh.js b/nanomuse/server/static/assets/Onboarding-CtVO6gdK.js
similarity index 97%
rename from nanomuse/server/static/assets/Onboarding-rP8qAahh.js
rename to nanomuse/server/static/assets/Onboarding-CtVO6gdK.js
index 5f5f68766..b4d23db46 100644
--- a/nanomuse/server/static/assets/Onboarding-rP8qAahh.js
+++ b/nanomuse/server/static/assets/Onboarding-CtVO6gdK.js
@@ -1 +1 @@
-import{E as e,J as t,K as n,L as r,Q as i,Y as a,a as o,b as s,f as c,i as l,q as u,x as d}from"./MuseHeader-Pw-NI98v.js";import{A as f}from"./StarNudge-DjXecvWj.js";import{n as p}from"./external-link-Xj5fjR8v.js";import"./Form-DwKuBk1V.js";import{r as m}from"./IdentityForm-Dhx4FiQY.js";import{Et as h,bt as g,t as _,vt as v}from"./index-BjYzdKkG.js";import{t as y}from"./AvatarPicker-oSjVM8L3.js";import{CalendarCard as b,ContactsCard as x,EmailCard as S,ModelCard as C}from"./ConnectionsScreen-0U0bXAf7.js";var w=t(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),T=i(a(),1),E=s();function D(){let{state:t,setTab:i,dismissOnboarding:a,refreshSettings:s,toast:p}=c(),[w,D]=(0,T.useState)(`welcome`),[M,N]=(0,T.useState)(null),[P,F]=(0,T.useState)(!1),[I,L]=(0,T.useState)(!1),R=n(),z=async()=>{L(!0);try{await d.cloudUseAsModel(),p(R(`The Cloud model is in use.`)),await H()}catch(e){p(e.message)}finally{L(!1)}},[B,V]=(0,T.useState)(null),H=async()=>{try{V(null),N(await d.connections())}catch(e){V(R(e.message)||R(`Could not load the connections.`))}};(0,T.useEffect)(()=>{H()},[t.connectionsVersion]);let U=async()=>{try{await d.onboarded(!0),await s()}catch{}a(),i(`chat`)},W=async()=>{F(!0);try{await d.firstrunStart(r()===`zh-CN`?`zh`:`en`)}catch{await d.onboarded(!0).catch(()=>void 0)}try{await s()}catch{}F(!1),a(),i(`chat`)},G={...m(t.profile,o,y[0]),proactivity:`default`,proactive:!0,goal_interval_minutes:60,quiet_hours:``},K=M?M.llm.key_source===`vault`||M.llm.key_source===`config`||!!M.providers[j(M)]?.no_key:!1,q=!!M&&(M.email.configured||M.calendar.feeds.length>0||M.contacts.sources.length>0),J=[`welcome`,`list`],Y=w===`welcome`?0:1;return(0,E.jsxs)(`div`,{className:`mx-auto flex h-[100dvh] max-w-[760px] flex-col bg-bg sm:border-x sm:border-border`,children:[(0,E.jsx)(`div`,{className:`titlebar-room`}),(0,E.jsxs)(`header`,{className:`safe-top shrink-0 px-5 pt-4 pb-2 flex items-center justify-between`,children:[(0,E.jsx)(`div`,{className:`flex gap-1`,children:J.map((t,n)=>(0,E.jsx)(`span`,{className:e(`h-1.5 rounded-full transition-all`,n<=Y?`w-5 bg-accent`:`w-1.5 bg-border`)},t))}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>void U(),className:`text-[13px] text-muted`,children:R(`Skip setup`)})]}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 pb-6`,children:[w===`welcome`&&(0,E.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center text-center`,children:[(0,E.jsx)(l,{profile:G,size:96}),(0,E.jsx)(`h1`,{className:`mt-6 text-[28px] font-bold tracking-tight`,children:R(`Meet your nanoMuse`)}),(0,E.jsx)(`p`,{className:`mt-2 text-[15px] text-muted`,children:R(`A personal agent of your own. Three things to know:`)}),(0,E.jsxs)(`ul`,{className:`mt-6 w-full max-w-sm space-y-2.5 text-left`,children:[(0,E.jsx)(O,{n:1,title:R(`It does things for you.`),body:R(`Searches, browses, writes, books, reads mail, and hands you the result, not a list of links.`)}),(0,E.jsx)(O,{n:2,title:R(`It keeps working when you close the app.`),body:R(`Goals move forward between your visits; it reports in the Feed and notifies you when something is worth it.`)}),(0,E.jsx)(O,{n:3,title:R(`It asks you first where it matters.`),body:R(`A separate Sentinel reviews every action. Sending, paying, deleting: it stops and asks; your keys stay in a vault the model cannot read.`)})]}),(0,E.jsx)(`p`,{className:`mt-5 max-w-sm text-[13px] text-muted`,children:R(`There is no form to fill in: once it has a model, it introduces itself in the chat and asks what to call you.`)}),(0,E.jsx)(`p`,{className:`mt-2 max-w-sm text-[13px] text-muted`,children:(0,E.jsx)(`a`,{href:`https://nanomuse.cn/#open-source`,target:`_blank`,rel:`noreferrer`,className:`underline decoration-dotted underline-offset-2 hover:text-accent`,children:R(`nanoMuse is a non-profit open-source community project, free forever.`)})})]}),w===`list`&&(0,E.jsxs)(`div`,{className:`pt-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(l,{profile:G,size:56}),(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`h1`,{className:`text-[24px] font-bold tracking-tight truncate`,children:R(`Set it up`)}),(0,E.jsx)(`p`,{className:`text-[13.5px] text-muted truncate`,children:R(`A model, then the chat. A minute.`)})]})]}),(0,E.jsxs)(`ol`,{className:`mt-6 space-y-2`,children:[(0,E.jsx)(k,{done:K,title:R(`Add a model`),body:K?M?.llm.cloud?`nanoMuse Cloud · ${M.llm.model}`:`${M?.llm.model} · ${A(M?.llm.base_url??``)}`:t.hub?.account.signed_in?R(`Your account's model, or a key of your own.`):R(`Pick a provider and paste a key. Yours, stored in the vault.`),onClick:()=>D(`model`)}),(0,E.jsx)(k,{done:q,optional:!0,title:R(`Connect mail, calendar, contacts`),body:R(q?`Connected. Tap to add more.`:`Optional. It can read what came in, know your day, and who is who.`),onClick:()=>D(`connect`)}),(0,E.jsx)(k,{locked:!K,done:!1,title:R(`Start`),body:R(K?`Open the chat. It introduces itself and asks your name.`:`Needs a model first.`),onClick:()=>K&&!P&&void W()})]})]}),w===`model`&&(0,E.jsxs)(`div`,{className:`pt-6 space-y-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{className:`text-[26px] font-bold tracking-tight`,children:R(`The model behind it`)}),(0,E.jsx)(`p`,{className:`mt-1 text-[14px] text-muted`,children:K?M?.llm.cloud?R(`Your account's model, with its free allowance. Keep it, or switch to a key of your own here.`):R(`A model is already set up on the server. Keep it, or switch here.`):R(`Your account brings a model with a free allowance, nothing to set up. Or paste a key of your own; it is stored encrypted in the vault on the server, never shown to the model, and nothing you say passes through the relay.`)})]}),M?(0,E.jsxs)(E.Fragment,{children:[!K&&t.hub?.account.signed_in&&(0,E.jsxs)(`button`,{type:`button`,disabled:I,onClick:()=>void z(),className:`flex w-full items-center gap-3 rounded-3xl border border-accent/30 bg-accent/5 px-4 py-3.5 text-left`,children:[(0,E.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-accent text-white`,children:I?(0,E.jsx)(u,{size:18,className:`animate-spin`}):(0,E.jsx)(v,{size:18})}),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`span`,{className:`block text-[15px] font-medium`,children:R(`Use the nanoMuse Cloud model`)}),(0,E.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:R(`Signed in as {hint}. A free allowance, nothing to paste. Recommended to start.`,{hint:t.hub.account.hint})})]}),(0,E.jsx)(g,{size:16,className:`shrink-0 text-muted`})]}),!K&&!t.hub?.account.signed_in&&(0,E.jsx)(`div`,{className:`rounded-3xl border border-border/70 bg-surface p-4`,children:(0,E.jsx)(_,{onSignedIn:()=>void H(),useAsModel:!0})}),!K&&(0,E.jsxs)(`p`,{className:`px-1 text-[12.5px] text-muted`,children:[(0,E.jsx)(`span`,{className:`font-medium`,children:R(`Or bring your own key`)}),` · `,f(R,t.hub?.account)]}),(0,E.jsx)(C,{data:M,onChange:()=>void H(),compact:!0})]}):B?(0,E.jsxs)(`div`,{className:`rounded-3xl border border-border/70 bg-surface p-4 text-center`,children:[(0,E.jsx)(`p`,{className:`text-[13.5px] text-muted`,children:B}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>void H(),className:`mt-3 rounded-full bg-surface-2 px-4 py-1.5 text-[13px] font-medium`,children:R(`Retry`)})]}):(0,E.jsx)(`div`,{className:`flex justify-center py-8 text-muted`,children:(0,E.jsx)(u,{className:`animate-spin`,size:20})})]}),w===`connect`&&(0,E.jsxs)(`div`,{className:`pt-6 space-y-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{className:`text-[26px] font-bold tracking-tight`,children:R(`Connect your mail, calendar and contacts`)}),(0,E.jsx)(`p`,{className:`mt-1 text-[14px] text-muted`,children:R(`Optional. With a mailbox connected it can read what came in and draft replies; it will always ask before sending. With a calendar it knows your day and finds free time. With your contacts it knows who is who. The browser and MCP servers are under Connections later.`)})]}),M?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(S,{data:M,onChange:()=>void H(),compact:!0}),(0,E.jsx)(b,{data:M,onChange:()=>void H(),compact:!0}),(0,E.jsx)(x,{data:M,onChange:()=>void H(),compact:!0})]}):B?(0,E.jsxs)(`div`,{className:`rounded-3xl border border-border/70 bg-surface p-4 text-center`,children:[(0,E.jsx)(`p`,{className:`text-[13.5px] text-muted`,children:B}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>void H(),className:`mt-3 rounded-full bg-surface-2 px-4 py-1.5 text-[13px] font-medium`,children:R(`Retry`)})]}):(0,E.jsx)(`div`,{className:`flex justify-center py-8 text-muted`,children:(0,E.jsx)(u,{className:`animate-spin`,size:20})})]})]}),(0,E.jsxs)(`footer`,{className:`safe-bottom shrink-0 px-5 pb-5 pt-2 flex gap-2`,children:[(w===`model`||w===`connect`)&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>D(`list`),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:R(`Back`)}),w===`welcome`&&(0,E.jsxs)(`button`,{type:`button`,onClick:()=>D(`list`),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1 py-3`),children:[R(`Get started`),` `,(0,E.jsx)(h,{size:16})]}),w===`list`&&(0,E.jsxs)(`button`,{type:`button`,disabled:!K||P,onClick:()=>void W(),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1 py-3`),children:[P?(0,E.jsx)(u,{size:16,className:`animate-spin`}):null,` `,R(K?`Start`:`Add a model to start`),` `,(0,E.jsx)(h,{size:16})]}),w===`model`&&(0,E.jsxs)(`button`,{type:`button`,disabled:!K,onClick:()=>D(`list`),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1 py-3`),children:[R(K?`Done`:`Save a model to continue`),` `,(0,E.jsx)(h,{size:16})]}),w===`connect`&&(0,E.jsxs)(`button`,{type:`button`,onClick:()=>D(`list`),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1 py-3`),children:[R(q?`Done`:`Skip for now`),` `,(0,E.jsx)(h,{size:16})]})]})]})}function O({n:e,title:t,body:n}){return(0,E.jsxs)(`li`,{className:`flex gap-3 rounded-3xl bg-surface border border-border/70 p-4`,children:[(0,E.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-accent/12 text-[13px] font-semibold text-accent`,children:e}),(0,E.jsxs)(`div`,{className:`text-[13.5px] leading-relaxed`,children:[(0,E.jsx)(`div`,{className:`font-medium text-fg`,children:t}),(0,E.jsx)(`div`,{className:`text-muted`,children:n})]})]})}function k({done:t,locked:r,optional:i,title:a,body:o,onClick:s}){let c=n();return(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,onClick:s,disabled:r,"aria-disabled":r,className:e(`w-full flex items-center gap-3 rounded-3xl border px-4 py-3.5 text-left transition-colors`,t?`border-accent/30 bg-accent/5`:`border-border/70 bg-surface`,r&&`opacity-50`),children:[(0,E.jsx)(`span`,{className:e(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full`,t?`bg-accent text-white`:r?`bg-surface-2 text-muted`:`border border-border text-muted`),children:t?(0,E.jsx)(p,{size:15,strokeWidth:3}):r?(0,E.jsx)(w,{size:13}):null}),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,E.jsxs)(`span`,{className:`flex items-center gap-2 text-[15px] font-medium`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:a}),i&&(0,E.jsx)(`span`,{className:`rounded-full bg-surface-2 px-2 py-0.5 text-[10.5px] font-medium text-muted`,children:c(`optional`)})]}),(0,E.jsx)(`span`,{className:`block truncate text-[12.5px] text-muted`,children:o})]}),!r&&(0,E.jsx)(g,{size:16,className:`shrink-0 text-muted`})]})})}function A(e){try{return new URL(e).host}catch{return e}}function j(e){return Object.entries(e.providers).find(([t,n])=>t!==`custom`&&n.base_url&&e.llm.base_url.startsWith(n.base_url))?.[0]??`custom`}export{D as Onboarding};
\ No newline at end of file
+import{E as e,J as t,K as n,L as r,Q as i,Y as a,a as o,b as s,f as c,i as l,q as u,x as d}from"./MuseHeader-Pw-NI98v.js";import{A as f}from"./StarNudge-DjXecvWj.js";import{n as p}from"./external-link-Xj5fjR8v.js";import"./Form-DwKuBk1V.js";import{r as m}from"./IdentityForm-BTGczGT_.js";import{Et as h,bt as g,t as _,vt as v}from"./index-CIdGZ5PB.js";import{t as y}from"./AvatarPicker-gR2knlot.js";import{CalendarCard as b,ContactsCard as x,EmailCard as S,ModelCard as C}from"./ConnectionsScreen-CMt7GOff.js";var w=t(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),T=i(a(),1),E=s();function D(){let{state:t,setTab:i,dismissOnboarding:a,refreshSettings:s,toast:p}=c(),[w,D]=(0,T.useState)(`welcome`),[M,N]=(0,T.useState)(null),[P,F]=(0,T.useState)(!1),[I,L]=(0,T.useState)(!1),R=n(),z=async()=>{L(!0);try{await d.cloudUseAsModel(),p(R(`The Cloud model is in use.`)),await H()}catch(e){p(e.message)}finally{L(!1)}},[B,V]=(0,T.useState)(null),H=async()=>{try{V(null),N(await d.connections())}catch(e){V(R(e.message)||R(`Could not load the connections.`))}};(0,T.useEffect)(()=>{H()},[t.connectionsVersion]);let U=async()=>{try{await d.onboarded(!0),await s()}catch{}a(),i(`chat`)},W=async()=>{F(!0);try{await d.firstrunStart(r()===`zh-CN`?`zh`:`en`)}catch{await d.onboarded(!0).catch(()=>void 0)}try{await s()}catch{}F(!1),a(),i(`chat`)},G={...m(t.profile,o,y[0]),proactivity:`default`,proactive:!0,goal_interval_minutes:60,quiet_hours:``},K=M?M.llm.key_source===`vault`||M.llm.key_source===`config`||!!M.providers[j(M)]?.no_key:!1,q=!!M&&(M.email.configured||M.calendar.feeds.length>0||M.contacts.sources.length>0),J=[`welcome`,`list`],Y=w===`welcome`?0:1;return(0,E.jsxs)(`div`,{className:`mx-auto flex h-[100dvh] max-w-[760px] flex-col bg-bg sm:border-x sm:border-border`,children:[(0,E.jsx)(`div`,{className:`titlebar-room`}),(0,E.jsxs)(`header`,{className:`safe-top shrink-0 px-5 pt-4 pb-2 flex items-center justify-between`,children:[(0,E.jsx)(`div`,{className:`flex gap-1`,children:J.map((t,n)=>(0,E.jsx)(`span`,{className:e(`h-1.5 rounded-full transition-all`,n<=Y?`w-5 bg-accent`:`w-1.5 bg-border`)},t))}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>void U(),className:`text-[13px] text-muted`,children:R(`Skip setup`)})]}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 pb-6`,children:[w===`welcome`&&(0,E.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center text-center`,children:[(0,E.jsx)(l,{profile:G,size:96}),(0,E.jsx)(`h1`,{className:`mt-6 text-[28px] font-bold tracking-tight`,children:R(`Meet your nanoMuse`)}),(0,E.jsx)(`p`,{className:`mt-2 text-[15px] text-muted`,children:R(`A personal agent of your own. Three things to know:`)}),(0,E.jsxs)(`ul`,{className:`mt-6 w-full max-w-sm space-y-2.5 text-left`,children:[(0,E.jsx)(O,{n:1,title:R(`It does things for you.`),body:R(`Searches, browses, writes, books, reads mail, and hands you the result, not a list of links.`)}),(0,E.jsx)(O,{n:2,title:R(`It keeps working when you close the app.`),body:R(`Goals move forward between your visits; it reports in the Feed and notifies you when something is worth it.`)}),(0,E.jsx)(O,{n:3,title:R(`It asks you first where it matters.`),body:R(`A separate Sentinel reviews every action. Sending, paying, deleting: it stops and asks; your keys stay in a vault the model cannot read.`)})]}),(0,E.jsx)(`p`,{className:`mt-5 max-w-sm text-[13px] text-muted`,children:R(`There is no form to fill in: once it has a model, it introduces itself in the chat and asks what to call you.`)}),(0,E.jsx)(`p`,{className:`mt-2 max-w-sm text-[13px] text-muted`,children:(0,E.jsx)(`a`,{href:`https://nanomuse.cn/#open-source`,target:`_blank`,rel:`noreferrer`,className:`underline decoration-dotted underline-offset-2 hover:text-accent`,children:R(`nanoMuse is a non-profit open-source community project, free forever.`)})})]}),w===`list`&&(0,E.jsxs)(`div`,{className:`pt-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(l,{profile:G,size:56}),(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`h1`,{className:`text-[24px] font-bold tracking-tight truncate`,children:R(`Set it up`)}),(0,E.jsx)(`p`,{className:`text-[13.5px] text-muted truncate`,children:R(`A model, then the chat. A minute.`)})]})]}),(0,E.jsxs)(`ol`,{className:`mt-6 space-y-2`,children:[(0,E.jsx)(k,{done:K,title:R(`Add a model`),body:K?M?.llm.cloud?`nanoMuse Cloud · ${M.llm.model}`:`${M?.llm.model} · ${A(M?.llm.base_url??``)}`:t.hub?.account.signed_in?R(`Your account's model, or a key of your own.`):R(`Pick a provider and paste a key. Yours, stored in the vault.`),onClick:()=>D(`model`)}),(0,E.jsx)(k,{done:q,optional:!0,title:R(`Connect mail, calendar, contacts`),body:R(q?`Connected. Tap to add more.`:`Optional. It can read what came in, know your day, and who is who.`),onClick:()=>D(`connect`)}),(0,E.jsx)(k,{locked:!K,done:!1,title:R(`Start`),body:R(K?`Open the chat. It introduces itself and asks your name.`:`Needs a model first.`),onClick:()=>K&&!P&&void W()})]})]}),w===`model`&&(0,E.jsxs)(`div`,{className:`pt-6 space-y-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{className:`text-[26px] font-bold tracking-tight`,children:R(`The model behind it`)}),(0,E.jsx)(`p`,{className:`mt-1 text-[14px] text-muted`,children:K?M?.llm.cloud?R(`Your account's model, with its free allowance. Keep it, or switch to a key of your own here.`):R(`A model is already set up on the server. Keep it, or switch here.`):R(`Your account brings a model with a free allowance, nothing to set up. Or paste a key of your own; it is stored encrypted in the vault on the server, never shown to the model, and nothing you say passes through the relay.`)})]}),M?(0,E.jsxs)(E.Fragment,{children:[!K&&t.hub?.account.signed_in&&(0,E.jsxs)(`button`,{type:`button`,disabled:I,onClick:()=>void z(),className:`flex w-full items-center gap-3 rounded-3xl border border-accent/30 bg-accent/5 px-4 py-3.5 text-left`,children:[(0,E.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-accent text-white`,children:I?(0,E.jsx)(u,{size:18,className:`animate-spin`}):(0,E.jsx)(v,{size:18})}),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`span`,{className:`block text-[15px] font-medium`,children:R(`Use the nanoMuse Cloud model`)}),(0,E.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:R(`Signed in as {hint}. A free allowance, nothing to paste. Recommended to start.`,{hint:t.hub.account.hint})})]}),(0,E.jsx)(g,{size:16,className:`shrink-0 text-muted`})]}),!K&&!t.hub?.account.signed_in&&(0,E.jsx)(`div`,{className:`rounded-3xl border border-border/70 bg-surface p-4`,children:(0,E.jsx)(_,{onSignedIn:()=>void H(),useAsModel:!0})}),!K&&(0,E.jsxs)(`p`,{className:`px-1 text-[12.5px] text-muted`,children:[(0,E.jsx)(`span`,{className:`font-medium`,children:R(`Or bring your own key`)}),` · `,f(R,t.hub?.account)]}),(0,E.jsx)(C,{data:M,onChange:()=>void H(),compact:!0})]}):B?(0,E.jsxs)(`div`,{className:`rounded-3xl border border-border/70 bg-surface p-4 text-center`,children:[(0,E.jsx)(`p`,{className:`text-[13.5px] text-muted`,children:B}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>void H(),className:`mt-3 rounded-full bg-surface-2 px-4 py-1.5 text-[13px] font-medium`,children:R(`Retry`)})]}):(0,E.jsx)(`div`,{className:`flex justify-center py-8 text-muted`,children:(0,E.jsx)(u,{className:`animate-spin`,size:20})})]}),w===`connect`&&(0,E.jsxs)(`div`,{className:`pt-6 space-y-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{className:`text-[26px] font-bold tracking-tight`,children:R(`Connect your mail, calendar and contacts`)}),(0,E.jsx)(`p`,{className:`mt-1 text-[14px] text-muted`,children:R(`Optional. With a mailbox connected it can read what came in and draft replies; it will always ask before sending. With a calendar it knows your day and finds free time. With your contacts it knows who is who. The browser and MCP servers are under Connections later.`)})]}),M?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(S,{data:M,onChange:()=>void H(),compact:!0}),(0,E.jsx)(b,{data:M,onChange:()=>void H(),compact:!0}),(0,E.jsx)(x,{data:M,onChange:()=>void H(),compact:!0})]}):B?(0,E.jsxs)(`div`,{className:`rounded-3xl border border-border/70 bg-surface p-4 text-center`,children:[(0,E.jsx)(`p`,{className:`text-[13.5px] text-muted`,children:B}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>void H(),className:`mt-3 rounded-full bg-surface-2 px-4 py-1.5 text-[13px] font-medium`,children:R(`Retry`)})]}):(0,E.jsx)(`div`,{className:`flex justify-center py-8 text-muted`,children:(0,E.jsx)(u,{className:`animate-spin`,size:20})})]})]}),(0,E.jsxs)(`footer`,{className:`safe-bottom shrink-0 px-5 pb-5 pt-2 flex gap-2`,children:[(w===`model`||w===`connect`)&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>D(`list`),className:`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,children:R(`Back`)}),w===`welcome`&&(0,E.jsxs)(`button`,{type:`button`,onClick:()=>D(`list`),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1 py-3`),children:[R(`Get started`),` `,(0,E.jsx)(h,{size:16})]}),w===`list`&&(0,E.jsxs)(`button`,{type:`button`,disabled:!K||P,onClick:()=>void W(),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1 py-3`),children:[P?(0,E.jsx)(u,{size:16,className:`animate-spin`}):null,` `,R(K?`Start`:`Add a model to start`),` `,(0,E.jsx)(h,{size:16})]}),w===`model`&&(0,E.jsxs)(`button`,{type:`button`,disabled:!K,onClick:()=>D(`list`),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1 py-3`),children:[R(K?`Done`:`Save a model to continue`),` `,(0,E.jsx)(h,{size:16})]}),w===`connect`&&(0,E.jsxs)(`button`,{type:`button`,onClick:()=>D(`list`),className:e(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`flex-1 py-3`),children:[R(q?`Done`:`Skip for now`),` `,(0,E.jsx)(h,{size:16})]})]})]})}function O({n:e,title:t,body:n}){return(0,E.jsxs)(`li`,{className:`flex gap-3 rounded-3xl bg-surface border border-border/70 p-4`,children:[(0,E.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-accent/12 text-[13px] font-semibold text-accent`,children:e}),(0,E.jsxs)(`div`,{className:`text-[13.5px] leading-relaxed`,children:[(0,E.jsx)(`div`,{className:`font-medium text-fg`,children:t}),(0,E.jsx)(`div`,{className:`text-muted`,children:n})]})]})}function k({done:t,locked:r,optional:i,title:a,body:o,onClick:s}){let c=n();return(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,onClick:s,disabled:r,"aria-disabled":r,className:e(`w-full flex items-center gap-3 rounded-3xl border px-4 py-3.5 text-left transition-colors`,t?`border-accent/30 bg-accent/5`:`border-border/70 bg-surface`,r&&`opacity-50`),children:[(0,E.jsx)(`span`,{className:e(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full`,t?`bg-accent text-white`:r?`bg-surface-2 text-muted`:`border border-border text-muted`),children:t?(0,E.jsx)(p,{size:15,strokeWidth:3}):r?(0,E.jsx)(w,{size:13}):null}),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,E.jsxs)(`span`,{className:`flex items-center gap-2 text-[15px] font-medium`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:a}),i&&(0,E.jsx)(`span`,{className:`rounded-full bg-surface-2 px-2 py-0.5 text-[10.5px] font-medium text-muted`,children:c(`optional`)})]}),(0,E.jsx)(`span`,{className:`block truncate text-[12.5px] text-muted`,children:o})]}),!r&&(0,E.jsx)(g,{size:16,className:`shrink-0 text-muted`})]})})}function A(e){try{return new URL(e).host}catch{return e}}function j(e){return Object.entries(e.providers).find(([t,n])=>t!==`custom`&&n.base_url&&e.llm.base_url.startsWith(n.base_url))?.[0]??`custom`}export{D as Onboarding};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/SettingsScreen-DoXURXet.js b/nanomuse/server/static/assets/SettingsScreen-CHVg61To.js
similarity index 99%
rename from nanomuse/server/static/assets/SettingsScreen-DoXURXet.js
rename to nanomuse/server/static/assets/SettingsScreen-CHVg61To.js
index fc3ab82fd..1761d74a0 100644
--- a/nanomuse/server/static/assets/SettingsScreen-DoXURXet.js
+++ b/nanomuse/server/static/assets/SettingsScreen-CHVg61To.js
@@ -1 +1 @@
-import{A as e,E as t,F as n,G as r,H as i,J as a,K as o,L as s,Q as c,T as l,Y as u,_ as d,a as f,b as p,f as m,g as h,h as g,m as _,v,x as y}from"./MuseHeader-Pw-NI98v.js";import{C as b,E as ee,T as te,_ as x,j as S,u as C,w}from"./StarNudge-DjXecvWj.js";import{n as ne}from"./external-link-Xj5fjR8v.js";import{n as T}from"./Form-DwKuBk1V.js";import{t as E}from"./clapperboard-BokpXv9J.js";import{t as re}from"./database-zap-CzaFBl6C.js";import{t as D}from"./plug-Bj_5EEV3.js";import{n as ie,r as O,t as ae}from"./IdentityForm-Dhx4FiQY.js";import{D as k,E as A,K as j,L as M,M as oe,O as se,R as N,St as P,U as ce,W as F,_t as I,a as L,at as R,bt as z,ct as le,d as ue,dt as B,ft as V,i as H,k as de,n as fe,nt as U,o as W,q as G,r as pe,rt as me,s as K,tt as he,u as ge,vt as _e,wt as ve}from"./index-BjYzdKkG.js";import{t as q}from"./BackBar-Dli0L0O_.js";import{t as J}from"./AvatarPicker-oSjVM8L3.js";var ye=a(`battery-full`,[[`path`,{d:`M10 10v4`,key:`1mb2ec`}],[`path`,{d:`M14 10v4`,key:`1nt88p`}],[`path`,{d:`M22 14v-4`,key:`14q9d5`}],[`path`,{d:`M6 10v4`,key:`1n77qd`}],[`rect`,{x:`2`,y:`6`,width:`16`,height:`12`,rx:`2`,key:`13zb55`}]]),be=a(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),xe=a(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Se=a(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),Ce=a(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),we=a(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Te=a(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),Ee=a(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Y=c(u(),1),De=`(min-width: 64rem)`;function Oe(){return typeof window>`u`?!1:document.documentElement.classList.contains(`desktop`)?!0:typeof window.matchMedia==`function`&&window.matchMedia(De).matches}function ke(){let[e,t]=(0,Y.useState)(Oe);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(De),n=()=>t(Oe());return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var X=p(),Ae=`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 outline-none focus:ring-2 focus:ring-accent/40`,je=[{id:`ask`,title:`Balanced`,text:`Browse, read and write files freely; stop for anything hard to undo: email, purchases, shell commands.`,icon:(0,X.jsx)(j,{size:18})},{id:`strict`,title:`Cautious`,text:`Also ask before moderate actions like fetching web pages or writing files.`,icon:(0,X.jsx)(we,{size:18})},{id:`auto`,title:`Hands-off`,text:`Approve everything automatically except explicit deny rules. For trusted, unattended runs only.`,icon:(0,X.jsx)(G,{size:18})}];function Me(){let{state:e,refreshSettings:a,setTab:s,toast:c}=m(),u=e.settings,[d,p]=(0,Y.useState)(()=>O(e.profile,f,J[0])),[h,v]=(0,Y.useState)(!1),b=o(),te=r(),x=g(),[w,E]=(0,Y.useState)(null),[re,D]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{u||a()},[u,a]);let j=(0,Y.useCallback)(async(e=!1)=>{D(!0);try{E(await y.update(e))}catch{E(null)}finally{D(!1)}},[]);(0,Y.useEffect)(()=>{j()},[j]),(0,Y.useEffect)(()=>{e.profile&&p(O(e.profile,``,J[0]))},[e.profile]);let M=async(e,t)=>{v(!0);try{await y.updateSettings(e),await a(),t&&c(t)}catch(e){c(e.message)}finally{v(!1)}},P=O(e.profile,``,J[0]),ce=!!e.profile&&Object.keys(d).some(e=>d[e]!==P[e]),F=e.profile?.name??`nanoMuse`,I=de(),L=ue(),R=ke()&&!e.lite,[B,V]=(0,Y.useState)(null),H=[{id:`who`,title:F},{id:`sentinel`,title:b(`Safety · Sentinel`)},{id:`proactivity`,title:b(`Proactivity`)},{id:`notifications`,title:b(`Notifications`)},...k()?[{id:`keep-running`,title:b(`Keep it running`)}]:[],{id:`model`,title:b(`Model`)},{id:`appearance`,title:b(`Appearance`)},...N()?[{id:`desktop`,title:b(`Desktop app`)}]:[],{id:`data`,title:b(`Data controls`)},{id:`developer`,title:b(`Developer`)},{id:`about`,title:b(`About`)}],U=e=>R||B===e,[W,G]=(0,Y.useState)(()=>{let e=window.location.hash.slice(1);return Ne.includes(e)?e:null});if((0,Y.useEffect)(()=>{if(W&&u){if(G(null),history.replaceState(null,``,window.location.pathname+window.location.search),!R){V(W);return}requestAnimationFrame(()=>document.getElementById(W)?.scrollIntoView({behavior:`smooth`,block:`start`}))}},[W,u,R]),!R&&B===null)return(0,X.jsx)(Fe,{release:w,onOpen:V});let pe=H.find(e=>e.id===B);return(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[R?(0,X.jsx)(q,{title:b(`Settings`),description:b(`Its name and look, how careful it is, how often it speaks up.`)}):(0,X.jsx)(q,{title:pe?.title??b(`Settings`),onBack:()=>V(null),backLabel:b(`Settings`)}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[R&&(0,X.jsx)(`nav`,{className:`flex w-[188px] shrink-0 flex-col gap-0.5 self-start pl-4 pr-2 pt-1`,"aria-label":b(`Settings`),children:H.map(e=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>document.getElementById(e.id)?.scrollIntoView({behavior:`smooth`,block:`start`}),className:`truncate rounded-xl px-3 py-1.5 text-left text-[13px] font-medium text-fg/75 hover:bg-surface-2 hover:text-fg`,children:e.title},e.id))}),(0,X.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-5`,children:[U(`who`)&&(0,X.jsxs)($,{title:F,id:`who`,plain:!R,children:[(0,X.jsx)(ae,{value:d,onChange:p,suggestions:!1,inputCls:Ae,onStudio:()=>s(`avatar`)}),(0,X.jsx)(`button`,{type:`button`,disabled:!ce||h,onClick:()=>void M({profile:ie(d)},b(`Saved`)),className:`w-full rounded-2xl bg-accent text-accent-fg py-2.5 font-medium disabled:opacity-40`,children:b(`Save`)})]}),U(`sentinel`)&&(0,X.jsxs)($,{title:b(`Safety · Sentinel`),id:`sentinel`,plain:!R,children:[(0,X.jsx)(`p`,{className:`text-[13px] text-muted -mt-1`,children:b(`A separate gatekeeper reviews every action. Pick how often it should check in with you.`)}),(0,X.jsx)(`div`,{className:`space-y-2`,children:je.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>void M({sentinel_mode:e.id}),"aria-pressed":u?.sentinel.mode===e.id,className:t(`w-full text-left rounded-2xl border px-3.5 py-3 flex items-start gap-3 transition`,u?.sentinel.mode===e.id?`border-accent bg-accent/8`:`border-border`),children:[(0,X.jsx)(`div`,{className:t(`mt-0.5`,e.id===`auto`?`text-rose-500`:`text-accent`),children:e.icon}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`font-medium text-[14.5px]`,children:b(e.title)}),(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted leading-snug mt-0.5`,children:b(e.text)})]}),u?.sentinel.mode===e.id&&(0,X.jsx)(ne,{size:18,className:`text-accent mt-0.5`})]},e.id))}),u&&(0,X.jsxs)(`div`,{className:`text-[12.5px] text-muted leading-relaxed`,children:[b(`Always asks before: {tools}.`,{tools:u.sentinel.always_ask_tools.map(e=>b(e)).join(`, `)||`—`}),` `,u.sentinel.taint_tracking&&b(`After reading private data, new network destinations need approval.`)]}),u?.sandbox&&(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2/60 px-3.5 py-2.5 text-[12.5px] leading-snug`,children:[(0,X.jsx)(be,{size:15,className:t(`shrink-0 mt-[2px]`,u.sandbox.active?`text-emerald-500`:`text-muted`)}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`font-medium text-fg`,children:[u.sandbox.active?b(`Commands run in a sandbox`):b(`Commands run without a sandbox`),(0,X.jsxs)(`span`,{className:`text-muted font-normal`,children:[` · `,u.sandbox.status]})]}),(0,X.jsx)(`div`,{className:`text-muted mt-0.5`,children:u.sandbox.active?b(`Each shell or Python call gets its own namespace: only the workspace is writable, your home directory is not there, and there is no network unless the command needs it.`):u.sandbox.status.includes(`container`)?b(`Each shell or Python call runs in the workspace with a scrubbed environment; the container is the boundary.`):b(`Each shell or Python call runs in the workspace with a scrubbed environment. On Linux, installing bubblewrap gives each one its own namespace.`)})]})]})]}),U(`proactivity`)&&(0,X.jsxs)($,{title:b(`Proactivity`),id:`proactivity`,plain:!R,children:[(0,X.jsx)(ze,{value:e.profile?.proactivity??`default`,onChange:e=>void M({profile:{proactivity:e}})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`label`,{className:`text-[13.5px] flex-1`,children:[b(`Check-in interval`),e.profile&&e.profile.proactivity!=="default"&&e.profile.proactivity!==`off`&&(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.profile.proactivity===`low`?b(`Doubled at this level`):b(`Halved at this level`)})]}),(0,X.jsx)(`select`,{value:e.profile?.goal_interval_minutes??60,onChange:e=>void M({profile:{goal_interval_minutes:Number(e.target.value)}}),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:[...new Set([15,30,60,120,240,480,1440,e.profile?.goal_interval_minutes??60])].sort((e,t)=>e-t).map(e=>(0,X.jsx)(`option`,{value:e,children:e<60?b(`{n} min`,{n:e}):e%60?`${b(`{n} h`,{n:Math.floor(e/60)})} ${b(`{n} min`,{n:e%60})}`:b(`{n} h`,{n:e/60})},e))})]}),(0,X.jsx)(Be,{value:e.profile?.quiet_hours??``,onChange:e=>void M({profile:{quiet_hours:e}})})]}),U(`notifications`)&&(0,X.jsx)($,{title:b(`Notifications`),id:`notifications`,plain:!R,children:A()?(0,X.jsx)(Ie,{name:e.profile?.name??`nanoMuse`}):(0,X.jsx)(Re,{name:e.profile?.name??`nanoMuse`})}),k()&&U(`keep-running`)&&(0,X.jsx)($,{title:b(`Keep it running`),id:`keep-running`,plain:!R,children:(0,X.jsx)(Le,{name:e.profile?.name??`nanoMuse`})}),U(`model`)&&(0,X.jsxs)($,{title:b(`Model`),id:`model`,plain:!R,children:[u&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(`connections`),className:`w-full text-[13.5px] flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:b(`Provider / model`)}),(0,X.jsxs)(`span`,{className:`font-mono text-[12.5px] flex items-center gap-1`,children:[u.llm.model,` `,(0,X.jsx)(z,{size:14,className:`text-muted`})]})]}),u?.llm.cloud&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>oe(s,S(e.hub?.account).preset),className:`w-full text-[13.5px] flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:b(`Use my own API key or a plan I pay for`)}),(0,X.jsxs)(`span`,{className:`text-[12.5px] text-muted flex items-center gap-1`,children:[b(`{first} first, then {others}`,{first:S(e.hub?.account).label,others:ee(e.hub?.account)?b(`DeepSeek, Kimi, OpenAI, ChatGPT…`):b(`OpenAI, ChatGPT, Gemini, DeepSeek…`)}),` `,(0,X.jsx)(z,{size:14})]})]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(`connections`),className:`w-full text-[13.5px] flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:b(`Connections`)}),(0,X.jsxs)(`span`,{className:`text-[12.5px] text-muted flex items-center gap-1`,children:[b(`E-mail, calendar, browser, MCP servers`),` `,(0,X.jsx)(z,{size:14})]})]})]}),U(`appearance`)&&(0,X.jsxs)($,{title:b(`Appearance`),id:`appearance`,plain:!R,children:[(0,X.jsx)(T,{label:b(`Show the agent's steps`),hint:b(`Every tool it uses becomes a chip in the chat. Off, the chat keeps to the conversation and the line under the name says what it is on. This device only.`),checked:L,onChange:ge}),(0,X.jsx)(T,{label:b(`Show thinking`),hint:b(`Reveal the model's reasoning under each reply when the provider exposes it.`),checked:!!u?.agent.show_thinking,onChange:e=>void M({show_thinking:e})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`label`,{className:`text-[13.5px] flex-1`,children:[b(`Appearance`),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:b(`This device only`)})]}),(0,X.jsxs)(`select`,{value:x,onChange:e=>_(e.target.value),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:[(0,X.jsx)(`option`,{value:`light`,children:b(`Light`)}),(0,X.jsx)(`option`,{value:`dark`,children:b(`Dark`)}),(0,X.jsx)(`option`,{value:`system`,children:b(`Follow the system`)})]})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`label`,{className:`text-[13.5px] flex-1`,children:[b(`App language`),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:b(`This device only`)})]}),(0,X.jsx)(`select`,{value:te,onChange:e=>i(e.target.value),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:n.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.value===`auto`?b(`Auto`):e.label},e.value))})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`label`,{className:`text-[13.5px] flex-1`,children:[b(`Reply language`),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:b(`What {name} writes in`,{name:e.profile?.name??`nanoMuse`})})]}),(0,X.jsxs)(`select`,{value:u?.agent.language??`auto`,onChange:e=>void M({language:e.target.value}),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:[(0,X.jsx)(`option`,{value:`auto`,children:b(`Match mine`)}),(0,X.jsx)(`option`,{value:`English`,children:`English`}),(0,X.jsx)(`option`,{value:`中文`,children:`中文`}),(0,X.jsx)(`option`,{value:`日本語`,children:`日本語`}),(0,X.jsx)(`option`,{value:`Español`,children:`Español`}),(0,X.jsx)(`option`,{value:`Deutsch`,children:`Deutsch`}),(0,X.jsx)(`option`,{value:`Français`,children:`Français`})]})]})]}),N()&&U(`desktop`)&&(0,X.jsx)($,{title:b(`Desktop app`),id:`desktop`,plain:!R,children:(0,X.jsx)(Ve,{})}),U(`data`)&&(0,X.jsx)($,{title:b(`Data controls`),id:`data`,plain:!R,children:(0,X.jsx)(fe,{flush:!0})}),U(`developer`)&&(0,X.jsxs)($,{title:b(`Developer`),id:`developer`,plain:!R,children:[(0,X.jsx)(T,{label:b(`Developer tools`),hint:b(`The Coding screen (Cursor, Codex and the other coding agents on this computer) in the sidebar, and the runtime's address below. This device only.`),checked:I,onChange:se}),I&&(0,X.jsxs)(`div`,{className:`text-[13px] text-muted space-y-1`,children:[(0,X.jsxs)(`div`,{className:`break-all`,children:[b(`Runtime:`),` `,window.location.origin,` · `,(0,X.jsx)(`span`,{className:`text-fg/70`,children:b(`the token is in the server_token file in the data folder`)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`a`,{href:`https://github.com/nano-muse/nanoMuse/blob/main/docs/cli.md`,target:`_blank`,rel:`noreferrer`,className:`text-accent underline-offset-2 hover:underline`,children:b(`The command line and the API`)}),` · `,(0,X.jsx)(`a`,{href:`https://github.com/nano-muse/nanoMuse/blob/main/docs/harness.md`,target:`_blank`,rel:`noreferrer`,className:`text-accent underline-offset-2 hover:underline`,children:b(`nanoMuse on DeepSeek Harness`)})]})]})]}),U(`about`)&&(0,X.jsxs)($,{title:b(`About`),id:`about`,plain:!R,children:[(0,X.jsx)(C,{}),(0,X.jsx)(Pe,{installed:e.version,release:w,checking:re,onCheck:()=>void j(!0)}),(0,X.jsxs)(`div`,{className:`text-[13px] text-muted space-y-1`,children:[u&&(0,X.jsxs)(`div`,{className:`break-all`,children:[b(`Data:`),` `,u.data_dir]}),u&&(0,X.jsxs)(`div`,{className:`break-all`,children:[b(`Workspace:`),` `,u.agent.workspace]}),(0,X.jsx)(`div`,{children:e.connected?b(`Connected`):b(`Reconnecting…`)})]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{let e=A();if(e){e.disconnect();return}l(``),window.location.reload()},className:`w-full rounded-2xl border border-border py-2.5 text-[14px] font-medium flex items-center justify-center gap-2 text-muted`,children:[(0,X.jsx)(le,{size:16}),` `,A()?b(`Disconnect from this server`):b(`Forget this device's access token`)]})]})]})]})]})}var Ne=[`who`,`sentinel`,`proactivity`,`notifications`,`keep-running`,`model`,`appearance`,`desktop`,`data`,`developer`,`about`];function Pe({installed:t,release:n,checking:r,onCheck:i}){let a=o(),s=!!A(),c=(0,X.jsx)(`button`,{type:`button`,onClick:i,disabled:r,className:`text-accent underline-offset-2 hover:underline disabled:opacity-60`,children:a(r?`Checking…`:`Check now`)}),l;return l=s?a(`The phone app checks for updates on its own.`):n&&!n.enabled?a(`Update checks are off here.`):r&&!n?a(`Checking…`):n?.latest&&n.newer?(0,X.jsxs)(X.Fragment,{children:[a(`{version} is out`,{version:n.latest}),` · `,(0,X.jsx)(`a`,{href:n.download_url||n.url,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent underline-offset-2 hover:underline`,children:a(`Update`)})]}):n?.latest?(0,X.jsxs)(X.Fragment,{children:[a(`Latest {version}; you have it`,{version:n.latest}),` · `,c]}):(0,X.jsxs)(X.Fragment,{children:[a(`Could not check`),` · `,c]}),(0,X.jsxs)(`div`,{className:`rounded-2xl bg-surface-2/60 px-3.5 py-2.5 text-[13px]`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:a(`nanoMuse {version}`,{version:t})}),(0,X.jsx)(`div`,{className:`mt-0.5 text-muted`,children:l}),!s&&n?.latest&&n.newer&&(0,X.jsx)(`div`,{className:`mt-1 text-[12px] text-muted`,children:a(`To update: pip install -U nanomuse, pull the new image, or use the desktop app's Update.`)}),!s&&n?.checked_at&&(0,X.jsx)(`div`,{className:`mt-1 text-[12px] text-muted`,children:a(`Checked {when}`,{when:e(n.checked_at)})})]})}function Fe({release:e,onOpen:t}){let{state:n,setTab:r}=m(),i=o(),a=n.settings,c=n.hub,l=te(),u=n.profile?.name??`nanoMuse`,d=g(),f=c?.devices.filter(e=>!e.this&&e.kind!==`web`)??[],p=f.filter(e=>e.kind===`computer`),h=f.filter(e=>e.online&&e.actions?.includes(`coding.sessions`)),_=a?.sentinel.mode,v=_===`ask`?i(`Balanced`):_===`strict`?i(`Cautious`):_===`auto`?i(`Hands-off`):``,y=n.profile?.proactivity??`default`,ee=i(y===`off`?`Off`:y===`low`?`Low`:y===`high`?`High`:`Default`),S=i(d===`dark`?`Dark`:d===`light`?`Light`:`Follow the system`),C=i(`none`);return(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,X.jsx)(q,{title:i(`Settings`)}),(0,X.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-8 pt-2`,children:[(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(`connections`),className:`flex w-full items-center gap-3 px-4 py-3.5 text-left hover:bg-surface-2/60`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate text-[16px] font-medium leading-[21px]`,children:a?.llm.model||i(`No model yet`)}),(0,X.jsx)(`span`,{className:`mt-0.5 block truncate text-[12.5px] leading-4 text-muted`,children:a?a.llm.cloud?`nanoMuse Cloud`:a.llm.provider:i(`Add a provider and pick its models`)})]}),(0,X.jsx)(`span`,{className:`text-[14px] font-medium text-accent`,children:i(`Change`)})]}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(_e,{size:22}),label:`nanoMuse Cloud`,value:c?.account.signed_in?c.account.hint:i(`Sign in`),onClick:()=>r(`account`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(E,{size:22}),label:i(`Image & video models`),value:x(l,`image`)===!1?w(i,`image`,b(c?.account),s()):x(l,`video`)===!1?w(i,`video`,b(c?.account),s()):void 0,onClick:()=>r(`connections`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(xe,{size:22}),label:i(`Usage`),onClick:()=>r(`account`)})]}),(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsx)(K,{icon:(0,X.jsx)(F,{size:22}),label:i(`Name & personality`),value:u,onClick:()=>t(`who`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(Te,{size:22}),label:i(`Avatar`),onClick:()=>r(`avatar`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(P,{size:22}),label:i(`Memory`),onClick:()=>r(`memory`)}),a?.skills?.enabled!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(Ce,{size:22}),label:i(`Skills`),value:a?String(a.skills.count):void 0,onClick:()=>r(`skills`)})]}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(D,{size:22}),label:i(`Connections`),value:a?.connectors.mcp.length?`${a.connectors.mcp.length} MCP`:void 0,onClick:()=>r(`connections`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(R,{size:22}),label:i(`Chat apps`),onClick:()=>r(`channels`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(me,{size:22}),label:i(`Devices`),value:p.length?String(p.length):C,onClick:()=>r(`devices`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(ce,{size:22}),label:i(`Coding agents`),value:h.length?String(h.length):C,onClick:()=>r(`coding`)})]}),(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsx)(K,{icon:(0,X.jsx)(j,{size:22}),label:i(`Safety · Sentinel`),value:v,onClick:()=>t(`sentinel`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(Ee,{size:22}),label:i(`Proactivity`),value:ee,onClick:()=>t(`proactivity`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(ve,{size:22}),label:i(`Notifications`),onClick:()=>t(`notifications`)}),k()&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(ye,{size:22}),label:i(`Keep it running`),onClick:()=>t(`keep-running`)})]})]}),(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsx)(K,{icon:(0,X.jsx)(he,{size:22}),label:i(`Appearance`),value:S,onClick:()=>t(`appearance`)}),N()&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(me,{size:22}),label:i(`Desktop app`),onClick:()=>t(`desktop`)})]}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(re,{size:22}),label:i(`Data controls`),onClick:()=>t(`data`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(I,{size:22}),label:i(`Developer`),onClick:()=>t(`developer`)})]}),(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsx)(K,{icon:(0,X.jsx)(B,{size:22}),label:i(`About nanoMuse`),value:e?.newer&&e.latest?i(`{version} is out`,{version:e.latest}):void 0,onClick:()=>t(`about`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(V,{size:22}),label:i(`Privacy policy`),onClick:()=>window.open(pe,`_blank`,`noopener`),external:!0}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(Se,{size:22}),label:i(`Feedback`),onClick:()=>window.open(`https://github.com/nano-muse/nanoMuse/issues/new/choose`,`_blank`,`noopener`),external:!0})]}),(0,X.jsxs)(H,{children:[`nanoMuse `,n.version]})]})]})}function Ie({name:e}){let t=o(),n=A(),[r,i]=(0,Y.useState)(()=>n?.notificationsEnabled()??!1);return n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(T,{label:t(`Let {name} notify this phone`,{name:e}),hint:t(`The app stays connected to your server in the background. Approvals, questions and finished background work arrive as notifications and open the right chat.`),checked:r,onChange:e=>{n.setNotificationsEnabled(e),i(e)}}),(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:t(`nanoMuse for Android {version}`,{version:n.version()})})]}):null}function Le({name:e}){let t=o(),n=A(),[r,i]=(0,Y.useState)(k);if((0,Y.useEffect)(()=>{let e=()=>i(k());return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,e)}},[]),!n||!r)return null;let a=e=>n.openKeepRunning?.(e),s={xiaomi:t(`Xiaomi / Redmi / POCO: Settings → Apps → Manage apps → {name} → Autostart on; Battery saver → No restrictions; Other permissions → Display pop-up windows while running in the background on.`),huawei:t(`Huawei: Settings → Battery → App launch → {name} → Manage manually, all three on (auto-launch, secondary launch, run in background); Settings → Apps → {name} → Battery → Launch: manage manually.`),honor:t(`Honor: Settings → Battery → App launch → {name} → Manage manually, all three on; Battery → More battery settings → Stay connected while asleep on.`),oppo:t(`OPPO / realme / OnePlus: Settings → Battery → More settings → Optimise battery use → {name} → Don't optimise; Settings → Apps → {name} → Battery usage → Allow background activity, Allow auto launch.`),vivo:t(`vivo / iQOO: i Manager → App manager → Autostart → {name} on; Settings → Battery → Background power consumption management → {name} → Allow high background power consumption.`),samsung:t(`Samsung: Settings → Battery → Background usage limits → {name} not in Sleeping or Deep sleeping apps (add it to Never sleeping apps); turn off Adaptive battery if it keeps stopping.`),meizu:t(`Meizu: Settings → Apps → {name} → Background management → Keep running in the background; Battery → App power management → Allow.`)}[r.vendor];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`text-[12.5px] text-muted leading-snug`,children:t(`Android stops apps that seem idle. {name} runs as a foreground service and holds the phone awake only while a task runs; these switches let it keep that promise on this phone.`,{name:e})}),(0,X.jsx)(Z,{label:t(`Battery`),value:r.battery_unrestricted?t(`Unrestricted`):t(`Optimised`),ok:r.battery_unrestricted,hint:t(`Optimised means Android may freeze the agent after a while with the screen off; routines and check-ins then wait until the phone wakes.`),action:r.battery_unrestricted?void 0:{label:t(`Allow`),onClick:()=>a(`battery`)}}),(0,X.jsx)(Z,{label:t(`Display over other apps`),value:r.overlay?t(`Allowed`):t(`Not allowed`),ok:r.overlay,hint:t(`Lets the agent bring an app to the front from the background and show its status capsule while it works in other apps.`),action:r.overlay?void 0:{label:t(`Allow`),onClick:()=>a(`overlay`)}}),r.exact_alarms!==`n/a`&&r.local&&(0,X.jsx)(Z,{label:t(`Alarms & reminders`),value:r.exact_alarms===`granted`?t(`Exact`):t(`Approximate`),ok:r.exact_alarms===`granted`,hint:t(`With exact alarms a reminder fires at the minute you named even when the phone is asleep; without them Android may deliver it up to a quarter of an hour late.`),action:r.exact_alarms===`granted`?void 0:{label:t(`Allow`),onClick:()=>a(`alarms`)}}),(0,X.jsx)(T,{label:t(`Start after a reboot`),hint:r.local?t(`Bring the runtime back when the phone restarts, so routines and check-ins do not stop.`):t(`Reconnect to your computer when the phone restarts, so approvals keep arriving.`),checked:r.boot_start,onChange:e=>{n.setStartOnBoot?.(e),i({...r,boot_start:e})}}),s&&(0,X.jsxs)(`div`,{className:`rounded-2xl bg-surface-2 px-3 py-2.5 text-[12.5px] leading-snug space-y-2`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:t(`On this phone's Android`)}),(0,X.jsx)(`div`,{className:`text-muted`,children:s}),r.autostart_settings&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>a(`autostart`),className:`rounded-full border border-border px-3 py-1.5 text-[12.5px]`,children:t(`Open the auto-start settings`)})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted leading-snug`,children:t(`Crashes are written to a file on this phone and nowhere else. Export bundles them with the runtime's log for someone you choose.`)}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>n.exportLogs?.(),className:`shrink-0 rounded-full border border-border px-3 py-1.5 text-[12.5px]`,children:t(`Export logs`)})]})]})}function Z({label:e,value:n,ok:r,hint:i,action:a}){return(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,r?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/15 text-amber-700 dark:text-amber-300`),children:n})]}),i&&(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted leading-snug`,children:i})]}),a&&(0,X.jsx)(`button`,{type:`button`,onClick:a.onClick,className:`shrink-0 rounded-full bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white`,children:a.label})]})}function Re({name:e}){let{toast:t}=m(),[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(`off`),[s,c]=(0,Y.useState)(!1),l=o(),u=async()=>{a(await v());try{r(await y.push())}catch{}};(0,Y.useEffect)(()=>{u()},[]);let f=async()=>{if(n){c(!0);try{let e=i===`on`?await h():await d(n.public_key);a(e),e===`denied`&&t(l(`Notifications are blocked for this site in the browser settings`)),await u()}catch(e){let n=e;t(n.name===`AbortError`?l(`This browser has no push service (embedded browsers often don't). Use Chrome, Edge, Firefox or Safari 16.4+ on the phone.`):n.message)}finally{c(!1)}}},p=async()=>{try{let e=await y.pushTest();t(e.ok?l(`Sent. It should arrive in a moment`):e.error??l(`Could not send`))}catch(e){t(e.message)}},g=i===`unsupported`?l(`This browser cannot receive push notifications.`):i===`insecure`?l(`Notifications need https:// (or localhost). Over plain http on your LAN the app works, this part stays off; see docs/deployment.md.`):i===`denied`?l(`Blocked for this site. Allow notifications in the browser's site settings, then try again.`):n&&!n.available?l(`The server was installed without pywebpush.`):``;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(T,{label:l(`Let {name} notify this device`,{name:e}),hint:l(`Approvals, questions, finished background work and check-ins; nothing while the app is on screen.`),checked:i===`on`,onChange:()=>void f(),disabled:s||!!g}),g&&(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:g}),n&&n.subscriptions>0&&(0,X.jsxs)(`div`,{className:`flex items-center justify-between text-[12.5px] text-muted`,children:[(0,X.jsx)(`span`,{children:n.subscriptions===1?l(`1 device subscribed`):l(`{n} devices subscribed`,{n:n.subscriptions})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>void p(),className:`text-accent font-medium`,children:l(`Send a test`)})]}),!N()&&(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:l(`On a phone, add the app to the home screen first; the icon then shows a badge and notifications open the right chat.`)})]})}var Q=[{id:`off`,title:`Off`,text:`Only works when you ask.`},{id:`low`,title:`Low`,text:`Checks in half as often; speaks up only when a step is done or it needs you.`},{id:`default`,title:`Default`,text:`Works on goals on schedule; reports real progress, stays quiet otherwise.`},{id:`high`,title:`High`,text:`Checks in twice as often and always reports, even 'still on track'.`}];function ze({value:e,onChange:n}){let r=o(),i=Q.find(t=>t.id===e)??Q[2];return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,X.jsx)(`div`,{className:`flex-1 text-[13px] text-muted leading-snug`,children:r(i.text)})}),(0,X.jsx)(`div`,{className:`mt-2 grid grid-cols-4 gap-1 rounded-2xl bg-surface-2 p-1`,children:Q.map(i=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>n(i.id),"aria-pressed":e===i.id,className:t(`rounded-xl py-1.5 text-[13px] font-medium transition`,e===i.id?`bg-surface shadow-sm text-accent`:`text-muted`),children:r(i.title)},i.id))})]})}function Be({value:e,onChange:n}){let[r,i]=e?e.split(`-`):[``,``],a=!!e,s=o(),c=(e,t)=>n(e&&t?`${e}-${t}`:``);return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer`,children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsxs)(`div`,{className:`text-[14px] flex items-center gap-1.5`,children:[(0,X.jsx)(U,{size:15,className:`text-muted`}),` `,s(`Quiet hours`)]}),(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted leading-snug`,children:s(`No background work in this window; anything due waits until it ends.`)})]}),(0,X.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":a,onClick:()=>c(a?``:`22:00`,a?``:`08:00`),className:t(`relative mt-0.5 h-7 w-12 shrink-0 rounded-full transition`,a?`bg-accent`:`bg-surface-2 border border-border`),children:(0,X.jsx)(`span`,{className:t(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,a?`left-[22px]`:`left-0.5`)})})]}),a&&(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-[13.5px]`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:s(`From`)}),(0,X.jsx)(`input`,{type:`time`,value:r,onChange:e=>c(e.target.value,i),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`}),(0,X.jsx)(`span`,{className:`text-muted`,children:s(`to`)}),(0,X.jsx)(`input`,{type:`time`,value:i,onChange:e=>c(r,e.target.value),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`})]})]})}function Ve(){let e=o(),t=M(),[n,r]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let e=!0;return t?.loginItem?.().then(t=>{e&&r(t)}),()=>{e=!1}},[t]);let i=t?.platform===`darwin`,a=[[e(`Quick chat`),i?`⌥ Space`:`Ctrl+Shift+Space`],[e(`Show the window`),i?`⌘⇧M`:`Ctrl+Shift+M`],[e(`Stop the hands`),i?`⌘⇧Esc`:`Ctrl+Shift+Esc`]];return(0,X.jsxs)(X.Fragment,{children:[t?.setLoginItem&&n!==null&&t.platform!==`linux`&&(0,X.jsx)(T,{label:e(`Start with the computer`),hint:e(`Opens in the tray at sign-in; the agent's goals and check-ins run from then on.`),checked:n,onChange:e=>{r(e),t.setLoginItem?.(e)}}),(0,X.jsxs)(`div`,{className:`text-[13.5px]`,children:[e(`In the tray`),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e(`The icon by the clock shows what the hands are doing and has Stop; closing the window keeps the agent running.`)})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`text-[13.5px]`,children:e(`Shortcuts`)}),a.map(([e,t])=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:e}),(0,X.jsx)(`kbd`,{className:`rounded-md border border-border bg-surface-2 px-1.5 py-0.5 font-sans text-[12px] text-fg/80`,children:t})]},e))]})]})}function $({title:e,children:n,id:r,plain:i=!1}){return(0,X.jsxs)(`section`,{id:r,className:t(`space-y-3 scroll-mt-4`,i?`pt-1`:`rounded-3xl bg-surface border border-border/70 shadow-sm p-4`),children:[!i&&(0,X.jsx)(`h2`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted`,children:e}),n]})}export{Me as SettingsScreen};
\ No newline at end of file
+import{A as e,E as t,F as n,G as r,H as i,J as a,K as o,L as s,Q as c,T as l,Y as u,_ as d,a as f,b as p,f as m,g as h,h as g,m as _,v,x as y}from"./MuseHeader-Pw-NI98v.js";import{C as b,E as ee,T as te,_ as x,j as S,u as C,w}from"./StarNudge-DjXecvWj.js";import{n as ne}from"./external-link-Xj5fjR8v.js";import{n as T}from"./Form-DwKuBk1V.js";import{t as E}from"./clapperboard-BokpXv9J.js";import{t as re}from"./database-zap-CzaFBl6C.js";import{t as D}from"./plug-Bj_5EEV3.js";import{n as ie,r as O,t as ae}from"./IdentityForm-BTGczGT_.js";import{D as k,E as A,K as j,L as M,M as oe,O as se,R as N,St as P,U as ce,W as F,_t as I,a as L,at as R,bt as z,ct as le,d as ue,dt as B,ft as V,i as H,k as de,n as fe,nt as U,o as W,q as G,r as pe,rt as me,s as K,tt as he,u as ge,vt as _e,wt as ve}from"./index-CIdGZ5PB.js";import{t as q}from"./BackBar-Dl56jHZM.js";import{t as J}from"./AvatarPicker-gR2knlot.js";var ye=a(`battery-full`,[[`path`,{d:`M10 10v4`,key:`1mb2ec`}],[`path`,{d:`M14 10v4`,key:`1nt88p`}],[`path`,{d:`M22 14v-4`,key:`14q9d5`}],[`path`,{d:`M6 10v4`,key:`1n77qd`}],[`rect`,{x:`2`,y:`6`,width:`16`,height:`12`,rx:`2`,key:`13zb55`}]]),be=a(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),xe=a(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Se=a(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),Ce=a(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),we=a(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Te=a(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),Ee=a(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Y=c(u(),1),De=`(min-width: 64rem)`;function Oe(){return typeof window>`u`?!1:document.documentElement.classList.contains(`desktop`)?!0:typeof window.matchMedia==`function`&&window.matchMedia(De).matches}function ke(){let[e,t]=(0,Y.useState)(Oe);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(De),n=()=>t(Oe());return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var X=p(),Ae=`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 outline-none focus:ring-2 focus:ring-accent/40`,je=[{id:`ask`,title:`Balanced`,text:`Browse, read and write files freely; stop for anything hard to undo: email, purchases, shell commands.`,icon:(0,X.jsx)(j,{size:18})},{id:`strict`,title:`Cautious`,text:`Also ask before moderate actions like fetching web pages or writing files.`,icon:(0,X.jsx)(we,{size:18})},{id:`auto`,title:`Hands-off`,text:`Approve everything automatically except explicit deny rules. For trusted, unattended runs only.`,icon:(0,X.jsx)(G,{size:18})}];function Me(){let{state:e,refreshSettings:a,setTab:s,toast:c}=m(),u=e.settings,[d,p]=(0,Y.useState)(()=>O(e.profile,f,J[0])),[h,v]=(0,Y.useState)(!1),b=o(),te=r(),x=g(),[w,E]=(0,Y.useState)(null),[re,D]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{u||a()},[u,a]);let j=(0,Y.useCallback)(async(e=!1)=>{D(!0);try{E(await y.update(e))}catch{E(null)}finally{D(!1)}},[]);(0,Y.useEffect)(()=>{j()},[j]),(0,Y.useEffect)(()=>{e.profile&&p(O(e.profile,``,J[0]))},[e.profile]);let M=async(e,t)=>{v(!0);try{await y.updateSettings(e),await a(),t&&c(t)}catch(e){c(e.message)}finally{v(!1)}},P=O(e.profile,``,J[0]),ce=!!e.profile&&Object.keys(d).some(e=>d[e]!==P[e]),F=e.profile?.name??`nanoMuse`,I=de(),L=ue(),R=ke()&&!e.lite,[B,V]=(0,Y.useState)(null),H=[{id:`who`,title:F},{id:`sentinel`,title:b(`Safety · Sentinel`)},{id:`proactivity`,title:b(`Proactivity`)},{id:`notifications`,title:b(`Notifications`)},...k()?[{id:`keep-running`,title:b(`Keep it running`)}]:[],{id:`model`,title:b(`Model`)},{id:`appearance`,title:b(`Appearance`)},...N()?[{id:`desktop`,title:b(`Desktop app`)}]:[],{id:`data`,title:b(`Data controls`)},{id:`developer`,title:b(`Developer`)},{id:`about`,title:b(`About`)}],U=e=>R||B===e,[W,G]=(0,Y.useState)(()=>{let e=window.location.hash.slice(1);return Ne.includes(e)?e:null});if((0,Y.useEffect)(()=>{if(W&&u){if(G(null),history.replaceState(null,``,window.location.pathname+window.location.search),!R){V(W);return}requestAnimationFrame(()=>document.getElementById(W)?.scrollIntoView({behavior:`smooth`,block:`start`}))}},[W,u,R]),!R&&B===null)return(0,X.jsx)(Fe,{release:w,onOpen:V});let pe=H.find(e=>e.id===B);return(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[R?(0,X.jsx)(q,{title:b(`Settings`),description:b(`Its name and look, how careful it is, how often it speaks up.`)}):(0,X.jsx)(q,{title:pe?.title??b(`Settings`),onBack:()=>V(null),backLabel:b(`Settings`)}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[R&&(0,X.jsx)(`nav`,{className:`flex w-[188px] shrink-0 flex-col gap-0.5 self-start pl-4 pr-2 pt-1`,"aria-label":b(`Settings`),children:H.map(e=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>document.getElementById(e.id)?.scrollIntoView({behavior:`smooth`,block:`start`}),className:`truncate rounded-xl px-3 py-1.5 text-left text-[13px] font-medium text-fg/75 hover:bg-surface-2 hover:text-fg`,children:e.title},e.id))}),(0,X.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-8 space-y-5`,children:[U(`who`)&&(0,X.jsxs)($,{title:F,id:`who`,plain:!R,children:[(0,X.jsx)(ae,{value:d,onChange:p,suggestions:!1,inputCls:Ae,onStudio:()=>s(`avatar`)}),(0,X.jsx)(`button`,{type:`button`,disabled:!ce||h,onClick:()=>void M({profile:ie(d)},b(`Saved`)),className:`w-full rounded-2xl bg-accent text-accent-fg py-2.5 font-medium disabled:opacity-40`,children:b(`Save`)})]}),U(`sentinel`)&&(0,X.jsxs)($,{title:b(`Safety · Sentinel`),id:`sentinel`,plain:!R,children:[(0,X.jsx)(`p`,{className:`text-[13px] text-muted -mt-1`,children:b(`A separate gatekeeper reviews every action. Pick how often it should check in with you.`)}),(0,X.jsx)(`div`,{className:`space-y-2`,children:je.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>void M({sentinel_mode:e.id}),"aria-pressed":u?.sentinel.mode===e.id,className:t(`w-full text-left rounded-2xl border px-3.5 py-3 flex items-start gap-3 transition`,u?.sentinel.mode===e.id?`border-accent bg-accent/8`:`border-border`),children:[(0,X.jsx)(`div`,{className:t(`mt-0.5`,e.id===`auto`?`text-rose-500`:`text-accent`),children:e.icon}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`font-medium text-[14.5px]`,children:b(e.title)}),(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted leading-snug mt-0.5`,children:b(e.text)})]}),u?.sentinel.mode===e.id&&(0,X.jsx)(ne,{size:18,className:`text-accent mt-0.5`})]},e.id))}),u&&(0,X.jsxs)(`div`,{className:`text-[12.5px] text-muted leading-relaxed`,children:[b(`Always asks before: {tools}.`,{tools:u.sentinel.always_ask_tools.map(e=>b(e)).join(`, `)||`—`}),` `,u.sentinel.taint_tracking&&b(`After reading private data, new network destinations need approval.`)]}),u?.sandbox&&(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2/60 px-3.5 py-2.5 text-[12.5px] leading-snug`,children:[(0,X.jsx)(be,{size:15,className:t(`shrink-0 mt-[2px]`,u.sandbox.active?`text-emerald-500`:`text-muted`)}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`font-medium text-fg`,children:[u.sandbox.active?b(`Commands run in a sandbox`):b(`Commands run without a sandbox`),(0,X.jsxs)(`span`,{className:`text-muted font-normal`,children:[` · `,u.sandbox.status]})]}),(0,X.jsx)(`div`,{className:`text-muted mt-0.5`,children:u.sandbox.active?b(`Each shell or Python call gets its own namespace: only the workspace is writable, your home directory is not there, and there is no network unless the command needs it.`):u.sandbox.status.includes(`container`)?b(`Each shell or Python call runs in the workspace with a scrubbed environment; the container is the boundary.`):b(`Each shell or Python call runs in the workspace with a scrubbed environment. On Linux, installing bubblewrap gives each one its own namespace.`)})]})]})]}),U(`proactivity`)&&(0,X.jsxs)($,{title:b(`Proactivity`),id:`proactivity`,plain:!R,children:[(0,X.jsx)(ze,{value:e.profile?.proactivity??`default`,onChange:e=>void M({profile:{proactivity:e}})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`label`,{className:`text-[13.5px] flex-1`,children:[b(`Check-in interval`),e.profile&&e.profile.proactivity!=="default"&&e.profile.proactivity!==`off`&&(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.profile.proactivity===`low`?b(`Doubled at this level`):b(`Halved at this level`)})]}),(0,X.jsx)(`select`,{value:e.profile?.goal_interval_minutes??60,onChange:e=>void M({profile:{goal_interval_minutes:Number(e.target.value)}}),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:[...new Set([15,30,60,120,240,480,1440,e.profile?.goal_interval_minutes??60])].sort((e,t)=>e-t).map(e=>(0,X.jsx)(`option`,{value:e,children:e<60?b(`{n} min`,{n:e}):e%60?`${b(`{n} h`,{n:Math.floor(e/60)})} ${b(`{n} min`,{n:e%60})}`:b(`{n} h`,{n:e/60})},e))})]}),(0,X.jsx)(Be,{value:e.profile?.quiet_hours??``,onChange:e=>void M({profile:{quiet_hours:e}})})]}),U(`notifications`)&&(0,X.jsx)($,{title:b(`Notifications`),id:`notifications`,plain:!R,children:A()?(0,X.jsx)(Ie,{name:e.profile?.name??`nanoMuse`}):(0,X.jsx)(Re,{name:e.profile?.name??`nanoMuse`})}),k()&&U(`keep-running`)&&(0,X.jsx)($,{title:b(`Keep it running`),id:`keep-running`,plain:!R,children:(0,X.jsx)(Le,{name:e.profile?.name??`nanoMuse`})}),U(`model`)&&(0,X.jsxs)($,{title:b(`Model`),id:`model`,plain:!R,children:[u&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(`connections`),className:`w-full text-[13.5px] flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:b(`Provider / model`)}),(0,X.jsxs)(`span`,{className:`font-mono text-[12.5px] flex items-center gap-1`,children:[u.llm.model,` `,(0,X.jsx)(z,{size:14,className:`text-muted`})]})]}),u?.llm.cloud&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>oe(s,S(e.hub?.account).preset),className:`w-full text-[13.5px] flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:b(`Use my own API key or a plan I pay for`)}),(0,X.jsxs)(`span`,{className:`text-[12.5px] text-muted flex items-center gap-1`,children:[b(`{first} first, then {others}`,{first:S(e.hub?.account).label,others:ee(e.hub?.account)?b(`DeepSeek, Kimi, OpenAI, ChatGPT…`):b(`OpenAI, ChatGPT, Gemini, DeepSeek…`)}),` `,(0,X.jsx)(z,{size:14})]})]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(`connections`),className:`w-full text-[13.5px] flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:b(`Connections`)}),(0,X.jsxs)(`span`,{className:`text-[12.5px] text-muted flex items-center gap-1`,children:[b(`E-mail, calendar, browser, MCP servers`),` `,(0,X.jsx)(z,{size:14})]})]})]}),U(`appearance`)&&(0,X.jsxs)($,{title:b(`Appearance`),id:`appearance`,plain:!R,children:[(0,X.jsx)(T,{label:b(`Show the agent's steps`),hint:b(`Every tool it uses becomes a chip in the chat. Off, the chat keeps to the conversation and the line under the name says what it is on. This device only.`),checked:L,onChange:ge}),(0,X.jsx)(T,{label:b(`Show thinking`),hint:b(`Reveal the model's reasoning under each reply when the provider exposes it.`),checked:!!u?.agent.show_thinking,onChange:e=>void M({show_thinking:e})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`label`,{className:`text-[13.5px] flex-1`,children:[b(`Appearance`),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:b(`This device only`)})]}),(0,X.jsxs)(`select`,{value:x,onChange:e=>_(e.target.value),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:[(0,X.jsx)(`option`,{value:`light`,children:b(`Light`)}),(0,X.jsx)(`option`,{value:`dark`,children:b(`Dark`)}),(0,X.jsx)(`option`,{value:`system`,children:b(`Follow the system`)})]})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`label`,{className:`text-[13.5px] flex-1`,children:[b(`App language`),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:b(`This device only`)})]}),(0,X.jsx)(`select`,{value:te,onChange:e=>i(e.target.value),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:n.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.value===`auto`?b(`Auto`):e.label},e.value))})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(`label`,{className:`text-[13.5px] flex-1`,children:[b(`Reply language`),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:b(`What {name} writes in`,{name:e.profile?.name??`nanoMuse`})})]}),(0,X.jsxs)(`select`,{value:u?.agent.language??`auto`,onChange:e=>void M({language:e.target.value}),className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13.5px] outline-none`,children:[(0,X.jsx)(`option`,{value:`auto`,children:b(`Match mine`)}),(0,X.jsx)(`option`,{value:`English`,children:`English`}),(0,X.jsx)(`option`,{value:`中文`,children:`中文`}),(0,X.jsx)(`option`,{value:`日本語`,children:`日本語`}),(0,X.jsx)(`option`,{value:`Español`,children:`Español`}),(0,X.jsx)(`option`,{value:`Deutsch`,children:`Deutsch`}),(0,X.jsx)(`option`,{value:`Français`,children:`Français`})]})]})]}),N()&&U(`desktop`)&&(0,X.jsx)($,{title:b(`Desktop app`),id:`desktop`,plain:!R,children:(0,X.jsx)(Ve,{})}),U(`data`)&&(0,X.jsx)($,{title:b(`Data controls`),id:`data`,plain:!R,children:(0,X.jsx)(fe,{flush:!0})}),U(`developer`)&&(0,X.jsxs)($,{title:b(`Developer`),id:`developer`,plain:!R,children:[(0,X.jsx)(T,{label:b(`Developer tools`),hint:b(`The Coding screen (Cursor, Codex and the other coding agents on this computer) in the sidebar, and the runtime's address below. This device only.`),checked:I,onChange:se}),I&&(0,X.jsxs)(`div`,{className:`text-[13px] text-muted space-y-1`,children:[(0,X.jsxs)(`div`,{className:`break-all`,children:[b(`Runtime:`),` `,window.location.origin,` · `,(0,X.jsx)(`span`,{className:`text-fg/70`,children:b(`the token is in the server_token file in the data folder`)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`a`,{href:`https://github.com/nano-muse/nanoMuse/blob/main/docs/cli.md`,target:`_blank`,rel:`noreferrer`,className:`text-accent underline-offset-2 hover:underline`,children:b(`The command line and the API`)}),` · `,(0,X.jsx)(`a`,{href:`https://github.com/nano-muse/nanoMuse/blob/main/docs/harness.md`,target:`_blank`,rel:`noreferrer`,className:`text-accent underline-offset-2 hover:underline`,children:b(`nanoMuse on DeepSeek Harness`)})]})]})]}),U(`about`)&&(0,X.jsxs)($,{title:b(`About`),id:`about`,plain:!R,children:[(0,X.jsx)(C,{}),(0,X.jsx)(Pe,{installed:e.version,release:w,checking:re,onCheck:()=>void j(!0)}),(0,X.jsxs)(`div`,{className:`text-[13px] text-muted space-y-1`,children:[u&&(0,X.jsxs)(`div`,{className:`break-all`,children:[b(`Data:`),` `,u.data_dir]}),u&&(0,X.jsxs)(`div`,{className:`break-all`,children:[b(`Workspace:`),` `,u.agent.workspace]}),(0,X.jsx)(`div`,{children:e.connected?b(`Connected`):b(`Reconnecting…`)})]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{let e=A();if(e){e.disconnect();return}l(``),window.location.reload()},className:`w-full rounded-2xl border border-border py-2.5 text-[14px] font-medium flex items-center justify-center gap-2 text-muted`,children:[(0,X.jsx)(le,{size:16}),` `,A()?b(`Disconnect from this server`):b(`Forget this device's access token`)]})]})]})]})]})}var Ne=[`who`,`sentinel`,`proactivity`,`notifications`,`keep-running`,`model`,`appearance`,`desktop`,`data`,`developer`,`about`];function Pe({installed:t,release:n,checking:r,onCheck:i}){let a=o(),s=!!A(),c=(0,X.jsx)(`button`,{type:`button`,onClick:i,disabled:r,className:`text-accent underline-offset-2 hover:underline disabled:opacity-60`,children:a(r?`Checking…`:`Check now`)}),l;return l=s?a(`The phone app checks for updates on its own.`):n&&!n.enabled?a(`Update checks are off here.`):r&&!n?a(`Checking…`):n?.latest&&n.newer?(0,X.jsxs)(X.Fragment,{children:[a(`{version} is out`,{version:n.latest}),` · `,(0,X.jsx)(`a`,{href:n.download_url||n.url,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent underline-offset-2 hover:underline`,children:a(`Update`)})]}):n?.latest?(0,X.jsxs)(X.Fragment,{children:[a(`Latest {version}; you have it`,{version:n.latest}),` · `,c]}):(0,X.jsxs)(X.Fragment,{children:[a(`Could not check`),` · `,c]}),(0,X.jsxs)(`div`,{className:`rounded-2xl bg-surface-2/60 px-3.5 py-2.5 text-[13px]`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:a(`nanoMuse {version}`,{version:t})}),(0,X.jsx)(`div`,{className:`mt-0.5 text-muted`,children:l}),!s&&n?.latest&&n.newer&&(0,X.jsx)(`div`,{className:`mt-1 text-[12px] text-muted`,children:a(`To update: pip install -U nanomuse, pull the new image, or use the desktop app's Update.`)}),!s&&n?.checked_at&&(0,X.jsx)(`div`,{className:`mt-1 text-[12px] text-muted`,children:a(`Checked {when}`,{when:e(n.checked_at)})})]})}function Fe({release:e,onOpen:t}){let{state:n,setTab:r}=m(),i=o(),a=n.settings,c=n.hub,l=te(),u=n.profile?.name??`nanoMuse`,d=g(),f=c?.devices.filter(e=>!e.this&&e.kind!==`web`)??[],p=f.filter(e=>e.kind===`computer`),h=f.filter(e=>e.online&&e.actions?.includes(`coding.sessions`)),_=a?.sentinel.mode,v=_===`ask`?i(`Balanced`):_===`strict`?i(`Cautious`):_===`auto`?i(`Hands-off`):``,y=n.profile?.proactivity??`default`,ee=i(y===`off`?`Off`:y===`low`?`Low`:y===`high`?`High`:`Default`),S=i(d===`dark`?`Dark`:d===`light`?`Light`:`Follow the system`),C=i(`none`);return(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,X.jsx)(q,{title:i(`Settings`)}),(0,X.jsxs)(`div`,{className:`flex-1 overflow-y-auto pb-8 pt-2`,children:[(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(`connections`),className:`flex w-full items-center gap-3 px-4 py-3.5 text-left hover:bg-surface-2/60`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate text-[16px] font-medium leading-[21px]`,children:a?.llm.model||i(`No model yet`)}),(0,X.jsx)(`span`,{className:`mt-0.5 block truncate text-[12.5px] leading-4 text-muted`,children:a?a.llm.cloud?`nanoMuse Cloud`:a.llm.provider:i(`Add a provider and pick its models`)})]}),(0,X.jsx)(`span`,{className:`text-[14px] font-medium text-accent`,children:i(`Change`)})]}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(_e,{size:22}),label:`nanoMuse Cloud`,value:c?.account.signed_in?c.account.hint:i(`Sign in`),onClick:()=>r(`account`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(E,{size:22}),label:i(`Image & video models`),value:x(l,`image`)===!1?w(i,`image`,b(c?.account),s()):x(l,`video`)===!1?w(i,`video`,b(c?.account),s()):void 0,onClick:()=>r(`connections`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(xe,{size:22}),label:i(`Usage`),onClick:()=>r(`account`)})]}),(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsx)(K,{icon:(0,X.jsx)(F,{size:22}),label:i(`Name & personality`),value:u,onClick:()=>t(`who`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(Te,{size:22}),label:i(`Avatar`),onClick:()=>r(`avatar`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(P,{size:22}),label:i(`Memory`),onClick:()=>r(`memory`)}),a?.skills?.enabled!==!1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(Ce,{size:22}),label:i(`Skills`),value:a?String(a.skills.count):void 0,onClick:()=>r(`skills`)})]}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(D,{size:22}),label:i(`Connections`),value:a?.connectors.mcp.length?`${a.connectors.mcp.length} MCP`:void 0,onClick:()=>r(`connections`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(R,{size:22}),label:i(`Chat apps`),onClick:()=>r(`channels`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(me,{size:22}),label:i(`Devices`),value:p.length?String(p.length):C,onClick:()=>r(`devices`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(ce,{size:22}),label:i(`Coding agents`),value:h.length?String(h.length):C,onClick:()=>r(`coding`)})]}),(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsx)(K,{icon:(0,X.jsx)(j,{size:22}),label:i(`Safety · Sentinel`),value:v,onClick:()=>t(`sentinel`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(Ee,{size:22}),label:i(`Proactivity`),value:ee,onClick:()=>t(`proactivity`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(ve,{size:22}),label:i(`Notifications`),onClick:()=>t(`notifications`)}),k()&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(ye,{size:22}),label:i(`Keep it running`),onClick:()=>t(`keep-running`)})]})]}),(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsx)(K,{icon:(0,X.jsx)(he,{size:22}),label:i(`Appearance`),value:S,onClick:()=>t(`appearance`)}),N()&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(me,{size:22}),label:i(`Desktop app`),onClick:()=>t(`desktop`)})]}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(re,{size:22}),label:i(`Data controls`),onClick:()=>t(`data`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(I,{size:22}),label:i(`Developer`),onClick:()=>t(`developer`)})]}),(0,X.jsxs)(L,{className:`mb-3`,children:[(0,X.jsx)(K,{icon:(0,X.jsx)(B,{size:22}),label:i(`About nanoMuse`),value:e?.newer&&e.latest?i(`{version} is out`,{version:e.latest}):void 0,onClick:()=>t(`about`)}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(V,{size:22}),label:i(`Privacy policy`),onClick:()=>window.open(pe,`_blank`,`noopener`),external:!0}),(0,X.jsx)(W,{}),(0,X.jsx)(K,{icon:(0,X.jsx)(Se,{size:22}),label:i(`Feedback`),onClick:()=>window.open(`https://github.com/nano-muse/nanoMuse/issues/new/choose`,`_blank`,`noopener`),external:!0})]}),(0,X.jsxs)(H,{children:[`nanoMuse `,n.version]})]})]})}function Ie({name:e}){let t=o(),n=A(),[r,i]=(0,Y.useState)(()=>n?.notificationsEnabled()??!1);return n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(T,{label:t(`Let {name} notify this phone`,{name:e}),hint:t(`The app stays connected to your server in the background. Approvals, questions and finished background work arrive as notifications and open the right chat.`),checked:r,onChange:e=>{n.setNotificationsEnabled(e),i(e)}}),(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:t(`nanoMuse for Android {version}`,{version:n.version()})})]}):null}function Le({name:e}){let t=o(),n=A(),[r,i]=(0,Y.useState)(k);if((0,Y.useEffect)(()=>{let e=()=>i(k());return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,e)}},[]),!n||!r)return null;let a=e=>n.openKeepRunning?.(e),s={xiaomi:t(`Xiaomi / Redmi / POCO: Settings → Apps → Manage apps → {name} → Autostart on; Battery saver → No restrictions; Other permissions → Display pop-up windows while running in the background on.`),huawei:t(`Huawei: Settings → Battery → App launch → {name} → Manage manually, all three on (auto-launch, secondary launch, run in background); Settings → Apps → {name} → Battery → Launch: manage manually.`),honor:t(`Honor: Settings → Battery → App launch → {name} → Manage manually, all three on; Battery → More battery settings → Stay connected while asleep on.`),oppo:t(`OPPO / realme / OnePlus: Settings → Battery → More settings → Optimise battery use → {name} → Don't optimise; Settings → Apps → {name} → Battery usage → Allow background activity, Allow auto launch.`),vivo:t(`vivo / iQOO: i Manager → App manager → Autostart → {name} on; Settings → Battery → Background power consumption management → {name} → Allow high background power consumption.`),samsung:t(`Samsung: Settings → Battery → Background usage limits → {name} not in Sleeping or Deep sleeping apps (add it to Never sleeping apps); turn off Adaptive battery if it keeps stopping.`),meizu:t(`Meizu: Settings → Apps → {name} → Background management → Keep running in the background; Battery → App power management → Allow.`)}[r.vendor];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`text-[12.5px] text-muted leading-snug`,children:t(`Android stops apps that seem idle. {name} runs as a foreground service and holds the phone awake only while a task runs; these switches let it keep that promise on this phone.`,{name:e})}),(0,X.jsx)(Z,{label:t(`Battery`),value:r.battery_unrestricted?t(`Unrestricted`):t(`Optimised`),ok:r.battery_unrestricted,hint:t(`Optimised means Android may freeze the agent after a while with the screen off; routines and check-ins then wait until the phone wakes.`),action:r.battery_unrestricted?void 0:{label:t(`Allow`),onClick:()=>a(`battery`)}}),(0,X.jsx)(Z,{label:t(`Display over other apps`),value:r.overlay?t(`Allowed`):t(`Not allowed`),ok:r.overlay,hint:t(`Lets the agent bring an app to the front from the background and show its status capsule while it works in other apps.`),action:r.overlay?void 0:{label:t(`Allow`),onClick:()=>a(`overlay`)}}),r.exact_alarms!==`n/a`&&r.local&&(0,X.jsx)(Z,{label:t(`Alarms & reminders`),value:r.exact_alarms===`granted`?t(`Exact`):t(`Approximate`),ok:r.exact_alarms===`granted`,hint:t(`With exact alarms a reminder fires at the minute you named even when the phone is asleep; without them Android may deliver it up to a quarter of an hour late.`),action:r.exact_alarms===`granted`?void 0:{label:t(`Allow`),onClick:()=>a(`alarms`)}}),(0,X.jsx)(T,{label:t(`Start after a reboot`),hint:r.local?t(`Bring the runtime back when the phone restarts, so routines and check-ins do not stop.`):t(`Reconnect to your computer when the phone restarts, so approvals keep arriving.`),checked:r.boot_start,onChange:e=>{n.setStartOnBoot?.(e),i({...r,boot_start:e})}}),s&&(0,X.jsxs)(`div`,{className:`rounded-2xl bg-surface-2 px-3 py-2.5 text-[12.5px] leading-snug space-y-2`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:t(`On this phone's Android`)}),(0,X.jsx)(`div`,{className:`text-muted`,children:s}),r.autostart_settings&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>a(`autostart`),className:`rounded-full border border-border px-3 py-1.5 text-[12.5px]`,children:t(`Open the auto-start settings`)})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted leading-snug`,children:t(`Crashes are written to a file on this phone and nowhere else. Export bundles them with the runtime's log for someone you choose.`)}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>n.exportLogs?.(),className:`shrink-0 rounded-full border border-border px-3 py-1.5 text-[12.5px]`,children:t(`Export logs`)})]})]})}function Z({label:e,value:n,ok:r,hint:i,action:a}){return(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,r?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/15 text-amber-700 dark:text-amber-300`),children:n})]}),i&&(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted leading-snug`,children:i})]}),a&&(0,X.jsx)(`button`,{type:`button`,onClick:a.onClick,className:`shrink-0 rounded-full bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white`,children:a.label})]})}function Re({name:e}){let{toast:t}=m(),[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(`off`),[s,c]=(0,Y.useState)(!1),l=o(),u=async()=>{a(await v());try{r(await y.push())}catch{}};(0,Y.useEffect)(()=>{u()},[]);let f=async()=>{if(n){c(!0);try{let e=i===`on`?await h():await d(n.public_key);a(e),e===`denied`&&t(l(`Notifications are blocked for this site in the browser settings`)),await u()}catch(e){let n=e;t(n.name===`AbortError`?l(`This browser has no push service (embedded browsers often don't). Use Chrome, Edge, Firefox or Safari 16.4+ on the phone.`):n.message)}finally{c(!1)}}},p=async()=>{try{let e=await y.pushTest();t(e.ok?l(`Sent. It should arrive in a moment`):e.error??l(`Could not send`))}catch(e){t(e.message)}},g=i===`unsupported`?l(`This browser cannot receive push notifications.`):i===`insecure`?l(`Notifications need https:// (or localhost). Over plain http on your LAN the app works, this part stays off; see docs/deployment.md.`):i===`denied`?l(`Blocked for this site. Allow notifications in the browser's site settings, then try again.`):n&&!n.available?l(`The server was installed without pywebpush.`):``;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(T,{label:l(`Let {name} notify this device`,{name:e}),hint:l(`Approvals, questions, finished background work and check-ins; nothing while the app is on screen.`),checked:i===`on`,onChange:()=>void f(),disabled:s||!!g}),g&&(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:g}),n&&n.subscriptions>0&&(0,X.jsxs)(`div`,{className:`flex items-center justify-between text-[12.5px] text-muted`,children:[(0,X.jsx)(`span`,{children:n.subscriptions===1?l(`1 device subscribed`):l(`{n} devices subscribed`,{n:n.subscriptions})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>void p(),className:`text-accent font-medium`,children:l(`Send a test`)})]}),!N()&&(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:l(`On a phone, add the app to the home screen first; the icon then shows a badge and notifications open the right chat.`)})]})}var Q=[{id:`off`,title:`Off`,text:`Only works when you ask.`},{id:`low`,title:`Low`,text:`Checks in half as often; speaks up only when a step is done or it needs you.`},{id:`default`,title:`Default`,text:`Works on goals on schedule; reports real progress, stays quiet otherwise.`},{id:`high`,title:`High`,text:`Checks in twice as often and always reports, even 'still on track'.`}];function ze({value:e,onChange:n}){let r=o(),i=Q.find(t=>t.id===e)??Q[2];return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,X.jsx)(`div`,{className:`flex-1 text-[13px] text-muted leading-snug`,children:r(i.text)})}),(0,X.jsx)(`div`,{className:`mt-2 grid grid-cols-4 gap-1 rounded-2xl bg-surface-2 p-1`,children:Q.map(i=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>n(i.id),"aria-pressed":e===i.id,className:t(`rounded-xl py-1.5 text-[13px] font-medium transition`,e===i.id?`bg-surface shadow-sm text-accent`:`text-muted`),children:r(i.title)},i.id))})]})}function Be({value:e,onChange:n}){let[r,i]=e?e.split(`-`):[``,``],a=!!e,s=o(),c=(e,t)=>n(e&&t?`${e}-${t}`:``);return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer`,children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsxs)(`div`,{className:`text-[14px] flex items-center gap-1.5`,children:[(0,X.jsx)(U,{size:15,className:`text-muted`}),` `,s(`Quiet hours`)]}),(0,X.jsx)(`div`,{className:`text-[12.5px] text-muted leading-snug`,children:s(`No background work in this window; anything due waits until it ends.`)})]}),(0,X.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":a,onClick:()=>c(a?``:`22:00`,a?``:`08:00`),className:t(`relative mt-0.5 h-7 w-12 shrink-0 rounded-full transition`,a?`bg-accent`:`bg-surface-2 border border-border`),children:(0,X.jsx)(`span`,{className:t(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,a?`left-[22px]`:`left-0.5`)})})]}),a&&(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-[13.5px]`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:s(`From`)}),(0,X.jsx)(`input`,{type:`time`,value:r,onChange:e=>c(e.target.value,i),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`}),(0,X.jsx)(`span`,{className:`text-muted`,children:s(`to`)}),(0,X.jsx)(`input`,{type:`time`,value:i,onChange:e=>c(r,e.target.value),className:`rounded-xl bg-surface-2 px-2.5 py-1.5 outline-none`})]})]})}function Ve(){let e=o(),t=M(),[n,r]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let e=!0;return t?.loginItem?.().then(t=>{e&&r(t)}),()=>{e=!1}},[t]);let i=t?.platform===`darwin`,a=[[e(`Quick chat`),i?`⌥ Space`:`Ctrl+Shift+Space`],[e(`Show the window`),i?`⌘⇧M`:`Ctrl+Shift+M`],[e(`Stop the hands`),i?`⌘⇧Esc`:`Ctrl+Shift+Esc`]];return(0,X.jsxs)(X.Fragment,{children:[t?.setLoginItem&&n!==null&&t.platform!==`linux`&&(0,X.jsx)(T,{label:e(`Start with the computer`),hint:e(`Opens in the tray at sign-in; the agent's goals and check-ins run from then on.`),checked:n,onChange:e=>{r(e),t.setLoginItem?.(e)}}),(0,X.jsxs)(`div`,{className:`text-[13.5px]`,children:[e(`In the tray`),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e(`The icon by the clock shows what the hands are doing and has Stop; closing the window keeps the agent running.`)})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`div`,{className:`text-[13.5px]`,children:e(`Shortcuts`)}),a.map(([e,t])=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted`,children:e}),(0,X.jsx)(`kbd`,{className:`rounded-md border border-border bg-surface-2 px-1.5 py-0.5 font-sans text-[12px] text-fg/80`,children:t})]},e))]})]})}function $({title:e,children:n,id:r,plain:i=!1}){return(0,X.jsxs)(`section`,{id:r,className:t(`space-y-3 scroll-mt-4`,i?`pt-1`:`rounded-3xl bg-surface border border-border/70 shadow-sm p-4`),children:[!i&&(0,X.jsx)(`h2`,{className:`text-[12px] font-semibold uppercase tracking-wide text-muted`,children:e}),n]})}export{Me as SettingsScreen};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/SkillsScreen-DZP-6db6.js b/nanomuse/server/static/assets/SkillsScreen-Dr-d7iS7.js
similarity index 99%
rename from nanomuse/server/static/assets/SkillsScreen-DZP-6db6.js
rename to nanomuse/server/static/assets/SkillsScreen-Dr-d7iS7.js
index a65b0e569..d6a9f8cc7 100644
--- a/nanomuse/server/static/assets/SkillsScreen-DZP-6db6.js
+++ b/nanomuse/server/static/assets/SkillsScreen-Dr-d7iS7.js
@@ -1,4 +1,4 @@
-import{A as e,E as t,J as n,K as r,Q as i,Y as a,b as o,f as s,q as c,r as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{B as d,C as f,F as p,Q as m,V as h,Z as g,bt as _,et as v}from"./index-BjYzdKkG.js";import{t as y}from"./BackBar-Dli0L0O_.js";var b=n(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),x=n(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),S=i(a(),1),C=o(),w=e=>`---
+import{A as e,E as t,J as n,K as r,Q as i,Y as a,b as o,f as s,q as c,r as l,x as u}from"./MuseHeader-Pw-NI98v.js";import{B as d,C as f,F as p,Q as m,V as h,Z as g,bt as _,et as v}from"./index-CIdGZ5PB.js";import{t as y}from"./BackBar-Dl56jHZM.js";var b=n(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),x=n(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),S=i(a(),1),C=o(),w=e=>`---
name: ${e}
description: What this does, and when to use it; the model picks the skill from this line.
---
diff --git a/nanomuse/server/static/assets/index-BjYzdKkG.js b/nanomuse/server/static/assets/index-CIdGZ5PB.js
similarity index 98%
rename from nanomuse/server/static/assets/index-BjYzdKkG.js
rename to nanomuse/server/static/assets/index-CIdGZ5PB.js
index 5744bf6a3..0ba4f0f94 100644
--- a/nanomuse/server/static/assets/index-BjYzdKkG.js
+++ b/nanomuse/server/static/assets/index-CIdGZ5PB.js
@@ -1,4 +1,4 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AccountScreen-DvBFnisI.js","assets/MuseHeader-Pw-NI98v.js","assets/StarNudge-DjXecvWj.js","assets/external-link-Xj5fjR8v.js","assets/Form-DwKuBk1V.js","assets/clapperboard-BokpXv9J.js","assets/database-zap-CzaFBl6C.js","assets/image-crWy0a06.js","assets/BackBar-Dli0L0O_.js","assets/AvatarStudioScreen-C1Q0sV3j.js","assets/refresh-cw-BKgIzslL.js","assets/AvatarPicker-oSjVM8L3.js","assets/ChannelsScreen-Bt6eBqvc.js","assets/CodingScreen-CTT5Jjn2.js","assets/ConnectionsScreen-0U0bXAf7.js","assets/plug-Bj_5EEV3.js","assets/CloudCard-CdydxD3H.js","assets/DevicesScreen-P67eLmyB.js","assets/GoalsScreen-BGb02qG6.js","assets/IdeasScreen-BVCFCRSV.js","assets/LibraryScreen-U8NV3qaf.js","assets/MemoryScreen-B5a6LPAu.js","assets/Onboarding-rP8qAahh.js","assets/IdentityForm-Dhx4FiQY.js","assets/SettingsScreen-DoXURXet.js","assets/SkillsScreen-DZP-6db6.js"])))=>i.map(i=>d[i]);
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AccountScreen-bHMDrVr5.js","assets/MuseHeader-Pw-NI98v.js","assets/StarNudge-DjXecvWj.js","assets/external-link-Xj5fjR8v.js","assets/Form-DwKuBk1V.js","assets/clapperboard-BokpXv9J.js","assets/database-zap-CzaFBl6C.js","assets/image-crWy0a06.js","assets/BackBar-Dl56jHZM.js","assets/AvatarStudioScreen-DD2X0R8P.js","assets/refresh-cw-BKgIzslL.js","assets/AvatarPicker-gR2knlot.js","assets/ChannelsScreen-mBzj7BLf.js","assets/CodingScreen-C_tutsx0.js","assets/ConnectionsScreen-CMt7GOff.js","assets/plug-Bj_5EEV3.js","assets/CloudCard-CtVHK0qc.js","assets/DevicesScreen-g6FUY327.js","assets/GoalsScreen-Dp2fRaLA.js","assets/IdeasScreen-CGfvq5H-.js","assets/LibraryScreen-B8JlrC_n.js","assets/MemoryScreen-M8j03G3u.js","assets/Onboarding-CtVO6gdK.js","assets/IdentityForm-BTGczGT_.js","assets/SettingsScreen-CHVg61To.js","assets/SkillsScreen-Dr-d7iS7.js"])))=>i.map(i=>d[i]);
import{A as e,B as t,C as n,D as r,E as i,I as a,J as o,K as s,L as c,M as l,N as u,O as d,P as f,Q as p,R as m,S as h,T as g,U as _,V as v,W as y,X as b,Y as x,Z as S,b as C,c as w,d as T,f as E,i as D,j as O,n as k,p as ee,q as A,r as te,s as j,t as ne,u as re,x as M,y as N,z as P}from"./MuseHeader-Pw-NI98v.js";import{A as ie,C as ae,D as oe,E as se,M as ce,N as le,P as ue,S as de,a as fe,b as pe,c as me,h as he,i as ge,j as _e,l as ve,n as ye,o as be,p as xe,r as Se,s as Ce,t as we,u as Te,v as Ee,x as De,y as Oe}from"./StarNudge-DjXecvWj.js";import{n as ke,t as Ae}from"./external-link-Xj5fjR8v.js";import{a as je,c as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le}from"./Form-DwKuBk1V.js";import{t as Re}from"./refresh-cw-BKgIzslL.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ze=b((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,te(x);else{var t=n(l);t!==null&&j(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&j(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,j(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,te(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Be=b(((e,t)=>{t.exports=ze()})),Ve=b((e=>{var t=x(),n=Be();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;nt}return!1}function g(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var _={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){_[e]=new g(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];_[t]=new g(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){_[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){_[e]=new g(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){_[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){_[e]=new g(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){_[e]=new g(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){_[e]=new g(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){_[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),_.xlinkHref=new g(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,t,n,r){var i=_.hasOwnProperty(t)?_[t]:null;(i===null?r||!(2n&&e&&t.length>0?uf(e,t):null,i=e=>n?.(e),a=n&&t.length>0?ff(e,t):e;return(0,R.jsx)(`div`,{className:`md text-[15px] leading-[1.5] break-words`,children:(0,R.jsx)(il,{remarkPlugins:[lf],components:{a:({href:e,children:t,...n})=>{let a=e&&!/^[a-z]+:/i.test(e)?r(O(e)):null;return a?(0,R.jsx)(`button`,{type:`button`,className:`md-file`,onClick:()=>i(a),children:t}):(0,R.jsx)(`a`,{href:e,...n,target:`_blank`,rel:`noreferrer noopener`,children:t})},code:({children:e,...t})=>{let n=pf({children:e,...t})&&typeof e==`string`?r(e):null;return n?(0,R.jsx)(`button`,{type:`button`,className:`md-file`,onClick:()=>i(n),title:n,children:e}):(0,R.jsx)(`code`,{...t,children:e})}},children:a})})}function gf({path:e,onClose:t}){let n=s(),i=(0,L.useRef)(null);if(On(i,!!e),(0,L.useEffect)(()=>{if(!e)return;let n=e=>e.key===`Escape`&&t();return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let a=e.split(`/`).pop()??e,o=r(a);return(0,R.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-label":a,className:`fixed inset-0 z-[60] flex flex-col bg-bg`,children:[(0,R.jsxs)(`header`,{className:`safe-top shrink-0 flex items-center gap-2 border-b border-border bg-surface/90 px-3 py-2 backdrop-blur`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`Close`),className:`p-2 rounded-full text-muted hover:bg-surface-2`,children:(0,R.jsx)(Fe,{size:20})}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsx)(`div`,{className:`font-semibold text-[15px] truncate`,children:a}),(0,R.jsx)(`div`,{className:`text-[12px] text-muted truncate`,children:e})]}),o!==`html`&&(0,R.jsx)(`a`,{href:h(e),target:`_blank`,rel:`noreferrer noopener`,"aria-label":n(`Open in a new tab`),className:`p-2 rounded-full text-muted hover:bg-surface-2`,children:(0,R.jsx)(Ae,{size:19})}),(0,R.jsx)(`a`,{href:h(e,!0),"aria-label":n(`Download`),className:`p-2 rounded-full text-muted hover:bg-surface-2`,children:(0,R.jsx)(ft,{size:19})})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,R.jsx)(_f,{path:e,kind:o})})]})}function _f({path:e,kind:t}){let n=s();return t===`image`?(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center p-3`,children:(0,R.jsx)(`img`,{src:h(e),alt:e,className:`max-h-full max-w-full rounded-2xl object-contain`})}):t===`pdf`?(0,R.jsx)(`iframe`,{title:e,src:h(e),className:`h-full w-full bg-white`}):t===`html`?(0,R.jsx)(yf,{path:e}):t===`event`?(0,R.jsx)(bf,{path:e}):t===`text`||t===`code`||t===`data`?(0,R.jsx)(Cf,{path:e,kind:t}):(0,R.jsxs)(`div`,{className:`p-8 text-center text-muted text-[14px]`,children:[n(`No preview for this file type.`),` `,(0,R.jsx)(`a`,{href:h(e,!0),className:`text-accent font-medium`,children:n(`Download it`)})]})}function vf(e){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let t=!0;return n(null),i(null),M.fileText(e).then(e=>t&&n(e)).catch(e=>t&&i(e.message)),()=>{t=!1}},[e]),{text:t,error:r}}function yf({path:e}){let{text:t,error:n}=vf(e);return n?(0,R.jsx)(Ef,{error:n}):t===null?(0,R.jsx)(Tf,{}):(0,R.jsx)(`iframe`,{title:e,srcDoc:t,sandbox:`allow-scripts allow-popups allow-forms allow-modals`,referrerPolicy:`no-referrer`,className:`h-full w-full bg-white`})}function bf({path:e}){let t=s(),{text:n,error:r}=vf(e);if(r)return(0,R.jsx)(Ef,{error:r});if(n===null)return(0,R.jsx)(Tf,{});let i=xf(n);return(0,R.jsxs)(`div`,{className:`mx-auto max-w-[560px] px-5 py-6 space-y-4`,children:[i.length===0&&(0,R.jsx)(`div`,{className:`text-center text-muted text-[14px]`,children:t(`No event in this file.`)}),i.map((e,n)=>(0,R.jsxs)(`div`,{className:`rounded-3xl border border-border/70 bg-surface shadow-sm p-5`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`rounded-2xl bg-accent/12 text-accent p-2.5`,children:(0,R.jsx)(tt,{size:22})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[18px] font-semibold leading-snug`,children:e.summary||t(`Untitled event`)}),(0,R.jsx)(`div`,{className:`mt-1 text-[14px] text-muted`,children:Sf(e)}),e.location&&(0,R.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[14px] text-muted`,children:[(0,R.jsx)(Dt,{size:14}),` `,e.location]})]})]}),e.description&&(0,R.jsx)(`div`,{className:`mt-4 whitespace-pre-wrap text-[14px] leading-relaxed`,children:e.description})]},n)),(0,R.jsxs)(`a`,{href:h(e,!0),download:!0,className:`flex items-center justify-center gap-2 rounded-2xl bg-accent text-accent-fg px-4 py-3 text-[15px] font-medium`,children:[(0,R.jsx)(nt,{size:18}),` `,t(`Add to calendar`)]}),(0,R.jsx)(`p`,{className:`text-center text-[12.5px] text-muted`,children:t(`Opens in your calendar app, which asks before it saves anything.`)})]})}function xf(e){let t=e.replace(/\r\n/g,`
`).replace(/\n[ \t]/g,``).split(`
`),n=[],r=null,i=e=>e.replace(/\\n/gi,`
-`).replace(/\\([,;\\])/g,`$1`),a=(e,t)=>{if(/VALUE=DATE(?![-])/i.test(t)||/^\d{8}$/.test(e)){let t=/^(\d{4})(\d{2})(\d{2})/.exec(e);return{at:t?new Date(+t[1],t[2]-1,+t[3]):null,allDay:!0}}let n=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})?(Z?)$/.exec(e);if(!n)return{at:null,allDay:!1};let r=[+n[1],n[2]-1,+n[3],+n[4],+n[5],+(n[6]??0)];return{at:n[7]?new Date(Date.UTC(...r)):new Date(...r),allDay:!1}};for(let e of t)if(e===`BEGIN:VEVENT`)r={summary:``,location:``,description:``,start:null,end:null,allDay:!1};else if(e===`END:VEVENT`&&r)n.push(r),r=null;else if(r){let t=e.indexOf(`:`);if(t<0)continue;let[n,...o]=e.slice(0,t).split(`;`),s=e.slice(t+1),c=o.join(`;`);if(n===`SUMMARY`)r.summary=i(s);else if(n===`LOCATION`)r.location=i(s);else if(n===`DESCRIPTION`)r.description=i(s);else if(n===`DTSTART`){let e=a(s,c);r.start=e.at,r.allDay=e.allDay}else n===`DTEND`&&(r.end=a(s,c).at)}return n}function Sf(e){if(!e.start)return``;let t=m(),n=e=>e.toLocaleDateString(t,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),r=e=>e.toLocaleTimeString(t,{hour:`numeric`,minute:`2-digit`});if(e.allDay){let t=e.end?new Date(e.end.getTime()-864e5):e.start;return t>e.start?`${n(e.start)} – ${n(t)}`:`${n(e.start)} · ${_(`all day`)}`}return e.end?e.start.toDateString()===e.end.toDateString()?`${n(e.start)} ${r(e.start)}–${r(e.end)}`:`${n(e.start)} ${r(e.start)} – ${n(e.end)} ${r(e.end)}`:`${n(e.start)} ${r(e.start)}`}function Cf({path:e,kind:t}){let{text:n,error:r}=vf(e);return r?(0,R.jsx)(Ef,{error:r}):n===null?(0,R.jsx)(Tf,{}):t===`text`&&/\.md$/i.test(e)?(0,R.jsx)(`div`,{className:`mx-auto max-w-[720px] px-5 py-4`,children:(0,R.jsx)(hf,{text:n})}):t===`data`&&/\.csv$/i.test(e)?(0,R.jsx)(wf,{text:n}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words px-4 py-3 font-mono text-[12.5px] leading-relaxed`,children:n})}function wf({text:e}){let t=s(),n=e.split(/\r?\n/).filter(e=>e.trim()).slice(0,500).map(e=>e.split(`,`));if(!n.length)return(0,R.jsx)(`div`,{className:`p-6 text-muted text-center`,children:t(`Empty file.`)});let[r,...i]=n;return(0,R.jsx)(`div`,{className:`overflow-auto p-3`,children:(0,R.jsxs)(`table`,{className:`min-w-full text-[13px] border-separate border-spacing-0`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsx)(`tr`,{children:r.map((e,t)=>(0,R.jsx)(`th`,{className:`sticky top-0 bg-surface-2 text-left font-semibold px-3 py-2 border-b border-border whitespace-nowrap`,children:e},t))})}),(0,R.jsx)(`tbody`,{children:i.map((e,t)=>(0,R.jsx)(`tr`,{className:`odd:bg-surface`,children:e.map((e,t)=>(0,R.jsx)(`td`,{className:`px-3 py-1.5 border-b border-border/60 whitespace-nowrap`,children:e},t))},t))})]})})}function Tf(){return(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted`,children:(0,R.jsx)(A,{className:`animate-spin`,size:22})})}function Ef({error:e}){let t=s();return(0,R.jsx)(`div`,{className:`p-8 text-center text-rose-600 dark:text-rose-300 text-[14px]`,children:t(`Could not load the file: {error}`,{error:e})})}var Df=`OpenAI's terms cover using a ChatGPT plan inside OpenAI's own Codex; other apps have had this access cut off before (OpenCode, January 2026). If it stops working, an API key does.`,Of=2e3,kf=6e5;function Af({compact:e,onChanged:t}){let n=s(),{toast:r}=E(),[a,o]=(0,L.useState)(null),[c,l]=(0,L.useState)(`unknown`),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(!0),[g,_]=(0,L.useState)(``),[v,y]=(0,L.useState)(null),b=(0,L.useRef)(0),x=(0,L.useCallback)(async()=>{try{let e=await M.chatgptStatus();return o(e),l(`yes`),e}catch(e){return/not found/i.test(e.message)?l(`no`):y(e.message),null}},[]);(0,L.useEffect)(()=>{x().then(e=>{e?.pending&&e.url&&(b.current=Date.now(),h(e.port_bound!==!1),p(e.url))})},[x]),(0,L.useEffect)(()=>{if(!f)return;let e=setInterval(()=>{x().then(e=>{e?.signed_in?(p(null),Ee(),r(n(`Signed in with {label}.`,{label:e.label||`ChatGPT`})),t?.()):e&&e.pending===!1&&e.error?(p(null),y(n(e.error))):Date.now()-b.current>kf&&(p(null),y(n(`The sign-in did not finish in ten minutes. Try again.`)))})},Of);return()=>clearInterval(e)},[f,x,t,r,n]);let S=async()=>{d(`login`),y(null);try{let e=await M.chatgptLogin();b.current=Date.now(),h(e.port_bound!==!1),_(``),p(e.url),window.open(e.url,`_blank`,`noopener`)}catch(e){/not found/i.test(e.message)?l(`no`):y(e.message)}finally{d(null)}},C=async()=>{let e=g.trim();if(e){d(`paste`),y(null);try{await M.chatgptCallback(e),_(``)}catch(e){let t=e.message;/state/i.test(t)?y(n(`That address belongs to another sign-in attempt. Open the page again and paste the address it ends on.`)):/no sign-in|409/i.test(t)?(p(null),y(n(`The sign-in did not finish in ten minutes. Try again.`))):y(t)}finally{d(null)}}},w=async()=>{d(`use`),y(null);try{await M.setLLM({provider:`chatgpt`,model:a?.models?.[0]??``,base_url:``,api_key:``}),Ee(),r(n(`ChatGPT answers the chat now.`)),t?.()}catch(e){y(e.message)}finally{d(null)}},T=async()=>{d(`logout`),y(null);try{await M.chatgptLogout(),Ee(),await x(),t?.()}catch(e){y(e.message)}finally{d(null)}},D=n(`Covers chat and the hands. Pictures and clips are not part of it; those need a provider with image or video models.`);return(0,R.jsxs)(`div`,{className:i(`space-y-2`,!e&&`rounded-2xl bg-surface-2/60 p-3`),children:[!e&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium`,children:[(0,R.jsx)(Mt,{size:15,className:`text-accent`}),` `,n(`Sign in with ChatGPT`)]}),c===`no`?(0,R.jsxs)(`p`,{className:`text-[12.5px] text-muted`,children:[n(`This nanoMuse has no sign-in route yet. In a terminal on this computer, run`),` `,(0,R.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5 text-[12px]`,children:`nanomuse chatgpt login`}),` `,n(`and reload this page.`)]}):a?.signed_in?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`text-[12.5px]`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:n(`Signed in with {label}.`,{label:a.label||`ChatGPT`})}),` `,(0,R.jsx)(`span`,{className:`text-muted`,children:D})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:u!==null,onClick:()=>void w(),className:i(Ne,`inline-flex items-center gap-1.5 py-2`),children:[u===`use`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(Mt,{size:14}),` `,n(`Use it for the chat`)]}),(0,R.jsxs)(`button`,{type:`button`,disabled:u!==null,onClick:()=>void T(),className:i(je,`inline-flex items-center gap-1.5`),children:[u===`logout`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(Tt,{size:14}),` `,n(`Sign out of ChatGPT`)]})]})]}):f?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`flex items-start gap-2 text-[12.5px] text-muted`,children:[(0,R.jsx)(A,{size:14,className:`mt-0.5 shrink-0 animate-spin`}),(0,R.jsx)(`span`,{children:n(m?`A page from OpenAI opened in a new tab. Sign in there; this card follows on its own.`:`A page from OpenAI opened in a new tab. Sign in there; when the browser ends on an address that will not load, paste that address below.`)})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Ae,{size:14}),` `,n(`Open the page again`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(null),className:je,children:n(`Cancel`)})]}),(0,R.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,R.jsx)(`input`,{type:`url`,value:g,onChange:e=>_(e.target.value),placeholder:`http://localhost:1455/auth/callback?code=…`,"aria-label":n(`The address the browser ended on`),className:`min-w-0 flex-1 rounded-lg border border-border bg-surface px-2 py-1.5 text-[12.5px]`}),(0,R.jsxs)(`button`,{type:`submit`,disabled:u!==null||!g.trim(),className:i(je,`inline-flex items-center gap-1.5`),children:[u===`paste`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):null,` `,n(`Use this address`)]})]}),!m&&(0,R.jsx)(`p`,{className:`text-[11.5px] text-muted`,children:n(`This nanoMuse runs where the browser cannot reach port 1455, so it cannot pick the sign-in up by itself.`)})]}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:D}),(0,R.jsxs)(`button`,{type:`button`,disabled:u!==null||c===`unknown`,onClick:()=>void S(),className:i(Ne,`inline-flex items-center gap-1.5 py-2`),children:[u===`login`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(wt,{size:14}),` `,n(`Sign in with ChatGPT`)]})]}),(0,R.jsx)(`p`,{className:`text-[11.5px] leading-snug text-muted`,children:n(Df)}),v&&(0,R.jsx)(`p`,{className:`text-[12px] text-rose-600 dark:text-rose-300`,children:v})]})}var jf=xe,Mf=`nm.connections.preset`;function Nf(e,t=_e().preset){try{sessionStorage.setItem(Mf,t)}catch{}e(`connections`)}function Pf(){try{let e=sessionStorage.getItem(Mf);return e&&sessionStorage.removeItem(Mf),e}catch{return null}}function Ff({info:e,exhausted:t,compact:n}){let r=s(),{toast:a,setTab:o,state:l}=E(),u=l.hub?.account,d=_e(u),f=ae(u),p=c(),m=e.invite_bonus_cny??5,h=e.own_key_docs||e.guidance?.docs||jf,g=e.invite_url||``,[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(!1),x=(e.guidance?.providers??de(f)).filter(e=>e.id!==d.id).map(e=>({id:e.id,name:De(e,p),keyUrl:e.key_url,covers:`covers`in e?e.covers:e.capabilities})),S=Oe().map(e=>e.name),C=async e=>{try{await navigator.clipboard.writeText(e),a(r(`Copied`))}catch{a(e)}},w=async()=>{let e=r(`Try nanoMuse with me, a fully open-source personal agent, free to use. Sign up with my link: {link}`,{link:g}),t=navigator;if(t.share)try{await t.share({text:e});return}catch{}await C(e)},T=Ce(),[D,O]=me(`exhausted`,t),k=ve(be(r,`exhausted`)),ee=t?r(`The free allowance is used up.`):r(`Nearly used up: ¥{left} of ¥{grant} left.`,{left:(e.left??0).toFixed(2),grant:(e.grant??0).toFixed(0)});return(0,R.jsxs)(`div`,{className:i(`space-y-2.5`,!n&&`pt-1`),children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:i(`font-semibold`,n?`text-[13.5px]`:`text-[15px]`),children:ee}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[12.5px] text-muted`,children:r(`Three ways on; your sign-in and your devices keep working whichever you pick.`)})]}),(0,R.jsxs)(If,{icon:(0,R.jsx)(xt,{size:16}),tone:`bg-accent/12 text-accent`,title:r(`Use your own model key`),children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:ie(r,u)}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>Nf(o,d.preset),className:i(Ne,`inline-flex items-center gap-1.5 py-2`),children:[(0,R.jsx)(xt,{size:14}),` `,r(`Set it up`)]}),(0,R.jsxs)(`a`,{href:d.keyUrl,target:`_blank`,rel:`noopener noreferrer`,className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Ae,{size:14}),` `,r(`Get a key from {vendor}`,{vendor:d.label})]}),(0,R.jsxs)(`a`,{href:h,target:`_blank`,rel:`noopener noreferrer`,className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Ae,{size:14}),` `,r(`Step-by-step guide`)]})]}),x.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>v(!_),className:`inline-flex items-center gap-1 text-[12px] text-muted`,children:[_?(0,R.jsx)(Le,{size:13}):(0,R.jsx)(Me,{size:13}),` `,r(`Other providers and what each key covers`)]}),_&&(0,R.jsx)(`ul`,{className:`mt-1.5 space-y-1 text-[12.5px]`,children:x.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-wrap items-baseline justify-between gap-x-3`,children:[(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.name}),` `,(0,R.jsxs)(`span`,{className:`text-muted`,children:[`· `,he(r,e.covers)]})]}),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>Nf(o,pe(e.id)),className:`text-accent`,children:r(`Set it up`)}),(0,R.jsxs)(`a`,{href:e.keyUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-accent`,children:[r(`Get a key`),` `,(0,R.jsx)(Ae,{size:11})]})]})]},e.id))})]})]}),(0,R.jsxs)(If,{icon:(0,R.jsx)(wt,{size:16}),tone:`bg-emerald-500/12 text-emerald-600 dark:text-emerald-300`,title:r(`Sign in with a plan you already pay for`),children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:r(`{plans}: the plan's models answer here, no key to make. ChatGPT works on every device, the others on the phones. A ChatGPT sign-in covers chat and the hands; pictures and clips still want a key.`,{plans:S.join(r(`, `))})}),y?(0,R.jsx)(Af,{compact:!0,onChanged:()=>b(!1)}):(0,R.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(wt,{size:14}),` `,r(`Sign in with ChatGPT`)]})]}),(0,R.jsx)(If,{icon:(0,R.jsx)(hn,{size:16}),tone:`bg-violet-500/12 text-violet-600 dark:text-violet-300`,title:r(`Invite a friend: +¥{bonus} for you and +¥{bonus} for them, for each new person who signs up with your link.`,{bonus:m.toFixed(0)}),children:g?(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void w(),className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Xt,{size:14}),` `,r(`Share the link`)]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void C(g),className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(ut,{size:14}),` `,r(`Copy the link`)]})]}):(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(`account`),className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Xt,{size:14}),` `,r(`Your invite link is under Account`)]})}),t&&D&&(0,R.jsxs)(If,{icon:(0,R.jsx)(ce,{size:16}),tone:`bg-amber-400/15 text-amber-600 dark:text-amber-300`,title:k,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>fe(T.repo_url),className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(ce,{size:14}),` `,r(`Star on GitHub`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{ge(),O(!1)},className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:r(`I already starred`)})]})]})}function If({icon:e,tone:t,title:n,children:r}){return(0,R.jsxs)(`div`,{className:`flex gap-3 rounded-2xl bg-surface-2/60 p-3`,children:[(0,R.jsx)(`span`,{className:i(`flex h-8 w-8 shrink-0 items-center justify-center rounded-xl`,t),children:e}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,R.jsx)(`div`,{className:`text-[13px] font-medium leading-snug`,children:n}),r]})]})}var Lf=`nm.cloud.warned_grant`;function Rf(){let e=s(),{state:t,setTab:n}=E(),[r,i]=(0,L.useState)(null),a=(0,L.useRef)(0),o=t.hub?.account,c=!!o?.signed_in&&!!o.is_model,l=t.finishedAt;if((0,L.useEffect)(()=>{if(!c||!l||r||Date.now()-a.current<6e4)return;a.current=Date.now();let e=!1;return M.cloudMe().then(t=>{if(e)return;let n=t.spend,r=n.grant??n.allowance_cny??0,a=n.left??null;if(n.unlimited||!n.warn||a===null||a<=0)return;let o=null;try{o=localStorage.getItem(Lf)}catch{}o!==String(r)&&i({left:a,grant:r,invite_url:t.invite?.url,invite_bonus_cny:n.invite_bonus_cny,invitee_bonus_cny:n.invitee_bonus_cny,own_key_docs:n.own_key_docs,guidance:n.guidance})}).catch(()=>{}),()=>{e=!0}},[c,l,r]),!r)return null;let u=()=>{try{localStorage.setItem(Lf,String(r.grant??0))}catch{}i(null)};return(0,R.jsxs)(`div`,{className:`rise mx-3 mb-1.5 flex items-start gap-2 rounded-2xl bg-amber-500/12 px-3 py-2 text-[12.5px] leading-snug text-amber-800 dark:text-amber-200`,children:[(0,R.jsx)(nn,{size:14,className:`mt-0.5 shrink-0`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e(`Nearly used up: ¥{left} of ¥{grant} left.`,{left:(r.left??0).toFixed(2),grant:(r.grant??0).toFixed(0)}),` `,e(`Invite a friend (+¥{invite} for each of you) or bring your own key; your sign-in keeps working either way.`,{invite:(r.invite_bonus_cny??5).toFixed(0)}),` `,(0,R.jsx)(`button`,{type:`button`,onClick:()=>{u(),n(`account`)},className:`font-semibold underline decoration-dotted underline-offset-2`,children:e(`See the ways`)})]}),(0,R.jsx)(`button`,{type:`button`,onClick:u,"aria-label":e(`Dismiss`),className:`shrink-0 rounded-full p-0.5 opacity-70 hover:opacity-100`,children:(0,R.jsx)(Fe,{size:14})})]})}var zf=`nm.cloud.first_sign_in`,Bf=`nm:first-sign-in`;function Vf(){try{sessionStorage.setItem(zf,`1`)}catch{}window.dispatchEvent(new Event(Bf))}function Hf(){try{sessionStorage.removeItem(zf)}catch{}window.dispatchEvent(new Event(Bf))}function Uf(){try{return sessionStorage.getItem(zf)===`1`}catch{return!1}}function Wf(){let[e,t]=(0,L.useState)(Uf);return(0,L.useEffect)(()=>{let e=()=>t(Uf());return window.addEventListener(Bf,e),()=>window.removeEventListener(Bf,e)},[]),e}function Gf(){let e=s(),{toast:t,refreshHub:n,setTab:r,state:a}=E(),o=_e(a.hub?.account),[c,l]=(0,L.useState)(`password`),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(null),v=async()=>{Hf(),await n().catch(()=>void 0)},y=async()=>{if(!(u.length<8||u!==f)){h(!0),_(null);try{await M.cloudPassword(u),t(e(`Password set.`)),d(``),p(``),l(`source`)}catch(t){_(e(t.message))}finally{h(!1)}}},b=async()=>{await v(),Nf(r,o.preset)},x=(0,L.useRef)(null);On(x,!0);let S=f.length>0&&f!==u;return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-end justify-center bg-black/40 backdrop-blur-[2px] sm:items-center`,role:`dialog`,"aria-modal":`true`,children:(0,R.jsxs)(`div`,{ref:x,className:`safe-bottom w-full max-w-[520px] rounded-t-[28px] bg-bg p-6 shadow-2xl sm:rounded-[28px]`,children:[(0,R.jsxs)(`div`,{className:`mb-4 flex gap-1`,children:[(0,R.jsx)(`span`,{className:i(`h-1.5 w-5 rounded-full bg-accent`)}),(0,R.jsx)(`span`,{className:i(`h-1.5 rounded-full transition-all`,c===`source`?`w-5 bg-accent`:`w-1.5 bg-border`)})]}),c===`password`?(0,R.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`span`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-accent/12 text-accent`,children:(0,R.jsx)(xt,{size:20})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-[20px] font-bold tracking-tight`,children:e(`Set a password`)}),(0,R.jsx)(`p`,{className:`mt-1 text-[13.5px] leading-relaxed text-muted`,children:e(`Your account is in. With a password, your phone and your other computers sign in at once, without waiting for a code. Optional; you can set one later under Account.`)})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`input`,{type:`password`,value:u,onChange:e=>d(e.target.value),autoComplete:`new-password`,autoFocus:!0,placeholder:e(`At least 8 characters`),className:Ie}),(0,R.jsx)(`input`,{type:`password`,value:f,onChange:e=>p(e.target.value),autoComplete:`new-password`,placeholder:e(`Once more`),className:i(Ie,S&&`border-rose-400`)}),S&&(0,R.jsx)(`p`,{className:`text-[12px] text-rose-600 dark:text-rose-300`,children:e(`The two do not match.`)})]}),g&&(0,R.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:g}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>l(`source`),className:je,children:e(`Skip`)}),(0,R.jsxs)(`button`,{type:`submit`,disabled:m||u.length<8||u!==f,className:i(Ne,`flex-1 py-3`),children:[m?(0,R.jsx)(A,{size:15,className:`animate-spin`}):null,` `,e(`Set the password`),` `,(0,R.jsx)(qe,{size:16})]})]})]}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`span`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-accent/12 text-accent`,children:(0,R.jsx)(ot,{size:20})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-[20px] font-bold tracking-tight`,children:e(`Which model answers?`)}),(0,R.jsx)(`p`,{className:`mt-1 text-[13.5px] leading-relaxed text-muted`,children:e(`Your account already brings one. You can add your own API key as well and switch at any time.`)})]})]}),(0,R.jsxs)(`ul`,{className:`space-y-2 text-[13px] leading-snug`,children:[(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2 px-3 py-2.5`,children:[(0,R.jsx)(ot,{size:16,className:`mt-0.5 shrink-0 text-accent`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e(`Use the nanoMuse Cloud model`)}),(0,R.jsx)(`span`,{className:`block text-muted`,children:e(`DeepSeek for the chat and Qwen for the hands, with a free allowance per account paid by the developer. Nothing to configure.`)})]})]}),(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2 px-3 py-2.5`,children:[(0,R.jsx)(xt,{size:16,className:`mt-0.5 shrink-0 text-accent`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e(`I have my own API key`)}),(0,R.jsx)(`span`,{className:`block text-muted`,children:o.preset===`qwen`?e(`Alibaba Cloud Bailian first (one key covers chat, the hands, pictures and clips), then DeepSeek, Kimi, Zhipu, OpenAI, OpenRouter and any OpenAI-compatible endpoint. The key stays on this device.`):e(`OpenRouter first (one account, one key, pay as you go), then OpenAI, Anthropic, Gemini, DeepSeek and any OpenAI-compatible endpoint. The key stays on this device.`)})]})]}),(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2 px-3 py-2.5`,children:[(0,R.jsx)(wt,{size:16,className:`mt-0.5 shrink-0 text-accent`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e(`Sign in with a plan you already pay for`)}),(0,R.jsx)(`span`,{className:`block text-muted`,children:e(`A ChatGPT plan signs in from Connections and answers the chat and the hands. Pictures and clips still want a key.`)})]})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void b(),className:je,children:e(`I have my own API key`)}),(0,R.jsxs)(`button`,{type:`button`,disabled:m,onClick:()=>void v(),className:i(Ne,`flex-1 py-3`),children:[e(`Use the nanoMuse Cloud model`),` `,(0,R.jsx)(qe,{size:16})]})]})]})]})})}var Kf=`nanomuse_devtools`;function qf(){try{return localStorage.getItem(Kf)===`1`}catch{return!1}}var Jf=qf(),Yf=new Set;function Xf(){return Jf}function Zf(e){Jf=e;try{localStorage.setItem(Kf,e?`1`:`0`)}catch{}Yf.forEach(e=>e())}function Qf(e){return Yf.add(e),()=>Yf.delete(e)}function $f(){return(0,L.useSyncExternalStore)(Qf,Xf,Xf)}function ep(e,t,n){if(!n.signedIn||n.chatOnCloud||n.deviceChat)return;let r=e[t];if(r?.type===`notice`&&r.level===`error`&&r.code&&r.code!==`allowance`&&!r.model_used)for(let n=t-1;n>=0;n--){let t=e[n];if(t?.type===`user`){let e=(t.files??[]).map(e=>e.path);return t.text||e.length>0?{text:t.text,files:e}:void 0}}}var tp=[`idle`,`working`,`waiting`,`happy`,`error`];function np({event:e,name:t=`nanoMuse`}){let n=s(),{toast:r}=E(),[a,o]=(0,L.useState)(null),c=e.cost??{},l=e.candidates??[null,null,null,null],u=e.moods??{},d=e.clips??{},f=async(e,t)=>{o(e);try{await t()}catch(e){r(e.message)}finally{o(null)}},p=e.stage===`estimate`||e.stage===`drawing`||e.stage===`choose`||e.stage===`posing`||e.stage===`animating`,m=c.clips?n(`{n} pictures and {c} clips`,{n:c.pictures??8,c:c.clips}):n(`{n} pictures`,{n:c.pictures??8}),g=(()=>{if(c.cloud===!1)return n(`{what}, made with your own key at your provider's prices.`,{what:m});if(c.error)return n(`The cost could not be checked: {error}`,{error:c.error});if(typeof c.cny!=`number`)return n(`Checking the cost…`);if(c.unlimited)return n(`About ¥{cny} for {what}; your account has no limit.`,{cny:c.cny.toFixed(2),what:m});let e=typeof c.left_cny==`number`?c.left_cny.toFixed(2):`?`;return c.affordable===!1?n(`About ¥{cny} for {what}, more than the ¥{left} left in your allowance.`,{cny:c.cny.toFixed(2),what:m,left:e}):n(`About ¥{cny} for {what}; ¥{left} left in your allowance.`,{cny:c.cny.toFixed(2),what:m,left:e})})();return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`div`,{className:i(`w-full max-w-[360px] overflow-hidden rounded-3xl rounded-tl-lg border bg-surface shadow-sm`,p?`border-accent/50`:`border-border/70`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 pt-3.5 pb-2`,children:[(0,R.jsx)(`div`,{className:i(`mt-0.5 rounded-full p-2`,p?`bg-accent/12 text-accent`:`bg-surface-2 text-fg/80`),children:(0,R.jsx)(nn,{size:18})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`text-[12.5px] font-medium text-muted`,children:[e.stage===`estimate`&&n(`A new look for {name}`,{name:t}),e.stage===`drawing`&&n(`Drawing four to choose from…`),e.stage===`choose`&&n(`Pick one: tap it, or say which`),e.stage===`posing`&&n(`Drawing the poses…`),e.stage===`animating`&&n(`The new look is on; making the clips…`),e.stage===`done`&&n(`The new look is on`),e.stage===`cancelled`&&n(`Not this time`),e.stage===`failed`&&n(`That did not work`)]}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[14px] leading-snug`,children:e.description}),e.reference&&(0,R.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-[12px] text-muted`,children:[(0,R.jsx)(`img`,{src:h(e.reference),alt:``,draggable:!1,className:`h-9 w-9 rounded-lg object-cover`}),n(`drawn from the picture you attached`)]})]})]}),e.stage===`estimate`&&(0,R.jsxs)(`div`,{className:`px-4 pb-3.5 space-y-2.5`,children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:g}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:a!==null||c.cloud!==!1&&typeof c.cny!=`number`&&!c.error,onClick:()=>f(`start`,()=>M.avatarStart(e.session)),className:i(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`inline-flex items-center gap-1.5 py-2`),children:[a===`start`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(nn,{size:14}),` `,n(`Draw`)]}),(0,R.jsxs)(`button`,{type:`button`,disabled:a!==null,onClick:()=>f(`cancel`,()=>M.avatarCancel(e.session)),className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Fe,{size:14}),` `,n(`Not now`)]})]})]}),(e.stage===`drawing`||e.stage===`choose`)&&(0,R.jsxs)(`div`,{className:`px-4 pb-3.5 space-y-2.5`,children:[(0,R.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:l.map((t,r)=>(0,R.jsxs)(`button`,{type:`button`,disabled:!t||e.stage!==`choose`||a!==null,onClick:()=>f(`pick${r}`,()=>M.avatarChoose(e.session,r)),"aria-label":n(`Candidate {n}`,{n:r+1}),className:i(`relative aspect-square overflow-hidden rounded-2xl bg-[#f1efeb] transition`,t&&e.stage===`choose`?`hover:ring-2 hover:ring-accent`:``),children:[t?(0,R.jsx)(`img`,{src:h(t),alt:``,draggable:!1,className:`h-full w-full object-cover`}):(0,R.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center text-muted`,children:e.stage===`drawing`?(0,R.jsx)(A,{size:20,className:`animate-spin`}):(0,R.jsx)(Fe,{size:18,className:`opacity-50`})}),a===`pick${r}`&&(0,R.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-bg/60`,children:(0,R.jsx)(A,{size:20,className:`animate-spin`})}),(0,R.jsx)(`span`,{className:`absolute left-1.5 top-1.5 rounded-full bg-bg/80 px-1.5 text-[10.5px] font-semibold text-fg/80`,children:r+1})]},r))}),e.errors&&e.errors.length>0&&(0,R.jsx)(`p`,{className:`text-[12px] text-rose-600 dark:text-rose-300`,children:n(e.errors[0])}),e.stage===`choose`&&(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:a!==null,onClick:()=>f(`redraw`,()=>M.avatarStart(e.session)),className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:[a===`redraw`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(Re,{size:14}),` `,n(`Redraw`)]}),(0,R.jsxs)(`button`,{type:`button`,disabled:a!==null,onClick:()=>f(`cancel`,()=>M.avatarCancel(e.session)),className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Fe,{size:14}),` `,n(`Not now`)]})]})]}),(e.stage===`posing`||e.stage===`animating`||e.stage===`done`)&&(0,R.jsxs)(`div`,{className:`px-4 pb-3.5 space-y-2`,children:[(0,R.jsx)(`div`,{className:`flex gap-1.5`,children:tp.map(t=>(0,R.jsxs)(`div`,{className:`relative aspect-square flex-1 overflow-hidden rounded-xl bg-[#f1efeb]`,children:[d[t]?(0,R.jsx)(`video`,{src:h(d[t]),poster:u[t]?h(u[t]):void 0,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,disablePictureInPicture:!0,className:`h-full w-full object-cover`},d[t]):u[t]?(0,R.jsx)(`img`,{src:h(u[t]),alt:``,draggable:!1,className:`h-full w-full object-cover`}):(0,R.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center text-muted`,children:(0,R.jsx)(A,{size:14,className:`animate-spin`})}),e.stage===`animating`&&u[t]&&!d[t]&&t!==`error`&&(0,R.jsx)(`span`,{className:`absolute bottom-1 right-1 rounded-full bg-white/80 p-0.5 text-muted`,children:(0,R.jsx)(A,{size:10,className:`animate-spin`})})]},t))}),e.stage===`done`?(0,R.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[12.5px] text-muted`,children:[(0,R.jsx)(ke,{size:14,className:`text-emerald-600`}),` `,n(`Idle, working, waiting, happy, sorry: the face follows what {name} is doing.`,{name:t})]}):e.stage===`animating`?(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:n(`The face is already on; four short clips are being made from the poses, a few minutes.`)}):(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:n(`Four more pictures from the one you picked; this takes a minute or two.`)}),e.errors&&e.errors.length>0&&e.stage===`done`&&(0,R.jsxs)(`p`,{className:`text-[12px] text-muted`,children:[e.errors.some(e=>!e.includes(` clip:`))&&n(`Some poses could not be drawn and show the idle picture instead.`),` `,e.errors.some(e=>e.includes(` clip:`))&&n(`Some clips could not be made; those moods stay still.`)]})]}),(e.stage===`failed`||e.stage===`cancelled`)&&e.message&&(0,R.jsx)(`p`,{className:`px-4 pb-3.5 text-[12.5px] text-muted`,children:n(e.message)})]})})}function rp(){let e=ip();if(!e||typeof e.keepRunning!=`function`)return null;try{return JSON.parse(e.keepRunning())}catch{return null}}function ip(){return window.NanoMuseAndroid??null}function ap(){let e=ip();return!!e&&typeof e.takeOverBrowser==`function`&&(typeof e.hasBrowser!=`function`||e.hasBrowser())}function op(){let e=ip();if(!e||typeof e.accessibilityState!=`function`)return null;let t=e.accessibilityState();return t===`on`||t===`off`||t===`unsupported`?t:null}function sp(e,t=15){switch(e){case`web_search`:return(0,R.jsx)(qt,{size:t});case`web_fetch`:case`browser`:return(0,R.jsx)(gt,{size:t});case`files`:return(0,R.jsx)(mt,{size:t});case`shell`:return(0,R.jsx)(dn,{size:t});case`python_execute`:return(0,R.jsx)(ct,{size:t});case`read_emails`:case`send_email`:return(0,R.jsx)(Et,{size:t});case`goals`:return(0,R.jsx)(un,{size:t});case`remember`:case`recall`:case`forget`:return(0,R.jsx)(Qe,{size:t});case`ask_user`:return(0,R.jsx)(kt,{size:t});case`devices`:return(0,R.jsx)(It,{size:t});case`device_shell`:return(0,R.jsx)(dn,{size:t});case`device_files`:case`device_get`:case`device_put`:return(0,R.jsx)(mt,{size:t});case`device_open`:return(0,R.jsx)(Ae,{size:t});case`device_screen`:return(0,R.jsx)(Lt,{size:t});case`device_notify`:return(0,R.jsx)(Xe,{size:t});case`delegate`:return(0,R.jsx)(Jt,{size:t});case`computer_screen`:return(0,R.jsx)(Lt,{size:t});case`computer_act`:return(0,R.jsx)(zt,{size:t});case`computer_task`:case`computer_app`:return(0,R.jsx)(vt,{size:t});case`phone_screen`:case`phone_act`:case`phone_task`:return(0,R.jsx)(tn,{size:t});default:return(0,R.jsx)(Ze,{size:t})}}function cp({device:e,className:t}){let n=s();return(0,R.jsxs)(`span`,{className:i(`inline-flex max-w-full items-center gap-1 rounded-full bg-accent/12 px-2 py-0.5 text-[11px] font-medium text-accent`,t),children:[(0,R.jsx)(It,{size:11,className:`shrink-0`}),` `,(0,R.jsx)(`span`,{className:`truncate`,children:n(`on {device}`,{device:e})})]})}var lp={safe:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,moderate:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,sensitive:`bg-rose-500/15 text-rose-700 dark:text-rose-300`};function up({risk:e}){return(0,R.jsx)(`span`,{className:i(`px-2 py-0.5 rounded-full text-[11px] font-semibold uppercase tracking-wide`,lp[e]),children:_(e)})}function dp({args:e}){let t=Object.entries(e??{}).filter(([,e])=>e!=null&&e!==``);return t.length?(0,R.jsx)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[13px]`,children:t.map(([e,t])=>(0,R.jsxs)(`div`,{className:`contents`,children:[(0,R.jsx)(`dt`,{className:`text-muted`,children:e}),(0,R.jsx)(`dd`,{className:`break-words whitespace-pre-wrap font-mono text-[12.5px] leading-snug`,children:String(t)})]},e))}):null}function fp({event:e}){let[t,n]=(0,L.useState)(!1),r=e.status===`running`?(0,R.jsx)(A,{size:14,className:`animate-spin text-accent`}):e.status===`ok`?(0,R.jsx)(ke,{size:14,className:`text-emerald-500`}):e.status===`blocked`?(0,R.jsx)(Ye,{size:14,className:`text-rose-500`}):(0,R.jsx)(Fe,{size:14,className:`text-rose-500`});return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`max-w-full text-left rounded-2xl bg-surface-2/80 border border-border/60 px-3 py-1.5 text-[13px] text-muted hover:text-fg transition`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-muted`,children:sp(e.tool)}),(0,R.jsx)(`span`,{className:`truncate flex-1`,children:e.title||e.summary||e.tool}),e.device&&(0,R.jsx)(cp,{device:e.device}),r,e.output?t?(0,R.jsx)(Me,{size:13}):(0,R.jsx)(rt,{size:13}):null]}),t&&(0,R.jsxs)(`div`,{className:`mt-2 text-fg`,children:[(0,R.jsx)(dp,{args:e.args}),e.output&&(0,R.jsx)(`pre`,{className:`mt-2 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-bg p-2 text-[12px] leading-snug`,children:e.output})]})]})})}function pp(e,t,n){if(!t)return e.replace(/_/g,` `);switch(e){case`shell`:return _(`{what} commands`,{what:t.split(`,`).join(`, `)});case`send_email`:return _(`email to {who}`,{who:t.split(`,`).join(`, `)});case`remote_control`:return _(`the device {name}`,{name:typeof n?.device==`string`&&n.device?n.device:t});case`computer_app`:return _(`the hands in {app}`,{app:typeof n?.name==`string`&&n.name?n.name:t});default:return t}}function mp(e,t,n,r){switch(e){case`once`:return _(`Once`);case`conversation`:return _(`For this conversation`);case`session`:return _(`Until restart`);case`24h`:return _(`For 24 hours`);case`always`:return _(`Always for {subject}`,{subject:pp(t,n,r)});default:return e}}function hp({event:e,name:t=`nanoMuse`,onDecide:n}){let[r,a]=(0,L.useState)(!1),[o,c]=(0,L.useState)(!1),[l,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(!1),m=(e,t)=>{f||(p(!0),Promise.resolve(n(e,t)).finally(()=>p(!1)))},h=(0,L.useRef)(null),g=(0,L.useRef)(null),_=s(),y=e.status===`pending`,b=e.risk===`sensitive`,x=(e.grant_options??[`once`]).filter(e=>e!==`once`),S=e.egress_target||([`web_fetch`,`browser`,`web_search`].includes(e.tool)?e.target:null),C=e.tool===`send_email`?e.target:null,w=Object.values(e.args??{}).some(e=>e!=null&&e!==``);return(0,L.useEffect)(()=>{let e=g.current;e&&!r&&d(e.scrollHeight>e.clientHeight+2)},[e.args,r]),(0,L.useEffect)(()=>{(r||o)&&h.current?.scrollIntoView({block:`end`,behavior:`smooth`})},[r,o]),(0,R.jsx)(`div`,{className:`rise flex justify-start`,ref:h,children:(0,R.jsxs)(`div`,{className:i(`w-full max-w-[600px] overflow-hidden rounded-[22px] bg-surface shadow-[0_2px_12px_rgba(0,0,0,0.12)] dark:border dark:border-border dark:shadow-none`,y&&b&&`border border-rose-400/60`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 pt-4 pb-2`,children:[(0,R.jsx)(`div`,{className:i(`flex h-10 w-10 shrink-0 items-center justify-center rounded-full`,b?`bg-rose-500/12 text-rose-500`:`bg-surface-2 text-fg`),children:b?(0,R.jsx)(Zt,{size:22}):sp(e.tool,22)}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[12.5px] font-medium text-muted`,children:[(0,R.jsx)(`span`,{children:e.remote?_(`{name} on {device} wants to`,{name:t,device:e.remote.name}):_(`{name} wants to`,{name:t})}),e.remote&&(0,R.jsx)(cp,{device:e.remote.name})]}),(0,R.jsx)(`div`,{className:`mt-0.5 break-words text-[17px] font-semibold leading-[22px]`,children:e.summary}),S?(0,R.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[13px] text-muted`,children:[(0,R.jsx)(gt,{size:12}),` `,(0,R.jsx)(`span`,{className:`truncate`,children:_(`at {host}`,{host:S})})]}):C?(0,R.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[13px] text-muted`,children:[(0,R.jsx)(Et,{size:12}),` `,(0,R.jsx)(`span`,{className:`truncate`,children:_(`to {recipient}`,{recipient:C})})]}):null,e.purpose&&(0,R.jsx)(`div`,{className:`mt-1.5 break-words text-[13px] leading-snug text-muted line-clamp-2`,children:e.purpose}),b&&(0,R.jsx)(`div`,{className:`mt-1.5`,children:(0,R.jsx)(up,{risk:e.risk})})]})]}),e.warnings?.length>0&&(0,R.jsx)(`div`,{className:`space-y-1 px-4 pb-2`,children:e.warnings.map(e=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[12.5px] text-rose-600 dark:text-rose-300`,children:[(0,R.jsx)(pn,{size:13,className:`mt-0.5 shrink-0`}),` `,(0,R.jsx)(`span`,{children:_(e)})]},e))}),(w||e.reasons?.length>0)&&(0,R.jsx)(`div`,{className:`px-4 pb-2`,children:(0,R.jsxs)(`div`,{className:`rounded-xl bg-surface-2 px-3 py-2.5`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-medium text-muted`,children:_(`Exactly what will run`)}),(0,R.jsxs)(`div`,{ref:g,className:i(`-mt-1`,!r&&`max-h-40 overflow-hidden`),children:[(0,R.jsx)(dp,{args:e.args}),e.reasons?.length>0&&(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:_(`Why it asks: {reasons}`,{reasons:e.reasons.map(v).join(` · `)})})]}),(l||r)&&(0,R.jsxs)(`button`,{type:`button`,className:`mt-1 flex items-center gap-1 text-[12.5px] text-accent`,onClick:()=>a(e=>!e),children:[r?(0,R.jsx)(Me,{size:13}):(0,R.jsx)(rt,{size:13}),` `,_(r?`Fewer options`:`Show all`)]})]})}),y?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pb-4 pt-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!0,`once`),disabled:f,className:`h-[46px] w-full rounded-full bg-accent text-[15px] font-semibold text-accent-fg transition active:scale-[0.98] disabled:opacity-60`,children:_(`Allow once`)}),x.filter(e=>o||e===`conversation`||e===`always`).map(t=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!0,t),disabled:f,className:`h-11 w-full truncate rounded-full bg-surface-2 px-4 text-[15px] font-medium transition active:scale-[0.98] disabled:opacity-60`,children:mp(t,e.tool,e.target,e.args)},t)),(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!1,`once`),disabled:f,className:`h-11 w-full rounded-full bg-surface-2 text-[15px] font-medium transition active:scale-[0.98] disabled:opacity-60`,children:_(`Deny`)}),x.length===0?(0,R.jsx)(`div`,{className:`text-center text-[12px] text-muted`,children:_(`This kind of action is approved one at a time.`)}):!o&&x.some(e=>e!==`conversation`&&e!==`always`)&&(0,R.jsx)(`button`,{type:`button`,className:`self-center text-[12.5px] text-muted`,onClick:()=>c(!0),children:_(`Allow {subject} for longer…`,{subject:pp(e.tool,e.target,e.args)})})]}):(0,R.jsxs)(`div`,{className:i(`flex items-center gap-1.5 border-t border-border px-4 py-2.5 text-[13px] font-medium`,e.status===`approved`?`text-emerald-600 dark:text-emerald-300`:`text-muted`),children:[e.status===`approved`?(0,R.jsx)(ke,{size:15}):(0,R.jsx)(Fe,{size:15}),e.status===`approved`?`${_(`Approved`)}${e.scope&&e.scope!==`once`?` · ${mp(e.scope,e.tool,e.target).toLowerCase()}`:``}`:e.status===`denied`?_(`Denied`):_(`Expired without an answer`),(0,R.jsx)(`span`,{className:`ml-auto font-normal`,children:u(e.updated_ts??e.ts)})]})]})})}function gp({event:e,name:t}){let n=s();return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`div`,{className:`max-w-full rounded-[20px] rounded-bl-md border border-accent/30 bg-surface px-4 py-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12.5px] font-medium text-accent`,children:[(0,R.jsx)(kt,{size:14}),` `,n(`{name} asks`,{name:t})]}),(0,R.jsx)(`div`,{className:`mt-1 text-[15px] leading-snug whitespace-pre-wrap break-words`,children:e.text}),e.status===`pending`&&(0,R.jsx)(`div`,{className:`mt-1.5 text-[12.5px] text-muted`,children:n(`Reply below to continue.`)}),e.status===`answered`&&e.answer&&(0,R.jsxs)(`div`,{className:`mt-2 text-[13px] text-muted border-t border-border pt-2`,children:[n(`You:`),` `,(0,R.jsx)(`span`,{className:`text-fg`,children:e.answer})]})]})})}function _p(e){return e.source===`reminder`||e.source===`memory`?t(e.text):_(e.text,e.vars)}function vp({event:e,onCloudRetry:t}){let n=s(),[r,a]=(0,L.useState)(!1),[o,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(null),d=e.detail&&e.detail!==e.text?e.detail:null;return e.code===`allowance`&&e.allowance?(0,R.jsxs)(`div`,{className:`rise flex flex-col items-center gap-2 px-6`,children:[(0,R.jsx)(`div`,{className:`max-w-full rounded-2xl bg-amber-500/12 px-3 py-1.5 text-center text-[12.5px] leading-snug text-amber-700 dark:text-amber-300`,children:n(e.text)}),(0,R.jsx)(`div`,{className:`w-full max-w-[520px]`,children:(0,R.jsx)(Ff,{info:e.allowance,exhausted:!0,compact:!0})})]}):(0,R.jsx)(`div`,{className:`rise flex justify-center px-6`,children:(0,R.jsxs)(`div`,{className:i(`max-w-full rounded-2xl px-3 py-1.5 text-center text-[12.5px] leading-snug`,e.level===`info`&&`bg-surface-2/70 text-muted`,e.level===`warn`&&`bg-amber-500/12 text-amber-700 dark:text-amber-300`,e.level===`error`&&`bg-rose-500/12 text-rose-700 dark:text-rose-300`),children:[_p(e),d&&(0,R.jsxs)(R.Fragment,{children:[` `,(0,R.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`underline decoration-dotted underline-offset-2 opacity-70 hover:opacity-100`,children:n(r?`Hide details`:`Details`)}),r&&(0,R.jsx)(`div`,{className:`mt-1.5 break-all text-left font-mono text-[11px] opacity-80`,children:d})]}),t&&(0,R.jsxs)(`div`,{className:`mt-1.5 flex flex-col items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>{t&&(c(!0),u(null),t().catch(e=>u(n(e.message||`Could not send`))).finally(()=>c(!1)))},className:`rounded-full bg-accent/12 px-3 py-1 text-[12px] font-medium text-accent disabled:opacity-50`,children:n(`Use nanoMuse Cloud this time`)}),l&&(0,R.jsx)(`div`,{className:`text-[12px] text-rose-700 dark:text-rose-300`,children:l})]})]})})}function yp({event:e,onOpen:t}){let[r,i]=(0,L.useState)(!1),a=s(),o=e.status===`live`,c=e.url;try{c=new URL(e.url).host}catch{}return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-label":a(`Browser: {title}`,{title:e.title||c}),className:`w-full max-w-[340px] overflow-hidden rounded-3xl rounded-tl-lg border border-border bg-surface shadow-sm hover:bg-surface-2 transition text-left`,children:[(0,R.jsxs)(`div`,{className:`relative aspect-[16/10] bg-surface-2`,children:[r?(0,R.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-1 text-muted`,children:[(0,R.jsx)(gt,{size:22}),(0,R.jsx)(`span`,{className:`text-[12px]`,children:a(`Frame no longer available`)})]}):(0,R.jsx)(`img`,{src:n(e.thread,e.frame),alt:e.title||c,onError:()=>i(!0),className:`absolute inset-0 h-full w-full object-cover object-top`},e.frame),(0,R.jsx)(`div`,{className:`absolute left-2.5 top-2.5 flex items-center gap-1.5 rounded-full bg-black/60 px-2 py-0.5 text-[10.5px] font-semibold text-white`,children:o?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-rose-400 animate-pulse`}),` `,a(`LIVE`)]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(gt,{size:11}),` `,a(`BROWSER`)]})})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-3.5 py-2.5`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:e.title||c}),(0,R.jsxs)(`div`,{className:`text-[12px] text-muted truncate`,children:[e.by_user&&e.action.startsWith(`You`)?a(`You`)+e.action.slice(3):e.action,` · `,c]})]}),(0,R.jsx)(rt,{size:16,className:`text-muted shrink-0`})]})]})})}function bp({event:e,name:t=`nanoMuse`}){let n=s(),{state:r,toast:a}=E(),[o,c]=(0,L.useState)(!1),[l,d]=(0,L.useState)(!1),f=e.status===`live`,p=e.last,m=[e.app,e.title].filter(Boolean).join(` · `),h=r.holds.find(t=>t.thread===e.thread&&t.tool===`computer`),g=async()=>{c(!0);try{await M.stopHands()}catch{}finally{c(!1)}},_=async()=>{d(!0);try{await M.openHold(e.thread,`computer`)}catch(e){a(e.message)}finally{d(!1)}};return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`div`,{className:i(`w-full max-w-[360px] overflow-hidden rounded-3xl rounded-tl-lg border bg-surface shadow-sm`,f?`border-accent/50`:`border-border/70`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 pt-3.5 pb-2`,children:[(0,R.jsx)(`div`,{className:i(`mt-0.5 rounded-full p-2`,f?`bg-accent/12 text-accent`:`bg-surface-2 text-fg/80`),children:(0,R.jsx)(vt,{size:18})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[12.5px] font-medium text-muted`,children:[(0,R.jsx)(`span`,{children:f?n(`{name} is using this computer`,{name:t}):e.status===`stopped`?n(`Hands stopped`):n(`Hands done`)}),f&&(0,R.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full bg-accent/12 px-2 py-0.5 text-[10.5px] font-semibold text-accent`,children:[(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-accent`}),` `,n(`LIVE`)]})]}),e.text&&(0,R.jsx)(`div`,{className:`mt-0.5 break-words text-[15px] font-semibold leading-snug`,children:e.text}),p?.action&&(0,R.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 text-[13px] text-fg/90`,children:[(0,R.jsx)(zt,{size:13,className:`shrink-0 text-muted`}),(0,R.jsx)(`span`,{className:`truncate`,children:Tp(p,n)})]}),m&&(0,R.jsx)(`div`,{className:`mt-1 truncate text-[12px] text-muted`,children:m}),e.notice&&(0,R.jsx)(`div`,{className:`mt-1.5 rounded-2xl bg-amber-500/12 px-3 py-1.5 text-[12.5px] text-amber-700 dark:text-amber-300`,children:e.notice}),f&&h&&(0,R.jsx)(xp,{hold:h})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/70 px-4 py-2 text-[12px] text-muted`,children:[(0,R.jsx)(`span`,{children:n(`{n} steps`,{n:e.steps})}),(0,R.jsx)(`span`,{className:`ml-auto`,children:u(e.updated_ts??e.ts)}),f&&!h&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void _(),disabled:l,className:`ml-1 inline-flex items-center gap-1.5 rounded-full bg-accent/12 px-3 py-1 text-[12.5px] font-semibold text-accent transition active:scale-95 disabled:opacity-60`,children:[(0,R.jsx)(vt,{size:11}),` `,n(`Take over`)]}),f&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void g(),disabled:o,className:`ml-1 inline-flex items-center gap-1.5 rounded-full bg-fg px-3 py-1 text-[12.5px] font-semibold text-bg transition active:scale-95 disabled:opacity-60`,children:[(0,R.jsx)(sn,{size:10,fill:`currentColor`}),` `,n(`Stop`)]})]})]})})}function xp({hold:e,compact:t}){let n=s(),[r,a]=(0,L.useState)(!1),o=async()=>{a(!0);try{await M.doneHold(e.id)}catch{}finally{a(!1)}};return(0,R.jsxs)(`div`,{className:i(`flex items-center gap-2 rounded-2xl bg-amber-500/12 px-3 text-amber-800 dark:text-amber-200`,t?`py-1.5 text-[12.5px]`:`mt-1.5 py-2 text-[13px]`),children:[(0,R.jsx)(vt,{size:14,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:Cp(e,n)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:r,className:`shrink-0 rounded-full bg-fg px-3 py-1 text-[12.5px] font-semibold text-bg transition active:scale-95 disabled:opacity-60`,children:r?(0,R.jsx)(A,{size:13,className:`animate-spin`}):n(`Done`)})]})}function Sp(e,t){return t(e===`browser`?`the browser`:e===`phone`?`the phone`:`this computer`)}function Cp(e,t){return e.by===`agent`?e.reason?t(`Your turn: {reason}`,{reason:e.reason}):t(`Your turn`):t(`You took over {thing}`,{thing:Sp(e.tool,t)})}function wp({event:e,name:t=`nanoMuse`}){let n=s(),[r,a]=(0,L.useState)(!1),o=e.status===`on`,c=Sp(e.tool,n),l=async()=>{a(!0);try{await M.doneHold(e.id)}catch{}finally{a(!1)}},d=e.timed_out?n(`{name} waited ten minutes and went on without you.`,{name:t}):e.stale?n(`Ended when the runtime restarted.`):e.by===`agent`?n(`You did it; {name} carried on.`,{name:t}):n(`Handed back; {name} carried on.`,{name:t});return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`div`,{className:i(`w-full max-w-[360px] overflow-hidden rounded-3xl rounded-tl-lg border bg-surface shadow-sm`,o?`border-amber-500/50`:`border-border/70 opacity-70`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 pt-3.5 pb-3`,children:[(0,R.jsx)(`div`,{className:i(`mt-0.5 rounded-full p-2`,o?`bg-amber-500/15 text-amber-700 dark:text-amber-300`:`bg-surface-2 text-fg/70`),children:(0,R.jsx)(vt,{size:18})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[12.5px] font-medium text-muted`,children:e.tool===`browser`?n(`The browser`):e.tool===`phone`?n(`The phone`):n(`This computer`)}),(0,R.jsx)(`div`,{className:`mt-0.5 break-words text-[15px] font-semibold leading-snug`,children:e.by===`agent`?n(`Your turn`):n(`You took over {thing}`,{thing:c})}),e.by===`agent`&&e.reason&&(0,R.jsx)(`div`,{className:`mt-1 break-words text-[13.5px] leading-snug text-fg/90`,children:e.reason}),(0,R.jsx)(`div`,{className:`mt-1.5 text-[12.5px] leading-snug text-muted`,children:o?e.by===`agent`?n(`Do this part yourself, then press Done. {name} looks again and carries on from there.`,{name:t}):n(`{name} waits. Press Done when you are finished and it looks again.`,{name:t}):d})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/70 px-4 py-2 text-[12px] text-muted`,children:[(0,R.jsx)(`span`,{children:u(e.ts)}),o&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void l(),disabled:r,className:`ml-auto inline-flex items-center gap-1.5 rounded-full bg-fg px-3.5 py-1 text-[12.5px] font-semibold text-bg transition active:scale-95 disabled:opacity-60`,children:[r?(0,R.jsx)(A,{size:13,className:`animate-spin`}):(0,R.jsx)(ke,{size:12}),` `,n(`Done`)]})]})]})})}function Tp(e,t){let n=e.label?`“${e.label}”`:``;switch(e.action){case`click`:return n?t(`Clicked {label}`,{label:n}):t(`Clicked`);case`double_click`:return n?t(`Double-clicked {label}`,{label:n}):t(`Double-clicked`);case`right_click`:case`middle_click`:return n?t(`Right-clicked {label}`,{label:n}):t(`Right-clicked`);case`move`:return n?t(`Pointed at {label}`,{label:n}):t(`Moved the mouse`);case`type`:return t(`Typed {n} characters`,{n:(e.text??``).length});case`key`:return t(`Pressed {keys}`,{keys:(e.keys??[]).join(`+`)});case`scroll`:return t(`Scrolled`);case`drag`:return t(`Dragged`);case`open_app`:return n?t(`Opened {label}`,{label:n}):t(`Opened an application`);case`wait`:return t(`Waited`);default:return e.action??``}}function Ep({event:e,onOpen:t}){let n=s(),a=r(e.name),o=n(a===`html`?`Page`:a===`image`?`Image`:a===`data`?`Data`:a===`code`?`Code`:a===`event`?`Event`:`Document`),c=e.action===`update`?`${o} · ${n(`updated`)}`:o,l=a===`html`||a===`image`;return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path),className:i(`max-w-full overflow-hidden rounded-[20px] border border-border bg-surface text-left shadow-[0_4px_20px_-12px_rgba(0,0,0,0.2)] transition hover:bg-surface-2`,l?`w-[300px]`:``),children:[l&&(0,R.jsx)(Dp,{path:e.path,kind:a}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,children:[!l&&(0,R.jsx)(`div`,{className:`rounded-2xl bg-accent/12 p-2.5 text-accent`,children:a===`code`?(0,R.jsx)(ct,{size:20}):a===`event`?(0,R.jsx)(tt,{size:20}):(0,R.jsx)(mt,{size:20})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted`,children:c}),(0,R.jsx)(`div`,{className:`truncate text-[14.5px] font-medium`,children:e.name}),(0,R.jsx)(`div`,{className:`truncate text-[12px] text-muted`,children:e.path})]}),(0,R.jsx)(rt,{size:16,className:`ml-1 shrink-0 text-muted`})]})]})})}function Dp({path:e,kind:t}){return t===`image`?(0,R.jsx)(`img`,{src:h(e),alt:``,loading:`lazy`,className:`h-40 w-full object-cover`}):(0,R.jsx)(`div`,{className:`pointer-events-none relative h-40 w-full overflow-hidden bg-white`,children:(0,R.jsx)(`iframe`,{title:e,src:h(e),sandbox:``,tabIndex:-1,loading:`lazy`,scrolling:`no`,className:`absolute left-0 top-0 h-[480px] w-[900px] origin-top-left scale-[0.3333] border-0`})})}function Op({open:e,onClose:t,title:n,children:r,footer:i}){let a=s(),o=(0,L.useRef)(null);return On(o,e),(0,L.useEffect)(()=>{if(!e)return;let n=e=>e.key===`Escape`&&t();return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,R.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-end sm:items-center sm:justify-center`,children:[(0,R.jsx)(`div`,{className:`absolute inset-0 bg-black/45 backdrop-blur-[2px]`,onClick:t}),(0,R.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,className:`sheet-in relative w-full sm:max-w-lg max-h-[92dvh] flex flex-col bg-surface rounded-t-3xl sm:rounded-3xl shadow-2xl border border-border`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 px-5 pt-4 pb-2`,children:[(0,R.jsx)(`div`,{className:`sm:hidden absolute left-1/2 -translate-x-1/2 top-2 h-1 w-10 rounded-full bg-border`}),(0,R.jsx)(`div`,{className:`flex-1 font-semibold text-[17px] mt-1`,children:n}),(0,R.jsx)(`button`,{type:`button`,onClick:t,"aria-label":a(`Close`),className:`p-2 -mr-2 rounded-full text-muted hover:bg-surface-2`,children:(0,R.jsx)(Fe,{size:20})})]}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 pb-4`,children:r}),i&&(0,R.jsx)(`div`,{className:`px-5 pt-2 pb-4 safe-bottom border-t border-border`,children:i})]})]}):null}var kp=1e3;function Ap({thread:e,eventId:t,onClose:r}){let{state:a,toast:o}=E(),c=s(),l=(a.events[e]??[]).find(e=>e.id===t),u=a.holds.find(t=>t.thread===e&&t.tool===`browser`),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)(``),[y,b]=(0,L.useState)(!1),x=(0,L.useRef)(null),S=d?d===`on`:!!u;(0,L.useEffect)(()=>b(!1),[l?.frame]),(0,L.useEffect)(()=>f(null),[u?.id,u?.status]);let C=l?.backend===`device`&&ap();(0,L.useEffect)(()=>{if(!C)return;let t=t=>{let n=t.detail;n?.thread&&n.thread!==e||M.browserControl(e,{action:`handed_back`}).catch(e=>o(e.message))};return window.addEventListener(`nanomuse:browser-handed-back`,t),()=>window.removeEventListener(`nanomuse:browser-handed-back`,t)},[C,e,o]);let w=(0,L.useCallback)(async t=>{m(t.action);try{await M.browserControl(e,t)}catch(e){o(e.message)}finally{m(null)}},[e,o]),T=()=>{if(C){ip()?.takeOverBrowser?.(e),M.browserControl(e,{action:`take_over`}).catch(()=>void 0);return}f(`on`),w({action:`take_over`})},D=()=>{f(`off`),w({action:`handed_back`})};(0,L.useEffect)(()=>{if(!S||C||!l||l.status!==`live`)return;let t=window.setInterval(()=>{document.hidden||M.browserControl(e,{action:`look`}).catch(()=>void 0)},kp);return()=>window.clearInterval(t)},[S,C,e,l]);let O=e=>{if(!S||p)return;let t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width,r=(e.clientY-t.top)/t.height;w({action:`click`,x:Math.min(Math.max(n,0),1),y:Math.min(Math.max(r,0),1)})},k=e=>{!S||p||Math.abs(e.deltaY)<8||w({action:`scroll`,dy:Math.max(-2e3,Math.min(2e3,Math.round(e.deltaY*2)))})};if(!l)return null;let ee=l.url;try{ee=new URL(l.url).host}catch{}let te=l.status===`live`,j=a.profile?.name??`nanoMuse`,ne=u?c(`{name} is waiting for you`,{name:j}):a.status.state!==`idle`&&a.status.thread===e?c(`{name} is working`,{name:j}):l.action;return(0,R.jsxs)(Op,{open:!0,onClose:r,title:(0,R.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,R.jsx)(gt,{size:17,className:`text-accent shrink-0`}),(0,R.jsx)(`span`,{className:`truncate`,children:l.title||ee}),te&&(0,R.jsxs)(`span`,{className:`ml-1 flex items-center gap-1 rounded-full bg-rose-500/12 px-2 py-0.5 text-[10.5px] font-semibold text-rose-500`,children:[(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-rose-500 animate-pulse`}),` `,c(`LIVE`)]})]}),footer:S?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),h&&w({action:`type`,text:h}).then(()=>g(``))},children:[(0,R.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:c(`Type into the focused field…`),className:`flex-1 rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14px] outline-none`,autoComplete:`off`,autoCapitalize:`off`}),(0,R.jsx)(`button`,{type:`submit`,disabled:!h||!!p,"aria-label":c(`Type`),className:`rounded-full bg-accent p-2.5 text-white disabled:opacity-40`,children:p===`type`?(0,R.jsx)(A,{size:16,className:`animate-spin`}):(0,R.jsx)(qe,{size:16})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`key`,key:`Enter`}),disabled:!!p,"aria-label":c(`Press Enter`),className:`rounded-full bg-surface-2 p-2.5 text-fg disabled:opacity-40`,children:(0,R.jsx)(dt,{size:16})})]}),(0,R.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),_&&w({action:`navigate`,url:_}).then(()=>v(``))},children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`back`}),disabled:!!p,"aria-label":c(`Back`),className:`rounded-full bg-surface-2 p-2 text-fg disabled:opacity-40`,children:(0,R.jsx)(Ke,{size:15})}),(0,R.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),placeholder:c(`Open a URL…`),inputMode:`url`,autoCapitalize:`off`,className:`flex-1 min-w-0 rounded-2xl bg-surface-2 px-3.5 py-2 text-[13px] outline-none`}),(0,R.jsx)(`button`,{type:`submit`,disabled:!_||!!p,className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13px] font-medium disabled:opacity-40`,children:c(`Go`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`scroll`,dy:-600}),disabled:!!p,"aria-label":c(`Scroll up`),className:`rounded-full bg-surface-2 p-2 text-fg disabled:opacity-40`,children:(0,R.jsx)(Je,{size:15})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`scroll`,dy:600}),disabled:!!p,"aria-label":c(`Scroll down`),className:`rounded-full bg-surface-2 p-2 text-fg disabled:opacity-40`,children:(0,R.jsx)(Ge,{size:15})})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[12px] text-muted`,children:c(`Tap the page to click. If the browser was closed, open a URL first.`)}),(0,R.jsxs)(`button`,{type:`button`,onClick:D,disabled:p===`handed_back`,className:`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full bg-fg px-3.5 py-1.5 text-[13px] font-semibold text-bg disabled:opacity-60`,children:[p===`handed_back`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(ke,{size:14}),` `,c(`Done`)]})]})]}):(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 text-[12.5px] text-muted truncate`,children:[ne,` · `,ee]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`look`}),disabled:!!p,"aria-label":c(`Refresh`),className:`rounded-full bg-surface-2 p-2 text-muted disabled:opacity-40`,children:p===`look`?(0,R.jsx)(A,{size:15,className:`animate-spin`}):(0,R.jsx)(Re,{size:15})}),(0,R.jsxs)(`button`,{type:`button`,onClick:T,disabled:d===`on`,className:`flex items-center gap-1.5 rounded-full bg-accent px-3.5 py-2 text-[13px] font-semibold text-white disabled:opacity-60`,children:[(0,R.jsx)(vt,{size:14}),` `,c(`Take over`)]})]})]}),children:[u&&u.by===`agent`&&(0,R.jsx)(`div`,{className:`mb-2`,children:(0,R.jsx)(xp,{hold:u,compact:!0})}),(0,R.jsxs)(`div`,{className:i(`relative overflow-hidden rounded-2xl border border-border bg-surface-2`,S&&`ring-2 ring-accent`),children:[y?(0,R.jsxs)(`div`,{className:`flex aspect-[16/10] flex-col items-center justify-center gap-1 text-muted`,children:[(0,R.jsx)(gt,{size:24}),(0,R.jsx)(`span`,{className:`text-[12.5px]`,children:c(`This frame is no longer available.`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`look`}),className:`text-accent text-[13px] font-medium`,children:c(`Look again`)})]}):(0,R.jsx)(`img`,{ref:x,src:n(e,l.frame),alt:l.title||ee,onError:()=>b(!0),onClick:O,onWheel:k,draggable:!1,className:i(`block w-full select-none`,S?`cursor-crosshair`:``)},l.frame),p&&p!==`look`&&(0,R.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/20`,children:(0,R.jsx)(A,{size:26,className:`animate-spin text-white`})})]}),(0,R.jsxs)(`div`,{className:`mt-2 flex items-center justify-between text-[12px] text-muted`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:l.url}),(0,R.jsx)(`span`,{className:`shrink-0 ml-2`,children:l.frames===1?c(`1 frame`):c(`{n} frames`,{n:l.frames})})]}),S&&(0,R.jsxs)(`div`,{className:`mt-3 rounded-2xl bg-accent/8 px-3.5 py-2.5 text-[13px] leading-snug`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:u&&u.by===`agent`?Cp(u,c):c(`You have the page. Press Done when you are finished.`)}),(0,R.jsx)(`div`,{className:`mt-1 text-muted`,children:c(`{name} waits meanwhile, then looks at the page as you left it and carries on. Passwords you type here go to the website, never to the model.`,{name:j})})]})]})}function jp(){if(typeof window>`u`)return null;let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}function Mp(){return jp()!==null}function Np(e,t){let[n,r]=(0,L.useState)(!1),i=(0,L.useRef)(null),a=(0,L.useRef)(``),o=s(),c=(0,L.useCallback)(()=>{i.current?.stop()},[]),l=(0,L.useCallback)(()=>{let n=jp();if(!n)return;let s=new n;s.lang=navigator.language||`en-US`,s.continuous=!0,s.interimResults=!0,a.current=``,s.onresult=t=>{let n=``;for(let e=t.resultIndex;e{let n=e.error||``;n!==`aborted`&&n!==`no-speech`&&t?.(n===`not-allowed`||n===`service-not-allowed`?o(`The microphone is not allowed. Allow it in the browser and try again.`):o(`Voice input stopped ({code}).`,{code:n}))},s.onend=()=>{i.current=null,r(!1)},i.current=s;try{s.start(),r(!0)}catch{i.current=null,r(!1)}},[e,t,o]),u=(0,L.useCallback)(()=>{i.current?c():l()},[l,c]);return(0,L.useEffect)(()=>()=>i.current?.abort(),[]),{supported:Mp(),listening:n,toggle:u,stop:c}}function Pp({listening:e,onClick:t,className:n}){let r=s();return(0,R.jsx)(`button`,{type:`button`,onClick:t,"aria-label":r(e?`Stop voice input`:`Voice input`),"aria-pressed":e,className:i(`flex h-9 w-9 shrink-0 items-center justify-center rounded-full transition active:scale-95`,e?`bg-accent/15 text-accent animate-pulse`:`text-fg/70 hover:bg-surface-2`,n),children:e?(0,R.jsx)(Pt,{size:19}):(0,R.jsx)(Ft,{size:19})})}function Fp({lines:e}){return(0,R.jsx)(`div`,{className:`flex items-end gap-2 pr-10`,children:(0,R.jsx)(`div`,{className:`min-w-0 max-w-full`,children:e.map((e,t)=>(0,R.jsx)(`div`,{className:`my-1 max-w-[340px] rounded-[20px] bg-surface-2 px-3.5 py-2.5 text-[14.5px] leading-snug whitespace-pre-wrap break-words wide:max-w-[600px]`,children:e},t))})})}function Ip({chips:e,chosen:t,busy:n,onPick:r,onElse:a}){let o=s();return e.length===0&&!t?null:(0,R.jsxs)(`section`,{className:`rise mx-1 my-2 rounded-[22px] border border-border/70 bg-surface p-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium text-fg`,children:[(0,R.jsx)(nn,{size:14,className:`text-accent`}),` `,o(`Pick a name for me, or type one`)]}),(0,R.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:[e.map(e=>{let a=t===e;return(0,R.jsxs)(`button`,{type:`button`,disabled:n||!!t,onClick:()=>r(e),className:i(`inline-flex items-center gap-1.5 rounded-full px-3.5 py-1.5 text-[13.5px] font-medium transition-colors disabled:opacity-60`,a?`bg-accent text-accent-fg`:`bg-surface-2 hover:bg-border/60`),children:[a&&(0,R.jsx)(ke,{size:13,strokeWidth:3}),e]},e)}),!t&&(0,R.jsx)(`button`,{type:`button`,disabled:n,onClick:a,className:`rounded-full border border-border px-3.5 py-1.5 text-[13.5px] text-muted hover:bg-surface-2 disabled:opacity-60`,children:o(`Something else`)})]})]})}var Lp=[{id:`pink`,background:`#F9D9E3`,accent:`#B5476A`,mood:`idle`},{id:`blue`,background:`#D6E6FA`,accent:`#2F5FA8`,mood:`working`},{id:`yellow`,background:`#FBEFC7`,accent:`#9A6B12`,mood:`waiting`},{id:`purple`,background:`#E4DDF7`,accent:`#5D44A6`,mood:`happy`},{id:`green`,background:`#D9F0DF`,accent:`#2E7D4F`,mood:`error`}],Rp=`github.com/nano-muse/nanoMuse`,zp=540,Bp=720;function Vp(e,t){return!e||w(e.avatar)?j(t):e.avatar?re(e.avatar,t):null}function Hp(e){return new Promise(t=>{let n=new Image;n.crossOrigin=`anonymous`,n.onload=()=>t(n),n.onerror=()=>t(null),n.src=e})}function Up(e,t,n){let r=t.includes(` `)?t.split(` `):Array.from(t),i=t.includes(` `)?` `:``,a=[],o=``;for(let t of r){let r=o?o+i+t:t;e.measureText(r).width>n&&o?(a.push(o),o=t):o=r}return o&&a.push(o),a}function Wp(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.arcTo(t+r,n,t+r,n+i,a),e.arcTo(t+r,n+i,t,n+i,a),e.arcTo(t,n+i,t,n,a),e.arcTo(t,n,t+r,n,a),e.closePath()}async function Gp(e,t,n,r,i,a=2){let o=document.createElement(`canvas`);o.width=zp*a,o.height=Bp*a;let s=o.getContext(`2d`);if(!s)return o;s.scale(a,a),s.fillStyle=e.background,Wp(s,0,0,zp,Bp,36),s.fill(),s.font=`600 22px system-ui, -apple-system, 'Segoe UI', sans-serif`;let c=Up(s,r,400),l=Math.max(...c.map(e=>s.measureText(e).width))+48,u=c.length*30+36,d=(zp-l)/2;s.fillStyle=`#ffffff`,Wp(s,d,56,l,u,24),s.fill(),s.beginPath(),s.moveTo(zp/2-14,56+u-1),s.lineTo(zp/2,56+u+18),s.lineTo(284,56+u-1),s.closePath(),s.fill(),s.fillStyle=e.accent,s.textAlign=`center`,s.textBaseline=`top`,c.forEach((e,t)=>s.fillText(e,zp/2,74+t*30+3));let f=56+u+54;s.fillStyle=`#ffffff`,s.beginPath(),s.arc(zp/2,f+150,158,0,Math.PI*2),s.fill();let p=Vp(t,e.mood),m=p?await Hp(p):null;return s.save(),s.beginPath(),s.arc(zp/2,f+150,150,0,Math.PI*2),s.clip(),m?(s.fillStyle=`#f1efeb`,s.fillRect(120,f,300,300),s.drawImage(m,120,f,300,300)):(s.fillStyle=t?.color??`#0064d4`,s.fillRect(120,f,300,300),s.font=`150px system-ui, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif`,s.textAlign=`center`,s.textBaseline=`middle`,s.fillStyle=`#ffffff`,s.fillText(t?.emoji??`✨`,zp/2,f+150+6)),s.restore(),s.fillStyle=e.accent,s.textAlign=`center`,s.textBaseline=`top`,s.font=`700 30px system-ui, -apple-system, 'Segoe UI', sans-serif`,s.fillText(n,zp/2,f+300+34),s.font=`500 15px system-ui, -apple-system, 'Segoe UI', sans-serif`,s.globalAlpha=.8,Up(s,i,460).forEach((e,t)=>s.fillText(e,zp/2,644+t*22)),s.globalAlpha=1,o}function Kp(e){return new Promise(t=>e.toBlob(t,`image/png`))}function qp({open:e,onClose:t}){let{state:n,toast:r}=E(),a=s(),o=n.profile,c=o?.name??`nanoMuse`,[l,u]=(0,L.useState)(0),[d,f]=(0,L.useState)([]),[p,m]=(0,L.useState)(!1),h=(0,L.useRef)(!0),g=a(`Hi, I'm {name}, a personal AI agent. Meet nanoMuse: open source, runs on your phone.`,{name:c}),_=a(`Your personal AI agent, open source · {repo}`,{repo:Rp});(0,L.useEffect)(()=>{if(h.current=!0,e)return u(0),(async()=>{let e=[];for(let t of Lp){let n=await Gp(t,o,c,g,_,1);e.push(n.toDataURL(`image/png`))}h.current&&f(e)})(),()=>{h.current=!1}},[e,o?.avatar,o?.emoji,o?.color,c]);let v=async()=>{m(!0);try{let e=await Kp(await Gp(Lp[l]??Lp[0],o,c,g,_,2));if(!e)throw Error(a(`The card could not be drawn.`));let n=new File([e],`${c}-nanomuse.png`,{type:`image/png`}),i=`${g}\nhttps://${Rp}`,s=navigator;if(typeof s.share==`function`&&(!s.canShare||s.canShare({files:[n]})))try{await s.share({files:[n],text:i,title:c}),t();return}catch(e){if(e.name===`AbortError`)return}let u=document.createElement(`a`);u.href=URL.createObjectURL(e),u.download=n.name,u.click(),window.setTimeout(()=>URL.revokeObjectURL(u.href),2e3),r(a(`Saved the card as a picture.`))}catch(e){r(e.message)}finally{m(!1)}};return(0,R.jsxs)(Op,{open:e,onClose:t,title:a(`Share my avatar`),children:[(0,R.jsx)(`p`,{className:`mb-3 text-[13px] text-muted`,children:a(`Pick a card. It goes out through the system share sheet, or saves as a picture where there is none.`)}),(0,R.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5 sm:grid-cols-5`,children:Lp.map((e,t)=>(0,R.jsx)(`button`,{type:`button`,"aria-label":e.id,"aria-pressed":l===t,onClick:()=>u(t),className:i(`overflow-hidden rounded-2xl border-2 transition`,l===t?`border-accent`:`border-transparent`),style:{background:e.background,aspectRatio:`${zp} / ${Bp}`},children:d[t]?(0,R.jsx)(`img`,{src:d[t],alt:``,className:`h-full w-full object-cover`}):(0,R.jsx)(A,{size:18,className:`mx-auto my-8 animate-spin text-muted`})},e.id))}),d[l]&&(0,R.jsx)(`img`,{src:d[l],alt:``,className:`mx-auto mt-4 w-[260px] rounded-[20px] shadow-md`}),(0,R.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:je,children:a(`Later`)}),(0,R.jsxs)(`button`,{type:`button`,disabled:p||!d.length,onClick:()=>void v(),className:Ne,children:[p?(0,R.jsx)(A,{size:15,className:`animate-spin`}):typeof navigator.share==`function`?(0,R.jsx)(Xt,{size:15}):(0,R.jsx)(ft,{size:15}),` `,typeof navigator.share==`function`?a(`Share`):a(`Save picture`)]})]})]})}function Jp({message:e,onRetry:t}){let n=s();return(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-8 py-10 text-center`,children:[(0,R.jsx)(`p`,{className:`text-[14px] text-rose-600 dark:text-rose-300`,children:n(e)||n(`Could not load.`)}),(0,R.jsxs)(`button`,{type:`button`,onClick:t,className:`flex h-10 items-center gap-1.5 rounded-full bg-surface px-4 text-[13.5px] font-medium shadow-[0_1px_4px_rgba(0,0,0,0.14)] dark:border dark:border-border dark:shadow-none`,children:[(0,R.jsx)(Re,{size:14}),` `,n(`Try again`)]})]})}var Yp=[{id:`health`,label:`Health`,icon:e=>(0,R.jsx)(yt,{...e}),tone:`bg-rose-500/12 text-rose-600 dark:text-rose-300`},{id:`finance`,label:`Finance`,icon:e=>(0,R.jsx)(Wt,{...e}),tone:`bg-emerald-500/12 text-emerald-600 dark:text-emerald-300`},{id:`career`,label:`Career`,icon:e=>(0,R.jsx)($e,{...e}),tone:`bg-sky-500/12 text-sky-600 dark:text-sky-300`},{id:`learning`,label:`Learning`,icon:e=>(0,R.jsx)(_t,{...e}),tone:`bg-violet-500/12 text-violet-600 dark:text-violet-300`},{id:`relationships`,label:`Relationships`,icon:e=>(0,R.jsx)(le,{...e}),tone:`bg-pink-500/12 text-pink-600 dark:text-pink-300`},{id:`family`,label:`Family`,icon:e=>(0,R.jsx)(hn,{...e}),tone:`bg-amber-500/12 text-amber-600 dark:text-amber-300`},{id:`home`,label:`Home`,icon:e=>(0,R.jsx)(bt,{...e}),tone:`bg-orange-500/12 text-orange-600 dark:text-orange-300`},{id:`travel`,label:`Travel`,icon:e=>(0,R.jsx)(lt,{...e}),tone:`bg-cyan-500/12 text-cyan-600 dark:text-cyan-300`},{id:`creative`,label:`Creative`,icon:e=>(0,R.jsx)(Vt,{...e}),tone:`bg-fuchsia-500/12 text-fuchsia-600 dark:text-fuchsia-300`},{id:`other`,label:`Other`,icon:e=>(0,R.jsx)(ln,{...e}),tone:`bg-surface-2 text-muted`}];function Xp(e){return Yp.find(t=>t.id===e)??null}var Zp=[{id:``,label:`No reminders`},{id:`daily`,label:`Every day`},{id:`weekdays`,label:`Weekdays`},{id:`weekly`,label:`Once a week`},{id:`monthly`,label:`Once a month`}],Qp=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`];function $p(e){let t=/^(daily|weekdays|weekly|monthly)(?:\s+(\S+?))?(?:\s+(\d{1,2}:\d{2}))?$/.exec(e.trim());if(!t)return{cadence:``,anchor:``,time:`09:00`};let n=t[2]??``,r=t[3]??`09:00`;return n&&/^\d{1,2}:\d{2}$/.test(n)&&(r=n,n=``),{cadence:t[1],anchor:n,time:r.padStart(5,`0`)}}function em(e,t,n){return e?[e,t,n].filter(Boolean).join(` `):``}function tm(e){let t=Qp.indexOf(e);return t<0?e:new Date(2024,0,1+t).toLocaleDateString(m(),{weekday:`long`})}function nm(e){let{cadence:t,anchor:n,time:r}=$p(e);switch(t){case`daily`:return _(`Daily at {time}`,{time:r});case`weekdays`:return _(`Weekdays at {time}`,{time:r});case`weekly`:return n&&Qp.includes(n)?_(`{day}s at {time}`,{day:tm(n),time:r}):_(`Weekly at {time}`,{time:r});case`monthly`:return _(`Monthly on the {day} at {time}`,{day:rm(Number(n||1)),time:r});default:return``}}function rm(e){if(c()!==`en`)return String(e);let t=[`th`,`st`,`nd`,`rd`],n=e%100;return`${e}${t[(n-20)%10]??t[n]??t[0]}`}function im(e,t){if(!e)return``;let n=new Date(`${e}T00:00:00`),r=n.toLocaleDateString(m(),{month:`short`,day:`numeric`,year:n.getFullYear()===new Date().getFullYear()?void 0:`numeric`});if(t)return _(`Was due {date}`,{date:r});let i=Math.ceil((n.getTime()-Date.now())/864e5);return i<=0?_(`Due today`):i===1?_(`Due tomorrow`):i<=14?_(`Due in {n} days`,{n:i}):_(`By {date}`,{date:r})}function am({open:e,onClose:t}){let{state:n,setTab:r,draft:a,toast:o}=E(),[c,l]=(0,L.useState)(0),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(!1),g=n.profile?.name??`nanoMuse`,_=n.pendingApprovals.length,v=s();(0,L.useEffect)(()=>{e&&(l(+(_>0)),d(!1),p(!1))},[e]);let y=(e,n)=>{t(),n&&history.replaceState(null,``,`${window.location.pathname}${window.location.search}#${n}`),r(e)},b=n.status.state===`working`,x=_>0?_>1?v(`{n} approvals waiting for you`,{n:_}):v(`1 approval waiting for you`):b?n.status.detail||v(`On it`):n.status.state===`waiting`?v(`Waiting for you`):v(`online`),S=async()=>{h(!0);try{(await M.stopThread(n.status.thread||`main`)).ok||o(v(`Nothing to stop`))}catch(e){o(e.message)}finally{h(!1)}},C=[{icon:(0,R.jsx)(it,{size:22}),label:v(`Activity`)},{icon:(0,R.jsx)(Qt,{size:22}),label:v(`Approvals`),badge:_},{icon:(0,R.jsx)(at,{size:22}),label:v(`Daily`)},{icon:(0,R.jsx)(ht,{size:22}),label:v(`Soul & memory`)}];return(0,R.jsxs)(Op,{open:e,onClose:t,children:[(0,R.jsxs)(`div`,{className:`relative flex flex-col items-center px-1 pb-3 text-center`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-label":v(`Share avatar`),title:v(`Share avatar`),onClick:()=>p(!0),className:`absolute right-0 top-0 flex h-9 w-9 items-center justify-center rounded-full bg-surface-2/70 text-fg hover:bg-surface-2`,children:(0,R.jsx)(Xt,{size:16})}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(D,{profile:n.profile,status:n.status,size:72}),(0,R.jsx)(`button`,{type:`button`,"aria-label":v(`Edit`),"aria-expanded":u,onClick:()=>d(e=>!e),className:`absolute -bottom-0.5 -right-0.5 flex h-6 w-6 items-center justify-center rounded-full bg-surface text-fg shadow-[0_1px_4px_rgba(0,0,0,0.18)] hover:bg-surface-2 dark:border dark:border-border`,children:(0,R.jsx)(Ht,{size:13})}),u&&(0,R.jsxs)(`div`,{className:`absolute left-1/2 top-full z-20 mt-2 w-56 -translate-x-1/2 overflow-hidden rounded-2xl border border-border/70 bg-surface py-1 text-left text-[14px] shadow-lg`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>{a(v(`Change your avatar to `)),t(),r(`chat`)},className:`block w-full px-4 py-2.5 text-left hover:bg-surface-2`,children:v(`Change avatar`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>y(`you`,`who`),className:`block w-full px-4 py-2.5 text-left hover:bg-surface-2`,children:v(`Edit name`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>y(`avatar`),className:`block w-full px-4 py-2.5 text-left text-muted hover:bg-surface-2`,children:v(`Avatar studio…`)})]})]}),(0,R.jsx)(`div`,{className:`mt-2.5 text-[21px] font-semibold leading-[26px]`,children:g}),(0,R.jsxs)(`div`,{className:i(`mt-0.5 flex items-center gap-1.5 text-[14px]`,b||_>0?`text-fg`:`text-muted`),children:[b&&(0,R.jsx)(A,{size:13,className:`animate-spin text-accent`}),(0,R.jsx)(`span`,{className:`line-clamp-2`,children:x})]}),(b||n.status.state===`waiting`)&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void S(),disabled:m,className:`mt-2.5 inline-flex items-center gap-1.5 rounded-full bg-fg px-4 py-1.5 text-[13.5px] font-semibold text-bg transition active:scale-95 disabled:opacity-60`,children:[(0,R.jsx)(sn,{size:12,fill:`currentColor`}),` `,v(`Stop`)]})]}),(0,R.jsx)(`div`,{role:`tablist`,className:`mb-5 flex rounded-2xl bg-surface-2/60 p-1`,children:C.map((e,t)=>(0,R.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":c===t,"aria-label":e.label,title:e.label,onClick:()=>l(t),className:i(`relative flex h-11 flex-1 items-center justify-center rounded-[13px] text-fg transition`,c===t&&`bg-surface shadow-sm`),children:[e.icon,e.badge?(0,R.jsx)(`span`,{className:`absolute right-1.5 top-1 flex h-[17px] min-w-[17px] items-center justify-center rounded-full bg-rose-500 px-1 text-[10px] font-bold text-white`,children:e.badge}):null]},e.label))}),c===0&&(0,R.jsx)(ym,{open:e}),c===1&&(0,R.jsxs)(R.Fragment,{children:[_>0&&(0,R.jsx)(cm,{onDone:()=>void 0}),(0,R.jsx)(bm,{open:e})]}),c===2&&(0,R.jsx)(lm,{onSettings:()=>y(`you`,`proactivity`)}),c===3&&(0,R.jsx)(om,{name:g,onEdit:()=>y(`you`,`who`),onMemory:()=>y(`memory`)}),(0,R.jsx)(qp,{open:f,onClose:()=>p(!1)})]})}function om({name:e,onEdit:t,onMemory:n}){let{state:r}=E(),i=s(),a=r.profile?.tagline?.trim()??``;return(0,R.jsxs)(`div`,{className:`pb-2`,children:[(0,R.jsx)(`div`,{className:`px-1 text-[15px]`,children:e}),(0,R.jsxs)(`button`,{type:`button`,onClick:t,className:`mt-2 flex h-[50px] w-full items-center justify-center gap-2 rounded-2xl bg-surface-2/70 text-[15px] font-medium hover:bg-surface-2`,children:[(0,R.jsx)(Ht,{size:18}),` `,i(`Edit`)]}),(0,R.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-3`,children:[(0,R.jsx)(sm,{title:`SOUL`,caption:i(`Handle with care`),foot:a,colors:`from-[#7d6bc7] to-[#574494]`,onClick:t}),(0,R.jsx)(sm,{title:i(`Memory`),caption:i(`Handle with care`),foot:r.settings?.memory_enabled===!1?i(`Off`):``,colors:`from-[#b0413e] to-[#7a1f1f]`,onClick:n})]})]})}function sm({title:e,caption:t,foot:n,colors:r,onClick:a}){return(0,R.jsxs)(`button`,{type:`button`,onClick:a,className:i(`flex h-[130px] flex-col items-start rounded-[18px] bg-gradient-to-b p-3.5 text-left text-white transition active:scale-[0.98]`,r),children:[(0,R.jsx)(`span`,{className:`text-[17px] font-semibold`,children:e}),(0,R.jsx)(`span`,{className:`mt-0.5 text-[11px] text-white/85`,children:t}),(0,R.jsx)(`span`,{className:`mt-auto text-[12px] text-white/90`,children:n})]})}function cm({onDone:e}){let{state:t,decide:n,openThread:r,toast:i}=E(),a=t.profile?.name??`nanoMuse`,o=s(),c=[...t.pendingApprovals].sort((e,t)=>e.ts.localeCompare(t.ts)),l=e=>{let n=t.threads.find(t=>t.id===e);return n?n.id===`main`?o(n.title):n.title:e};return(0,L.useEffect)(()=>{if(c.length===0){let t=window.setTimeout(e,600);return()=>window.clearTimeout(t)}},[c.length,e]),c.length===0?(0,R.jsxs)(`div`,{className:`py-10 text-center text-muted text-[14px]`,children:[(0,R.jsx)(ke,{size:26,className:`mx-auto mb-2 text-emerald-500`}),o(`Nothing is waiting for you.`)]}):(0,R.jsxs)(`div`,{className:`space-y-4 pb-2`,children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:o(`Actions {name} wants to take but cannot without you. Each one shows what will run and why; a permission you grant is bound to that exact tool and target.`,{name:a})}),c.map(e=>(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(e.thread),className:`mb-1 px-1 text-[12px] font-semibold uppercase tracking-wide text-muted hover:text-accent`,children:[l(e.thread),` · `,u(e.ts)]}),(0,R.jsx)(`div`,{className:`rounded-[22px] border border-border/70`,children:(0,R.jsx)(hp,{event:e,onDecide:(t,r)=>n(e.id,t,r).catch(e=>i(e.message))})})]},e.id))]})}function lm({onSettings:t}){let{state:n,refreshSettings:r,toast:a}=E(),[o,c]=(0,L.useState)(null),[l,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(null),m=n.profile?.name??`nanoMuse`,h=s(),g=()=>M.upcoming().then(e=>{c(e),d(null)}).catch(e=>o===null?d(e.message):a(e.message));(0,L.useEffect)(()=>{g()},[n.goalsVersion,n.remindersVersion,n.profile?.proactive,n.profile?.goal_interval_minutes]);let _=async()=>{try{await M.updateSettings({profile:{proactive:!n.profile?.proactive}}),await r()}catch(e){a(e.message)}},v=async e=>{p(e);try{await M.advanceGoal(e),a(h(`{name} is working on it in the main chat`,{name:m}))}catch(e){a(e.message)}finally{p(null)}};return o?(0,R.jsxs)(`div`,{className:`space-y-4 pb-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-2xl border border-border p-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-medium`,children:h(`Background work`)}),(0,R.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:o.proactive?`${h(o.proactivity[0].toUpperCase()+o.proactivity.slice(1))} · ${h(`every {n} min {name} picks one active goal and works on its next step.`,{n:o.effective_interval_minutes,name:m})}${o.quiet_until?` ${h(`Quiet hours until {time}.`,{time:u(o.quiet_until)})}`:o.next_pass_at?` ${h(`Next around {time}.`,{time:u(o.next_pass_at)})}`:``}`:h(`Off. {name} only works when you ask.`,{name:m})})]}),(0,R.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o.proactive,onClick:()=>void _(),className:i(`relative h-7 w-12 shrink-0 rounded-full transition`,o.proactive?`bg-accent`:`bg-border`),children:(0,R.jsx)(`span`,{className:i(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,o.proactive?`left-[26px]`:`left-0.5`)})})]}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`mt-2 text-[12.5px] text-accent font-medium`,children:h(`Level, interval and quiet hours in Settings`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:h(`In line`)}),o.queue.length===0?(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:h(`No active goal has a next step. Add one in Goals and {name} will pick it up.`,{name:m})}):(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:o.queue.map((e,t)=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`w-5 text-center text-[12px] font-semibold text-muted`,children:t+1}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:e.title}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[e.next_step??`—`,` · `,h(`{done}/{total} done`,{done:e.progress.done,total:e.progress.total})]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void v(e.goal_id),disabled:f!==null||o.busy,"aria-label":h(`Work on {title} now`,{title:e.title}),className:`rounded-full bg-accent/12 p-2 text-accent disabled:opacity-50`,children:f===e.goal_id?(0,R.jsx)(A,{size:15,className:`animate-spin`}):(0,R.jsx)(Gt,{size:15})})]},e.goal_id))})]}),o.check_ins.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:h(`Check-ins`)}),(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:o.check_ins.map(t=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(Xe,{size:15,className:`text-muted shrink-0`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:t.title}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[e(t.at),` · `,u(t.at),` · `,nm(t.cadence).toLowerCase()]})]})]},t.goal_id))}),(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:h(`Goal nudges you asked for; they arrive whatever the proactivity level, but wait out quiet hours.`)})]}),(0,R.jsx)(um,{items:o.reminders,name:m,onChange:()=>void g()}),(0,R.jsx)(mm,{data:o.triggers,name:m,onChange:()=>void g()})]}):l?(0,R.jsx)(Jp,{message:l,onRetry:()=>void g()}):(0,R.jsx)(`div`,{className:`py-10 flex justify-center text-muted`,children:(0,R.jsx)(A,{className:`animate-spin`,size:20})})}function um({items:t,name:n,onChange:r}){let{toast:i}=E(),a=s(),[o,c]=(0,L.useState)(null),[l,d]=(0,L.useState)(!1),f=t.filter(e=>e.status===`active`),p=t.filter(e=>e.status!==`active`),m=async e=>{c(e.id);try{await M.cancelReminder(e.id),r()}catch(e){i(e.message)}finally{c(null)}},h=async e=>{c(e.id);try{await M.fireReminder(e.id),i(e.kind===`task`?a(`{name} is on it`,{name:n}):a(`{name} will say it now`,{name:n})),r()}catch(e){i(e.message)}finally{c(null)}};return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold`,children:a(`Reminders & routines`)}),!l&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:`text-[12.5px] text-accent font-medium`,children:a(`+ Add`)})]}),l&&(0,R.jsx)(dm,{onDone:()=>{d(!1),r()},onCancel:()=>d(!1)}),f.length===0&&!l?(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:a(`Nothing scheduled. Tell {name} “remind me at six to call mum” or “every weekday morning, summarise my unread email”.`,{name:n})}):(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:f.map(t=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[t.kind===`task`?(0,R.jsx)(Kt,{size:15,className:`text-muted shrink-0`}):(0,R.jsx)(We,{size:15,className:`text-muted shrink-0`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:t.text}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[t.next_at?`${e(t.next_at)} · ${u(t.next_at)}`:`—`,t.repeat&&` · ${nm(t.repeat).toLowerCase()}`,t.kind===`task`&&` · ${a(`does the work`)}`]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void h(t),disabled:o!==null,"aria-label":t.kind===`task`?a(`Do “{text}” now`,{text:t.text}):a(`Remind me now: {text}`,{text:t.text}),className:`rounded-full bg-accent/12 p-2 text-accent disabled:opacity-50`,children:o===t.id?(0,R.jsx)(A,{size:15,className:`animate-spin`}):(0,R.jsx)(Gt,{size:15})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(t),disabled:o!==null,"aria-label":a(`Cancel: {text}`,{text:t.text}),className:`rounded-full p-2 text-muted hover:text-fg disabled:opacity-50`,children:(0,R.jsx)(Fe,{size:15})})]},t.id))}),p.length>0&&(0,R.jsxs)(`details`,{className:`mt-2`,children:[(0,R.jsx)(`summary`,{className:`text-[12px] text-muted cursor-pointer select-none`,children:a(`{n} finished recently`,{n:p.length})}),(0,R.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:p.map(t=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2 px-3 text-[12.5px] text-muted`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate line-through decoration-border`,children:t.text}),(0,R.jsx)(`span`,{className:`shrink-0`,children:t.status===`done`?t.last_fired_at?e(t.last_fired_at):a(`done`):a(`cancelled`)})]},t.id))})]}),(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:a(`A time you named is kept whatever the level or the quiet hours. Reminders just say it; routines do the work and report.`)})]})}function dm({onDone:e,onCancel:t}){let{toast:n}=E(),r=s(),[a,o]=(0,L.useState)(``),[c,l]=(0,L.useState)(`remind`),[u,d]=(0,L.useState)(`once`),[f,p]=(0,L.useState)(()=>_m()),[h,g]=(0,L.useState)(`daily`),[_,v]=(0,L.useState)(`09:00`),[y,b]=(0,L.useState)(`mon`),[x,S]=(0,L.useState)(`1`),[C,w]=(0,L.useState)(!1),T=h===`weekly`?`weekly ${y} ${_}`:h===`monthly`?`monthly ${x} ${_}`:`${h} ${_}`,D=async()=>{if(a.trim()){w(!0);try{await M.createReminder(u===`once`?{text:a.trim(),kind:c,at:f.replace(`T`,` `)}:{text:a.trim(),kind:c,repeat:T}),e()}catch(e){n(e.message)}finally{w(!1)}}},O=`h-9 rounded-xl bg-surface border border-border px-3 text-[13px] outline-none focus:border-accent`;return(0,R.jsxs)(`div`,{className:`mb-2 rounded-2xl border border-border p-3 space-y-2`,children:[(0,R.jsx)(`input`,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:r(c===`task`?`What should be done…`:`What to remind you of…`),className:i(O,`w-full h-10 text-[14px]`)}),(0,R.jsxs)(`div`,{className:`flex gap-1.5 text-[12.5px]`,children:[(0,R.jsx)(gm,{options:[[`remind`,r(`Remind me`)],[`task`,r(`Do it for me`)]],value:c,onChange:e=>l(e)}),(0,R.jsx)(gm,{options:[[`once`,r(`Once`)],[`repeat`,r(`Repeat`)]],value:u,onChange:e=>d(e)})]}),u===`once`?(0,R.jsx)(`input`,{type:`datetime-local`,value:f,onChange:e=>p(e.target.value),className:i(O,`w-full`)}):(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,R.jsxs)(`select`,{value:h,onChange:e=>g(e.target.value),className:O,children:[(0,R.jsx)(`option`,{value:`daily`,children:r(`Every day`)}),(0,R.jsx)(`option`,{value:`weekdays`,children:r(`Weekdays`)}),(0,R.jsx)(`option`,{value:`weekly`,children:r(`Weekly`)}),(0,R.jsx)(`option`,{value:`monthly`,children:r(`Monthly`)})]}),h===`weekly`&&(0,R.jsx)(`select`,{value:y,onChange:e=>b(e.target.value),className:O,children:[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`].map((e,t)=>(0,R.jsx)(`option`,{value:e,children:new Date(2024,0,1+t).toLocaleDateString(m(),{weekday:`long`})},e))}),h===`monthly`&&(0,R.jsx)(`select`,{value:x,onChange:e=>S(e.target.value),className:O,children:Array.from({length:28},(e,t)=>String(t+1)).map(e=>(0,R.jsx)(`option`,{value:e,children:r(`Day {d}`,{d:e})},e))}),(0,R.jsx)(`input`,{type:`time`,value:_,onChange:e=>v(e.target.value),className:O})]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2 pt-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-full px-3 py-1.5 text-[13px] text-muted`,children:r(`Cancel`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void D(),disabled:C||!a.trim(),className:`rounded-full bg-accent px-3.5 py-1.5 text-[13px] font-medium text-accent-fg disabled:opacity-50`,children:r(C?`Saving…`:u===`once`?`Set reminder`:`Set routine`)})]})]})}var fm={mail:Et,event:et,hook:_n};function pm(e,t){if(e.kind===`mail`)return e.match?t(`mail matching “{match}”`,{match:e.match}):t(`any new mail`);if(e.kind===`event`){let n=e.match?t(`events matching “{match}”`,{match:e.match}):t(`any event`);return t(`{n} min before {what}`,{n:e.lead_minutes,what:n})}return e.match?t(`webhook “{match}”`,{match:e.match}):t(`webhook`)}function mm({data:t,name:n,onChange:r}){let{toast:a}=E(),o=s(),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(!1),f=t.items.filter(e=>e.status===`active`),p=f.some(e=>e.kind===`mail`),m=async e=>{l(e.id);try{await M.cancelTrigger(e.id),r()}catch(e){a(e.message)}finally{l(null)}},h=async e=>{l(e.id);try{await M.fireTrigger(e.id),a(o(`{name} is on it`,{name:n})),r()}catch(e){a(e.message)}finally{l(null)}},g=async e=>{if(e.url)try{await navigator.clipboard.writeText(e.url),a(o(`Webhook URL copied`))}catch{a(e.url)}};return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold`,children:o(`When something happens`)}),!u&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:`text-[12.5px] text-accent font-medium`,children:o(`+ Add`)})]}),u&&(0,R.jsx)(hm,{available:t.available,onDone:()=>{d(!1),r()},onCancel:()=>d(!1)}),f.length===0&&!u?(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:o(`Nothing yet. Tell {name} “when the landlord writes back, summarise it and draft a reply” or “half an hour before any review, brief me”.`,{name:n})}):(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:f.map(t=>{let n=fm[t.kind];return(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(n,{size:15,className:`text-muted shrink-0 mt-[3px]`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:pm(t,o)}),(0,R.jsx)(`div`,{className:`text-[12px] leading-snug text-fg/80 line-clamp-2`,children:t.text}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted flex flex-wrap items-center gap-x-1.5`,children:[t.fired>0?(0,R.jsxs)(`span`,{children:[o(`fired {n}×`,{n:t.fired}),t.last_fired_at&&` · ${e(t.last_fired_at)}`]}):(0,R.jsx)(`span`,{children:o(`not fired yet`)}),t.kind===`hook`&&t.url&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void g(t),className:`inline-flex items-center gap-1 text-accent font-medium`,children:[(0,R.jsx)(ut,{size:11}),` `,o(`Copy URL`)]})]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void h(t),disabled:c!==null,"aria-label":o(`Run now: {text}`,{text:t.text}),className:`rounded-full bg-accent/12 p-2 text-accent disabled:opacity-50`,children:c===t.id?(0,R.jsx)(A,{size:15,className:`animate-spin`}):(0,R.jsx)(Gt,{size:15})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(t),disabled:c!==null,"aria-label":o(`Cancel: {text}`,{text:t.text}),className:`rounded-full p-2 text-muted hover:text-fg disabled:opacity-50`,children:(0,R.jsx)(Fe,{size:15})})]},t.id)})}),p&&(0,R.jsx)(`div`,{className:i(`mt-1.5 text-[12px]`,t.mail_error?`text-rose-500`:`text-muted`),children:t.mail_error?o(`The inbox could not be read: {error}`,{error:t.mail_error}):t.mail_checked_at?o(`Inbox checked {when}; {name} looks every {n} min.`,{when:e(t.mail_checked_at),name:n,n:t.mail_poll_minutes}):o(`{name} will look at the inbox shortly, then every {n} min.`,{name:n,n:t.mail_poll_minutes})}),(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:o(`Each time it happens {name} does the work in the chat it was set from and reports in the Feed. A mail or a request is treated as data, never as instructions.`,{name:n})})]})}function hm({available:e,onDone:t,onCancel:n}){let{toast:r}=E(),a=s(),o=[`mail`,`event`,`hook`].find(t=>e[t])??`hook`,[c,l]=(0,L.useState)(o),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(`30`),[m,h]=(0,L.useState)(``),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(null),b=async()=>{if(m.trim()){_(!0);try{let e=await M.createTrigger({kind:c,text:m.trim(),match:u.trim(),lead_minutes:Number(f)||30});e.kind===`hook`&&e.url?y(e):t()}catch(e){r(e.message)}finally{_(!1)}}},x=`h-9 rounded-xl bg-surface border border-border px-3 text-[13px] outline-none focus:border-accent`;if(v)return(0,R.jsxs)(`div`,{className:`mb-2 rounded-2xl border border-border p-3 space-y-2`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:a(`Webhook ready`)}),(0,R.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:a(`POST anything to this URL and the work starts. The key is in the URL; share it only with the program that will call it.`)}),(0,R.jsx)(`code`,{className:`block break-all rounded-xl bg-surface-2 px-3 py-2 text-[12px]`,children:v.url}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2 pt-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void navigator.clipboard.writeText(v.url??``).then(()=>r(a(`Webhook URL copied`)),()=>r(v.url??``)),className:`rounded-full px-3 py-1.5 text-[13px] text-accent font-medium`,children:a(`Copy`)}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-full bg-accent px-3.5 py-1.5 text-[13px] font-medium text-accent-fg`,children:a(`Done`)})]})]});let S=[[`mail`,a(`New mail`)],[`event`,a(`Before an event`)],[`hook`,a(`Webhook`)]];return(0,R.jsxs)(`div`,{className:`mb-2 rounded-2xl border border-border p-3 space-y-2`,children:[(0,R.jsx)(gm,{options:S,value:c,onChange:e=>l(e)}),!e[c]&&(0,R.jsx)(`div`,{className:`text-[12.5px] text-rose-500`,children:a(c===`mail`?`Connect a mailbox under Connections first.`:`Add a calendar under Connections first.`)}),(0,R.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,R.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:a(c===`mail`?`Words in the sender or subject (empty: any mail)`:c===`event`?`Words in the title or place (empty: any event)`:`A name for this hook`),className:i(x,`min-w-0 flex-1`)}),c===`event`&&(0,R.jsxs)(`label`,{className:`flex items-center gap-1 text-[12.5px] text-muted`,children:[(0,R.jsx)(`input`,{type:`number`,min:0,max:1440,value:f,onChange:e=>p(e.target.value),className:i(x,`w-[64px] px-2`),"aria-label":a(`Minutes before`)}),a(`min before`)]})]}),(0,R.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:a(`What should be done each time…`),className:i(x,`w-full h-10 text-[14px]`)}),(0,R.jsx)(`div`,{className:`text-[12px] text-muted`,children:a(`When {condition}`,{condition:pm({kind:c,match:u.trim(),lead_minutes:Number(f)||30},a)})}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2 pt-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-full px-3 py-1.5 text-[13px] text-muted`,children:a(`Cancel`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void b(),disabled:g||!m.trim()||!e[c],className:`rounded-full bg-accent px-3.5 py-1.5 text-[13px] font-medium text-accent-fg disabled:opacity-50`,children:a(g?`Saving…`:`Set trigger`)})]})]})}function gm({options:e,value:t,onChange:n}){return(0,R.jsx)(`div`,{className:`flex rounded-full bg-surface-2 p-0.5`,children:e.map(([e,r])=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:i(`rounded-full px-2.5 py-1 transition`,t===e?`bg-surface shadow-sm font-medium`:`text-muted`),children:r},e))})}function _m(){let e=new Date(Date.now()+36e5);e.setMinutes(0,0,0);let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`}function vm(e){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null),a=async()=>{try{n(await M.activity(150)),i(null)}catch(e){i(e.message||`Could not load.`)}};return(0,L.useEffect)(()=>{if(!e)return;a();let t=window.setInterval(()=>void a(),4e3);return()=>window.clearInterval(t)},[e]),[t,a,r]}function ym({open:e}){let[t,n,r]=vm(e),{state:i}=E(),a=s(),o=i.profile?.name??`nanoMuse`,c=(t?.audit??[]).filter(e=>e.event===`tool_call`).reverse(),l=c.filter(e=>e.channel===`gui`).length;return(0,R.jsxs)(`div`,{className:`pb-2`,children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted mb-2`,children:a(`Every tool call goes through the Sentinel and is written to the audit log, including the ones it refused.`)}),l>0&&(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted mb-2`,children:a(`On the phone's screen: {gui} of {total} steps ({pct}%). The screen is the last resort; a skill, a fetch or the browser comes first.`,{gui:String(l),total:String(c.length),pct:String(Math.round(l/c.length*100))})}),!t&&r&&(0,R.jsx)(Jp,{message:r,onRetry:()=>void n()}),!t&&!r&&(0,R.jsx)(`div`,{className:`py-10 flex justify-center text-muted`,children:(0,R.jsx)(A,{className:`animate-spin`,size:20})}),t&&c.length===0&&(0,R.jsx)(`div`,{className:`py-8 text-center text-muted text-[14px]`,children:a(`Nothing yet today. What you ask for and what {name} does about it shows up here.`,{name:o})}),(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:c.map((e,t)=>(0,R.jsx)(Tm,{entry:e},`${e.ts}-${t}`))})]})}function bm({open:e}){let{state:t,toast:n}=E(),r=s(),[i,a]=vm(e),o=async()=>{if(window.confirm(r(`Forget every permission you granted? {name} will ask again next time.`,{name:t.profile?.name??`nanoMuse`})))try{await M.resetApprovals(),await a(),n(r(`Permissions reset`))}catch(e){n(e.message)}},c=async e=>{try{await M.revokeGrant(e.key),await a(),n(r(`Revoked: {subject}`,{subject:pp(e.tool,e.target)}))}catch(e){n(e.message)}},l=t.settings?.sentinel.mode;return(0,R.jsxs)(`div`,{className:`space-y-4 pb-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-2xl border border-border p-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,R.jsx)(Qt,{size:18,className:`text-accent`}),` `,r(`Sentinel mode:`),` `,(0,R.jsx)(`span`,{className:`capitalize`,children:l===`ask`?r(`balanced`):l===`strict`?r(`cautious`):l===`auto`?r(`hands-off`):l})]}),(0,R.jsxs)(`p`,{className:`mt-1 text-[12.5px] text-muted`,children:[l===`ask`&&r(`Safe and moderate actions run freely; anything sensitive (email, shell, purchases) waits for you.`),l===`strict`&&r(`Moderate and sensitive actions both wait for your approval.`),l===`auto`&&r(`Everything is approved automatically except explicit deny rules. Use with care.`)]}),i?.tainted&&(0,R.jsxs)(`p`,{className:`mt-2 text-[12.5px] text-amber-600 dark:text-amber-300 flex items-center gap-1.5`,children:[(0,R.jsx)($t,{size:14}),` `,r(`Private data was read this session: network calls to new destinations need approval.`)]})]}),(0,R.jsx)(Cm,{grants:i?.grants??[],onRevoke:c}),(0,R.jsx)(wm,{title:r(`Always ask (from config)`),tools:t.settings?.sentinel.always_ask_tools??[],muted:!0}),(i?.grants.length??0)>0&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>void o(),className:`w-full rounded-2xl border border-border py-2.5 text-[14px] font-medium`,children:r(`Reset all granted permissions`)})]})}function xm(e,t){switch(e.scope){case`conversation`:return t(`for this conversation`);case`session`:return t(`until restart`);case`24h`:return e.expires_at?t(`until {time}`,{time:u(e.expires_at)}):t(`for 24 hours`);case`always`:return t(`always`);default:return e.scope}}var Sm=[`sensitive`,`moderate`,`low`,`safe`];function Cm({grants:e,onRevoke:t}){let n=s(),{state:r}=E(),i=e=>r.settings?.tools.find(t=>t.name===e)?.risk??`moderate`,a=Sm.map(t=>({risk:t,rows:e.filter(e=>i(e.tool)===t)})).filter(e=>e.rows.length>0);return(0,R.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:n(`Permissions you granted`)}),(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:n(`No standing approvals. When you answer “always allow” to a risky step, it is listed here and can be revoked; approvals you give once are not kept.`)})]}):a.map((e,r)=>(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:[r===0?`${n(`Permissions you granted`)} · `:``,n(e.risk)]}),(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:e.rows.map(e=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`text-accent`,children:sp(e.tool,15)}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:pp(e.tool,e.target)}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted`,children:[e.tool,` · `,xm(e,n),` · `,n(`granted {time}`,{time:u(e.granted_at)})]})]}),(0,R.jsx)(`button`,{type:`button`,"aria-label":n(`Revoke {what}`,{what:mp(e.scope,e.tool,e.target)}),onClick:()=>t(e),className:`rounded-full p-1.5 text-muted hover:bg-surface active:scale-95`,children:(0,R.jsx)(Fe,{size:15})})]},e.key))})]},e.risk))})}function wm({title:e,tools:t,muted:n}){let r=s();return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:e}),t.length===0?(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:r(`None`)}):(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,R.jsxs)(`span`,{className:i(`rounded-full px-2.5 py-1 text-[12.5px] flex items-center gap-1`,n?`bg-surface-2 text-muted`:`bg-accent/12 text-accent`),children:[sp(e,12),` `,e]},e))})]})}function Tm({entry:e}){let t=s(),n=e.decision===`deny`,r=e.ok===!1&&!n;return(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(`div`,{className:i(`mt-0.5`,n?`text-rose-500`:r?`text-amber-500`:`text-muted`),children:n||r?(0,R.jsx)(Ye,{size:15}):(0,R.jsx)(ke,{size:15})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[13.5px]`,children:[(0,R.jsx)(`span`,{className:`text-muted`,children:sp(e.tool??``,13)}),(0,R.jsx)(`span`,{className:`font-medium truncate`,children:e.summary||e.tool})]}),(0,R.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11.5px] text-muted`,children:[(0,R.jsx)(`span`,{children:u(e.ts)}),e.risk&&(0,R.jsx)(up,{risk:e.risk}),e.approved===!0&&(0,R.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-300`,children:[t(`approved by you`),e.approval_scope&&e.approval_scope!==`once`?` (${e.approval_scope})`:``]}),e.approved==null&&e.approval_scope&&e.approval_scope!==`once`&&(0,R.jsx)(`span`,{className:`text-emerald-600 dark:text-emerald-300`,children:t(`covered by your {scope} permission`,{scope:e.approval_scope})}),n&&(0,R.jsx)(`span`,{className:`text-rose-500`,children:t(`blocked`)}),r&&(0,R.jsx)(`span`,{className:`text-amber-600`,children:t(`failed`)}),typeof e.duration_ms==`number`&&(0,R.jsxs)(`span`,{children:[(e.duration_ms/1e3).toFixed(1),`s`]})]}),n&&e.reasons&&e.reasons.length>0&&(0,R.jsx)(`div`,{className:`mt-0.5 text-[12px] text-muted`,children:e.reasons.map(v).join(` · `)})]})]})}function Em({title:e,actions:t=[],trailing:n,children:r}){let{state:i,setDrawer:a}=E(),o=s(),[c,l]=(0,L.useState)(!1),u=i.profile?.name||`nanoMuse`,d=i.pendingApprovals.length,f=d>0?d>1?o(`{n} approvals waiting for you`,{n:d}):o(`1 approval waiting for you`):i.status.state===`working`?i.status.detail||o(`On it`):i.status.state===`waiting`?o(`Waiting for you`):null;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ne,{profile:i.profile,status:i.status,name:u,statusLine:f,statusTone:f?`accent`:`muted`,spinning:i.status.state===`working`&&d===0,badge:d,onAvatar:()=>l(!0),leading:(0,R.jsx)(te,{onClick:()=>a(!0),label:o(`Chats`),className:`wide:invisible`,children:(0,R.jsx)(Ot,{size:22})}),trailing:n??(0,R.jsx)(Dm,{actions:t})}),(e||r)&&(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 pr-5`,children:[(0,R.jsx)(k,{className:`flex-1`,children:e}),r]}),(0,R.jsx)(am,{open:c,onClose:()=>l(!1)})]})}function Dm({actions:e=[]}){let{setTab:t}=E(),n=s(),[r,i]=(0,L.useState)(!1),a=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!r)return;let e=e=>{a.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&i(!1)};return window.addEventListener(`pointerdown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`pointerdown`,e),window.removeEventListener(`keydown`,t)}},[r]);let o=e=>{i(!1),t(e)},c=[...e.map(e=>({label:e.label,onClick:()=>{i(!1),e.onClick()}})),{label:n(`Memory`),onClick:()=>o(`memory`)},{label:n(`Settings`),onClick:()=>o(`you`)}];return(0,R.jsxs)(`div`,{ref:a,className:`relative`,children:[(0,R.jsx)(te,{onClick:()=>i(e=>!e),label:n(`More`),expanded:r,children:(0,R.jsx)(pt,{size:22})}),r&&(0,R.jsx)(`ul`,{role:`menu`,className:`absolute right-0 top-12 z-30 min-w-[180px] overflow-hidden rounded-2xl border border-border bg-surface py-1 shadow-xl`,children:c.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:e.onClick,className:`w-full px-4 py-2.5 text-left text-[14.5px] hover:bg-surface-2`,children:e.label})},e.label))})]})}var Om=`nanomuse-naming`;function km(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Am(e,t,n=!1){let r="```"+t,i=e;if(i.includes(r)){let e=RegExp("```"+km(t)+"[ \\t]*\\r?\\n[\\s\\S]*?```",`g`);i=i.replace(e,``);let n=i.lastIndexOf(r);n>=0&&(i=i.slice(0,n))}if(n){let e=i.lastIndexOf("```");e>=0&&r.startsWith(i.slice(e))&&(i=i.slice(0,e))}return i===e?e:i.replace(/\s+$/,``)}function jm(e,t=!1){return Am(e,Om,t)}function Mm(e){return e.filter(e=>!e.this&&e.kind!==`web`&&e.name.trim()!==``)}function Nm(e){let t=/^@([^\s,:;,:;]*)$/.exec(e);return t?t[1]:null}function Pm(e,t,n=6){let r=Nm(e);if(r===null)return[];let i=r.toLowerCase();return Mm(t).filter(e=>e.name.toLowerCase().startsWith(i)).sort((e,t)=>Number(t.online)-Number(e.online)||e.name.localeCompare(t.name)).slice(0,n)}function Fm(e,t){let n=e.trimStart();if(!n.startsWith(`@`))return null;let r=n.slice(1),i=r.toLowerCase(),a=Mm(t),o=a.filter(e=>{let t=e.name.trim().toLowerCase();if(!i.startsWith(t))return!1;let n=r.charAt(t.length);return n===``||/[\s,:;,:;]/.test(n)}).sort((e,t)=>t.name.length-e.name.length);if(o[0])return o[0];let s=/^[^\s,:;,:;]+/.exec(r)?.[0]?.toLowerCase()??``;if(!s)return null;let c=a.filter(e=>e.name.trim().toLowerCase().startsWith(s));if(c.length===1)return c[0];let l=c.filter(e=>e.online);return l.length===1?l[0]:null}var Im=`nm.show_steps`;function Lm(){try{return localStorage.getItem(Im)!==`0`}catch{return!0}}var Rm=Lm(),zm=new Set;function Bm(){return Rm}function Vm(e){Rm=e;try{localStorage.setItem(Im,e?`1`:`0`)}catch{}zm.forEach(e=>e())}function Hm(e){return zm.add(e),()=>zm.delete(e)}function Um(){return(0,L.useSyncExternalStore)(Hm,Bm,Bm)}function Wm(){let{state:e,send:t,sendViaCloud:n,decide:r,loadEvents:i,openFile:a,toast:o,setDrawer:c,setTab:l}=E(),u=s(),{profile:d,status:f,activeThread:p,threads:m}=e,h=e.events[p],g=(0,L.useMemo)(()=>h??[],[h]),_=h!==void 0,v=e.streams[p],b=m.find(e=>e.id===p),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null),T=d?.name??`nanoMuse`,D=b?.device?e.hub?.devices.find(e=>e.id===b.device)?.online??null:null,O=nh(e.working[p]),k=(0,L.useRef)(null),ee=(0,L.useRef)(null),A=(0,L.useRef)(!0),[j,re]=(0,L.useState)(!1),N=e.firstrun,P=!!N&&N.phase!==`none`&&N.session_id===p,ie=P&&N.running,ae=y()===`zh-CN`?`zh`:`en`,[oe,se]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(!P||oe?.lang===ae)return;let e=!0;return M.firstrun(ae).then(t=>e&&t.intro&&se({lang:ae,lines:t.intro})).catch(()=>void 0),()=>{e=!1}},[P,ae,oe?.lang]);let ce=e=>{M.firstrunPick(e).then(()=>t(p,e)).catch(e=>o(e.message||u(`Could not send`)))},le=()=>window.dispatchEvent(new Event(`nanomuse:quick-chat`)),[ue,de]=(0,L.useState)(null),fe=e.settings?.onboarded===!0,pe=(0,L.useRef)(!1),me=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(b?.busy){pe.current||(me.current=ie),pe.current=!0;return}pe.current&&(pe.current=!1,fe&&!me.current&&!ie&&ch(g)&&de(Se()))},[b?.busy,g,fe,ie]);let[he,ge]=(0,L.useState)(null);(0,L.useEffect)(()=>{let{days:e,fresh:t}=ye();t&&ge(e)},[]);let _e=(0,L.useCallback)(()=>{let e=k.current;e&&(e.scrollTop=e.scrollHeight,re(!1))},[]),ve=(0,L.useCallback)(()=>{let e=k.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;A.current=t<120,re(t>400)},[]),be=(0,L.useRef)(null);(0,L.useLayoutEffect)(()=>{be.current!==p&&(be.current=p,A.current=!0),A.current&&_e()},[g,v?.text,p,_e]),(0,L.useEffect)(()=>{let e=k.current,t=ee.current;if(!e||!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>{A.current?_e():ve()});return n.observe(e),n.observe(t),()=>n.disconnect()},[_e,ve]);let xe=()=>{let e=k.current;e&&e.scrollTo({top:e.scrollHeight,behavior:`smooth`})},Ce=e.pendingApprovals.length,Te=e.pendingApprovals.filter(e=>e.thread===p).length,Ee=(0,L.useMemo)(()=>{let e=!f.thread||f.thread===p;if(Te>0&&!(e&&f.state===`working`))return Te>1?u(`{n} approvals waiting for you`,{n:Te}):u(`1 approval waiting for you`);if(!e)return b?.busy?u(`On it`):void 0;if(f.state===`idle`&&!b?.busy)return;if(f.detail)return f.detail;if(f.state===`waiting`)return u(`Waiting for you`);let t=sh(g);return t?u(`On it: {request}`,{request:t}):u(`On it`)},[f,b,p,Te,g,u]),De=g.filter(e=>e.type===`approval`&&e.status===`pending`).length,Oe=Um(),ke=(0,L.useMemo)(()=>Oe?g:g.filter(e=>e.type!==`tool`),[g,Oe]),Ae={signedIn:!!e.hub?.account.signed_in,chatOnCloud:!!e.settings?.llm.cloud,deviceChat:!!b?.device},je=e=>{let t=ep(ke,e,Ae);return t?()=>n(p,t.text,t.files):void 0},Ne=(0,L.useMemo)(()=>Array.from(new Set(g.flatMap(e=>e.type===`artifact`?[e.path]:[]))),[g]);return(0,R.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,R.jsx)(ne,{profile:d,status:f,name:T,statusLine:Ee,statusTone:f.state===`idle`&&!b?.busy?`muted`:`accent`,spinning:(f.state===`working`&&f.thread===p||!!b?.busy)&&Te===0,badge:Ce,onAvatar:()=>S(!0),leading:(0,R.jsx)(te,{onClick:()=>c(!0),label:u(`Chats`),dot:m.length>1&&p!==`main`,className:`wide:invisible`,children:(0,R.jsx)(Ot,{size:22})}),trailing:(0,R.jsx)(Dm,{actions:[{label:u(`Coding agents`),onClick:()=>l(`coding`)}]}),under:b&&b.id!==`main`?b.device?(0,R.jsxs)(`span`,{className:`flex max-w-full items-center gap-1 rounded-full bg-accent/12 px-2.5 py-0.5 text-[11.5px] font-medium text-accent`,children:[D===!1?(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-border`}):(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-500`}),(0,R.jsx)(`span`,{className:`truncate`,children:u(`on {device}`,{device:b.device_name||b.device})})]}):b.remote_from?(0,R.jsxs)(`span`,{className:`flex max-w-full items-center gap-1 rounded-full bg-surface-2 px-2.5 py-0.5 text-[11.5px] font-medium text-fg/80`,children:[(0,R.jsx)(It,{size:11}),` `,(0,R.jsx)(`span`,{className:`truncate`,children:u(`from {device}`,{device:b.remote_from.name})})]}):(0,R.jsx)(`span`,{className:`truncate rounded-full bg-surface-2 px-2.5 py-0.5 text-[11.5px] font-medium text-fg/80`,children:b.title}):void 0}),(0,R.jsxs)(`div`,{ref:k,onScroll:ve,className:`relative flex-1 overflow-y-auto px-3 py-3`,children:[(0,R.jsxs)(`div`,{ref:ee,className:`space-y-2.5`,children:[e.hasMore[p]&&g.length>0&&(0,R.jsx)(`div`,{className:`flex justify-center`,children:(0,R.jsx)(`button`,{type:`button`,className:`text-[12.5px] text-accent px-3 py-1 rounded-full bg-surface-2`,onClick:()=>void i(p,g[0]?.id),children:u(`Load earlier messages`)})}),P&&_&&!e.hasMore[p]&&oe&&(0,R.jsx)(Fp,{lines:oe.lines}),_&&g.length===0&&!v&&!P&&(0,R.jsx)(ih,{name:T,device:b?.device?b.device_name||b.device:void 0,onSend:e=>t(p,e).catch(e=>o(e.message||u(`Could not send`)))}),ke.map((e,t)=>(0,R.jsx)(Gm,{event:e,prev:ke[t-1],name:T,onDecide:(t,n)=>r(e.id,t,n).catch(e=>o(e.message||u(`Could not send decision`))),onOpenFile:a,onOpenBrowser:w,files:Ne,onCloudRetry:je(t)},e.id)),v&&v.text&&(0,R.jsx)($m,{text:v.text,streaming:!0,files:Ne,onOpenFile:a}),(b?.busy||f.state!==`idle`)&&!v?.text&&f.state!==`waiting`&&(0,R.jsx)(th,{label:b?.queued?u(`{n} queued`,{n:b.queued}):void 0}),P&&N.phase===`ask_agent_name`&&!b?.busy&&(0,R.jsx)(Ip,{chips:N.chips,chosen:N.chosen,onPick:ce,onElse:le}),O&&!b?.busy&&(0,R.jsx)(rh,{who:O}),!b?.busy&&f.state===`idle`&&ue!==null&&(0,R.jsx)(we,{moment:`tasks`,n:ue,className:`mx-1 my-2`}),!b?.busy&&f.state===`idle`&&he!==null&&(0,R.jsx)(we,{moment:`days_used`,n:he,className:`mx-1 my-2`})]}),j&&(0,R.jsxs)(`button`,{type:`button`,onClick:xe,className:`sticky bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-surface border border-border shadow px-3 py-1.5 text-[12.5px] flex items-center gap-1`,children:[(0,R.jsx)(Me,{size:14}),` `,u(`Latest`),De?` · ${u(`{n} approval`,{n:De})}`:``]})]}),(0,R.jsx)(Rf,{}),(0,R.jsx)(ah,{name:T,busy:!!b?.busy&&De===0,waiting:g.some(e=>e.type===`question`&&e.status===`pending`),onSend:(e,n)=>t(p,e,n).catch(e=>{throw o(e.message||u(`Could not send`)),e})}),(0,R.jsx)(am,{open:x,onClose:()=>S(!1)}),C&&(0,R.jsx)(Ap,{thread:p,eventId:C,onClose:()=>w(null)})]})}function Gm({event:e,prev:t,name:n,onDecide:r,onOpenFile:i,onOpenBrowser:a,files:o,onCloudRetry:s}){let c=qm(t,e)?(0,R.jsx)(Jm,{ts:e.ts}):null,l=(()=>{switch(e.type){case`user`:return(0,R.jsx)(Ym,{event:e,onOpenFile:i});case`assistant`:return e.quiet?(0,R.jsx)(eh,{text:e.text,about:e.about,ts:e.ts}):(0,R.jsx)($m,{text:e.text,reasoning:e.reasoning,continued:t?.type===`assistant`,files:o,onOpenFile:i,spoken:e.via===`call`,modelUsed:e.model_used});case`tool`:return(0,R.jsx)(fp,{event:e});case`approval`:return(0,R.jsx)(hp,{event:e,name:n,onDecide:r});case`question`:return(0,R.jsx)(gp,{event:e,name:n});case`notice`:return(0,R.jsx)(vp,{event:e,onCloudRetry:s});case`artifact`:return(0,R.jsx)(Ep,{event:e,onOpen:i});case`browser`:return(0,R.jsx)(yp,{event:e,onOpen:a});case`hands`:return(0,R.jsx)(bp,{event:e,name:n});case`hold`:return(0,R.jsx)(wp,{event:e,name:n});case`avatar`:return(0,R.jsx)(np,{event:e,name:n});default:return null}})();return l?(0,R.jsxs)(R.Fragment,{children:[c,l]}):null}var Km=6e5;function qm(e,t){return t.ts?!e?.ts||new Date(t.ts).getTime()-new Date(e.ts).getTime()>=Km:!1}function Jm({ts:e}){let t=l(e);return t?(0,R.jsx)(`div`,{className:`pt-2 pb-0.5 text-center text-[11.5px] font-medium text-muted`,children:t}):null}function Ym({event:e,onOpenFile:t}){let n=s(),r=e.files??[],a=r.filter(e=>e.kind===`image`),o=r.filter(e=>e.kind!==`image`);return(0,R.jsxs)(`div`,{className:`rise flex flex-col items-end pl-12`,children:[e.via===`call`?(0,R.jsxs)(`span`,{className:`mb-1 flex items-center gap-1 text-[11.5px] font-medium text-muted`,children:[(0,R.jsx)(Ut,{size:11}),` `,n(`said on a call`)]}):e.via?(0,R.jsx)(`span`,{className:`mb-1 text-[11.5px] font-medium text-muted`,children:n(`asked from {device}`,{device:e.via})}):e.to_device_name||e.to_device?(0,R.jsxs)(`span`,{className:`mb-1 flex items-center gap-1 text-[11.5px] font-medium text-accent`,children:[(0,R.jsx)(It,{size:11}),` `,n(`to {device}`,{device:e.to_device_name||e.to_device||``})]}):(e.via_device_name||e.via_device)&&(0,R.jsx)(`span`,{className:`mb-1 text-[11.5px] font-medium text-muted`,children:n(`From {device}`,{device:e.via_device_name||e.via_device||``})}),a.length>0&&(0,R.jsx)(`div`,{className:`mb-1 flex max-w-full flex-wrap justify-end gap-1.5`,children:a.map(e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>t(e.path),"aria-label":e.name,className:i(`overflow-hidden rounded-2xl border border-border/60 bg-surface-2 shadow-sm active:scale-[0.98] transition`,a.length===1?`max-h-64 max-w-[240px]`:`h-28 w-28`),children:(0,R.jsx)(`img`,{src:h(e.path),alt:e.name,loading:`lazy`,className:i(`object-cover`,a.length===1?`max-h-64 w-auto max-w-full`:`h-full w-full`)})},e.path))}),o.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path),className:`mb-1 flex max-w-full items-center gap-2.5 rounded-2xl border border-border bg-surface px-3 py-2 text-left shadow-sm hover:bg-surface-2 active:scale-[0.98] transition`,children:[(0,R.jsx)(`span`,{className:`rounded-xl bg-accent/12 p-2 text-accent`,children:e.kind===`data`?(0,R.jsx)(cn,{size:17}):(0,R.jsx)(mt,{size:17})}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-[14px] font-medium`,children:e.name}),(0,R.jsx)(`span`,{className:`block text-[11.5px] text-muted`,children:Xm(e.size)})]})]},e.path)),e.text&&(0,R.jsx)(`div`,{className:`bubble-user max-w-full rounded-[20px] bg-bubble-user px-4 py-2.5 text-bubble-user-fg`,children:(0,R.jsx)(`div`,{className:`md text-[15px] leading-[1.45] whitespace-pre-wrap break-words`,children:e.text})})]})}function Xm(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function Zm(e){let t=e.toLowerCase().split(`.`).pop()??``;return[`csv`,`tsv`,`json`,`xlsx`,`xls`].includes(t)?`data`:`other`}var Qm=`image/*,.pdf,.txt,.md,.csv,.tsv,.json,.log,.html,.xml,.yaml,.yml,.toml,.ics,.vcf,.xlsx,.xls,.docx`;function $m({text:e,reasoning:t,streaming:n,continued:r,files:a,onOpenFile:o,spoken:c,modelUsed:l}){let[u,d]=(0,L.useState)(!1),f=s(),p=(0,L.useMemo)(()=>mf(jm(e,!!n)),[e,n]);return p.length===0&&!n&&!t?null:(0,R.jsx)(`div`,{className:i(`rise flex items-end gap-2 pr-10`,r&&`-mt-1`),children:(0,R.jsxs)(`div`,{className:`min-w-0 max-w-full`,children:[t&&(0,R.jsx)(`button`,{type:`button`,className:`mb-1 ml-1 text-[12px] text-muted`,onClick:()=>d(e=>!e),children:f(u?`Hide thinking`:`Show thinking`)}),t&&u&&(0,R.jsx)(`div`,{className:`mb-1.5 rounded-2xl bg-surface-2/70 px-3 py-2 text-[13px] text-muted whitespace-pre-wrap break-words`,children:t}),p.map((e,t)=>e.bare?(0,R.jsx)(`div`,{className:`my-1 max-w-full`,children:(0,R.jsx)(hf,{text:e.text,files:a,onOpenFile:o})},t):(0,R.jsxs)(`div`,{className:i(`my-1 max-w-[340px] rounded-[20px] bg-surface-2 px-3.5 py-2.5 wide:max-w-[600px]`,c&&`border border-accent/15`),children:[c&&t===0&&(0,R.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-1 text-[11px] font-medium text-accent/80`,children:[(0,R.jsx)(Ut,{size:10}),` `,f(`said on a call`)]}),(0,R.jsx)(hf,{text:e.text,files:a,onOpenFile:o}),n&&t===p.length-1&&(0,R.jsx)(`span`,{className:`inline-block w-1.5 h-4 ml-0.5 align-middle bg-accent/70 animate-pulse rounded-sm`})]},t)),p.length===0&&n&&(0,R.jsx)(`div`,{className:`my-1 rounded-[20px] bg-surface-2 px-3.5 py-2.5`,children:(0,R.jsx)(`span`,{className:`inline-block w-1.5 h-4 align-middle bg-accent/70 animate-pulse rounded-sm`})}),l&&!n&&(0,R.jsx)(`div`,{className:`ml-1 text-[11px] text-muted`,children:f(`Answered by nanoMuse Cloud this time ({model})`,{model:l})})]})})}function eh({text:e,about:n,ts:r}){let[i,a]=(0,L.useState)(!1),o=s(),c=n?t(n.replace(/^Working on your goal: /,``)):o(`background check`);return(0,R.jsx)(`div`,{className:`rise flex justify-center px-6`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`max-w-full rounded-2xl px-3 py-1.5 text-[12px] text-muted text-center leading-snug`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsx)(Rt,{size:12}),` `,o(`Checked on {label}: nothing new`,{label:c}),r?` · ${u(r)}`:``]}),i&&(0,R.jsx)(`span`,{className:`block mt-1 text-left whitespace-pre-wrap text-[12.5px]`,children:e})]})})}function th({label:e}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-[20px] rounded-bl-md bg-surface-2 px-3.5 py-2.5 flex items-center gap-1`,children:[(0,R.jsx)(`span`,{className:`typing-dot h-2 w-2 rounded-full bg-muted`}),(0,R.jsx)(`span`,{className:`typing-dot h-2 w-2 rounded-full bg-muted`}),(0,R.jsx)(`span`,{className:`typing-dot h-2 w-2 rounded-full bg-muted`})]}),e&&(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:e})]})}function nh(e){let t=e?e.at*1e3+N:0,[n,r]=(0,L.useState)(0);return(0,L.useEffect)(()=>{if(!t)return;let e=t-Date.now();if(e<=0){r(t);return}let n=window.setTimeout(()=>r(t),e+50);return()=>window.clearTimeout(n)},[t]),!e||n===t?null:e}function rh({who:e}){let t=s();return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 text-[12px] text-muted`,children:[(0,R.jsx)(A,{size:12,className:`animate-spin`}),(0,R.jsx)(`span`,{children:t(`{device} is working…`,{device:e.device_name||e.device})})]})}function ih({name:e,device:t,onSend:n}){let r=s(),i=t?[r(`What is on your screen right now?`),r(`Which folder are you in, and what is in it?`),r(`Check for updates and tell me what needs a restart`)]:[r(`What can you do for me?`),r(`Plan my week: ask me what's on my plate`),r(`Research and compare two options for me`),r(`Set up a long-term goal and track it`)];return(0,R.jsxs)(`div`,{className:`flex flex-col items-center text-center px-6 pt-10 pb-6 gap-3`,children:[(0,R.jsx)(`div`,{className:`text-[20px] font-semibold`,children:t?r(`This chat goes to {device}.`,{device:t}):r(`Hi, I'm {name}.`,{name:e})}),(0,R.jsx)(`p`,{className:`text-muted text-[14.5px] leading-snug max-w-sm`,children:t?r(`Whatever you ask here, the {name} on {device} does where it is: its shell, its files, its screen. Every step shows up here, and anything that needs an approval asks you here.`,{name:e,device:t}):r(`I don't just answer; I get things done: research, plans, files, code, email, long-running goals. Everything I do shows up here, and anything hard to undo waits for your approval.`)}),(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap justify-center gap-2`,children:i.map(e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`rounded-full bg-surface-2 px-3.5 py-1.5 text-[13.5px] hover:bg-border/60`,children:e},e))})]})}function ah({name:e,busy:t,waiting:n,onSend:r}){let{state:a,draft:o,draftFiles:c,toast:l}=E(),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!1),m=(0,L.useRef)(``),g=Np((0,L.useCallback)((e,t)=>{let n=m.current,r=n&&!/\s$/.test(n)?` `:``;d(n+r+e+t)},[]),(0,L.useCallback)(e=>l(e),[l])),_=()=>{g.listening||(m.current=u),g.toggle()},[v,y]=(0,L.useState)([]),[b,x]=(0,L.useState)([]);(0,L.useEffect)(()=>{if(!a.draftFiles)return;let e=a.draftFiles.map(e=>({key:`shared-${e.path}`,file:new File([],e.name),preview:e.kind===`image`?h(e.path):null,info:e,error:null}));x(t=>[...t.filter(t=>!e.some(e=>e.key===t.key)),...e].slice(0,10)),c(null)},[a.draftFiles]);let S=(0,L.useRef)(null),C=(0,L.useRef)(null),w=s();(0,L.useEffect)(()=>()=>b.forEach(e=>e.preview?.startsWith(`blob:`)&&URL.revokeObjectURL(e.preview)),[b]),(0,L.useEffect)(()=>{let e=()=>S.current?.focus();return window.addEventListener(`nanomuse:quick-chat`,e),()=>window.removeEventListener(`nanomuse:quick-chat`,e)},[]);let T=e=>{let t=Array.from(e).slice(0,Math.max(0,10-b.length));if(t.length===0)return;let n=t.map(e=>({key:`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,7)}`,file:e,preview:e.type.startsWith(`image/`)?URL.createObjectURL(e):null,info:null,error:null}));x(e=>[...e,...n]);for(let e of n)M.upload(e.file).then(t=>x(n=>n.map(n=>n.key===e.key?{...n,info:t}:n))).catch(t=>{let n=t.message?P(t.message):w(`Upload failed`);x(t=>t.map(t=>t.key===e.key?{...t,error:n}:t)),l(n)})},D=e=>x(t=>t.filter(t=>t.key!==e)),O=b.some(e=>!e.info&&!e.error),k=b.flatMap(e=>e.info?[e.info.path]:[]);(0,L.useEffect)(()=>{let e=S.current;e&&(e.style.height=`0px`,e.style.height=`${Math.min(e.scrollHeight,160)}px`)},[u]),(0,L.useEffect)(()=>{if(a.draft===null)return;d(a.draft),o(null);let e=S.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},[a.draft]);let ee=a.settings?.skills?.enabled!==!1;(0,L.useEffect)(()=>{ee&&M.skills().then(e=>y(e.skills.filter(e=>e.enabled))).catch(()=>y([]))},[ee,a.skillsVersion]);let te=/^\/([a-z0-9-]*)$/i.exec(u),j=te?v.filter(e=>e.name.startsWith(te[1].toLowerCase())).slice(0,6):[],ne=e=>{d(`/${e.name} `),S.current?.focus()},re=a.hub?.devices??[],N=Pm(u,re),ie=N.length===0?Fm(u,re):null,ae=e=>{d(`@${e.name} `),S.current?.focus()},oe=e=>{e?.preventDefault();let t=u.trim();if(!t&&k.length===0||O||f)return;g.listening&&g.stop();let n=b;p(!0),d(``),x([]),S.current?.focus(),r(t,k).catch(()=>{d(e=>e||t),x(e=>e.length?e:n)}).finally(()=>p(!1))};return(0,R.jsxs)(`form`,{onSubmit:oe,className:`shrink-0 bg-bg px-3 pt-1.5 pb-1`,children:[t&&!n&&(0,R.jsx)(`div`,{className:`px-2 pb-1 text-[12px] text-muted`,children:w(`{name} is working; anything you send now is picked up right away.`,{name:e})}),j.length>0&&(0,R.jsx)(`ul`,{className:`mb-2 max-h-72 overflow-y-auto rounded-3xl border border-border/70 bg-surface shadow-lg divide-y divide-border/70`,role:`listbox`,"aria-label":w(`Skills`),children:j.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>ne(e),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left hover:bg-surface-2/70 active:bg-surface-2`,children:[(0,R.jsx)(gn,{size:16,className:`shrink-0 text-accent`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`span`,{className:`block text-[14px] font-medium`,children:[`/`,e.name]}),(0,R.jsx)(`span`,{className:`block truncate text-[12.5px] text-muted`,children:e.description})]})]})},e.name))}),N.length>0&&(0,R.jsx)(`ul`,{className:`mb-2 max-h-72 overflow-y-auto rounded-3xl border border-border/70 bg-surface shadow-lg divide-y divide-border/70`,role:`listbox`,"aria-label":w(`Devices`),children:N.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>ae(e),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left hover:bg-surface-2/70 active:bg-surface-2`,children:[(0,R.jsx)(`span`,{className:`shrink-0 text-accent`,children:e.kind===`computer`?(0,R.jsx)(Lt,{size:16}):(0,R.jsx)(tn,{size:16})}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`span`,{className:`block text-[14px] font-medium`,children:[`@`,e.name]}),(0,R.jsx)(`span`,{className:`block truncate text-[12.5px] text-muted`,children:e.online?w(`Runs this there and reports back`):w(`Offline`)})]})]})},e.id))}),ie&&(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 pb-1 text-[12px] text-muted`,children:[(0,R.jsx)(It,{size:12}),` `,w(`This goes to {device}.`,{device:ie.name})]}),b.length>0&&(0,R.jsx)(`div`,{className:`mb-1 flex gap-2.5 overflow-x-auto px-1 pt-2.5 pb-1 pr-3`,role:`list`,"aria-label":w(`Attachments`),children:b.map(e=>(0,R.jsxs)(`div`,{role:`listitem`,className:i(`relative shrink-0 rounded-2xl border bg-surface-2`,e.error?`border-danger/60`:`border-border/70`),children:[e.preview?(0,R.jsx)(`img`,{src:e.preview,alt:e.file.name,className:`h-16 w-16 rounded-2xl object-cover`}):(0,R.jsxs)(`div`,{className:`flex h-16 w-40 items-center gap-2 px-2.5`,children:[(0,R.jsx)(`span`,{className:`rounded-xl bg-accent/12 p-1.5 text-accent`,children:Zm(e.file.name)===`data`?(0,R.jsx)(cn,{size:16}):(0,R.jsx)(mt,{size:16})}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-[12.5px] font-medium`,children:e.file.name}),(0,R.jsx)(`span`,{className:`block text-[11px] text-muted`,children:e.error?w(`Upload failed`):Xm(e.info?.size??e.file.size)})]})]}),!e.info&&!e.error&&(0,R.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center rounded-2xl bg-bg/50`,children:(0,R.jsx)(A,{size:18,className:`animate-spin text-accent`})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>D(e.key),"aria-label":w(`Remove`),className:`absolute -right-1.5 -top-1.5 flex h-6 w-6 items-center justify-center rounded-full border border-border bg-surface text-muted shadow-sm`,children:(0,R.jsx)(Fe,{size:13})})]},e.key))}),(0,R.jsxs)(`div`,{className:`flex items-end gap-2 rounded-[26px] border border-border bg-surface px-1.5 py-1.5 shadow-[0_2px_12px_-6px_rgba(0,0,0,0.12)] focus-within:border-fg/20`,children:[(0,R.jsx)(`input`,{ref:C,type:`file`,multiple:!0,accept:Qm,className:`hidden`,onChange:e=>{e.target.files&&T(e.target.files),e.target.value=``}}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>C.current?.click(),"aria-label":w(`Attach a file`),className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-fg/70 transition hover:bg-surface-2 active:scale-95`,children:(0,R.jsx)(I,{size:22})}),(0,R.jsx)(`textarea`,{ref:S,value:u,onChange:e=>d(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData?.files??[]);t.length>0&&(e.preventDefault(),T(t))},onKeyDown:e=>{if(e.key===`Tab`&&j.length>0&&j[0]){e.preventDefault(),ne(j[0]);return}if(e.key===`Tab`&&N.length>0&&N[0]){e.preventDefault(),ae(N[0]);return}e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),oe())},rows:1,placeholder:n?w(`Answer {name}…`,{name:e}):b.length>0?w(`Say what to do with it…`):w(`Message`),className:`flex-1 resize-none bg-transparent px-1 py-2 text-[15px] leading-[1.4] outline-none placeholder:text-muted`}),g.supported&&(0,R.jsx)(Pp,{listening:g.listening,onClick:_}),(0,R.jsx)(`button`,{type:`submit`,disabled:!u.trim()&&k.length===0||O,"aria-label":w(`Send`),className:i(`flex h-9 w-9 shrink-0 items-center justify-center rounded-full transition active:scale-95`,u.trim()||k.length>0?`bg-accent text-accent-fg`:`bg-surface-2 text-muted`,`disabled:opacity-60`),children:(0,R.jsx)(Je,{size:19,strokeWidth:2.5})})]})]})}function oh({threads:e,active:t,onPick:n,onCleared:r,compact:a=!1,grouped:o=!1}){let{state:c,toast:l,dispatch:d}=E(),f=s(),[p,m]=(0,L.useState)(``),[h,g]=(0,L.useState)(!1),_=(0,L.useRef)(null),v=(c.hub?.devices??[]).filter(e=>!e.this&&e.kind!==`web`&&e.online),y=e=>c.hub?.devices.find(t=>t.id===e)?.kind??`phone`,b=async e=>{try{let t=await M.askDevice(e.id);d({type:`ws`,msg:{kind:`thread`,thread:t.thread}}),n(t.thread.id)}catch(e){l(e.message)}},x=async()=>{g(!0);try{let e=await M.createThread(p.trim()||f(`Side chat`));d({type:`ws`,msg:{kind:`thread`,thread:e}}),m(``),n(e.id)}catch(e){l(e.message)}finally{g(!1)}},S=async e=>{if(window.confirm(f(`Delete this side chat and its history?`)))try{await M.deleteThread(e),d({type:`ws`,msg:{kind:`thread_deleted`,thread:e}})}catch(e){l(e.message)}},C=async e=>{if(window.confirm(f(`Clear this conversation? Memory and goals are kept.`)))try{await M.clearThread(e),d({type:`ws`,msg:{kind:`thread_cleared`,thread:e}}),r?.()}catch(e){l(e.message)}},w=e=>(0,R.jsxs)(`li`,{className:i(`group flex items-center gap-2 px-3`,a?`py-2 rounded-xl hover:bg-surface-2/60`:`py-2.5`,e.id===t&&`bg-surface-2/60`),children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:`flex-1 text-left min-w-0`,children:[(0,R.jsxs)(`div`,{className:i(`font-medium truncate flex items-center gap-2`,a?`text-[13.5px]`:`text-[15px]`),children:[e.device?(0,R.jsx)(`span`,{className:`text-accent`,children:y(e.device)===`computer`?(0,R.jsx)(Lt,{size:14}):(0,R.jsx)(tn,{size:14})}):e.remote_from?(0,R.jsx)(It,{size:14,className:`text-muted`}):null,(0,R.jsx)(`span`,{className:`truncate`,children:e.id===`main`?f(e.title):e.title}),e.busy&&(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400 animate-pulse`})]}),(0,R.jsxs)(`div`,{className:i(`text-muted`,a?`text-[11.5px]`:`text-[12px]`),children:[f(`{n} events`,{n:e.events}),e.queued?` · ${f(`{n} queued`,{n:e.queued})}`:``,` · `,u(e.updated_at)]})]}),(0,R.jsx)(`button`,{type:`button`,"aria-label":f(`Clear`),onClick:()=>void C(e.id),className:i(`p-2 text-muted hover:text-fg`,a&&`opacity-0 group-hover:opacity-100 focus:opacity-100`),children:(0,R.jsx)(Fe,{size:16})}),e.id!==`main`&&(0,R.jsx)(`button`,{type:`button`,"aria-label":f(`Delete`),onClick:()=>void S(e.id),className:i(`p-2 text-muted hover:text-rose-500`,a&&`opacity-0 group-hover:opacity-100 focus:opacity-100`),children:(0,R.jsx)(fn,{size:16})})]},e.id),T=i(`divide-y divide-border overflow-hidden`,a?`rounded-xl`:`rounded-2xl border border-border`),D=`px-3 pb-1 pt-3 text-[11.5px] font-semibold uppercase tracking-wide text-muted`;return(0,R.jsxs)(`div`,{children:[o?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:D,children:f(`Main chat`)}),(0,R.jsx)(`ul`,{className:T,children:e.filter(e=>e.id===`main`).map(w)}),(0,R.jsxs)(`div`,{className:i(D,`flex items-center justify-between pr-1`),children:[(0,R.jsx)(`span`,{children:f(`Side chats`)}),(0,R.jsx)(`button`,{type:`button`,"aria-label":f(`New side chat`),onClick:()=>_.current?.focus(),className:`flex h-6 w-6 items-center justify-center rounded-full text-muted hover:bg-surface-2 hover:text-fg`,children:(0,R.jsx)(I,{size:15})})]}),(0,R.jsx)(`ul`,{className:T,children:e.filter(e=>e.id!==`main`).map(w)}),e.every(e=>e.id===`main`)&&(0,R.jsx)(`p`,{className:`px-3 py-2 text-[12px] text-muted`,children:f(`A side chat keeps one topic apart from the rest.`)})]}):(0,R.jsx)(`ul`,{className:T,children:e.map(w)}),v.length>0&&(0,R.jsxs)(`div`,{className:`mt-4`,children:[(0,R.jsx)(`div`,{className:`mb-1.5 text-[12px] font-medium text-muted`,children:f(`Ask one of your devices`)}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:v.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void b(e),className:`flex items-center gap-1.5 rounded-full border border-border bg-surface px-3 py-1.5 text-[13px] font-medium hover:bg-surface-2`,children:[e.kind===`phone`?(0,R.jsx)(tn,{size:14,className:`text-accent`}):(0,R.jsx)(Lt,{size:14,className:`text-accent`}),e.name]},e.id))})]}),(0,R.jsxs)(`div`,{className:i(`flex gap-2`,a?`mt-3`:`mt-4`),children:[(0,R.jsx)(`input`,{ref:_,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!h&&x()},placeholder:f(a?`New side chat`:`New side chat, e.g. “Trip to Kyoto”`),className:i(`min-w-0 flex-1 bg-surface-2 outline-none focus:ring-2 focus:ring-accent/40`,a?`rounded-xl px-3 py-2 text-[13px]`:`rounded-2xl px-3.5 py-2.5 text-[14px]`)}),(0,R.jsxs)(`button`,{type:`button`,disabled:h,onClick:()=>void x(),"aria-label":f(`New`),className:i(`flex items-center gap-1.5 bg-accent text-accent-fg font-medium disabled:opacity-50`,a?`rounded-xl px-2.5`:`rounded-2xl px-3.5 py-2.5`),children:[(0,R.jsx)(jt,{size:18}),` `,!a&&f(`New`)]})]})]})}function sh(e){let t=[...e].reverse().find(e=>e.type===`user`),n=(((t?.type===`user`?t.text:``)||``).split(/\r?\n/).map(e=>e.trim()).find(e=>e.length>0)??``).replace(/\s+/g,` `);if(n.length<=36)return n;let r=n.slice(0,36),i=r.lastIndexOf(` `);return(i>16?r.slice(0,i):r).trimEnd()+`…`}function ch(e){let t=!1;for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.type===`assistant`){if(!r.text||r.quiet)return!1;t=!0;continue}if(r.type===`user`)return t&&!r.via;if(r.type===`notice`)return!1}return!1}function lh(e){let t=Sn(),n=t?`Desktop app (${t.platform}, shell ${t.version})`:`Web app (${navigator.userAgent})`;return`https://github.com/nano-muse/nanoMuse/issues/new?${new URLSearchParams({template:`bug_report.yml`,version:e||``,os:n}).toString()}`}function uh(){let{state:e,setTab:t,openThread:n}=E(),r=s(),[a,o]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(``),f=(0,L.useRef)(null),p=$f(),{profile:m,status:h}=e,g=m?.name??`nanoMuse`,_=e.pendingApprovals.length,v=e.goals.filter(e=>e.proposal&&e.status!==`cancelled`).length,y=e.pendingApprovals.filter(t=>t.ts>e.feedSeenAt).length,b=(e.hub?.devices??[]).filter(e=>!e.this&&e.kind!==`web`&&e.online).length,x=_>0?_>1?r(`{n} approvals waiting for you`,{n:_}):r(`1 approval waiting for you`):h.state===`idle`?r(`Idle`):h.detail||(h.state===`waiting`?r(`Waiting for you`):r(`Working…`));(0,L.useEffect)(()=>{if(!c)return;let e=e=>{f.current?.contains(e.target)||l(!1)},t=e=>{e.key===`Escape`&&l(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[c]);let S=[{id:`chat`,label:`Chat`,icon:(0,R.jsx)(At,{size:21}),badge:_},{id:`feed`,label:`Feed`,icon:(0,R.jsx)(Bt,{size:21}),badge:y},{id:`ideas`,label:`Ideas`,icon:(0,R.jsx)(Ct,{size:21})},{id:`goals`,label:`Goals`,icon:(0,R.jsx)(rn,{size:21}),badge:v},{id:`library`,label:`Library`,icon:(0,R.jsx)(St,{size:21})},{id:`devices`,label:`Devices`,icon:(0,R.jsx)(It,{size:21}),dot:b>0},...p?[{id:`coding`,label:`Coding`,icon:(0,R.jsx)(on,{size:21})}]:[]],C=u.trim().toLowerCase(),w=C?e.threads.filter(e=>e.id===`main`||(e.id===`main`?r(e.title):e.title).toLowerCase().includes(C)||(e.device_name??``).toLowerCase().includes(C)):e.threads,T=e=>i(`relative flex w-[60px] flex-col items-center gap-[3px] rounded-xl py-1.5 text-[10.5px] font-medium leading-none transition`,e?`bg-surface-2 text-fg`:`text-fg/65 hover:bg-surface-2/60 hover:text-fg`);return(0,R.jsxs)(`div`,{className:`flex h-full shrink-0`,children:[(0,R.jsxs)(`aside`,{className:`relative flex h-full w-[76px] shrink-0 flex-col items-center border-r border-border bg-surface/70`,children:[(0,R.jsx)(`div`,{className:`titlebar-room`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(!0),className:`relative mt-3 rounded-full transition hover:scale-[1.04]`,"aria-label":r(`Activity`),title:`${g} · ${x}`,children:[(0,R.jsx)(D,{profile:m,status:h,size:44}),_>0&&(0,R.jsx)(`span`,{className:`pointer-events-none absolute -right-1 -top-1 flex h-[18px] min-w-[18px] items-center justify-center rounded-full border-2 border-surface bg-rose-500 px-1 text-[10.5px] font-bold text-white`,children:_})]}),(0,R.jsx)(`span`,{className:`mt-1.5 max-w-[68px] truncate px-1 text-[11px] font-semibold leading-tight`,children:g}),(0,R.jsx)(`nav`,{className:`mt-3 flex w-full flex-1 flex-col items-center gap-0.5 overflow-y-auto overflow-x-hidden px-2`,children:S.map(n=>{let a=e.tab===n.id;return(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-current":a?`page`:void 0,className:T(a),children:[(0,R.jsx)(`span`,{className:i(a?`text-accent`:`text-fg/60`),children:n.icon}),(0,R.jsx)(`span`,{className:`max-w-full truncate`,children:r(n.label)}),n.badge?(0,R.jsx)(`span`,{className:`absolute right-1.5 top-1 flex h-[17px] min-w-[17px] items-center justify-center rounded-full bg-rose-500 px-1 text-[10px] font-bold text-white`,children:n.badge}):n.dot?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-3 top-2 h-2 w-2 rounded-full border-2 border-surface bg-emerald-500`}),(0,R.jsx)(`span`,{className:`sr-only`,children:r(`{n} online`,{n:b})})]}):null]},n.id)})}),(0,R.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-0.5 px-2 pb-3 pt-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`account`),"aria-current":e.tab===`account`?`page`:void 0,className:T(e.tab===`account`),title:e.hub?.account.signed_in?e.hub.account.hint:r(`Account`),children:[(0,R.jsx)(mn,{size:21,className:e.tab===`account`?`text-accent`:`text-fg/60`}),(0,R.jsx)(`span`,{className:`max-w-full truncate`,children:r(`Account`)})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`you`),"aria-current":e.tab===`you`?`page`:void 0,className:T(e.tab===`you`),children:[(0,R.jsx)(en,{size:21,className:e.tab===`you`?`text-accent`:`text-fg/60`}),(0,R.jsx)(`span`,{className:`max-w-full truncate`,children:r(`Settings`)})]}),(0,R.jsxs)(`div`,{ref:f,className:`relative w-full`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-expanded":c,"aria-haspopup":`menu`,className:i(T(c),`mx-auto`),children:[(0,R.jsx)(Ot,{size:21,className:`text-fg/60`}),(0,R.jsx)(`span`,{children:r(`More`)})]}),c&&(0,R.jsxs)(`div`,{role:`menu`,className:`absolute bottom-0 left-[68px] z-30 w-[232px] rounded-2xl border border-border bg-surface p-1.5 shadow-[0_12px_40px_-12px_rgba(0,0,0,0.3)]`,children:[(0,R.jsxs)(`a`,{role:`menuitem`,href:lh(e.version),target:`_blank`,rel:`noreferrer`,onClick:()=>l(!1),className:`flex items-center gap-2.5 rounded-xl px-2.5 py-2 text-[13px] font-medium hover:bg-surface-2`,children:[(0,R.jsx)(ue,{size:16,className:`text-fg/60`}),` `,r(`Report a bug`)]}),(0,R.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{l(!1),t(`you`),window.location.hash=`developer`},className:`flex w-full items-center gap-2.5 rounded-xl px-2.5 py-2 text-left text-[13px] font-medium hover:bg-surface-2`,children:[(0,R.jsx)(yn,{size:16,className:`text-fg/60`}),(0,R.jsx)(`span`,{className:`flex-1`,children:r(`Developer tools`)}),(0,R.jsx)(`span`,{className:`text-[11.5px] font-normal text-muted`,children:r(p?`On`:`Off`)})]}),e.version&&(0,R.jsxs)(`div`,{className:`px-2.5 pb-1 pt-1.5 text-[11.5px] text-muted`,children:[`nanoMuse `,e.version]})]})]})]}),(0,R.jsx)(am,{open:a,onClose:()=>o(!1)})]}),e.tab===`chat`&&(0,R.jsxs)(`section`,{className:`flex h-full w-[248px] shrink-0 flex-col border-r border-border bg-surface/40`,"aria-label":r(`Chats`),children:[(0,R.jsx)(`div`,{className:`titlebar-room`}),(0,R.jsxs)(`div`,{className:`px-3 pb-2 pt-4`,children:[(0,R.jsx)(`h2`,{className:`px-1 text-[15px] font-semibold tracking-tight`,children:r(`Chats`)}),(0,R.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-1.5 text-muted focus-within:ring-2 focus-within:ring-accent/40`,children:[(0,R.jsx)(qt,{size:14,className:`shrink-0`}),(0,R.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:r(`Search`),"aria-label":r(`Search chats`),className:`min-w-0 flex-1 bg-transparent text-[13px] text-fg outline-none placeholder:text-muted`}),u&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(``),"aria-label":r(`Clear`),className:`shrink-0 hover:text-fg`,children:(0,R.jsx)(Fe,{size:14})})]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-3`,children:(0,R.jsx)(oh,{threads:w,active:e.activeThread,onPick:e=>n(e),compact:!0,grouped:!0})})]})]})}function dh(){let{state:e,send:t,openThread:n,openFile:r,markFeedSeen:i,setTab:a,toast:o}=E(),[c,l]=(0,L.useState)(null),[u,p]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(null),b=e.profile?.name??`nanoMuse`,x=s(),S=y();(0,L.useEffect)(()=>{let e=!0;return M.feed(80).then(t=>e&&l(t)).catch(e=>o(e.message)),M.upcoming().then(t=>e&&g(t)).catch(()=>void 0),M.feedPosts().then(t=>e&&p(t)).catch(()=>void 0),()=>{e=!1}},[e.feedVersion,e.remindersVersion]),(0,L.useEffect)(()=>{let e=!0;return M.calendar().then(t=>e&&v(t)).catch(()=>void 0),()=>{e=!1}},[e.calendarVersion,e.connectionsVersion]),(0,L.useEffect)(()=>{c&&c.length&&c[0].ts>e.feedSeenAt&&i(c[0].ts)},[c,e.feedSeenAt,i]);let C=(0,L.useMemo)(()=>kh(c??[]),[c,S]),[w,T]=(0,L.useState)(!1),[D,O]=(0,L.useState)(null),[k,ee]=(0,L.useState)(()=>d(fh)===`1`),[j,ne]=(0,L.useState)(!1),re=()=>{f(fh,`1`),ee(!0)},N=async()=>{ne(!0);try{let e=await M.refreshFeedPosts();p(e),e.error&&o(x(`Could not write posts: {error}`,{error:e.error}))}catch(e){o(e.message)}finally{ne(!1)}},P=e=>{t(`main`,e.prompt||`${x(`About this post from my feed:`)}\n\n**${e.title}**\n\n${e.body.slice(0,1200)}`).catch(e=>o(e.message||x(`Could not send`))),n(`main`)},ie=(0,L.useMemo)(()=>mh(u?.posts??[]),[u]),ae=u!==null&&u.posts.length===0;return(0,R.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,R.jsx)(Em,{title:``,trailing:(0,R.jsx)(te,{onClick:()=>T(!0),label:x(`Feed settings`),children:(0,R.jsx)(en,{size:22})})}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-3.5 pb-7`,children:[ie.length===0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(gh,{text:hh(ph(),new Date)}),!k&&(0,R.jsx)(xh,{instructions:u?.instructions??``,onEdit:()=>T(!0),onAck:re}),ae&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Sh,{emoji:`🖼️`,title:x(`Nothing in the feed yet`),body:x(`As we get to know each other, new posts will show up here. Every day at {time} I read what I remember about you (your memory files, the last week of diary, your goals) and write a few short posts.`,{time:u?.time??`08:00`})}),(0,R.jsx)(Sh,{emoji:`📝`,title:x(`Steer it with one sentence`),body:x(`Tap the sliders at the top right to tell me what you want more of, switch the daily routine off, or have me write the first day now.`)}),e.settings&&!e.settings.llm_ready&&(0,R.jsx)(_h,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a(`you`),className:`flex w-full items-center gap-2 p-4 text-left text-[14px] text-muted`,children:[(0,R.jsx)(F,{size:16,className:`shrink-0 text-accent`}),` `,x(`Add a model first; the feed is written by your agent.`)]})}),(0,R.jsx)(_h,{children:(0,R.jsx)(`div`,{className:`p-4`,children:j?(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 text-[15px]`,children:[(0,R.jsx)(A,{size:18,className:`animate-spin text-accent`}),` `,x(`Writing…`)]}):(0,R.jsx)(`button`,{type:`button`,onClick:()=>void N(),className:`h-[46px] w-full rounded-full bg-accent text-[15px] font-semibold text-accent-fg`,children:x(`Write it now`)})})})]})]}),ie.map(([e,t],n)=>(0,R.jsxs)(`section`,{children:[(0,R.jsx)(gh,{text:hh(e,new Date(t[0].ts))}),n===0&&!k&&(0,R.jsx)(xh,{instructions:u?.instructions??``,onEdit:()=>T(!0),onAck:re}),n===0&&j&&(0,R.jsx)(_h,{children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5 p-4 text-[15px]`,children:[(0,R.jsx)(A,{size:18,className:`animate-spin text-accent`}),` `,x(`Writing…`)]})}),t.map(e=>(0,R.jsx)(bh,{post:e,onDiscuss:()=>P(e),onInfo:()=>O(e)},e.id))]},e)),(0,R.jsxs)(`div`,{className:`space-y-4 px-0.5 pt-3`,children:[h&&(0,R.jsx)(Th,{data:h,name:b,onSettings:()=>a(`you`),onGoals:()=>a(`goals`)}),_?.configured&&(0,R.jsx)(Eh,{data:_,onAsk:()=>n(`main`)}),c&&c.length===0&&(!u||u.posts.length===0)&&(0,R.jsxs)(`div`,{className:`py-10 text-center text-muted text-[14px] px-6`,children:[(0,R.jsx)(Rt,{size:28,className:`mx-auto mb-2 opacity-60`}),x(`Nothing yet. Once {name} works on a goal in the background or needs your approval, it shows up here.`,{name:b})]}),c&&c.length>0&&(0,R.jsx)(`div`,{className:`px-1 pt-1 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:x(`While you were away`)}),C.map(([t,i])=>(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`div`,{className:`px-1 mb-1.5 text-[12px] uppercase tracking-wide text-muted font-semibold`,children:t}),(0,R.jsx)(`ul`,{className:`space-y-2`,children:i.map(t=>(0,R.jsx)(`li`,{children:(0,R.jsx)(Oh,{item:t,unseen:t.ts>e.feedSeenAt,onOpen:()=>{t.kind===`artifact`&&t.path?r(t.path):n(t.thread)}})},t.id))})]},t))]})]}),(0,R.jsx)(wh,{open:w,onClose:()=>T(!1),data:u,writing:j,onChange:p,onWriteNow:()=>void N()}),(0,R.jsx)(Op,{open:D!==null,onClose:()=>O(null),title:D?.title,children:D&&(0,R.jsxs)(`div`,{className:`space-y-3 px-1 pb-2`,children:[(0,R.jsx)(Ch,{label:x(`Post type`),value:yh(D.area)}),(0,R.jsx)(Ch,{label:x(`Written`),value:new Date(D.ts).toLocaleString(m(),{dateStyle:`medium`,timeStyle:`short`})}),(0,R.jsx)(`button`,{type:`button`,onClick:async()=>{let e=D.id;O(null);try{await M.deleteFeedPost(e),p(t=>t&&{...t,posts:t.posts.filter(t=>t.id!==e)})}catch(e){o(e.message)}},className:`w-full rounded-full bg-surface-2 py-2.5 text-[15px] font-medium text-rose-500`,children:x(`Delete this post`)})]})})]})}var fh=`nanomuse.feed.introAck`;function ph(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function mh(e){let t=new Map;for(let n of e){let e=new Date(n.ts),r=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`,i=t.get(r);i?i.push(n):t.set(r,[n])}return[...t.entries()]}function hh(e,t){let n=ph(),r=new Date;r.setDate(r.getDate()-1);let i=`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,`0`)}-${String(r.getDate()).padStart(2,`0`)}`,a=t.toLocaleDateString(m(),{weekday:`long`});if(e===n){let e=new Date().getHours(),t=_(e<12?`morning`:e<18?`afternoon`:`evening`);return _(`{weekday} {part}`,{weekday:a,part:t})}return e===i?_(`Yesterday`):`${a} · ${t.toLocaleDateString(m(),{month:`short`,day:`numeric`})}`}function gh({text:e}){return(0,R.jsx)(`h2`,{className:`px-1.5 pt-3.5 pb-2 text-[22px] font-bold leading-7`,children:e})}function _h({children:e,className:t}){return(0,R.jsx)(`div`,{className:i(`my-1.5 overflow-hidden rounded-[18px] bg-surface dark:border dark:border-border`,t),children:e})}var vh={planning:`🗓️`,research:`🔍`,goals:`🎯`,money:`💰`,health:`🌿`,home:`🏠`,learning:`📚`,people:`👥`,files:`📄`,fun:`🎈`};function yh(e){switch(e){case`planning`:return _(`Planning`);case`research`:return _(`Research`);case`goals`:return _(`Goals`);case`money`:return _(`Money`);case`health`:return _(`Health`);case`home`:return _(`Home`);case`learning`:return _(`Learning`);case`people`:return _(`People`);case`files`:return _(`Files`);case`fun`:return _(`Fun`);default:return _(`Note`)}}function bh({post:e,onDiscuss:t,onInfo:n}){let r=s();return(0,R.jsx)(_h,{children:(0,R.jsxs)(`article`,{className:`pl-3.5 pr-2.5 pt-3.5 pb-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-[22px] leading-none`,children:vh[e.area]??`📝`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`h3`,{className:`text-[16px] font-semibold leading-[22px]`,children:e.title}),(0,R.jsx)(`div`,{className:`md mt-1 text-[15px] leading-[22px] text-fg/85`,children:(0,R.jsx)(hf,{text:e.body})})]})]}),(0,R.jsxs)(`div`,{className:`mt-1.5 flex items-center`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-1.5 rounded-full px-2 py-2 text-[14px] hover:bg-surface-2`,children:[(0,R.jsx)(At,{size:22,strokeWidth:1.8}),` `,r(`Discuss`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:n,"aria-label":r(`About this post`),className:`ml-auto rounded-full p-2 hover:bg-surface-2`,children:(0,R.jsx)(F,{size:22,strokeWidth:1.8})})]})]})})}function xh({instructions:e,onEdit:t,onAck:n}){let r=s();return(0,R.jsxs)(_h,{children:[(0,R.jsxs)(`div`,{className:`px-4 py-3.5`,children:[(0,R.jsx)(`div`,{className:`text-[17px] font-semibold`,children:r(`About the feed`)}),(0,R.jsx)(`p`,{className:`mt-1 text-[13px] leading-[18px] text-muted`,children:r(`Short posts your agent writes for you from what it remembers: your memory files, the last week of diary, your goals. The sentence below steers every post from now on; edit it any time.`)})]}),(0,R.jsxs)(`div`,{className:`border-t border-border/70 px-4 py-3.5`,children:[(0,R.jsx)(`p`,{className:`text-[15px] leading-[22px]`,children:e||r(`Build me a feed about what I care about. Keep it short and direct, easy to skim, no clickbait.`)}),(0,R.jsxs)(`div`,{className:`mt-3.5 flex justify-end gap-2.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-full bg-surface-2 px-6 py-2.5 text-[15px] font-medium`,children:r(`Edit`)}),(0,R.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-full bg-accent px-6 py-2.5 text-[15px] font-semibold text-accent-fg`,children:r(`Got it`)})]})]})]})}function Sh({emoji:e,title:t,body:n}){return(0,R.jsx)(_h,{children:(0,R.jsxs)(`div`,{className:`flex items-start gap-3 p-3.5`,children:[(0,R.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-[22px] leading-none`,children:e}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[16px] font-semibold leading-[22px]`,children:t}),(0,R.jsx)(`p`,{className:`mt-1 text-[15px] leading-[22px] text-fg/85`,children:n})]})]})})}function Ch({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`flex items-start gap-3 text-[14.5px]`,children:[(0,R.jsx)(`span`,{className:`w-14 shrink-0 text-muted`,children:e}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:t})]})}function wh({open:e,onClose:t,data:n,writing:r,onChange:i,onWriteNow:a}){let{toast:o,state:c}=E(),l=s(),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!1);(0,L.useEffect)(()=>{e&&d(n?.instructions??``)},[e,n]);let m=async()=>{p(!0);try{i(await M.setFeedInstructions({instructions:u})),t()}catch(e){o(e.message)}finally{p(!1)}},h=async e=>{try{i(await M.setFeedInstructions(e))}catch(e){o(e.message)}},g=c.settings?.llm_ready!==!1;return(0,R.jsx)(Op,{open:e,onClose:t,title:l(`Feed`),children:(0,R.jsxs)(`div`,{className:`space-y-3 px-1 pb-2`,children:[(0,R.jsx)(`p`,{className:`text-[13px] leading-[18px] text-muted`,children:l(`Your feed is driven by the instruction below. Any edit you make here applies to every post from now on.`)}),(0,R.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),rows:4,maxLength:2e3,placeholder:l(`Build me a feed about what I care about. Keep it short and direct, easy to skim, no clickbait.`),className:`w-full resize-none rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[15px] leading-snug outline-none focus:ring-2 focus:ring-accent/40`}),(0,R.jsxs)(`div`,{className:`space-y-2 rounded-2xl bg-surface-2 px-3.5 py-2.5`,children:[(0,R.jsx)(Pe,{label:l(`Write it every day`),hint:n?.daily===!1?void 0:l(`Daily at {time}`,{time:n?.time??`08:00`}),checked:n?.daily!==!1,onChange:e=>void h({daily:e}),disabled:!n}),n?.daily!==!1&&(0,R.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-[13px] text-muted`,children:[(0,R.jsx)(`span`,{children:l(`Time of day`)}),(0,R.jsx)(`input`,{type:`time`,value:n?.time??`08:00`,onChange:e=>e.target.value&&void h({time:e.target.value}),className:`rounded-lg bg-surface px-2 py-1 text-[13px] text-fg outline-none focus:ring-2 focus:ring-accent/40`})]}),!g&&(0,R.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:l(`Add a model first; the feed is written by your agent.`)})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:a,disabled:r||!n||!g,className:`flex w-full items-center justify-center gap-2 rounded-full bg-surface-2 py-2.5 text-[15px] font-medium disabled:opacity-60`,children:[r?(0,R.jsx)(A,{size:16,className:`animate-spin`}):(0,R.jsx)(nn,{size:16,className:`text-accent`}),l(r?`Writing…`:`Write it now`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(),disabled:f,className:`h-[46px] w-full rounded-full bg-accent text-[15px] font-semibold text-accent-fg disabled:opacity-60`,children:l(`Save`)})]})})}function Th({data:t,name:n,onSettings:r,onGoals:i}){let a=s(),o=t.queue[0],c=t.reminders.filter(e=>e.status===`active`&&!!e.next_at),l=c[0],d=c.length;return(0,R.jsxs)(`div`,{className:`rounded-3xl border border-border/70 bg-surface shadow-sm px-4 py-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] uppercase tracking-wide text-muted font-semibold`,children:[(0,R.jsx)(Xe,{size:13}),` `,a(`Next up`)]}),t.proactive?o?(0,R.jsxs)(`div`,{className:`mt-1.5 text-[14px] leading-snug`,children:[t.busy?a(`Working now`):t.quiet_until?a(`Quiet hours after {time}`,{time:u(t.quiet_until)}):t.next_pass_at?a(`Around {time}`,{time:u(t.next_pass_at)}):a(`Soon`),`: `,(0,R.jsx)(`span`,{className:`font-medium`,children:o.title}),o.next_step&&(0,R.jsxs)(`span`,{className:`text-muted`,children:[` · `,o.next_step]}),o.overdue&&(0,R.jsxs)(`span`,{className:`text-rose-500 font-medium`,children:[` · `,a(`overdue`)]}),t.queue.length>1&&(0,R.jsxs)(`span`,{className:`text-muted`,children:[` · `,a(`{n} more in line`,{n:t.queue.length-1})]})]}):(0,R.jsxs)(`div`,{className:`mt-1.5 text-[14px] leading-snug`,children:[a(`No goal has a next step to work on.`),` `,(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`text-accent font-medium`,children:a(`Add one`)})]}):(0,R.jsxs)(`div`,{className:`mt-1.5 text-[14px] leading-snug`,children:[a(`Background work is off. {name} only acts when you ask.`,{name:n}),` `,(0,R.jsx)(`button`,{type:`button`,onClick:r,className:`text-accent font-medium`,children:a(`Turn it on`)})]}),t.check_ins[0]&&(0,R.jsxs)(`div`,{className:`mt-1.5 text-[12.5px] text-muted`,children:[a(`Check-in on`),` `,(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.check_ins[0].title}),` `,e(t.check_ins[0].at),t.check_ins.length>1&&` · ${a(`{n} more`,{n:t.check_ins.length-1})}`]}),l&&(0,R.jsxs)(`div`,{className:`mt-1.5 text-[12.5px] text-muted`,children:[l.kind===`task`?a(`Routine`):a(`Reminder`),` `,(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:l.text}),` `,e(l.next_at),d>1&&` · ${a(`{n} more`,{n:d-1})}`]})]})}function Eh({data:e,onAsk:t}){let n=s(),r=t=>t.start.slice(0,10)<=e.today,a=e.events.filter(r),o=e.events.filter(e=>!r(e)),c=new Date,l=e=>!e.all_day&&new Date(e.end)e.error),d=a.every(l)&&o.length>0,f=d?o:a;return(0,R.jsxs)(`div`,{className:`rounded-3xl border border-border/70 bg-surface shadow-sm px-4 py-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] uppercase tracking-wide text-muted font-semibold`,children:[(0,R.jsx)(tt,{size:13}),` `,n(d?`Tomorrow`:`Today`),f.length>0&&(0,R.jsx)(`span`,{className:`ml-auto normal-case tracking-normal font-normal`,children:n(`{n} scheduled`,{n:f.length})})]}),f.length===0?(0,R.jsx)(`div`,{className:`mt-1.5 text-[14px] leading-snug text-muted`,children:n(`Nothing on the calendar today.`)}):(0,R.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:f.map(e=>(0,R.jsxs)(`li`,{className:i(`flex items-baseline gap-2.5 text-[14px] leading-snug`,!d&&l(e)&&`opacity-50`),children:[(0,R.jsx)(`span`,{className:`w-[86px] shrink-0 tabular-nums text-[12.5px] text-muted`,children:e.all_day?n(`all day`):`${e.start.slice(11,16)}–${e.end.slice(11,16)}`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.summary}),e.location&&(0,R.jsxs)(`span`,{className:`text-muted text-[12.5px]`,children:[` `,(0,R.jsx)(Dt,{size:11,className:`inline -mt-0.5`}),` `,e.location]})]})]},`${e.uid}-${e.start}`))}),u.length>0&&(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-rose-500`,children:n(`{name} could not be read`,{name:u.map(e=>e.name).join(`, `)})}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`mt-2 text-[12.5px] text-accent font-medium`,children:n(`Ask about your week`)})]})}function Dh(e){return e.replace(/```[\s\S]*?```/g,` `).replace(/^#{1,6}\s+/gm,``).replace(/(\*\*|__|`)/g,``).replace(/^\s*[-*+]\s+/gm,`• `).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).trim()}function Oh({item:n,unseen:r,onOpen:a}){let o=s(),c=n.kind===`approval`?(0,R.jsx)(Zt,{size:18}):n.kind===`question`?(0,R.jsx)(kt,{size:18}):n.kind===`artifact`?(0,R.jsx)(mt,{size:18}):n.quiet?(0,R.jsx)(Rt,{size:18}):n.title.startsWith(`New mail: `)?(0,R.jsx)(Et,{size:18}):n.title.startsWith(`Coming up: `)?(0,R.jsx)(et,{size:18}):n.title.startsWith(`Webhook: `)?(0,R.jsx)(_n,{size:18}):(0,R.jsx)(nn,{size:18}),l=n.kind===`approval`?`bg-amber-500/12 text-amber-600 dark:text-amber-300`:n.kind===`question`?`bg-accent/12 text-accent`:`bg-surface-2 text-muted`;return n.quiet?(0,R.jsxs)(`button`,{type:`button`,onClick:a,className:`w-full text-left px-2 py-1.5 flex items-center gap-2 text-[12.5px] text-muted`,children:[(0,R.jsx)(Rt,{size:13,className:`shrink-0`}),(0,R.jsxs)(`span`,{className:`truncate`,children:[o(`{label}: nothing new`,{label:t(n.title.replace(/^Working on your goal: /,``))}),n.text?`: ${n.text}`:``]}),(0,R.jsx)(`span`,{className:`ml-auto shrink-0`,children:e(n.ts)})]}):(0,R.jsx)(`button`,{type:`button`,onClick:a,className:i(`w-full text-left rounded-3xl border bg-surface shadow-sm px-4 py-3 active:scale-[0.99] transition`,r?`border-accent/40`:`border-border/70`),children:(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:i(`rounded-2xl p-2 mt-0.5`,l),children:c}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`div`,{className:`font-semibold text-[14.5px] leading-snug truncate`,children:t(n.title)}),r&&(0,R.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-accent shrink-0`})]}),n.text&&(0,R.jsx)(`div`,{className:`mt-0.5 text-[13.5px] text-muted leading-snug line-clamp-3 whitespace-pre-wrap`,children:Dh(n.text)}),(0,R.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-[12px] text-muted`,children:[(0,R.jsx)(`span`,{children:e(n.ts)}),(0,R.jsx)(`span`,{children:`·`}),(0,R.jsx)(`span`,{className:`truncate`,children:n.thread===`main`?o(n.thread_title):n.thread_title}),(0,R.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-accent font-medium`,children:[n.kind===`artifact`?o(`Open`):n.kind===`approval`||n.kind===`question`?o(`Answer`):o(`Open chat`),(0,R.jsx)(qe,{size:13})]})]})]})]})})}function kh(e){let t=new Date,n=new Date(t);n.setDate(t.getDate()-1);let r=e=>{let r=new Date(e);return r.toDateString()===t.toDateString()?_(`Today`):r.toDateString()===n.toDateString()?_(`Yesterday`):r.toLocaleDateString(m(),{weekday:`long`,month:`short`,day:`numeric`})},i=new Map;for(let t of e){let e=r(t.ts);i.set(e,[...i.get(e)??[],t])}return[...i.entries()]}function Ah({children:e,className:t}){return(0,R.jsx)(`div`,{className:i(`mx-4 overflow-hidden rounded-2xl bg-surface dark:border dark:border-border`,t),children:e})}function jh({inset:e=52}){return(0,R.jsx)(`div`,{className:i(`border-t border-border/60`,e===52?`ml-[52px]`:`ml-4`)})}function Mh({icon:e,label:t,value:n,onClick:r,external:a=!1,trailing:o,chevron:s=!0}){let c=(0,R.jsxs)(R.Fragment,{children:[e&&(0,R.jsx)(`span`,{className:`shrink-0 text-fg`,children:e}),(0,R.jsx)(`span`,{className:i(`min-w-0 truncate text-[16px] leading-[21px]`,n?`max-w-[60%] shrink-0`:`flex-1`),children:t}),n&&(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate pl-3 text-right text-[14px] leading-[18px] text-muted`,children:n}),o??(s?a?(0,R.jsx)(Ae,{size:16,className:`shrink-0 text-muted/70`}):(0,R.jsx)(rt,{size:18,className:`shrink-0 text-muted/70`}):null)]}),l=`flex min-h-[54px] w-full items-center gap-3.5 px-4 py-2 text-left`;return r?(0,R.jsx)(`button`,{type:`button`,onClick:r,className:i(l,`hover:bg-surface-2/60`),children:c}):(0,R.jsx)(`div`,{className:l,children:c})}function Nh({icon:e,label:t,value:n,checked:r,disabled:a=!1,onChange:o}){return(0,R.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:a,onClick:()=>o(!r),className:i(`flex min-h-[54px] w-full items-center gap-3.5 px-4 py-2 text-left`,a?`opacity-60`:`hover:bg-surface-2/60`),children:[e&&(0,R.jsx)(`span`,{className:`shrink-0 text-fg`,children:e}),(0,R.jsx)(`span`,{className:i(`min-w-0 truncate text-[16px] leading-[21px]`,n?`max-w-[60%] shrink-0`:`flex-1`),children:t}),n&&(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate pl-3 text-right text-[14px] leading-[18px] text-muted`,children:n}),(0,R.jsx)(Ph,{checked:r})]})}function Ph({checked:e}){return(0,R.jsx)(`span`,{"aria-hidden":!0,className:i(`relative h-7 w-12 shrink-0 rounded-full transition`,e?`bg-accent`:`bg-surface-2 border border-border`),children:(0,R.jsx)(`span`,{className:i(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,e?`left-[22px]`:`left-0.5`)})})}function Fh({children:e,className:t}){return(0,R.jsx)(`p`,{className:i(`px-8 py-2 text-[13px] leading-[18px] text-muted`,t),children:e})}function Ih({children:e}){return(0,R.jsx)(`p`,{className:`px-8 pb-2 pt-[18px] text-[13px] leading-[18px] text-muted`,children:e})}var Lh=`https://nanomuse.cn/privacy/`;function Rh({me:e,onChanged:t,flush:n=!1}){let r=s(),{state:a,toast:o}=E(),c=!!a.hub?.account.signed_in,[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),p=e??l,m=async()=>{if(c&&!e)try{u(await M.cloudMe())}catch{}};(0,L.useEffect)(()=>{m()},[c,e]);let h=p?.contribute??{on:!1,samples:0},g=h.samples??0,_=h.privacy_url||`https://nanomuse.cn/privacy/`,v=async n=>{f(!0);try{await M.cloudContribute(n),o(r(n?`On. Turn it off here at any time.`:`Off. Nothing more is kept.`)),e?t?.():await m()}catch(e){o(e.message)}finally{f(!1)}},y=async()=>{if(window.confirm(r(`The kept conversations are removed from the server. This cannot be undone.`))){f(!0);try{let n=await M.cloudDeleteSamples();o(r(`{n} turns deleted`,{n:String(n.deleted)})),e?t?.():await m()}catch(e){o(e.message)}finally{f(!1)}}};return(0,R.jsxs)(`div`,{className:i(n&&`-mx-4`),children:[(0,R.jsx)(zh,{signedIn:c}),(0,R.jsx)(Ah,{children:(0,R.jsx)(Nh,{label:r(`Help improve nanoMuse's AI models`),checked:c&&h.on,disabled:d||!c||!p,onChange:e=>void v(e)})}),(0,R.jsxs)(Fh,{children:[r(`While this is on, the text of your chats with the nanoMuse Cloud models (what you wrote, what it answered and the tools it chose to call) is kept on the relay to train the community's own open model. Not your memory or SOUL (the system prompt), not what tools returned, not pictures, and never next to who you are. Your own API key never passes through the relay.`),` `,c?h.default_on!==void 0&&(h.default_on?r(`New accounts start with it on.`):r(`New accounts start with it off.`)):r(`Sign in to nanoMuse Cloud to use it.`),` `,c&&g>0&&r(`{n} turns kept so far.`,{n:String(g)}),` `,(0,R.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent underline-offset-2 hover:underline`,children:r(`Privacy policy`)})]}),c&&g>0&&(0,R.jsxs)(Ah,{className:`mt-3`,children:[(0,R.jsx)(Mh,{icon:d?(0,R.jsx)(A,{size:22,className:`animate-spin`}):(0,R.jsx)(fn,{size:22}),label:r(`Delete the kept conversations`),value:r(`{n} turns`,{n:String(g)}),onClick:()=>void y(),chevron:!1}),(0,R.jsx)(jh,{inset:16}),(0,R.jsx)(Fh,{className:`px-4 pb-2.5 pt-2`,children:r(`Removes every turn kept from this account, whether the switch is on or off now. Turning the switch off keeps what was kept until you delete it here.`)})]})]})}function zh({signedIn:e}){let t=s(),{toast:n}=E(),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(!1),c=r?.relay?.counts??{conversations:0,messages:0},l=e&&(c.conversations>0||c.messages>0),u=async()=>{try{i(await M.syncState())}catch{}};(0,L.useEffect)(()=>{u()},[e]);let d=async(e,t)=>{o(!0);try{i(await e()),n(t)}catch(e){n(e.message),await u()}finally{o(!1)}},f=e=>{(e||!l||window.confirm(t(`Off deletes the synced conversations from nanoMuse Cloud. The chats on each device stay.`)))&&d(()=>M.syncSetState(e),t(e?`On. Your devices show the same conversations from now on.`:`Off. Nothing is kept on nanoMuse Cloud any more.`))},p=()=>{window.confirm(t(`The synced conversations are removed from nanoMuse Cloud. The chats on each device stay. This cannot be undone.`))&&d(()=>M.syncDelete(),t(`Synced conversations deleted.`))},m=e=>{d(()=>M.syncSetSideChats(e),t(e?`On. This device's side chats go to the account; the other devices' are on their way.`:`Off. Side chats stay on this device from now on.`))},h=e&&!!r?.enabled;return(0,R.jsxs)(`div`,{className:`mb-6`,children:[(0,R.jsx)(Ah,{children:(0,R.jsx)(Nh,{label:t(`Sync conversations between my devices`),checked:h,disabled:a||!e||!r,onChange:f})}),(0,R.jsxs)(Fh,{children:[t(`The text of your chats is kept on nanoMuse Cloud so every device shows the same conversations. Files and images stay on the device they were made on.`),` `,e?r?.paused?t(`Paused: sign in again to continue.`):l&&t(`{c} chats, {m} messages kept so far.`,{c:String(c.conversations),m:String(c.messages)}):t(`Sign in to nanoMuse Cloud to use it.`)]}),r&&`side_chats`in r&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Ah,{className:`mt-3`,children:(0,R.jsx)(Nh,{label:t(`Also sync side chats`),checked:h&&!!r.side_chats,disabled:a||!h,onChange:m})}),(0,R.jsx)(Fh,{children:t(`Off: side chats stay on this device. On: this device's side chats go to the account and the other devices' side chats come here.`)})]}),l&&(0,R.jsxs)(Ah,{className:`mt-3`,children:[(0,R.jsx)(Mh,{icon:a?(0,R.jsx)(A,{size:22,className:`animate-spin`}):(0,R.jsx)(fn,{size:22}),label:t(`Delete synced conversations`),value:t(`{n} chats`,{n:String(c.conversations)}),onClick:p,chevron:!1}),(0,R.jsx)(jh,{inset:16}),(0,R.jsx)(Fh,{className:`px-4 pb-2.5 pt-2`,children:t(`Removes what nanoMuse Cloud stores for this account; the chats on each device stay, and the switch stays on. Deleting a chat on one device deletes it on all of them.`)})]})]})}var Bh=`nm.invite`;function Vh(){try{let e=new URLSearchParams(window.location.search).get(`invite`);if(e){let t=Hh(e);t&&localStorage.setItem(Bh,t)}return localStorage.getItem(Bh)??``}catch{return``}}function Hh(e){return e.toUpperCase().replace(/[^A-Z0-9]/g,``).slice(0,8)}function Uh(e){return/^\s*[+\d]/.test(e)?`tel`:`email`}function Wh({onSignedIn:e,useAsModel:t=!1,cta:n,autoFocus:r=!0}){let a=s(),o=(0,L.useId)(),c=Ce(),[l,u]=(0,L.useState)(`code`),[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(``),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(null),[C,w]=(0,L.useState)(``),[T,E]=(0,L.useState)(!1);(0,L.useEffect)(()=>{let e=Vh();e&&(w(e),E(!0))},[]);let D=async()=>{if(t){b(`model`);try{await M.cloudUseAsModel()}catch{}}await e()},O=async()=>{let e=d.trim();if(e){b(`code`),S(null);try{await M.cloudCode(e),v(!0)}catch(e){S(a(e.message))}finally{b(null)}}},k=async()=>{let e=d.trim();if(!(!e||p.trim().length<4)){b(`verify`),S(null);try{(await M.cloudVerify(e,p.trim(),C.trim())).created&&Vf(),m(``),v(!1);try{localStorage.removeItem(Bh)}catch{}await D()}catch(e){S(a(e.message))}finally{b(null)}}},ee=async()=>{let e=d.trim();if(e&&h){b(`login`),S(null);try{await M.cloudLogin(e,h),g(``),await D()}catch(e){S(a(e.message))}finally{b(null)}}},te=()=>void(l===`password`?ee():_?k():O()),j=n??a(t?`Sign in and use its model`:`Sign in`);return(0,R.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),te()},children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-1 rounded-2xl bg-surface-2/70 p-1 text-[13px] font-medium`,children:[(0,R.jsx)(Gh,{active:l===`code`,onClick:()=>u(`code`),icon:(0,R.jsx)(Mt,{size:14}),label:a(`With a code`)}),(0,R.jsx)(Gh,{active:l===`password`,onClick:()=>u(`password`),icon:(0,R.jsx)(xt,{size:14}),label:a(`With a password`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`${o}-id`,className:`text-[12px] text-muted`,children:se()?a(`Mainland China phone number or e-mail`):a(`E-mail (or a mainland China phone number)`)}),(0,R.jsx)(`input`,{id:`${o}-id`,value:d,onChange:e=>{f(e.target.value),v(!1)},inputMode:Uh(d),autoComplete:`username`,autoFocus:r,placeholder:a(`138 0000 0000 or you@example.com`),className:i(Ie,`mt-1`)}),l===`code`&&!_&&(!se()||oe(d))&&(0,R.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:a(`Text-message codes reach mainland-China numbers only. Use an e-mail address instead.`)})]}),l===`password`?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`${o}-password`,className:`text-[12px] text-muted`,children:a(`Password`)}),(0,R.jsx)(`input`,{id:`${o}-password`,type:`password`,value:h,onChange:e=>g(e.target.value),autoComplete:`current-password`,className:i(Ie,`mt-1`)}),(0,R.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:a(`No password yet? Use a code first; set one under Account.`)})]}):(0,R.jsxs)(R.Fragment,{children:[_&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`${o}-code`,className:`text-[12px] text-muted`,children:a(`The code you received`)}),(0,R.jsx)(`input`,{id:`${o}-code`,value:p,onChange:e=>m(e.target.value.replace(/\D/g,``).slice(0,8)),inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,autoFocus:!0,className:i(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`mt-1 tracking-[0.3em]`)})]}),T?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`${o}-invite`,className:`text-[12px] text-muted`,children:a(`Invite code (optional)`)}),(0,R.jsx)(`input`,{id:`${o}-invite`,value:C,onChange:e=>w(Hh(e.target.value)),autoComplete:`off`,placeholder:`ABCD2345`,className:i(Ie,`mt-1 tracking-[0.2em] uppercase`)}),(0,R.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:a(`A friend's code counts for a new account: you both get ¥{invite} more allowance.`,{invite:(c.invite_bonus_cny??5).toFixed(0)})})]}):(0,R.jsx)(`button`,{type:`button`,onClick:()=>E(!0),className:`text-[12px] text-muted underline-offset-2 hover:underline`,children:a(`Have an invite code?`)})]}),x&&(0,R.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:x}),(0,R.jsx)(`div`,{className:`flex gap-2`,children:l===`code`&&_?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,disabled:y!==null,onClick:()=>void O(),className:je,children:a(`Send again`)}),(0,R.jsxs)(`button`,{type:`submit`,disabled:y!==null||p.trim().length<4,className:i(Ne,`flex-1 py-3`),children:[y?(0,R.jsx)(A,{size:15,className:`animate-spin`}):null,` `,j]})]}):l===`code`?(0,R.jsxs)(`button`,{type:`submit`,disabled:y!==null||!d.trim(),className:i(Ne,`flex-1 py-3`),children:[y===`code`?(0,R.jsx)(A,{size:15,className:`animate-spin`}):null,` `,a(`Send me a code`)]}):(0,R.jsxs)(`button`,{type:`submit`,disabled:y!==null||!d.trim()||!h,className:i(Ne,`flex-1 py-3`),children:[y?(0,R.jsx)(A,{size:15,className:`animate-spin`}):null,` `,j]})})]})}function Gh({active:e,onClick:t,icon:n,label:r}){return(0,R.jsxs)(`button`,{type:`button`,onClick:t,"aria-pressed":e,className:i(`flex items-center justify-center gap-1.5 rounded-xl px-2 py-2 transition`,e?`bg-surface text-fg shadow-sm`:`text-muted hover:text-fg`),children:[n,` `,r]})}function Kh(){let{state:e,refreshSettings:t,refreshHub:n,toast:r,skipSignIn:i}=E(),a=s(),o=e.profile?.name??`nanoMuse`,c=(0,R.jsxs)(`ul`,{className:`grid grid-cols-2 gap-2 text-[12.5px] wide:grid-cols-1 wide:gap-1.5 wide:text-[13.5px]`,children:[(0,R.jsx)(qh,{icon:(0,R.jsx)(It,{size:15}),text:a(`Every device of yours, one nanoMuse`)}),(0,R.jsx)(qh,{icon:(0,R.jsx)(st,{size:15}),text:a(`A model with a free allowance, or your own key`)}),(0,R.jsx)(qh,{icon:(0,R.jsx)(vt,{size:15}),text:a(`It uses your phone and computers for you`)}),(0,R.jsx)(qh,{icon:(0,R.jsx)(Qt,{size:15}),text:a(`Keys in your vault; nothing you say is kept on the relay`)})]});return(0,R.jsxs)(`div`,{className:`relative mx-auto flex h-[100dvh] w-full max-w-[760px] flex-col overflow-hidden bg-bg sm:border-x sm:border-border wide:max-w-none wide:border-0`,children:[(0,R.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 h-[46vh] bg-[radial-gradient(ellipse_at_top,rgba(0,100,212,0.14),transparent_65%)] dark:bg-[radial-gradient(ellipse_at_top,rgba(23,147,255,0.2),transparent_65%)] wide:inset-y-0 wide:h-auto wide:bg-[radial-gradient(ellipse_at_left,rgba(0,100,212,0.12),transparent_60%)] wide:dark:bg-[radial-gradient(ellipse_at_left,rgba(23,147,255,0.16),transparent_60%)]`}),(0,R.jsx)(`div`,{className:`titlebar-room relative`}),(0,R.jsx)(`div`,{className:`relative flex-1 overflow-y-auto px-6 pb-8 wide:flex wide:items-center wide:px-12`,children:(0,R.jsxs)(`div`,{className:`mx-auto w-full wide:grid wide:max-w-[980px] wide:grid-cols-[1.1fr_1fr] wide:items-center wide:gap-16`,children:[(0,R.jsxs)(`div`,{className:`safe-top flex flex-col items-center pt-14 text-center wide:items-start wide:pt-0 wide:text-left`,children:[(0,R.jsx)(xn,{size:88,className:`drop-shadow-[0_20px_40px_rgba(0,100,212,0.28)]`}),(0,R.jsx)(`h1`,{className:`mt-6 text-[28px] font-bold tracking-tight wide:text-[34px]`,children:a(`Sign in to {name}`,{name:o})}),(0,R.jsx)(`p`,{className:`mt-2 max-w-sm text-[14.5px] leading-relaxed text-muted wide:max-w-md wide:text-[15.5px]`,children:a(`One free account. It is what lets your phone and computers work as one and brings a model to start with.`)}),(0,R.jsx)(`div`,{className:`mt-7 hidden w-full wide:block`,children:c}),(0,R.jsx)(Te,{compact:!0,className:`mt-6 hidden w-full wide:block`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`mt-8 rounded-[28px] border border-border/70 bg-surface p-5 shadow-sm wide:mt-0 wide:p-7`,children:(0,R.jsx)(Wh,{onSignedIn:async()=>{r(a(`Signed in to nanoMuse Cloud.`)),await Promise.all([t(),n()])}})}),(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`mt-4 w-full rounded-2xl border border-border/70 px-4 py-2.5 text-[13.5px] text-fg/80 hover:bg-surface-2`,"data-testid":`sign-in-skip`,children:a(`Use your own API key instead`)}),(0,R.jsx)(`p`,{className:`mt-2 text-center text-[11.5px] leading-relaxed text-muted`,children:a(`You can sign in later under Connections, for sync and your devices.`)}),(0,R.jsx)(`div`,{className:`mt-6 wide:hidden`,children:c}),(0,R.jsx)(Te,{compact:!0,className:`mt-6 wide:hidden`}),(0,R.jsxs)(`p`,{className:`mt-4 text-center text-[11.5px] leading-relaxed text-muted wide:mt-5`,children:[a(`The relay keeps an account id, a masked identifier, usage counts and your agent's name and look; what else, and what is yours to switch off, is in the`),` `,(0,R.jsx)(`a`,{href:Lh,target:`_blank`,rel:`noopener noreferrer`,className:`underline decoration-dotted underline-offset-2 hover:text-fg`,children:a(`privacy policy`)}),`.`]})]})]})})]})}function qh({icon:e,text:t}){return(0,R.jsxs)(`li`,{className:`flex items-start gap-2 rounded-2xl bg-surface-2/60 px-3 py-2.5 text-fg/80 wide:bg-transparent wide:px-0 wide:py-1`,children:[(0,R.jsx)(`span`,{className:`mt-0.5 text-accent`,children:e}),(0,R.jsx)(`span`,{className:`leading-snug`,children:t})]})}function Jh(e,t,n){return!e||!e.account.required||e.account.signed_in||t?.llm_ready?!1:!n}var Yh=`modulepreload`,Xh=function(e){return`/`+e},Zh={},Qh=function(e){return e.pathname.endsWith(`.css`)},$h=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Xh(t,n);let r=s(t);if(r.href in Zh)return;Zh[r.href]=!0;let i=Qh(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:Yh,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},eg=(0,L.lazy)(()=>$h(()=>import(`./AccountScreen-DvBFnisI.js`).then(e=>({default:e.AccountScreen})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),tg=(0,L.lazy)(()=>$h(()=>import(`./AvatarStudioScreen-C1Q0sV3j.js`).then(e=>({default:e.AvatarStudioScreen})),__vite__mapDeps([9,1,2,3,4,10,8,11]))),ng=(0,L.lazy)(()=>$h(()=>import(`./ChannelsScreen-Bt6eBqvc.js`).then(e=>({default:e.ChannelsScreen})),__vite__mapDeps([12,1,3,4,10,8]))),rg=(0,L.lazy)(()=>$h(()=>import(`./CodingScreen-CTT5Jjn2.js`).then(e=>({default:e.CodingScreen})),__vite__mapDeps([13,1,4,10,8]))),ig=(0,L.lazy)(()=>$h(()=>import(`./ConnectionsScreen-0U0bXAf7.js`).then(e=>({default:e.ConnectionsScreen})),__vite__mapDeps([14,1,2,3,4,5,7,15,10,8,16]))),ag=(0,L.lazy)(()=>$h(()=>import(`./DevicesScreen-P67eLmyB.js`).then(e=>({default:e.DevicesScreen})),__vite__mapDeps([17,1,3,4,10,8,16]))),og=(0,L.lazy)(()=>$h(()=>import(`./GoalsScreen-BGb02qG6.js`).then(e=>({default:e.GoalsScreen})),__vite__mapDeps([18,1,2,3,4]))),sg=(0,L.lazy)(()=>$h(()=>import(`./IdeasScreen-BVCFCRSV.js`).then(e=>({default:e.IdeasScreen})),__vite__mapDeps([19,1,10]))),cg=(0,L.lazy)(()=>$h(()=>import(`./LibraryScreen-U8NV3qaf.js`).then(e=>({default:e.LibraryScreen})),__vite__mapDeps([20,1]))),lg=(0,L.lazy)(()=>$h(()=>import(`./MemoryScreen-B5a6LPAu.js`).then(e=>({default:e.MemoryScreen})),__vite__mapDeps([21,1,8]))),ug=(0,L.lazy)(()=>$h(()=>import(`./Onboarding-rP8qAahh.js`).then(e=>({default:e.Onboarding})),__vite__mapDeps([22,1,2,3,4,23,11,14,5,7,15,10,8,16]))),dg=(0,L.lazy)(()=>$h(()=>import(`./SettingsScreen-DoXURXet.js`).then(e=>({default:e.SettingsScreen})),__vite__mapDeps([24,1,2,3,4,5,6,15,23,11,8]))),fg=(0,L.lazy)(()=>$h(()=>import(`./SkillsScreen-DZP-6db6.js`).then(e=>({default:e.SkillsScreen})),__vite__mapDeps([25,1,8])));function pg(){return(0,R.jsx)(`div`,{className:`flex h-full min-h-[40vh] items-center justify-center text-muted`,children:(0,R.jsx)(A,{className:`animate-spin`,size:20})})}var mg=e=>({size:26,strokeWidth:e?2:1.7,fill:e?`currentColor`:`none`,fillOpacity:e?.18:0}),hg=[{id:`chat`,label:`Chat`,icon:e=>(0,R.jsx)(At,{...mg(e)})},{id:`feed`,label:`Feed`,icon:e=>(0,R.jsx)(Bt,{...mg(e)})},{id:`ideas`,label:`Ideas`,icon:e=>(0,R.jsx)(Ct,{...mg(e)})},{id:`goals`,label:`Goals`,icon:e=>(0,R.jsx)(rn,{...mg(e)})},{id:`library`,label:`Library`,icon:e=>(0,R.jsx)(St,{...mg(e)})}];function gg(){let{state:e,setTab:t,openFile:n}=E(),r=Wf(),a=s();(0,L.useEffect)(()=>{let t=e.profile?.name?.trim();document.title=t&&t.toLowerCase()!==`nanomuse`?`${t} · nanoMuse`:`nanoMuse`},[e.profile?.name]),(0,L.useEffect)(()=>{let e=Sn()?.onQuickChat?.(()=>{t(`chat`),requestAnimationFrame(()=>window.dispatchEvent(new Event(`nanomuse:quick-chat`)))});return()=>{typeof e==`function`&&e()}},[t]),(0,L.useEffect)(()=>{let e=()=>{let e=window.location.hash.slice(1);(e&&hg.some(t=>t.id===e)||e===`devices`||e===`you`||e===`memory`||e===`connections`||e===`channels`||e===`skills`||e===`account`||e===`coding`||e===`avatar`)&&t(e)};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[t]);let o=r&&e.hub?.account.signed_in?(0,R.jsx)(Gf,{}):null,c=e.lite&&e.settings!==null&&!e.settings.onboarded;if((0,L.useEffect)(()=>{c&&M.onboarded(!0).catch(()=>void 0)},[c]),e.authError)return(0,R.jsx)(vg,{});if(!e.loaded)return(0,R.jsx)(_g,{error:e.error});if(Jh(e.hub,e.settings,e.signInSkipped))return(0,R.jsx)(Kh,{});if(!e.lite&&e.settings&&!e.settings.onboarded&&!e.onboardingDismissed&&!e.threads.some(e=>e.events>0))return(0,R.jsxs)(L.Suspense,{fallback:(0,R.jsx)(pg,{}),children:[(0,R.jsx)(ug,{}),o]});let l=e.pendingApprovals.length,u=e.goals.filter(e=>e.proposal&&e.status!==`cancelled`).length,d=e.pendingApprovals.filter(t=>t.ts>e.feedSeenAt).length;return(0,R.jsxs)(`div`,{className:i(`mx-auto flex h-[100dvh] max-w-[760px] flex-col bg-bg sm:border-x sm:border-border`,!e.lite&&`wide:max-w-none wide:flex-row wide:border-x-0`),children:[!e.lite&&(0,R.jsx)(`div`,{className:`hidden wide:block wide:h-full`,children:(0,R.jsx)(uh,{})}),(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[e.gone&&(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-2 bg-surface-2 text-muted text-[12.5px] py-1`,children:[(0,R.jsx)(vn,{size:14}),` `,a(e.lite?`This demo has ended.`:`This nanoMuse has stopped. Reload the page once it is running again.`)]}),!e.gone&&!e.connected&&e.loaded&&(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-2 bg-amber-500/15 text-amber-700 dark:text-amber-300 text-[12.5px] py-1`,children:[(0,R.jsx)(vn,{size:14}),` `,a(`Reconnecting to your nanoMuse…`)]}),!e.lite&&(0,R.jsx)(En,{}),(0,R.jsx)(`main`,{className:`mx-auto min-h-0 w-full flex-1 wide:max-w-[900px]`,children:(0,R.jsxs)(L.Suspense,{fallback:(0,R.jsx)(pg,{}),children:[e.tab===`chat`&&(0,R.jsx)(Wm,{}),e.tab===`feed`&&(0,R.jsx)(dh,{}),e.tab===`ideas`&&(0,R.jsx)(sg,{}),e.tab===`goals`&&(0,R.jsx)(og,{}),e.tab===`library`&&(0,R.jsx)(cg,{}),e.tab===`memory`&&(0,R.jsx)(lg,{}),e.tab===`skills`&&(0,R.jsx)(fg,{}),e.tab===`connections`&&(0,R.jsx)(ig,{}),e.tab===`channels`&&(0,R.jsx)(ng,{}),e.tab===`devices`&&(0,R.jsx)(ag,{}),e.tab===`you`&&(0,R.jsx)(dg,{}),e.tab===`account`&&(0,R.jsx)(eg,{}),e.tab===`coding`&&(0,R.jsx)(rg,{}),e.tab===`avatar`&&(0,R.jsx)(tg,{})]})}),(0,R.jsx)(`nav`,{className:i(`safe-bottom shrink-0 bg-bg`,!e.lite&&`wide:hidden`),children:(0,R.jsx)(`ul`,{className:`flex h-14 items-center justify-evenly`,children:hg.map(n=>{let r=e.tab===n.id,o=n.id===`chat`?l:n.id===`feed`?d:n.id===`goals`?u:0;return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-label":a(n.label),"aria-current":r?`page`:void 0,className:i(`relative flex h-12 w-12 items-center justify-center rounded-full transition`,r?`text-fg`:`text-fg/70 hover:text-fg`),children:[n.icon(r),o>0&&(0,R.jsx)(`span`,{className:`absolute right-1 top-1 flex h-[17px] min-w-[17px] items-center justify-center rounded-full bg-rose-500 px-1 text-[10px] font-bold text-white`,children:o})]})},n.id)})})})]}),(0,R.jsx)(kn,{}),(0,R.jsx)(gf,{path:e.viewer,onClose:()=>n(null)}),o,e.toast&&(0,R.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-24 z-[70] flex justify-center px-4`,children:(0,R.jsx)(`div`,{className:`rise rounded-2xl bg-fg text-bg px-4 py-2 text-[13.5px] shadow-lg max-w-sm text-center`,children:e.toast})})]})}function _g({error:e}){let t=s();return(0,R.jsxs)(`div`,{className:`mx-auto flex h-[100dvh] max-w-sm flex-col items-center justify-center px-6 text-center`,children:[(0,R.jsx)(xn,{size:72}),e?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`mt-6 text-[15px] font-medium`,children:t(`Could not reach your nanoMuse.`)}),(0,R.jsx)(`p`,{className:`mt-1.5 text-[13px] text-muted`,children:t(e)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`mt-5 rounded-full bg-fg px-5 py-2 text-[14px] font-medium text-bg`,children:t(`Try again`)})]}):(0,R.jsxs)(`p`,{className:`mt-6 flex items-center gap-2 text-[14px] text-muted`,children:[(0,R.jsx)(A,{className:`animate-spin`,size:16}),` `,t(`Connecting to your nanoMuse…`)]})]})}function vg(){let[e,t]=(0,L.useState)(``),n=s();return(0,R.jsxs)(`div`,{className:`mx-auto flex h-[100dvh] max-w-md flex-col items-center justify-center px-6 text-center`,children:[(0,R.jsx)(xn,{size:88}),(0,R.jsx)(`h1`,{className:`mt-4 text-[22px] font-bold`,children:n(`Connect to your nanoMuse`)}),(0,R.jsxs)(`p`,{className:`mt-2 text-[14px] text-muted`,children:[n(`This app talks to the nanoMuse server you run yourself. Scan the QR code printed by`),` `,(0,R.jsx)(`code`,{className:`rounded bg-surface-2 px-1`,children:`nanomuse serve`}),n(`, or paste the access token below.`)]}),(0,R.jsxs)(`form`,{className:`mt-5 w-full flex gap-2`,onSubmit:t=>{t.preventDefault(),e.trim()&&(g(e.trim()),window.location.reload())},children:[(0,R.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),"aria-label":n(`Access token`),placeholder:n(`Access token`),className:`flex-1 rounded-2xl bg-surface-2 px-4 py-2.5 text-[15px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,R.jsx)(`button`,{type:`submit`,className:`rounded-2xl bg-accent text-accent-fg px-4 font-medium`,children:n(`Connect`)})]})]})}a(),ee(),wn(),bn.createRoot(document.getElementById(`root`)).render((0,R.jsx)(L.StrictMode,{children:(0,R.jsx)(T,{children:(0,R.jsx)(gg,{})})}));export{Ut as $,Ff as A,gn as B,Jp as C,Ze as Ct,rp as D,Ke as Dt,ip as E,qe as Et,hf as F,tn as G,sn as H,Mn as I,Xt as J,Qt as K,Sn as L,Nf as M,Pf as N,Zf as O,Af as P,Gt as Q,Cn as R,tm as S,Qe as St,op as T,Je as Tt,on as U,fn as V,nn as W,qt as X,Jt as Y,I as Z,nm as _,ct as _t,Ah as a,Nt as at,rm as b,rt as bt,Ih as c,Tt as ct,Um as d,F as dt,Ht as et,Em as f,vt as ft,Xp as g,ut as gt,Qp as h,pt as ht,Fh as i,It as it,jf as j,$f as k,Nh as l,wt as lt,Yp as m,mt,Rh as n,Rt as nt,jh as o,At as ot,Zp as p,gt as pt,Zt as q,Lh as r,Lt as rt,Mh as s,Et as st,Wh as t,Vt as tt,Vm as u,xt as ut,im as v,st as vt,Op as w,Xe as wt,$p as x,tt as xt,em as y,at as yt,yn as z};
\ No newline at end of file
+`).replace(/\\([,;\\])/g,`$1`),a=(e,t)=>{if(/VALUE=DATE(?![-])/i.test(t)||/^\d{8}$/.test(e)){let t=/^(\d{4})(\d{2})(\d{2})/.exec(e);return{at:t?new Date(+t[1],t[2]-1,+t[3]):null,allDay:!0}}let n=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})?(Z?)$/.exec(e);if(!n)return{at:null,allDay:!1};let r=[+n[1],n[2]-1,+n[3],+n[4],+n[5],+(n[6]??0)];return{at:n[7]?new Date(Date.UTC(...r)):new Date(...r),allDay:!1}};for(let e of t)if(e===`BEGIN:VEVENT`)r={summary:``,location:``,description:``,start:null,end:null,allDay:!1};else if(e===`END:VEVENT`&&r)n.push(r),r=null;else if(r){let t=e.indexOf(`:`);if(t<0)continue;let[n,...o]=e.slice(0,t).split(`;`),s=e.slice(t+1),c=o.join(`;`);if(n===`SUMMARY`)r.summary=i(s);else if(n===`LOCATION`)r.location=i(s);else if(n===`DESCRIPTION`)r.description=i(s);else if(n===`DTSTART`){let e=a(s,c);r.start=e.at,r.allDay=e.allDay}else n===`DTEND`&&(r.end=a(s,c).at)}return n}function Sf(e){if(!e.start)return``;let t=m(),n=e=>e.toLocaleDateString(t,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),r=e=>e.toLocaleTimeString(t,{hour:`numeric`,minute:`2-digit`});if(e.allDay){let t=e.end?new Date(e.end.getTime()-864e5):e.start;return t>e.start?`${n(e.start)} – ${n(t)}`:`${n(e.start)} · ${_(`all day`)}`}return e.end?e.start.toDateString()===e.end.toDateString()?`${n(e.start)} ${r(e.start)}–${r(e.end)}`:`${n(e.start)} ${r(e.start)} – ${n(e.end)} ${r(e.end)}`:`${n(e.start)} ${r(e.start)}`}function Cf({path:e,kind:t}){let{text:n,error:r}=vf(e);return r?(0,R.jsx)(Ef,{error:r}):n===null?(0,R.jsx)(Tf,{}):t===`text`&&/\.md$/i.test(e)?(0,R.jsx)(`div`,{className:`mx-auto max-w-[720px] px-5 py-4`,children:(0,R.jsx)(hf,{text:n})}):t===`data`&&/\.csv$/i.test(e)?(0,R.jsx)(wf,{text:n}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-words px-4 py-3 font-mono text-[12.5px] leading-relaxed`,children:n})}function wf({text:e}){let t=s(),n=e.split(/\r?\n/).filter(e=>e.trim()).slice(0,500).map(e=>e.split(`,`));if(!n.length)return(0,R.jsx)(`div`,{className:`p-6 text-muted text-center`,children:t(`Empty file.`)});let[r,...i]=n;return(0,R.jsx)(`div`,{className:`overflow-auto p-3`,children:(0,R.jsxs)(`table`,{className:`min-w-full text-[13px] border-separate border-spacing-0`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsx)(`tr`,{children:r.map((e,t)=>(0,R.jsx)(`th`,{className:`sticky top-0 bg-surface-2 text-left font-semibold px-3 py-2 border-b border-border whitespace-nowrap`,children:e},t))})}),(0,R.jsx)(`tbody`,{children:i.map((e,t)=>(0,R.jsx)(`tr`,{className:`odd:bg-surface`,children:e.map((e,t)=>(0,R.jsx)(`td`,{className:`px-3 py-1.5 border-b border-border/60 whitespace-nowrap`,children:e},t))},t))})]})})}function Tf(){return(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted`,children:(0,R.jsx)(A,{className:`animate-spin`,size:22})})}function Ef({error:e}){let t=s();return(0,R.jsx)(`div`,{className:`p-8 text-center text-rose-600 dark:text-rose-300 text-[14px]`,children:t(`Could not load the file: {error}`,{error:e})})}var Df=`OpenAI's terms cover using a ChatGPT plan inside OpenAI's own Codex; other apps have had this access cut off before (OpenCode, January 2026). If it stops working, an API key does.`,Of=2e3,kf=6e5;function Af({compact:e,onChanged:t}){let n=s(),{toast:r}=E(),[a,o]=(0,L.useState)(null),[c,l]=(0,L.useState)(`unknown`),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(!0),[g,_]=(0,L.useState)(``),[v,y]=(0,L.useState)(null),b=(0,L.useRef)(0),x=(0,L.useCallback)(async()=>{try{let e=await M.chatgptStatus();return o(e),l(`yes`),e}catch(e){return/not found/i.test(e.message)?l(`no`):y(e.message),null}},[]);(0,L.useEffect)(()=>{x().then(e=>{e?.pending&&e.url&&(b.current=Date.now(),h(e.port_bound!==!1),p(e.url))})},[x]),(0,L.useEffect)(()=>{if(!f)return;let e=setInterval(()=>{x().then(e=>{e?.signed_in?(p(null),Ee(),r(n(`Signed in with {label}.`,{label:e.label||`ChatGPT`})),t?.()):e&&e.pending===!1&&e.error?(p(null),y(n(e.error))):Date.now()-b.current>kf&&(p(null),y(n(`The sign-in did not finish in ten minutes. Try again.`)))})},Of);return()=>clearInterval(e)},[f,x,t,r,n]);let S=async()=>{d(`login`),y(null);try{let e=await M.chatgptLogin();b.current=Date.now(),h(e.port_bound!==!1),_(``),p(e.url),window.open(e.url,`_blank`,`noopener`)}catch(e){/not found/i.test(e.message)?l(`no`):y(e.message)}finally{d(null)}},C=async()=>{let e=g.trim();if(e){d(`paste`),y(null);try{await M.chatgptCallback(e),_(``)}catch(e){let t=e.message;/state/i.test(t)?y(n(`That address belongs to another sign-in attempt. Open the page again and paste the address it ends on.`)):/no sign-in|409/i.test(t)?(p(null),y(n(`The sign-in did not finish in ten minutes. Try again.`))):y(t)}finally{d(null)}}},w=async()=>{d(`use`),y(null);try{await M.setLLM({provider:`chatgpt`,model:a?.models?.[0]??``,base_url:``,api_key:``}),Ee(),r(n(`ChatGPT answers the chat now.`)),t?.()}catch(e){y(e.message)}finally{d(null)}},T=async()=>{d(`logout`),y(null);try{await M.chatgptLogout(),Ee(),await x(),t?.()}catch(e){y(e.message)}finally{d(null)}},D=n(`Covers chat and the hands. Pictures and clips are not part of it; those need a provider with image or video models.`);return(0,R.jsxs)(`div`,{className:i(`space-y-2`,!e&&`rounded-2xl bg-surface-2/60 p-3`),children:[!e&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium`,children:[(0,R.jsx)(Mt,{size:15,className:`text-accent`}),` `,n(`Sign in with ChatGPT`)]}),c===`no`?(0,R.jsxs)(`p`,{className:`text-[12.5px] text-muted`,children:[n(`This nanoMuse has no sign-in route yet. In a terminal on this computer, run`),` `,(0,R.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5 text-[12px]`,children:`nanomuse chatgpt login`}),` `,n(`and reload this page.`)]}):a?.signed_in?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`text-[12.5px]`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:n(`Signed in with {label}.`,{label:a.label||`ChatGPT`})}),` `,(0,R.jsx)(`span`,{className:`text-muted`,children:D})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:u!==null,onClick:()=>void w(),className:i(Ne,`inline-flex items-center gap-1.5 py-2`),children:[u===`use`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(Mt,{size:14}),` `,n(`Use it for the chat`)]}),(0,R.jsxs)(`button`,{type:`button`,disabled:u!==null,onClick:()=>void T(),className:i(je,`inline-flex items-center gap-1.5`),children:[u===`logout`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(Tt,{size:14}),` `,n(`Sign out of ChatGPT`)]})]})]}):f?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`p`,{className:`flex items-start gap-2 text-[12.5px] text-muted`,children:[(0,R.jsx)(A,{size:14,className:`mt-0.5 shrink-0 animate-spin`}),(0,R.jsx)(`span`,{children:n(m?`A page from OpenAI opened in a new tab. Sign in there; this card follows on its own.`:`A page from OpenAI opened in a new tab. Sign in there; when the browser ends on an address that will not load, paste that address below.`)})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Ae,{size:14}),` `,n(`Open the page again`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(null),className:je,children:n(`Cancel`)})]}),(0,R.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,R.jsx)(`input`,{type:`url`,value:g,onChange:e=>_(e.target.value),placeholder:`http://localhost:1455/auth/callback?code=…`,"aria-label":n(`The address the browser ended on`),className:`min-w-0 flex-1 rounded-lg border border-border bg-surface px-2 py-1.5 text-[12.5px]`}),(0,R.jsxs)(`button`,{type:`submit`,disabled:u!==null||!g.trim(),className:i(je,`inline-flex items-center gap-1.5`),children:[u===`paste`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):null,` `,n(`Use this address`)]})]}),!m&&(0,R.jsx)(`p`,{className:`text-[11.5px] text-muted`,children:n(`This nanoMuse runs where the browser cannot reach port 1455, so it cannot pick the sign-in up by itself.`)})]}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:D}),(0,R.jsxs)(`button`,{type:`button`,disabled:u!==null||c===`unknown`,onClick:()=>void S(),className:i(Ne,`inline-flex items-center gap-1.5 py-2`),children:[u===`login`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(wt,{size:14}),` `,n(`Sign in with ChatGPT`)]})]}),(0,R.jsx)(`p`,{className:`text-[11.5px] leading-snug text-muted`,children:n(Df)}),v&&(0,R.jsx)(`p`,{className:`text-[12px] text-rose-600 dark:text-rose-300`,children:v})]})}var jf=xe,Mf=`nm.connections.preset`;function Nf(e,t=_e().preset){try{sessionStorage.setItem(Mf,t)}catch{}e(`connections`)}function Pf(){try{let e=sessionStorage.getItem(Mf);return e&&sessionStorage.removeItem(Mf),e}catch{return null}}function Ff({info:e,exhausted:t,compact:n}){let r=s(),{toast:a,setTab:o,state:l}=E(),u=l.hub?.account,d=_e(u),f=ae(u),p=c(),m=e.invite_bonus_cny??5,h=e.own_key_docs||e.guidance?.docs||jf,g=e.invite_url||``,[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(!1),x=(e.guidance?.providers??de(f)).filter(e=>e.id!==d.id).map(e=>({id:e.id,name:De(e,p),keyUrl:e.key_url,covers:`covers`in e?e.covers:e.capabilities})),S=Oe().map(e=>e.name),C=async e=>{try{await navigator.clipboard.writeText(e),a(r(`Copied`))}catch{a(e)}},w=async()=>{let e=r(`Try nanoMuse with me, a fully open-source personal agent, free to use. Sign up with my link: {link}`,{link:g}),t=navigator;if(t.share)try{await t.share({text:e});return}catch{}await C(e)},T=Ce(),[D,O]=me(`exhausted`,t),k=ve(be(r,`exhausted`)),ee=t?r(`The free allowance is used up.`):r(`Nearly used up: ¥{left} of ¥{grant} left.`,{left:(e.left??0).toFixed(2),grant:(e.grant??0).toFixed(0)});return(0,R.jsxs)(`div`,{className:i(`space-y-2.5`,!n&&`pt-1`),children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:i(`font-semibold`,n?`text-[13.5px]`:`text-[15px]`),children:ee}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[12.5px] text-muted`,children:r(`Three ways on; your sign-in and your devices keep working whichever you pick.`)})]}),(0,R.jsxs)(If,{icon:(0,R.jsx)(xt,{size:16}),tone:`bg-accent/12 text-accent`,title:r(`Use your own model key`),children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:ie(r,u)}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>Nf(o,d.preset),className:i(Ne,`inline-flex items-center gap-1.5 py-2`),children:[(0,R.jsx)(xt,{size:14}),` `,r(`Set it up`)]}),(0,R.jsxs)(`a`,{href:d.keyUrl,target:`_blank`,rel:`noopener noreferrer`,className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Ae,{size:14}),` `,r(`Get a key from {vendor}`,{vendor:d.label})]}),(0,R.jsxs)(`a`,{href:h,target:`_blank`,rel:`noopener noreferrer`,className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Ae,{size:14}),` `,r(`Step-by-step guide`)]})]}),x.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>v(!_),className:`inline-flex items-center gap-1 text-[12px] text-muted`,children:[_?(0,R.jsx)(Le,{size:13}):(0,R.jsx)(Me,{size:13}),` `,r(`Other providers and what each key covers`)]}),_&&(0,R.jsx)(`ul`,{className:`mt-1.5 space-y-1 text-[12.5px]`,children:x.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-wrap items-baseline justify-between gap-x-3`,children:[(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.name}),` `,(0,R.jsxs)(`span`,{className:`text-muted`,children:[`· `,he(r,e.covers)]})]}),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>Nf(o,pe(e.id)),className:`text-accent`,children:r(`Set it up`)}),(0,R.jsxs)(`a`,{href:e.keyUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-accent`,children:[r(`Get a key`),` `,(0,R.jsx)(Ae,{size:11})]})]})]},e.id))})]})]}),(0,R.jsxs)(If,{icon:(0,R.jsx)(wt,{size:16}),tone:`bg-emerald-500/12 text-emerald-600 dark:text-emerald-300`,title:r(`Sign in with a plan you already pay for`),children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:r(`{plans}: the plan's models answer here, no key to make. ChatGPT works on every device, the others on the phones. A ChatGPT sign-in covers chat and the hands; pictures and clips still want a key.`,{plans:S.join(r(`, `))})}),y?(0,R.jsx)(Af,{compact:!0,onChanged:()=>b(!1)}):(0,R.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(wt,{size:14}),` `,r(`Sign in with ChatGPT`)]})]}),(0,R.jsx)(If,{icon:(0,R.jsx)(hn,{size:16}),tone:`bg-violet-500/12 text-violet-600 dark:text-violet-300`,title:r(`Invite a friend: +¥{bonus} for you and +¥{bonus} for them, for each new person who signs up with your link.`,{bonus:m.toFixed(0)}),children:g?(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void w(),className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Xt,{size:14}),` `,r(`Share the link`)]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void C(g),className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(ut,{size:14}),` `,r(`Copy the link`)]})]}):(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(`account`),className:i(je,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Xt,{size:14}),` `,r(`Your invite link is under Account`)]})}),t&&D&&(0,R.jsxs)(If,{icon:(0,R.jsx)(ce,{size:16}),tone:`bg-amber-400/15 text-amber-600 dark:text-amber-300`,title:k,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>fe(T.repo_url),className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(ce,{size:14}),` `,r(`Star on GitHub`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{ge(),O(!1)},className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:r(`I already starred`)})]})]})}function If({icon:e,tone:t,title:n,children:r}){return(0,R.jsxs)(`div`,{className:`flex gap-3 rounded-2xl bg-surface-2/60 p-3`,children:[(0,R.jsx)(`span`,{className:i(`flex h-8 w-8 shrink-0 items-center justify-center rounded-xl`,t),children:e}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,R.jsx)(`div`,{className:`text-[13px] font-medium leading-snug`,children:n}),r]})]})}var Lf=`nm.cloud.warned_grant`;function Rf(){let e=s(),{state:t,setTab:n}=E(),[r,i]=(0,L.useState)(null),a=(0,L.useRef)(0),o=t.hub?.account,c=!!o?.signed_in&&!!o.is_model,l=t.finishedAt;if((0,L.useEffect)(()=>{if(!c||!l||r||Date.now()-a.current<6e4)return;a.current=Date.now();let e=!1;return M.cloudMe().then(t=>{if(e)return;let n=t.spend,r=n.grant??n.allowance_cny??0,a=n.left??null;if(n.unlimited||!n.warn||a===null||a<=0)return;let o=null;try{o=localStorage.getItem(Lf)}catch{}o!==String(r)&&i({left:a,grant:r,invite_url:t.invite?.url,invite_bonus_cny:n.invite_bonus_cny,invitee_bonus_cny:n.invitee_bonus_cny,own_key_docs:n.own_key_docs,guidance:n.guidance})}).catch(()=>{}),()=>{e=!0}},[c,l,r]),!r)return null;let u=()=>{try{localStorage.setItem(Lf,String(r.grant??0))}catch{}i(null)};return(0,R.jsxs)(`div`,{className:`rise mx-3 mb-1.5 flex items-start gap-2 rounded-2xl bg-amber-500/12 px-3 py-2 text-[12.5px] leading-snug text-amber-800 dark:text-amber-200`,children:[(0,R.jsx)(nn,{size:14,className:`mt-0.5 shrink-0`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e(`Nearly used up: ¥{left} of ¥{grant} left.`,{left:(r.left??0).toFixed(2),grant:(r.grant??0).toFixed(0)}),` `,e(`Invite a friend (+¥{invite} for each of you) or bring your own key; your sign-in keeps working either way.`,{invite:(r.invite_bonus_cny??5).toFixed(0)}),` `,(0,R.jsx)(`button`,{type:`button`,onClick:()=>{u(),n(`account`)},className:`font-semibold underline decoration-dotted underline-offset-2`,children:e(`See the ways`)})]}),(0,R.jsx)(`button`,{type:`button`,onClick:u,"aria-label":e(`Dismiss`),className:`shrink-0 rounded-full p-0.5 opacity-70 hover:opacity-100`,children:(0,R.jsx)(Fe,{size:14})})]})}var zf=`nm.cloud.first_sign_in`,Bf=`nm:first-sign-in`;function Vf(){try{sessionStorage.setItem(zf,`1`)}catch{}window.dispatchEvent(new Event(Bf))}function Hf(){try{sessionStorage.removeItem(zf)}catch{}window.dispatchEvent(new Event(Bf))}function Uf(){try{return sessionStorage.getItem(zf)===`1`}catch{return!1}}function Wf(){let[e,t]=(0,L.useState)(Uf);return(0,L.useEffect)(()=>{let e=()=>t(Uf());return window.addEventListener(Bf,e),()=>window.removeEventListener(Bf,e)},[]),e}function Gf(){let e=s(),{toast:t,refreshHub:n,setTab:r,state:a}=E(),o=_e(a.hub?.account),[c,l]=(0,L.useState)(`password`),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(null),v=async()=>{Hf(),await n().catch(()=>void 0)},y=async()=>{if(!(u.length<8||u!==f)){h(!0),_(null);try{await M.cloudPassword(u),t(e(`Password set.`)),d(``),p(``),l(`source`)}catch(t){_(e(t.message))}finally{h(!1)}}},b=async()=>{await v(),Nf(r,o.preset)},x=(0,L.useRef)(null);On(x,!0);let S=f.length>0&&f!==u;return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-end justify-center bg-black/40 backdrop-blur-[2px] sm:items-center`,role:`dialog`,"aria-modal":`true`,children:(0,R.jsxs)(`div`,{ref:x,className:`safe-bottom w-full max-w-[520px] rounded-t-[28px] bg-bg p-6 shadow-2xl sm:rounded-[28px]`,children:[(0,R.jsxs)(`div`,{className:`mb-4 flex gap-1`,children:[(0,R.jsx)(`span`,{className:i(`h-1.5 w-5 rounded-full bg-accent`)}),(0,R.jsx)(`span`,{className:i(`h-1.5 rounded-full transition-all`,c===`source`?`w-5 bg-accent`:`w-1.5 bg-border`)})]}),c===`password`?(0,R.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`span`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-accent/12 text-accent`,children:(0,R.jsx)(xt,{size:20})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-[20px] font-bold tracking-tight`,children:e(`Set a password`)}),(0,R.jsx)(`p`,{className:`mt-1 text-[13.5px] leading-relaxed text-muted`,children:e(`Your account is in. With a password, your phone and your other computers sign in at once, without waiting for a code. Optional; you can set one later under Account.`)})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`input`,{type:`password`,value:u,onChange:e=>d(e.target.value),autoComplete:`new-password`,autoFocus:!0,placeholder:e(`At least 8 characters`),className:Ie}),(0,R.jsx)(`input`,{type:`password`,value:f,onChange:e=>p(e.target.value),autoComplete:`new-password`,placeholder:e(`Once more`),className:i(Ie,S&&`border-rose-400`)}),S&&(0,R.jsx)(`p`,{className:`text-[12px] text-rose-600 dark:text-rose-300`,children:e(`The two do not match.`)})]}),g&&(0,R.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:g}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>l(`source`),className:je,children:e(`Skip`)}),(0,R.jsxs)(`button`,{type:`submit`,disabled:m||u.length<8||u!==f,className:i(Ne,`flex-1 py-3`),children:[m?(0,R.jsx)(A,{size:15,className:`animate-spin`}):null,` `,e(`Set the password`),` `,(0,R.jsx)(qe,{size:16})]})]})]}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`span`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-accent/12 text-accent`,children:(0,R.jsx)(ot,{size:20})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-[20px] font-bold tracking-tight`,children:e(`Which model answers?`)}),(0,R.jsx)(`p`,{className:`mt-1 text-[13.5px] leading-relaxed text-muted`,children:e(`Your account already brings one. You can add your own API key as well and switch at any time.`)})]})]}),(0,R.jsxs)(`ul`,{className:`space-y-2 text-[13px] leading-snug`,children:[(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2 px-3 py-2.5`,children:[(0,R.jsx)(ot,{size:16,className:`mt-0.5 shrink-0 text-accent`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e(`Use the nanoMuse Cloud model`)}),(0,R.jsx)(`span`,{className:`block text-muted`,children:e(`DeepSeek for the chat and Qwen for the hands, with a free allowance per account paid by the developer. Nothing to configure.`)})]})]}),(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2 px-3 py-2.5`,children:[(0,R.jsx)(xt,{size:16,className:`mt-0.5 shrink-0 text-accent`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e(`I have my own API key`)}),(0,R.jsx)(`span`,{className:`block text-muted`,children:o.preset===`qwen`?e(`Alibaba Cloud Bailian first (one key covers chat, the hands, pictures and clips), then DeepSeek, Kimi, Zhipu, OpenAI, OpenRouter and any OpenAI-compatible endpoint. The key stays on this device.`):e(`OpenRouter first (one account, one key, pay as you go), then OpenAI, Anthropic, Gemini, DeepSeek and any OpenAI-compatible endpoint. The key stays on this device.`)})]})]}),(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2 px-3 py-2.5`,children:[(0,R.jsx)(wt,{size:16,className:`mt-0.5 shrink-0 text-accent`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e(`Sign in with a plan you already pay for`)}),(0,R.jsx)(`span`,{className:`block text-muted`,children:e(`A ChatGPT plan signs in from Connections and answers the chat and the hands. Pictures and clips still want a key.`)})]})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void b(),className:je,children:e(`I have my own API key`)}),(0,R.jsxs)(`button`,{type:`button`,disabled:m,onClick:()=>void v(),className:i(Ne,`flex-1 py-3`),children:[e(`Use the nanoMuse Cloud model`),` `,(0,R.jsx)(qe,{size:16})]})]})]})]})})}var Kf=`nanomuse_devtools`;function qf(){try{return localStorage.getItem(Kf)===`1`}catch{return!1}}var Jf=qf(),Yf=new Set;function Xf(){return Jf}function Zf(e){Jf=e;try{localStorage.setItem(Kf,e?`1`:`0`)}catch{}Yf.forEach(e=>e())}function Qf(e){return Yf.add(e),()=>Yf.delete(e)}function $f(){return(0,L.useSyncExternalStore)(Qf,Xf,Xf)}function ep(e,t,n){if(!n.signedIn||n.chatOnCloud||n.deviceChat)return;let r=e[t];if(r?.type===`notice`&&r.level===`error`&&r.code&&r.code!==`allowance`&&!r.model_used)for(let n=t-1;n>=0;n--){let t=e[n];if(t?.type===`user`){let e=(t.files??[]).map(e=>e.path);return t.text||e.length>0?{text:t.text,files:e}:void 0}}}var tp=[`idle`,`working`,`waiting`,`happy`,`error`];function np({event:e,name:t=`nanoMuse`}){let n=s(),{toast:r}=E(),[a,o]=(0,L.useState)(null),c=e.cost??{},l=e.candidates??[null,null,null,null],u=e.moods??{},d=e.clips??{},f=async(e,t)=>{o(e);try{await t()}catch(e){r(e.message)}finally{o(null)}},p=e.stage===`estimate`||e.stage===`drawing`||e.stage===`choose`||e.stage===`posing`||e.stage===`animating`,m=c.clips?n(`{n} pictures and {c} clips`,{n:c.pictures??8,c:c.clips}):n(`{n} pictures`,{n:c.pictures??8}),g=(()=>{if(c.cloud===!1)return n(`{what}, made with your own key at your provider's prices.`,{what:m});if(c.error)return n(`The cost could not be checked: {error}`,{error:c.error});if(typeof c.cny!=`number`)return n(`Checking the cost…`);if(c.unlimited)return n(`About ¥{cny} for {what}; your account has no limit.`,{cny:c.cny.toFixed(2),what:m});let e=typeof c.left_cny==`number`?c.left_cny.toFixed(2):`?`;return c.affordable===!1?n(`About ¥{cny} for {what}, more than the ¥{left} left in your allowance.`,{cny:c.cny.toFixed(2),what:m,left:e}):n(`About ¥{cny} for {what}; ¥{left} left in your allowance.`,{cny:c.cny.toFixed(2),what:m,left:e})})();return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`div`,{className:i(`w-full max-w-[360px] overflow-hidden rounded-3xl rounded-tl-lg border bg-surface shadow-sm`,p?`border-accent/50`:`border-border/70`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 pt-3.5 pb-2`,children:[(0,R.jsx)(`div`,{className:i(`mt-0.5 rounded-full p-2`,p?`bg-accent/12 text-accent`:`bg-surface-2 text-fg/80`),children:(0,R.jsx)(nn,{size:18})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`text-[12.5px] font-medium text-muted`,children:[e.stage===`estimate`&&n(`A new look for {name}`,{name:t}),e.stage===`drawing`&&n(`Drawing four to choose from…`),e.stage===`choose`&&n(`Pick one: tap it, or say which`),e.stage===`posing`&&n(`Drawing the poses…`),e.stage===`animating`&&n(`The new look is on; making the clips…`),e.stage===`done`&&n(`The new look is on`),e.stage===`cancelled`&&n(`Not this time`),e.stage===`failed`&&n(`That did not work`)]}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[14px] leading-snug`,children:e.description}),e.reference&&(0,R.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-[12px] text-muted`,children:[(0,R.jsx)(`img`,{src:h(e.reference),alt:``,draggable:!1,className:`h-9 w-9 rounded-lg object-cover`}),n(`drawn from the picture you attached`)]})]})]}),e.stage===`estimate`&&(0,R.jsxs)(`div`,{className:`px-4 pb-3.5 space-y-2.5`,children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:g}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:a!==null||c.cloud!==!1&&typeof c.cny!=`number`&&!c.error,onClick:()=>f(`start`,()=>M.avatarStart(e.session)),className:i(`flex items-center justify-center gap-1.5 rounded-2xl bg-accent text-accent-fg px-4 py-2.5 text-[14px] font-medium disabled:opacity-40`,`inline-flex items-center gap-1.5 py-2`),children:[a===`start`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(nn,{size:14}),` `,n(`Draw`)]}),(0,R.jsxs)(`button`,{type:`button`,disabled:a!==null,onClick:()=>f(`cancel`,()=>M.avatarCancel(e.session)),className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Fe,{size:14}),` `,n(`Not now`)]})]})]}),(e.stage===`drawing`||e.stage===`choose`)&&(0,R.jsxs)(`div`,{className:`px-4 pb-3.5 space-y-2.5`,children:[(0,R.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:l.map((t,r)=>(0,R.jsxs)(`button`,{type:`button`,disabled:!t||e.stage!==`choose`||a!==null,onClick:()=>f(`pick${r}`,()=>M.avatarChoose(e.session,r)),"aria-label":n(`Candidate {n}`,{n:r+1}),className:i(`relative aspect-square overflow-hidden rounded-2xl bg-[#f1efeb] transition`,t&&e.stage===`choose`?`hover:ring-2 hover:ring-accent`:``),children:[t?(0,R.jsx)(`img`,{src:h(t),alt:``,draggable:!1,className:`h-full w-full object-cover`}):(0,R.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center text-muted`,children:e.stage===`drawing`?(0,R.jsx)(A,{size:20,className:`animate-spin`}):(0,R.jsx)(Fe,{size:18,className:`opacity-50`})}),a===`pick${r}`&&(0,R.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-bg/60`,children:(0,R.jsx)(A,{size:20,className:`animate-spin`})}),(0,R.jsx)(`span`,{className:`absolute left-1.5 top-1.5 rounded-full bg-bg/80 px-1.5 text-[10.5px] font-semibold text-fg/80`,children:r+1})]},r))}),e.errors&&e.errors.length>0&&(0,R.jsx)(`p`,{className:`text-[12px] text-rose-600 dark:text-rose-300`,children:n(e.errors[0])}),e.stage===`choose`&&(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:a!==null,onClick:()=>f(`redraw`,()=>M.avatarStart(e.session)),className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:[a===`redraw`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(Re,{size:14}),` `,n(`Redraw`)]}),(0,R.jsxs)(`button`,{type:`button`,disabled:a!==null,onClick:()=>f(`cancel`,()=>M.avatarCancel(e.session)),className:i(`flex items-center justify-center gap-1.5 rounded-2xl border border-border px-4 py-2.5 text-[14px] font-medium text-muted disabled:opacity-40`,`inline-flex items-center gap-1.5`),children:[(0,R.jsx)(Fe,{size:14}),` `,n(`Not now`)]})]})]}),(e.stage===`posing`||e.stage===`animating`||e.stage===`done`)&&(0,R.jsxs)(`div`,{className:`px-4 pb-3.5 space-y-2`,children:[(0,R.jsx)(`div`,{className:`flex gap-1.5`,children:tp.map(t=>(0,R.jsxs)(`div`,{className:`relative aspect-square flex-1 overflow-hidden rounded-xl bg-[#f1efeb]`,children:[d[t]?(0,R.jsx)(`video`,{src:h(d[t]),poster:u[t]?h(u[t]):void 0,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,disablePictureInPicture:!0,className:`h-full w-full object-cover`},d[t]):u[t]?(0,R.jsx)(`img`,{src:h(u[t]),alt:``,draggable:!1,className:`h-full w-full object-cover`}):(0,R.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center text-muted`,children:(0,R.jsx)(A,{size:14,className:`animate-spin`})}),e.stage===`animating`&&u[t]&&!d[t]&&t!==`error`&&(0,R.jsx)(`span`,{className:`absolute bottom-1 right-1 rounded-full bg-white/80 p-0.5 text-muted`,children:(0,R.jsx)(A,{size:10,className:`animate-spin`})})]},t))}),e.stage===`done`?(0,R.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[12.5px] text-muted`,children:[(0,R.jsx)(ke,{size:14,className:`text-emerald-600`}),` `,n(`Idle, working, waiting, happy, sorry: the face follows what {name} is doing.`,{name:t})]}):e.stage===`animating`?(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:n(`The face is already on; four short clips are being made from the poses, a few minutes.`)}):(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:n(`Four more pictures from the one you picked; this takes a minute or two.`)}),e.errors&&e.errors.length>0&&e.stage===`done`&&(0,R.jsxs)(`p`,{className:`text-[12px] text-muted`,children:[e.errors.some(e=>!e.includes(` clip:`))&&n(`Some poses could not be drawn and show the idle picture instead.`),` `,e.errors.some(e=>e.includes(` clip:`))&&n(`Some clips could not be made; those moods stay still.`)]})]}),(e.stage===`failed`||e.stage===`cancelled`)&&e.message&&(0,R.jsx)(`p`,{className:`px-4 pb-3.5 text-[12.5px] text-muted`,children:n(e.message)})]})})}function rp(){let e=ip();if(!e||typeof e.keepRunning!=`function`)return null;try{return JSON.parse(e.keepRunning())}catch{return null}}function ip(){return window.NanoMuseAndroid??null}function ap(){let e=ip();return!!e&&typeof e.takeOverBrowser==`function`&&(typeof e.hasBrowser!=`function`||e.hasBrowser())}function op(){let e=ip();if(!e||typeof e.accessibilityState!=`function`)return null;let t=e.accessibilityState();return t===`on`||t===`off`||t===`unsupported`?t:null}function sp(e,t=15){switch(e){case`web_search`:return(0,R.jsx)(qt,{size:t});case`web_fetch`:case`browser`:return(0,R.jsx)(gt,{size:t});case`files`:return(0,R.jsx)(mt,{size:t});case`shell`:return(0,R.jsx)(dn,{size:t});case`python_execute`:return(0,R.jsx)(ct,{size:t});case`read_emails`:case`send_email`:return(0,R.jsx)(Et,{size:t});case`goals`:return(0,R.jsx)(un,{size:t});case`remember`:case`recall`:case`forget`:return(0,R.jsx)(Qe,{size:t});case`ask_user`:return(0,R.jsx)(kt,{size:t});case`devices`:return(0,R.jsx)(It,{size:t});case`device_shell`:return(0,R.jsx)(dn,{size:t});case`device_files`:case`device_get`:case`device_put`:return(0,R.jsx)(mt,{size:t});case`device_open`:return(0,R.jsx)(Ae,{size:t});case`device_screen`:return(0,R.jsx)(Lt,{size:t});case`device_notify`:return(0,R.jsx)(Xe,{size:t});case`delegate`:return(0,R.jsx)(Jt,{size:t});case`computer_screen`:return(0,R.jsx)(Lt,{size:t});case`computer_act`:return(0,R.jsx)(zt,{size:t});case`computer_task`:case`computer_app`:return(0,R.jsx)(vt,{size:t});case`phone_screen`:case`phone_act`:case`phone_task`:return(0,R.jsx)(tn,{size:t});default:return(0,R.jsx)(Ze,{size:t})}}function cp({device:e,className:t}){let n=s();return(0,R.jsxs)(`span`,{className:i(`inline-flex max-w-full items-center gap-1 rounded-full bg-accent/12 px-2 py-0.5 text-[11px] font-medium text-accent`,t),children:[(0,R.jsx)(It,{size:11,className:`shrink-0`}),` `,(0,R.jsx)(`span`,{className:`truncate`,children:n(`on {device}`,{device:e})})]})}var lp={safe:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,moderate:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,sensitive:`bg-rose-500/15 text-rose-700 dark:text-rose-300`};function up({risk:e}){return(0,R.jsx)(`span`,{className:i(`px-2 py-0.5 rounded-full text-[11px] font-semibold uppercase tracking-wide`,lp[e]),children:_(e)})}function dp({args:e}){let t=Object.entries(e??{}).filter(([,e])=>e!=null&&e!==``);return t.length?(0,R.jsx)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[13px]`,children:t.map(([e,t])=>(0,R.jsxs)(`div`,{className:`contents`,children:[(0,R.jsx)(`dt`,{className:`text-muted`,children:e}),(0,R.jsx)(`dd`,{className:`break-words whitespace-pre-wrap font-mono text-[12.5px] leading-snug`,children:String(t)})]},e))}):null}function fp({event:e}){let[t,n]=(0,L.useState)(!1),r=e.status===`running`?(0,R.jsx)(A,{size:14,className:`animate-spin text-accent`}):e.status===`ok`?(0,R.jsx)(ke,{size:14,className:`text-emerald-500`}):e.status===`blocked`?(0,R.jsx)(Ye,{size:14,className:`text-rose-500`}):(0,R.jsx)(Fe,{size:14,className:`text-rose-500`});return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`max-w-full text-left rounded-2xl bg-surface-2/80 border border-border/60 px-3 py-1.5 text-[13px] text-muted hover:text-fg transition`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-muted`,children:sp(e.tool)}),(0,R.jsx)(`span`,{className:`truncate flex-1`,children:e.title||e.summary||e.tool}),e.device&&(0,R.jsx)(cp,{device:e.device}),r,e.output?t?(0,R.jsx)(Me,{size:13}):(0,R.jsx)(rt,{size:13}):null]}),t&&(0,R.jsxs)(`div`,{className:`mt-2 text-fg`,children:[(0,R.jsx)(dp,{args:e.args}),e.output&&(0,R.jsx)(`pre`,{className:`mt-2 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-bg p-2 text-[12px] leading-snug`,children:e.output})]})]})})}function pp(e,t,n){if(!t)return e.replace(/_/g,` `);switch(e){case`shell`:return _(`{what} commands`,{what:t.split(`,`).join(`, `)});case`send_email`:return _(`email to {who}`,{who:t.split(`,`).join(`, `)});case`remote_control`:return _(`the device {name}`,{name:typeof n?.device==`string`&&n.device?n.device:t});case`computer_app`:return _(`the hands in {app}`,{app:typeof n?.name==`string`&&n.name?n.name:t});default:return t}}function mp(e,t,n,r){switch(e){case`once`:return _(`Once`);case`conversation`:return _(`For this conversation`);case`session`:return _(`Until restart`);case`24h`:return _(`For 24 hours`);case`always`:return _(`Always for {subject}`,{subject:pp(t,n,r)});default:return e}}function hp({event:e,name:t=`nanoMuse`,onDecide:n}){let[r,a]=(0,L.useState)(!1),[o,c]=(0,L.useState)(!1),[l,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(!1),m=(e,t)=>{f||(p(!0),Promise.resolve(n(e,t)).finally(()=>p(!1)))},h=(0,L.useRef)(null),g=(0,L.useRef)(null),_=s(),y=e.status===`pending`,b=e.risk===`sensitive`,x=(e.grant_options??[`once`]).filter(e=>e!==`once`),S=e.egress_target||([`web_fetch`,`browser`,`web_search`].includes(e.tool)?e.target:null),C=e.tool===`send_email`?e.target:null,w=Object.values(e.args??{}).some(e=>e!=null&&e!==``);return(0,L.useEffect)(()=>{let e=g.current;e&&!r&&d(e.scrollHeight>e.clientHeight+2)},[e.args,r]),(0,L.useEffect)(()=>{(r||o)&&h.current?.scrollIntoView({block:`end`,behavior:`smooth`})},[r,o]),(0,R.jsx)(`div`,{className:`rise flex justify-start`,ref:h,children:(0,R.jsxs)(`div`,{className:i(`w-full max-w-[600px] overflow-hidden rounded-[22px] bg-surface shadow-[0_2px_12px_rgba(0,0,0,0.12)] dark:border dark:border-border dark:shadow-none`,y&&b&&`border border-rose-400/60`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 pt-4 pb-2`,children:[(0,R.jsx)(`div`,{className:i(`flex h-10 w-10 shrink-0 items-center justify-center rounded-full`,b?`bg-rose-500/12 text-rose-500`:`bg-surface-2 text-fg`),children:b?(0,R.jsx)(Zt,{size:22}):sp(e.tool,22)}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[12.5px] font-medium text-muted`,children:[(0,R.jsx)(`span`,{children:e.remote?_(`{name} on {device} wants to`,{name:t,device:e.remote.name}):_(`{name} wants to`,{name:t})}),e.remote&&(0,R.jsx)(cp,{device:e.remote.name})]}),(0,R.jsx)(`div`,{className:`mt-0.5 break-words text-[17px] font-semibold leading-[22px]`,children:e.summary}),S?(0,R.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[13px] text-muted`,children:[(0,R.jsx)(gt,{size:12}),` `,(0,R.jsx)(`span`,{className:`truncate`,children:_(`at {host}`,{host:S})})]}):C?(0,R.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[13px] text-muted`,children:[(0,R.jsx)(Et,{size:12}),` `,(0,R.jsx)(`span`,{className:`truncate`,children:_(`to {recipient}`,{recipient:C})})]}):null,e.purpose&&(0,R.jsx)(`div`,{className:`mt-1.5 break-words text-[13px] leading-snug text-muted line-clamp-2`,children:e.purpose}),b&&(0,R.jsx)(`div`,{className:`mt-1.5`,children:(0,R.jsx)(up,{risk:e.risk})})]})]}),e.warnings?.length>0&&(0,R.jsx)(`div`,{className:`space-y-1 px-4 pb-2`,children:e.warnings.map(e=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[12.5px] text-rose-600 dark:text-rose-300`,children:[(0,R.jsx)(pn,{size:13,className:`mt-0.5 shrink-0`}),` `,(0,R.jsx)(`span`,{children:_(e)})]},e))}),(w||e.reasons?.length>0)&&(0,R.jsx)(`div`,{className:`px-4 pb-2`,children:(0,R.jsxs)(`div`,{className:`rounded-xl bg-surface-2 px-3 py-2.5`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-medium text-muted`,children:_(`Exactly what will run`)}),(0,R.jsxs)(`div`,{ref:g,className:i(`-mt-1`,!r&&`max-h-40 overflow-hidden`),children:[(0,R.jsx)(dp,{args:e.args}),e.reasons?.length>0&&(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:_(`Why it asks: {reasons}`,{reasons:e.reasons.map(v).join(` · `)})})]}),(l||r)&&(0,R.jsxs)(`button`,{type:`button`,className:`mt-1 flex items-center gap-1 text-[12.5px] text-accent`,onClick:()=>a(e=>!e),children:[r?(0,R.jsx)(Me,{size:13}):(0,R.jsx)(rt,{size:13}),` `,_(r?`Fewer options`:`Show all`)]})]})}),y?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pb-4 pt-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!0,`once`),disabled:f,className:`h-[46px] w-full rounded-full bg-accent text-[15px] font-semibold text-accent-fg transition active:scale-[0.98] disabled:opacity-60`,children:_(`Allow once`)}),x.filter(e=>o||e===`conversation`||e===`always`).map(t=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!0,t),disabled:f,className:`h-11 w-full truncate rounded-full bg-surface-2 px-4 text-[15px] font-medium transition active:scale-[0.98] disabled:opacity-60`,children:mp(t,e.tool,e.target,e.args)},t)),(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!1,`once`),disabled:f,className:`h-11 w-full rounded-full bg-surface-2 text-[15px] font-medium transition active:scale-[0.98] disabled:opacity-60`,children:_(`Deny`)}),x.length===0?(0,R.jsx)(`div`,{className:`text-center text-[12px] text-muted`,children:_(`This kind of action is approved one at a time.`)}):!o&&x.some(e=>e!==`conversation`&&e!==`always`)&&(0,R.jsx)(`button`,{type:`button`,className:`self-center text-[12.5px] text-muted`,onClick:()=>c(!0),children:_(`Allow {subject} for longer…`,{subject:pp(e.tool,e.target,e.args)})})]}):(0,R.jsxs)(`div`,{className:i(`flex items-center gap-1.5 border-t border-border px-4 py-2.5 text-[13px] font-medium`,e.status===`approved`?`text-emerald-600 dark:text-emerald-300`:`text-muted`),children:[e.status===`approved`?(0,R.jsx)(ke,{size:15}):(0,R.jsx)(Fe,{size:15}),e.status===`approved`?`${_(`Approved`)}${e.scope&&e.scope!==`once`?` · ${mp(e.scope,e.tool,e.target).toLowerCase()}`:``}`:e.status===`denied`?_(`Denied`):_(`Expired without an answer`),(0,R.jsx)(`span`,{className:`ml-auto font-normal`,children:u(e.updated_ts??e.ts)})]})]})})}function gp({event:e,name:t}){let n=s();return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`div`,{className:`max-w-full rounded-[20px] rounded-bl-md border border-accent/30 bg-surface px-4 py-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12.5px] font-medium text-accent`,children:[(0,R.jsx)(kt,{size:14}),` `,n(`{name} asks`,{name:t})]}),(0,R.jsx)(`div`,{className:`mt-1 text-[15px] leading-snug whitespace-pre-wrap break-words`,children:e.text}),e.status===`pending`&&(0,R.jsx)(`div`,{className:`mt-1.5 text-[12.5px] text-muted`,children:n(`Reply below to continue.`)}),e.status===`answered`&&e.answer&&(0,R.jsxs)(`div`,{className:`mt-2 text-[13px] text-muted border-t border-border pt-2`,children:[n(`You:`),` `,(0,R.jsx)(`span`,{className:`text-fg`,children:e.answer})]})]})})}function _p(e){return e.source===`reminder`||e.source===`memory`?t(e.text):_(e.text,e.vars)}function vp({event:e,onCloudRetry:t}){let n=s(),[r,a]=(0,L.useState)(!1),[o,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(null),d=e.detail&&e.detail!==e.text?e.detail:null;return e.code===`allowance`&&e.allowance?(0,R.jsxs)(`div`,{className:`rise flex flex-col items-center gap-2 px-6`,children:[(0,R.jsx)(`div`,{className:`max-w-full rounded-2xl bg-amber-500/12 px-3 py-1.5 text-center text-[12.5px] leading-snug text-amber-700 dark:text-amber-300`,children:n(e.text)}),(0,R.jsx)(`div`,{className:`w-full max-w-[520px]`,children:(0,R.jsx)(Ff,{info:e.allowance,exhausted:!0,compact:!0})})]}):(0,R.jsx)(`div`,{className:`rise flex justify-center px-6`,children:(0,R.jsxs)(`div`,{className:i(`max-w-full rounded-2xl px-3 py-1.5 text-center text-[12.5px] leading-snug`,e.level===`info`&&`bg-surface-2/70 text-muted`,e.level===`warn`&&`bg-amber-500/12 text-amber-700 dark:text-amber-300`,e.level===`error`&&`bg-rose-500/12 text-rose-700 dark:text-rose-300`),children:[_p(e),d&&(0,R.jsxs)(R.Fragment,{children:[` `,(0,R.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`underline decoration-dotted underline-offset-2 opacity-70 hover:opacity-100`,children:n(r?`Hide details`:`Details`)}),r&&(0,R.jsx)(`div`,{className:`mt-1.5 break-all text-left font-mono text-[11px] opacity-80`,children:d})]}),t&&(0,R.jsxs)(`div`,{className:`mt-1.5 flex flex-col items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>{t&&(c(!0),u(null),t().catch(e=>u(n(e.message||`Could not send`))).finally(()=>c(!1)))},className:`rounded-full bg-accent/12 px-3 py-1 text-[12px] font-medium text-accent disabled:opacity-50`,children:n(`Use nanoMuse Cloud this time`)}),l&&(0,R.jsx)(`div`,{className:`text-[12px] text-rose-700 dark:text-rose-300`,children:l})]})]})})}function yp({event:e,onOpen:t}){let[r,i]=(0,L.useState)(!1),a=s(),o=e.status===`live`,c=e.url;try{c=new URL(e.url).host}catch{}return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-label":a(`Browser: {title}`,{title:e.title||c}),className:`w-full max-w-[340px] overflow-hidden rounded-3xl rounded-tl-lg border border-border bg-surface shadow-sm hover:bg-surface-2 transition text-left`,children:[(0,R.jsxs)(`div`,{className:`relative aspect-[16/10] bg-surface-2`,children:[r?(0,R.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-1 text-muted`,children:[(0,R.jsx)(gt,{size:22}),(0,R.jsx)(`span`,{className:`text-[12px]`,children:a(`Frame no longer available`)})]}):(0,R.jsx)(`img`,{src:n(e.thread,e.frame),alt:e.title||c,onError:()=>i(!0),className:`absolute inset-0 h-full w-full object-cover object-top`},e.frame),(0,R.jsx)(`div`,{className:`absolute left-2.5 top-2.5 flex items-center gap-1.5 rounded-full bg-black/60 px-2 py-0.5 text-[10.5px] font-semibold text-white`,children:o?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-rose-400 animate-pulse`}),` `,a(`LIVE`)]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(gt,{size:11}),` `,a(`BROWSER`)]})})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-3.5 py-2.5`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:e.title||c}),(0,R.jsxs)(`div`,{className:`text-[12px] text-muted truncate`,children:[e.by_user&&e.action.startsWith(`You`)?a(`You`)+e.action.slice(3):e.action,` · `,c]})]}),(0,R.jsx)(rt,{size:16,className:`text-muted shrink-0`})]})]})})}function bp({event:e,name:t=`nanoMuse`}){let n=s(),{state:r,toast:a}=E(),[o,c]=(0,L.useState)(!1),[l,d]=(0,L.useState)(!1),f=e.status===`live`,p=e.last,m=[e.app,e.title].filter(Boolean).join(` · `),h=r.holds.find(t=>t.thread===e.thread&&t.tool===`computer`),g=async()=>{c(!0);try{await M.stopHands()}catch{}finally{c(!1)}},_=async()=>{d(!0);try{await M.openHold(e.thread,`computer`)}catch(e){a(e.message)}finally{d(!1)}};return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`div`,{className:i(`w-full max-w-[360px] overflow-hidden rounded-3xl rounded-tl-lg border bg-surface shadow-sm`,f?`border-accent/50`:`border-border/70`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 pt-3.5 pb-2`,children:[(0,R.jsx)(`div`,{className:i(`mt-0.5 rounded-full p-2`,f?`bg-accent/12 text-accent`:`bg-surface-2 text-fg/80`),children:(0,R.jsx)(vt,{size:18})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[12.5px] font-medium text-muted`,children:[(0,R.jsx)(`span`,{children:f?n(`{name} is using this computer`,{name:t}):e.status===`stopped`?n(`Hands stopped`):n(`Hands done`)}),f&&(0,R.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full bg-accent/12 px-2 py-0.5 text-[10.5px] font-semibold text-accent`,children:[(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-accent`}),` `,n(`LIVE`)]})]}),e.text&&(0,R.jsx)(`div`,{className:`mt-0.5 break-words text-[15px] font-semibold leading-snug`,children:e.text}),p?.action&&(0,R.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 text-[13px] text-fg/90`,children:[(0,R.jsx)(zt,{size:13,className:`shrink-0 text-muted`}),(0,R.jsx)(`span`,{className:`truncate`,children:Tp(p,n)})]}),m&&(0,R.jsx)(`div`,{className:`mt-1 truncate text-[12px] text-muted`,children:m}),e.notice&&(0,R.jsx)(`div`,{className:`mt-1.5 rounded-2xl bg-amber-500/12 px-3 py-1.5 text-[12.5px] text-amber-700 dark:text-amber-300`,children:e.notice}),f&&h&&(0,R.jsx)(xp,{hold:h})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/70 px-4 py-2 text-[12px] text-muted`,children:[(0,R.jsx)(`span`,{children:n(`{n} steps`,{n:e.steps})}),(0,R.jsx)(`span`,{className:`ml-auto`,children:u(e.updated_ts??e.ts)}),f&&!h&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void _(),disabled:l,className:`ml-1 inline-flex items-center gap-1.5 rounded-full bg-accent/12 px-3 py-1 text-[12.5px] font-semibold text-accent transition active:scale-95 disabled:opacity-60`,children:[(0,R.jsx)(vt,{size:11}),` `,n(`Take over`)]}),f&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void g(),disabled:o,className:`ml-1 inline-flex items-center gap-1.5 rounded-full bg-fg px-3 py-1 text-[12.5px] font-semibold text-bg transition active:scale-95 disabled:opacity-60`,children:[(0,R.jsx)(sn,{size:10,fill:`currentColor`}),` `,n(`Stop`)]})]})]})})}function xp({hold:e,compact:t}){let n=s(),[r,a]=(0,L.useState)(!1),o=async()=>{a(!0);try{await M.doneHold(e.id)}catch{}finally{a(!1)}};return(0,R.jsxs)(`div`,{className:i(`flex items-center gap-2 rounded-2xl bg-amber-500/12 px-3 text-amber-800 dark:text-amber-200`,t?`py-1.5 text-[12.5px]`:`mt-1.5 py-2 text-[13px]`),children:[(0,R.jsx)(vt,{size:14,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:Cp(e,n)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:r,className:`shrink-0 rounded-full bg-fg px-3 py-1 text-[12.5px] font-semibold text-bg transition active:scale-95 disabled:opacity-60`,children:r?(0,R.jsx)(A,{size:13,className:`animate-spin`}):n(`Done`)})]})}function Sp(e,t){return t(e===`browser`?`the browser`:e===`phone`?`the phone`:`this computer`)}function Cp(e,t){return e.by===`agent`?e.reason?t(`Your turn: {reason}`,{reason:e.reason}):t(`Your turn`):t(`You took over {thing}`,{thing:Sp(e.tool,t)})}function wp({event:e,name:t=`nanoMuse`}){let n=s(),[r,a]=(0,L.useState)(!1),o=e.status===`on`,c=Sp(e.tool,n),l=async()=>{a(!0);try{await M.doneHold(e.id)}catch{}finally{a(!1)}},d=e.timed_out?n(`{name} waited ten minutes and went on without you.`,{name:t}):e.stale?n(`Ended when the runtime restarted.`):e.by===`agent`?n(`You did it; {name} carried on.`,{name:t}):n(`Handed back; {name} carried on.`,{name:t});return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`div`,{className:i(`w-full max-w-[360px] overflow-hidden rounded-3xl rounded-tl-lg border bg-surface shadow-sm`,o?`border-amber-500/50`:`border-border/70 opacity-70`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 pt-3.5 pb-3`,children:[(0,R.jsx)(`div`,{className:i(`mt-0.5 rounded-full p-2`,o?`bg-amber-500/15 text-amber-700 dark:text-amber-300`:`bg-surface-2 text-fg/70`),children:(0,R.jsx)(vt,{size:18})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[12.5px] font-medium text-muted`,children:e.tool===`browser`?n(`The browser`):e.tool===`phone`?n(`The phone`):n(`This computer`)}),(0,R.jsx)(`div`,{className:`mt-0.5 break-words text-[15px] font-semibold leading-snug`,children:e.by===`agent`?n(`Your turn`):n(`You took over {thing}`,{thing:c})}),e.by===`agent`&&e.reason&&(0,R.jsx)(`div`,{className:`mt-1 break-words text-[13.5px] leading-snug text-fg/90`,children:e.reason}),(0,R.jsx)(`div`,{className:`mt-1.5 text-[12.5px] leading-snug text-muted`,children:o?e.by===`agent`?n(`Do this part yourself, then press Done. {name} looks again and carries on from there.`,{name:t}):n(`{name} waits. Press Done when you are finished and it looks again.`,{name:t}):d})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/70 px-4 py-2 text-[12px] text-muted`,children:[(0,R.jsx)(`span`,{children:u(e.ts)}),o&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void l(),disabled:r,className:`ml-auto inline-flex items-center gap-1.5 rounded-full bg-fg px-3.5 py-1 text-[12.5px] font-semibold text-bg transition active:scale-95 disabled:opacity-60`,children:[r?(0,R.jsx)(A,{size:13,className:`animate-spin`}):(0,R.jsx)(ke,{size:12}),` `,n(`Done`)]})]})]})})}function Tp(e,t){let n=e.label?`“${e.label}”`:``;switch(e.action){case`click`:return n?t(`Clicked {label}`,{label:n}):t(`Clicked`);case`double_click`:return n?t(`Double-clicked {label}`,{label:n}):t(`Double-clicked`);case`right_click`:case`middle_click`:return n?t(`Right-clicked {label}`,{label:n}):t(`Right-clicked`);case`move`:return n?t(`Pointed at {label}`,{label:n}):t(`Moved the mouse`);case`type`:return t(`Typed {n} characters`,{n:(e.text??``).length});case`key`:return t(`Pressed {keys}`,{keys:(e.keys??[]).join(`+`)});case`scroll`:return t(`Scrolled`);case`drag`:return t(`Dragged`);case`open_app`:return n?t(`Opened {label}`,{label:n}):t(`Opened an application`);case`wait`:return t(`Waited`);default:return e.action??``}}function Ep({event:e,onOpen:t}){let n=s(),a=r(e.name),o=n(a===`html`?`Page`:a===`image`?`Image`:a===`data`?`Data`:a===`code`?`Code`:a===`event`?`Event`:`Document`),c=e.action===`update`?`${o} · ${n(`updated`)}`:o,l=a===`html`||a===`image`;return(0,R.jsx)(`div`,{className:`rise flex justify-start pr-8`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path),className:i(`max-w-full overflow-hidden rounded-[20px] border border-border bg-surface text-left shadow-[0_4px_20px_-12px_rgba(0,0,0,0.2)] transition hover:bg-surface-2`,l?`w-[300px]`:``),children:[l&&(0,R.jsx)(Dp,{path:e.path,kind:a}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,children:[!l&&(0,R.jsx)(`div`,{className:`rounded-2xl bg-accent/12 p-2.5 text-accent`,children:a===`code`?(0,R.jsx)(ct,{size:20}):a===`event`?(0,R.jsx)(tt,{size:20}):(0,R.jsx)(mt,{size:20})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted`,children:c}),(0,R.jsx)(`div`,{className:`truncate text-[14.5px] font-medium`,children:e.name}),(0,R.jsx)(`div`,{className:`truncate text-[12px] text-muted`,children:e.path})]}),(0,R.jsx)(rt,{size:16,className:`ml-1 shrink-0 text-muted`})]})]})})}function Dp({path:e,kind:t}){return t===`image`?(0,R.jsx)(`img`,{src:h(e),alt:``,loading:`lazy`,className:`h-40 w-full object-cover`}):(0,R.jsx)(`div`,{className:`pointer-events-none relative h-40 w-full overflow-hidden bg-white`,children:(0,R.jsx)(`iframe`,{title:e,src:h(e),sandbox:``,tabIndex:-1,loading:`lazy`,scrolling:`no`,className:`absolute left-0 top-0 h-[480px] w-[900px] origin-top-left scale-[0.3333] border-0`})})}function Op({open:e,onClose:t,title:n,children:r,footer:i}){let a=s(),o=(0,L.useRef)(null);return On(o,e),(0,L.useEffect)(()=>{if(!e)return;let n=e=>e.key===`Escape`&&t();return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,R.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-end sm:items-center sm:justify-center`,children:[(0,R.jsx)(`div`,{className:`absolute inset-0 bg-black/45 backdrop-blur-[2px]`,onClick:t}),(0,R.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,className:`sheet-in relative w-full sm:max-w-lg max-h-[92dvh] flex flex-col bg-surface rounded-t-3xl sm:rounded-3xl shadow-2xl border border-border`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 px-5 pt-4 pb-2`,children:[(0,R.jsx)(`div`,{className:`sm:hidden absolute left-1/2 -translate-x-1/2 top-2 h-1 w-10 rounded-full bg-border`}),(0,R.jsx)(`div`,{className:`flex-1 font-semibold text-[17px] mt-1`,children:n}),(0,R.jsx)(`button`,{type:`button`,onClick:t,"aria-label":a(`Close`),className:`p-2 -mr-2 rounded-full text-muted hover:bg-surface-2`,children:(0,R.jsx)(Fe,{size:20})})]}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 pb-4`,children:r}),i&&(0,R.jsx)(`div`,{className:`px-5 pt-2 pb-4 safe-bottom border-t border-border`,children:i})]})]}):null}var kp=1e3;function Ap({thread:e,eventId:t,onClose:r}){let{state:a,toast:o}=E(),c=s(),l=(a.events[e]??[]).find(e=>e.id===t),u=a.holds.find(t=>t.thread===e&&t.tool===`browser`),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)(``),[y,b]=(0,L.useState)(!1),x=(0,L.useRef)(null),S=d?d===`on`:!!u;(0,L.useEffect)(()=>b(!1),[l?.frame]),(0,L.useEffect)(()=>f(null),[u?.id,u?.status]);let C=l?.backend===`device`&&ap();(0,L.useEffect)(()=>{if(!C)return;let t=t=>{let n=t.detail;n?.thread&&n.thread!==e||M.browserControl(e,{action:`handed_back`}).catch(e=>o(e.message))};return window.addEventListener(`nanomuse:browser-handed-back`,t),()=>window.removeEventListener(`nanomuse:browser-handed-back`,t)},[C,e,o]);let w=(0,L.useCallback)(async t=>{m(t.action);try{await M.browserControl(e,t)}catch(e){o(e.message)}finally{m(null)}},[e,o]),T=()=>{if(C){ip()?.takeOverBrowser?.(e),M.browserControl(e,{action:`take_over`}).catch(()=>void 0);return}f(`on`),w({action:`take_over`})},D=()=>{f(`off`),w({action:`handed_back`})};(0,L.useEffect)(()=>{if(!S||C||!l||l.status!==`live`)return;let t=window.setInterval(()=>{document.hidden||M.browserControl(e,{action:`look`}).catch(()=>void 0)},kp);return()=>window.clearInterval(t)},[S,C,e,l]);let O=e=>{if(!S||p)return;let t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width,r=(e.clientY-t.top)/t.height;w({action:`click`,x:Math.min(Math.max(n,0),1),y:Math.min(Math.max(r,0),1)})},k=e=>{!S||p||Math.abs(e.deltaY)<8||w({action:`scroll`,dy:Math.max(-2e3,Math.min(2e3,Math.round(e.deltaY*2)))})};if(!l)return null;let ee=l.url;try{ee=new URL(l.url).host}catch{}let te=l.status===`live`,j=a.profile?.name??`nanoMuse`,ne=u?c(`{name} is waiting for you`,{name:j}):a.status.state!==`idle`&&a.status.thread===e?c(`{name} is working`,{name:j}):l.action;return(0,R.jsxs)(Op,{open:!0,onClose:r,title:(0,R.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,R.jsx)(gt,{size:17,className:`text-accent shrink-0`}),(0,R.jsx)(`span`,{className:`truncate`,children:l.title||ee}),te&&(0,R.jsxs)(`span`,{className:`ml-1 flex items-center gap-1 rounded-full bg-rose-500/12 px-2 py-0.5 text-[10.5px] font-semibold text-rose-500`,children:[(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-rose-500 animate-pulse`}),` `,c(`LIVE`)]})]}),footer:S?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),h&&w({action:`type`,text:h}).then(()=>g(``))},children:[(0,R.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:c(`Type into the focused field…`),className:`flex-1 rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14px] outline-none`,autoComplete:`off`,autoCapitalize:`off`}),(0,R.jsx)(`button`,{type:`submit`,disabled:!h||!!p,"aria-label":c(`Type`),className:`rounded-full bg-accent p-2.5 text-white disabled:opacity-40`,children:p===`type`?(0,R.jsx)(A,{size:16,className:`animate-spin`}):(0,R.jsx)(qe,{size:16})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`key`,key:`Enter`}),disabled:!!p,"aria-label":c(`Press Enter`),className:`rounded-full bg-surface-2 p-2.5 text-fg disabled:opacity-40`,children:(0,R.jsx)(dt,{size:16})})]}),(0,R.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),_&&w({action:`navigate`,url:_}).then(()=>v(``))},children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`back`}),disabled:!!p,"aria-label":c(`Back`),className:`rounded-full bg-surface-2 p-2 text-fg disabled:opacity-40`,children:(0,R.jsx)(Ke,{size:15})}),(0,R.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),placeholder:c(`Open a URL…`),inputMode:`url`,autoCapitalize:`off`,className:`flex-1 min-w-0 rounded-2xl bg-surface-2 px-3.5 py-2 text-[13px] outline-none`}),(0,R.jsx)(`button`,{type:`submit`,disabled:!_||!!p,className:`rounded-2xl bg-surface-2 px-3 py-2 text-[13px] font-medium disabled:opacity-40`,children:c(`Go`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`scroll`,dy:-600}),disabled:!!p,"aria-label":c(`Scroll up`),className:`rounded-full bg-surface-2 p-2 text-fg disabled:opacity-40`,children:(0,R.jsx)(Je,{size:15})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`scroll`,dy:600}),disabled:!!p,"aria-label":c(`Scroll down`),className:`rounded-full bg-surface-2 p-2 text-fg disabled:opacity-40`,children:(0,R.jsx)(Ge,{size:15})})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate text-[12px] text-muted`,children:c(`Tap the page to click. If the browser was closed, open a URL first.`)}),(0,R.jsxs)(`button`,{type:`button`,onClick:D,disabled:p===`handed_back`,className:`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full bg-fg px-3.5 py-1.5 text-[13px] font-semibold text-bg disabled:opacity-60`,children:[p===`handed_back`?(0,R.jsx)(A,{size:14,className:`animate-spin`}):(0,R.jsx)(ke,{size:14}),` `,c(`Done`)]})]})]}):(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 text-[12.5px] text-muted truncate`,children:[ne,` · `,ee]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`look`}),disabled:!!p,"aria-label":c(`Refresh`),className:`rounded-full bg-surface-2 p-2 text-muted disabled:opacity-40`,children:p===`look`?(0,R.jsx)(A,{size:15,className:`animate-spin`}):(0,R.jsx)(Re,{size:15})}),(0,R.jsxs)(`button`,{type:`button`,onClick:T,disabled:d===`on`,className:`flex items-center gap-1.5 rounded-full bg-accent px-3.5 py-2 text-[13px] font-semibold text-white disabled:opacity-60`,children:[(0,R.jsx)(vt,{size:14}),` `,c(`Take over`)]})]})]}),children:[u&&u.by===`agent`&&(0,R.jsx)(`div`,{className:`mb-2`,children:(0,R.jsx)(xp,{hold:u,compact:!0})}),(0,R.jsxs)(`div`,{className:i(`relative overflow-hidden rounded-2xl border border-border bg-surface-2`,S&&`ring-2 ring-accent`),children:[y?(0,R.jsxs)(`div`,{className:`flex aspect-[16/10] flex-col items-center justify-center gap-1 text-muted`,children:[(0,R.jsx)(gt,{size:24}),(0,R.jsx)(`span`,{className:`text-[12.5px]`,children:c(`This frame is no longer available.`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w({action:`look`}),className:`text-accent text-[13px] font-medium`,children:c(`Look again`)})]}):(0,R.jsx)(`img`,{ref:x,src:n(e,l.frame),alt:l.title||ee,onError:()=>b(!0),onClick:O,onWheel:k,draggable:!1,className:i(`block w-full select-none`,S?`cursor-crosshair`:``)},l.frame),p&&p!==`look`&&(0,R.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/20`,children:(0,R.jsx)(A,{size:26,className:`animate-spin text-white`})})]}),(0,R.jsxs)(`div`,{className:`mt-2 flex items-center justify-between text-[12px] text-muted`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:l.url}),(0,R.jsx)(`span`,{className:`shrink-0 ml-2`,children:l.frames===1?c(`1 frame`):c(`{n} frames`,{n:l.frames})})]}),S&&(0,R.jsxs)(`div`,{className:`mt-3 rounded-2xl bg-accent/8 px-3.5 py-2.5 text-[13px] leading-snug`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:u&&u.by===`agent`?Cp(u,c):c(`You have the page. Press Done when you are finished.`)}),(0,R.jsx)(`div`,{className:`mt-1 text-muted`,children:c(`{name} waits meanwhile, then looks at the page as you left it and carries on. Passwords you type here go to the website, never to the model.`,{name:j})})]})]})}function jp(){if(typeof window>`u`)return null;let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}function Mp(){return jp()!==null}function Np(e,t){let[n,r]=(0,L.useState)(!1),i=(0,L.useRef)(null),a=(0,L.useRef)(``),o=s(),c=(0,L.useCallback)(()=>{i.current?.stop()},[]),l=(0,L.useCallback)(()=>{let n=jp();if(!n)return;let s=new n;s.lang=navigator.language||`en-US`,s.continuous=!0,s.interimResults=!0,a.current=``,s.onresult=t=>{let n=``;for(let e=t.resultIndex;e{let n=e.error||``;n!==`aborted`&&n!==`no-speech`&&t?.(n===`not-allowed`||n===`service-not-allowed`?o(`The microphone is not allowed. Allow it in the browser and try again.`):o(`Voice input stopped ({code}).`,{code:n}))},s.onend=()=>{i.current=null,r(!1)},i.current=s;try{s.start(),r(!0)}catch{i.current=null,r(!1)}},[e,t,o]),u=(0,L.useCallback)(()=>{i.current?c():l()},[l,c]);return(0,L.useEffect)(()=>()=>i.current?.abort(),[]),{supported:Mp(),listening:n,toggle:u,stop:c}}function Pp({listening:e,onClick:t,className:n}){let r=s();return(0,R.jsx)(`button`,{type:`button`,onClick:t,"aria-label":r(e?`Stop voice input`:`Voice input`),"aria-pressed":e,className:i(`flex h-9 w-9 shrink-0 items-center justify-center rounded-full transition active:scale-95`,e?`bg-accent/15 text-accent animate-pulse`:`text-fg/70 hover:bg-surface-2`,n),children:e?(0,R.jsx)(Pt,{size:19}):(0,R.jsx)(Ft,{size:19})})}function Fp({lines:e}){return(0,R.jsx)(`div`,{className:`flex items-end gap-2 pr-10`,children:(0,R.jsx)(`div`,{className:`min-w-0 max-w-full`,children:e.map((e,t)=>(0,R.jsx)(`div`,{className:`my-1 max-w-[340px] rounded-[20px] bg-surface-2 px-3.5 py-2.5 text-[14.5px] leading-snug whitespace-pre-wrap break-words wide:max-w-[600px]`,children:e},t))})})}function Ip({chips:e,chosen:t,busy:n,onPick:r,onElse:a}){let o=s();return e.length===0&&!t?null:(0,R.jsxs)(`section`,{className:`rise mx-1 my-2 rounded-[22px] border border-border/70 bg-surface p-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium text-fg`,children:[(0,R.jsx)(nn,{size:14,className:`text-accent`}),` `,o(`Pick a name for me, or type one`)]}),(0,R.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:[e.map(e=>{let a=t===e;return(0,R.jsxs)(`button`,{type:`button`,disabled:n||!!t,onClick:()=>r(e),className:i(`inline-flex items-center gap-1.5 rounded-full px-3.5 py-1.5 text-[13.5px] font-medium transition-colors disabled:opacity-60`,a?`bg-accent text-accent-fg`:`bg-surface-2 hover:bg-border/60`),children:[a&&(0,R.jsx)(ke,{size:13,strokeWidth:3}),e]},e)}),!t&&(0,R.jsx)(`button`,{type:`button`,disabled:n,onClick:a,className:`rounded-full border border-border px-3.5 py-1.5 text-[13.5px] text-muted hover:bg-surface-2 disabled:opacity-60`,children:o(`Something else`)})]})]})}var Lp=[{id:`pink`,background:`#F9D9E3`,accent:`#B5476A`,mood:`idle`},{id:`blue`,background:`#D6E6FA`,accent:`#2F5FA8`,mood:`working`},{id:`yellow`,background:`#FBEFC7`,accent:`#9A6B12`,mood:`waiting`},{id:`purple`,background:`#E4DDF7`,accent:`#5D44A6`,mood:`happy`},{id:`green`,background:`#D9F0DF`,accent:`#2E7D4F`,mood:`error`}],Rp=`github.com/nano-muse/nanoMuse`,zp=540,Bp=720;function Vp(e,t){return!e||w(e.avatar)?j(t):e.avatar?re(e.avatar,t):null}function Hp(e){return new Promise(t=>{let n=new Image;n.crossOrigin=`anonymous`,n.onload=()=>t(n),n.onerror=()=>t(null),n.src=e})}function Up(e,t,n){let r=t.includes(` `)?t.split(` `):Array.from(t),i=t.includes(` `)?` `:``,a=[],o=``;for(let t of r){let r=o?o+i+t:t;e.measureText(r).width>n&&o?(a.push(o),o=t):o=r}return o&&a.push(o),a}function Wp(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.arcTo(t+r,n,t+r,n+i,a),e.arcTo(t+r,n+i,t,n+i,a),e.arcTo(t,n+i,t,n,a),e.arcTo(t,n,t+r,n,a),e.closePath()}async function Gp(e,t,n,r,i,a=2){let o=document.createElement(`canvas`);o.width=zp*a,o.height=Bp*a;let s=o.getContext(`2d`);if(!s)return o;s.scale(a,a),s.fillStyle=e.background,Wp(s,0,0,zp,Bp,36),s.fill(),s.font=`600 22px system-ui, -apple-system, 'Segoe UI', sans-serif`;let c=Up(s,r,400),l=Math.max(...c.map(e=>s.measureText(e).width))+48,u=c.length*30+36,d=(zp-l)/2;s.fillStyle=`#ffffff`,Wp(s,d,56,l,u,24),s.fill(),s.beginPath(),s.moveTo(zp/2-14,56+u-1),s.lineTo(zp/2,56+u+18),s.lineTo(284,56+u-1),s.closePath(),s.fill(),s.fillStyle=e.accent,s.textAlign=`center`,s.textBaseline=`top`,c.forEach((e,t)=>s.fillText(e,zp/2,74+t*30+3));let f=56+u+54;s.fillStyle=`#ffffff`,s.beginPath(),s.arc(zp/2,f+150,158,0,Math.PI*2),s.fill();let p=Vp(t,e.mood),m=p?await Hp(p):null;return s.save(),s.beginPath(),s.arc(zp/2,f+150,150,0,Math.PI*2),s.clip(),m?(s.fillStyle=`#f1efeb`,s.fillRect(120,f,300,300),s.drawImage(m,120,f,300,300)):(s.fillStyle=t?.color??`#0064d4`,s.fillRect(120,f,300,300),s.font=`150px system-ui, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif`,s.textAlign=`center`,s.textBaseline=`middle`,s.fillStyle=`#ffffff`,s.fillText(t?.emoji??`✨`,zp/2,f+150+6)),s.restore(),s.fillStyle=e.accent,s.textAlign=`center`,s.textBaseline=`top`,s.font=`700 30px system-ui, -apple-system, 'Segoe UI', sans-serif`,s.fillText(n,zp/2,f+300+34),s.font=`500 15px system-ui, -apple-system, 'Segoe UI', sans-serif`,s.globalAlpha=.8,Up(s,i,460).forEach((e,t)=>s.fillText(e,zp/2,644+t*22)),s.globalAlpha=1,o}function Kp(e){return new Promise(t=>e.toBlob(t,`image/png`))}function qp({open:e,onClose:t}){let{state:n,toast:r}=E(),a=s(),o=n.profile,c=o?.name??`nanoMuse`,[l,u]=(0,L.useState)(0),[d,f]=(0,L.useState)([]),[p,m]=(0,L.useState)(!1),h=(0,L.useRef)(!0),g=a(`Hi, I'm {name}, a personal AI agent. Meet nanoMuse: open source, runs on your phone.`,{name:c}),_=a(`Your personal AI agent, open source · {repo}`,{repo:Rp});(0,L.useEffect)(()=>{if(h.current=!0,e)return u(0),(async()=>{let e=[];for(let t of Lp){let n=await Gp(t,o,c,g,_,1);e.push(n.toDataURL(`image/png`))}h.current&&f(e)})(),()=>{h.current=!1}},[e,o?.avatar,o?.emoji,o?.color,c]);let v=async()=>{m(!0);try{let e=await Kp(await Gp(Lp[l]??Lp[0],o,c,g,_,2));if(!e)throw Error(a(`The card could not be drawn.`));let n=new File([e],`${c}-nanomuse.png`,{type:`image/png`}),i=`${g}\nhttps://${Rp}`,s=navigator;if(typeof s.share==`function`&&(!s.canShare||s.canShare({files:[n]})))try{await s.share({files:[n],text:i,title:c}),t();return}catch(e){if(e.name===`AbortError`)return}let u=document.createElement(`a`);u.href=URL.createObjectURL(e),u.download=n.name,u.click(),window.setTimeout(()=>URL.revokeObjectURL(u.href),2e3),r(a(`Saved the card as a picture.`))}catch(e){r(e.message)}finally{m(!1)}};return(0,R.jsxs)(Op,{open:e,onClose:t,title:a(`Share my avatar`),children:[(0,R.jsx)(`p`,{className:`mb-3 text-[13px] text-muted`,children:a(`Pick a card. It goes out through the system share sheet, or saves as a picture where there is none.`)}),(0,R.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5 sm:grid-cols-5`,children:Lp.map((e,t)=>(0,R.jsx)(`button`,{type:`button`,"aria-label":e.id,"aria-pressed":l===t,onClick:()=>u(t),className:i(`overflow-hidden rounded-2xl border-2 transition`,l===t?`border-accent`:`border-transparent`),style:{background:e.background,aspectRatio:`${zp} / ${Bp}`},children:d[t]?(0,R.jsx)(`img`,{src:d[t],alt:``,className:`h-full w-full object-cover`}):(0,R.jsx)(A,{size:18,className:`mx-auto my-8 animate-spin text-muted`})},e.id))}),d[l]&&(0,R.jsx)(`img`,{src:d[l],alt:``,className:`mx-auto mt-4 w-[260px] rounded-[20px] shadow-md`}),(0,R.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:je,children:a(`Later`)}),(0,R.jsxs)(`button`,{type:`button`,disabled:p||!d.length,onClick:()=>void v(),className:Ne,children:[p?(0,R.jsx)(A,{size:15,className:`animate-spin`}):typeof navigator.share==`function`?(0,R.jsx)(Xt,{size:15}):(0,R.jsx)(ft,{size:15}),` `,typeof navigator.share==`function`?a(`Share`):a(`Save picture`)]})]})]})}function Jp({message:e,onRetry:t}){let n=s();return(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-8 py-10 text-center`,children:[(0,R.jsx)(`p`,{className:`text-[14px] text-rose-600 dark:text-rose-300`,children:n(e)||n(`Could not load.`)}),(0,R.jsxs)(`button`,{type:`button`,onClick:t,className:`flex h-10 items-center gap-1.5 rounded-full bg-surface px-4 text-[13.5px] font-medium shadow-[0_1px_4px_rgba(0,0,0,0.14)] dark:border dark:border-border dark:shadow-none`,children:[(0,R.jsx)(Re,{size:14}),` `,n(`Try again`)]})]})}var Yp=[{id:`health`,label:`Health`,icon:e=>(0,R.jsx)(yt,{...e}),tone:`bg-rose-500/12 text-rose-600 dark:text-rose-300`},{id:`finance`,label:`Finance`,icon:e=>(0,R.jsx)(Wt,{...e}),tone:`bg-emerald-500/12 text-emerald-600 dark:text-emerald-300`},{id:`career`,label:`Career`,icon:e=>(0,R.jsx)($e,{...e}),tone:`bg-sky-500/12 text-sky-600 dark:text-sky-300`},{id:`learning`,label:`Learning`,icon:e=>(0,R.jsx)(_t,{...e}),tone:`bg-violet-500/12 text-violet-600 dark:text-violet-300`},{id:`relationships`,label:`Relationships`,icon:e=>(0,R.jsx)(le,{...e}),tone:`bg-pink-500/12 text-pink-600 dark:text-pink-300`},{id:`family`,label:`Family`,icon:e=>(0,R.jsx)(hn,{...e}),tone:`bg-amber-500/12 text-amber-600 dark:text-amber-300`},{id:`home`,label:`Home`,icon:e=>(0,R.jsx)(bt,{...e}),tone:`bg-orange-500/12 text-orange-600 dark:text-orange-300`},{id:`travel`,label:`Travel`,icon:e=>(0,R.jsx)(lt,{...e}),tone:`bg-cyan-500/12 text-cyan-600 dark:text-cyan-300`},{id:`creative`,label:`Creative`,icon:e=>(0,R.jsx)(Vt,{...e}),tone:`bg-fuchsia-500/12 text-fuchsia-600 dark:text-fuchsia-300`},{id:`other`,label:`Other`,icon:e=>(0,R.jsx)(ln,{...e}),tone:`bg-surface-2 text-muted`}];function Xp(e){return Yp.find(t=>t.id===e)??null}var Zp=[{id:``,label:`No reminders`},{id:`daily`,label:`Every day`},{id:`weekdays`,label:`Weekdays`},{id:`weekly`,label:`Once a week`},{id:`monthly`,label:`Once a month`}],Qp=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`];function $p(e){let t=/^(daily|weekdays|weekly|monthly)(?:\s+(\S+?))?(?:\s+(\d{1,2}:\d{2}))?$/.exec(e.trim());if(!t)return{cadence:``,anchor:``,time:`09:00`};let n=t[2]??``,r=t[3]??`09:00`;return n&&/^\d{1,2}:\d{2}$/.test(n)&&(r=n,n=``),{cadence:t[1],anchor:n,time:r.padStart(5,`0`)}}function em(e,t,n){return e?[e,t,n].filter(Boolean).join(` `):``}function tm(e){let t=Qp.indexOf(e);return t<0?e:new Date(2024,0,1+t).toLocaleDateString(m(),{weekday:`long`})}function nm(e){let{cadence:t,anchor:n,time:r}=$p(e);switch(t){case`daily`:return _(`Daily at {time}`,{time:r});case`weekdays`:return _(`Weekdays at {time}`,{time:r});case`weekly`:return n&&Qp.includes(n)?_(`{day}s at {time}`,{day:tm(n),time:r}):_(`Weekly at {time}`,{time:r});case`monthly`:return _(`Monthly on the {day} at {time}`,{day:rm(Number(n||1)),time:r});default:return``}}function rm(e){if(c()!==`en`)return String(e);let t=[`th`,`st`,`nd`,`rd`],n=e%100;return`${e}${t[(n-20)%10]??t[n]??t[0]}`}function im(e,t){if(!e)return``;let n=new Date(`${e}T00:00:00`),r=n.toLocaleDateString(m(),{month:`short`,day:`numeric`,year:n.getFullYear()===new Date().getFullYear()?void 0:`numeric`});if(t)return _(`Was due {date}`,{date:r});let i=Math.ceil((n.getTime()-Date.now())/864e5);return i<=0?_(`Due today`):i===1?_(`Due tomorrow`):i<=14?_(`Due in {n} days`,{n:i}):_(`By {date}`,{date:r})}function am({open:e,onClose:t}){let{state:n,setTab:r,draft:a,toast:o}=E(),[c,l]=(0,L.useState)(0),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(!1),g=n.profile?.name??`nanoMuse`,_=n.pendingApprovals.length,v=s();(0,L.useEffect)(()=>{e&&(l(+(_>0)),d(!1),p(!1))},[e]);let y=(e,n)=>{t(),n&&history.replaceState(null,``,`${window.location.pathname}${window.location.search}#${n}`),r(e)},b=n.status.state===`working`,x=_>0?_>1?v(`{n} approvals waiting for you`,{n:_}):v(`1 approval waiting for you`):b?n.status.detail||v(`On it`):n.status.state===`waiting`?v(`Waiting for you`):v(`online`),S=async()=>{h(!0);try{(await M.stopThread(n.status.thread||`main`)).ok||o(v(`Nothing to stop`))}catch(e){o(e.message)}finally{h(!1)}},C=[{icon:(0,R.jsx)(it,{size:22}),label:v(`Activity`)},{icon:(0,R.jsx)(Qt,{size:22}),label:v(`Approvals`),badge:_},{icon:(0,R.jsx)(at,{size:22}),label:v(`Daily`)},{icon:(0,R.jsx)(ht,{size:22}),label:v(`Soul & memory`)}];return(0,R.jsxs)(Op,{open:e,onClose:t,children:[(0,R.jsxs)(`div`,{className:`relative flex flex-col items-center px-1 pb-3 text-center`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-label":v(`Share avatar`),title:v(`Share avatar`),onClick:()=>p(!0),className:`absolute right-0 top-0 flex h-9 w-9 items-center justify-center rounded-full bg-surface-2/70 text-fg hover:bg-surface-2`,children:(0,R.jsx)(Xt,{size:16})}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(D,{profile:n.profile,status:n.status,size:72}),(0,R.jsx)(`button`,{type:`button`,"aria-label":v(`Edit`),"aria-expanded":u,onClick:()=>d(e=>!e),className:`absolute -bottom-0.5 -right-0.5 flex h-6 w-6 items-center justify-center rounded-full bg-surface text-fg shadow-[0_1px_4px_rgba(0,0,0,0.18)] hover:bg-surface-2 dark:border dark:border-border`,children:(0,R.jsx)(Ht,{size:13})}),u&&(0,R.jsxs)(`div`,{className:`absolute left-1/2 top-full z-20 mt-2 w-56 -translate-x-1/2 overflow-hidden rounded-2xl border border-border/70 bg-surface py-1 text-left text-[14px] shadow-lg`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>{a(v(`Change your avatar to `)),t(),r(`chat`)},className:`block w-full px-4 py-2.5 text-left hover:bg-surface-2`,children:v(`Change avatar`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>y(`you`,`who`),className:`block w-full px-4 py-2.5 text-left hover:bg-surface-2`,children:v(`Edit name`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>y(`avatar`),className:`block w-full px-4 py-2.5 text-left text-muted hover:bg-surface-2`,children:v(`Avatar studio…`)})]})]}),(0,R.jsx)(`div`,{className:`mt-2.5 text-[21px] font-semibold leading-[26px]`,children:g}),(0,R.jsxs)(`div`,{className:i(`mt-0.5 flex items-center gap-1.5 text-[14px]`,b||_>0?`text-fg`:`text-muted`),children:[b&&(0,R.jsx)(A,{size:13,className:`animate-spin text-accent`}),(0,R.jsx)(`span`,{className:`line-clamp-2`,children:x})]}),(b||n.status.state===`waiting`)&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void S(),disabled:m,className:`mt-2.5 inline-flex items-center gap-1.5 rounded-full bg-fg px-4 py-1.5 text-[13.5px] font-semibold text-bg transition active:scale-95 disabled:opacity-60`,children:[(0,R.jsx)(sn,{size:12,fill:`currentColor`}),` `,v(`Stop`)]})]}),(0,R.jsx)(`div`,{role:`tablist`,className:`mb-5 flex rounded-2xl bg-surface-2/60 p-1`,children:C.map((e,t)=>(0,R.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":c===t,"aria-label":e.label,title:e.label,onClick:()=>l(t),className:i(`relative flex h-11 flex-1 items-center justify-center rounded-[13px] text-fg transition`,c===t&&`bg-surface shadow-sm`),children:[e.icon,e.badge?(0,R.jsx)(`span`,{className:`absolute right-1.5 top-1 flex h-[17px] min-w-[17px] items-center justify-center rounded-full bg-rose-500 px-1 text-[10px] font-bold text-white`,children:e.badge}):null]},e.label))}),c===0&&(0,R.jsx)(ym,{open:e}),c===1&&(0,R.jsxs)(R.Fragment,{children:[_>0&&(0,R.jsx)(cm,{onDone:()=>void 0}),(0,R.jsx)(bm,{open:e})]}),c===2&&(0,R.jsx)(lm,{onSettings:()=>y(`you`,`proactivity`)}),c===3&&(0,R.jsx)(om,{name:g,onEdit:()=>y(`you`,`who`),onMemory:()=>y(`memory`)}),(0,R.jsx)(qp,{open:f,onClose:()=>p(!1)})]})}function om({name:e,onEdit:t,onMemory:n}){let{state:r}=E(),i=s(),a=r.profile?.tagline?.trim()??``;return(0,R.jsxs)(`div`,{className:`pb-2`,children:[(0,R.jsx)(`div`,{className:`px-1 text-[15px]`,children:e}),(0,R.jsxs)(`button`,{type:`button`,onClick:t,className:`mt-2 flex h-[50px] w-full items-center justify-center gap-2 rounded-2xl bg-surface-2/70 text-[15px] font-medium hover:bg-surface-2`,children:[(0,R.jsx)(Ht,{size:18}),` `,i(`Edit`)]}),(0,R.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-3`,children:[(0,R.jsx)(sm,{title:`SOUL`,caption:i(`Handle with care`),foot:a,colors:`from-[#7d6bc7] to-[#574494]`,onClick:t}),(0,R.jsx)(sm,{title:i(`Memory`),caption:i(`Handle with care`),foot:r.settings?.memory_enabled===!1?i(`Off`):``,colors:`from-[#b0413e] to-[#7a1f1f]`,onClick:n})]})]})}function sm({title:e,caption:t,foot:n,colors:r,onClick:a}){return(0,R.jsxs)(`button`,{type:`button`,onClick:a,className:i(`flex h-[130px] flex-col items-start rounded-[18px] bg-gradient-to-b p-3.5 text-left text-white transition active:scale-[0.98]`,r),children:[(0,R.jsx)(`span`,{className:`text-[17px] font-semibold`,children:e}),(0,R.jsx)(`span`,{className:`mt-0.5 text-[11px] text-white/85`,children:t}),(0,R.jsx)(`span`,{className:`mt-auto text-[12px] text-white/90`,children:n})]})}function cm({onDone:e}){let{state:t,decide:n,openThread:r,toast:i}=E(),a=t.profile?.name??`nanoMuse`,o=s(),c=[...t.pendingApprovals].sort((e,t)=>e.ts.localeCompare(t.ts)),l=e=>{let n=t.threads.find(t=>t.id===e);return n?n.id===`main`?o(n.title):n.title:e};return(0,L.useEffect)(()=>{if(c.length===0){let t=window.setTimeout(e,600);return()=>window.clearTimeout(t)}},[c.length,e]),c.length===0?(0,R.jsxs)(`div`,{className:`py-10 text-center text-muted text-[14px]`,children:[(0,R.jsx)(ke,{size:26,className:`mx-auto mb-2 text-emerald-500`}),o(`Nothing is waiting for you.`)]}):(0,R.jsxs)(`div`,{className:`space-y-4 pb-2`,children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted`,children:o(`Actions {name} wants to take but cannot without you. Each one shows what will run and why; a permission you grant is bound to that exact tool and target.`,{name:a})}),c.map(e=>(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(e.thread),className:`mb-1 px-1 text-[12px] font-semibold uppercase tracking-wide text-muted hover:text-accent`,children:[l(e.thread),` · `,u(e.ts)]}),(0,R.jsx)(`div`,{className:`rounded-[22px] border border-border/70`,children:(0,R.jsx)(hp,{event:e,onDecide:(t,r)=>n(e.id,t,r).catch(e=>i(e.message))})})]},e.id))]})}function lm({onSettings:t}){let{state:n,refreshSettings:r,toast:a}=E(),[o,c]=(0,L.useState)(null),[l,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(null),m=n.profile?.name??`nanoMuse`,h=s(),g=()=>M.upcoming().then(e=>{c(e),d(null)}).catch(e=>o===null?d(e.message):a(e.message));(0,L.useEffect)(()=>{g()},[n.goalsVersion,n.remindersVersion,n.profile?.proactive,n.profile?.goal_interval_minutes]);let _=async()=>{try{await M.updateSettings({profile:{proactive:!n.profile?.proactive}}),await r()}catch(e){a(e.message)}},v=async e=>{p(e);try{await M.advanceGoal(e),a(h(`{name} is working on it in the main chat`,{name:m}))}catch(e){a(e.message)}finally{p(null)}};return o?(0,R.jsxs)(`div`,{className:`space-y-4 pb-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-2xl border border-border p-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-medium`,children:h(`Background work`)}),(0,R.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:o.proactive?`${h(o.proactivity[0].toUpperCase()+o.proactivity.slice(1))} · ${h(`every {n} min {name} picks one active goal and works on its next step.`,{n:o.effective_interval_minutes,name:m})}${o.quiet_until?` ${h(`Quiet hours until {time}.`,{time:u(o.quiet_until)})}`:o.next_pass_at?` ${h(`Next around {time}.`,{time:u(o.next_pass_at)})}`:``}`:h(`Off. {name} only works when you ask.`,{name:m})})]}),(0,R.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o.proactive,onClick:()=>void _(),className:i(`relative h-7 w-12 shrink-0 rounded-full transition`,o.proactive?`bg-accent`:`bg-border`),children:(0,R.jsx)(`span`,{className:i(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,o.proactive?`left-[26px]`:`left-0.5`)})})]}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`mt-2 text-[12.5px] text-accent font-medium`,children:h(`Level, interval and quiet hours in Settings`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:h(`In line`)}),o.queue.length===0?(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:h(`No active goal has a next step. Add one in Goals and {name} will pick it up.`,{name:m})}):(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:o.queue.map((e,t)=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`w-5 text-center text-[12px] font-semibold text-muted`,children:t+1}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:e.title}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[e.next_step??`—`,` · `,h(`{done}/{total} done`,{done:e.progress.done,total:e.progress.total})]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void v(e.goal_id),disabled:f!==null||o.busy,"aria-label":h(`Work on {title} now`,{title:e.title}),className:`rounded-full bg-accent/12 p-2 text-accent disabled:opacity-50`,children:f===e.goal_id?(0,R.jsx)(A,{size:15,className:`animate-spin`}):(0,R.jsx)(Gt,{size:15})})]},e.goal_id))})]}),o.check_ins.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:h(`Check-ins`)}),(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:o.check_ins.map(t=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(Xe,{size:15,className:`text-muted shrink-0`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:t.title}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[e(t.at),` · `,u(t.at),` · `,nm(t.cadence).toLowerCase()]})]})]},t.goal_id))}),(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:h(`Goal nudges you asked for; they arrive whatever the proactivity level, but wait out quiet hours.`)})]}),(0,R.jsx)(um,{items:o.reminders,name:m,onChange:()=>void g()}),(0,R.jsx)(mm,{data:o.triggers,name:m,onChange:()=>void g()})]}):l?(0,R.jsx)(Jp,{message:l,onRetry:()=>void g()}):(0,R.jsx)(`div`,{className:`py-10 flex justify-center text-muted`,children:(0,R.jsx)(A,{className:`animate-spin`,size:20})})}function um({items:t,name:n,onChange:r}){let{toast:i}=E(),a=s(),[o,c]=(0,L.useState)(null),[l,d]=(0,L.useState)(!1),f=t.filter(e=>e.status===`active`),p=t.filter(e=>e.status!==`active`),m=async e=>{c(e.id);try{await M.cancelReminder(e.id),r()}catch(e){i(e.message)}finally{c(null)}},h=async e=>{c(e.id);try{await M.fireReminder(e.id),i(e.kind===`task`?a(`{name} is on it`,{name:n}):a(`{name} will say it now`,{name:n})),r()}catch(e){i(e.message)}finally{c(null)}};return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold`,children:a(`Reminders & routines`)}),!l&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:`text-[12.5px] text-accent font-medium`,children:a(`+ Add`)})]}),l&&(0,R.jsx)(dm,{onDone:()=>{d(!1),r()},onCancel:()=>d(!1)}),f.length===0&&!l?(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:a(`Nothing scheduled. Tell {name} “remind me at six to call mum” or “every weekday morning, summarise my unread email”.`,{name:n})}):(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:f.map(t=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[t.kind===`task`?(0,R.jsx)(Kt,{size:15,className:`text-muted shrink-0`}):(0,R.jsx)(We,{size:15,className:`text-muted shrink-0`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:t.text}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted truncate`,children:[t.next_at?`${e(t.next_at)} · ${u(t.next_at)}`:`—`,t.repeat&&` · ${nm(t.repeat).toLowerCase()}`,t.kind===`task`&&` · ${a(`does the work`)}`]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void h(t),disabled:o!==null,"aria-label":t.kind===`task`?a(`Do “{text}” now`,{text:t.text}):a(`Remind me now: {text}`,{text:t.text}),className:`rounded-full bg-accent/12 p-2 text-accent disabled:opacity-50`,children:o===t.id?(0,R.jsx)(A,{size:15,className:`animate-spin`}):(0,R.jsx)(Gt,{size:15})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(t),disabled:o!==null,"aria-label":a(`Cancel: {text}`,{text:t.text}),className:`rounded-full p-2 text-muted hover:text-fg disabled:opacity-50`,children:(0,R.jsx)(Fe,{size:15})})]},t.id))}),p.length>0&&(0,R.jsxs)(`details`,{className:`mt-2`,children:[(0,R.jsx)(`summary`,{className:`text-[12px] text-muted cursor-pointer select-none`,children:a(`{n} finished recently`,{n:p.length})}),(0,R.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:p.map(t=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2 px-3 text-[12.5px] text-muted`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate line-through decoration-border`,children:t.text}),(0,R.jsx)(`span`,{className:`shrink-0`,children:t.status===`done`?t.last_fired_at?e(t.last_fired_at):a(`done`):a(`cancelled`)})]},t.id))})]}),(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:a(`A time you named is kept whatever the level or the quiet hours. Reminders just say it; routines do the work and report.`)})]})}function dm({onDone:e,onCancel:t}){let{toast:n}=E(),r=s(),[a,o]=(0,L.useState)(``),[c,l]=(0,L.useState)(`remind`),[u,d]=(0,L.useState)(`once`),[f,p]=(0,L.useState)(()=>_m()),[h,g]=(0,L.useState)(`daily`),[_,v]=(0,L.useState)(`09:00`),[y,b]=(0,L.useState)(`mon`),[x,S]=(0,L.useState)(`1`),[C,w]=(0,L.useState)(!1),T=h===`weekly`?`weekly ${y} ${_}`:h===`monthly`?`monthly ${x} ${_}`:`${h} ${_}`,D=async()=>{if(a.trim()){w(!0);try{await M.createReminder(u===`once`?{text:a.trim(),kind:c,at:f.replace(`T`,` `)}:{text:a.trim(),kind:c,repeat:T}),e()}catch(e){n(e.message)}finally{w(!1)}}},O=`h-9 rounded-xl bg-surface border border-border px-3 text-[13px] outline-none focus:border-accent`;return(0,R.jsxs)(`div`,{className:`mb-2 rounded-2xl border border-border p-3 space-y-2`,children:[(0,R.jsx)(`input`,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:r(c===`task`?`What should be done…`:`What to remind you of…`),className:i(O,`w-full h-10 text-[14px]`)}),(0,R.jsxs)(`div`,{className:`flex gap-1.5 text-[12.5px]`,children:[(0,R.jsx)(gm,{options:[[`remind`,r(`Remind me`)],[`task`,r(`Do it for me`)]],value:c,onChange:e=>l(e)}),(0,R.jsx)(gm,{options:[[`once`,r(`Once`)],[`repeat`,r(`Repeat`)]],value:u,onChange:e=>d(e)})]}),u===`once`?(0,R.jsx)(`input`,{type:`datetime-local`,value:f,onChange:e=>p(e.target.value),className:i(O,`w-full`)}):(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,R.jsxs)(`select`,{value:h,onChange:e=>g(e.target.value),className:O,children:[(0,R.jsx)(`option`,{value:`daily`,children:r(`Every day`)}),(0,R.jsx)(`option`,{value:`weekdays`,children:r(`Weekdays`)}),(0,R.jsx)(`option`,{value:`weekly`,children:r(`Weekly`)}),(0,R.jsx)(`option`,{value:`monthly`,children:r(`Monthly`)})]}),h===`weekly`&&(0,R.jsx)(`select`,{value:y,onChange:e=>b(e.target.value),className:O,children:[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`].map((e,t)=>(0,R.jsx)(`option`,{value:e,children:new Date(2024,0,1+t).toLocaleDateString(m(),{weekday:`long`})},e))}),h===`monthly`&&(0,R.jsx)(`select`,{value:x,onChange:e=>S(e.target.value),className:O,children:Array.from({length:28},(e,t)=>String(t+1)).map(e=>(0,R.jsx)(`option`,{value:e,children:r(`Day {d}`,{d:e})},e))}),(0,R.jsx)(`input`,{type:`time`,value:_,onChange:e=>v(e.target.value),className:O})]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2 pt-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-full px-3 py-1.5 text-[13px] text-muted`,children:r(`Cancel`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void D(),disabled:C||!a.trim(),className:`rounded-full bg-accent px-3.5 py-1.5 text-[13px] font-medium text-accent-fg disabled:opacity-50`,children:r(C?`Saving…`:u===`once`?`Set reminder`:`Set routine`)})]})]})}var fm={mail:Et,event:et,hook:_n};function pm(e,t){if(e.kind===`mail`)return e.match?t(`mail matching “{match}”`,{match:e.match}):t(`any new mail`);if(e.kind===`event`){let n=e.match?t(`events matching “{match}”`,{match:e.match}):t(`any event`);return t(`{n} min before {what}`,{n:e.lead_minutes,what:n})}return e.match?t(`webhook “{match}”`,{match:e.match}):t(`webhook`)}function mm({data:t,name:n,onChange:r}){let{toast:a}=E(),o=s(),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(!1),f=t.items.filter(e=>e.status===`active`),p=f.some(e=>e.kind===`mail`),m=async e=>{l(e.id);try{await M.cancelTrigger(e.id),r()}catch(e){a(e.message)}finally{l(null)}},h=async e=>{l(e.id);try{await M.fireTrigger(e.id),a(o(`{name} is on it`,{name:n})),r()}catch(e){a(e.message)}finally{l(null)}},g=async e=>{if(e.url)try{await navigator.clipboard.writeText(e.url),a(o(`Webhook URL copied`))}catch{a(e.url)}};return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold`,children:o(`When something happens`)}),!u&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:`text-[12.5px] text-accent font-medium`,children:o(`+ Add`)})]}),u&&(0,R.jsx)(hm,{available:t.available,onDone:()=>{d(!1),r()},onCancel:()=>d(!1)}),f.length===0&&!u?(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:o(`Nothing yet. Tell {name} “when the landlord writes back, summarise it and draft a reply” or “half an hour before any review, brief me”.`,{name:n})}):(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:f.map(t=>{let n=fm[t.kind];return(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(n,{size:15,className:`text-muted shrink-0 mt-[3px]`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:pm(t,o)}),(0,R.jsx)(`div`,{className:`text-[12px] leading-snug text-fg/80 line-clamp-2`,children:t.text}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted flex flex-wrap items-center gap-x-1.5`,children:[t.fired>0?(0,R.jsxs)(`span`,{children:[o(`fired {n}×`,{n:t.fired}),t.last_fired_at&&` · ${e(t.last_fired_at)}`]}):(0,R.jsx)(`span`,{children:o(`not fired yet`)}),t.kind===`hook`&&t.url&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void g(t),className:`inline-flex items-center gap-1 text-accent font-medium`,children:[(0,R.jsx)(ut,{size:11}),` `,o(`Copy URL`)]})]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void h(t),disabled:c!==null,"aria-label":o(`Run now: {text}`,{text:t.text}),className:`rounded-full bg-accent/12 p-2 text-accent disabled:opacity-50`,children:c===t.id?(0,R.jsx)(A,{size:15,className:`animate-spin`}):(0,R.jsx)(Gt,{size:15})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(t),disabled:c!==null,"aria-label":o(`Cancel: {text}`,{text:t.text}),className:`rounded-full p-2 text-muted hover:text-fg disabled:opacity-50`,children:(0,R.jsx)(Fe,{size:15})})]},t.id)})}),p&&(0,R.jsx)(`div`,{className:i(`mt-1.5 text-[12px]`,t.mail_error?`text-rose-500`:`text-muted`),children:t.mail_error?o(`The inbox could not be read: {error}`,{error:t.mail_error}):t.mail_checked_at?o(`Inbox checked {when}; {name} looks every {n} min.`,{when:e(t.mail_checked_at),name:n,n:t.mail_poll_minutes}):o(`{name} will look at the inbox shortly, then every {n} min.`,{name:n,n:t.mail_poll_minutes})}),(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-muted`,children:o(`Each time it happens {name} does the work in the chat it was set from and reports in the Feed. A mail or a request is treated as data, never as instructions.`,{name:n})})]})}function hm({available:e,onDone:t,onCancel:n}){let{toast:r}=E(),a=s(),o=[`mail`,`event`,`hook`].find(t=>e[t])??`hook`,[c,l]=(0,L.useState)(o),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(`30`),[m,h]=(0,L.useState)(``),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(null),b=async()=>{if(m.trim()){_(!0);try{let e=await M.createTrigger({kind:c,text:m.trim(),match:u.trim(),lead_minutes:Number(f)||30});e.kind===`hook`&&e.url?y(e):t()}catch(e){r(e.message)}finally{_(!1)}}},x=`h-9 rounded-xl bg-surface border border-border px-3 text-[13px] outline-none focus:border-accent`;if(v)return(0,R.jsxs)(`div`,{className:`mb-2 rounded-2xl border border-border p-3 space-y-2`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:a(`Webhook ready`)}),(0,R.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:a(`POST anything to this URL and the work starts. The key is in the URL; share it only with the program that will call it.`)}),(0,R.jsx)(`code`,{className:`block break-all rounded-xl bg-surface-2 px-3 py-2 text-[12px]`,children:v.url}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2 pt-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void navigator.clipboard.writeText(v.url??``).then(()=>r(a(`Webhook URL copied`)),()=>r(v.url??``)),className:`rounded-full px-3 py-1.5 text-[13px] text-accent font-medium`,children:a(`Copy`)}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-full bg-accent px-3.5 py-1.5 text-[13px] font-medium text-accent-fg`,children:a(`Done`)})]})]});let S=[[`mail`,a(`New mail`)],[`event`,a(`Before an event`)],[`hook`,a(`Webhook`)]];return(0,R.jsxs)(`div`,{className:`mb-2 rounded-2xl border border-border p-3 space-y-2`,children:[(0,R.jsx)(gm,{options:S,value:c,onChange:e=>l(e)}),!e[c]&&(0,R.jsx)(`div`,{className:`text-[12.5px] text-rose-500`,children:a(c===`mail`?`Connect a mailbox under Connections first.`:`Add a calendar under Connections first.`)}),(0,R.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,R.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:a(c===`mail`?`Words in the sender or subject (empty: any mail)`:c===`event`?`Words in the title or place (empty: any event)`:`A name for this hook`),className:i(x,`min-w-0 flex-1`)}),c===`event`&&(0,R.jsxs)(`label`,{className:`flex items-center gap-1 text-[12.5px] text-muted`,children:[(0,R.jsx)(`input`,{type:`number`,min:0,max:1440,value:f,onChange:e=>p(e.target.value),className:i(x,`w-[64px] px-2`),"aria-label":a(`Minutes before`)}),a(`min before`)]})]}),(0,R.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:a(`What should be done each time…`),className:i(x,`w-full h-10 text-[14px]`)}),(0,R.jsx)(`div`,{className:`text-[12px] text-muted`,children:a(`When {condition}`,{condition:pm({kind:c,match:u.trim(),lead_minutes:Number(f)||30},a)})}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2 pt-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-full px-3 py-1.5 text-[13px] text-muted`,children:a(`Cancel`)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void b(),disabled:g||!m.trim()||!e[c],className:`rounded-full bg-accent px-3.5 py-1.5 text-[13px] font-medium text-accent-fg disabled:opacity-50`,children:a(g?`Saving…`:`Set trigger`)})]})]})}function gm({options:e,value:t,onChange:n}){return(0,R.jsx)(`div`,{className:`flex rounded-full bg-surface-2 p-0.5`,children:e.map(([e,r])=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:i(`rounded-full px-2.5 py-1 transition`,t===e?`bg-surface shadow-sm font-medium`:`text-muted`),children:r},e))})}function _m(){let e=new Date(Date.now()+36e5);e.setMinutes(0,0,0);let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`}function vm(e){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null),a=async()=>{try{n(await M.activity(150)),i(null)}catch(e){i(e.message||`Could not load.`)}};return(0,L.useEffect)(()=>{if(!e)return;a();let t=window.setInterval(()=>void a(),4e3);return()=>window.clearInterval(t)},[e]),[t,a,r]}function ym({open:e}){let[t,n,r]=vm(e),{state:i}=E(),a=s(),o=i.profile?.name??`nanoMuse`,c=(t?.audit??[]).filter(e=>e.event===`tool_call`).reverse(),l=c.filter(e=>e.channel===`gui`).length;return(0,R.jsxs)(`div`,{className:`pb-2`,children:[(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted mb-2`,children:a(`Every tool call goes through the Sentinel and is written to the audit log, including the ones it refused.`)}),l>0&&(0,R.jsx)(`p`,{className:`text-[12.5px] text-muted mb-2`,children:a(`On the phone's screen: {gui} of {total} steps ({pct}%). The screen is the last resort; a skill, a fetch or the browser comes first.`,{gui:String(l),total:String(c.length),pct:String(Math.round(l/c.length*100))})}),!t&&r&&(0,R.jsx)(Jp,{message:r,onRetry:()=>void n()}),!t&&!r&&(0,R.jsx)(`div`,{className:`py-10 flex justify-center text-muted`,children:(0,R.jsx)(A,{className:`animate-spin`,size:20})}),t&&c.length===0&&(0,R.jsx)(`div`,{className:`py-8 text-center text-muted text-[14px]`,children:a(`Nothing yet today. What you ask for and what {name} does about it shows up here.`,{name:o})}),(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:c.map((e,t)=>(0,R.jsx)(Tm,{entry:e},`${e.ts}-${t}`))})]})}function bm({open:e}){let{state:t,toast:n}=E(),r=s(),[i,a]=vm(e),o=async()=>{if(window.confirm(r(`Forget every permission you granted? {name} will ask again next time.`,{name:t.profile?.name??`nanoMuse`})))try{await M.resetApprovals(),await a(),n(r(`Permissions reset`))}catch(e){n(e.message)}},c=async e=>{try{await M.revokeGrant(e.key),await a(),n(r(`Revoked: {subject}`,{subject:pp(e.tool,e.target)}))}catch(e){n(e.message)}},l=t.settings?.sentinel.mode;return(0,R.jsxs)(`div`,{className:`space-y-4 pb-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-2xl border border-border p-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,R.jsx)(Qt,{size:18,className:`text-accent`}),` `,r(`Sentinel mode:`),` `,(0,R.jsx)(`span`,{className:`capitalize`,children:l===`ask`?r(`balanced`):l===`strict`?r(`cautious`):l===`auto`?r(`hands-off`):l})]}),(0,R.jsxs)(`p`,{className:`mt-1 text-[12.5px] text-muted`,children:[l===`ask`&&r(`Safe and moderate actions run freely; anything sensitive (email, shell, purchases) waits for you.`),l===`strict`&&r(`Moderate and sensitive actions both wait for your approval.`),l===`auto`&&r(`Everything is approved automatically except explicit deny rules. Use with care.`)]}),i?.tainted&&(0,R.jsxs)(`p`,{className:`mt-2 text-[12.5px] text-amber-600 dark:text-amber-300 flex items-center gap-1.5`,children:[(0,R.jsx)($t,{size:14}),` `,r(`Private data was read this session: network calls to new destinations need approval.`)]})]}),(0,R.jsx)(Cm,{grants:i?.grants??[],onRevoke:c}),(0,R.jsx)(wm,{title:r(`Always ask (from config)`),tools:t.settings?.sentinel.always_ask_tools??[],muted:!0}),(i?.grants.length??0)>0&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>void o(),className:`w-full rounded-2xl border border-border py-2.5 text-[14px] font-medium`,children:r(`Reset all granted permissions`)})]})}function xm(e,t){switch(e.scope){case`conversation`:return t(`for this conversation`);case`session`:return t(`until restart`);case`24h`:return e.expires_at?t(`until {time}`,{time:u(e.expires_at)}):t(`for 24 hours`);case`always`:return t(`always`);default:return e.scope}}var Sm=[`sensitive`,`moderate`,`low`,`safe`];function Cm({grants:e,onRevoke:t}){let n=s(),{state:r}=E(),i=e=>r.settings?.tools.find(t=>t.name===e)?.risk??`moderate`,a=Sm.map(t=>({risk:t,rows:e.filter(e=>i(e.tool)===t)})).filter(e=>e.rows.length>0);return(0,R.jsx)(`div`,{className:`space-y-3`,children:e.length===0?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:n(`Permissions you granted`)}),(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:n(`No standing approvals. When you answer “always allow” to a risky step, it is listed here and can be revoked; approvals you give once are not kept.`)})]}):a.map((e,r)=>(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:[r===0?`${n(`Permissions you granted`)} · `:``,n(e.risk)]}),(0,R.jsx)(`ul`,{className:`space-y-1.5`,children:e.rows.map(e=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`text-accent`,children:sp(e.tool,15)}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[13.5px] font-medium truncate`,children:pp(e.tool,e.target)}),(0,R.jsxs)(`div`,{className:`text-[11.5px] text-muted`,children:[e.tool,` · `,xm(e,n),` · `,n(`granted {time}`,{time:u(e.granted_at)})]})]}),(0,R.jsx)(`button`,{type:`button`,"aria-label":n(`Revoke {what}`,{what:mp(e.scope,e.tool,e.target)}),onClick:()=>t(e),className:`rounded-full p-1.5 text-muted hover:bg-surface active:scale-95`,children:(0,R.jsx)(Fe,{size:15})})]},e.key))})]},e.risk))})}function wm({title:e,tools:t,muted:n}){let r=s();return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[12px] uppercase tracking-wide text-muted font-semibold mb-1.5`,children:e}),t.length===0?(0,R.jsx)(`div`,{className:`text-[13px] text-muted`,children:r(`None`)}):(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,R.jsxs)(`span`,{className:i(`rounded-full px-2.5 py-1 text-[12.5px] flex items-center gap-1`,n?`bg-surface-2 text-muted`:`bg-accent/12 text-accent`),children:[sp(e,12),` `,e]},e))})]})}function Tm({entry:e}){let t=s(),n=e.decision===`deny`,r=e.ok===!1&&!n;return(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 rounded-2xl bg-surface-2/60 px-3 py-2`,children:[(0,R.jsx)(`div`,{className:i(`mt-0.5`,n?`text-rose-500`:r?`text-amber-500`:`text-muted`),children:n||r?(0,R.jsx)(Ye,{size:15}):(0,R.jsx)(ke,{size:15})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[13.5px]`,children:[(0,R.jsx)(`span`,{className:`text-muted`,children:sp(e.tool??``,13)}),(0,R.jsx)(`span`,{className:`font-medium truncate`,children:e.summary||e.tool})]}),(0,R.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11.5px] text-muted`,children:[(0,R.jsx)(`span`,{children:u(e.ts)}),e.risk&&(0,R.jsx)(up,{risk:e.risk}),e.approved===!0&&(0,R.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-300`,children:[t(`approved by you`),e.approval_scope&&e.approval_scope!==`once`?` (${e.approval_scope})`:``]}),e.approved==null&&e.approval_scope&&e.approval_scope!==`once`&&(0,R.jsx)(`span`,{className:`text-emerald-600 dark:text-emerald-300`,children:t(`covered by your {scope} permission`,{scope:e.approval_scope})}),n&&(0,R.jsx)(`span`,{className:`text-rose-500`,children:t(`blocked`)}),r&&(0,R.jsx)(`span`,{className:`text-amber-600`,children:t(`failed`)}),typeof e.duration_ms==`number`&&(0,R.jsxs)(`span`,{children:[(e.duration_ms/1e3).toFixed(1),`s`]})]}),n&&e.reasons&&e.reasons.length>0&&(0,R.jsx)(`div`,{className:`mt-0.5 text-[12px] text-muted`,children:e.reasons.map(v).join(` · `)})]})]})}function Em({title:e,actions:t=[],trailing:n,children:r}){let{state:i,setDrawer:a}=E(),o=s(),[c,l]=(0,L.useState)(!1),u=i.profile?.name||`nanoMuse`,d=i.pendingApprovals.length,f=d>0?d>1?o(`{n} approvals waiting for you`,{n:d}):o(`1 approval waiting for you`):i.status.state===`working`?i.status.detail||o(`On it`):i.status.state===`waiting`?o(`Waiting for you`):null;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ne,{profile:i.profile,status:i.status,name:u,statusLine:f,statusTone:f?`accent`:`muted`,spinning:i.status.state===`working`&&d===0,badge:d,onAvatar:()=>l(!0),leading:(0,R.jsx)(te,{onClick:()=>a(!0),label:o(`Chats`),className:`wide:invisible`,children:(0,R.jsx)(Ot,{size:22})}),trailing:n??(0,R.jsx)(Dm,{actions:t})}),(e||r)&&(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 pr-5`,children:[(0,R.jsx)(k,{className:`flex-1`,children:e}),r]}),(0,R.jsx)(am,{open:c,onClose:()=>l(!1)})]})}function Dm({actions:e=[]}){let{setTab:t}=E(),n=s(),[r,i]=(0,L.useState)(!1),a=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!r)return;let e=e=>{a.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&i(!1)};return window.addEventListener(`pointerdown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`pointerdown`,e),window.removeEventListener(`keydown`,t)}},[r]);let o=e=>{i(!1),t(e)},c=[...e.map(e=>({label:e.label,onClick:()=>{i(!1),e.onClick()}})),{label:n(`Memory`),onClick:()=>o(`memory`)},{label:n(`Settings`),onClick:()=>o(`you`)}];return(0,R.jsxs)(`div`,{ref:a,className:`relative`,children:[(0,R.jsx)(te,{onClick:()=>i(e=>!e),label:n(`More`),expanded:r,children:(0,R.jsx)(pt,{size:22})}),r&&(0,R.jsx)(`ul`,{role:`menu`,className:`absolute right-0 top-12 z-30 min-w-[180px] overflow-hidden rounded-2xl border border-border bg-surface py-1 shadow-xl`,children:c.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:e.onClick,className:`w-full px-4 py-2.5 text-left text-[14.5px] hover:bg-surface-2`,children:e.label})},e.label))})]})}var Om=`nanomuse-naming`;function km(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Am(e,t,n=!1){let r="```"+t,i=e;if(i.includes(r)){let e=RegExp("```"+km(t)+"[ \\t]*\\r?\\n[\\s\\S]*?```",`g`);i=i.replace(e,``);let n=i.lastIndexOf(r);n>=0&&(i=i.slice(0,n))}if(n){let e=i.lastIndexOf("```");e>=0&&r.startsWith(i.slice(e))&&(i=i.slice(0,e))}return i===e?e:i.replace(/\s+$/,``)}function jm(e,t=!1){return Am(e,Om,t)}function Mm(e){return e.filter(e=>!e.this&&e.kind!==`web`&&e.name.trim()!==``)}function Nm(e){let t=/^@([^\s,:;,:;]*)$/.exec(e);return t?t[1]:null}function Pm(e,t,n=6){let r=Nm(e);if(r===null)return[];let i=r.toLowerCase();return Mm(t).filter(e=>e.name.toLowerCase().startsWith(i)).sort((e,t)=>Number(t.online)-Number(e.online)||e.name.localeCompare(t.name)).slice(0,n)}function Fm(e,t){let n=e.trimStart();if(!n.startsWith(`@`))return null;let r=n.slice(1),i=r.toLowerCase(),a=Mm(t),o=a.filter(e=>{let t=e.name.trim().toLowerCase();if(!i.startsWith(t))return!1;let n=r.charAt(t.length);return n===``||/[\s,:;,:;]/.test(n)}).sort((e,t)=>t.name.length-e.name.length);if(o[0])return o[0];let s=/^[^\s,:;,:;]+/.exec(r)?.[0]?.toLowerCase()??``;if(!s)return null;let c=a.filter(e=>e.name.trim().toLowerCase().startsWith(s));if(c.length===1)return c[0];let l=c.filter(e=>e.online);return l.length===1?l[0]:null}var Im=`nm.show_steps`;function Lm(){try{return localStorage.getItem(Im)!==`0`}catch{return!0}}var Rm=Lm(),zm=new Set;function Bm(){return Rm}function Vm(e){Rm=e;try{localStorage.setItem(Im,e?`1`:`0`)}catch{}zm.forEach(e=>e())}function Hm(e){return zm.add(e),()=>zm.delete(e)}function Um(){return(0,L.useSyncExternalStore)(Hm,Bm,Bm)}function Wm(){let{state:e,send:t,sendViaCloud:n,decide:r,loadEvents:i,openFile:a,toast:o,setDrawer:c,setTab:l}=E(),u=s(),{profile:d,status:f,activeThread:p,threads:m}=e,h=e.events[p],g=(0,L.useMemo)(()=>h??[],[h]),_=h!==void 0,v=e.streams[p],b=m.find(e=>e.id===p),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null),T=d?.name??`nanoMuse`,D=b?.device?e.hub?.devices.find(e=>e.id===b.device)?.online??null:null,O=nh(e.working[p]),k=(0,L.useRef)(null),ee=(0,L.useRef)(null),A=(0,L.useRef)(!0),[j,re]=(0,L.useState)(!1),N=e.firstrun,P=!!N&&N.phase!==`none`&&N.session_id===p,ie=P&&N.running,ae=y()===`zh-CN`?`zh`:`en`,[oe,se]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(!P||oe?.lang===ae)return;let e=!0;return M.firstrun(ae).then(t=>e&&t.intro&&se({lang:ae,lines:t.intro})).catch(()=>void 0),()=>{e=!1}},[P,ae,oe?.lang]);let ce=e=>{M.firstrunPick(e).then(()=>t(p,e)).catch(e=>o(e.message||u(`Could not send`)))},le=()=>window.dispatchEvent(new Event(`nanomuse:quick-chat`)),[ue,de]=(0,L.useState)(null),fe=e.settings?.onboarded===!0,pe=(0,L.useRef)(!1),me=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(b?.busy){pe.current||(me.current=ie),pe.current=!0;return}pe.current&&(pe.current=!1,fe&&!me.current&&!ie&&ch(g)&&de(Se()))},[b?.busy,g,fe,ie]);let[he,ge]=(0,L.useState)(null);(0,L.useEffect)(()=>{let{days:e,fresh:t}=ye();t&&ge(e)},[]);let _e=(0,L.useCallback)(()=>{let e=k.current;e&&(e.scrollTop=e.scrollHeight,re(!1))},[]),ve=(0,L.useCallback)(()=>{let e=k.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;A.current=t<120,re(t>400)},[]),be=(0,L.useRef)(null);(0,L.useLayoutEffect)(()=>{be.current!==p&&(be.current=p,A.current=!0),A.current&&_e()},[g,v?.text,p,_e]),(0,L.useEffect)(()=>{let e=k.current,t=ee.current;if(!e||!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>{A.current?_e():ve()});return n.observe(e),n.observe(t),()=>n.disconnect()},[_e,ve]);let xe=()=>{let e=k.current;e&&e.scrollTo({top:e.scrollHeight,behavior:`smooth`})},Ce=e.pendingApprovals.length,Te=e.pendingApprovals.filter(e=>e.thread===p).length,Ee=(0,L.useMemo)(()=>{let e=!f.thread||f.thread===p;if(Te>0&&!(e&&f.state===`working`))return Te>1?u(`{n} approvals waiting for you`,{n:Te}):u(`1 approval waiting for you`);if(!e)return b?.busy?u(`On it`):void 0;if(f.state===`idle`&&!b?.busy)return;if(f.detail)return f.detail;if(f.state===`waiting`)return u(`Waiting for you`);let t=sh(g);return t?u(`On it: {request}`,{request:t}):u(`On it`)},[f,b,p,Te,g,u]),De=g.filter(e=>e.type===`approval`&&e.status===`pending`).length,Oe=Um(),ke=(0,L.useMemo)(()=>Oe?g:g.filter(e=>e.type!==`tool`),[g,Oe]),Ae={signedIn:!!e.hub?.account.signed_in,chatOnCloud:!!e.settings?.llm.cloud,deviceChat:!!b?.device},je=e=>{let t=ep(ke,e,Ae);return t?()=>n(p,t.text,t.files):void 0},Ne=(0,L.useMemo)(()=>Array.from(new Set(g.flatMap(e=>e.type===`artifact`?[e.path]:[]))),[g]);return(0,R.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,R.jsx)(ne,{profile:d,status:f,name:T,statusLine:Ee,statusTone:f.state===`idle`&&!b?.busy?`muted`:`accent`,spinning:(f.state===`working`&&f.thread===p||!!b?.busy)&&Te===0,badge:Ce,onAvatar:()=>S(!0),leading:(0,R.jsx)(te,{onClick:()=>c(!0),label:u(`Chats`),dot:m.length>1&&p!==`main`,className:`wide:invisible`,children:(0,R.jsx)(Ot,{size:22})}),trailing:(0,R.jsx)(Dm,{actions:[{label:u(`Coding agents`),onClick:()=>l(`coding`)}]}),under:b&&b.id!==`main`?b.device?(0,R.jsxs)(`span`,{className:`flex max-w-full items-center gap-1 rounded-full bg-accent/12 px-2.5 py-0.5 text-[11.5px] font-medium text-accent`,children:[D===!1?(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-border`}):(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-500`}),(0,R.jsx)(`span`,{className:`truncate`,children:u(`on {device}`,{device:b.device_name||b.device})})]}):b.remote_from?(0,R.jsxs)(`span`,{className:`flex max-w-full items-center gap-1 rounded-full bg-surface-2 px-2.5 py-0.5 text-[11.5px] font-medium text-fg/80`,children:[(0,R.jsx)(It,{size:11}),` `,(0,R.jsx)(`span`,{className:`truncate`,children:u(`from {device}`,{device:b.remote_from.name})})]}):(0,R.jsx)(`span`,{className:`truncate rounded-full bg-surface-2 px-2.5 py-0.5 text-[11.5px] font-medium text-fg/80`,children:b.title}):void 0}),(0,R.jsxs)(`div`,{ref:k,onScroll:ve,className:`relative flex-1 overflow-y-auto px-3 py-3`,children:[(0,R.jsxs)(`div`,{ref:ee,className:`space-y-2.5`,children:[e.hasMore[p]&&g.length>0&&(0,R.jsx)(`div`,{className:`flex justify-center`,children:(0,R.jsx)(`button`,{type:`button`,className:`text-[12.5px] text-accent px-3 py-1 rounded-full bg-surface-2`,onClick:()=>void i(p,g[0]?.id),children:u(`Load earlier messages`)})}),P&&_&&!e.hasMore[p]&&oe&&(0,R.jsx)(Fp,{lines:oe.lines}),_&&g.length===0&&!v&&!P&&(0,R.jsx)(ih,{name:T,device:b?.device?b.device_name||b.device:void 0,onSend:e=>t(p,e).catch(e=>o(e.message||u(`Could not send`)))}),ke.map((e,t)=>(0,R.jsx)(Gm,{event:e,prev:ke[t-1],name:T,onDecide:(t,n)=>r(e.id,t,n).catch(e=>o(e.message||u(`Could not send decision`))),onOpenFile:a,onOpenBrowser:w,files:Ne,onCloudRetry:je(t)},e.id)),v&&v.text&&(0,R.jsx)($m,{text:v.text,streaming:!0,files:Ne,onOpenFile:a}),(b?.busy||f.state!==`idle`)&&!v?.text&&f.state!==`waiting`&&(0,R.jsx)(th,{label:b?.queued?u(`{n} queued`,{n:b.queued}):void 0}),P&&N.phase===`ask_agent_name`&&!b?.busy&&(0,R.jsx)(Ip,{chips:N.chips,chosen:N.chosen,onPick:ce,onElse:le}),O&&!b?.busy&&(0,R.jsx)(rh,{who:O}),!b?.busy&&f.state===`idle`&&ue!==null&&(0,R.jsx)(we,{moment:`tasks`,n:ue,className:`mx-1 my-2`}),!b?.busy&&f.state===`idle`&&he!==null&&(0,R.jsx)(we,{moment:`days_used`,n:he,className:`mx-1 my-2`})]}),j&&(0,R.jsxs)(`button`,{type:`button`,onClick:xe,className:`sticky bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-surface border border-border shadow px-3 py-1.5 text-[12.5px] flex items-center gap-1`,children:[(0,R.jsx)(Me,{size:14}),` `,u(`Latest`),De?` · ${u(`{n} approval`,{n:De})}`:``]})]}),(0,R.jsx)(Rf,{}),(0,R.jsx)(ah,{name:T,busy:!!b?.busy&&De===0,waiting:g.some(e=>e.type===`question`&&e.status===`pending`),onSend:(e,n)=>t(p,e,n).catch(e=>{throw o(e.message||u(`Could not send`)),e})}),(0,R.jsx)(am,{open:x,onClose:()=>S(!1)}),C&&(0,R.jsx)(Ap,{thread:p,eventId:C,onClose:()=>w(null)})]})}function Gm({event:e,prev:t,name:n,onDecide:r,onOpenFile:i,onOpenBrowser:a,files:o,onCloudRetry:s}){let c=qm(t,e)?(0,R.jsx)(Jm,{ts:e.ts}):null,l=(()=>{switch(e.type){case`user`:return(0,R.jsx)(Ym,{event:e,onOpenFile:i});case`assistant`:return e.quiet?(0,R.jsx)(eh,{text:e.text,about:e.about,ts:e.ts}):(0,R.jsx)($m,{text:e.text,reasoning:e.reasoning,continued:t?.type===`assistant`,files:o,onOpenFile:i,spoken:e.via===`call`,modelUsed:e.model_used});case`tool`:return(0,R.jsx)(fp,{event:e});case`approval`:return(0,R.jsx)(hp,{event:e,name:n,onDecide:r});case`question`:return(0,R.jsx)(gp,{event:e,name:n});case`notice`:return(0,R.jsx)(vp,{event:e,onCloudRetry:s});case`artifact`:return(0,R.jsx)(Ep,{event:e,onOpen:i});case`browser`:return(0,R.jsx)(yp,{event:e,onOpen:a});case`hands`:return(0,R.jsx)(bp,{event:e,name:n});case`hold`:return(0,R.jsx)(wp,{event:e,name:n});case`avatar`:return(0,R.jsx)(np,{event:e,name:n});default:return null}})();return l?(0,R.jsxs)(R.Fragment,{children:[c,l]}):null}var Km=6e5;function qm(e,t){return t.ts?!e?.ts||new Date(t.ts).getTime()-new Date(e.ts).getTime()>=Km:!1}function Jm({ts:e}){let t=l(e);return t?(0,R.jsx)(`div`,{className:`pt-2 pb-0.5 text-center text-[11.5px] font-medium text-muted`,children:t}):null}function Ym({event:e,onOpenFile:t}){let n=s(),r=e.files??[],a=r.filter(e=>e.kind===`image`),o=r.filter(e=>e.kind!==`image`);return(0,R.jsxs)(`div`,{className:`rise flex flex-col items-end pl-12`,children:[e.via===`call`?(0,R.jsxs)(`span`,{className:`mb-1 flex items-center gap-1 text-[11.5px] font-medium text-muted`,children:[(0,R.jsx)(Ut,{size:11}),` `,n(`said on a call`)]}):e.via?(0,R.jsx)(`span`,{className:`mb-1 text-[11.5px] font-medium text-muted`,children:n(`asked from {device}`,{device:e.via})}):e.to_device_name||e.to_device?(0,R.jsxs)(`span`,{className:`mb-1 flex items-center gap-1 text-[11.5px] font-medium text-accent`,children:[(0,R.jsx)(It,{size:11}),` `,n(`to {device}`,{device:e.to_device_name||e.to_device||``})]}):(e.via_device_name||e.via_device)&&(0,R.jsx)(`span`,{className:`mb-1 text-[11.5px] font-medium text-muted`,children:n(`From {device}`,{device:e.via_device_name||e.via_device||``})}),a.length>0&&(0,R.jsx)(`div`,{className:`mb-1 flex max-w-full flex-wrap justify-end gap-1.5`,children:a.map(e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>t(e.path),"aria-label":e.name,className:i(`overflow-hidden rounded-2xl border border-border/60 bg-surface-2 shadow-sm active:scale-[0.98] transition`,a.length===1?`max-h-64 max-w-[240px]`:`h-28 w-28`),children:(0,R.jsx)(`img`,{src:h(e.path),alt:e.name,loading:`lazy`,className:i(`object-cover`,a.length===1?`max-h-64 w-auto max-w-full`:`h-full w-full`)})},e.path))}),o.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path),className:`mb-1 flex max-w-full items-center gap-2.5 rounded-2xl border border-border bg-surface px-3 py-2 text-left shadow-sm hover:bg-surface-2 active:scale-[0.98] transition`,children:[(0,R.jsx)(`span`,{className:`rounded-xl bg-accent/12 p-2 text-accent`,children:e.kind===`data`?(0,R.jsx)(cn,{size:17}):(0,R.jsx)(mt,{size:17})}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-[14px] font-medium`,children:e.name}),(0,R.jsx)(`span`,{className:`block text-[11.5px] text-muted`,children:Xm(e.size)})]})]},e.path)),e.text&&(0,R.jsx)(`div`,{className:`bubble-user max-w-full rounded-[20px] bg-bubble-user px-4 py-2.5 text-bubble-user-fg`,children:(0,R.jsx)(`div`,{className:`md text-[15px] leading-[1.45] whitespace-pre-wrap break-words`,children:e.text})})]})}function Xm(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function Zm(e){let t=e.toLowerCase().split(`.`).pop()??``;return[`csv`,`tsv`,`json`,`xlsx`,`xls`].includes(t)?`data`:`other`}var Qm=`image/*,.pdf,.txt,.md,.csv,.tsv,.json,.log,.html,.xml,.yaml,.yml,.toml,.ics,.vcf,.xlsx,.xls,.docx`;function $m({text:e,reasoning:t,streaming:n,continued:r,files:a,onOpenFile:o,spoken:c,modelUsed:l}){let[u,d]=(0,L.useState)(!1),f=s(),p=(0,L.useMemo)(()=>mf(jm(e,!!n)),[e,n]);return p.length===0&&!n&&!t?null:(0,R.jsx)(`div`,{className:i(`rise flex items-end gap-2 pr-10`,r&&`-mt-1`),children:(0,R.jsxs)(`div`,{className:`min-w-0 max-w-full`,children:[t&&(0,R.jsx)(`button`,{type:`button`,className:`mb-1 ml-1 text-[12px] text-muted`,onClick:()=>d(e=>!e),children:f(u?`Hide thinking`:`Show thinking`)}),t&&u&&(0,R.jsx)(`div`,{className:`mb-1.5 rounded-2xl bg-surface-2/70 px-3 py-2 text-[13px] text-muted whitespace-pre-wrap break-words`,children:t}),p.map((e,t)=>e.bare?(0,R.jsx)(`div`,{className:`my-1 max-w-full`,children:(0,R.jsx)(hf,{text:e.text,files:a,onOpenFile:o})},t):(0,R.jsxs)(`div`,{className:i(`my-1 max-w-[340px] rounded-[20px] bg-surface-2 px-3.5 py-2.5 wide:max-w-[600px]`,c&&`border border-accent/15`),children:[c&&t===0&&(0,R.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-1 text-[11px] font-medium text-accent/80`,children:[(0,R.jsx)(Ut,{size:10}),` `,f(`said on a call`)]}),(0,R.jsx)(hf,{text:e.text,files:a,onOpenFile:o}),n&&t===p.length-1&&(0,R.jsx)(`span`,{className:`inline-block w-1.5 h-4 ml-0.5 align-middle bg-accent/70 animate-pulse rounded-sm`})]},t)),p.length===0&&n&&(0,R.jsx)(`div`,{className:`my-1 rounded-[20px] bg-surface-2 px-3.5 py-2.5`,children:(0,R.jsx)(`span`,{className:`inline-block w-1.5 h-4 align-middle bg-accent/70 animate-pulse rounded-sm`})}),l&&!n&&(0,R.jsx)(`div`,{className:`ml-1 text-[11px] text-muted`,children:f(`Answered by nanoMuse Cloud this time ({model})`,{model:l})})]})})}function eh({text:e,about:n,ts:r}){let[i,a]=(0,L.useState)(!1),o=s(),c=n?t(n.replace(/^Working on your goal: /,``)):o(`background check`);return(0,R.jsx)(`div`,{className:`rise flex justify-center px-6`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`max-w-full rounded-2xl px-3 py-1.5 text-[12px] text-muted text-center leading-snug`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsx)(Rt,{size:12}),` `,o(`Checked on {label}: nothing new`,{label:c}),r?` · ${u(r)}`:``]}),i&&(0,R.jsx)(`span`,{className:`block mt-1 text-left whitespace-pre-wrap text-[12.5px]`,children:e})]})})}function th({label:e}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-[20px] rounded-bl-md bg-surface-2 px-3.5 py-2.5 flex items-center gap-1`,children:[(0,R.jsx)(`span`,{className:`typing-dot h-2 w-2 rounded-full bg-muted`}),(0,R.jsx)(`span`,{className:`typing-dot h-2 w-2 rounded-full bg-muted`}),(0,R.jsx)(`span`,{className:`typing-dot h-2 w-2 rounded-full bg-muted`})]}),e&&(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:e})]})}function nh(e){let t=e?e.at*1e3+N:0,[n,r]=(0,L.useState)(0);return(0,L.useEffect)(()=>{if(!t)return;let e=t-Date.now();if(e<=0){r(t);return}let n=window.setTimeout(()=>r(t),e+50);return()=>window.clearTimeout(n)},[t]),!e||n===t?null:e}function rh({who:e}){let t=s();return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 text-[12px] text-muted`,children:[(0,R.jsx)(A,{size:12,className:`animate-spin`}),(0,R.jsx)(`span`,{children:t(`{device} is working…`,{device:e.device_name||e.device})})]})}function ih({name:e,device:t,onSend:n}){let r=s(),i=t?[r(`What is on your screen right now?`),r(`Which folder are you in, and what is in it?`),r(`Check for updates and tell me what needs a restart`)]:[r(`What can you do for me?`),r(`Plan my week: ask me what's on my plate`),r(`Research and compare two options for me`),r(`Set up a long-term goal and track it`)];return(0,R.jsxs)(`div`,{className:`flex flex-col items-center text-center px-6 pt-10 pb-6 gap-3`,children:[(0,R.jsx)(`div`,{className:`text-[20px] font-semibold`,children:t?r(`This chat goes to {device}.`,{device:t}):r(`Hi, I'm {name}.`,{name:e})}),(0,R.jsx)(`p`,{className:`text-muted text-[14.5px] leading-snug max-w-sm`,children:t?r(`Whatever you ask here, the {name} on {device} does where it is: its shell, its files, its screen. Every step shows up here, and anything that needs an approval asks you here.`,{name:e,device:t}):r(`I don't just answer; I get things done: research, plans, files, code, email, long-running goals. Everything I do shows up here, and anything hard to undo waits for your approval.`)}),(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap justify-center gap-2`,children:i.map(e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`rounded-full bg-surface-2 px-3.5 py-1.5 text-[13.5px] hover:bg-border/60`,children:e},e))})]})}function ah({name:e,busy:t,waiting:n,onSend:r}){let{state:a,draft:o,draftFiles:c,toast:l}=E(),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!1),m=(0,L.useRef)(``),g=Np((0,L.useCallback)((e,t)=>{let n=m.current,r=n&&!/\s$/.test(n)?` `:``;d(n+r+e+t)},[]),(0,L.useCallback)(e=>l(e),[l])),_=()=>{g.listening||(m.current=u),g.toggle()},[v,y]=(0,L.useState)([]),[b,x]=(0,L.useState)([]);(0,L.useEffect)(()=>{if(!a.draftFiles)return;let e=a.draftFiles.map(e=>({key:`shared-${e.path}`,file:new File([],e.name),preview:e.kind===`image`?h(e.path):null,info:e,error:null}));x(t=>[...t.filter(t=>!e.some(e=>e.key===t.key)),...e].slice(0,10)),c(null)},[a.draftFiles]);let S=(0,L.useRef)(null),C=(0,L.useRef)(null),w=s();(0,L.useEffect)(()=>()=>b.forEach(e=>e.preview?.startsWith(`blob:`)&&URL.revokeObjectURL(e.preview)),[b]),(0,L.useEffect)(()=>{let e=()=>S.current?.focus();return window.addEventListener(`nanomuse:quick-chat`,e),()=>window.removeEventListener(`nanomuse:quick-chat`,e)},[]);let T=e=>{let t=Array.from(e).slice(0,Math.max(0,10-b.length));if(t.length===0)return;let n=t.map(e=>({key:`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,7)}`,file:e,preview:e.type.startsWith(`image/`)?URL.createObjectURL(e):null,info:null,error:null}));x(e=>[...e,...n]);for(let e of n)M.upload(e.file).then(t=>x(n=>n.map(n=>n.key===e.key?{...n,info:t}:n))).catch(t=>{let n=t.message?P(t.message):w(`Upload failed`);x(t=>t.map(t=>t.key===e.key?{...t,error:n}:t)),l(n)})},D=e=>x(t=>t.filter(t=>t.key!==e)),O=b.some(e=>!e.info&&!e.error),k=b.flatMap(e=>e.info?[e.info.path]:[]);(0,L.useEffect)(()=>{let e=S.current;e&&(e.style.height=`0px`,e.style.height=`${Math.min(e.scrollHeight,160)}px`)},[u]),(0,L.useEffect)(()=>{if(a.draft===null)return;d(a.draft),o(null);let e=S.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},[a.draft]);let ee=a.settings?.skills?.enabled!==!1;(0,L.useEffect)(()=>{ee&&M.skills().then(e=>y(e.skills.filter(e=>e.enabled))).catch(()=>y([]))},[ee,a.skillsVersion]);let te=/^\/([a-z0-9-]*)$/i.exec(u),j=te?v.filter(e=>e.name.startsWith(te[1].toLowerCase())).slice(0,6):[],ne=e=>{d(`/${e.name} `),S.current?.focus()},re=a.hub?.devices??[],N=Pm(u,re),ie=N.length===0?Fm(u,re):null,ae=e=>{d(`@${e.name} `),S.current?.focus()},oe=e=>{e?.preventDefault();let t=u.trim();if(!t&&k.length===0||O||f)return;g.listening&&g.stop();let n=b;p(!0),d(``),x([]),S.current?.focus(),r(t,k).catch(()=>{d(e=>e||t),x(e=>e.length?e:n)}).finally(()=>p(!1))};return(0,R.jsxs)(`form`,{onSubmit:oe,className:`shrink-0 bg-bg px-3 pt-1.5 pb-1`,children:[t&&!n&&(0,R.jsx)(`div`,{className:`px-2 pb-1 text-[12px] text-muted`,children:w(`{name} is working; anything you send now is picked up right away.`,{name:e})}),j.length>0&&(0,R.jsx)(`ul`,{className:`mb-2 max-h-72 overflow-y-auto rounded-3xl border border-border/70 bg-surface shadow-lg divide-y divide-border/70`,role:`listbox`,"aria-label":w(`Skills`),children:j.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>ne(e),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left hover:bg-surface-2/70 active:bg-surface-2`,children:[(0,R.jsx)(gn,{size:16,className:`shrink-0 text-accent`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`span`,{className:`block text-[14px] font-medium`,children:[`/`,e.name]}),(0,R.jsx)(`span`,{className:`block truncate text-[12.5px] text-muted`,children:e.description})]})]})},e.name))}),N.length>0&&(0,R.jsx)(`ul`,{className:`mb-2 max-h-72 overflow-y-auto rounded-3xl border border-border/70 bg-surface shadow-lg divide-y divide-border/70`,role:`listbox`,"aria-label":w(`Devices`),children:N.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>ae(e),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left hover:bg-surface-2/70 active:bg-surface-2`,children:[(0,R.jsx)(`span`,{className:`shrink-0 text-accent`,children:e.kind===`computer`?(0,R.jsx)(Lt,{size:16}):(0,R.jsx)(tn,{size:16})}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`span`,{className:`block text-[14px] font-medium`,children:[`@`,e.name]}),(0,R.jsx)(`span`,{className:`block truncate text-[12.5px] text-muted`,children:e.online?w(`Runs this there and reports back`):w(`Offline`)})]})]})},e.id))}),ie&&(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 pb-1 text-[12px] text-muted`,children:[(0,R.jsx)(It,{size:12}),` `,w(`This goes to {device}.`,{device:ie.name})]}),b.length>0&&(0,R.jsx)(`div`,{className:`mb-1 flex gap-2.5 overflow-x-auto px-1 pt-2.5 pb-1 pr-3`,role:`list`,"aria-label":w(`Attachments`),children:b.map(e=>(0,R.jsxs)(`div`,{role:`listitem`,className:i(`relative shrink-0 rounded-2xl border bg-surface-2`,e.error?`border-danger/60`:`border-border/70`),children:[e.preview?(0,R.jsx)(`img`,{src:e.preview,alt:e.file.name,className:`h-16 w-16 rounded-2xl object-cover`}):(0,R.jsxs)(`div`,{className:`flex h-16 w-40 items-center gap-2 px-2.5`,children:[(0,R.jsx)(`span`,{className:`rounded-xl bg-accent/12 p-1.5 text-accent`,children:Zm(e.file.name)===`data`?(0,R.jsx)(cn,{size:16}):(0,R.jsx)(mt,{size:16})}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-[12.5px] font-medium`,children:e.file.name}),(0,R.jsx)(`span`,{className:`block text-[11px] text-muted`,children:e.error?w(`Upload failed`):Xm(e.info?.size??e.file.size)})]})]}),!e.info&&!e.error&&(0,R.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center rounded-2xl bg-bg/50`,children:(0,R.jsx)(A,{size:18,className:`animate-spin text-accent`})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>D(e.key),"aria-label":w(`Remove`),className:`absolute -right-1.5 -top-1.5 flex h-6 w-6 items-center justify-center rounded-full border border-border bg-surface text-muted shadow-sm`,children:(0,R.jsx)(Fe,{size:13})})]},e.key))}),(0,R.jsxs)(`div`,{className:`flex items-end gap-2 rounded-[26px] border border-border bg-surface px-1.5 py-1.5 shadow-[0_2px_12px_-6px_rgba(0,0,0,0.12)] focus-within:border-fg/20`,children:[(0,R.jsx)(`input`,{ref:C,type:`file`,multiple:!0,accept:Qm,className:`hidden`,onChange:e=>{e.target.files&&T(e.target.files),e.target.value=``}}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>C.current?.click(),"aria-label":w(`Attach a file`),className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-fg/70 transition hover:bg-surface-2 active:scale-95`,children:(0,R.jsx)(I,{size:22})}),(0,R.jsx)(`textarea`,{ref:S,value:u,onChange:e=>d(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData?.files??[]);t.length>0&&(e.preventDefault(),T(t))},onKeyDown:e=>{if(e.key===`Tab`&&j.length>0&&j[0]){e.preventDefault(),ne(j[0]);return}if(e.key===`Tab`&&N.length>0&&N[0]){e.preventDefault(),ae(N[0]);return}e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),oe())},rows:1,placeholder:n?w(`Answer {name}…`,{name:e}):b.length>0?w(`Say what to do with it…`):w(`Message`),className:`flex-1 resize-none bg-transparent px-1 py-2 text-[15px] leading-[1.4] outline-none placeholder:text-muted`}),g.supported&&(0,R.jsx)(Pp,{listening:g.listening,onClick:_}),(0,R.jsx)(`button`,{type:`submit`,disabled:!u.trim()&&k.length===0||O,"aria-label":w(`Send`),className:i(`flex h-9 w-9 shrink-0 items-center justify-center rounded-full transition active:scale-95`,u.trim()||k.length>0?`bg-accent text-accent-fg`:`bg-surface-2 text-muted`,`disabled:opacity-60`),children:(0,R.jsx)(Je,{size:19,strokeWidth:2.5})})]})]})}function oh({threads:e,active:t,onPick:n,onCleared:r,compact:a=!1,grouped:o=!1}){let{state:c,toast:l,dispatch:d}=E(),f=s(),[p,m]=(0,L.useState)(``),[h,g]=(0,L.useState)(!1),_=(0,L.useRef)(null),v=(c.hub?.devices??[]).filter(e=>!e.this&&e.kind!==`web`&&e.online),y=e=>c.hub?.devices.find(t=>t.id===e)?.kind??`phone`,b=async e=>{try{let t=await M.askDevice(e.id);d({type:`ws`,msg:{kind:`thread`,thread:t.thread}}),n(t.thread.id)}catch(e){l(e.message)}},x=async()=>{g(!0);try{let e=await M.createThread(p.trim()||f(`Side chat`));d({type:`ws`,msg:{kind:`thread`,thread:e}}),m(``),n(e.id)}catch(e){l(e.message)}finally{g(!1)}},S=async e=>{if(window.confirm(f(`Delete this side chat and its history?`)))try{await M.deleteThread(e),d({type:`ws`,msg:{kind:`thread_deleted`,thread:e}})}catch(e){l(e.message)}},C=async e=>{if(window.confirm(f(`Clear this conversation? Memory and goals are kept.`)))try{await M.clearThread(e),d({type:`ws`,msg:{kind:`thread_cleared`,thread:e}}),r?.()}catch(e){l(e.message)}},w=e=>(0,R.jsxs)(`li`,{className:i(`group flex items-center gap-2 px-3`,a?`py-2 rounded-xl hover:bg-surface-2/60`:`py-2.5`,e.id===t&&`bg-surface-2/60`),children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:`flex-1 text-left min-w-0`,children:[(0,R.jsxs)(`div`,{className:i(`font-medium truncate flex items-center gap-2`,a?`text-[13.5px]`:`text-[15px]`),children:[e.device?(0,R.jsx)(`span`,{className:`text-accent`,children:y(e.device)===`computer`?(0,R.jsx)(Lt,{size:14}):(0,R.jsx)(tn,{size:14})}):e.remote_from?(0,R.jsx)(It,{size:14,className:`text-muted`}):null,(0,R.jsx)(`span`,{className:`truncate`,children:e.id===`main`?f(e.title):e.title}),e.busy&&(0,R.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400 animate-pulse`})]}),(0,R.jsxs)(`div`,{className:i(`text-muted`,a?`text-[11.5px]`:`text-[12px]`),children:[f(`{n} events`,{n:e.events}),e.queued?` · ${f(`{n} queued`,{n:e.queued})}`:``,` · `,u(e.updated_at)]})]}),(0,R.jsx)(`button`,{type:`button`,"aria-label":f(`Clear`),onClick:()=>void C(e.id),className:i(`p-2 text-muted hover:text-fg`,a&&`opacity-0 group-hover:opacity-100 focus:opacity-100`),children:(0,R.jsx)(Fe,{size:16})}),e.id!==`main`&&(0,R.jsx)(`button`,{type:`button`,"aria-label":f(`Delete`),onClick:()=>void S(e.id),className:i(`p-2 text-muted hover:text-rose-500`,a&&`opacity-0 group-hover:opacity-100 focus:opacity-100`),children:(0,R.jsx)(fn,{size:16})})]},e.id),T=i(`divide-y divide-border overflow-hidden`,a?`rounded-xl`:`rounded-2xl border border-border`),D=`px-3 pb-1 pt-3 text-[11.5px] font-semibold uppercase tracking-wide text-muted`;return(0,R.jsxs)(`div`,{children:[o?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:D,children:f(`Main chat`)}),(0,R.jsx)(`ul`,{className:T,children:e.filter(e=>e.id===`main`).map(w)}),(0,R.jsxs)(`div`,{className:i(D,`flex items-center justify-between pr-1`),children:[(0,R.jsx)(`span`,{children:f(`Side chats`)}),(0,R.jsx)(`button`,{type:`button`,"aria-label":f(`New side chat`),onClick:()=>_.current?.focus(),className:`flex h-6 w-6 items-center justify-center rounded-full text-muted hover:bg-surface-2 hover:text-fg`,children:(0,R.jsx)(I,{size:15})})]}),(0,R.jsx)(`ul`,{className:T,children:e.filter(e=>e.id!==`main`).map(w)}),e.every(e=>e.id===`main`)&&(0,R.jsx)(`p`,{className:`px-3 py-2 text-[12px] text-muted`,children:f(`A side chat keeps one topic apart from the rest.`)})]}):(0,R.jsx)(`ul`,{className:T,children:e.map(w)}),v.length>0&&(0,R.jsxs)(`div`,{className:`mt-4`,children:[(0,R.jsx)(`div`,{className:`mb-1.5 text-[12px] font-medium text-muted`,children:f(`Ask one of your devices`)}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:v.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void b(e),className:`flex items-center gap-1.5 rounded-full border border-border bg-surface px-3 py-1.5 text-[13px] font-medium hover:bg-surface-2`,children:[e.kind===`phone`?(0,R.jsx)(tn,{size:14,className:`text-accent`}):(0,R.jsx)(Lt,{size:14,className:`text-accent`}),e.name]},e.id))})]}),(0,R.jsxs)(`div`,{className:i(`flex gap-2`,a?`mt-3`:`mt-4`),children:[(0,R.jsx)(`input`,{ref:_,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!h&&x()},placeholder:f(a?`New side chat`:`New side chat, e.g. “Trip to Kyoto”`),className:i(`min-w-0 flex-1 bg-surface-2 outline-none focus:ring-2 focus:ring-accent/40`,a?`rounded-xl px-3 py-2 text-[13px]`:`rounded-2xl px-3.5 py-2.5 text-[14px]`)}),(0,R.jsxs)(`button`,{type:`button`,disabled:h,onClick:()=>void x(),"aria-label":f(`New`),className:i(`flex items-center gap-1.5 bg-accent text-accent-fg font-medium disabled:opacity-50`,a?`rounded-xl px-2.5`:`rounded-2xl px-3.5 py-2.5`),children:[(0,R.jsx)(jt,{size:18}),` `,!a&&f(`New`)]})]})]})}function sh(e){let t=[...e].reverse().find(e=>e.type===`user`),n=(((t?.type===`user`?t.text:``)||``).split(/\r?\n/).map(e=>e.trim()).find(e=>e.length>0)??``).replace(/\s+/g,` `);if(n.length<=36)return n;let r=n.slice(0,36),i=r.lastIndexOf(` `);return(i>16?r.slice(0,i):r).trimEnd()+`…`}function ch(e){let t=!1;for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.type===`assistant`){if(!r.text||r.quiet)return!1;t=!0;continue}if(r.type===`user`)return t&&!r.via;if(r.type===`notice`)return!1}return!1}function lh(e){let t=Sn(),n=t?`Desktop app (${t.platform}, shell ${t.version})`:`Web app (${navigator.userAgent})`;return`https://github.com/nano-muse/nanoMuse/issues/new?${new URLSearchParams({template:`bug_report.yml`,version:e||``,os:n}).toString()}`}function uh(){let{state:e,setTab:t,openThread:n}=E(),r=s(),[a,o]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(``),f=(0,L.useRef)(null),p=$f(),{profile:m,status:h}=e,g=m?.name??`nanoMuse`,_=e.pendingApprovals.length,v=e.goals.filter(e=>e.proposal&&e.status!==`cancelled`).length,y=e.pendingApprovals.filter(t=>t.ts>e.feedSeenAt).length,b=(e.hub?.devices??[]).filter(e=>!e.this&&e.kind!==`web`&&e.online).length,x=_>0?_>1?r(`{n} approvals waiting for you`,{n:_}):r(`1 approval waiting for you`):h.state===`idle`?r(`Idle`):h.detail||(h.state===`waiting`?r(`Waiting for you`):r(`Working…`));(0,L.useEffect)(()=>{if(!c)return;let e=e=>{f.current?.contains(e.target)||l(!1)},t=e=>{e.key===`Escape`&&l(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[c]);let S=[{id:`chat`,label:`Chat`,icon:(0,R.jsx)(At,{size:21}),badge:_},{id:`feed`,label:`Feed`,icon:(0,R.jsx)(Bt,{size:21}),badge:y},{id:`ideas`,label:`Ideas`,icon:(0,R.jsx)(Ct,{size:21})},{id:`goals`,label:`Goals`,icon:(0,R.jsx)(rn,{size:21}),badge:v},{id:`library`,label:`Library`,icon:(0,R.jsx)(St,{size:21})},{id:`devices`,label:`Devices`,icon:(0,R.jsx)(It,{size:21}),dot:b>0},...p?[{id:`coding`,label:`Coding`,icon:(0,R.jsx)(on,{size:21})}]:[]],C=u.trim().toLowerCase(),w=C?e.threads.filter(e=>e.id===`main`||(e.id===`main`?r(e.title):e.title).toLowerCase().includes(C)||(e.device_name??``).toLowerCase().includes(C)):e.threads,T=e=>i(`relative flex w-[60px] flex-col items-center gap-[3px] rounded-xl py-1.5 text-[10.5px] font-medium leading-none transition`,e?`bg-surface-2 text-fg`:`text-fg/65 hover:bg-surface-2/60 hover:text-fg`);return(0,R.jsxs)(`div`,{className:`flex h-full shrink-0`,children:[(0,R.jsxs)(`aside`,{className:`relative flex h-full w-[76px] shrink-0 flex-col items-center border-r border-border bg-surface/70`,children:[(0,R.jsx)(`div`,{className:`titlebar-room`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(!0),className:`relative mt-3 rounded-full transition hover:scale-[1.04]`,"aria-label":r(`Activity`),title:`${g} · ${x}`,children:[(0,R.jsx)(D,{profile:m,status:h,size:44}),_>0&&(0,R.jsx)(`span`,{className:`pointer-events-none absolute -right-1 -top-1 flex h-[18px] min-w-[18px] items-center justify-center rounded-full border-2 border-surface bg-rose-500 px-1 text-[10.5px] font-bold text-white`,children:_})]}),(0,R.jsx)(`span`,{className:`mt-1.5 max-w-[68px] truncate px-1 text-[11px] font-semibold leading-tight`,children:g}),(0,R.jsx)(`nav`,{className:`mt-3 flex w-full flex-1 flex-col items-center gap-0.5 overflow-y-auto overflow-x-hidden px-2`,children:S.map(n=>{let a=e.tab===n.id;return(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-current":a?`page`:void 0,className:T(a),children:[(0,R.jsx)(`span`,{className:i(a?`text-accent`:`text-fg/60`),children:n.icon}),(0,R.jsx)(`span`,{className:`max-w-full truncate`,children:r(n.label)}),n.badge?(0,R.jsx)(`span`,{className:`absolute right-1.5 top-1 flex h-[17px] min-w-[17px] items-center justify-center rounded-full bg-rose-500 px-1 text-[10px] font-bold text-white`,children:n.badge}):n.dot?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-3 top-2 h-2 w-2 rounded-full border-2 border-surface bg-emerald-500`}),(0,R.jsx)(`span`,{className:`sr-only`,children:r(`{n} online`,{n:b})})]}):null]},n.id)})}),(0,R.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-0.5 px-2 pb-3 pt-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`account`),"aria-current":e.tab===`account`?`page`:void 0,className:T(e.tab===`account`),title:e.hub?.account.signed_in?e.hub.account.hint:r(`Account`),children:[(0,R.jsx)(mn,{size:21,className:e.tab===`account`?`text-accent`:`text-fg/60`}),(0,R.jsx)(`span`,{className:`max-w-full truncate`,children:r(`Account`)})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`you`),"aria-current":e.tab===`you`?`page`:void 0,className:T(e.tab===`you`),children:[(0,R.jsx)(en,{size:21,className:e.tab===`you`?`text-accent`:`text-fg/60`}),(0,R.jsx)(`span`,{className:`max-w-full truncate`,children:r(`Settings`)})]}),(0,R.jsxs)(`div`,{ref:f,className:`relative w-full`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-expanded":c,"aria-haspopup":`menu`,className:i(T(c),`mx-auto`),children:[(0,R.jsx)(Ot,{size:21,className:`text-fg/60`}),(0,R.jsx)(`span`,{children:r(`More`)})]}),c&&(0,R.jsxs)(`div`,{role:`menu`,className:`absolute bottom-0 left-[68px] z-30 w-[232px] rounded-2xl border border-border bg-surface p-1.5 shadow-[0_12px_40px_-12px_rgba(0,0,0,0.3)]`,children:[(0,R.jsxs)(`a`,{role:`menuitem`,href:lh(e.version),target:`_blank`,rel:`noreferrer`,onClick:()=>l(!1),className:`flex items-center gap-2.5 rounded-xl px-2.5 py-2 text-[13px] font-medium hover:bg-surface-2`,children:[(0,R.jsx)(ue,{size:16,className:`text-fg/60`}),` `,r(`Report a bug`)]}),(0,R.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{l(!1),t(`you`),window.location.hash=`developer`},className:`flex w-full items-center gap-2.5 rounded-xl px-2.5 py-2 text-left text-[13px] font-medium hover:bg-surface-2`,children:[(0,R.jsx)(yn,{size:16,className:`text-fg/60`}),(0,R.jsx)(`span`,{className:`flex-1`,children:r(`Developer tools`)}),(0,R.jsx)(`span`,{className:`text-[11.5px] font-normal text-muted`,children:r(p?`On`:`Off`)})]}),e.version&&(0,R.jsxs)(`div`,{className:`px-2.5 pb-1 pt-1.5 text-[11.5px] text-muted`,children:[`nanoMuse `,e.version]})]})]})]}),(0,R.jsx)(am,{open:a,onClose:()=>o(!1)})]}),e.tab===`chat`&&(0,R.jsxs)(`section`,{className:`flex h-full w-[248px] shrink-0 flex-col border-r border-border bg-surface/40`,"aria-label":r(`Chats`),children:[(0,R.jsx)(`div`,{className:`titlebar-room`}),(0,R.jsxs)(`div`,{className:`px-3 pb-2 pt-4`,children:[(0,R.jsx)(`h2`,{className:`px-1 text-[15px] font-semibold tracking-tight`,children:r(`Chats`)}),(0,R.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 rounded-xl bg-surface-2 px-2.5 py-1.5 text-muted focus-within:ring-2 focus-within:ring-accent/40`,children:[(0,R.jsx)(qt,{size:14,className:`shrink-0`}),(0,R.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:r(`Search`),"aria-label":r(`Search chats`),className:`min-w-0 flex-1 bg-transparent text-[13px] text-fg outline-none placeholder:text-muted`}),u&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(``),"aria-label":r(`Clear`),className:`shrink-0 hover:text-fg`,children:(0,R.jsx)(Fe,{size:14})})]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-3`,children:(0,R.jsx)(oh,{threads:w,active:e.activeThread,onPick:e=>n(e),compact:!0,grouped:!0})})]})]})}function dh(){let{state:e,send:t,openThread:n,openFile:r,markFeedSeen:i,setTab:a,toast:o}=E(),[c,l]=(0,L.useState)(null),[u,p]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(null),b=e.profile?.name??`nanoMuse`,x=s(),S=y();(0,L.useEffect)(()=>{let e=!0;return M.feed(80).then(t=>e&&l(t)).catch(e=>o(e.message)),M.upcoming().then(t=>e&&g(t)).catch(()=>void 0),M.feedPosts().then(t=>e&&p(t)).catch(()=>void 0),()=>{e=!1}},[e.feedVersion,e.remindersVersion]),(0,L.useEffect)(()=>{let e=!0;return M.calendar().then(t=>e&&v(t)).catch(()=>void 0),()=>{e=!1}},[e.calendarVersion,e.connectionsVersion]),(0,L.useEffect)(()=>{c&&c.length&&c[0].ts>e.feedSeenAt&&i(c[0].ts)},[c,e.feedSeenAt,i]);let C=(0,L.useMemo)(()=>kh(c??[]),[c,S]),[w,T]=(0,L.useState)(!1),[D,O]=(0,L.useState)(null),[k,ee]=(0,L.useState)(()=>d(fh)===`1`),[j,ne]=(0,L.useState)(!1),re=()=>{f(fh,`1`),ee(!0)},N=async()=>{ne(!0);try{let e=await M.refreshFeedPosts();p(e),e.error&&o(x(`Could not write posts: {error}`,{error:e.error}))}catch(e){o(e.message)}finally{ne(!1)}},P=e=>{t(`main`,e.prompt||`${x(`About this post from my feed:`)}\n\n**${e.title}**\n\n${e.body.slice(0,1200)}`).catch(e=>o(e.message||x(`Could not send`))),n(`main`)},ie=(0,L.useMemo)(()=>mh(u?.posts??[]),[u]),ae=u!==null&&u.posts.length===0;return(0,R.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,R.jsx)(Em,{title:``,trailing:(0,R.jsx)(te,{onClick:()=>T(!0),label:x(`Feed settings`),children:(0,R.jsx)(en,{size:22})})}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-3.5 pb-7`,children:[ie.length===0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(gh,{text:hh(ph(),new Date)}),!k&&(0,R.jsx)(xh,{instructions:u?.instructions??``,onEdit:()=>T(!0),onAck:re}),ae&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Sh,{emoji:`🖼️`,title:x(`Nothing in the feed yet`),body:x(`As we get to know each other, new posts will show up here. Every day at {time} I read what I remember about you (your memory files, the last week of diary, your goals) and write a few short posts.`,{time:u?.time??`08:00`})}),(0,R.jsx)(Sh,{emoji:`📝`,title:x(`Steer it with one sentence`),body:x(`Tap the sliders at the top right to tell me what you want more of, switch the daily routine off, or have me write the first day now.`)}),e.settings&&!e.settings.llm_ready&&(0,R.jsx)(_h,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a(`you`),className:`flex w-full items-center gap-2 p-4 text-left text-[14px] text-muted`,children:[(0,R.jsx)(F,{size:16,className:`shrink-0 text-accent`}),` `,x(`Add a model first; the feed is written by your agent.`)]})}),(0,R.jsx)(_h,{children:(0,R.jsx)(`div`,{className:`p-4`,children:j?(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 text-[15px]`,children:[(0,R.jsx)(A,{size:18,className:`animate-spin text-accent`}),` `,x(`Writing…`)]}):(0,R.jsx)(`button`,{type:`button`,onClick:()=>void N(),className:`h-[46px] w-full rounded-full bg-accent text-[15px] font-semibold text-accent-fg`,children:x(`Write it now`)})})})]})]}),ie.map(([e,t],n)=>(0,R.jsxs)(`section`,{children:[(0,R.jsx)(gh,{text:hh(e,new Date(t[0].ts))}),n===0&&!k&&(0,R.jsx)(xh,{instructions:u?.instructions??``,onEdit:()=>T(!0),onAck:re}),n===0&&j&&(0,R.jsx)(_h,{children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5 p-4 text-[15px]`,children:[(0,R.jsx)(A,{size:18,className:`animate-spin text-accent`}),` `,x(`Writing…`)]})}),t.map(e=>(0,R.jsx)(bh,{post:e,onDiscuss:()=>P(e),onInfo:()=>O(e)},e.id))]},e)),(0,R.jsxs)(`div`,{className:`space-y-4 px-0.5 pt-3`,children:[h&&(0,R.jsx)(Th,{data:h,name:b,onSettings:()=>a(`you`),onGoals:()=>a(`goals`)}),_?.configured&&(0,R.jsx)(Eh,{data:_,onAsk:()=>n(`main`)}),c&&c.length===0&&(!u||u.posts.length===0)&&(0,R.jsxs)(`div`,{className:`py-10 text-center text-muted text-[14px] px-6`,children:[(0,R.jsx)(Rt,{size:28,className:`mx-auto mb-2 opacity-60`}),x(`Nothing yet. Once {name} works on a goal in the background or needs your approval, it shows up here.`,{name:b})]}),c&&c.length>0&&(0,R.jsx)(`div`,{className:`px-1 pt-1 text-[12px] font-semibold uppercase tracking-wide text-muted`,children:x(`While you were away`)}),C.map(([t,i])=>(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`div`,{className:`px-1 mb-1.5 text-[12px] uppercase tracking-wide text-muted font-semibold`,children:t}),(0,R.jsx)(`ul`,{className:`space-y-2`,children:i.map(t=>(0,R.jsx)(`li`,{children:(0,R.jsx)(Oh,{item:t,unseen:t.ts>e.feedSeenAt,onOpen:()=>{t.kind===`artifact`&&t.path?r(t.path):n(t.thread)}})},t.id))})]},t))]})]}),(0,R.jsx)(wh,{open:w,onClose:()=>T(!1),data:u,writing:j,onChange:p,onWriteNow:()=>void N()}),(0,R.jsx)(Op,{open:D!==null,onClose:()=>O(null),title:D?.title,children:D&&(0,R.jsxs)(`div`,{className:`space-y-3 px-1 pb-2`,children:[(0,R.jsx)(Ch,{label:x(`Post type`),value:yh(D.area)}),(0,R.jsx)(Ch,{label:x(`Written`),value:new Date(D.ts).toLocaleString(m(),{dateStyle:`medium`,timeStyle:`short`})}),(0,R.jsx)(`button`,{type:`button`,onClick:async()=>{let e=D.id;O(null);try{await M.deleteFeedPost(e),p(t=>t&&{...t,posts:t.posts.filter(t=>t.id!==e)})}catch(e){o(e.message)}},className:`w-full rounded-full bg-surface-2 py-2.5 text-[15px] font-medium text-rose-500`,children:x(`Delete this post`)})]})})]})}var fh=`nanomuse.feed.introAck`;function ph(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function mh(e){let t=new Map;for(let n of e){let e=new Date(n.ts),r=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`,i=t.get(r);i?i.push(n):t.set(r,[n])}return[...t.entries()]}function hh(e,t){let n=ph(),r=new Date;r.setDate(r.getDate()-1);let i=`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,`0`)}-${String(r.getDate()).padStart(2,`0`)}`,a=t.toLocaleDateString(m(),{weekday:`long`});if(e===n){let e=new Date().getHours(),t=_(e<12?`morning`:e<18?`afternoon`:`evening`);return _(`{weekday} {part}`,{weekday:a,part:t})}return e===i?_(`Yesterday`):`${a} · ${t.toLocaleDateString(m(),{month:`short`,day:`numeric`})}`}function gh({text:e}){return(0,R.jsx)(`h2`,{className:`px-1.5 pt-3.5 pb-2 text-[22px] font-bold leading-7`,children:e})}function _h({children:e,className:t}){return(0,R.jsx)(`div`,{className:i(`my-1.5 overflow-hidden rounded-[18px] bg-surface dark:border dark:border-border`,t),children:e})}var vh={planning:`🗓️`,research:`🔍`,goals:`🎯`,money:`💰`,health:`🌿`,home:`🏠`,learning:`📚`,people:`👥`,files:`📄`,fun:`🎈`};function yh(e){switch(e){case`planning`:return _(`Planning`);case`research`:return _(`Research`);case`goals`:return _(`Goals`);case`money`:return _(`Money`);case`health`:return _(`Health`);case`home`:return _(`Home`);case`learning`:return _(`Learning`);case`people`:return _(`People`);case`files`:return _(`Files`);case`fun`:return _(`Fun`);default:return _(`Note`)}}function bh({post:e,onDiscuss:t,onInfo:n}){let r=s();return(0,R.jsx)(_h,{children:(0,R.jsxs)(`article`,{className:`pl-3.5 pr-2.5 pt-3.5 pb-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-[22px] leading-none`,children:vh[e.area]??`📝`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`h3`,{className:`text-[16px] font-semibold leading-[22px]`,children:e.title}),(0,R.jsx)(`div`,{className:`md mt-1 text-[15px] leading-[22px] text-fg/85`,children:(0,R.jsx)(hf,{text:e.body})})]})]}),(0,R.jsxs)(`div`,{className:`mt-1.5 flex items-center`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-1.5 rounded-full px-2 py-2 text-[14px] hover:bg-surface-2`,children:[(0,R.jsx)(At,{size:22,strokeWidth:1.8}),` `,r(`Discuss`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:n,"aria-label":r(`About this post`),className:`ml-auto rounded-full p-2 hover:bg-surface-2`,children:(0,R.jsx)(F,{size:22,strokeWidth:1.8})})]})]})})}function xh({instructions:e,onEdit:t,onAck:n}){let r=s();return(0,R.jsxs)(_h,{children:[(0,R.jsxs)(`div`,{className:`px-4 py-3.5`,children:[(0,R.jsx)(`div`,{className:`text-[17px] font-semibold`,children:r(`About the feed`)}),(0,R.jsx)(`p`,{className:`mt-1 text-[13px] leading-[18px] text-muted`,children:r(`Short posts your agent writes for you from what it remembers: your memory files, the last week of diary, your goals. The sentence below steers every post from now on; edit it any time.`)})]}),(0,R.jsxs)(`div`,{className:`border-t border-border/70 px-4 py-3.5`,children:[(0,R.jsx)(`p`,{className:`text-[15px] leading-[22px]`,children:e||r(`Build me a feed about what I care about. Keep it short and direct, easy to skim, no clickbait.`)}),(0,R.jsxs)(`div`,{className:`mt-3.5 flex justify-end gap-2.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-full bg-surface-2 px-6 py-2.5 text-[15px] font-medium`,children:r(`Edit`)}),(0,R.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-full bg-accent px-6 py-2.5 text-[15px] font-semibold text-accent-fg`,children:r(`Got it`)})]})]})]})}function Sh({emoji:e,title:t,body:n}){return(0,R.jsx)(_h,{children:(0,R.jsxs)(`div`,{className:`flex items-start gap-3 p-3.5`,children:[(0,R.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-2 text-[22px] leading-none`,children:e}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[16px] font-semibold leading-[22px]`,children:t}),(0,R.jsx)(`p`,{className:`mt-1 text-[15px] leading-[22px] text-fg/85`,children:n})]})]})})}function Ch({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`flex items-start gap-3 text-[14.5px]`,children:[(0,R.jsx)(`span`,{className:`w-14 shrink-0 text-muted`,children:e}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:t})]})}function wh({open:e,onClose:t,data:n,writing:r,onChange:i,onWriteNow:a}){let{toast:o,state:c}=E(),l=s(),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!1);(0,L.useEffect)(()=>{e&&d(n?.instructions??``)},[e,n]);let m=async()=>{p(!0);try{i(await M.setFeedInstructions({instructions:u})),t()}catch(e){o(e.message)}finally{p(!1)}},h=async e=>{try{i(await M.setFeedInstructions(e))}catch(e){o(e.message)}},g=c.settings?.llm_ready!==!1;return(0,R.jsx)(Op,{open:e,onClose:t,title:l(`Feed`),children:(0,R.jsxs)(`div`,{className:`space-y-3 px-1 pb-2`,children:[(0,R.jsx)(`p`,{className:`text-[13px] leading-[18px] text-muted`,children:l(`Your feed is driven by the instruction below. Any edit you make here applies to every post from now on.`)}),(0,R.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),rows:4,maxLength:2e3,placeholder:l(`Build me a feed about what I care about. Keep it short and direct, easy to skim, no clickbait.`),className:`w-full resize-none rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[15px] leading-snug outline-none focus:ring-2 focus:ring-accent/40`}),(0,R.jsxs)(`div`,{className:`space-y-2 rounded-2xl bg-surface-2 px-3.5 py-2.5`,children:[(0,R.jsx)(Pe,{label:l(`Write it every day`),hint:n?.daily===!1?void 0:l(`Daily at {time}`,{time:n?.time??`08:00`}),checked:n?.daily!==!1,onChange:e=>void h({daily:e}),disabled:!n}),n?.daily!==!1&&(0,R.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-[13px] text-muted`,children:[(0,R.jsx)(`span`,{children:l(`Time of day`)}),(0,R.jsx)(`input`,{type:`time`,value:n?.time??`08:00`,onChange:e=>e.target.value&&void h({time:e.target.value}),className:`rounded-lg bg-surface px-2 py-1 text-[13px] text-fg outline-none focus:ring-2 focus:ring-accent/40`})]}),!g&&(0,R.jsx)(`div`,{className:`text-[12.5px] text-muted`,children:l(`Add a model first; the feed is written by your agent.`)})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:a,disabled:r||!n||!g,className:`flex w-full items-center justify-center gap-2 rounded-full bg-surface-2 py-2.5 text-[15px] font-medium disabled:opacity-60`,children:[r?(0,R.jsx)(A,{size:16,className:`animate-spin`}):(0,R.jsx)(nn,{size:16,className:`text-accent`}),l(r?`Writing…`:`Write it now`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(),disabled:f,className:`h-[46px] w-full rounded-full bg-accent text-[15px] font-semibold text-accent-fg disabled:opacity-60`,children:l(`Save`)})]})})}function Th({data:t,name:n,onSettings:r,onGoals:i}){let a=s(),o=t.queue[0],c=t.reminders.filter(e=>e.status===`active`&&!!e.next_at),l=c[0],d=c.length;return(0,R.jsxs)(`div`,{className:`rounded-3xl border border-border/70 bg-surface shadow-sm px-4 py-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] uppercase tracking-wide text-muted font-semibold`,children:[(0,R.jsx)(Xe,{size:13}),` `,a(`Next up`)]}),t.proactive?o?(0,R.jsxs)(`div`,{className:`mt-1.5 text-[14px] leading-snug`,children:[t.busy?a(`Working now`):t.quiet_until?a(`Quiet hours after {time}`,{time:u(t.quiet_until)}):t.next_pass_at?a(`Around {time}`,{time:u(t.next_pass_at)}):a(`Soon`),`: `,(0,R.jsx)(`span`,{className:`font-medium`,children:o.title}),o.next_step&&(0,R.jsxs)(`span`,{className:`text-muted`,children:[` · `,o.next_step]}),o.overdue&&(0,R.jsxs)(`span`,{className:`text-rose-500 font-medium`,children:[` · `,a(`overdue`)]}),t.queue.length>1&&(0,R.jsxs)(`span`,{className:`text-muted`,children:[` · `,a(`{n} more in line`,{n:t.queue.length-1})]})]}):(0,R.jsxs)(`div`,{className:`mt-1.5 text-[14px] leading-snug`,children:[a(`No goal has a next step to work on.`),` `,(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`text-accent font-medium`,children:a(`Add one`)})]}):(0,R.jsxs)(`div`,{className:`mt-1.5 text-[14px] leading-snug`,children:[a(`Background work is off. {name} only acts when you ask.`,{name:n}),` `,(0,R.jsx)(`button`,{type:`button`,onClick:r,className:`text-accent font-medium`,children:a(`Turn it on`)})]}),t.check_ins[0]&&(0,R.jsxs)(`div`,{className:`mt-1.5 text-[12.5px] text-muted`,children:[a(`Check-in on`),` `,(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.check_ins[0].title}),` `,e(t.check_ins[0].at),t.check_ins.length>1&&` · ${a(`{n} more`,{n:t.check_ins.length-1})}`]}),l&&(0,R.jsxs)(`div`,{className:`mt-1.5 text-[12.5px] text-muted`,children:[l.kind===`task`?a(`Routine`):a(`Reminder`),` `,(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:l.text}),` `,e(l.next_at),d>1&&` · ${a(`{n} more`,{n:d-1})}`]})]})}function Eh({data:e,onAsk:t}){let n=s(),r=t=>t.start.slice(0,10)<=e.today,a=e.events.filter(r),o=e.events.filter(e=>!r(e)),c=new Date,l=e=>!e.all_day&&new Date(e.end)e.error),d=a.every(l)&&o.length>0,f=d?o:a;return(0,R.jsxs)(`div`,{className:`rounded-3xl border border-border/70 bg-surface shadow-sm px-4 py-3.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] uppercase tracking-wide text-muted font-semibold`,children:[(0,R.jsx)(tt,{size:13}),` `,n(d?`Tomorrow`:`Today`),f.length>0&&(0,R.jsx)(`span`,{className:`ml-auto normal-case tracking-normal font-normal`,children:n(`{n} scheduled`,{n:f.length})})]}),f.length===0?(0,R.jsx)(`div`,{className:`mt-1.5 text-[14px] leading-snug text-muted`,children:n(`Nothing on the calendar today.`)}):(0,R.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:f.map(e=>(0,R.jsxs)(`li`,{className:i(`flex items-baseline gap-2.5 text-[14px] leading-snug`,!d&&l(e)&&`opacity-50`),children:[(0,R.jsx)(`span`,{className:`w-[86px] shrink-0 tabular-nums text-[12.5px] text-muted`,children:e.all_day?n(`all day`):`${e.start.slice(11,16)}–${e.end.slice(11,16)}`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.summary}),e.location&&(0,R.jsxs)(`span`,{className:`text-muted text-[12.5px]`,children:[` `,(0,R.jsx)(Dt,{size:11,className:`inline -mt-0.5`}),` `,e.location]})]})]},`${e.uid}-${e.start}`))}),u.length>0&&(0,R.jsx)(`div`,{className:`mt-1.5 text-[12px] text-rose-500`,children:n(`{name} could not be read`,{name:u.map(e=>e.name).join(`, `)})}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`mt-2 text-[12.5px] text-accent font-medium`,children:n(`Ask about your week`)})]})}function Dh(e){return e.replace(/```[\s\S]*?```/g,` `).replace(/^#{1,6}\s+/gm,``).replace(/(\*\*|__|`)/g,``).replace(/^\s*[-*+]\s+/gm,`• `).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).trim()}function Oh({item:n,unseen:r,onOpen:a}){let o=s(),c=n.kind===`approval`?(0,R.jsx)(Zt,{size:18}):n.kind===`question`?(0,R.jsx)(kt,{size:18}):n.kind===`artifact`?(0,R.jsx)(mt,{size:18}):n.quiet?(0,R.jsx)(Rt,{size:18}):n.title.startsWith(`New mail: `)?(0,R.jsx)(Et,{size:18}):n.title.startsWith(`Coming up: `)?(0,R.jsx)(et,{size:18}):n.title.startsWith(`Webhook: `)?(0,R.jsx)(_n,{size:18}):(0,R.jsx)(nn,{size:18}),l=n.kind===`approval`?`bg-amber-500/12 text-amber-600 dark:text-amber-300`:n.kind===`question`?`bg-accent/12 text-accent`:`bg-surface-2 text-muted`;return n.quiet?(0,R.jsxs)(`button`,{type:`button`,onClick:a,className:`w-full text-left px-2 py-1.5 flex items-center gap-2 text-[12.5px] text-muted`,children:[(0,R.jsx)(Rt,{size:13,className:`shrink-0`}),(0,R.jsxs)(`span`,{className:`truncate`,children:[o(`{label}: nothing new`,{label:t(n.title.replace(/^Working on your goal: /,``))}),n.text?`: ${n.text}`:``]}),(0,R.jsx)(`span`,{className:`ml-auto shrink-0`,children:e(n.ts)})]}):(0,R.jsx)(`button`,{type:`button`,onClick:a,className:i(`w-full text-left rounded-3xl border bg-surface shadow-sm px-4 py-3 active:scale-[0.99] transition`,r?`border-accent/40`:`border-border/70`),children:(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:i(`rounded-2xl p-2 mt-0.5`,l),children:c}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`div`,{className:`font-semibold text-[14.5px] leading-snug truncate`,children:t(n.title)}),r&&(0,R.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-accent shrink-0`})]}),n.text&&(0,R.jsx)(`div`,{className:`mt-0.5 text-[13.5px] text-muted leading-snug line-clamp-3 whitespace-pre-wrap`,children:Dh(n.text)}),(0,R.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-[12px] text-muted`,children:[(0,R.jsx)(`span`,{children:e(n.ts)}),(0,R.jsx)(`span`,{children:`·`}),(0,R.jsx)(`span`,{className:`truncate`,children:n.thread===`main`?o(n.thread_title):n.thread_title}),(0,R.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-accent font-medium`,children:[n.kind===`artifact`?o(`Open`):n.kind===`approval`||n.kind===`question`?o(`Answer`):o(`Open chat`),(0,R.jsx)(qe,{size:13})]})]})]})]})})}function kh(e){let t=new Date,n=new Date(t);n.setDate(t.getDate()-1);let r=e=>{let r=new Date(e);return r.toDateString()===t.toDateString()?_(`Today`):r.toDateString()===n.toDateString()?_(`Yesterday`):r.toLocaleDateString(m(),{weekday:`long`,month:`short`,day:`numeric`})},i=new Map;for(let t of e){let e=r(t.ts);i.set(e,[...i.get(e)??[],t])}return[...i.entries()]}function Ah({children:e,className:t}){return(0,R.jsx)(`div`,{className:i(`mx-4 overflow-hidden rounded-2xl bg-surface dark:border dark:border-border`,t),children:e})}function jh({inset:e=52}){return(0,R.jsx)(`div`,{className:i(`border-t border-border/60`,e===52?`ml-[52px]`:`ml-4`)})}function Mh({icon:e,label:t,value:n,onClick:r,external:a=!1,trailing:o,chevron:s=!0}){let c=(0,R.jsxs)(R.Fragment,{children:[e&&(0,R.jsx)(`span`,{className:`shrink-0 text-fg`,children:e}),(0,R.jsx)(`span`,{className:i(`min-w-0 truncate text-[16px] leading-[21px]`,n?`max-w-[60%] shrink-0`:`flex-1`),children:t}),n&&(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate pl-3 text-right text-[14px] leading-[18px] text-muted`,children:n}),o??(s?a?(0,R.jsx)(Ae,{size:16,className:`shrink-0 text-muted/70`}):(0,R.jsx)(rt,{size:18,className:`shrink-0 text-muted/70`}):null)]}),l=`flex min-h-[54px] w-full items-center gap-3.5 px-4 py-2 text-left`;return r?(0,R.jsx)(`button`,{type:`button`,onClick:r,className:i(l,`hover:bg-surface-2/60`),children:c}):(0,R.jsx)(`div`,{className:l,children:c})}function Nh({icon:e,label:t,value:n,checked:r,disabled:a=!1,onChange:o}){return(0,R.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:a,onClick:()=>o(!r),className:i(`flex min-h-[54px] w-full items-center gap-3.5 px-4 py-2 text-left`,a?`opacity-60`:`hover:bg-surface-2/60`),children:[e&&(0,R.jsx)(`span`,{className:`shrink-0 text-fg`,children:e}),(0,R.jsx)(`span`,{className:i(`min-w-0 truncate text-[16px] leading-[21px]`,n?`max-w-[60%] shrink-0`:`flex-1`),children:t}),n&&(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate pl-3 text-right text-[14px] leading-[18px] text-muted`,children:n}),(0,R.jsx)(Ph,{checked:r})]})}function Ph({checked:e}){return(0,R.jsx)(`span`,{"aria-hidden":!0,className:i(`relative h-7 w-12 shrink-0 rounded-full transition`,e?`bg-accent`:`bg-surface-2 border border-border`),children:(0,R.jsx)(`span`,{className:i(`absolute top-0.5 h-6 w-6 rounded-full bg-white shadow transition`,e?`left-[22px]`:`left-0.5`)})})}function Fh({children:e,className:t}){return(0,R.jsx)(`p`,{className:i(`px-8 py-2 text-[13px] leading-[18px] text-muted`,t),children:e})}function Ih({children:e}){return(0,R.jsx)(`p`,{className:`px-8 pb-2 pt-[18px] text-[13px] leading-[18px] text-muted`,children:e})}var Lh=`https://nanomuse.cn/privacy/`;function Rh({me:e,onChanged:t,flush:n=!1}){let r=s(),{state:a,toast:o}=E(),c=!!a.hub?.account.signed_in,[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),p=e??l,m=async()=>{if(c&&!e)try{u(await M.cloudMe())}catch{}};(0,L.useEffect)(()=>{m()},[c,e]);let h=p?.contribute??{on:!1,samples:0},g=h.samples??0,_=h.privacy_url||`https://nanomuse.cn/privacy/`,v=async n=>{f(!0);try{await M.cloudContribute(n),o(r(n?`On. Turn it off here at any time.`:`Off. Nothing more is kept.`)),e?t?.():await m()}catch(e){o(e.message)}finally{f(!1)}},y=async()=>{if(window.confirm(r(`The kept conversations are removed from the server. This cannot be undone.`))){f(!0);try{let n=await M.cloudDeleteSamples();o(r(`{n} turns deleted`,{n:String(n.deleted)})),e?t?.():await m()}catch(e){o(e.message)}finally{f(!1)}}};return(0,R.jsxs)(`div`,{className:i(n&&`-mx-4`),children:[(0,R.jsx)(zh,{signedIn:c}),(0,R.jsx)(Ah,{children:(0,R.jsx)(Nh,{label:r(`Help improve nanoMuse's AI models`),checked:c&&h.on,disabled:d||!c||!p,onChange:e=>void v(e)})}),(0,R.jsxs)(Fh,{children:[r(`While this is on, the text of your chats with the nanoMuse Cloud models (what you wrote, what it answered and the tools it chose to call) is kept on the relay to train the community's own open model. Not your memory or SOUL (the system prompt), not what tools returned, not pictures, and never next to who you are. Your own API key never passes through the relay.`),` `,c?h.default_on!==void 0&&(h.default_on?r(`New accounts start with it on.`):r(`New accounts start with it off.`)):r(`Sign in to nanoMuse Cloud to use it.`),` `,c&&g>0&&r(`{n} turns kept so far.`,{n:String(g)}),` `,(0,R.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent underline-offset-2 hover:underline`,children:r(`Privacy policy`)})]}),c&&g>0&&(0,R.jsxs)(Ah,{className:`mt-3`,children:[(0,R.jsx)(Mh,{icon:d?(0,R.jsx)(A,{size:22,className:`animate-spin`}):(0,R.jsx)(fn,{size:22}),label:r(`Delete the kept conversations`),value:r(`{n} turns`,{n:String(g)}),onClick:()=>void y(),chevron:!1}),(0,R.jsx)(jh,{inset:16}),(0,R.jsx)(Fh,{className:`px-4 pb-2.5 pt-2`,children:r(`Removes every turn kept from this account, whether the switch is on or off now. Turning the switch off keeps what was kept until you delete it here.`)})]})]})}function zh({signedIn:e}){let t=s(),{toast:n}=E(),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(!1),c=r?.relay?.counts??{conversations:0,messages:0},l=e&&(c.conversations>0||c.messages>0),u=async()=>{try{i(await M.syncState())}catch{}};(0,L.useEffect)(()=>{u()},[e]);let d=async(e,t)=>{o(!0);try{i(await e()),n(t)}catch(e){n(e.message),await u()}finally{o(!1)}},f=e=>{(e||!l||window.confirm(t(`Off deletes the synced conversations from nanoMuse Cloud. The chats on each device stay.`)))&&d(()=>M.syncSetState(e),t(e?`On. Your devices show the same conversations from now on.`:`Off. Nothing is kept on nanoMuse Cloud any more.`))},p=()=>{window.confirm(t(`The synced conversations are removed from nanoMuse Cloud. The chats on each device stay. This cannot be undone.`))&&d(()=>M.syncDelete(),t(`Synced conversations deleted.`))},m=e=>{d(()=>M.syncSetSideChats(e),t(e?`On. This device's side chats go to the account; the other devices' are on their way.`:`Off. Side chats stay on this device from now on.`))},h=e&&!!r?.enabled;return(0,R.jsxs)(`div`,{className:`mb-6`,children:[(0,R.jsx)(Ah,{children:(0,R.jsx)(Nh,{label:t(`Sync conversations between my devices`),checked:h,disabled:a||!e||!r,onChange:f})}),(0,R.jsxs)(Fh,{children:[t(`The text of your chats is kept on nanoMuse Cloud so every device shows the same conversations. Files and images stay on the device they were made on.`),` `,e?r?.paused?t(`Paused: sign in again to continue.`):l&&t(`{c} chats, {m} messages kept so far.`,{c:String(c.conversations),m:String(c.messages)}):t(`Sign in to nanoMuse Cloud to use it.`)]}),r&&`side_chats`in r&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Ah,{className:`mt-3`,children:(0,R.jsx)(Nh,{label:t(`Also sync side chats`),checked:h&&!!r.side_chats,disabled:a||!h,onChange:m})}),(0,R.jsx)(Fh,{children:t(`Off: side chats stay on this device. On: this device's side chats go to the account and the other devices' side chats come here.`)})]}),l&&(0,R.jsxs)(Ah,{className:`mt-3`,children:[(0,R.jsx)(Mh,{icon:a?(0,R.jsx)(A,{size:22,className:`animate-spin`}):(0,R.jsx)(fn,{size:22}),label:t(`Delete synced conversations`),value:t(`{n} chats`,{n:String(c.conversations)}),onClick:p,chevron:!1}),(0,R.jsx)(jh,{inset:16}),(0,R.jsx)(Fh,{className:`px-4 pb-2.5 pt-2`,children:t(`Removes what nanoMuse Cloud stores for this account; the chats on each device stay, and the switch stays on. Deleting a chat on one device deletes it on all of them.`)})]})]})}var Bh=`nm.invite`;function Vh(){try{let e=new URLSearchParams(window.location.search).get(`invite`);if(e){let t=Hh(e);t&&localStorage.setItem(Bh,t)}return localStorage.getItem(Bh)??``}catch{return``}}function Hh(e){return e.toUpperCase().replace(/[^A-Z0-9]/g,``).slice(0,8)}function Uh(e){return/^\s*[+\d]/.test(e)?`tel`:`email`}function Wh({onSignedIn:e,useAsModel:t=!1,cta:n,autoFocus:r=!0}){let a=s(),o=(0,L.useId)(),c=Ce(),[l,u]=(0,L.useState)(`code`),[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(``),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(null),[C,w]=(0,L.useState)(``),[T,E]=(0,L.useState)(!1);(0,L.useEffect)(()=>{let e=Vh();e&&(w(e),E(!0))},[]);let D=async()=>{if(t){b(`model`);try{await M.cloudUseAsModel()}catch{}}await e()},O=async()=>{let e=d.trim();if(e){b(`code`),S(null);try{await M.cloudCode(e),v(!0)}catch(e){S(a(e.message))}finally{b(null)}}},k=async()=>{let e=d.trim();if(!(!e||p.trim().length<4)){b(`verify`),S(null);try{(await M.cloudVerify(e,p.trim(),C.trim())).created&&Vf(),m(``),v(!1);try{localStorage.removeItem(Bh)}catch{}await D()}catch(e){S(a(e.message))}finally{b(null)}}},ee=async()=>{let e=d.trim();if(e&&h){b(`login`),S(null);try{await M.cloudLogin(e,h),g(``),await D()}catch(e){S(a(e.message))}finally{b(null)}}},te=()=>void(l===`password`?ee():_?k():O()),j=n??a(t?`Sign in and use its model`:`Sign in`);return(0,R.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),te()},children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-1 rounded-2xl bg-surface-2/70 p-1 text-[13px] font-medium`,children:[(0,R.jsx)(Gh,{active:l===`code`,onClick:()=>u(`code`),icon:(0,R.jsx)(Mt,{size:14}),label:a(`With a code`)}),(0,R.jsx)(Gh,{active:l===`password`,onClick:()=>u(`password`),icon:(0,R.jsx)(xt,{size:14}),label:a(`With a password`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`${o}-id`,className:`text-[12px] text-muted`,children:se()?a(`Mainland China phone number or e-mail`):a(`E-mail (or a mainland China phone number)`)}),(0,R.jsx)(`input`,{id:`${o}-id`,value:d,onChange:e=>{f(e.target.value),v(!1)},inputMode:Uh(d),autoComplete:`username`,autoFocus:r,placeholder:a(`138 0000 0000 or you@example.com`),className:i(Ie,`mt-1`)}),l===`code`&&!_&&(!se()||oe(d))&&(0,R.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:a(`Text-message codes reach mainland-China numbers only. Use an e-mail address instead.`)})]}),l===`password`?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`${o}-password`,className:`text-[12px] text-muted`,children:a(`Password`)}),(0,R.jsx)(`input`,{id:`${o}-password`,type:`password`,value:h,onChange:e=>g(e.target.value),autoComplete:`current-password`,className:i(Ie,`mt-1`)}),(0,R.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:a(`No password yet? Use a code first; set one under Account.`)})]}):(0,R.jsxs)(R.Fragment,{children:[_&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`${o}-code`,className:`text-[12px] text-muted`,children:a(`The code you received`)}),(0,R.jsx)(`input`,{id:`${o}-code`,value:p,onChange:e=>m(e.target.value.replace(/\D/g,``).slice(0,8)),inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,autoFocus:!0,className:i(`w-full rounded-2xl bg-surface-2 px-3.5 py-2.5 text-[14.5px] outline-none focus:ring-2 focus:ring-accent/40`,`mt-1 tracking-[0.3em]`)})]}),T?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:`${o}-invite`,className:`text-[12px] text-muted`,children:a(`Invite code (optional)`)}),(0,R.jsx)(`input`,{id:`${o}-invite`,value:C,onChange:e=>w(Hh(e.target.value)),autoComplete:`off`,placeholder:`ABCD2345`,className:i(Ie,`mt-1 tracking-[0.2em] uppercase`)}),(0,R.jsx)(`p`,{className:`mt-1.5 text-[12px] text-muted`,children:a(`A friend's code counts for a new account: you both get ¥{invite} more allowance.`,{invite:(c.invite_bonus_cny??5).toFixed(0)})})]}):(0,R.jsx)(`button`,{type:`button`,onClick:()=>E(!0),className:`text-[12px] text-muted underline-offset-2 hover:underline`,children:a(`Have an invite code?`)})]}),x&&(0,R.jsx)(`div`,{className:`rounded-2xl bg-rose-500/12 px-3 py-2 text-[12.5px] text-rose-700 dark:text-rose-300`,children:x}),(0,R.jsx)(`div`,{className:`flex gap-2`,children:l===`code`&&_?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,disabled:y!==null,onClick:()=>void O(),className:je,children:a(`Send again`)}),(0,R.jsxs)(`button`,{type:`submit`,disabled:y!==null||p.trim().length<4,className:i(Ne,`flex-1 py-3`),children:[y?(0,R.jsx)(A,{size:15,className:`animate-spin`}):null,` `,j]})]}):l===`code`?(0,R.jsxs)(`button`,{type:`submit`,disabled:y!==null||!d.trim(),className:i(Ne,`flex-1 py-3`),children:[y===`code`?(0,R.jsx)(A,{size:15,className:`animate-spin`}):null,` `,a(`Send me a code`)]}):(0,R.jsxs)(`button`,{type:`submit`,disabled:y!==null||!d.trim()||!h,className:i(Ne,`flex-1 py-3`),children:[y?(0,R.jsx)(A,{size:15,className:`animate-spin`}):null,` `,j]})})]})}function Gh({active:e,onClick:t,icon:n,label:r}){return(0,R.jsxs)(`button`,{type:`button`,onClick:t,"aria-pressed":e,className:i(`flex items-center justify-center gap-1.5 rounded-xl px-2 py-2 transition`,e?`bg-surface text-fg shadow-sm`:`text-muted hover:text-fg`),children:[n,` `,r]})}function Kh(){let{state:e,refreshSettings:t,refreshHub:n,toast:r,skipSignIn:i}=E(),a=s(),o=e.profile?.name??`nanoMuse`,c=(0,R.jsxs)(`ul`,{className:`grid grid-cols-2 gap-2 text-[12.5px] wide:grid-cols-1 wide:gap-1.5 wide:text-[13.5px]`,children:[(0,R.jsx)(qh,{icon:(0,R.jsx)(It,{size:15}),text:a(`Every device of yours, one nanoMuse`)}),(0,R.jsx)(qh,{icon:(0,R.jsx)(st,{size:15}),text:a(`A model with a free allowance, or your own key`)}),(0,R.jsx)(qh,{icon:(0,R.jsx)(vt,{size:15}),text:a(`It uses your phone and computers for you`)}),(0,R.jsx)(qh,{icon:(0,R.jsx)(Qt,{size:15}),text:a(`Keys in your vault; nothing you say is kept on the relay`)})]});return(0,R.jsxs)(`div`,{className:`relative mx-auto flex h-[100dvh] w-full max-w-[760px] flex-col overflow-hidden bg-bg sm:border-x sm:border-border wide:max-w-none wide:border-0`,children:[(0,R.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 h-[46vh] bg-[radial-gradient(ellipse_at_top,rgba(0,100,212,0.14),transparent_65%)] dark:bg-[radial-gradient(ellipse_at_top,rgba(23,147,255,0.2),transparent_65%)] wide:inset-y-0 wide:h-auto wide:bg-[radial-gradient(ellipse_at_left,rgba(0,100,212,0.12),transparent_60%)] wide:dark:bg-[radial-gradient(ellipse_at_left,rgba(23,147,255,0.16),transparent_60%)]`}),(0,R.jsx)(`div`,{className:`titlebar-room relative`}),(0,R.jsx)(`div`,{className:`relative flex-1 overflow-y-auto px-6 pb-8 wide:flex wide:items-center wide:px-12`,children:(0,R.jsxs)(`div`,{className:`mx-auto w-full wide:grid wide:max-w-[980px] wide:grid-cols-[1.1fr_1fr] wide:items-center wide:gap-16`,children:[(0,R.jsxs)(`div`,{className:`safe-top flex flex-col items-center pt-14 text-center wide:items-start wide:pt-0 wide:text-left`,children:[(0,R.jsx)(xn,{size:88,className:`drop-shadow-[0_20px_40px_rgba(0,100,212,0.28)]`}),(0,R.jsx)(`h1`,{className:`mt-6 text-[28px] font-bold tracking-tight wide:text-[34px]`,children:a(`Sign in to {name}`,{name:o})}),(0,R.jsx)(`p`,{className:`mt-2 max-w-sm text-[14.5px] leading-relaxed text-muted wide:max-w-md wide:text-[15.5px]`,children:a(`One free account. It is what lets your phone and computers work as one and brings a model to start with.`)}),(0,R.jsx)(`div`,{className:`mt-7 hidden w-full wide:block`,children:c}),(0,R.jsx)(Te,{compact:!0,className:`mt-6 hidden w-full wide:block`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`mt-8 rounded-[28px] border border-border/70 bg-surface p-5 shadow-sm wide:mt-0 wide:p-7`,children:(0,R.jsx)(Wh,{onSignedIn:async()=>{r(a(`Signed in to nanoMuse Cloud.`)),await Promise.all([t(),n()])}})}),(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`mt-4 w-full rounded-2xl border border-border/70 px-4 py-2.5 text-[13.5px] text-fg/80 hover:bg-surface-2`,"data-testid":`sign-in-skip`,children:a(`Use your own API key instead`)}),(0,R.jsx)(`p`,{className:`mt-2 text-center text-[11.5px] leading-relaxed text-muted`,children:a(`You can sign in later under Connections, for sync and your devices.`)}),(0,R.jsx)(`div`,{className:`mt-6 wide:hidden`,children:c}),(0,R.jsx)(Te,{compact:!0,className:`mt-6 wide:hidden`}),(0,R.jsxs)(`p`,{className:`mt-4 text-center text-[11.5px] leading-relaxed text-muted wide:mt-5`,children:[a(`The relay keeps an account id, a masked identifier, usage counts and your agent's name and look; what else, and what is yours to switch off, is in the`),` `,(0,R.jsx)(`a`,{href:Lh,target:`_blank`,rel:`noopener noreferrer`,className:`underline decoration-dotted underline-offset-2 hover:text-fg`,children:a(`privacy policy`)}),`.`]})]})]})})]})}function qh({icon:e,text:t}){return(0,R.jsxs)(`li`,{className:`flex items-start gap-2 rounded-2xl bg-surface-2/60 px-3 py-2.5 text-fg/80 wide:bg-transparent wide:px-0 wide:py-1`,children:[(0,R.jsx)(`span`,{className:`mt-0.5 text-accent`,children:e}),(0,R.jsx)(`span`,{className:`leading-snug`,children:t})]})}function Jh(e,t,n){return!e||!e.account.required||e.account.signed_in||t?.llm_ready?!1:!n}var Yh=`modulepreload`,Xh=function(e){return`/`+e},Zh={},Qh=function(e){return e.pathname.endsWith(`.css`)},$h=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Xh(t,n);let r=s(t);if(r.href in Zh)return;Zh[r.href]=!0;let i=Qh(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:Yh,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},eg=(0,L.lazy)(()=>$h(()=>import(`./AccountScreen-bHMDrVr5.js`).then(e=>({default:e.AccountScreen})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),tg=(0,L.lazy)(()=>$h(()=>import(`./AvatarStudioScreen-DD2X0R8P.js`).then(e=>({default:e.AvatarStudioScreen})),__vite__mapDeps([9,1,2,3,4,10,8,11]))),ng=(0,L.lazy)(()=>$h(()=>import(`./ChannelsScreen-mBzj7BLf.js`).then(e=>({default:e.ChannelsScreen})),__vite__mapDeps([12,1,3,4,10,8]))),rg=(0,L.lazy)(()=>$h(()=>import(`./CodingScreen-C_tutsx0.js`).then(e=>({default:e.CodingScreen})),__vite__mapDeps([13,1,4,10,8]))),ig=(0,L.lazy)(()=>$h(()=>import(`./ConnectionsScreen-CMt7GOff.js`).then(e=>({default:e.ConnectionsScreen})),__vite__mapDeps([14,1,2,3,4,5,7,15,10,8,16]))),ag=(0,L.lazy)(()=>$h(()=>import(`./DevicesScreen-g6FUY327.js`).then(e=>({default:e.DevicesScreen})),__vite__mapDeps([17,1,3,4,10,8,16]))),og=(0,L.lazy)(()=>$h(()=>import(`./GoalsScreen-Dp2fRaLA.js`).then(e=>({default:e.GoalsScreen})),__vite__mapDeps([18,1,2,3,4]))),sg=(0,L.lazy)(()=>$h(()=>import(`./IdeasScreen-CGfvq5H-.js`).then(e=>({default:e.IdeasScreen})),__vite__mapDeps([19,1,10]))),cg=(0,L.lazy)(()=>$h(()=>import(`./LibraryScreen-B8JlrC_n.js`).then(e=>({default:e.LibraryScreen})),__vite__mapDeps([20,1]))),lg=(0,L.lazy)(()=>$h(()=>import(`./MemoryScreen-M8j03G3u.js`).then(e=>({default:e.MemoryScreen})),__vite__mapDeps([21,1,8]))),ug=(0,L.lazy)(()=>$h(()=>import(`./Onboarding-CtVO6gdK.js`).then(e=>({default:e.Onboarding})),__vite__mapDeps([22,1,2,3,4,23,11,14,5,7,15,10,8,16]))),dg=(0,L.lazy)(()=>$h(()=>import(`./SettingsScreen-CHVg61To.js`).then(e=>({default:e.SettingsScreen})),__vite__mapDeps([24,1,2,3,4,5,6,15,23,11,8]))),fg=(0,L.lazy)(()=>$h(()=>import(`./SkillsScreen-Dr-d7iS7.js`).then(e=>({default:e.SkillsScreen})),__vite__mapDeps([25,1,8])));function pg(){return(0,R.jsx)(`div`,{className:`flex h-full min-h-[40vh] items-center justify-center text-muted`,children:(0,R.jsx)(A,{className:`animate-spin`,size:20})})}var mg=e=>({size:26,strokeWidth:e?2:1.7,fill:e?`currentColor`:`none`,fillOpacity:e?.18:0}),hg=[{id:`chat`,label:`Chat`,icon:e=>(0,R.jsx)(At,{...mg(e)})},{id:`feed`,label:`Feed`,icon:e=>(0,R.jsx)(Bt,{...mg(e)})},{id:`ideas`,label:`Ideas`,icon:e=>(0,R.jsx)(Ct,{...mg(e)})},{id:`goals`,label:`Goals`,icon:e=>(0,R.jsx)(rn,{...mg(e)})},{id:`library`,label:`Library`,icon:e=>(0,R.jsx)(St,{...mg(e)})}];function gg(){let{state:e,setTab:t,openFile:n}=E(),r=Wf(),a=s();(0,L.useEffect)(()=>{let t=e.profile?.name?.trim();document.title=t&&t.toLowerCase()!==`nanomuse`?`${t} · nanoMuse`:`nanoMuse`},[e.profile?.name]),(0,L.useEffect)(()=>{let e=Sn()?.onQuickChat?.(()=>{t(`chat`),requestAnimationFrame(()=>window.dispatchEvent(new Event(`nanomuse:quick-chat`)))});return()=>{typeof e==`function`&&e()}},[t]),(0,L.useEffect)(()=>{let e=()=>{let e=window.location.hash.slice(1);(e&&hg.some(t=>t.id===e)||e===`devices`||e===`you`||e===`memory`||e===`connections`||e===`channels`||e===`skills`||e===`account`||e===`coding`||e===`avatar`)&&t(e)};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[t]);let o=r&&e.hub?.account.signed_in?(0,R.jsx)(Gf,{}):null,c=e.lite&&e.settings!==null&&!e.settings.onboarded;if((0,L.useEffect)(()=>{c&&M.onboarded(!0).catch(()=>void 0)},[c]),e.authError)return(0,R.jsx)(vg,{});if(!e.loaded)return(0,R.jsx)(_g,{error:e.error});if(Jh(e.hub,e.settings,e.signInSkipped))return(0,R.jsx)(Kh,{});if(!e.lite&&e.settings&&!e.settings.onboarded&&!e.onboardingDismissed&&!e.threads.some(e=>e.events>0))return(0,R.jsxs)(L.Suspense,{fallback:(0,R.jsx)(pg,{}),children:[(0,R.jsx)(ug,{}),o]});let l=e.pendingApprovals.length,u=e.goals.filter(e=>e.proposal&&e.status!==`cancelled`).length,d=e.pendingApprovals.filter(t=>t.ts>e.feedSeenAt).length;return(0,R.jsxs)(`div`,{className:i(`mx-auto flex h-[100dvh] max-w-[760px] flex-col bg-bg sm:border-x sm:border-border`,!e.lite&&`wide:max-w-none wide:flex-row wide:border-x-0`),children:[!e.lite&&(0,R.jsx)(`div`,{className:`hidden wide:block wide:h-full`,children:(0,R.jsx)(uh,{})}),(0,R.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[e.gone&&(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-2 bg-surface-2 text-muted text-[12.5px] py-1`,children:[(0,R.jsx)(vn,{size:14}),` `,a(e.lite?`This demo has ended.`:`This nanoMuse has stopped. Reload the page once it is running again.`)]}),!e.gone&&!e.connected&&e.loaded&&(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-2 bg-amber-500/15 text-amber-700 dark:text-amber-300 text-[12.5px] py-1`,children:[(0,R.jsx)(vn,{size:14}),` `,a(`Reconnecting to your nanoMuse…`)]}),!e.lite&&(0,R.jsx)(En,{}),(0,R.jsx)(`main`,{className:i(`tabbar-room mx-auto min-h-0 w-full flex-1 wide:max-w-[900px]`,!e.lite&&`wide:pb-0`),children:(0,R.jsxs)(L.Suspense,{fallback:(0,R.jsx)(pg,{}),children:[e.tab===`chat`&&(0,R.jsx)(Wm,{}),e.tab===`feed`&&(0,R.jsx)(dh,{}),e.tab===`ideas`&&(0,R.jsx)(sg,{}),e.tab===`goals`&&(0,R.jsx)(og,{}),e.tab===`library`&&(0,R.jsx)(cg,{}),e.tab===`memory`&&(0,R.jsx)(lg,{}),e.tab===`skills`&&(0,R.jsx)(fg,{}),e.tab===`connections`&&(0,R.jsx)(ig,{}),e.tab===`channels`&&(0,R.jsx)(ng,{}),e.tab===`devices`&&(0,R.jsx)(ag,{}),e.tab===`you`&&(0,R.jsx)(dg,{}),e.tab===`account`&&(0,R.jsx)(eg,{}),e.tab===`coding`&&(0,R.jsx)(rg,{}),e.tab===`avatar`&&(0,R.jsx)(tg,{})]})}),(0,R.jsx)(`nav`,{className:i(`tabbar-float pointer-events-none absolute inset-x-0 z-20 flex justify-center px-4`,!e.lite&&`wide:hidden`),children:(0,R.jsx)(`ul`,{className:`pointer-events-auto flex items-center gap-0.5 rounded-full bg-surface-2/55 px-3.5 py-2 ring-1 ring-border/50 backdrop-blur-2xl`,children:hg.map(n=>{let r=e.tab===n.id,o=n.id===`chat`?l:n.id===`feed`?d:n.id===`goals`?u:0;return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-label":a(n.label),"aria-current":r?`page`:void 0,className:i(`relative flex h-[46px] w-[60px] items-center justify-center rounded-full transition-colors duration-300`,r?`bg-accent-soft text-accent-soft-fg`:`text-muted hover:text-fg`),children:[n.icon(r),o>0&&(0,R.jsx)(`span`,{className:`absolute right-2.5 top-1 flex h-[17px] min-w-[17px] items-center justify-center rounded-full bg-rose-500 px-1 text-[10px] font-bold text-white`,children:o})]})},n.id)})})})]}),(0,R.jsx)(kn,{}),(0,R.jsx)(gf,{path:e.viewer,onClose:()=>n(null)}),o,e.toast&&(0,R.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-[calc(6rem+env(safe-area-inset-bottom))] z-[70] flex justify-center px-4`,children:(0,R.jsx)(`div`,{className:`rise rounded-2xl bg-fg text-bg px-4 py-2 text-[13.5px] shadow-lg max-w-sm text-center`,children:e.toast})})]})}function _g({error:e}){let t=s();return(0,R.jsxs)(`div`,{className:`mx-auto flex h-[100dvh] max-w-sm flex-col items-center justify-center px-6 text-center`,children:[(0,R.jsx)(xn,{size:72}),e?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`p`,{className:`mt-6 text-[15px] font-medium`,children:t(`Could not reach your nanoMuse.`)}),(0,R.jsx)(`p`,{className:`mt-1.5 text-[13px] text-muted`,children:t(e)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`mt-5 rounded-full bg-fg px-5 py-2 text-[14px] font-medium text-bg`,children:t(`Try again`)})]}):(0,R.jsxs)(`p`,{className:`mt-6 flex items-center gap-2 text-[14px] text-muted`,children:[(0,R.jsx)(A,{className:`animate-spin`,size:16}),` `,t(`Connecting to your nanoMuse…`)]})]})}function vg(){let[e,t]=(0,L.useState)(``),n=s();return(0,R.jsxs)(`div`,{className:`mx-auto flex h-[100dvh] max-w-md flex-col items-center justify-center px-6 text-center`,children:[(0,R.jsx)(xn,{size:88}),(0,R.jsx)(`h1`,{className:`mt-4 text-[22px] font-bold`,children:n(`Connect to your nanoMuse`)}),(0,R.jsxs)(`p`,{className:`mt-2 text-[14px] text-muted`,children:[n(`This app talks to the nanoMuse server you run yourself. Scan the QR code printed by`),` `,(0,R.jsx)(`code`,{className:`rounded bg-surface-2 px-1`,children:`nanomuse serve`}),n(`, or paste the access token below.`)]}),(0,R.jsxs)(`form`,{className:`mt-5 w-full flex gap-2`,onSubmit:t=>{t.preventDefault(),e.trim()&&(g(e.trim()),window.location.reload())},children:[(0,R.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),"aria-label":n(`Access token`),placeholder:n(`Access token`),className:`flex-1 rounded-2xl bg-surface-2 px-4 py-2.5 text-[15px] outline-none focus:ring-2 focus:ring-accent/40`}),(0,R.jsx)(`button`,{type:`submit`,className:`rounded-2xl bg-accent text-accent-fg px-4 font-medium`,children:n(`Connect`)})]})]})}a(),ee(),wn(),bn.createRoot(document.getElementById(`root`)).render((0,R.jsx)(L.StrictMode,{children:(0,R.jsx)(T,{children:(0,R.jsx)(gg,{})})}));export{Ut as $,Ff as A,gn as B,Jp as C,Ze as Ct,rp as D,Ke as Dt,ip as E,qe as Et,hf as F,tn as G,sn as H,Mn as I,Xt as J,Qt as K,Sn as L,Nf as M,Pf as N,Zf as O,Af as P,Gt as Q,Cn as R,tm as S,Qe as St,op as T,Je as Tt,on as U,fn as V,nn as W,qt as X,Jt as Y,I as Z,nm as _,ct as _t,Ah as a,Nt as at,rm as b,rt as bt,Ih as c,Tt as ct,Um as d,F as dt,Ht as et,Em as f,vt as ft,Xp as g,ut as gt,Qp as h,pt as ht,Fh as i,It as it,jf as j,$f as k,Nh as l,wt as lt,Yp as m,mt,Rh as n,Rt as nt,jh as o,At as ot,Zp as p,gt as pt,Zt as q,Lh as r,Lt as rt,Mh as s,Et as st,Wh as t,Vt as tt,Vm as u,xt as ut,im as v,st as vt,Op as w,Xe as wt,$p as x,tt as xt,em as y,at as yt,yn as z};
\ No newline at end of file
diff --git a/nanomuse/server/static/assets/index-CwUBXfPC.css b/nanomuse/server/static/assets/index-CwUBXfPC.css
new file mode 100644
index 000000000..a3236b7a6
--- /dev/null
+++ b/nanomuse/server/static/assets/index-CwUBXfPC.css
@@ -0,0 +1,2 @@
+/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
+@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:"Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-teal-700:oklch(51.1% .096 186.391);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-600:oklch(58.8% .158 241.966);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-500:oklch(60.6% .25 292.717);--color-violet-600:oklch(54.1% .281 293.009);--color-fuchsia-300:oklch(83.3% .145 321.434);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-fuchsia-600:oklch(59.1% .293 322.896);--color-pink-300:oklch(82.3% .12 346.018);--color-pink-500:oklch(65.6% .241 354.308);--color-pink-600:oklch(59.2% .249 .584);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-900:oklch(20.8% .042 265.755);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--drop-shadow-sm:0 1px 2px #00000026;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-2xl:40px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:var(--om-bg);--color-surface:var(--om-surface);--color-surface-2:var(--om-surface-2);--color-border:var(--om-border);--color-fg:var(--om-fg);--color-muted:var(--om-muted);--color-accent:var(--om-accent);--color-accent-fg:#fff;--color-accent-soft:var(--om-accent-soft);--color-accent-soft-fg:var(--om-accent-soft-fg);--color-bubble-user:var(--om-bubble-user);--color-bubble-user-fg:var(--om-bubble-user-fg)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\@container{container-type:inline-size}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.-top-1{top:calc(var(--spacing) * -1)}.-top-1\.5{top:calc(var(--spacing) * -1.5)}.-top-20{top:calc(var(--spacing) * -20)}.top-0{top:0}.top-0\.5{top:calc(var(--spacing) * .5)}.top-1{top:var(--spacing)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-9{top:calc(var(--spacing) * 9)}.top-12{top:calc(var(--spacing) * 12)}.top-\[3px\]{top:3px}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1{right:calc(var(--spacing) * -1)}.-right-1\.5{right:calc(var(--spacing) * -1.5)}.-right-16{right:calc(var(--spacing) * -16)}.right-0{right:0}.right-1{right:var(--spacing)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.right-2{right:calc(var(--spacing) * 2)}.right-2\.5{right:calc(var(--spacing) * 2.5)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.right-\[3px\]{right:3px}.-bottom-0\.5{bottom:calc(var(--spacing) * -.5)}.bottom-0{bottom:0}.bottom-1{bottom:var(--spacing)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-\[calc\(6rem\+env\(safe-area-inset-bottom\)\)\]{bottom:calc(6rem + env(safe-area-inset-bottom))}.tabbar-float{bottom:calc(12px + env(safe-area-inset-bottom))}.left-0{left:0}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\.5{left:calc(var(--spacing) * 1.5)}.left-1\/2{left:50%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.left-\[18px\]{left:18px}.left-\[22px\]{left:22px}.left-\[26px\]{left:26px}.left-\[68px\]{left:68px}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-mx-4{margin-inline:calc(var(--spacing) * -4)}.mx-1{margin-inline:var(--spacing)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-3{margin-inline:calc(var(--spacing) * 3)}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.my-2{margin-block:calc(var(--spacing) * 2)}.my-8{margin-block:calc(var(--spacing) * 8)}.-mt-0\.5{margin-top:calc(var(--spacing) * -.5)}.-mt-1{margin-top:calc(var(--spacing) * -1)}.-mt-2\.5{margin-top:calc(var(--spacing) * -2.5)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-3\.5{margin-top:calc(var(--spacing) * 3.5)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-7{margin-top:calc(var(--spacing) * 7)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mt-\[2px\]{margin-top:2px}.mt-\[3px\]{margin-top:3px}.mt-\[22px\]{margin-top:22px}.mt-auto{margin-top:auto}.-mr-1\.5{margin-right:calc(var(--spacing) * -1.5)}.-mr-2{margin-right:calc(var(--spacing) * -2)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-2\.5{margin-right:calc(var(--spacing) * 2.5)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mr-5{margin-right:calc(var(--spacing) * 5)}.-mb-2{margin-bottom:calc(var(--spacing) * -2)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.-ml-1{margin-left:calc(var(--spacing) * -1)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-2\.5{margin-left:calc(var(--spacing) * 2.5)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-\[52px\]{margin-left:52px}.ml-\[76px\]{margin-left:76px}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-\[16\/10\]{aspect-ratio:16/10}.aspect-square{aspect-ratio:1}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-28{height:calc(var(--spacing) * 28)}.h-40{height:calc(var(--spacing) * 40)}.h-44{height:calc(var(--spacing) * 44)}.h-48{height:calc(var(--spacing) * 48)}.h-\[9px\]{height:9px}.h-\[17px\]{height:17px}.h-\[18px\]{height:18px}.h-\[46px\]{height:46px}.h-\[46vh\]{height:46vh}.h-\[50px\]{height:50px}.h-\[72px\]{height:72px}.h-\[100dvh\]{height:100dvh}.h-\[130px\]{height:130px}.h-\[148px\]{height:148px}.h-\[480px\]{height:480px}.h-full{height:100%}.max-h-28{max-height:calc(var(--spacing) * 28)}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-52{max-height:calc(var(--spacing) * 52)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[92dvh\]{max-height:92dvh}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-\[40vh\]{min-height:40vh}.min-h-\[44px\]{min-height:44px}.min-h-\[54px\]{min-height:54px}.min-h-\[56px\]{min-height:56px}.\!w-auto{width:auto!important}.w-1{width:var(--spacing)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-28{width:calc(var(--spacing) * 28)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-\[9px\]{width:9px}.w-\[46px\]{width:46px}.w-\[60px\]{width:60px}.w-\[64px\]{width:64px}.w-\[72px\]{width:72px}.w-\[74px\]{width:74px}.w-\[76px\]{width:76px}.w-\[82vw\]{width:82vw}.w-\[86px\]{width:86px}.w-\[148px\]{width:148px}.w-\[188px\]{width:188px}.w-\[232px\]{width:232px}.w-\[248px\]{width:248px}.w-\[260px\]{width:260px}.w-\[300px\]{width:300px}.w-\[900px\]{width:900px}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.max-w-\[60\%\]{max-width:60%}.max-w-\[68px\]{max-width:68px}.max-w-\[86\%\]{max-width:86%}.max-w-\[240px\]{max-width:240px}.max-w-\[320px\]{max-width:320px}.max-w-\[340px\]{max-width:340px}.max-w-\[360px\]{max-width:360px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[600px\]{max-width:600px}.max-w-\[720px\]{max-width:720px}.max-w-\[760px\]{max-width:760px}.max-w-\[calc\(100\%-128px\)\]{max-width:calc(100% - 128px)}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-\[17px\]{min-width:17px}.min-w-\[18px\]{min-width:18px}.min-w-\[180px\]{min-width:180px}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-separate{border-collapse:separate}.border-spacing-0{--tw-border-spacing-x:0px;--tw-border-spacing-y:0px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}.origin-top-left{transform-origin:0 0}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-\[0\.3333\]{scale:.3333}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-crosshair{cursor:crosshair}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize-y{resize:vertical}.scroll-mt-4{scroll-margin-top:calc(var(--spacing) * 4)}.list-decimal{list-style-type:decimal}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.grid-cols-\[1fr_1fr_auto\]{grid-template-columns:1fr 1fr auto}.grid-cols-\[1fr_84px\]{grid-template-columns:1fr 84px}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-\[3px\]{gap:3px}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-1\.5{column-gap:calc(var(--spacing) * 1.5)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-0\.5{row-gap:calc(var(--spacing) * .5)}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)),:where(.divide-border\/60>:not(:last-child)){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){:where(.divide-border\/60>:not(:last-child)){border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}:where(.divide-border\/70>:not(:last-child)){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){:where(.divide-border\/70>:not(:last-child)){border-color:color-mix(in oklab, var(--color-border) 70%, transparent)}}.self-center{align-self:center}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\[10px\]{border-radius:10px}.rounded-\[13px\]{border-radius:13px}.rounded-\[14px\]{border-radius:14px}.rounded-\[18px\]{border-radius:18px}.rounded-\[20px\]{border-radius:20px}.rounded-\[22px\]{border-radius:22px}.rounded-\[26px\]{border-radius:26px}.rounded-\[28px\]{border-radius:28px}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-3xl{border-top-left-radius:var(--radius-3xl);border-top-right-radius:var(--radius-3xl)}.rounded-t-\[28px\]{border-top-left-radius:28px;border-top-right-radius:28px}.rounded-tl-lg{border-top-left-radius:var(--radius-lg)}.rounded-br-lg{border-bottom-right-radius:var(--radius-lg)}.rounded-bl-lg{border-bottom-left-radius:var(--radius-lg)}.rounded-bl-md{border-bottom-left-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-\[1\.5px\]{border-style:var(--tw-border-style);border-width:1.5px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent,.border-accent\/15{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/15{border-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.border-accent\/25{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/25{border-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.border-accent\/30{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/30{border-color:color-mix(in oklab, var(--color-accent) 30%, transparent)}}.border-accent\/40{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-accent\/50{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/50{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.border-amber-400\/40{border-color:#fcbb0066}@supports (color:color-mix(in lab, red, red)){.border-amber-400\/40{border-color:color-mix(in oklab, var(--color-amber-400) 40%, transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/50{border-color:color-mix(in oklab, var(--color-amber-500) 50%, transparent)}}.border-bg{border-color:var(--color-bg)}.border-border,.border-border\/60{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.border-border\/70{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.border-border\/70{border-color:color-mix(in oklab, var(--color-border) 70%, transparent)}}.border-border\/80{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.border-border\/80{border-color:color-mix(in oklab, var(--color-border) 80%, transparent)}}.border-current{border-color:currentColor}.border-fg{border-color:var(--color-fg)}.border-rose-400{border-color:var(--color-rose-400)}.border-rose-400\/60{border-color:#ff667f99}@supports (color:color-mix(in lab, red, red)){.border-rose-400\/60{border-color:color-mix(in oklab, var(--color-rose-400) 60%, transparent)}}.border-rose-500\/25{border-color:#ff235740}@supports (color:color-mix(in lab, red, red)){.border-rose-500\/25{border-color:color-mix(in oklab, var(--color-rose-500) 25%, transparent)}}.border-surface{border-color:var(--color-surface)}.border-transparent{border-color:#0000}.border-t-transparent{border-top-color:#0000}.bg-\[\#2fb344\]{background-color:#2fb344}.bg-\[\#f1efeb\]{background-color:#f1efeb}.bg-accent{background-color:var(--color-accent)}.bg-accent-soft{background-color:var(--color-accent-soft)}.bg-accent\/5{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/5{background-color:color-mix(in oklab, var(--color-accent) 5%, transparent)}}.bg-accent\/8{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/8{background-color:color-mix(in oklab, var(--color-accent) 8%, transparent)}}.bg-accent\/10{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-accent\/12{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/12{background-color:color-mix(in oklab, var(--color-accent) 12%, transparent)}}.bg-accent\/15{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-accent\/70{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/70{background-color:color-mix(in oklab, var(--color-accent) 70%, transparent)}}.bg-accent\/\[0\.06\]{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.06\]{background-color:color-mix(in oklab, var(--color-accent) 6%, transparent)}}.bg-amber-50\/70{background-color:#fffbebb3}@supports (color:color-mix(in lab, red, red)){.bg-amber-50\/70{background-color:color-mix(in oklab, var(--color-amber-50) 70%, transparent)}}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-400\/15{background-color:#fcbb0026}@supports (color:color-mix(in lab, red, red)){.bg-amber-400\/15{background-color:color-mix(in oklab, var(--color-amber-400) 15%, transparent)}}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/10{background-color:color-mix(in oklab, var(--color-amber-500) 10%, transparent)}}.bg-amber-500\/12{background-color:#f99c001f}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/12{background-color:color-mix(in oklab, var(--color-amber-500) 12%, transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/15{background-color:color-mix(in oklab, var(--color-amber-500) 15%, transparent)}}.bg-bg,.bg-bg\/50{background-color:var(--color-bg)}@supports (color:color-mix(in lab, red, red)){.bg-bg\/50{background-color:color-mix(in oklab, var(--color-bg) 50%, transparent)}}.bg-bg\/60{background-color:var(--color-bg)}@supports (color:color-mix(in lab, red, red)){.bg-bg\/60{background-color:color-mix(in oklab, var(--color-bg) 60%, transparent)}}.bg-bg\/80{background-color:var(--color-bg)}@supports (color:color-mix(in lab, red, red)){.bg-bg\/80{background-color:color-mix(in oklab, var(--color-bg) 80%, transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\/20{background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.bg-black\/40{background-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.bg-black\/45{background-color:#00000073}@supports (color:color-mix(in lab, red, red)){.bg-black\/45{background-color:color-mix(in oklab, var(--color-black) 45%, transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-border{background-color:var(--color-border)}.bg-bubble-user{background-color:var(--color-bubble-user)}.bg-cyan-500\/12{background-color:#00b7d71f}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/12{background-color:color-mix(in oklab, var(--color-cyan-500) 12%, transparent)}}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/12{background-color:#00bb7f1f}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/12{background-color:color-mix(in oklab, var(--color-emerald-500) 12%, transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/15{background-color:color-mix(in oklab, var(--color-emerald-500) 15%, transparent)}}.bg-fg,.bg-fg\/40{background-color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.bg-fg\/40{background-color:color-mix(in oklab, var(--color-fg) 40%, transparent)}}.bg-fuchsia-500\/12{background-color:#e12afb1f}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/12{background-color:color-mix(in oklab, var(--color-fuchsia-500) 12%, transparent)}}.bg-muted,.bg-muted\/35{background-color:var(--color-muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/35{background-color:color-mix(in oklab, var(--color-muted) 35%, transparent)}}.bg-orange-500\/12{background-color:#fe6e001f}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/12{background-color:color-mix(in oklab, var(--color-orange-500) 12%, transparent)}}.bg-pink-500{background-color:var(--color-pink-500)}.bg-pink-500\/12{background-color:#f6339a1f}@supports (color:color-mix(in lab, red, red)){.bg-pink-500\/12{background-color:color-mix(in oklab, var(--color-pink-500) 12%, transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-rose-400{background-color:var(--color-rose-400)}.bg-rose-500{background-color:var(--color-rose-500)}.bg-rose-500\/12{background-color:#ff23571f}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/12{background-color:color-mix(in oklab, var(--color-rose-500) 12%, transparent)}}.bg-rose-500\/15{background-color:#ff235726}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/15{background-color:color-mix(in oklab, var(--color-rose-500) 15%, transparent)}}.bg-rose-500\/\[0\.04\]{background-color:#ff23570a}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/\[0\.04\]{background-color:color-mix(in oklab, var(--color-rose-500) 4%, transparent)}}.bg-sky-500\/12{background-color:#00a5ef1f}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\/12{background-color:color-mix(in oklab, var(--color-sky-500) 12%, transparent)}}.bg-surface{background-color:var(--color-surface)}.bg-surface-2,.bg-surface-2\/40{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.bg-surface-2\/40{background-color:color-mix(in oklab, var(--color-surface-2) 40%, transparent)}}.bg-surface-2\/55{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.bg-surface-2\/55{background-color:color-mix(in oklab, var(--color-surface-2) 55%, transparent)}}.bg-surface-2\/60{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.bg-surface-2\/60{background-color:color-mix(in oklab, var(--color-surface-2) 60%, transparent)}}.bg-surface-2\/70{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.bg-surface-2\/70{background-color:color-mix(in oklab, var(--color-surface-2) 70%, transparent)}}.bg-surface-2\/80{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.bg-surface-2\/80{background-color:color-mix(in oklab, var(--color-surface-2) 80%, transparent)}}.bg-surface\/40{background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.bg-surface\/40{background-color:color-mix(in oklab, var(--color-surface) 40%, transparent)}}.bg-surface\/70{background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.bg-surface\/70{background-color:color-mix(in oklab, var(--color-surface) 70%, transparent)}}.bg-surface\/90{background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.bg-surface\/90{background-color:color-mix(in oklab, var(--color-surface) 90%, transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500{background-color:var(--color-violet-500)}.bg-violet-500\/12{background-color:#8d54ff1f}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/12{background-color:color-mix(in oklab, var(--color-violet-500) 12%, transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab, red, red)){.bg-white\/80{background-color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-\[radial-gradient\(ellipse_at_top\,rgba\(0\,100\,212\,0\.14\)\,transparent_65\%\)\]{background-image:radial-gradient(at top,#0064d424,#0000 65%)}.from-\[\#7d6bc7\]{--tw-gradient-from:#7d6bc7;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-\[\#b0413e\]{--tw-gradient-from:#b0413e;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-accent{--tw-gradient-from:var(--color-accent);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500{--tw-gradient-from:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-400{--tw-gradient-from:var(--color-orange-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-400{--tw-gradient-from:var(--color-slate-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-700{--tw-gradient-from:var(--color-slate-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-\[\#7a1f1f\]{--tw-gradient-to:#7a1f1f;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-\[\#574494\]{--tw-gradient-to:#574494;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-600{--tw-gradient-to:var(--color-amber-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-400{--tw-gradient-to:var(--color-sky-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-600{--tw-gradient-to:var(--color-slate-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-900{--tw-gradient-to:var(--color-slate-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-700{--tw-gradient-to:var(--color-teal-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-top{object-position:top}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.\!px-3\.5{padding-inline:calc(var(--spacing) * 3.5)!important}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.px-16{padding-inline:calc(var(--spacing) * 16)}.\!py-1\.5{padding-block:calc(var(--spacing) * 1.5)!important}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.pt-0{padding-top:0}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-3\.5{padding-top:calc(var(--spacing) * 3.5)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-9{padding-top:calc(var(--spacing) * 9)}.pt-10{padding-top:calc(var(--spacing) * 10)}.pt-14{padding-top:calc(var(--spacing) * 14)}.pt-\[3px\]{padding-top:3px}.pt-\[18px\]{padding-top:18px}.pt-\[22px\]{padding-top:22px}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-5{padding-right:calc(var(--spacing) * 5)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-0\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-2\.5{padding-bottom:calc(var(--spacing) * 2.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-3\.5{padding-bottom:calc(var(--spacing) * 3.5)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-7{padding-bottom:calc(var(--spacing) * 7)}.pb-8{padding-bottom:calc(var(--spacing) * 8)}.tabbar-room{padding-bottom:calc(74px + env(safe-area-inset-bottom))}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-9{padding-left:calc(var(--spacing) * 9)}.pl-12{padding-left:calc(var(--spacing) * 12)}.pl-\[18px\]{padding-left:18px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-\[10\.5px\]{font-size:10.5px}.text-\[10px\]{font-size:10px}.text-\[11\.5px\]{font-size:11.5px}.text-\[11px\]{font-size:11px}.text-\[12\.5px\]{font-size:12.5px}.text-\[12px\]{font-size:12px}.text-\[13\.5px\]{font-size:13.5px}.text-\[13px\]{font-size:13px}.text-\[14\.5px\]{font-size:14.5px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-\[18px\]{font-size:18px}.text-\[20px\]{font-size:20px}.text-\[21px\]{font-size:21px}.text-\[22px\]{font-size:22px}.text-\[24px\]{font-size:24px}.text-\[26px\]{font-size:26px}.text-\[28px\]{font-size:28px}.text-\[30px\]{font-size:30px}.text-\[64px\]{font-size:64px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.leading-8{--tw-leading:calc(var(--spacing) * 8);line-height:calc(var(--spacing) * 8)}.leading-\[1\.4\]{--tw-leading:1.4;line-height:1.4}.leading-\[1\.5\]{--tw-leading:1.5;line-height:1.5}.leading-\[1\.45\]{--tw-leading:1.45;line-height:1.45}.leading-\[14px\]{--tw-leading:14px;line-height:14px}.leading-\[17px\]{--tw-leading:17px;line-height:17px}.leading-\[18px\]{--tw-leading:18px;line-height:18px}.leading-\[19px\]{--tw-leading:19px;line-height:19px}.leading-\[20px\]{--tw-leading:20px;line-height:20px}.leading-\[21px\]{--tw-leading:21px;line-height:21px}.leading-\[22px\]{--tw-leading:22px;line-height:22px}.leading-\[26px\]{--tw-leading:26px;line-height:26px}.leading-\[34px\]{--tw-leading:34px;line-height:34px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-\[0\.3em\]{--tw-tracking:.3em;letter-spacing:.3em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--color-accent)}.text-accent-fg{color:var(--color-accent-fg)}.text-accent-soft-fg{color:var(--color-accent-soft-fg)}.text-accent\/80{color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.text-accent\/80{color:color-mix(in oklab, var(--color-accent) 80%, transparent)}}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-bg{color:var(--color-bg)}.text-bubble-user-fg{color:var(--color-bubble-user-fg)}.text-cyan-600{color:var(--color-cyan-600)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-fg,.text-fg\/45{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/45{color:color-mix(in oklab, var(--color-fg) 45%, transparent)}}.text-fg\/60{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/60{color:color-mix(in oklab, var(--color-fg) 60%, transparent)}}.text-fg\/65{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/65{color:color-mix(in oklab, var(--color-fg) 65%, transparent)}}.text-fg\/70{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/70{color:color-mix(in oklab, var(--color-fg) 70%, transparent)}}.text-fg\/75{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/75{color:color-mix(in oklab, var(--color-fg) 75%, transparent)}}.text-fg\/80{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/80{color:color-mix(in oklab, var(--color-fg) 80%, transparent)}}.text-fg\/85{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/85{color:color-mix(in oklab, var(--color-fg) 85%, transparent)}}.text-fg\/90{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/90{color:color-mix(in oklab, var(--color-fg) 90%, transparent)}}.text-fuchsia-600{color:var(--color-fuchsia-600)}.text-muted,.text-muted\/70{color:var(--color-muted)}@supports (color:color-mix(in lab, red, red)){.text-muted\/70{color:color-mix(in oklab, var(--color-muted) 70%, transparent)}}.text-muted\/80{color:var(--color-muted)}@supports (color:color-mix(in lab, red, red)){.text-muted\/80{color:color-mix(in oklab, var(--color-muted) 80%, transparent)}}.text-orange-600{color:var(--color-orange-600)}.text-pink-600{color:var(--color-pink-600)}.text-red-600{color:var(--color-red-600)}.text-rose-500{color:var(--color-rose-500)}.text-rose-600{color:var(--color-rose-600)}.text-rose-700{color:var(--color-rose-700)}.text-sky-600{color:var(--color-sky-600)}.text-violet-600{color:var(--color-violet-600)}.text-white{color:var(--color-white)}.text-white\/85{color:#ffffffd9}@supports (color:color-mix(in lab, red, red)){.text-white\/85{color:color-mix(in oklab, var(--color-white) 85%, transparent)}}.text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\/90{color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.decoration-border{-webkit-text-decoration-color:var(--color-border);-webkit-text-decoration-color:var(--color-border);-webkit-text-decoration-color:var(--color-border);text-decoration-color:var(--color-border)}.decoration-dotted{text-decoration-style:dotted}.underline-offset-2{text-underline-offset:2px}.accent-\[var\(--om-accent\)\]{accent-color:var(--om-accent)}.accent-accent{accent-color:var(--color-accent)}.opacity-0{opacity:0}.opacity-45{opacity:.45}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_4px_rgba\(0\,0\,0\,0\.14\)\]{--tw-shadow:0 1px 4px var(--tw-shadow-color,#00000024);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_4px_rgba\(0\,0\,0\,0\.16\)\]{--tw-shadow:0 1px 4px var(--tw-shadow-color,#00000029);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_4px_rgba\(0\,0\,0\,0\.18\)\]{--tw-shadow:0 1px 4px var(--tw-shadow-color,#0000002e);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_2px_12px_-6px_rgba\(0\,0\,0\,0\.12\)\]{--tw-shadow:0 2px 12px -6px var(--tw-shadow-color,#0000001f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_2px_12px_rgba\(0\,0\,0\,0\.12\)\]{--tw-shadow:0 2px 12px var(--tw-shadow-color,#0000001f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_4px_20px_-12px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 4px 20px -12px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_12px_40px_-12px_rgba\(0\,0\,0\,0\.3\)\]{--tw-shadow:0 12px 40px -12px var(--tw-shadow-color,#0000004d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-\[2\.5px\]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2.5px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-\[3px\]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent,.ring-accent\/40{--tw-ring-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.ring-accent\/40{--tw-ring-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.ring-border\/50{--tw-ring-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.ring-border\/50{--tw-ring-color:color-mix(in oklab, var(--color-border) 50%, transparent)}}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-bg{--tw-ring-offset-color:var(--color-bg)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow-\[0_20px_40px_rgba\(0\,100\,212\,0\.28\)\]{--tw-drop-shadow-size:drop-shadow(0 20px 40px var(--tw-drop-shadow-color,#0064d447));--tw-drop-shadow:var(--tw-drop-shadow-size);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow-sm{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-sm));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-2xl{--tw-backdrop-blur:blur(var(--blur-2xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-\[2px\]{--tw-backdrop-blur:blur(2px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.will-change-transform{will-change:transform}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-muted::placeholder{color:var(--color-muted)}.odd\:bg-surface:nth-child(odd){background-color:var(--color-surface)}.focus-within\:border-fg\/20:focus-within{border-color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.focus-within\:border-fg\/20:focus-within{border-color:color-mix(in oklab, var(--color-fg) 20%, transparent)}}.focus-within\:ring-2:focus-within{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-within\:ring-accent\/40:focus-within{--tw-ring-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.focus-within\:ring-accent\/40:focus-within{--tw-ring-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}@media (hover:hover){.hover\:scale-\[1\.04\]:hover{scale:1.04}.hover\:bg-accent\/15:hover{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/15:hover{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.hover\:bg-border\/60:hover{background-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-border\/60:hover{background-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.hover\:bg-rose-500\/10:hover{background-color:#ff23571a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-rose-500\/10:hover{background-color:color-mix(in oklab, var(--color-rose-500) 10%, transparent)}}.hover\:bg-surface:hover{background-color:var(--color-surface)}.hover\:bg-surface-2:hover,.hover\:bg-surface-2\/60:hover{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-2\/60:hover{background-color:color-mix(in oklab, var(--color-surface-2) 60%, transparent)}}.hover\:bg-surface-2\/70:hover{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-2\/70:hover{background-color:color-mix(in oklab, var(--color-surface-2) 70%, transparent)}}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-fg:hover{color:var(--color-fg)}.hover\:text-rose-500:hover{color:var(--color-rose-500)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}.hover\:opacity-100:hover{opacity:1}.hover\:ring-2:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:ring-accent:hover,.hover\:ring-accent\/60:hover{--tw-ring-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.hover\:ring-accent\/60:hover{--tw-ring-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}}.focus\:border-accent:focus{border-color:var(--color-accent)}.focus\:bg-surface-2:focus{background-color:var(--color-surface-2)}.focus\:opacity-100:focus{opacity:1}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-accent\/40:focus{--tw-ring-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.focus\:ring-accent\/40:focus{--tw-ring-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:scale-\[0\.99\]:active{scale:.99}.active\:bg-surface-2:active,.active\:bg-surface-2\/70:active{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.active\:bg-surface-2\/70:active{background-color:color-mix(in oklab, var(--color-surface-2) 70%, transparent)}}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.disabled\:opacity-70:disabled{opacity:.7}@media (width>=40rem){.sm\:hidden{display:none}.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:items-center{align-items:center}.sm\:justify-center{justify-content:center}.sm\:rounded-3xl{border-radius:var(--radius-3xl)}.sm\:rounded-\[28px\]{border-radius:28px}.sm\:border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.sm\:border-border{border-color:var(--color-border)}}@container (width>=42rem){.\@2xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.dark\:border:where([data-theme=dark],[data-theme=dark] *){border-style:var(--tw-border-style);border-width:1px}.dark\:border-border:where([data-theme=dark],[data-theme=dark] *){border-color:var(--color-border)}.dark\:bg-accent\/\[0\.10\]:where([data-theme=dark],[data-theme=dark] *){background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-accent\/\[0\.10\]:where([data-theme=dark],[data-theme=dark] *){background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.dark\:bg-amber-400\/\[0\.08\]:where([data-theme=dark],[data-theme=dark] *){background-color:#fcbb0014}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-400\/\[0\.08\]:where([data-theme=dark],[data-theme=dark] *){background-color:color-mix(in oklab, var(--color-amber-400) 8%, transparent)}}.dark\:bg-\[radial-gradient\(ellipse_at_top\,rgba\(23\,147\,255\,0\.2\)\,transparent_65\%\)\]:where([data-theme=dark],[data-theme=dark] *){background-image:radial-gradient(at top,#1793ff33,#0000 65%)}.dark\:text-amber-200:where([data-theme=dark],[data-theme=dark] *){color:var(--color-amber-200)}.dark\:text-amber-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-amber-300)}.dark\:text-cyan-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-cyan-300)}.dark\:text-emerald-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-emerald-300)}.dark\:text-emerald-400:where([data-theme=dark],[data-theme=dark] *){color:var(--color-emerald-400)}.dark\:text-fuchsia-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-fuchsia-300)}.dark\:text-orange-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-orange-300)}.dark\:text-pink-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-pink-300)}.dark\:text-red-400:where([data-theme=dark],[data-theme=dark] *){color:var(--color-red-400)}.dark\:text-rose-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-rose-300)}.dark\:text-rose-400:where([data-theme=dark],[data-theme=dark] *){color:var(--color-rose-400)}.dark\:text-sky-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-sky-300)}.dark\:text-violet-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-violet-300)}.dark\:shadow-none:where([data-theme=dark],[data-theme=dark] *){--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}@media (width>=64rem){.wide\:invisible{visibility:hidden}}:where(html.desktop) .wide\:invisible{visibility:hidden}@media (width>=64rem){.wide\:inset-y-0{inset-block:0}}:where(html.desktop) .wide\:inset-y-0{inset-block:0}@media (width>=64rem){.wide\:mt-0{margin-top:0}}:where(html.desktop) .wide\:mt-0{margin-top:0}@media (width>=64rem){.wide\:mt-5{margin-top:calc(var(--spacing) * 5)}}:where(html.desktop) .wide\:mt-5{margin-top:calc(var(--spacing) * 5)}@media (width>=64rem){.wide\:block{display:block}}:where(html.desktop) .wide\:block{display:block}@media (width>=64rem){.wide\:flex{display:flex}}:where(html.desktop) .wide\:flex{display:flex}@media (width>=64rem){.wide\:grid{display:grid}}:where(html.desktop) .wide\:grid{display:grid}@media (width>=64rem){.wide\:hidden{display:none}}:where(html.desktop) .wide\:hidden{display:none}@media (width>=64rem){.wide\:h-auto{height:auto}}:where(html.desktop) .wide\:h-auto{height:auto}@media (width>=64rem){.wide\:h-full{height:100%}}:where(html.desktop) .wide\:h-full{height:100%}@media (width>=64rem){.wide\:max-w-\[600px\]{max-width:600px}}:where(html.desktop) .wide\:max-w-\[600px\]{max-width:600px}@media (width>=64rem){.wide\:max-w-\[900px\]{max-width:900px}}:where(html.desktop) .wide\:max-w-\[900px\]{max-width:900px}@media (width>=64rem){.wide\:max-w-\[980px\]{max-width:980px}}:where(html.desktop) .wide\:max-w-\[980px\]{max-width:980px}@media (width>=64rem){.wide\:max-w-md{max-width:var(--container-md)}}:where(html.desktop) .wide\:max-w-md{max-width:var(--container-md)}@media (width>=64rem){.wide\:max-w-none{max-width:none}}:where(html.desktop) .wide\:max-w-none{max-width:none}@media (width>=64rem){.wide\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}}:where(html.desktop) .wide\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}@media (width>=64rem){.wide\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}:where(html.desktop) .wide\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}@media (width>=64rem){.wide\:grid-cols-\[1\.1fr_1fr\]{grid-template-columns:1.1fr 1fr}}:where(html.desktop) .wide\:grid-cols-\[1\.1fr_1fr\]{grid-template-columns:1.1fr 1fr}@media (width>=64rem){.wide\:flex-row{flex-direction:row}}:where(html.desktop) .wide\:flex-row{flex-direction:row}@media (width>=64rem){.wide\:items-center{align-items:center}}:where(html.desktop) .wide\:items-center{align-items:center}@media (width>=64rem){.wide\:items-start{align-items:flex-start}}:where(html.desktop) .wide\:items-start{align-items:flex-start}@media (width>=64rem){.wide\:gap-1\.5{gap:calc(var(--spacing) * 1.5)}}:where(html.desktop) .wide\:gap-1\.5{gap:calc(var(--spacing) * 1.5)}@media (width>=64rem){.wide\:gap-16{gap:calc(var(--spacing) * 16)}}:where(html.desktop) .wide\:gap-16{gap:calc(var(--spacing) * 16)}@media (width>=64rem){.wide\:border-0{border-style:var(--tw-border-style);border-width:0}}:where(html.desktop) .wide\:border-0{border-style:var(--tw-border-style);border-width:0}@media (width>=64rem){.wide\:border-x-0{border-inline-style:var(--tw-border-style);border-inline-width:0}}:where(html.desktop) .wide\:border-x-0{border-inline-style:var(--tw-border-style);border-inline-width:0}@media (width>=64rem){.wide\:bg-transparent{background-color:#0000}}:where(html.desktop) .wide\:bg-transparent{background-color:#0000}@media (width>=64rem){.wide\:bg-\[radial-gradient\(ellipse_at_left\,rgba\(0\,100\,212\,0\.12\)\,transparent_60\%\)\]{background-image:radial-gradient(at 0,#0064d41f,#0000 60%)}}:where(html.desktop) .wide\:bg-\[radial-gradient\(ellipse_at_left\,rgba\(0\,100\,212\,0\.12\)\,transparent_60\%\)\]{background-image:radial-gradient(at 0,#0064d41f,#0000 60%)}@media (width>=64rem){.wide\:p-7{padding:calc(var(--spacing) * 7)}}:where(html.desktop) .wide\:p-7{padding:calc(var(--spacing) * 7)}@media (width>=64rem){.wide\:px-0{padding-inline:0}}:where(html.desktop) .wide\:px-0{padding-inline:0}@media (width>=64rem){.wide\:px-12{padding-inline:calc(var(--spacing) * 12)}}:where(html.desktop) .wide\:px-12{padding-inline:calc(var(--spacing) * 12)}@media (width>=64rem){.wide\:py-1{padding-block:var(--spacing)}}:where(html.desktop) .wide\:py-1{padding-block:var(--spacing)}@media (width>=64rem){.wide\:pt-0{padding-top:0}}:where(html.desktop) .wide\:pt-0{padding-top:0}@media (width>=64rem){.wide\:pb-0{padding-bottom:0}}:where(html.desktop) .wide\:pb-0{padding-bottom:0}@media (width>=64rem){.wide\:text-left{text-align:left}}:where(html.desktop) .wide\:text-left{text-align:left}@media (width>=64rem){.wide\:text-\[13\.5px\]{font-size:13.5px}}:where(html.desktop) .wide\:text-\[13\.5px\]{font-size:13.5px}@media (width>=64rem){.wide\:text-\[15\.5px\]{font-size:15.5px}}:where(html.desktop) .wide\:text-\[15\.5px\]{font-size:15.5px}@media (width>=64rem){.wide\:text-\[34px\]{font-size:34px}}:where(html.desktop) .wide\:text-\[34px\]{font-size:34px}@media (width>=64rem){.wide\:dark\:bg-\[radial-gradient\(ellipse_at_left\,rgba\(23\,147\,255\,0\.16\)\,transparent_60\%\)\]:where([data-theme=dark],[data-theme=dark] *){background-image:radial-gradient(at 0,#1793ff29,#0000 60%)}}:where(html.desktop) .wide\:dark\:bg-\[radial-gradient\(ellipse_at_left\,rgba\(23\,147\,255\,0\.16\)\,transparent_60\%\)\]:where([data-theme=dark],[data-theme=dark] *){background-image:radial-gradient(at 0,#1793ff29,#0000 60%)}.\[\&\+\&\]\:mt-1\.5+.\[\&\+\&\]\:mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}}@font-face{font-family:Figtree;font-style:normal;font-weight:300 900;font-display:swap;src:url(/fonts/figtree-latin.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Figtree;font-style:normal;font-weight:300 900;font-display:swap;src:url(/fonts/figtree-latin-ext.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}:root{--om-bg:#fcfcfc;--om-surface:#fff;--om-surface-2:#f2f2f4;--om-border:#e7e7ea;--om-fg:#111112;--om-muted:#6b6b71;--om-accent:#0064d4;--om-accent-soft:#e5f0ff;--om-accent-soft-fg:#012f80;--om-bubble-user:#d8e9ff;--om-bubble-user-fg:#111112;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}html[data-theme=dark]{--om-bg:#181819;--om-surface:#202022;--om-surface-2:#2a2a2d;--om-border:#333337;--om-fg:#fff;--om-muted:#9d9da4;--om-accent:#1793ff;--om-accent-soft:#1a2b4a;--om-accent-soft-fg:#e5f0ff;--om-bubble-user:#1c3d66;--om-bubble-user-fg:#fff;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}html,body,#root{height:100%}body{background:var(--om-bg);color:var(--om-fg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;overscroll-behavior-y:none;margin:0}.safe-top{padding-top:env(safe-area-inset-top)}.titlebar-room{display:none}html.desktop[data-platform=darwin] .titlebar-room{-webkit-app-region:drag;flex-shrink:0;height:28px;display:block}.safe-bottom{padding-bottom:env(safe-area-inset-bottom)}*{scrollbar-width:thin;scrollbar-color:var(--om-border) transparent}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-thumb{background:var(--om-border);border-radius:999px}::-webkit-scrollbar-track{background:0 0}@media (pointer:coarse),(width<=480px){*{scrollbar-width:none}::-webkit-scrollbar{display:none}}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{scrollbar-width:none}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md p{margin:.35em 0}.md ul,.md ol{margin:.35em 0;padding-left:1.3em}.md ul{list-style:outside}.md ol{list-style:decimal}.md li{margin:.15em 0}.md h1,.md h2,.md h3,.md h4{margin:.7em 0 .3em;font-weight:650;line-height:1.3}.md h1{font-size:1.15em}.md h2{font-size:1.08em}.md h3,.md h4{font-size:1em}.md a{color:var(--om-accent);text-underline-offset:2px;word-break:break-all;text-decoration:underline}.bubble-user .md a{color:var(--om-accent)}.md code{background:#7f7fa029;border-radius:6px;padding:.1em .35em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.86em}.md pre{color:#eaeaf5;background:#0f0f19e6;border-radius:12px;margin:.5em 0;padding:.7em .85em;font-size:.82em;line-height:1.45;overflow-x:auto}.md pre code{font-size:inherit;background:0 0;padding:0}.md .md-file{color:var(--om-accent);background:var(--om-accent);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.86em}@supports (color:color-mix(in lab, red, red)){.md .md-file{background:color-mix(in srgb, var(--om-accent) 12%, transparent)}}.md .md-file{text-underline-offset:2px;word-break:break-all;border-radius:6px;padding:.1em .4em;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.md blockquote{border-left:3px solid var(--om-border);color:var(--om-muted);margin:.5em 0;padding-left:.8em}.md table{border-collapse:collapse;max-width:100%;margin:.5em 0;font-size:.9em;display:block;overflow-x:auto}.md th,.md td{border:1px solid var(--om-border);text-align:left;padding:.3em .55em}.md hr{border:0;border-top:1px solid var(--om-border);margin:.7em 0}.md img{border-radius:10px;max-width:100%}@keyframes om-breathe{0%,to{transform:translateY(0)scale(1)}50%{transform:translateY(-1.5%)scale(1.025)}}@keyframes om-sway{0%,to{transform:rotate(-4deg)translateY(0)}25%{transform:rotate(0)translateY(-2%)}50%{transform:rotate(4deg)translateY(0)}75%{transform:rotate(0)translateY(-2%)}}@keyframes om-hop{0%,70%,to{transform:translateY(0)scale(1)}78%{transform:translateY(-9%)scale(1.04,.97)}86%{transform:translateY(0)scale(.98,1.03)}92%{transform:translateY(-3%)scale(1)}}@keyframes om-wiggle{0%,to{transform:rotate(0)}20%{transform:rotate(-10deg)scale(1.06)}45%{transform:rotate(9deg)scale(1.06)}70%{transform:rotate(-5deg)}}.avatar-idle{animation:4.5s ease-in-out infinite om-breathe}.avatar-working{animation:2.6s ease-in-out infinite om-sway}.avatar-waiting{animation:3.2s ease-in-out infinite om-hop}.avatar-wiggle{animation:.6s ease-in-out om-wiggle}@keyframes om-pop{0%{transform:scale(.6)}70%{transform:scale(1.06)}to{transform:scale(1)}}.avatar-pop{animation:.55s cubic-bezier(.34,1.56,.64,1) om-pop}@media (prefers-reduced-motion:reduce){.avatar-idle,.avatar-working,.avatar-waiting,.avatar-wiggle,.avatar-pop{animation:none}}@keyframes om-blink{50%{opacity:.25}}.typing-dot{animation:1.1s infinite om-blink}.typing-dot:nth-child(2){animation-delay:.18s}.typing-dot:nth-child(3){animation-delay:.36s}@keyframes om-rise{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}.rise{animation:.18s ease-out om-rise}@keyframes om-sheet{0%{transform:translateY(100%)}to{transform:none}}.sheet-in{animation:.22s cubic-bezier(.2,.8,.2,1) om-sheet}@keyframes om-drawer-in{0%{transform:translate(-100%)}to{transform:none}}.drawer-in{animation:.2s ease-out om-drawer-in}@property --tw-border-spacing-x{syntax:"";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"";inherits:false;initial-value:0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
diff --git a/nanomuse/server/static/assets/index-D-ZnIXbP.css b/nanomuse/server/static/assets/index-D-ZnIXbP.css
deleted file mode 100644
index 12015268c..000000000
--- a/nanomuse/server/static/assets/index-D-ZnIXbP.css
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
-@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:"Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-teal-700:oklch(51.1% .096 186.391);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-600:oklch(58.8% .158 241.966);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-500:oklch(60.6% .25 292.717);--color-violet-600:oklch(54.1% .281 293.009);--color-fuchsia-300:oklch(83.3% .145 321.434);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-fuchsia-600:oklch(59.1% .293 322.896);--color-pink-300:oklch(82.3% .12 346.018);--color-pink-500:oklch(65.6% .241 354.308);--color-pink-600:oklch(59.2% .249 .584);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-900:oklch(20.8% .042 265.755);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--drop-shadow-sm:0 1px 2px #00000026;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:var(--om-bg);--color-surface:var(--om-surface);--color-surface-2:var(--om-surface-2);--color-border:var(--om-border);--color-fg:var(--om-fg);--color-muted:var(--om-muted);--color-accent:var(--om-accent);--color-accent-fg:#fff;--color-bubble-user:var(--om-bubble-user);--color-bubble-user-fg:var(--om-bubble-user-fg)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\@container{container-type:inline-size}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.-top-1{top:calc(var(--spacing) * -1)}.-top-1\.5{top:calc(var(--spacing) * -1.5)}.-top-20{top:calc(var(--spacing) * -20)}.top-0{top:0}.top-0\.5{top:calc(var(--spacing) * .5)}.top-1{top:var(--spacing)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-9{top:calc(var(--spacing) * 9)}.top-12{top:calc(var(--spacing) * 12)}.top-\[3px\]{top:3px}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1{right:calc(var(--spacing) * -1)}.-right-1\.5{right:calc(var(--spacing) * -1.5)}.-right-16{right:calc(var(--spacing) * -16)}.right-0{right:0}.right-1{right:var(--spacing)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.right-\[3px\]{right:3px}.-bottom-0\.5{bottom:calc(var(--spacing) * -.5)}.bottom-0{bottom:0}.bottom-1{bottom:var(--spacing)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-24{bottom:calc(var(--spacing) * 24)}.left-0{left:0}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\.5{left:calc(var(--spacing) * 1.5)}.left-1\/2{left:50%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.left-\[18px\]{left:18px}.left-\[22px\]{left:22px}.left-\[26px\]{left:26px}.left-\[68px\]{left:68px}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-mx-4{margin-inline:calc(var(--spacing) * -4)}.mx-1{margin-inline:var(--spacing)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-3{margin-inline:calc(var(--spacing) * 3)}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.my-2{margin-block:calc(var(--spacing) * 2)}.my-8{margin-block:calc(var(--spacing) * 8)}.-mt-0\.5{margin-top:calc(var(--spacing) * -.5)}.-mt-1{margin-top:calc(var(--spacing) * -1)}.-mt-2\.5{margin-top:calc(var(--spacing) * -2.5)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-3\.5{margin-top:calc(var(--spacing) * 3.5)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-7{margin-top:calc(var(--spacing) * 7)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mt-\[2px\]{margin-top:2px}.mt-\[3px\]{margin-top:3px}.mt-\[22px\]{margin-top:22px}.mt-auto{margin-top:auto}.-mr-1\.5{margin-right:calc(var(--spacing) * -1.5)}.-mr-2{margin-right:calc(var(--spacing) * -2)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-2\.5{margin-right:calc(var(--spacing) * 2.5)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mr-5{margin-right:calc(var(--spacing) * 5)}.-mb-2{margin-bottom:calc(var(--spacing) * -2)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.-ml-1{margin-left:calc(var(--spacing) * -1)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-2\.5{margin-left:calc(var(--spacing) * 2.5)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-\[52px\]{margin-left:52px}.ml-\[76px\]{margin-left:76px}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-\[16\/10\]{aspect-ratio:16/10}.aspect-square{aspect-ratio:1}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-28{height:calc(var(--spacing) * 28)}.h-40{height:calc(var(--spacing) * 40)}.h-44{height:calc(var(--spacing) * 44)}.h-48{height:calc(var(--spacing) * 48)}.h-\[9px\]{height:9px}.h-\[17px\]{height:17px}.h-\[18px\]{height:18px}.h-\[46px\]{height:46px}.h-\[46vh\]{height:46vh}.h-\[50px\]{height:50px}.h-\[72px\]{height:72px}.h-\[100dvh\]{height:100dvh}.h-\[130px\]{height:130px}.h-\[148px\]{height:148px}.h-\[480px\]{height:480px}.h-full{height:100%}.max-h-28{max-height:calc(var(--spacing) * 28)}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-52{max-height:calc(var(--spacing) * 52)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[92dvh\]{max-height:92dvh}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-\[40vh\]{min-height:40vh}.min-h-\[44px\]{min-height:44px}.min-h-\[54px\]{min-height:54px}.min-h-\[56px\]{min-height:56px}.\!w-auto{width:auto!important}.w-1{width:var(--spacing)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-28{width:calc(var(--spacing) * 28)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-\[9px\]{width:9px}.w-\[46px\]{width:46px}.w-\[60px\]{width:60px}.w-\[64px\]{width:64px}.w-\[72px\]{width:72px}.w-\[74px\]{width:74px}.w-\[76px\]{width:76px}.w-\[82vw\]{width:82vw}.w-\[86px\]{width:86px}.w-\[148px\]{width:148px}.w-\[188px\]{width:188px}.w-\[232px\]{width:232px}.w-\[248px\]{width:248px}.w-\[260px\]{width:260px}.w-\[300px\]{width:300px}.w-\[900px\]{width:900px}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.max-w-\[60\%\]{max-width:60%}.max-w-\[68px\]{max-width:68px}.max-w-\[86\%\]{max-width:86%}.max-w-\[240px\]{max-width:240px}.max-w-\[320px\]{max-width:320px}.max-w-\[340px\]{max-width:340px}.max-w-\[360px\]{max-width:360px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[600px\]{max-width:600px}.max-w-\[720px\]{max-width:720px}.max-w-\[760px\]{max-width:760px}.max-w-\[calc\(100\%-128px\)\]{max-width:calc(100% - 128px)}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-\[17px\]{min-width:17px}.min-w-\[18px\]{min-width:18px}.min-w-\[180px\]{min-width:180px}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-separate{border-collapse:separate}.border-spacing-0{--tw-border-spacing-x:0px;--tw-border-spacing-y:0px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}.origin-top-left{transform-origin:0 0}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-\[0\.3333\]{scale:.3333}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-crosshair{cursor:crosshair}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize-y{resize:vertical}.scroll-mt-4{scroll-margin-top:calc(var(--spacing) * 4)}.list-decimal{list-style-type:decimal}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.grid-cols-\[1fr_1fr_auto\]{grid-template-columns:1fr 1fr auto}.grid-cols-\[1fr_84px\]{grid-template-columns:1fr 84px}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-evenly{justify-content:space-evenly}.justify-start{justify-content:flex-start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-\[3px\]{gap:3px}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-1\.5{column-gap:calc(var(--spacing) * 1.5)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-0\.5{row-gap:calc(var(--spacing) * .5)}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)),:where(.divide-border\/60>:not(:last-child)){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){:where(.divide-border\/60>:not(:last-child)){border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}:where(.divide-border\/70>:not(:last-child)){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){:where(.divide-border\/70>:not(:last-child)){border-color:color-mix(in oklab, var(--color-border) 70%, transparent)}}.self-center{align-self:center}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\[10px\]{border-radius:10px}.rounded-\[13px\]{border-radius:13px}.rounded-\[14px\]{border-radius:14px}.rounded-\[18px\]{border-radius:18px}.rounded-\[20px\]{border-radius:20px}.rounded-\[22px\]{border-radius:22px}.rounded-\[26px\]{border-radius:26px}.rounded-\[28px\]{border-radius:28px}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-3xl{border-top-left-radius:var(--radius-3xl);border-top-right-radius:var(--radius-3xl)}.rounded-t-\[28px\]{border-top-left-radius:28px;border-top-right-radius:28px}.rounded-tl-lg{border-top-left-radius:var(--radius-lg)}.rounded-br-lg{border-bottom-right-radius:var(--radius-lg)}.rounded-bl-lg{border-bottom-left-radius:var(--radius-lg)}.rounded-bl-md{border-bottom-left-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-\[1\.5px\]{border-style:var(--tw-border-style);border-width:1.5px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent,.border-accent\/15{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/15{border-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.border-accent\/25{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/25{border-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.border-accent\/30{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/30{border-color:color-mix(in oklab, var(--color-accent) 30%, transparent)}}.border-accent\/40{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-accent\/50{border-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\/50{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.border-amber-400\/40{border-color:#fcbb0066}@supports (color:color-mix(in lab, red, red)){.border-amber-400\/40{border-color:color-mix(in oklab, var(--color-amber-400) 40%, transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/50{border-color:color-mix(in oklab, var(--color-amber-500) 50%, transparent)}}.border-bg{border-color:var(--color-bg)}.border-border,.border-border\/60{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.border-border\/70{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.border-border\/70{border-color:color-mix(in oklab, var(--color-border) 70%, transparent)}}.border-border\/80{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.border-border\/80{border-color:color-mix(in oklab, var(--color-border) 80%, transparent)}}.border-current{border-color:currentColor}.border-fg{border-color:var(--color-fg)}.border-rose-400{border-color:var(--color-rose-400)}.border-rose-400\/60{border-color:#ff667f99}@supports (color:color-mix(in lab, red, red)){.border-rose-400\/60{border-color:color-mix(in oklab, var(--color-rose-400) 60%, transparent)}}.border-rose-500\/25{border-color:#ff235740}@supports (color:color-mix(in lab, red, red)){.border-rose-500\/25{border-color:color-mix(in oklab, var(--color-rose-500) 25%, transparent)}}.border-surface{border-color:var(--color-surface)}.border-transparent{border-color:#0000}.border-t-transparent{border-top-color:#0000}.bg-\[\#2fb344\]{background-color:#2fb344}.bg-\[\#f1efeb\]{background-color:#f1efeb}.bg-accent,.bg-accent\/5{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/5{background-color:color-mix(in oklab, var(--color-accent) 5%, transparent)}}.bg-accent\/8{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/8{background-color:color-mix(in oklab, var(--color-accent) 8%, transparent)}}.bg-accent\/10{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-accent\/12{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/12{background-color:color-mix(in oklab, var(--color-accent) 12%, transparent)}}.bg-accent\/15{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-accent\/70{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/70{background-color:color-mix(in oklab, var(--color-accent) 70%, transparent)}}.bg-accent\/\[0\.06\]{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.06\]{background-color:color-mix(in oklab, var(--color-accent) 6%, transparent)}}.bg-amber-50\/70{background-color:#fffbebb3}@supports (color:color-mix(in lab, red, red)){.bg-amber-50\/70{background-color:color-mix(in oklab, var(--color-amber-50) 70%, transparent)}}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-400\/15{background-color:#fcbb0026}@supports (color:color-mix(in lab, red, red)){.bg-amber-400\/15{background-color:color-mix(in oklab, var(--color-amber-400) 15%, transparent)}}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/10{background-color:color-mix(in oklab, var(--color-amber-500) 10%, transparent)}}.bg-amber-500\/12{background-color:#f99c001f}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/12{background-color:color-mix(in oklab, var(--color-amber-500) 12%, transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/15{background-color:color-mix(in oklab, var(--color-amber-500) 15%, transparent)}}.bg-bg,.bg-bg\/50{background-color:var(--color-bg)}@supports (color:color-mix(in lab, red, red)){.bg-bg\/50{background-color:color-mix(in oklab, var(--color-bg) 50%, transparent)}}.bg-bg\/60{background-color:var(--color-bg)}@supports (color:color-mix(in lab, red, red)){.bg-bg\/60{background-color:color-mix(in oklab, var(--color-bg) 60%, transparent)}}.bg-bg\/80{background-color:var(--color-bg)}@supports (color:color-mix(in lab, red, red)){.bg-bg\/80{background-color:color-mix(in oklab, var(--color-bg) 80%, transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\/20{background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.bg-black\/40{background-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.bg-black\/45{background-color:#00000073}@supports (color:color-mix(in lab, red, red)){.bg-black\/45{background-color:color-mix(in oklab, var(--color-black) 45%, transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-border{background-color:var(--color-border)}.bg-bubble-user{background-color:var(--color-bubble-user)}.bg-cyan-500\/12{background-color:#00b7d71f}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/12{background-color:color-mix(in oklab, var(--color-cyan-500) 12%, transparent)}}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/12{background-color:#00bb7f1f}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/12{background-color:color-mix(in oklab, var(--color-emerald-500) 12%, transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/15{background-color:color-mix(in oklab, var(--color-emerald-500) 15%, transparent)}}.bg-fg,.bg-fg\/40{background-color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.bg-fg\/40{background-color:color-mix(in oklab, var(--color-fg) 40%, transparent)}}.bg-fuchsia-500\/12{background-color:#e12afb1f}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/12{background-color:color-mix(in oklab, var(--color-fuchsia-500) 12%, transparent)}}.bg-muted,.bg-muted\/35{background-color:var(--color-muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/35{background-color:color-mix(in oklab, var(--color-muted) 35%, transparent)}}.bg-orange-500\/12{background-color:#fe6e001f}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/12{background-color:color-mix(in oklab, var(--color-orange-500) 12%, transparent)}}.bg-pink-500{background-color:var(--color-pink-500)}.bg-pink-500\/12{background-color:#f6339a1f}@supports (color:color-mix(in lab, red, red)){.bg-pink-500\/12{background-color:color-mix(in oklab, var(--color-pink-500) 12%, transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-rose-400{background-color:var(--color-rose-400)}.bg-rose-500{background-color:var(--color-rose-500)}.bg-rose-500\/12{background-color:#ff23571f}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/12{background-color:color-mix(in oklab, var(--color-rose-500) 12%, transparent)}}.bg-rose-500\/15{background-color:#ff235726}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/15{background-color:color-mix(in oklab, var(--color-rose-500) 15%, transparent)}}.bg-rose-500\/\[0\.04\]{background-color:#ff23570a}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/\[0\.04\]{background-color:color-mix(in oklab, var(--color-rose-500) 4%, transparent)}}.bg-sky-500\/12{background-color:#00a5ef1f}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\/12{background-color:color-mix(in oklab, var(--color-sky-500) 12%, transparent)}}.bg-surface{background-color:var(--color-surface)}.bg-surface-2,.bg-surface-2\/40{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.bg-surface-2\/40{background-color:color-mix(in oklab, var(--color-surface-2) 40%, transparent)}}.bg-surface-2\/60{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.bg-surface-2\/60{background-color:color-mix(in oklab, var(--color-surface-2) 60%, transparent)}}.bg-surface-2\/70{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.bg-surface-2\/70{background-color:color-mix(in oklab, var(--color-surface-2) 70%, transparent)}}.bg-surface-2\/80{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.bg-surface-2\/80{background-color:color-mix(in oklab, var(--color-surface-2) 80%, transparent)}}.bg-surface\/40{background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.bg-surface\/40{background-color:color-mix(in oklab, var(--color-surface) 40%, transparent)}}.bg-surface\/70{background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.bg-surface\/70{background-color:color-mix(in oklab, var(--color-surface) 70%, transparent)}}.bg-surface\/90{background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.bg-surface\/90{background-color:color-mix(in oklab, var(--color-surface) 90%, transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500{background-color:var(--color-violet-500)}.bg-violet-500\/12{background-color:#8d54ff1f}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/12{background-color:color-mix(in oklab, var(--color-violet-500) 12%, transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab, red, red)){.bg-white\/80{background-color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-\[radial-gradient\(ellipse_at_top\,rgba\(0\,100\,212\,0\.14\)\,transparent_65\%\)\]{background-image:radial-gradient(at top,#0064d424,#0000 65%)}.from-\[\#7d6bc7\]{--tw-gradient-from:#7d6bc7;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-\[\#b0413e\]{--tw-gradient-from:#b0413e;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-accent{--tw-gradient-from:var(--color-accent);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500{--tw-gradient-from:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-400{--tw-gradient-from:var(--color-orange-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-400{--tw-gradient-from:var(--color-slate-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-700{--tw-gradient-from:var(--color-slate-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-\[\#7a1f1f\]{--tw-gradient-to:#7a1f1f;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-\[\#574494\]{--tw-gradient-to:#574494;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-600{--tw-gradient-to:var(--color-amber-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-400{--tw-gradient-to:var(--color-sky-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-600{--tw-gradient-to:var(--color-slate-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-900{--tw-gradient-to:var(--color-slate-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-700{--tw-gradient-to:var(--color-teal-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-top{object-position:top}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.\!px-3\.5{padding-inline:calc(var(--spacing) * 3.5)!important}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.px-16{padding-inline:calc(var(--spacing) * 16)}.\!py-1\.5{padding-block:calc(var(--spacing) * 1.5)!important}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.pt-0{padding-top:0}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-3\.5{padding-top:calc(var(--spacing) * 3.5)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-9{padding-top:calc(var(--spacing) * 9)}.pt-10{padding-top:calc(var(--spacing) * 10)}.pt-14{padding-top:calc(var(--spacing) * 14)}.pt-\[3px\]{padding-top:3px}.pt-\[18px\]{padding-top:18px}.pt-\[22px\]{padding-top:22px}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-5{padding-right:calc(var(--spacing) * 5)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-0\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-2\.5{padding-bottom:calc(var(--spacing) * 2.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-3\.5{padding-bottom:calc(var(--spacing) * 3.5)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-7{padding-bottom:calc(var(--spacing) * 7)}.pb-8{padding-bottom:calc(var(--spacing) * 8)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-9{padding-left:calc(var(--spacing) * 9)}.pl-12{padding-left:calc(var(--spacing) * 12)}.pl-\[18px\]{padding-left:18px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-\[10\.5px\]{font-size:10.5px}.text-\[10px\]{font-size:10px}.text-\[11\.5px\]{font-size:11.5px}.text-\[11px\]{font-size:11px}.text-\[12\.5px\]{font-size:12.5px}.text-\[12px\]{font-size:12px}.text-\[13\.5px\]{font-size:13.5px}.text-\[13px\]{font-size:13px}.text-\[14\.5px\]{font-size:14.5px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-\[18px\]{font-size:18px}.text-\[20px\]{font-size:20px}.text-\[21px\]{font-size:21px}.text-\[22px\]{font-size:22px}.text-\[24px\]{font-size:24px}.text-\[26px\]{font-size:26px}.text-\[28px\]{font-size:28px}.text-\[30px\]{font-size:30px}.text-\[64px\]{font-size:64px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.leading-8{--tw-leading:calc(var(--spacing) * 8);line-height:calc(var(--spacing) * 8)}.leading-\[1\.4\]{--tw-leading:1.4;line-height:1.4}.leading-\[1\.5\]{--tw-leading:1.5;line-height:1.5}.leading-\[1\.45\]{--tw-leading:1.45;line-height:1.45}.leading-\[14px\]{--tw-leading:14px;line-height:14px}.leading-\[17px\]{--tw-leading:17px;line-height:17px}.leading-\[18px\]{--tw-leading:18px;line-height:18px}.leading-\[19px\]{--tw-leading:19px;line-height:19px}.leading-\[20px\]{--tw-leading:20px;line-height:20px}.leading-\[21px\]{--tw-leading:21px;line-height:21px}.leading-\[22px\]{--tw-leading:22px;line-height:22px}.leading-\[26px\]{--tw-leading:26px;line-height:26px}.leading-\[34px\]{--tw-leading:34px;line-height:34px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-\[0\.3em\]{--tw-tracking:.3em;letter-spacing:.3em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--color-accent)}.text-accent-fg{color:var(--color-accent-fg)}.text-accent\/80{color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.text-accent\/80{color:color-mix(in oklab, var(--color-accent) 80%, transparent)}}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-bg{color:var(--color-bg)}.text-bubble-user-fg{color:var(--color-bubble-user-fg)}.text-cyan-600{color:var(--color-cyan-600)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-fg,.text-fg\/45{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/45{color:color-mix(in oklab, var(--color-fg) 45%, transparent)}}.text-fg\/60{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/60{color:color-mix(in oklab, var(--color-fg) 60%, transparent)}}.text-fg\/65{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/65{color:color-mix(in oklab, var(--color-fg) 65%, transparent)}}.text-fg\/70{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/70{color:color-mix(in oklab, var(--color-fg) 70%, transparent)}}.text-fg\/75{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/75{color:color-mix(in oklab, var(--color-fg) 75%, transparent)}}.text-fg\/80{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/80{color:color-mix(in oklab, var(--color-fg) 80%, transparent)}}.text-fg\/85{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/85{color:color-mix(in oklab, var(--color-fg) 85%, transparent)}}.text-fg\/90{color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.text-fg\/90{color:color-mix(in oklab, var(--color-fg) 90%, transparent)}}.text-fuchsia-600{color:var(--color-fuchsia-600)}.text-muted,.text-muted\/70{color:var(--color-muted)}@supports (color:color-mix(in lab, red, red)){.text-muted\/70{color:color-mix(in oklab, var(--color-muted) 70%, transparent)}}.text-muted\/80{color:var(--color-muted)}@supports (color:color-mix(in lab, red, red)){.text-muted\/80{color:color-mix(in oklab, var(--color-muted) 80%, transparent)}}.text-orange-600{color:var(--color-orange-600)}.text-pink-600{color:var(--color-pink-600)}.text-red-600{color:var(--color-red-600)}.text-rose-500{color:var(--color-rose-500)}.text-rose-600{color:var(--color-rose-600)}.text-rose-700{color:var(--color-rose-700)}.text-sky-600{color:var(--color-sky-600)}.text-violet-600{color:var(--color-violet-600)}.text-white{color:var(--color-white)}.text-white\/85{color:#ffffffd9}@supports (color:color-mix(in lab, red, red)){.text-white\/85{color:color-mix(in oklab, var(--color-white) 85%, transparent)}}.text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\/90{color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.decoration-border{-webkit-text-decoration-color:var(--color-border);-webkit-text-decoration-color:var(--color-border);-webkit-text-decoration-color:var(--color-border);text-decoration-color:var(--color-border)}.decoration-dotted{text-decoration-style:dotted}.underline-offset-2{text-underline-offset:2px}.accent-\[var\(--om-accent\)\]{accent-color:var(--om-accent)}.accent-accent{accent-color:var(--color-accent)}.opacity-0{opacity:0}.opacity-45{opacity:.45}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_4px_rgba\(0\,0\,0\,0\.14\)\]{--tw-shadow:0 1px 4px var(--tw-shadow-color,#00000024);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_4px_rgba\(0\,0\,0\,0\.16\)\]{--tw-shadow:0 1px 4px var(--tw-shadow-color,#00000029);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_4px_rgba\(0\,0\,0\,0\.18\)\]{--tw-shadow:0 1px 4px var(--tw-shadow-color,#0000002e);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_2px_12px_-6px_rgba\(0\,0\,0\,0\.12\)\]{--tw-shadow:0 2px 12px -6px var(--tw-shadow-color,#0000001f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_2px_12px_rgba\(0\,0\,0\,0\.12\)\]{--tw-shadow:0 2px 12px var(--tw-shadow-color,#0000001f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_4px_20px_-12px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 4px 20px -12px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_12px_40px_-12px_rgba\(0\,0\,0\,0\.3\)\]{--tw-shadow:0 12px 40px -12px var(--tw-shadow-color,#0000004d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-\[2\.5px\]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2.5px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-\[3px\]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent,.ring-accent\/40{--tw-ring-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.ring-accent\/40{--tw-ring-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-bg{--tw-ring-offset-color:var(--color-bg)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow-\[0_20px_40px_rgba\(0\,100\,212\,0\.28\)\]{--tw-drop-shadow-size:drop-shadow(0 20px 40px var(--tw-drop-shadow-color,#0064d447));--tw-drop-shadow:var(--tw-drop-shadow-size);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow-sm{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-sm));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-\[2px\]{--tw-backdrop-blur:blur(2px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.will-change-transform{will-change:transform}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-muted::placeholder{color:var(--color-muted)}.odd\:bg-surface:nth-child(odd){background-color:var(--color-surface)}.focus-within\:border-fg\/20:focus-within{border-color:var(--color-fg)}@supports (color:color-mix(in lab, red, red)){.focus-within\:border-fg\/20:focus-within{border-color:color-mix(in oklab, var(--color-fg) 20%, transparent)}}.focus-within\:ring-2:focus-within{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-within\:ring-accent\/40:focus-within{--tw-ring-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.focus-within\:ring-accent\/40:focus-within{--tw-ring-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}@media (hover:hover){.hover\:scale-\[1\.04\]:hover{scale:1.04}.hover\:bg-accent\/15:hover{background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/15:hover{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.hover\:bg-border\/60:hover{background-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-border\/60:hover{background-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.hover\:bg-rose-500\/10:hover{background-color:#ff23571a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-rose-500\/10:hover{background-color:color-mix(in oklab, var(--color-rose-500) 10%, transparent)}}.hover\:bg-surface:hover{background-color:var(--color-surface)}.hover\:bg-surface-2:hover,.hover\:bg-surface-2\/60:hover{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-2\/60:hover{background-color:color-mix(in oklab, var(--color-surface-2) 60%, transparent)}}.hover\:bg-surface-2\/70:hover{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-2\/70:hover{background-color:color-mix(in oklab, var(--color-surface-2) 70%, transparent)}}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-fg:hover{color:var(--color-fg)}.hover\:text-rose-500:hover{color:var(--color-rose-500)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}.hover\:opacity-100:hover{opacity:1}.hover\:ring-2:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:ring-accent:hover,.hover\:ring-accent\/60:hover{--tw-ring-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.hover\:ring-accent\/60:hover{--tw-ring-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}}.focus\:border-accent:focus{border-color:var(--color-accent)}.focus\:bg-surface-2:focus{background-color:var(--color-surface-2)}.focus\:opacity-100:focus{opacity:1}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-accent\/40:focus{--tw-ring-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.focus\:ring-accent\/40:focus{--tw-ring-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:scale-\[0\.99\]:active{scale:.99}.active\:bg-surface-2:active,.active\:bg-surface-2\/70:active{background-color:var(--color-surface-2)}@supports (color:color-mix(in lab, red, red)){.active\:bg-surface-2\/70:active{background-color:color-mix(in oklab, var(--color-surface-2) 70%, transparent)}}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.disabled\:opacity-70:disabled{opacity:.7}@media (width>=40rem){.sm\:hidden{display:none}.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:items-center{align-items:center}.sm\:justify-center{justify-content:center}.sm\:rounded-3xl{border-radius:var(--radius-3xl)}.sm\:rounded-\[28px\]{border-radius:28px}.sm\:border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.sm\:border-border{border-color:var(--color-border)}}@container (width>=42rem){.\@2xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.dark\:border:where([data-theme=dark],[data-theme=dark] *){border-style:var(--tw-border-style);border-width:1px}.dark\:border-border:where([data-theme=dark],[data-theme=dark] *){border-color:var(--color-border)}.dark\:bg-accent\/\[0\.10\]:where([data-theme=dark],[data-theme=dark] *){background-color:var(--color-accent)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-accent\/\[0\.10\]:where([data-theme=dark],[data-theme=dark] *){background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.dark\:bg-amber-400\/\[0\.08\]:where([data-theme=dark],[data-theme=dark] *){background-color:#fcbb0014}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-400\/\[0\.08\]:where([data-theme=dark],[data-theme=dark] *){background-color:color-mix(in oklab, var(--color-amber-400) 8%, transparent)}}.dark\:bg-\[radial-gradient\(ellipse_at_top\,rgba\(23\,147\,255\,0\.2\)\,transparent_65\%\)\]:where([data-theme=dark],[data-theme=dark] *){background-image:radial-gradient(at top,#1793ff33,#0000 65%)}.dark\:text-amber-200:where([data-theme=dark],[data-theme=dark] *){color:var(--color-amber-200)}.dark\:text-amber-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-amber-300)}.dark\:text-cyan-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-cyan-300)}.dark\:text-emerald-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-emerald-300)}.dark\:text-emerald-400:where([data-theme=dark],[data-theme=dark] *){color:var(--color-emerald-400)}.dark\:text-fuchsia-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-fuchsia-300)}.dark\:text-orange-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-orange-300)}.dark\:text-pink-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-pink-300)}.dark\:text-red-400:where([data-theme=dark],[data-theme=dark] *){color:var(--color-red-400)}.dark\:text-rose-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-rose-300)}.dark\:text-rose-400:where([data-theme=dark],[data-theme=dark] *){color:var(--color-rose-400)}.dark\:text-sky-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-sky-300)}.dark\:text-violet-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-violet-300)}.dark\:shadow-none:where([data-theme=dark],[data-theme=dark] *){--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}@media (width>=64rem){.wide\:invisible{visibility:hidden}}:where(html.desktop) .wide\:invisible{visibility:hidden}@media (width>=64rem){.wide\:inset-y-0{inset-block:0}}:where(html.desktop) .wide\:inset-y-0{inset-block:0}@media (width>=64rem){.wide\:mt-0{margin-top:0}}:where(html.desktop) .wide\:mt-0{margin-top:0}@media (width>=64rem){.wide\:mt-5{margin-top:calc(var(--spacing) * 5)}}:where(html.desktop) .wide\:mt-5{margin-top:calc(var(--spacing) * 5)}@media (width>=64rem){.wide\:block{display:block}}:where(html.desktop) .wide\:block{display:block}@media (width>=64rem){.wide\:flex{display:flex}}:where(html.desktop) .wide\:flex{display:flex}@media (width>=64rem){.wide\:grid{display:grid}}:where(html.desktop) .wide\:grid{display:grid}@media (width>=64rem){.wide\:hidden{display:none}}:where(html.desktop) .wide\:hidden{display:none}@media (width>=64rem){.wide\:h-auto{height:auto}}:where(html.desktop) .wide\:h-auto{height:auto}@media (width>=64rem){.wide\:h-full{height:100%}}:where(html.desktop) .wide\:h-full{height:100%}@media (width>=64rem){.wide\:max-w-\[600px\]{max-width:600px}}:where(html.desktop) .wide\:max-w-\[600px\]{max-width:600px}@media (width>=64rem){.wide\:max-w-\[900px\]{max-width:900px}}:where(html.desktop) .wide\:max-w-\[900px\]{max-width:900px}@media (width>=64rem){.wide\:max-w-\[980px\]{max-width:980px}}:where(html.desktop) .wide\:max-w-\[980px\]{max-width:980px}@media (width>=64rem){.wide\:max-w-md{max-width:var(--container-md)}}:where(html.desktop) .wide\:max-w-md{max-width:var(--container-md)}@media (width>=64rem){.wide\:max-w-none{max-width:none}}:where(html.desktop) .wide\:max-w-none{max-width:none}@media (width>=64rem){.wide\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}}:where(html.desktop) .wide\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}@media (width>=64rem){.wide\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}:where(html.desktop) .wide\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}@media (width>=64rem){.wide\:grid-cols-\[1\.1fr_1fr\]{grid-template-columns:1.1fr 1fr}}:where(html.desktop) .wide\:grid-cols-\[1\.1fr_1fr\]{grid-template-columns:1.1fr 1fr}@media (width>=64rem){.wide\:flex-row{flex-direction:row}}:where(html.desktop) .wide\:flex-row{flex-direction:row}@media (width>=64rem){.wide\:items-center{align-items:center}}:where(html.desktop) .wide\:items-center{align-items:center}@media (width>=64rem){.wide\:items-start{align-items:flex-start}}:where(html.desktop) .wide\:items-start{align-items:flex-start}@media (width>=64rem){.wide\:gap-1\.5{gap:calc(var(--spacing) * 1.5)}}:where(html.desktop) .wide\:gap-1\.5{gap:calc(var(--spacing) * 1.5)}@media (width>=64rem){.wide\:gap-16{gap:calc(var(--spacing) * 16)}}:where(html.desktop) .wide\:gap-16{gap:calc(var(--spacing) * 16)}@media (width>=64rem){.wide\:border-0{border-style:var(--tw-border-style);border-width:0}}:where(html.desktop) .wide\:border-0{border-style:var(--tw-border-style);border-width:0}@media (width>=64rem){.wide\:border-x-0{border-inline-style:var(--tw-border-style);border-inline-width:0}}:where(html.desktop) .wide\:border-x-0{border-inline-style:var(--tw-border-style);border-inline-width:0}@media (width>=64rem){.wide\:bg-transparent{background-color:#0000}}:where(html.desktop) .wide\:bg-transparent{background-color:#0000}@media (width>=64rem){.wide\:bg-\[radial-gradient\(ellipse_at_left\,rgba\(0\,100\,212\,0\.12\)\,transparent_60\%\)\]{background-image:radial-gradient(at 0,#0064d41f,#0000 60%)}}:where(html.desktop) .wide\:bg-\[radial-gradient\(ellipse_at_left\,rgba\(0\,100\,212\,0\.12\)\,transparent_60\%\)\]{background-image:radial-gradient(at 0,#0064d41f,#0000 60%)}@media (width>=64rem){.wide\:p-7{padding:calc(var(--spacing) * 7)}}:where(html.desktop) .wide\:p-7{padding:calc(var(--spacing) * 7)}@media (width>=64rem){.wide\:px-0{padding-inline:0}}:where(html.desktop) .wide\:px-0{padding-inline:0}@media (width>=64rem){.wide\:px-12{padding-inline:calc(var(--spacing) * 12)}}:where(html.desktop) .wide\:px-12{padding-inline:calc(var(--spacing) * 12)}@media (width>=64rem){.wide\:py-1{padding-block:var(--spacing)}}:where(html.desktop) .wide\:py-1{padding-block:var(--spacing)}@media (width>=64rem){.wide\:pt-0{padding-top:0}}:where(html.desktop) .wide\:pt-0{padding-top:0}@media (width>=64rem){.wide\:text-left{text-align:left}}:where(html.desktop) .wide\:text-left{text-align:left}@media (width>=64rem){.wide\:text-\[13\.5px\]{font-size:13.5px}}:where(html.desktop) .wide\:text-\[13\.5px\]{font-size:13.5px}@media (width>=64rem){.wide\:text-\[15\.5px\]{font-size:15.5px}}:where(html.desktop) .wide\:text-\[15\.5px\]{font-size:15.5px}@media (width>=64rem){.wide\:text-\[34px\]{font-size:34px}}:where(html.desktop) .wide\:text-\[34px\]{font-size:34px}@media (width>=64rem){.wide\:dark\:bg-\[radial-gradient\(ellipse_at_left\,rgba\(23\,147\,255\,0\.16\)\,transparent_60\%\)\]:where([data-theme=dark],[data-theme=dark] *){background-image:radial-gradient(at 0,#1793ff29,#0000 60%)}}:where(html.desktop) .wide\:dark\:bg-\[radial-gradient\(ellipse_at_left\,rgba\(23\,147\,255\,0\.16\)\,transparent_60\%\)\]:where([data-theme=dark],[data-theme=dark] *){background-image:radial-gradient(at 0,#1793ff29,#0000 60%)}.\[\&\+\&\]\:mt-1\.5+.\[\&\+\&\]\:mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}}@font-face{font-family:Figtree;font-style:normal;font-weight:300 900;font-display:swap;src:url(/fonts/figtree-latin.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Figtree;font-style:normal;font-weight:300 900;font-display:swap;src:url(/fonts/figtree-latin-ext.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}:root{--om-bg:#fcfcfc;--om-surface:#fff;--om-surface-2:#f2f2f4;--om-border:#e7e7ea;--om-fg:#111112;--om-muted:#6b6b71;--om-accent:#0064d4;--om-bubble-user:#d8e9ff;--om-bubble-user-fg:#111112;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}html[data-theme=dark]{--om-bg:#181819;--om-surface:#202022;--om-surface-2:#2a2a2d;--om-border:#333337;--om-fg:#fff;--om-muted:#9d9da4;--om-accent:#1793ff;--om-bubble-user:#1c3d66;--om-bubble-user-fg:#fff;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}html,body,#root{height:100%}body{background:var(--om-bg);color:var(--om-fg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;overscroll-behavior-y:none;margin:0}.safe-top{padding-top:env(safe-area-inset-top)}.titlebar-room{display:none}html.desktop[data-platform=darwin] .titlebar-room{-webkit-app-region:drag;flex-shrink:0;height:28px;display:block}.safe-bottom{padding-bottom:env(safe-area-inset-bottom)}*{scrollbar-width:thin;scrollbar-color:var(--om-border) transparent}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-thumb{background:var(--om-border);border-radius:999px}::-webkit-scrollbar-track{background:0 0}@media (pointer:coarse),(width<=480px){*{scrollbar-width:none}::-webkit-scrollbar{display:none}}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{scrollbar-width:none}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md p{margin:.35em 0}.md ul,.md ol{margin:.35em 0;padding-left:1.3em}.md ul{list-style:outside}.md ol{list-style:decimal}.md li{margin:.15em 0}.md h1,.md h2,.md h3,.md h4{margin:.7em 0 .3em;font-weight:650;line-height:1.3}.md h1{font-size:1.15em}.md h2{font-size:1.08em}.md h3,.md h4{font-size:1em}.md a{color:var(--om-accent);text-underline-offset:2px;word-break:break-all;text-decoration:underline}.bubble-user .md a{color:var(--om-accent)}.md code{background:#7f7fa029;border-radius:6px;padding:.1em .35em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.86em}.md pre{color:#eaeaf5;background:#0f0f19e6;border-radius:12px;margin:.5em 0;padding:.7em .85em;font-size:.82em;line-height:1.45;overflow-x:auto}.md pre code{font-size:inherit;background:0 0;padding:0}.md .md-file{color:var(--om-accent);background:var(--om-accent);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.86em}@supports (color:color-mix(in lab, red, red)){.md .md-file{background:color-mix(in srgb, var(--om-accent) 12%, transparent)}}.md .md-file{text-underline-offset:2px;word-break:break-all;border-radius:6px;padding:.1em .4em;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.md blockquote{border-left:3px solid var(--om-border);color:var(--om-muted);margin:.5em 0;padding-left:.8em}.md table{border-collapse:collapse;max-width:100%;margin:.5em 0;font-size:.9em;display:block;overflow-x:auto}.md th,.md td{border:1px solid var(--om-border);text-align:left;padding:.3em .55em}.md hr{border:0;border-top:1px solid var(--om-border);margin:.7em 0}.md img{border-radius:10px;max-width:100%}@keyframes om-breathe{0%,to{transform:translateY(0)scale(1)}50%{transform:translateY(-1.5%)scale(1.025)}}@keyframes om-sway{0%,to{transform:rotate(-4deg)translateY(0)}25%{transform:rotate(0)translateY(-2%)}50%{transform:rotate(4deg)translateY(0)}75%{transform:rotate(0)translateY(-2%)}}@keyframes om-hop{0%,70%,to{transform:translateY(0)scale(1)}78%{transform:translateY(-9%)scale(1.04,.97)}86%{transform:translateY(0)scale(.98,1.03)}92%{transform:translateY(-3%)scale(1)}}@keyframes om-wiggle{0%,to{transform:rotate(0)}20%{transform:rotate(-10deg)scale(1.06)}45%{transform:rotate(9deg)scale(1.06)}70%{transform:rotate(-5deg)}}.avatar-idle{animation:4.5s ease-in-out infinite om-breathe}.avatar-working{animation:2.6s ease-in-out infinite om-sway}.avatar-waiting{animation:3.2s ease-in-out infinite om-hop}.avatar-wiggle{animation:.6s ease-in-out om-wiggle}@keyframes om-pop{0%{transform:scale(.6)}70%{transform:scale(1.06)}to{transform:scale(1)}}.avatar-pop{animation:.55s cubic-bezier(.34,1.56,.64,1) om-pop}@media (prefers-reduced-motion:reduce){.avatar-idle,.avatar-working,.avatar-waiting,.avatar-wiggle,.avatar-pop{animation:none}}@keyframes om-blink{50%{opacity:.25}}.typing-dot{animation:1.1s infinite om-blink}.typing-dot:nth-child(2){animation-delay:.18s}.typing-dot:nth-child(3){animation-delay:.36s}@keyframes om-rise{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}.rise{animation:.18s ease-out om-rise}@keyframes om-sheet{0%{transform:translateY(100%)}to{transform:none}}.sheet-in{animation:.22s cubic-bezier(.2,.8,.2,1) om-sheet}@keyframes om-drawer-in{0%{transform:translate(-100%)}to{transform:none}}.drawer-in{animation:.2s ease-out om-drawer-in}@property --tw-border-spacing-x{syntax:"";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"";inherits:false;initial-value:0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
diff --git a/nanomuse/server/static/index.html b/nanomuse/server/static/index.html
index 794872b3d..b5389e5ca 100644
--- a/nanomuse/server/static/index.html
+++ b/nanomuse/server/static/index.html
@@ -25,13 +25,13 @@
nanoMuse
-
+
-
+
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 55a4efd13..00528a0ae 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -41,7 +41,7 @@ function Loading() {
);
}
-/** The five glyphs: outlined at rest, filled with the page's ink when selected — the fill is the state. */
+/** The five glyphs: outlined at rest, filled with the button's own ink when selected. The fill is the state. */
const glyph = (active: boolean) => ({ size: 26, strokeWidth: active ? 2 : 1.7, fill: active ? "currentColor" : "none", fillOpacity: active ? 0.18 : 0 });
const TABS: Array<{ id: Tab; label: string; icon: (active: boolean) => ReactNode }> = [
{ id: "chat", label: "Chat", icon: (a) => },
@@ -129,7 +129,7 @@ export default function App() {
)}
-
+
{state.gone && (
{t(state.lite ? "This demo has ended." : "This nanoMuse has stopped. Reload the page once it is running again.")}
@@ -141,7 +141,9 @@ export default function App() {
)}
{!state.lite && }
-
+ {/* `tabbar-room` keeps the screens, the chat's composer included, above the floating bar;
+ a wide window has the sidebar instead and gives the room back. */}
+
}>
{state.tab === "chat" && }
{state.tab === "feed" && }
@@ -159,11 +161,15 @@ export default function App() {
{state.tab === "avatar" && }
- {/* Muse's bottom bar, as the Android app draws it: a plain strip, five glyphs, the current one
- filled and dark, the others outlined and softer — no labels, no pill. In lite (the phone in
- the showcase) it shows whatever the width; otherwise a wide window has the sidebar instead. */}
-