@xopcai/xopc 0.0.104 → 0.0.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/agents-XzgIVKcI.js +396 -0
- package/dist/gateway/static/root/assets/{apps-page-L-IwQTe0.js → apps-page-B7Us3RMl.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BgeV6fzw.js +1 -0
- package/dist/gateway/static/root/assets/cron-page-DKGHEeAU.js +1 -0
- package/dist/gateway/static/root/assets/{dist-C6vclgEL.js → dist-DJDkNhu5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D4JYAbsX.js → extension-debug-page-DI1XJTJi.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-_T62gi6e.js → extension-page-SuafGTT_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CkJbjyM-.js → extension-settings-page-cKmGax9v.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-B5aiIguv.js → fetch-CkvRO30i.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DqmLXhs6.js → gateway-startup-retry-BkKyRDrF.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-HwJV1K_Y.js → heartbeat-config-api-CRiDcxtt.js} +1 -1
- package/dist/gateway/static/root/assets/index-50FVtgXU.js +4845 -0
- package/dist/gateway/static/root/assets/{logs-page-DsjtTjBy.js → logs-page-DM8o5-Bm.js} +2 -2
- package/dist/gateway/static/root/assets/{note-detail-page-B2V7RhgD.js → note-detail-page-j53jtvq9.js} +54 -54
- package/dist/gateway/static/root/assets/{note-time-BG8GCTr4.js → note-time-Ck2H2Qpw.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-xrcVBQ6Z.js → notes-page-CsWIw35Q.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-S-QUvhul.js → schema-form-BvmGNxiJ.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CLPsbyOW.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-gate-DujQl9c7.js → settings-advanced-gate-DRdayl8P.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-r1V7dRV6.js → settings-form-section-BlIYg2gZ.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-CRGHT_bm.js +3 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DOFy0FNt.js → share-preview-page-BlT6Akvk.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-Ce-RIH2y.js +2 -0
- package/dist/gateway/static/root/assets/{theme-store-Bo3j5Ovv.js → theme-store-DYgVdRB4.js} +1 -1
- package/dist/gateway/static/root/assets/url-DPEStU4M.js +3 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-AjmUAlEQ.js → voice-api-key-field-CJGTidqc.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-page.utils-DLEJ92gK.js → workflow-page.utils-_sjXCMvi.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-o63aaARK.js +27 -0
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/context/workspace-seed.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +2 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js.map +1 -1
- package/dist/src/agent/prompt/memory/index.js +30 -2
- package/dist/src/agent/prompt/memory/index.js.map +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
- package/dist/src/agent/service/direct-turn-helpers.js +5 -2
- package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.d.ts +2 -0
- package/dist/src/agent/service/process-direct-streaming.js +15 -1
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service.js +2 -1
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/service.types.d.ts +3 -0
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/source-context/index.d.ts +2 -0
- package/dist/src/agent/source-context/index.js +3 -0
- package/dist/src/agent/source-context/injector.d.ts +3 -0
- package/dist/src/agent/source-context/injector.js +36 -0
- package/dist/src/agent/source-context/injector.js.map +1 -0
- package/dist/src/agent/source-context/types.d.ts +19 -0
- package/dist/src/agent/source-context/types.js +10 -0
- package/dist/src/agent/source-context/types.js.map +1 -0
- package/dist/src/agent/tools/factory.js +5 -5
- package/dist/src/agent/tools/index.js +3 -3
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/shell.js +1 -1
- package/dist/src/agent/tools/web-extract.js +2 -2
- package/dist/src/agent/tools/web.js +1 -1
- package/dist/src/browser/actions/extension-registry-bridge.js +1 -1
- package/dist/src/browser/actions/registry.js +2 -2
- package/dist/src/browser/cdp-local-launcher.js +1 -1
- package/dist/src/browser/index.js +3 -3
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/browser/providers/cloakbrowser.js +1 -1
- package/dist/src/cli/commands/browser-cli-helpers.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/paths.d.ts +1 -0
- package/dist/src/config/paths.js +5 -1
- package/dist/src/config/paths.js.map +1 -1
- package/dist/src/document-understanding/extract.d.ts +13 -0
- package/dist/src/document-understanding/extract.js +63 -0
- package/dist/src/document-understanding/extract.js.map +1 -0
- package/dist/src/gateway/hono/routes/notes.js +46 -27
- package/dist/src/gateway/hono/routes/notes.js.map +1 -1
- package/dist/src/gateway/service.js +11 -0
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/notes/agent-context.d.ts +40 -0
- package/dist/src/notes/agent-context.js +383 -0
- package/dist/src/notes/agent-context.js.map +1 -0
- package/dist/src/notes/index.d.ts +2 -0
- package/dist/src/notes/index.js +2 -1
- package/dist/src/notes/service.d.ts +5 -0
- package/dist/src/notes/service.js +22 -0
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/notes/store.js +2 -0
- package/dist/src/notes/store.js.map +1 -1
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/005_add_note_agent_contexts.sql +10 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/note-agent-context-repository.d.ts +10 -0
- package/dist/src/storage/sqlite/note-agent-context-repository.js +35 -0
- package/dist/src/storage/sqlite/note-agent-context-repository.js.map +1 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-CvsBrBfi.js +0 -396
- package/dist/gateway/static/root/assets/channels-settings-D95KuPeP.js +0 -1
- package/dist/gateway/static/root/assets/cron-page-CfkWXDAI.js +0 -1
- package/dist/gateway/static/root/assets/index-DvTb6wNR.js +0 -4845
- package/dist/gateway/static/root/assets/sessions-page-CrQer6Au.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-C9nrONQ2.js +0 -3
- package/dist/gateway/static/root/assets/skills-page-DmTsrs_a.js +0 -2
- package/dist/gateway/static/root/assets/url-WgQIjFZu.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BnjjKrM1.js +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./url-
|
|
1
|
+
import{a as e}from"./url-DPEStU4M.js";import{Ct as t,St as n}from"./index-50FVtgXU.js";var r={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},i=null,a=null,o=null,s=null;function c(){return i||(i=new Audio,i.addEventListener(`timeupdate`,()=>{u.setState({currentTime:i.currentTime})}),i.addEventListener(`loadedmetadata`,()=>{let e=i.duration;Number.isFinite(e)&&u.setState({duration:e})}),i.addEventListener(`ended`,()=>{u.setState({playing:!1,currentTime:0}),i.currentTime=0}),i.addEventListener(`pause`,()=>{u.setState({playing:!1})}),i.addEventListener(`play`,()=>{u.setState({playing:!0})})),i}function l(){o&&s&&t(o,s),a=null,o=null,s=null}var u=e()((e,t)=>({...r,play:async(r,i,u)=>{let d=c(),f=t();if(f.noteId===r&&f.attachmentId===i&&a){d.play();return}d.pause(),l(),e({noteId:r,attachmentId:i,playing:!1,currentTime:0,duration:u??0,loading:!0});try{let t=await n(r,i);a=t,o=r,s=i,d.src=t,await d.play(),e({loading:!1})}catch{e({loading:!1,playing:!1}),l()}},pause:()=>{c().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=c();n.currentTime=t,e({currentTime:t})},reset:()=>{c().pause(),c().src=``,l(),e(r)}})),d=6e4,f=36e5,p=864e5;function m(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function h(e,t,n){let r=t-e;if(r<d)return n.justNow;if(r<f){let e=Math.floor(r/d);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=m(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-p)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*p){let e=Math.floor(r/p);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function g(e,t,n){let r=m(t);if(e>=r)return n.today;if(e>=r-p)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function _(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}export{u as i,g as n,h as r,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a}from"./url-WgQIjFZu.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s}from"./fetch-B5aiIguv.js";import{r as c}from"./toast-z0toXu32.js";import{Ai as l,Ct as u,Da as d,Fi as f,Io as p,Ir as m,Ka as h,Ki as g,Ni as _,P as v,Pa as y,Uo as b,Wa as x,Xo as S,ca as C,ci as w,da as T,dt as E,ft as D,gt as O,it as k,lo as A,lt as j,pa as M,pt as N,qi as P,ua as F,xa as I,xi as L,yt as R,zr as z}from"./index-DvTb6wNR.js";import{i as B,n as V,r as ee,t as H}from"./note-time-BG8GCTr4.js";import{a as te,i as ne,n as re,o as ie,r as ae,t as oe}from"./dist-C6vclgEL.js";var se=n(),U=e(t(),1),W=r();function ce(e){let t=(0,se.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,U.useState)(!1),s;t[0]!==r||t[1]!==n?(s=u(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=w(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(h,{className:`h-4 w-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,W.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let d;t[9]===i?d=t[10]:(d=w(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==c||t[13]!==d?(f=(0,W.jsx)(R,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:d}),t[11]=n,t[12]=c,t[13]=d,t[14]=f):f=t[14],f}function G(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function le(e){let t=(0,se.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:f}=B(),p=B(q),m=u===n&&f===r,h=m&&o,g=m&&s,_=m?c:0,v=m&&l>0?l:i??0,y=v>0?Math.min(_/v*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(b=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=S):S=t[9];let T=S,E;t[10]===a?E=t[11]:(E=w(`flex items-center gap-2`,a),t[10]=a,t[11]=E);let D=h?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,O;t[12]===D?O=t[13]:(O=w(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition-colors`,D),t[12]=D,t[13]=O);let k=h?`Pause`:`Play`,A;t[14]!==g||t[15]!==h?(A=g?(0,W.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):h?(0,W.jsx)(M,{className:`h-3.5 w-3.5`}):(0,W.jsx)(C,{className:`h-3.5 w-3.5 ml-0.5`}),t[14]=g,t[15]=h,t[16]=A):A=t[16];let j;t[17]!==x||t[18]!==T||t[19]!==O||t[20]!==k||t[21]!==A?(j=(0,W.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:T,className:O,"aria-label":k,children:A}),t[17]=x,t[18]=T,t[19]=O,t[20]=k,t[21]=A,t[22]=j):j=t[22];let N=`${y}%`,P;t[23]===N?P=t[24]:(P=(0,W.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:N}})}),t[23]=N,t[24]=P);let F;t[25]!==v||t[26]!==m||t[27]!==_?(F=G(m&&_>0?_:v),t[25]=v,t[26]=m,t[27]=_,t[28]=F):F=t[28];let I;t[29]===F?I=t[30]:(I=(0,W.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:F}),t[29]=F,t[30]=I);let L;t[31]!==P||t[32]!==I?(L=(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[P,I]}),t[31]=P,t[32]=I,t[33]=L):L=t[33];let R;return t[34]!==L||t[35]!==E||t[36]!==j?(R=(0,W.jsxs)(`div`,{className:E,onClick:K,children:[j,L]}),t[34]=L,t[35]=E,t[36]=j,t[37]=R):R=t[37],R}function K(e){return e.stopPropagation()}function q(e){return e.toggle}var ue={thought:y,todo:f,voice:I,media:x,bookmark:p,mixed:y,task:f};function de(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function J(e){let t=(0,se.c)(78),{note:n,onPress:r,onPin:i,onArchive:a,onDelete:o,labels:s,timeLabels:c}=e,l=ue[n.kind]||y,u;t[0]!==s||t[1]!==n?(u=de(n,s),t[0]=s,t[1]=n,t[2]=u):u=t[2];let d=u,f=!n.snippet?.trim(),[p]=(0,U.useState)(Y),m;t[3]!==n.createdAt||t[4]!==p||t[5]!==c?(m=ee(n.createdAt,p,c),t[3]=n.createdAt,t[4]=p,t[5]=c,t[6]=m):m=t[6];let h=m,g,_;t[7]!==n.id||t[8]!==r?(g=()=>r(n.id),_=e=>{(e.key===`Enter`||e.key===` `)&&r(n.id)},t[7]=n.id,t[8]=r,t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=w(`group relative flex cursor-pointer flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,`transition-colors duration-150 ease-out hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[11]=v):v=t[11];let x;t[12]!==l||t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(x=n.coverAttachmentId?(0,W.jsx)(ce,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,W.jsx)(le,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-32 shrink-0`}):(0,W.jsx)(l,{className:`mt-0.5 h-4 w-4 shrink-0 text-fg-muted`}),t[12]=l,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=x):x=t[18];let S;t[19]===n.title?S=t[20]:(S=n.title&&(0,W.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=S);let C=n.title?`text-fg-muted`:f?`italic text-fg-muted`:`text-fg`,E;t[21]===C?E=t[22]:(E=w(`text-sm line-clamp-3`,C),t[21]=C,t[22]=E);let D;t[23]!==d||t[24]!==E?(D=(0,W.jsx)(`p`,{className:E,children:d}),t[23]=d,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==D||t[27]!==S?(O=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,D]}),t[26]=D,t[27]=S,t[28]=O):O=t[28];let k;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,onClick:me,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,W.jsx)(A,{className:`h-4 w-4`})})}),t[29]=k):k=t[29];let j;t[30]!==n.id||t[31]!==n.pinned||t[32]!==i?(j=()=>i(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=i,t[33]=j):j=t[33];let M;t[34]===n.pinned?M=t[35]:(M=n.pinned?(0,W.jsx)(F,{className:`h-4 w-4`}):(0,W.jsx)(T,{className:`h-4 w-4`}),t[34]=n.pinned,t[35]=M);let N=n.pinned?s.unpin:s.pin,P;t[36]!==j||t[37]!==M||t[38]!==N?(P=(0,W.jsxs)(re,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:j,children:[M,N]}),t[36]=j,t[37]=M,t[38]=N,t[39]=P):P=t[39];let I;t[40]!==n.id||t[41]!==a?(I=()=>a(n.id),t[40]=n.id,t[41]=a,t[42]=I):I=t[42];let R;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,W.jsx)(b,{className:`h-4 w-4`}),t[43]=R):R=t[43];let z;t[44]!==s.archive||t[45]!==I?(z=(0,W.jsxs)(re,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[R,s.archive]}),t[44]=s.archive,t[45]=I,t[46]=z):z=t[46];let B;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,W.jsx)(te,{className:`my-1 h-px bg-edge-subtle`}),t[47]=B):B=t[47];let V;t[48]!==n.id||t[49]!==o?(V=()=>o(n.id),t[48]=n.id,t[49]=o,t[50]=V):V=t[50];let H;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,W.jsx)(L,{className:`h-4 w-4`}),t[51]=H):H=t[51];let G;t[52]!==s.delete||t[53]!==V?(G=(0,W.jsxs)(re,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:V,children:[H,s.delete]}),t[52]=s.delete,t[53]=V,t[54]=G):G=t[54];let K;t[55]!==P||t[56]!==z||t[57]!==G?(K=(0,W.jsxs)(ne,{children:[k,(0,W.jsx)(ae,{children:(0,W.jsxs)(oe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:pe,children:[P,z,B,G]})})]}),t[55]=P,t[56]=z,t[57]=G,t[58]=K):K=t[58];let q;t[59]!==O||t[60]!==K||t[61]!==x?(q=(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[x,O,K]}),t[59]=O,t[60]=K,t[61]=x,t[62]=q):q=t[62];let J;t[63]===n.pinned?J=t[64]:(J=n.pinned&&(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,W.jsx)(T,{className:`h-3 w-3`})}),t[63]=n.pinned,t[64]=J);let X;t[65]===n.tags?X=t[66]:(X=n.tags?.map(fe),t[65]=n.tags,t[66]=X);let Z;t[67]===h?Z=t[68]:(Z=(0,W.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:h}),t[67]=h,t[68]=Z);let Q;t[69]!==J||t[70]!==X||t[71]!==Z?(Q=(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[J,X,Z]}),t[69]=J,t[70]=X,t[71]=Z,t[72]=Q):Q=t[72];let he;return t[73]!==q||t[74]!==Q||t[75]!==g||t[76]!==_?(he=(0,W.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:g,onKeyDown:_,className:v,children:[q,Q]}),t[73]=q,t[74]=Q,t[75]=g,t[76]=_,t[77]=he):he=t[77],he}function fe(e){return(0,W.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function pe(e){return e.stopPropagation()}function me(e){return e.stopPropagation()}function Y(){return Date.now()}var X=3e4;function Z(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Q({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:o=!1,voiceDisabled:s=!1}){let[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(0),[v,y]=(0,U.useState)(!1),b=(0,U.useRef)(null),S=(0,U.useRef)(null),C=(0,U.useRef)(null),T=(0,U.useRef)([]),E=(0,U.useRef)(0),D=(0,U.useRef)(null),O=(0,U.useRef)(null),k=(0,U.useCallback)(()=>{D.current&&=(clearInterval(D.current),null),O.current&&=(clearTimeout(O.current),null),C.current?.getTracks().forEach(e=>e.stop()),C.current=null,S.current=null,T.current=[],p(!1),h(0)},[]);(0,U.useEffect)(()=>()=>k(),[k]);let A=(0,U.useCallback)(async()=>{let e=S.current;if(!e||e.state!==`recording`)return;y(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-E.current)/1e3)),n=e.mimeType||Z()||`audio/webm`,r=new Blob(T.current,{type:n});if(k(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{y(!1)}return}y(!1)},[k,i]),j=(0,U.useCallback)(async()=>{if(!(!i||v||f)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Z(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);C.current=e,S.current=n,T.current=[],E.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&T.current.push(e.data)},n.start(),p(!0),h(0),D.current=setInterval(()=>{h(Math.round((Date.now()-E.current)/1e3))},250),O.current=setTimeout(()=>{A()},X)}catch{k()}},[k,i,f,A,v]),M=(0,U.useCallback)(()=>{if(f){A();return}j()},[f,j,A]),N=(0,U.useCallback)(async e=>{let t=c.trim();if(!(!t||u)){d(!0),l(``);try{await n(t,e)}catch{l(t)}finally{d(!1),b.current?.focus()}}},[c,u,n]),P=(0,U.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),N()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),N({navigate:!1}))},[N]),F=u||v;return(0,W.jsxs)(`div`,{className:w(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel px-2 py-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,f&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,W.jsx)(`button`,{type:`button`,onClick:r,disabled:F||o||f,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,W.jsx)(x,{className:`h-4 w-4`})}),i&&(0,W.jsx)(`button`,{type:`button`,onClick:M,disabled:F||s||u,className:w(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,f?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":f?`Stop recording`:`Voice`,"aria-pressed":f,children:f?(0,W.jsx)(_,{className:`h-4 w-4 fill-current`}):(0,W.jsx)(I,{className:`h-4 w-4`})}),f?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(m))}):(0,W.jsx)(`textarea`,{ref:b,value:c,onChange:e=>l(e.target.value),onKeyDown:P,placeholder:e,rows:1,disabled:F,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,W.jsx)(`button`,{type:`button`,disabled:!c.trim()||F||f,onClick:e=>void N({navigate:!e.shiftKey}),"aria-label":t,className:w(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,c.trim()&&!F&&!f?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,W.jsx)(g,{className:`h-4 w-4`})})]})}var he={statusFilter:`all`,kindFilter:`all`,search:``};function $(){let e=(0,se.c)(107),t=a(i(xe)).notes,n=!!s(be),[r,u]=(0,U.useReducer)(v,he),[d]=(0,U.useState)(ye),f=S(),p;e[0]!==n||e[1]!==r.kindFilter||e[2]!==r.search||e[3]!==r.statusFilter?(p=n?[`notes-list`,r.statusFilter,r.kindFilter,r.search]:null,e[0]=n,e[1]=r.kindFilter,e[2]=r.search,e[3]=r.statusFilter,e[4]=p):p=e[4];let h=p,g;e[5]!==r.kindFilter||e[6]!==r.search||e[7]!==r.statusFilter?(g=()=>j({status:r.statusFilter===`all`?void 0:r.statusFilter,kind:r.kindFilter===`all`?void 0:r.kindFilter,search:r.search||void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),e[5]=r.kindFilter,e[6]=r.search,e[7]=r.statusFilter,e[8]=g):g=e[8];let _;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_={keepPreviousData:!0},e[9]=_):_=e[9];let{data:y,mutate:b,isLoading:x}=o(h,g,_),C=x&&!y,T;e[10]===y?.items?T=e[11]:(T=y?.items??[],e[10]=y?.items,e[11]=T);let A=T,M=y?.total??0,F=m(ve),I=m(_e),L=M>0?t.noteCount.replace(`{{count}}`,String(M)):null,R,B;e[12]!==I||e[13]!==n||e[14]!==t.title||e[15]!==L||e[16]!==F?(R=()=>n?(F({startExtra:null,main:(0,W.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-2 px-3 sm:px-5 xl:px-6`,z),children:[(0,W.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),L?(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:L}):null]}),end:null}),()=>I()):(I(),()=>I()),B=[I,n,t.title,L,F],e[12]=I,e[13]=n,e[14]=t.title,e[15]=L,e[16]=F,e[17]=R,e[18]=B):(R=e[17],B=e[18]),(0,U.useLayoutEffect)(R,B);let ee;e[19]!==t.daysAgo||e[20]!==t.justNow||e[21]!==t.minutesAgo||e[22]!==t.today||e[23]!==t.yesterday?(ee={justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo},e[19]=t.daysAgo,e[20]=t.justNow,e[21]=t.minutesAgo,e[22]=t.today,e[23]=t.yesterday,e[24]=ee):ee=e[24];let te=ee,ne;e[25]!==b||e[26]!==f?(ne=async(e,t)=>{let n=await E(e,`web`);await b(),t?.navigate!==!1&&f(`/notes/${n.id}`)},e[25]=b,e[26]=f,e[27]=ne):ne=e[27];let re=ne,ie;e[28]!==b||e[29]!==t.imageUploadFailed||e[30]!==t.imageUploadFailedHint?(ie=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let n=e.files?.[0];if(n)try{await D(n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.imageUploadFailed,message:n instanceof Error?n.message:t.imageUploadFailedHint})}},e.click()},e[28]=b,e[29]=t.imageUploadFailed,e[30]=t.imageUploadFailedHint,e[31]=ie):ie=e[31];let ae=ie,oe;e[32]!==b||e[33]!==t.voiceUploadFailed||e[34]!==t.voiceUploadFailedHint?(oe=async(e,n)=>{try{await N(e,n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.voiceUploadFailed,message:n instanceof Error?n.message:t.voiceUploadFailedHint})}},e[32]=b,e[33]=t.voiceUploadFailed,e[34]=t.voiceUploadFailedHint,e[35]=oe):oe=e[35];let ce=oe,G;e[36]===b?G=e[37]:(G=async(e,t)=>{await O(e,{pinned:t}),await b()},e[36]=b,e[37]=G);let le=G,K;e[38]===b?K=e[39]:(K=async e=>{await O(e,{status:`archived`}),await b()},e[38]=b,e[39]=K);let q=K,ue;e[40]===b?ue=e[41]:(ue=async e=>{await k(e),await b()},e[40]=b,e[41]=ue);let de=ue,fe;e[42]===f?fe=e[43]:(fe=e=>{f(`/notes/${e}`)},e[42]=f,e[43]=fe);let pe=fe;if(!n){let n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(l,{className:`h-10 w-10 text-fg-muted`}),e[44]=n):n=e[44];let r;return e[45]===t.needToken?r=e[46]:(r=(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[n,(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]}),e[45]=t.needToken,e[46]=r),r}let me;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,W.jsx)(P,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),e[47]=me):me=e[47];let Y;e[48]===u?Y=e[49]:(Y=e=>u({type:`patch`,patch:{search:e.target.value}}),e[48]=u,e[49]=Y);let X;e[50]!==t.searchPlaceholder||e[51]!==Y||e[52]!==r.search?(X=(0,W.jsxs)(`div`,{className:`relative`,children:[me,(0,W.jsx)(`input`,{type:`search`,value:r.search,onChange:Y,placeholder:t.searchPlaceholder,className:`w-full rounded-xl border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`})]}),e[50]=t.searchPlaceholder,e[51]=Y,e[52]=r.search,e[53]=X):X=e[53];let Z;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Z=[`all`,`inbox`,`processed`,`archived`],e[54]=Z):Z=e[54];let $;e[55]!==u||e[56]!==t.filterAll||e[57]!==t.filterArchived||e[58]!==t.filterInbox||e[59]!==t.filterProcessed||e[60]!==r.statusFilter?($=Z.map(e=>{let n=e===`all`?t.filterAll:e===`inbox`?t.filterInbox:e===`processed`?t.filterProcessed:t.filterArchived;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>u({type:`patch`,patch:{statusFilter:e}}),className:w(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.statusFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[55]=u,e[56]=t.filterAll,e[57]=t.filterArchived,e[58]=t.filterInbox,e[59]=t.filterProcessed,e[60]=r.statusFilter,e[61]=$):$=e[61];let Se,Ce;e[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,W.jsx)(`div`,{className:`mx-1 h-4 w-px bg-edge-subtle`}),Ce=[`all`,`thought`,`todo`,`voice`,`media`,`bookmark`],e[62]=Se,e[63]=Ce):(Se=e[62],Ce=e[63]);let we;e[64]!==u||e[65]!==t.kindAll||e[66]!==t.kindBookmark||e[67]!==t.kindMedia||e[68]!==t.kindThought||e[69]!==t.kindTodo||e[70]!==t.kindVoice||e[71]!==r.kindFilter?(we=Ce.map(e=>{let n=e===`all`?t.kindAll:e===`thought`?t.kindThought:e===`todo`?t.kindTodo:e===`voice`?t.kindVoice:e===`media`?t.kindMedia:t.kindBookmark;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>u({type:`patch`,patch:{kindFilter:e}}),className:w(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.kindFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[64]=u,e[65]=t.kindAll,e[66]=t.kindBookmark,e[67]=t.kindMedia,e[68]=t.kindThought,e[69]=t.kindTodo,e[70]=t.kindVoice,e[71]=r.kindFilter,e[72]=we):we=e[72];let Te;e[73]!==$||e[74]!==we?(Te=(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[$,Se,we]}),e[73]=$,e[74]=we,e[75]=Te):Te=e[75];let Ee;e[76]!==X||e[77]!==Te?(Ee=(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4 p-4 pb-2`,children:[X,Te]}),e[76]=X,e[77]=Te,e[78]=Ee):Ee=e[78];let De;e[79]!==q||e[80]!==de||e[81]!==pe||e[82]!==le||e[83]!==t.archive||e[84]!==t.delete||e[85]!==t.imageNote||e[86]!==t.noNotes||e[87]!==t.noNotesDescription||e[88]!==t.noText||e[89]!==t.pin||e[90]!==t.unpin||e[91]!==A||e[92]!==d||e[93]!==C||e[94]!==te?(De=(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-3 pb-24 [scrollbar-gutter:stable]`,children:C?(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:[1,2,3].map(ge)}):A.length===0?(0,W.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 py-16 text-center`,children:[(0,W.jsx)(l,{className:`h-8 w-8 text-fg-muted`}),(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:t.noNotes}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.noNotesDescription})]}):(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:A.map((e,n)=>{let r=n>0?H(A[n-1].createdAt):null;return(0,W.jsxs)(`div`,{children:[H(e.createdAt)!==r&&(0,W.jsx)(`div`,{className:w(`pb-2 text-xs font-medium text-fg-muted`,n>0&&`pt-2`),children:V(e.createdAt,d,te)}),(0,W.jsx)(J,{note:e,onPress:pe,onPin:le,onArchive:q,onDelete:de,timeLabels:te,labels:{pin:t.pin,unpin:t.unpin,archive:t.archive,delete:t.delete,imageNote:t.imageNote,noText:t.noText}})]},e.id)})})}),e[79]=q,e[80]=de,e[81]=pe,e[82]=le,e[83]=t.archive,e[84]=t.delete,e[85]=t.imageNote,e[86]=t.noNotes,e[87]=t.noNotesDescription,e[88]=t.noText,e[89]=t.pin,e[90]=t.unpin,e[91]=A,e[92]=d,e[93]=C,e[94]=te,e[95]=De):De=e[95];let Oe;e[96]!==re||e[97]!==ae||e[98]!==ce||e[99]!==t.quickCapturePlaceholder||e[100]!==t.recording||e[101]!==t.send?(Oe=(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-surface-panel from-60% via-surface-panel/90 to-transparent px-4 pb-[max(0.75rem,env(safe-area-inset-bottom))] pt-6`,children:(0,W.jsx)(`div`,{className:`pointer-events-auto`,children:(0,W.jsx)(Q,{placeholder:t.quickCapturePlaceholder,sendLabel:t.send,onCapture:re,onImagePick:ae,onVoiceCapture:ce,recordingLabel:t.recording})})}),e[96]=re,e[97]=ae,e[98]=ce,e[99]=t.quickCapturePlaceholder,e[100]=t.recording,e[101]=t.send,e[102]=Oe):Oe=e[102];let ke;return e[103]!==Ee||e[104]!==De||e[105]!==Oe?(ke=(0,W.jsxs)(`div`,{className:`relative mx-auto flex h-full min-h-0 w-full max-w-3xl flex-1 flex-col overflow-hidden`,children:[Ee,De,Oe]}),e[103]=Ee,e[104]=De,e[105]=Oe,e[106]=ke):ke=e[106],ke}function ge(e){return(0,W.jsx)(`div`,{className:`h-24 animate-pulse rounded-xl bg-surface-hover`},e)}function _e(e){return e.clearPageHeader}function ve(e){return e.setPageHeader}function ye(){return Date.now()}function be(e){return e.token}function xe(e){return e.language}export{$ as NotesPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a}from"./url-DPEStU4M.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s}from"./fetch-CkvRO30i.js";import{r as c}from"./toast-z0toXu32.js";import{Ca as l,Ci as u,Fi as d,Go as f,Ia as p,Ja as m,Ji as h,Ka as g,Li as _,Mi as v,P as y,Qo as b,Ro as x,Rr as S,Tt as C,Vr as w,Yi as T,do as E,fa as D,ft as O,ha as k,it as A,ka as j,mt as M,pa as N,pt as P,ua as F,ui as I,ut as L,vt as R,xt as z}from"./index-50FVtgXU.js";import{i as B,n as V,r as ee,t as H}from"./note-time-Ck2H2Qpw.js";import{a as te,i as ne,n as re,o as ie,r as ae,t as oe}from"./dist-DJDkNhu5.js";var se=n(),U=e(t(),1),W=r();function ce(e){let t=(0,se.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,U.useState)(!1),s;t[0]!==r||t[1]!==n?(s=C(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=I(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(m,{className:`h-4 w-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,W.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=I(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,W.jsx)(z,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function G(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function le(e){let t=(0,se.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=B(),f=B(q),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=I(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=I(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,W.jsx)(j,{className:`h-3.5 w-3.5 animate-spin`}):m?(0,W.jsx)(k,{className:`h-3.5 w-3.5`}):(0,W.jsx)(F,{className:`h-3.5 w-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,W.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let A=`${v}%`,M;t[23]===A?M=t[24]:(M=(0,W.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:A}})}),t[23]=A,t[24]=M);let N;t[25]!==_||t[26]!==p||t[27]!==g?(N=G(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,W.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let L;t[31]!==M||t[32]!==P?(L=(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=L):L=t[33];let R;return t[34]!==L||t[35]!==C||t[36]!==O?(R=(0,W.jsxs)(`div`,{className:C,onClick:K,children:[O,L]}),t[34]=L,t[35]=C,t[36]=O,t[37]=R):R=t[37],R}function K(e){return e.stopPropagation()}function q(e){return e.toggle}var ue={thought:p,todo:_,voice:l,media:g,bookmark:x,mixed:p,task:_};function de(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function J(e){let t=(0,se.c)(78),{note:n,onPress:r,onPin:i,onArchive:a,onDelete:o,labels:s,timeLabels:c}=e,l=ue[n.kind]||p,d;t[0]!==s||t[1]!==n?(d=de(n,s),t[0]=s,t[1]=n,t[2]=d):d=t[2];let m=d,h=!n.snippet?.trim(),[g]=(0,U.useState)(Y),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==c?(_=ee(n.createdAt,g,c),t[3]=n.createdAt,t[4]=g,t[5]=c,t[6]=_):_=t[6];let v=_,y,b;t[7]!==n.id||t[8]!==r?(y=()=>r(n.id),b=e=>{(e.key===`Enter`||e.key===` `)&&r(n.id)},t[7]=n.id,t[8]=r,t[9]=y,t[10]=b):(y=t[9],b=t[10]);let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=I(`group relative flex cursor-pointer flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,`transition-colors duration-150 ease-out hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[11]=x):x=t[11];let S;t[12]!==l||t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(S=n.coverAttachmentId?(0,W.jsx)(ce,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,W.jsx)(le,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-32 shrink-0`}):(0,W.jsx)(l,{className:`mt-0.5 h-4 w-4 shrink-0 text-fg-muted`}),t[12]=l,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=S):S=t[18];let C;t[19]===n.title?C=t[20]:(C=n.title&&(0,W.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=C);let w=n.title?`text-fg-muted`:h?`italic text-fg-muted`:`text-fg`,T;t[21]===w?T=t[22]:(T=I(`text-sm line-clamp-3`,w),t[21]=w,t[22]=T);let O;t[23]!==m||t[24]!==T?(O=(0,W.jsx)(`p`,{className:T,children:m}),t[23]=m,t[24]=T,t[25]=O):O=t[25];let k;t[26]!==O||t[27]!==C?(k=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[C,O]}),t[26]=O,t[27]=C,t[28]=k):k=t[28];let A;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,onClick:me,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,W.jsx)(E,{className:`h-4 w-4`})})}),t[29]=A):A=t[29];let j;t[30]!==n.id||t[31]!==n.pinned||t[32]!==i?(j=()=>i(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=i,t[33]=j):j=t[33];let M;t[34]===n.pinned?M=t[35]:(M=n.pinned?(0,W.jsx)(D,{className:`h-4 w-4`}):(0,W.jsx)(N,{className:`h-4 w-4`}),t[34]=n.pinned,t[35]=M);let P=n.pinned?s.unpin:s.pin,F;t[36]!==j||t[37]!==M||t[38]!==P?(F=(0,W.jsxs)(re,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:j,children:[M,P]}),t[36]=j,t[37]=M,t[38]=P,t[39]=F):F=t[39];let L;t[40]!==n.id||t[41]!==a?(L=()=>a(n.id),t[40]=n.id,t[41]=a,t[42]=L):L=t[42];let R;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,W.jsx)(f,{className:`h-4 w-4`}),t[43]=R):R=t[43];let z;t[44]!==s.archive||t[45]!==L?(z=(0,W.jsxs)(re,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:L,children:[R,s.archive]}),t[44]=s.archive,t[45]=L,t[46]=z):z=t[46];let B;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,W.jsx)(te,{className:`my-1 h-px bg-edge-subtle`}),t[47]=B):B=t[47];let V;t[48]!==n.id||t[49]!==o?(V=()=>o(n.id),t[48]=n.id,t[49]=o,t[50]=V):V=t[50];let H;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,W.jsx)(u,{className:`h-4 w-4`}),t[51]=H):H=t[51];let G;t[52]!==s.delete||t[53]!==V?(G=(0,W.jsxs)(re,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:V,children:[H,s.delete]}),t[52]=s.delete,t[53]=V,t[54]=G):G=t[54];let K;t[55]!==F||t[56]!==z||t[57]!==G?(K=(0,W.jsxs)(ne,{children:[A,(0,W.jsx)(ae,{children:(0,W.jsxs)(oe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:pe,children:[F,z,B,G]})})]}),t[55]=F,t[56]=z,t[57]=G,t[58]=K):K=t[58];let q;t[59]!==k||t[60]!==K||t[61]!==S?(q=(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[S,k,K]}),t[59]=k,t[60]=K,t[61]=S,t[62]=q):q=t[62];let J;t[63]===n.pinned?J=t[64]:(J=n.pinned&&(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,W.jsx)(N,{className:`h-3 w-3`})}),t[63]=n.pinned,t[64]=J);let X;t[65]===n.tags?X=t[66]:(X=n.tags?.map(fe),t[65]=n.tags,t[66]=X);let Z;t[67]===v?Z=t[68]:(Z=(0,W.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[67]=v,t[68]=Z);let Q;t[69]!==J||t[70]!==X||t[71]!==Z?(Q=(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[J,X,Z]}),t[69]=J,t[70]=X,t[71]=Z,t[72]=Q):Q=t[72];let he;return t[73]!==q||t[74]!==Q||t[75]!==y||t[76]!==b?(he=(0,W.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:b,className:x,children:[q,Q]}),t[73]=q,t[74]=Q,t[75]=y,t[76]=b,t[77]=he):he=t[77],he}function fe(e){return(0,W.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function pe(e){return e.stopPropagation()}function me(e){return e.stopPropagation()}function Y(){return Date.now()}var X=3e4;function Z(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Q({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:o=!1,voiceDisabled:s=!1}){let[c,u]=(0,U.useState)(``),[f,p]=(0,U.useState)(!1),[m,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(0),[b,x]=(0,U.useState)(!1),S=(0,U.useRef)(null),C=(0,U.useRef)(null),w=(0,U.useRef)(null),T=(0,U.useRef)([]),E=(0,U.useRef)(0),D=(0,U.useRef)(null),O=(0,U.useRef)(null),k=(0,U.useCallback)(()=>{D.current&&=(clearInterval(D.current),null),O.current&&=(clearTimeout(O.current),null),w.current?.getTracks().forEach(e=>e.stop()),w.current=null,C.current=null,T.current=[],_(!1),y(0)},[]);(0,U.useEffect)(()=>()=>k(),[k]);let A=(0,U.useCallback)(async()=>{let e=C.current;if(!e||e.state!==`recording`)return;x(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-E.current)/1e3)),n=e.mimeType||Z()||`audio/webm`,r=new Blob(T.current,{type:n});if(k(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{x(!1)}return}x(!1)},[k,i]),j=(0,U.useCallback)(async()=>{if(!(!i||b||m)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Z(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);w.current=e,C.current=n,T.current=[],E.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&T.current.push(e.data)},n.start(),_(!0),y(0),D.current=setInterval(()=>{y(Math.round((Date.now()-E.current)/1e3))},250),O.current=setTimeout(()=>{A()},X)}catch{k()}},[k,i,m,A,b]),M=(0,U.useCallback)(()=>{if(m){A();return}j()},[m,j,A]),N=(0,U.useCallback)(async e=>{let t=c.trim();if(!(!t||f)){p(!0),u(``);try{await n(t,e)}catch{u(t)}finally{p(!1),S.current?.focus()}}},[c,f,n]),P=(0,U.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),N()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),N({navigate:!1}))},[N]),F=f||b;return(0,W.jsxs)(`div`,{className:I(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel px-2 py-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,m&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,W.jsx)(`button`,{type:`button`,onClick:r,disabled:F||o||m,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,W.jsx)(g,{className:`h-4 w-4`})}),i&&(0,W.jsx)(`button`,{type:`button`,onClick:M,disabled:F||s||f,className:I(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,m?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":m?`Stop recording`:`Voice`,"aria-pressed":m,children:m?(0,W.jsx)(d,{className:`h-4 w-4 fill-current`}):(0,W.jsx)(l,{className:`h-4 w-4`})}),m?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(v))}):(0,W.jsx)(`textarea`,{ref:S,value:c,onChange:e=>u(e.target.value),onKeyDown:P,placeholder:e,rows:1,disabled:F,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,W.jsx)(`button`,{type:`button`,disabled:!c.trim()||F||m,onClick:e=>void N({navigate:!e.shiftKey}),"aria-label":t,className:I(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,c.trim()&&!F&&!m?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,W.jsx)(h,{className:`h-4 w-4`})})]})}var he={statusFilter:`all`,kindFilter:`all`,search:``};function $(){let e=(0,se.c)(107),t=a(i(xe)).notes,n=!!s(be),[r,l]=(0,U.useReducer)(y,he),[u]=(0,U.useState)(ye),d=b(),f;e[0]!==n||e[1]!==r.kindFilter||e[2]!==r.search||e[3]!==r.statusFilter?(f=n?[`notes-list`,r.statusFilter,r.kindFilter,r.search]:null,e[0]=n,e[1]=r.kindFilter,e[2]=r.search,e[3]=r.statusFilter,e[4]=f):f=e[4];let p=f,m;e[5]!==r.kindFilter||e[6]!==r.search||e[7]!==r.statusFilter?(m=()=>L({status:r.statusFilter===`all`?void 0:r.statusFilter,kind:r.kindFilter===`all`?void 0:r.kindFilter,search:r.search||void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),e[5]=r.kindFilter,e[6]=r.search,e[7]=r.statusFilter,e[8]=m):m=e[8];let h;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(h={keepPreviousData:!0},e[9]=h):h=e[9];let{data:g,mutate:_,isLoading:x}=o(p,m,h),C=x&&!g,E;e[10]===g?.items?E=e[11]:(E=g?.items??[],e[10]=g?.items,e[11]=E);let D=E,k=g?.total??0,j=S(ve),N=S(_e),F=k>0?t.noteCount.replace(`{{count}}`,String(k)):null,z,B;e[12]!==N||e[13]!==n||e[14]!==t.title||e[15]!==F||e[16]!==j?(z=()=>n?(j({startExtra:null,main:(0,W.jsxs)(`div`,{className:I(`flex min-w-0 items-center gap-2 px-3 sm:px-5 xl:px-6`,w),children:[(0,W.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),F?(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:F}):null]}),end:null}),()=>N()):(N(),()=>N()),B=[N,n,t.title,F,j],e[12]=N,e[13]=n,e[14]=t.title,e[15]=F,e[16]=j,e[17]=z,e[18]=B):(z=e[17],B=e[18]),(0,U.useLayoutEffect)(z,B);let ee;e[19]!==t.daysAgo||e[20]!==t.justNow||e[21]!==t.minutesAgo||e[22]!==t.today||e[23]!==t.yesterday?(ee={justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo},e[19]=t.daysAgo,e[20]=t.justNow,e[21]=t.minutesAgo,e[22]=t.today,e[23]=t.yesterday,e[24]=ee):ee=e[24];let te=ee,ne;e[25]!==_||e[26]!==d?(ne=async(e,t)=>{let n=await O(e,`web`);await _(),t?.navigate!==!1&&d(`/notes/${n.id}`)},e[25]=_,e[26]=d,e[27]=ne):ne=e[27];let re=ne,ie;e[28]!==_||e[29]!==t.imageUploadFailed||e[30]!==t.imageUploadFailedHint?(ie=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let n=e.files?.[0];if(n)try{await P(n,`web`),await _()}catch(e){let n=e;c({type:`error`,title:t.imageUploadFailed,message:n instanceof Error?n.message:t.imageUploadFailedHint})}},e.click()},e[28]=_,e[29]=t.imageUploadFailed,e[30]=t.imageUploadFailedHint,e[31]=ie):ie=e[31];let ae=ie,oe;e[32]!==_||e[33]!==t.voiceUploadFailed||e[34]!==t.voiceUploadFailedHint?(oe=async(e,n)=>{try{await M(e,n,`web`),await _()}catch(e){let n=e;c({type:`error`,title:t.voiceUploadFailed,message:n instanceof Error?n.message:t.voiceUploadFailedHint})}},e[32]=_,e[33]=t.voiceUploadFailed,e[34]=t.voiceUploadFailedHint,e[35]=oe):oe=e[35];let ce=oe,G;e[36]===_?G=e[37]:(G=async(e,t)=>{await R(e,{pinned:t}),await _()},e[36]=_,e[37]=G);let le=G,K;e[38]===_?K=e[39]:(K=async e=>{await R(e,{status:`archived`}),await _()},e[38]=_,e[39]=K);let q=K,ue;e[40]===_?ue=e[41]:(ue=async e=>{await A(e),await _()},e[40]=_,e[41]=ue);let de=ue,fe;e[42]===d?fe=e[43]:(fe=e=>{d(`/notes/${e}`)},e[42]=d,e[43]=fe);let pe=fe;if(!n){let n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(v,{className:`h-10 w-10 text-fg-muted`}),e[44]=n):n=e[44];let r;return e[45]===t.needToken?r=e[46]:(r=(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[n,(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]}),e[45]=t.needToken,e[46]=r),r}let me;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,W.jsx)(T,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),e[47]=me):me=e[47];let Y;e[48]===l?Y=e[49]:(Y=e=>l({type:`patch`,patch:{search:e.target.value}}),e[48]=l,e[49]=Y);let X;e[50]!==t.searchPlaceholder||e[51]!==Y||e[52]!==r.search?(X=(0,W.jsxs)(`div`,{className:`relative`,children:[me,(0,W.jsx)(`input`,{type:`search`,value:r.search,onChange:Y,placeholder:t.searchPlaceholder,className:`w-full rounded-xl border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`})]}),e[50]=t.searchPlaceholder,e[51]=Y,e[52]=r.search,e[53]=X):X=e[53];let Z;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Z=[`all`,`inbox`,`processed`,`archived`],e[54]=Z):Z=e[54];let $;e[55]!==l||e[56]!==t.filterAll||e[57]!==t.filterArchived||e[58]!==t.filterInbox||e[59]!==t.filterProcessed||e[60]!==r.statusFilter?($=Z.map(e=>{let n=e===`all`?t.filterAll:e===`inbox`?t.filterInbox:e===`processed`?t.filterProcessed:t.filterArchived;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{statusFilter:e}}),className:I(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.statusFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[55]=l,e[56]=t.filterAll,e[57]=t.filterArchived,e[58]=t.filterInbox,e[59]=t.filterProcessed,e[60]=r.statusFilter,e[61]=$):$=e[61];let Se,Ce;e[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,W.jsx)(`div`,{className:`mx-1 h-4 w-px bg-edge-subtle`}),Ce=[`all`,`thought`,`todo`,`voice`,`media`,`bookmark`],e[62]=Se,e[63]=Ce):(Se=e[62],Ce=e[63]);let we;e[64]!==l||e[65]!==t.kindAll||e[66]!==t.kindBookmark||e[67]!==t.kindMedia||e[68]!==t.kindThought||e[69]!==t.kindTodo||e[70]!==t.kindVoice||e[71]!==r.kindFilter?(we=Ce.map(e=>{let n=e===`all`?t.kindAll:e===`thought`?t.kindThought:e===`todo`?t.kindTodo:e===`voice`?t.kindVoice:e===`media`?t.kindMedia:t.kindBookmark;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{kindFilter:e}}),className:I(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.kindFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[64]=l,e[65]=t.kindAll,e[66]=t.kindBookmark,e[67]=t.kindMedia,e[68]=t.kindThought,e[69]=t.kindTodo,e[70]=t.kindVoice,e[71]=r.kindFilter,e[72]=we):we=e[72];let Te;e[73]!==$||e[74]!==we?(Te=(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[$,Se,we]}),e[73]=$,e[74]=we,e[75]=Te):Te=e[75];let Ee;e[76]!==X||e[77]!==Te?(Ee=(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4 p-4 pb-2`,children:[X,Te]}),e[76]=X,e[77]=Te,e[78]=Ee):Ee=e[78];let De;e[79]!==q||e[80]!==de||e[81]!==pe||e[82]!==le||e[83]!==t.archive||e[84]!==t.delete||e[85]!==t.imageNote||e[86]!==t.noNotes||e[87]!==t.noNotesDescription||e[88]!==t.noText||e[89]!==t.pin||e[90]!==t.unpin||e[91]!==D||e[92]!==u||e[93]!==C||e[94]!==te?(De=(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-3 pb-24 [scrollbar-gutter:stable]`,children:C?(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:[1,2,3].map(ge)}):D.length===0?(0,W.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 py-16 text-center`,children:[(0,W.jsx)(v,{className:`h-8 w-8 text-fg-muted`}),(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:t.noNotes}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.noNotesDescription})]}):(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:D.map((e,n)=>{let r=n>0?H(D[n-1].createdAt):null;return(0,W.jsxs)(`div`,{children:[H(e.createdAt)!==r&&(0,W.jsx)(`div`,{className:I(`pb-2 text-xs font-medium text-fg-muted`,n>0&&`pt-2`),children:V(e.createdAt,u,te)}),(0,W.jsx)(J,{note:e,onPress:pe,onPin:le,onArchive:q,onDelete:de,timeLabels:te,labels:{pin:t.pin,unpin:t.unpin,archive:t.archive,delete:t.delete,imageNote:t.imageNote,noText:t.noText}})]},e.id)})})}),e[79]=q,e[80]=de,e[81]=pe,e[82]=le,e[83]=t.archive,e[84]=t.delete,e[85]=t.imageNote,e[86]=t.noNotes,e[87]=t.noNotesDescription,e[88]=t.noText,e[89]=t.pin,e[90]=t.unpin,e[91]=D,e[92]=u,e[93]=C,e[94]=te,e[95]=De):De=e[95];let Oe;e[96]!==re||e[97]!==ae||e[98]!==ce||e[99]!==t.quickCapturePlaceholder||e[100]!==t.recording||e[101]!==t.send?(Oe=(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-surface-panel from-60% via-surface-panel/90 to-transparent px-4 pb-[max(0.75rem,env(safe-area-inset-bottom))] pt-6`,children:(0,W.jsx)(`div`,{className:`pointer-events-auto`,children:(0,W.jsx)(Q,{placeholder:t.quickCapturePlaceholder,sendLabel:t.send,onCapture:re,onImagePick:ae,onVoiceCapture:ce,recordingLabel:t.recording})})}),e[96]=re,e[97]=ae,e[98]=ce,e[99]=t.quickCapturePlaceholder,e[100]=t.recording,e[101]=t.send,e[102]=Oe):Oe=e[102];let ke;return e[103]!==Ee||e[104]!==De||e[105]!==Oe?(ke=(0,W.jsxs)(`div`,{className:`relative mx-auto flex h-full min-h-0 w-full max-w-3xl flex-1 flex-col overflow-hidden`,children:[Ee,De,Oe]}),e[103]=Ee,e[104]=De,e[105]=Oe,e[106]=ke):ke=e[106],ke}function ge(e){return(0,W.jsx)(`div`,{className:`h-24 animate-pulse rounded-xl bg-surface-hover`},e)}function _e(e){return e.clearPageHeader}function ve(e){return e.setPageHeader}function ye(){return Date.now()}function be(e){return e.token}function xe(e){return e.language}export{$ as NotesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{Gr as r,Jr as i,ci as a}from"./index-DvTb6wNR.js";var o=t();e();var s=n();function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function l(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function u(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function d(e){return e[`x-hidden`]===!0}function f(e){let t=e.properties;if(!c(t))return[];let n=[];for(let[e,r]of Object.entries(t))c(r)&&(d(r)||n.push({key:e,sub:r,order:l(r),group:u(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function p(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function m(e){let t=(0,o.c)(38),{name:n,s:a,value:c,onChange:l,disabled:u}=e,d=typeof a.description==`string`?a.description:void 0,f=(typeof a[`x-placeholder`]==`string`?a[`x-placeholder`]:null)||d,p=a.format;if(Array.isArray(a.enum)&&a.enum.every(g)){let e;t[0]===d?e=t[1]:(e=d?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:d}):null,t[0]=d,t[1]=e);let r;t[2]===l?r=t[3]:(r=e=>l(e.target.value),t[2]=l,t[3]=r);let i;t[4]===a.enum?i=t[5]:(i=a.enum.map(h),t[4]=a.enum,t[5]=i);let o;t[6]!==u||t[7]!==n||t[8]!==r||t[9]!==i||t[10]!==c?(o=(0,s.jsx)(`select`,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:c,disabled:u,onChange:r,children:i}),t[6]=u,t[7]=n,t[8]=r,t[9]=i,t[10]=c,t[11]=o):o=t[11];let f;return t[12]!==e||t[13]!==o?(f=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,o]}),t[12]=e,t[13]=o,t[14]=f):f=t[14],f}if(p===`password`){let e;t[15]===d?e=t[16]:(e=d?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:d}):null,t[15]=d,t[16]=e);let n;t[17]!==u||t[18]!==l||t[19]!==f||t[20]!==c?(n=(0,s.jsx)(i,{value:c,onChange:l,placeholder:f,labels:r,disabled:u,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=u,t[18]=l,t[19]=f,t[20]=c,t[21]=n):n=t[21];let a;return t[22]!==e||t[23]!==n?(a=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=a):a=t[24],a}let m;t[25]===d?m=t[26]:(m=d?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:d}):null,t[25]=d,t[26]=m);let _;t[27]===l?_=t[28]:(_=e=>l(e.target.value),t[27]=l,t[28]=_);let v;t[29]!==u||t[30]!==n||t[31]!==f||t[32]!==_||t[33]!==c?(v=(0,s.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:c,placeholder:f,disabled:u,onChange:_}),t[29]=u,t[30]=n,t[31]=f,t[32]=_,t[33]=c,t[34]=v):v=t[34];let y;return t[35]!==m||t[36]!==v?(y=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[m,v]}),t[35]=m,t[36]=v,t[37]=y):y=t[37],y}function h(e){return(0,s.jsx)(`option`,{value:e,children:e},e)}function g(e){return typeof e==`string`}function _(e){let t=(0,o.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,c=typeof n.description==`string`?n.description:void 0,l;t[0]===c?l=t[1]:(l=c?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:c}):null,t[0]=c,t[1]=l);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,s.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==l||t[9]!==f?(p=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[l,f]}),t[8]=l,t[9]=f,t[10]=p):p=t[10],p}function v(e){let t=(0,o.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:c}=e,l=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:c?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,s.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===l?f=t[7]:(f=(0,s.jsx)(`span`,{children:l}),t[6]=l,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,s.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function y(e){let t=(0,o.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:l}=e,u=typeof n.description==`string`?n.description:void 0,d=n.items,f=c(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=l?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,s.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==u||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===u?_=t[12]:(_=u?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:u}):null,t[11]=u,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,s.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,s.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=u,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,s.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=l?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,s.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,s.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function b(e){let t=(0,o.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:l,labels:u}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,s.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,o;t[2]===a?o=t[3]:(o=e=>a(e),t[2]=a,t[3]=o);let c;t[4]!==l||t[5]!==u||t[6]!==r||t[7]!==n||t[8]!==o?(c=(0,s.jsx)(v,{s:r,value:n,disabled:l,onChange:o,labels:u}),t[4]=l,t[5]=u,t[6]=r,t[7]=n,t[8]=o,t[9]=c):c=t[9];let d;return t[10]!==e||t[11]!==c?(d=(0,s.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[10]=e,t[11]=c,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,s.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,o;t[15]!==l||t[16]!==a||t[17]!==r||t[18]!==n?(o=(0,s.jsx)(_,{s:r,value:n,disabled:l,onChange:a}),t[15]=l,t[16]=a,t[17]=r,t[18]=n,t[19]=o):o=t[19];let c;return t[20]!==e||t[21]!==o?(c=(0,s.jsxs)(`div`,{className:`space-y-1.5`,children:[e,o]}),t[20]=e,t[21]=o,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,s.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let o=typeof i==`string`?i:``,c;t[25]!==l||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==o?(c=(0,s.jsx)(m,{name:n,s:r,value:o,disabled:l,onChange:a}),t[25]=l,t[26]=n,t[27]=a,t[28]=r,t[29]=o,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,s.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=c(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,s.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(x)?i.map(String):[],t[36]=i,t[37]=n);let o;t[38]!==l||t[39]!==u||t[40]!==a||t[41]!==r||t[42]!==n?(o=(0,s.jsx)(y,{s:r,value:n,disabled:l,onChange:a,labels:u}),t[38]=l,t[39]=u,t[40]=a,t[41]=r,t[42]=n,t[43]=o):o=t[43];let c;return t[44]!==e||t[45]!==o?(c=(0,s.jsxs)(`div`,{className:`space-y-1.5`,children:[e,o]}),t[44]=e,t[45]=o,t[46]=c):c=t[46],c}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=c(i)?i:{},t[47]=i,t[48]=e);let n=e,o;t[49]===f?o=t[50]:(o=(0,s.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=o);let d;t[51]!==l||t[52]!==u||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,s.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,s.jsx)(S,{schema:r,values:n,onChange:a,disabled:l,labels:u})}),t[51]=l,t[52]=u,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==o||t[58]!==d?(p=(0,s.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[o,d]}),t[57]=o,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==u||t[61]!==d||t[62]!==f?(p=u?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=u,t[61]=d,t[62]=f,t[63]=p):p=t[63];let h;return t[64]===p?h=t[65]:(h=(0,s.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=h),h}function x(e){return typeof e==`string`||typeof e==`number`}function S(e){let t=(0,o.c)(28),{schema:n,values:r,onChange:i,disabled:l,className:u,labels:d}=e,m=l===void 0?!1:l,h;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],h=e;break bb0}let e;t[1]===n?e=t[2]:(e=f(n),t[1]=n,t[2]=e),h=e}let g=h,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=p(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let x=y;if(n.type!==`object`||!c(n.properties)||g.length===0)return null;let S,w;if(t[9]!==u||t[10]!==m||t[11]!==v||t[12]!==d||t[13]!==x||t[14]!==r){let e=Array.from(v.keys()).sort(C);t[17]===u?S=t[18]:(S=a(`flex flex-col gap-4`,u),t[17]=u,t[18]=S);let n;t[19]!==m||t[20]!==v||t[21]!==d||t[22]!==x||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,s.jsx)(b,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>x(e.key,t),disabled:m,labels:d},e.key));return e===``?(0,s.jsx)(`div`,{children:t},`default`):(0,s.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,s.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,s.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=m,t[20]=v,t[21]=d,t[22]=x,t[23]=r,t[24]=n):n=t[24],w=e.map(n),t[9]=u,t[10]=m,t[11]=v,t[12]=d,t[13]=x,t[14]=r,t[15]=S,t[16]=w}else S=t[15],w=t[16];let T;return t[25]!==S||t[26]!==w?(T=(0,s.jsx)(`div`,{className:S,children:w}),t[25]=S,t[26]=w,t[27]=T):T=t[27],T}function C(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{S as t};
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{Xr as r,qr as i,ui as a}from"./index-50FVtgXU.js";var o=t();e();var s=n();function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function l(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function u(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function d(e){return e[`x-hidden`]===!0}function f(e){let t=e.properties;if(!c(t))return[];let n=[];for(let[e,r]of Object.entries(t))c(r)&&(d(r)||n.push({key:e,sub:r,order:l(r),group:u(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function p(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function m(e){let t=(0,o.c)(38),{name:n,s:a,value:c,onChange:l,disabled:u}=e,d=typeof a.description==`string`?a.description:void 0,f=(typeof a[`x-placeholder`]==`string`?a[`x-placeholder`]:null)||d,p=a.format;if(Array.isArray(a.enum)&&a.enum.every(g)){let e;t[0]===d?e=t[1]:(e=d?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:d}):null,t[0]=d,t[1]=e);let r;t[2]===l?r=t[3]:(r=e=>l(e.target.value),t[2]=l,t[3]=r);let i;t[4]===a.enum?i=t[5]:(i=a.enum.map(h),t[4]=a.enum,t[5]=i);let o;t[6]!==u||t[7]!==n||t[8]!==r||t[9]!==i||t[10]!==c?(o=(0,s.jsx)(`select`,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:c,disabled:u,onChange:r,children:i}),t[6]=u,t[7]=n,t[8]=r,t[9]=i,t[10]=c,t[11]=o):o=t[11];let f;return t[12]!==e||t[13]!==o?(f=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,o]}),t[12]=e,t[13]=o,t[14]=f):f=t[14],f}if(p===`password`){let e;t[15]===d?e=t[16]:(e=d?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:d}):null,t[15]=d,t[16]=e);let n;t[17]!==u||t[18]!==l||t[19]!==f||t[20]!==c?(n=(0,s.jsx)(r,{value:c,onChange:l,placeholder:f,labels:i,disabled:u,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=u,t[18]=l,t[19]=f,t[20]=c,t[21]=n):n=t[21];let a;return t[22]!==e||t[23]!==n?(a=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=a):a=t[24],a}let m;t[25]===d?m=t[26]:(m=d?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:d}):null,t[25]=d,t[26]=m);let _;t[27]===l?_=t[28]:(_=e=>l(e.target.value),t[27]=l,t[28]=_);let v;t[29]!==u||t[30]!==n||t[31]!==f||t[32]!==_||t[33]!==c?(v=(0,s.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:c,placeholder:f,disabled:u,onChange:_}),t[29]=u,t[30]=n,t[31]=f,t[32]=_,t[33]=c,t[34]=v):v=t[34];let y;return t[35]!==m||t[36]!==v?(y=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[m,v]}),t[35]=m,t[36]=v,t[37]=y):y=t[37],y}function h(e){return(0,s.jsx)(`option`,{value:e,children:e},e)}function g(e){return typeof e==`string`}function _(e){let t=(0,o.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,c=typeof n.description==`string`?n.description:void 0,l;t[0]===c?l=t[1]:(l=c?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:c}):null,t[0]=c,t[1]=l);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,s.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==l||t[9]!==f?(p=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[l,f]}),t[8]=l,t[9]=f,t[10]=p):p=t[10],p}function v(e){let t=(0,o.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:c}=e,l=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:c?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,s.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===l?f=t[7]:(f=(0,s.jsx)(`span`,{children:l}),t[6]=l,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,s.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function y(e){let t=(0,o.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:l}=e,u=typeof n.description==`string`?n.description:void 0,d=n.items,f=c(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=l?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,s.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==u||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===u?_=t[12]:(_=u?(0,s.jsx)(`label`,{className:`text-xs text-fg-muted`,children:u}):null,t[11]=u,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,s.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,s.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=u,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,s.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=l?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,s.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,s.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function b(e){let t=(0,o.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:l,labels:u}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,s.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,o;t[2]===a?o=t[3]:(o=e=>a(e),t[2]=a,t[3]=o);let c;t[4]!==l||t[5]!==u||t[6]!==r||t[7]!==n||t[8]!==o?(c=(0,s.jsx)(v,{s:r,value:n,disabled:l,onChange:o,labels:u}),t[4]=l,t[5]=u,t[6]=r,t[7]=n,t[8]=o,t[9]=c):c=t[9];let d;return t[10]!==e||t[11]!==c?(d=(0,s.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[10]=e,t[11]=c,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,s.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,o;t[15]!==l||t[16]!==a||t[17]!==r||t[18]!==n?(o=(0,s.jsx)(_,{s:r,value:n,disabled:l,onChange:a}),t[15]=l,t[16]=a,t[17]=r,t[18]=n,t[19]=o):o=t[19];let c;return t[20]!==e||t[21]!==o?(c=(0,s.jsxs)(`div`,{className:`space-y-1.5`,children:[e,o]}),t[20]=e,t[21]=o,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,s.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let o=typeof i==`string`?i:``,c;t[25]!==l||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==o?(c=(0,s.jsx)(m,{name:n,s:r,value:o,disabled:l,onChange:a}),t[25]=l,t[26]=n,t[27]=a,t[28]=r,t[29]=o,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,s.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=c(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,s.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(x)?i.map(String):[],t[36]=i,t[37]=n);let o;t[38]!==l||t[39]!==u||t[40]!==a||t[41]!==r||t[42]!==n?(o=(0,s.jsx)(y,{s:r,value:n,disabled:l,onChange:a,labels:u}),t[38]=l,t[39]=u,t[40]=a,t[41]=r,t[42]=n,t[43]=o):o=t[43];let c;return t[44]!==e||t[45]!==o?(c=(0,s.jsxs)(`div`,{className:`space-y-1.5`,children:[e,o]}),t[44]=e,t[45]=o,t[46]=c):c=t[46],c}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=c(i)?i:{},t[47]=i,t[48]=e);let n=e,o;t[49]===f?o=t[50]:(o=(0,s.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=o);let d;t[51]!==l||t[52]!==u||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,s.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,s.jsx)(S,{schema:r,values:n,onChange:a,disabled:l,labels:u})}),t[51]=l,t[52]=u,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==o||t[58]!==d?(p=(0,s.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[o,d]}),t[57]=o,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==u||t[61]!==d||t[62]!==f?(p=u?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=u,t[61]=d,t[62]=f,t[63]=p):p=t[63];let h;return t[64]===p?h=t[65]:(h=(0,s.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=h),h}function x(e){return typeof e==`string`||typeof e==`number`}function S(e){let t=(0,o.c)(28),{schema:n,values:r,onChange:i,disabled:l,className:u,labels:d}=e,m=l===void 0?!1:l,h;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],h=e;break bb0}let e;t[1]===n?e=t[2]:(e=f(n),t[1]=n,t[2]=e),h=e}let g=h,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=p(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let x=y;if(n.type!==`object`||!c(n.properties)||g.length===0)return null;let S,w;if(t[9]!==u||t[10]!==m||t[11]!==v||t[12]!==d||t[13]!==x||t[14]!==r){let e=Array.from(v.keys()).sort(C);t[17]===u?S=t[18]:(S=a(`flex flex-col gap-4`,u),t[17]=u,t[18]=S);let n;t[19]!==m||t[20]!==v||t[21]!==d||t[22]!==x||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,s.jsx)(b,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>x(e.key,t),disabled:m,labels:d},e.key));return e===``?(0,s.jsx)(`div`,{children:t},`default`):(0,s.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,s.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,s.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=m,t[20]=v,t[21]=d,t[22]=x,t[23]=r,t[24]=n):n=t[24],w=e.map(n),t[9]=u,t[10]=m,t[11]=v,t[12]=d,t[13]=x,t[14]=r,t[15]=S,t[16]=w}else S=t[15],w=t[16];let T;return t[25]!==S||t[26]!==w?(T=(0,s.jsx)(`div`,{className:S,children:w}),t[25]=S,t[26]=w,t[27]=T):T=t[27],T}function C(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{S as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a,t as o}from"./url-DPEStU4M.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{a as c,n as l}from"./fetch-CkvRO30i.js";import{i as u,r as d}from"./gateway-startup-retry-BkKyRDrF.js";import{Ba as f,Ci as p,Cr as ee,Dr as m,Er as h,Gi as g,Go as te,Hn as _,Ko as v,M as y,N as b,Or as x,P as S,Sn as C,So as w,Sr as T,Tr as E,Un as ne,Va as D,Vn as O,Yi as k,ao as A,ar as j,ci as M,cr as N,di as P,ei as F,es as I,fa as L,fi as R,fo as z,ir as B,ka as V,li as H,lr as re,mr as ie,nr as ae,or as U,pa as oe,po as W,pr as G,rr as se,sr as ce,ti as K,tr as le,ui as q,ur as ue,wa as J,xn as de,za as fe}from"./index-50FVtgXU.js";import{n as pe,t as Y}from"./settings-form-section-BlIYg2gZ.js";var X=e(t(),1),Z=n(),Q=r();function me(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function he(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ge(e){let t=(0,Z.c)(105),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:s,onAction:c}=e,l;t[0]!==i.unnamedSession||t[1]!==n.name?(l=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=l):l=t[2];let u=l,d;t[3]===n.name?d=t[4]:(d=n.name?.trim(),t[3]=n.name,t[4]=d);let f=!!d,ee=n.status===`archived`,m=n.status===`pinned`,h=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,g;t[5]===h?g=t[6]:(g=q(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,h),t[5]=h,t[6]=g);let _;t[7]===s?_=t[8]:(_=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},t[7]=s,t[8]=_);let y=r===`list`&&`sm:py-3`,b;t[9]===y?b=t[10]:(b=q(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,y),t[9]=y,t[10]=b);let x;t[11]===n.sourceChannel?x=t[12]:(x=(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.sourceChannel})}),t[11]=n.sourceChannel,t[12]=x);let S;t[13]===m?S=t[14]:(S=m?(0,Q.jsx)(oe,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[13]=m,t[14]=S);let C;t[15]===n.updatedAt?C=t[16]:(C=me(n.updatedAt),t[15]=n.updatedAt,t[16]=C);let w;t[17]===C?w=t[18]:(w=(0,Q.jsx)(`span`,{children:C}),t[17]=C,t[18]=w);let T;t[19]!==w||t[20]!==S?(T=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[S,w]}),t[19]=w,t[20]=S,t[21]=T):T=t[21];let E;t[22]!==T||t[23]!==b||t[24]!==x?(E=(0,Q.jsxs)(`div`,{className:b,children:[x,T]}),t[22]=T,t[23]=b,t[24]=x,t[25]=E):E=t[25];let D=r===`list`&&`sm:py-3`,O;t[26]===D?O=t[27]:(O=q(`min-w-0 flex-1 px-3 py-2`,D),t[26]=D,t[27]=O);let k=r===`list`&&`sm:items-start`,A;t[28]===k?A=t[29]:(A=q(`flex gap-3`,k),t[28]=k,t[29]=A);let j;t[30]!==o||t[31]!==a?(j=(0,Q.jsx)(ne,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[30]=o,t[31]=a,t[32]=j):j=t[32];let M;t[33]===u?M=t[34]:(M=(0,Q.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:u,children:u}),t[33]=u,t[34]=M);let N;t[35]!==n.key||t[36]!==f?(N=f?(0,Q.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[35]=n.key,t[36]=f,t[37]=N):N=t[37];let I;t[38]!==M||t[39]!==N?(I=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[M,N]}),t[38]=M,t[39]=N,t[40]=I):I=t[40];let R;t[41]!==A||t[42]!==j||t[43]!==I?(R=(0,Q.jsxs)(`div`,{className:A,children:[j,I]}),t[41]=A,t[42]=j,t[43]=I,t[44]=R):R=t[44];let B;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(J,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[45]=B):B=t[45];let V;t[46]===n.messageCount?V=t[47]:(V=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[B,n.messageCount]}),t[46]=n.messageCount,t[47]=V);let H;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(P,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[48]=H):H=t[48];let re;t[49]===n.estimatedTokens?re=t[50]:(re=he(n.estimatedTokens),t[49]=n.estimatedTokens,t[50]=re);let ie;t[51]===re?ie=t[52]:(ie=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[H,re]}),t[51]=re,t[52]=ie);let ae;t[53]!==V||t[54]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[V,ie]}),t[53]=V,t[54]=ie,t[55]=ae):ae=t[55];let U;t[56]===n.tags?U=t[57]:(U=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(ye),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[56]=n.tags,t[57]=U);let W;t[58]!==O||t[59]!==R||t[60]!==ae||t[61]!==U?(W=(0,Q.jsxs)(`div`,{className:O,children:[R,ae,U]}),t[58]=O,t[59]=R,t[60]=ae,t[61]=U,t[62]=W):W=t[62];let G;t[63]===c?G=t[64]:(G=()=>c(`continue`),t[63]=c,t[64]=G);let se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Q.jsx)(J,{className:`size-4`,strokeWidth:1.75}),t[65]=se):se=t[65];let ce;t[66]!==i.continueChat||t[67]!==G?(ce=(0,Q.jsx)(`button`,{type:`button`,className:F,title:i.continueChat,"aria-label":i.continueChat,onClick:G,children:se}),t[66]=i.continueChat,t[67]=G,t[68]=ce):ce=t[68];let K;t[69]!==ee||t[70]!==i.archive||t[71]!==i.unarchive||t[72]!==c?(K=ee?(0,Q.jsx)(`button`,{type:`button`,className:F,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>c(`unarchive`),children:(0,Q.jsx)(v,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:F,title:i.archive,"aria-label":i.archive,onClick:()=>c(`archive`),children:(0,Q.jsx)(te,{className:`size-4`,strokeWidth:1.75})}),t[69]=ee,t[70]=i.archive,t[71]=i.unarchive,t[72]=c,t[73]=K):K=t[73];let le;t[74]!==m||t[75]!==i.pin||t[76]!==i.unpin||t[77]!==c?(le=m?(0,Q.jsx)(`button`,{type:`button`,className:F,title:i.unpin,"aria-label":i.unpin,onClick:()=>c(`unpin`),children:(0,Q.jsx)(L,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:F,title:i.pin,"aria-label":i.pin,onClick:()=>c(`pin`),children:(0,Q.jsx)(oe,{className:`size-4`,strokeWidth:1.75})}),t[74]=m,t[75]=i.pin,t[76]=i.unpin,t[77]=c,t[78]=le):le=t[78];let ue;t[79]===c?ue=t[80]:(ue=()=>c(`export`),t[79]=c,t[80]=ue);let de;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Q.jsx)(z,{className:`size-4`,strokeWidth:1.75}),t[81]=de):de=t[81];let fe;t[82]!==i.export||t[83]!==ue?(fe=(0,Q.jsx)(`button`,{type:`button`,className:F,title:i.export,"aria-label":i.export,onClick:ue,children:de}),t[82]=i.export,t[83]=ue,t[84]=fe):fe=t[84];let pe;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(pe=q(F,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[85]=pe):pe=t[85];let Y;t[86]===c?Y=t[87]:(Y=()=>c(`delete`),t[86]=c,t[87]=Y);let X;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Q.jsx)(p,{className:`size-4`,strokeWidth:1.75}),t[88]=X):X=t[88];let ge;t[89]!==i.delete||t[90]!==Y?(ge=(0,Q.jsx)(`button`,{type:`button`,className:pe,title:i.delete,"aria-label":i.delete,onClick:Y,children:X}),t[89]=i.delete,t[90]=Y,t[91]=ge):ge=t[91];let $;t[92]!==ce||t[93]!==K||t[94]!==le||t[95]!==fe||t[96]!==ge?($=(0,Q.jsxs)(`div`,{role:`group`,className:`flex flex-wrap items-center gap-0.5 border-t border-edge-subtle/80 bg-surface-hover/25 p-2 dark:border-edge-subtle`,onClick:ve,onKeyDown:_e,children:[ce,K,le,fe,ge]}),t[92]=ce,t[93]=K,t[94]=le,t[95]=fe,t[96]=ge,t[97]=$):$=t[97];let be;return t[98]!==s||t[99]!==E||t[100]!==W||t[101]!==g||t[102]!==$||t[103]!==_?(be=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:g,onClick:s,onKeyDown:_,children:[E,W,$]}),t[98]=s,t[99]=E,t[100]=W,t[101]=g,t[102]=$,t[103]=_,t[104]=be):be=t[104],be}function _e(e){return e.stopPropagation()}function ve(e){return e.stopPropagation()}function ye(e){return(0,Q.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function be(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function xe(e){let t=$(e)?e:{},n=$(t.session)?t.session:{},r=$(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:be(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function Se(e){await l(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),d()}function Ce(){return q(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,M,`dark:border-edge`)}var we=y();function Te({hasToken:e}){let t=a(i(e=>e.language)).sessions.config,{data:n,isLoading:r}=u(e),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:xe(n.payload.config),[n]),[s,c]=(0,X.useReducer)(we,{form:null,baseline:null}),l=s.form,d=s.baseline,[f,p]=(0,X.useState)(!1),[ee,m]=(0,X.useState)(null),h=(0,X.useRef)(!1),g=(0,X.useRef)(null);b({enabled:e,parsed:o,dirty:h.current,trackedParsedRef:g,dispatch:c,onResetDirty:()=>{h.current=!1}});let te=l&&d&&JSON.stringify(l)!==JSON.stringify(d),_=(0,X.useCallback)(e=>{h.current=!0,c({type:`patch`,patch:e})},[]);return!e||!l?r?(0,Q.jsx)(Y,{children:(0,Q.jsx)(V,{className:`size-4 animate-spin text-fg-muted`})}):null:(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(pe,{icon:W,title:t.title,subtitle:t.hint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex justify-end gap-2`,children:[(0,Q.jsx)(H,{type:`button`,variant:`secondary`,disabled:!te||f,onClick:()=>c({type:`discard`}),children:t.discard}),(0,Q.jsx)(H,{type:`button`,variant:`primary`,disabled:!te||f,onClick:()=>{(async()=>{p(!0),m(null);try{await Se(l),h.current=!1,c({type:`saved`,value:l})}catch(e){m(e instanceof Error?e.message:t.saveError)}finally{p(!1)}})()},children:f?t.saving:t.save})]}),ee?(0,Q.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:ee}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(`select`,{className:Ce(),value:l.dmScope,onChange:e=>_({dmScope:e.target.value}),children:[(0,Q.jsx)(`option`,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(`option`,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(`option`,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(`option`,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(`input`,{type:`number`,min:0,className:Ce(),value:l.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();_({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(`input`,{type:`number`,min:1,className:Ce(),value:l.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();_({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})]})]})}function Ee(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function De(e){let t=(0,Z.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:u,onPin:d,onUnpin:f,onExport:p,onDelete:g}=e,te=i?.status===`archived`,_=i?.status===`pinned`,v;t[0]===c?v=t[1]:(v=e=>!e&&c(),t[0]=c,t[1]=v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(E,{className:q(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[2]=y):y=t[2];let b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=q(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,de,`dark:border-edge`),t[3]=b):b=t[3];let S;t[4]!==i||t[5]!==o||t[6]!==a?(S=i&&a?(0,Q.jsx)(ne,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=S):S=t[7];let w;t[8]!==s.unnamedSession||t[9]!==i?.name?(w=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=w):w=t[10];let D;t[11]===w?D=t[12]:(D=(0,Q.jsx)(x,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:w}),t[11]=w,t[12]=D);let O;t[13]!==S||t[14]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[S,D]}),t[13]=S,t[14]=D,t[15]=O):O=t[15];let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(R,{className:`size-5`,strokeWidth:1.75}),t[16]=k):k=t[16];let A;t[17]===s.close?A=t[18]:(A=(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:k})}),t[17]=s.close,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(M=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Q.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(Oe)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=M):M=t[26];let N;t[27]===M?N=t[28]:(N=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:M}),t[27]=M,t[28]=N);let P;t[29]!==s.detailExport||t[30]!==p?(P=(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:s.detailExport}),t[29]=s.detailExport,t[30]=p,t[31]=P):P=t[31];let F;t[32]!==te||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==u?(F=te?(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:u,children:s.unarchive}):(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=te,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=u,t[37]=F):F=t[37];let I;t[38]!==_||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==d||t[42]!==f?(I=_?(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:s.unpin}):(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:s.pin}),t[38]=_,t[39]=s.pin,t[40]=s.unpin,t[41]=d,t[42]=f,t[43]=I):I=t[43];let L;t[44]!==s.delete||t[45]!==g?(L=(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:g,children:s.delete}),t[44]=s.delete,t[45]=g,t[46]=L):L=t[46];let z;t[47]!==P||t[48]!==F||t[49]!==I||t[50]!==L?(z=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[P,F,I,L]})}),t[47]=P,t[48]=F,t[49]=I,t[50]=L,t[51]=z):z=t[51];let B;t[52]!==j||t[53]!==N||t[54]!==z?(B=(0,Q.jsxs)(h,{children:[y,(0,Q.jsxs)(ee,{className:b,"aria-describedby":void 0,children:[j,N,z]})]}),t[52]=j,t[53]=N,t[54]=z,t[55]=B):B=t[55];let V;return t[56]!==n||t[57]!==v||t[58]!==B?(V=(0,Q.jsx)(m,{open:n,onOpenChange:v,children:B}),t[56]=n,t[57]=v,t[58]=B,t[59]=V):V=t[59],V}function Oe(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:Ee(e.content)})]},`${e.timestamp??``}-${e.role}-${Ee(e.content).slice(0,24)}`)}var ke=20;function Ae(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var je=new Set([`all`,`active`,`pinned`,`archived`]),Me=new Set([`grid`,`list`]),Ne=[`sessions`,`settings`];function Pe(e){return e&&Ne.includes(e)?e:`sessions`}function Fe(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function Ie(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function Le(e){let t=(0,Z.c)(11),{s:n,activeTab:r,onChange:i}=e,a=n.tabsAriaLabel,o;t[0]!==r||t[1]!==i?(o=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=Ne.indexOf(r);t<0||i(Ne[(t+(e.key===`ArrowRight`?1:-1)+Ne.length)%Ne.length])},t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==i||t[5]!==n?(s=Ne.map(e=>{let t=e===`sessions`?D:g,a=e===r;return(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":a,"aria-controls":`sessions-panel-${e}`,id:`sessions-tab-${e}`,className:q(`inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,K.press,a?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>i(e),children:[(0,Q.jsx)(t,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:Fe(n,e)})]},e)}),t[3]=r,t[4]=i,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==n.tabsAriaLabel||t[8]!==o||t[9]!==s?(c=(0,Q.jsx)(`nav`,{"aria-label":a,className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,role:`tablist`,onKeyDown:o,children:s}),t[7]=n.tabsAriaLabel,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function Re(e){let t=(0,Z.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-2xl border border-edge bg-surface-base px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:Fe(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:Ie(n,r)})]}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Q.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function ze(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:je.has(t)?t:`all`,viewMode:Me.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function Be(){let e=a(i(e=>e.language)),t=e.sessions,n=c(e=>e.token),r=!!n,{data:o,mutate:l}=s(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),u=o?.defaultId??`main`,d=o?.items??[],[p,g]=I(),v=Pe(p.get(`tab`)),y=(0,X.useCallback)(e=>{let t=new URLSearchParams(p);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),g(t,{replace:!0})},[p,g]),[b,T]=(0,X.useReducer)(S,p,ze),{searchInput:ne,debouncedSearch:M,statusFilter:P,viewMode:F,channelFilter:L,sessions:R,loading:z,error:V,hasMore:W,stats:J,detailOpen:pe,detailLoading:Y,detailSession:Z,confirmOpen:me,confirmKey:he}=b;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=ne.trim();M!==e&&T({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[ne,M]);let _e=p.toString(),ve=(0,X.useRef)(_e);if(ve.current!==_e){ve.current=_e;let e=p.get(`q`)??``,t=p.get(`status`),n=p.get(`view`),r=(p.get(`channel`)??``).trim(),i=je.has(t)?t:`all`,a=Me.has(n)?n:`grid`,o=e.trim();T({type:`patch`,patch:{...ne===e?{}:{searchInput:e},...M===o?{}:{debouncedSearch:o},...P===i?{}:{statusFilter:i},...F===a?{}:{viewMode:a},...L===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(p),t=M.trim();t?e.set(`q`,t):e.delete(`q`),P===`all`?e.delete(`status`):e.set(`status`,P),F===`grid`?e.delete(`view`):e.set(`view`,F),L?e.set(`channel`,L):e.delete(`channel`),e.toString()!==p.toString()&&g(e,{replace:!0})},[M,p,g,P,F,L]),(0,X.useEffect)(()=>{if(!r||v!==`sessions`)return;let e=!1;return(async()=>{T({type:`patch`,patch:{loading:!0,error:null}});try{let t=await U({limit:ke,offset:0,...M?{search:M}:{},...P===`all`?{}:{status:P},...L?{channel:L}:{}});if(e)return;T({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||T({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||T({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,v,M,P,L,t.loadError]),(0,X.useEffect)(()=>{!r||v!==`sessions`||j().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,v]),(0,X.useEffect)(()=>{if(!r||v!==`sessions`)return;let e=()=>void l();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,v,l]),(0,X.useEffect)(()=>{if(!r||v!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||T({type:`patch`,patch:{sessions:R.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:Z&&Z.key===t.key?{...Z,name:t.name}:Z}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,v,R,Z]);let ye=(0,X.useCallback)(async()=>{if(!(!r||z||!W)){T({type:`patch`,patch:{loading:!0,error:null}});try{let e=await U({limit:ke,offset:R.length,...M?{search:M}:{},...P===`all`?{}:{status:P},...L?{channel:L}:{}});T({type:`patch`,patch:{sessions:[...R,...e.items],hasMore:e.hasMore}})}catch(e){T({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{T({type:`patch`,patch:{loading:!1}})}}},[r,z,W,R.length,M,P,L,t.loadError]),$=(0,X.useCallback)((e,t)=>{T({type:`patch`,patch:{sessions:R.map(n=>n.key===e?{...n,status:t}:n),detailSession:Z&&Z.key===e?{...Z,status:t}:Z}})},[R,Z]),be=(0,X.useCallback)(async e=>{T({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{T({type:`patch`,patch:{detailSession:await B(e)}})}catch{T({type:`patch`,patch:{detailOpen:!1}})}finally{T({type:`patch`,patch:{detailLoading:!1}})}},[]),xe=e=>{be(e)},Se=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e},bubbles:!0}));return}if(t===`delete`){T({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await le(e),$(e,`archived`);break;case`unarchive`:await N(e),$(e,`active`);break;case`pin`:await ce(e),$(e,`pinned`);break;case`unpin`:await re(e),$(e,`active`);break;case`export`:{let t=await se(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}j().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ce=async e=>{try{await ae(e),T({type:`patch`,patch:{sessions:R.filter(t=>t.key!==e),detailSession:Z?.key===e?null:Z,...Z?.key===e?{detailOpen:!1}:{}}}),j().then(e=>T({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},we={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,unnamedSession:e.chat.newSession},Ee={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},Oe=[{key:`all`,label:t.filterAll,icon:D},{key:`active`,label:t.filterActive,icon:w},{key:`pinned`,label:t.filterPinned,icon:oe},{key:`archived`,label:t.filterArchived,icon:te}],Ne=(()=>{let e=Object.entries(J?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6`,children:[(0,Q.jsx)(`header`,{className:`flex flex-col gap-2`,children:(0,Q.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.title})}),(0,Q.jsx)(Le,{s:t,activeTab:v,onChange:y}),(0,Q.jsx)(Re,{s:t,id:`settings`,activeTab:v,plain:!0,children:(0,Q.jsx)(Te,{hasToken:r})}),(0,Q.jsxs)(Re,{s:t,id:`sessions`,activeTab:v,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Oe.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":P===e,onClick:()=>T({type:`patch`,patch:{statusFilter:e}}),className:q(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,K.transition,K.focusRingPanel,P===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Q.jsx)(k,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:ne,onChange:e=>T({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"data-debounced-query":M||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!L,onClick:()=>T({type:`patch`,patch:{channelFilter:``}}),className:q(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,K.transition,K.focusRingPanel,L?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Ne.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":L===e,onClick:()=>T({type:`patch`,patch:{channelFilter:e}}),className:q(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,K.transition,K.focusRingPanel,L===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,J?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:J.byChannel[e]})]},e))]}),J?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[J.totalSessions,t.totalSessions],[J.activeSessions,t.activeSessions],[J.pinnedSessions,t.pinnedSessions],[J.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,V?(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:V}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:Ae(t.sessionCount,{count:R.length})}),(0,Q.jsxs)(`div`,{className:ie,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Q.jsx)(H,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":F===`grid`,onClick:()=>T({type:`patch`,patch:{viewMode:`grid`}}),className:q(G,`size-7 p-0`,F===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,F===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(f,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(H,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":F===`list`,onClick:()=>T({type:`patch`,patch:{viewMode:`list`}}),className:q(G,`size-9 p-0`,F===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,F===`list`&&`text-accent-fg`),children:(0,Q.jsx)(fe,{className:`size-3.5`,strokeWidth:1.5})})]})]}),z&&R.length===0?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):R.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Q.jsx)(A,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(H,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:q(`grid min-w-0 gap-3`,F===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":M||void 0,children:R.map(e=>{let t=_(e,u);return(0,Q.jsx)(ge,{session:e,variant:F,labels:we,sessionAgentId:t,sessionAgentAvatar:O(t,d),onOpen:()=>xe(e.key),onAction:t=>void Se(e.key,t)},e.key)})}),W?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(H,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void ye(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(De,{open:pe,loading:Y,session:Z,sessionAgentId:Z?_(Z,u):void 0,sessionAgentAvatar:Z?O(_(Z,u),d):void 0,labels:Ee,onClose:()=>{T({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>Z&&void Se(Z.key,`archive`),onUnarchive:()=>Z&&void Se(Z.key,`unarchive`),onPin:()=>Z&&void Se(Z.key,`pin`),onUnpin:()=>Z&&void Se(Z.key,`unpin`),onExport:()=>Z&&void Se(Z.key,`export`),onDelete:()=>Z&&T({type:`patch`,patch:{confirmKey:Z.key,confirmOpen:!0}})}),(0,Q.jsx)(m,{open:me,onOpenChange:e=>T({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(h,{children:[(0,Q.jsx)(E,{className:q(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),(0,Q.jsxs)(ee,{className:q(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,de),children:[(0,Q.jsx)(x,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:he?Ae(t.deleteSessionMessage,{name:R.find(e=>e.key===he)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(H,{type:`button`,variant:`secondary`,onClick:()=>T({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(H,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{he&&Ce(he),T({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-2xl px-4 py-16 text-center text-sm text-fg-muted sm:px-8 lg:max-w-app-main`,children:t.needToken})}export{Be as SessionsPage};
|