brief-lens 0.1.2 → 0.1.3
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/python/prompts/chat_insights.md +34 -0
- package/dist/python/src/chat_cli.py +28 -9
- package/dist/python/src/chat_insights.py +200 -0
- package/dist/python/src/local_llm/config.py +5 -0
- package/dist/python/src/local_llm/indexer.py +63 -10
- package/dist/python/src/workflow/definitions/chat_insights.py +83 -0
- package/dist/python/src/workflow/definitions/daily.py +4 -1
- package/dist/python/web/routers/chat.py +36 -19
- package/dist/python/web/routers/config.py +28 -0
- package/dist/web/.next-pack/BUILD_ID +1 -1
- package/dist/web/.next-pack/app-build-manifest.json +33 -32
- package/dist/web/.next-pack/app-path-routes-manifest.json +1 -1
- package/dist/web/.next-pack/build-manifest.json +2 -2
- package/dist/web/.next-pack/prerender-manifest.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/auth/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/auth/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/briefing/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/briefing/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/chat/page.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/chat/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/chat/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/config/usage/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/config/usage/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/credentials/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/credentials/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/geopolitical/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/geopolitical/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/journal/page.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/journal/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/journal/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/monitor/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/monitor/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/portfolio/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/portfolio/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/run/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/run/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/watch-sectors/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/watch-sectors/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/(main)/workspace/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/(main)/workspace/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app/_not-found.html +2 -2
- package/dist/web/.next-pack/server/app/_not-found.rsc +1 -1
- package/dist/web/.next-pack/server/app/api/[...path]/route.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/api/attachments/[...path]/route.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/api/attachments/upload/route.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/api/images/[...path]/route.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/api/images/upload/route.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/icon.svg/route.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/page.js +9 -9
- package/dist/web/.next-pack/server/app/page.js.nft.json +1 -1
- package/dist/web/.next-pack/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/.next-pack/server/app-paths-manifest.json +6 -6
- package/dist/web/.next-pack/server/chunks/1442.js +2 -2
- package/dist/web/.next-pack/server/chunks/899.js +1 -0
- package/dist/web/.next-pack/server/pages/404.html +2 -2
- package/dist/web/.next-pack/server/pages/500.html +1 -1
- package/dist/web/.next-pack/server/pages/_app.js.nft.json +1 -1
- package/dist/web/.next-pack/server/pages/_document.js.nft.json +1 -1
- package/dist/web/.next-pack/server/pages/_error.js.nft.json +1 -1
- package/dist/web/.next-pack/server/server-reference-manifest.json +1 -1
- package/dist/web/.next-pack/static/chunks/2793-3a816c3e63003cd6.js +1 -0
- package/dist/web/.next-pack/static/chunks/4397-f2bbfac974a09e4a.js +1 -0
- package/dist/web/.next-pack/static/chunks/6739-73ae2a518896a21d.js +1 -0
- package/dist/web/.next-pack/static/chunks/9095-7b51a045d7ef3c03.js +1 -0
- package/dist/web/.next-pack/static/chunks/app/(main)/briefing/page-2bd110800f6f6092.js +1 -0
- package/dist/web/.next-pack/static/chunks/app/(main)/chat/page-4787522c9ae8eb98.js +1 -0
- package/dist/web/.next-pack/static/chunks/app/(main)/journal/page-f06bd837eb652eec.js +1 -0
- package/dist/web/.next-pack/static/chunks/app/(main)/layout-722c5f8b47c03713.js +1 -0
- package/dist/web/.next-pack/static/chunks/app/page-31f1d43bab366b86.js +1 -0
- package/dist/web/.next-pack/static/css/eeafe748380067e9.css +3 -0
- package/package.json +1 -1
- package/dist/web/.next-pack/server/chunks/3462.js +0 -1
- package/dist/web/.next-pack/static/chunks/2941-b28caa63b1192cbf.js +0 -1
- package/dist/web/.next-pack/static/chunks/6739-26a12feb3f34ac69.js +0 -1
- package/dist/web/.next-pack/static/chunks/8480-3e063ceeceee7e6a.js +0 -1
- package/dist/web/.next-pack/static/chunks/app/(main)/briefing/page-32855bc0aad3c4c5.js +0 -1
- package/dist/web/.next-pack/static/chunks/app/(main)/chat/page-f176f405e29e9deb.js +0 -1
- package/dist/web/.next-pack/static/chunks/app/(main)/journal/page-d0b70496ffe17f8d.js +0 -1
- package/dist/web/.next-pack/static/chunks/app/(main)/layout-b0cecbd1d6c9d290.js +0 -1
- package/dist/web/.next-pack/static/chunks/app/page-ecd907ac75b147cf.js +0 -1
- package/dist/web/.next-pack/static/css/ddefc688f27e14b2.css +0 -3
- /package/dist/web/.next-pack/static/{VdoUHqMuKEB2yUBQvac5b → HRelvfbIJ8aRo0S_dK4jo}/_buildManifest.js +0 -0
- /package/dist/web/.next-pack/static/{VdoUHqMuKEB2yUBQvac5b → HRelvfbIJ8aRo0S_dK4jo}/_ssgManifest.js +0 -0
|
@@ -18,5 +18,5 @@ exports.id=1442,exports.ids=[1442],exports.modules={1712:(e,t,a)=>{Promise.resol
|
|
|
18
18
|
document.documentElement.style.setProperty(${JSON.stringify(n.is)}, sw + "px");
|
|
19
19
|
}
|
|
20
20
|
}catch(e){}})();
|
|
21
|
-
`},48768:(e,t,a)=>{"use strict";a.d(t,{Qq:()=>i,Tw:()=>l,XH:()=>o,h0:()=>d,jG:()=>n});var r=a(10326);function s({size:e=14,children:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t})}function n(e){return(0,r.jsxs)(s,{...e,children:[r.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),r.jsx("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),r.jsx("path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}),r.jsx("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]})}function i(e){return(0,r.jsxs)(s,{...e,children:[r.jsx("path",{d:"M15 3h6v6"}),r.jsx("path",{d:"M9 21H3v-6"}),r.jsx("path",{d:"M21 3l-7 7"}),r.jsx("path",{d:"M3 21l7-7"})]})}function l(e){return(0,r.jsxs)(s,{...e,children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function o({size:e=14}){return(0,r.jsxs)(s,{size:e,children:[r.jsx("polyline",{points:"3 6 5 6 21 6"}),r.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),r.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),r.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function d({size:e=12}){return(0,r.jsxs)(s,{size:e,children:[r.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),r.jsx("polyline",{points:"15 3 21 3 21 9"}),r.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}},84739:(e,t,a)=>{"use strict";a.d(t,{JournalChatBridge:()=>l});var r=a(17577);a(29766);var s=a(36298),n=a(12711),i=a(2632);function l(){let e=(0,s.R)(),t=(0,n.l)(),{loadDates:a}=(0,i.O)();(0,r.useRef)(new Set);let{status:l,jobId:o,question:d,assistantContent:c,targetEntryId:u,setError:h,reset:m}=e,{addTurn:x,setEntryId:p}=t;return null}},94397:(e,t,a)=>{"use strict";a.d(t,{AuthModeForm:()=>u});var r=a(10326),s=a(90434),n=a(35047),i=a(17577),l=a(90772),o=a(33071),d=a(18660);let c=[{value:"cli",label:"Claude Pro / Max subscription (CLI)",hint:"Uses the OAuth session from `claude login`. No API key billing."},{value:"api",label:"Anthropic API key",hint:"Pay-per-use via ANTHROPIC_API_KEY (stored in the keychain)."}];function u({initialAuthMode:e,anthropicKeySet:t}){let a=(0,n.useRouter)(),[u,h]=(0,i.useState)(e),[m,x]=(0,i.useState)("idle"),[p,f]=(0,i.useState)(null),g="api"===u&&!t,b=async()=>{if(g){f("Set ANTHROPIC_API_KEY in Credentials before switching to API mode."),x("error");return}x("saving"),f(null);let e=await fetch("/api/auth/mode",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({auth_mode:u})});if(!e.ok){f(`PUT /api/auth/mode failed (HTTP ${e.status})`),x("error");return}x("saved"),a.refresh()};return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("fieldset",{className:"space-y-3","data-testid":"auth-options",children:[r.jsx("legend",{className:"sr-only",children:"Authentication mode"}),c.map(e=>r.jsx(o.Zb,{children:r.jsx(o.aY,{className:"pt-6",children:(0,r.jsxs)("label",{className:"flex cursor-pointer items-start gap-3",children:[r.jsx("input",{type:"radio",name:"auth-mode",value:e.value,checked:u===e.value,onChange:()=>h(e.value),className:"mt-1","data-testid":`auth-radio-${e.value}`}),(0,r.jsxs)("span",{className:"flex flex-col",children:[r.jsx("span",{className:"font-medium",children:e.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e.hint})]})]})})},e.value))]}),g&&(0,r.jsxs)("p",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive","data-testid":"api-blocked",children:["API mode requires ",r.jsx("code",{className:"font-mono",children:"ANTHROPIC_API_KEY"})," ","in the keychain. Open"," ",r.jsx(s.default,{href:"/credentials",className:"underline underline-offset-2",children:"Credentials"})," ","to set it, then come back."]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[r.jsx(l.z,{onClick:()=>void b(),disabled:"saving"===m||u===e,"data-testid":"auth-save",children:"Save"}),r.jsx(d.Q,{status:m})]}),p&&r.jsx("p",{className:"text-sm text-destructive","data-testid":"generic-error",children:p})]})}},23492:(e,t,a)=>{"use strict";a.d(t,{CredentialsForm:()=>h});var r=a(10326),s=a(35047),n=a(17577),i=a(567),l=a(90772),o=a(33071),d=a(62288),c=a(54432);let u=[{name:"DISCORD_TOKEN",label:"Discord bot token",secret:!0},{name:"CHANNEL_ID",label:"Discord channel id",secret:!1},{name:"NOTION_API_KEY",label:"Notion integration key",secret:!0},{name:"NOTION_DATABASE_ID",label:"Notion database id",secret:!1},{name:"NOTION_DATABASE_ID_JOURNAL",label:"Notion journal database id",secret:!1},{name:"ANTHROPIC_API_KEY",label:"Anthropic API key",secret:!0}];function h({initial:e}){let t=(0,s.useRouter)(),[a,h]=(0,n.useState)(e),[m,x]=(0,n.useState)(null),[p,f]=(0,n.useState)(""),[g,b]=(0,n.useState)(null),[y,v]=(0,n.useState)(null),j=e=>{x(e),f(""),v(null)},w=()=>{x(null),f("")},N=async()=>{if(!m)return;let e=p.trim();if(""===e){v("Value is required");return}b(m.name),v(null);let a=await fetch(`/api/credentials/${encodeURIComponent(m.name)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:e})});if(b(null),!a.ok){v(`PUT failed (HTTP ${a.status})`);return}h(e=>({...e,[m.name]:!0})),w(),t.refresh()},k=async e=>{b(e),v(null);let a=await fetch(`/api/credentials/${encodeURIComponent(e)}`,{method:"DELETE"});if(b(null),!a.ok){v(`DELETE failed (HTTP ${a.status})`);return}h(t=>({...t,[e]:!1})),t.refresh()};return(0,r.jsxs)("div",{className:"space-y-3",children:[u.map(e=>{let t=!!a[e.name];return r.jsx(o.Zb,{children:(0,r.jsxs)(o.aY,{className:"flex items-center justify-between gap-4 pt-6",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[r.jsx("p",{className:"font-medium",children:e.label}),r.jsx("p",{className:"text-xs font-mono text-muted-foreground",children:e.name})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[r.jsx(i.C,{variant:t?"default":"secondary","data-testid":`status-${e.name}`,children:t?"Set":"Not set"}),r.jsx(l.z,{variant:"outline",size:"sm",onClick:()=>j(e),disabled:g===e.name,"data-testid":`update-${e.name}`,children:t?"Update":"Set"}),r.jsx(l.z,{variant:"ghost",size:"sm",onClick:()=>void k(e.name),disabled:!t||g===e.name,"data-testid":`delete-${e.name}`,children:"Delete"})]})]})},e.name)}),r.jsx(d.Vq,{open:null!==m,onOpenChange:e=>{e||w()},children:r.jsx(d.cZ,{children:m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(d.fK,{children:[(0,r.jsxs)(d.$N,{children:[a[m.name]?"Update":"Set"," ",m.label]}),(0,r.jsxs)(d.Be,{children:["Stored in the OS keychain under",r.jsx("code",{className:"ml-1 font-mono",children:m.name}),"."]})]}),r.jsx(c.I,{autoFocus:!0,type:m.secret?"password":"text",value:p,onChange:e=>f(e.target.value),placeholder:m.secret?"••••••••••":"Paste the value",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),N())},"data-testid":"credential-draft"}),y&&r.jsx("p",{className:"text-sm text-destructive","data-testid":"credential-error",children:y}),(0,r.jsxs)(d.cN,{children:[r.jsx(l.z,{variant:"ghost",onClick:w,children:"Cancel"}),r.jsx(l.z,{onClick:()=>void N(),disabled:g===m.name,"data-testid":"credential-save",children:"Save"})]})]})})}),y&&!m&&r.jsx("p",{className:"text-sm text-destructive","data-testid":"generic-error",children:y})]})}},5266:(e,t,a)=>{"use strict";a.d(t,{UsageDashboard:()=>c});var r=a(10326),s=a(17577),n=a(81828),i=a(77863);function l({records:e,metric:t,activeIndex:a=null,onActiveChange:l}){let o=(0,s.useRef)([]);if(0===e.length)return r.jsx("p",{"data-testid":"usage-chart-empty",className:"text-sm text-muted-foreground",children:"No usage records for this date."});let d="all"===t,c=e.map(e=>d?(0,n.gT)(e):(0,n.S)(e,t)),{niceMax:u,ticks:h}=(0,n.t_)(Math.max(...c,1)),m=new Set((0,n.DI)(e.length,12)),x=t=>{let a=Math.max(0,Math.min(e.length-1,t));o.current[a]?.focus()},p=e=>{let t=e.relatedTarget;t&&e.currentTarget.parentElement?.contains(t)||l?.(null)},f=(e,t)=>{"ArrowRight"===t.key?(t.preventDefault(),x(e+1)):"ArrowLeft"===t.key&&(t.preventDefault(),x(e-1))};return(0,r.jsxs)("div",{"data-testid":"usage-bar-chart",role:"group","aria-label":"Usage bar chart",className:"flex pt-6",children:[r.jsx("div",{"aria-hidden":!0,className:"relative shrink-0",style:{height:240,width:48},children:h.map(e=>r.jsx("span",{"data-testid":`usage-y-tick-${e}`,className:"absolute right-2 -translate-y-1/2 text-[11px] tabular-nums text-muted-foreground",style:{bottom:`${e/u*100}%`},children:(0,n.jP)(t,e)},e))}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{"data-testid":"usage-plot-area",className:"relative w-full border-b border-l border-border",style:{height:240},onMouseLeave:()=>l?.(null),children:[h.map(e=>0===e?null:r.jsx("div",{"data-testid":`usage-gridline-${e}`,"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 border-t border-muted-foreground/60",style:{bottom:`${e/u*100}%`}},e)),r.jsx("div",{className:"absolute inset-0 flex items-end gap-1",children:e.map((e,s)=>{let h=c[s],m=h/u*100,x=a===s;return r.jsx("button",{ref:e=>{o.current[s]=e},type:"button","data-testid":`usage-bar-${s}`,"data-active":x,"aria-label":`${e.label} ${(0,n.vM)(e.timestamp)}: ${(0,n.jP)(t,h)}`,title:e.label,className:"flex h-full flex-1 flex-col justify-end",onMouseEnter:()=>l?.(s),onFocus:()=>l?.(s),onBlur:p,onKeyDown:e=>f(s,e),children:d?r.jsx("span",{"data-testid":`usage-bar-fill-${s}`,className:(0,i.cn)("flex w-full flex-col-reverse overflow-hidden rounded-t transition-all",x?"brightness-110":"brightness-100"),style:{height:`${m}%`},children:n.TE.map(t=>{let a=e[t.key]??0,n=h||1;return r.jsx("span",{"data-testid":`usage-bar-segment-${s}-${t.key}`,className:(0,i.cn)("w-full",t.className),style:{height:`${a/n*100}%`}},t.key)})}):r.jsx("span",{"data-testid":`usage-bar-fill-${s}`,className:(0,i.cn)("w-full rounded-t bg-gradient-to-t transition-colors",x?"from-blue-700 to-blue-400":"from-blue-600 to-blue-300 hover:from-blue-700 hover:to-blue-400"),style:{height:`${m}%`}})},`${e.timestamp}-${s}`)})})]}),r.jsx("div",{className:"flex gap-1","aria-hidden":!0,children:e.map((e,t)=>r.jsx("span",{"data-testid":m.has(t)?`usage-bar-x-label-${t}`:void 0,className:"min-w-0 flex-1 truncate pt-1 text-center text-[11px] tabular-nums text-muted-foreground",children:m.has(t)?(0,n.vM)(e.timestamp):""},`${e.timestamp}-label-${t}`))})]}),d&&r.jsx("ul",{"data-testid":"usage-stack-legend",className:"ml-2 flex shrink-0 flex-col justify-start gap-1 self-center text-xs text-muted-foreground",children:n.TE.map(e=>(0,r.jsxs)("li",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:(0,i.cn)("h-2.5 w-2.5 rounded-sm",e.swatchClassName),"aria-hidden":!0}),e.label]},e.key))})]})}function o({summary:e,metric:t}){let a=(0,s.useId)(),[i,l]=(0,s.useState)(null);if(0===e.length)return r.jsx("p",{"data-testid":"usage-trend-empty",className:"text-sm text-muted-foreground",children:"No daily summary available yet."});let o=e.map(e=>(0,n.Gt)(e,t)),{niceMax:d,ticks:c}=(0,n.t_)(Math.max(...o,1)),u=e.length,h=e=>1===u?50:8+e/(u-1)*84,m=e=>(1-e/d)*100,x=o.map((t,a)=>({x:h(a),y:m(t),v:t,day:e[a].date})),p=x.map((e,t)=>`${0===t?"M":"L"} ${e.x} ${e.y}`).join(" "),f=new Set((0,n.DI)(u,8));return(0,r.jsxs)("div",{"data-testid":"usage-trend-chart",role:"group","aria-label":"Usage daily trend chart",className:"pt-6",children:[(0,r.jsxs)("div",{className:"flex",children:[r.jsx("div",{"aria-hidden":!0,className:"relative shrink-0",style:{height:200,width:48},children:c.map(e=>r.jsx("span",{className:"absolute right-2 -translate-y-1/2 text-[11px] tabular-nums text-muted-foreground",style:{bottom:`${e/d*100}%`},children:(0,n.jP)(t,e)},e))}),(0,r.jsxs)("div",{"data-testid":"usage-trend-plot",className:"relative flex-1 border-b border-l border-border",style:{height:200},children:[c.map(e=>0===e?null:r.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 border-t border-muted-foreground/60",style:{bottom:`${e/d*100}%`}},e)),(0,r.jsxs)("svg",{className:"absolute inset-0 h-full w-full overflow-visible",viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":!0,children:[r.jsx("defs",{children:(0,r.jsxs)("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"0%",stopColor:"rgb(37 99 235)",stopOpacity:"0.3"}),r.jsx("stop",{offset:"100%",stopColor:"rgb(37 99 235)",stopOpacity:"0"})]})}),u>1&&r.jsx("path",{d:`${p} L ${x[u-1].x} 100 L ${x[0].x} 100 Z`,fill:`url(#${a})`,stroke:"none"}),u>1&&r.jsx("path",{"data-testid":"usage-trend-line",d:p,fill:"none",stroke:"rgb(37 99 235)",strokeWidth:1.5,vectorEffect:"non-scaling-stroke"})]}),i&&r.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-10 -translate-x-1/2 -translate-y-full rounded bg-foreground px-2 py-1 text-[11px] tabular-nums text-background shadow",style:{left:`${i.x}%`,top:`${i.y}%`,marginTop:"-6px"},children:i.label}),x.map((e,a)=>{let s=`${e.day}: ${(0,n.jP)(t,e.v)}`;return r.jsx("span",{"data-testid":`usage-trend-point-${a}`,role:"img","aria-label":s,tabIndex:0,className:"absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 cursor-pointer rounded-full bg-blue-600 outline-none ring-offset-0 focus-visible:ring-2 focus-visible:ring-blue-400",style:{left:`${e.x}%`,top:`${e.y}%`},onMouseEnter:()=>l({x:e.x,y:e.y,label:s}),onMouseLeave:()=>l(null),onFocus:()=>l({x:e.x,y:e.y,label:s}),onBlur:()=>l(null)},e.day)})]})]}),(0,r.jsxs)("div",{className:"flex","aria-hidden":!0,children:[r.jsx("div",{className:"shrink-0",style:{width:48}}),r.jsx("div",{className:"relative h-5 flex-1",children:x.map((e,t)=>f.has(t)?r.jsx("span",{"data-testid":`usage-trend-x-label-${t}`,className:"absolute top-1 -translate-x-1/2 whitespace-nowrap text-[11px] tabular-nums text-muted-foreground",style:{left:`${e.x}%`},children:(0,n.iS)(e.day)},e.day):null)})]})]})}let d=["cost_usd","input_tokens","output_tokens","cache_read_tokens","cache_creation_tokens","duration_ms","all"];function c(){let[e,t]=(0,s.useState)(null),[a,c]=(0,s.useState)(null),[u,h]=(0,s.useState)([]),[m,x]=(0,s.useState)("cost_usd"),[p,f]=(0,s.useState)("7d"),[g,b]=(0,s.useState)([]),[y,v]=(0,s.useState)(null),[j,w]=(0,s.useState)(null),[N,k]=(0,s.useState)(!1),S=(0,s.useRef)(null);if((0,s.useCallback)(e=>{k(!0),w(null),v(null),S.current=e,fetch(`/api/usage?date=${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{S.current===e&&h(t.records)}).catch(t=>{S.current===e&&w(String(t))}).finally(()=>{S.current===e&&k(!1)})},[]),j)return(0,r.jsxs)("p",{"data-testid":"usage-error",className:"text-sm text-destructive",children:["Failed to load usage data: ",j]});if(null===e)return r.jsx("p",{"data-testid":"usage-dates-loading",className:"text-sm text-muted-foreground",children:"Loading usage dates…"});if(0===e.length)return r.jsx("p",{"data-testid":"usage-no-dates",className:"text-sm text-muted-foreground",children:"No usage logs found."});let C=(0,n.Ep)(g,p,(0,i._)()),P=(0,n.xY)(C),$=null!==y?u[y]:null;return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:["Date",r.jsx("select",{"data-testid":"usage-date-select",value:a??"",onChange:e=>c(e.target.value),className:"rounded-md border bg-background px-2 py-1 text-sm",children:e.map(e=>r.jsx("option",{value:e,children:e},e))})]}),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:["Metric",r.jsx("select",{"data-testid":"usage-metric-select",value:m,onChange:e=>x(e.target.value),className:"rounded-md border bg-background px-2 py-1 text-sm",children:d.map(e=>r.jsx("option",{value:e,children:n.tB[e]},e))})]})]}),(0,r.jsxs)("section",{className:"space-y-1",children:[(0,r.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground",children:["Per run (",a,") — ",n.tB[m]]}),N?r.jsx("p",{"data-testid":"usage-loading",className:"text-sm text-muted-foreground",children:"Loading…"}):r.jsx(l,{records:u,metric:m,activeIndex:y,onActiveChange:v})]}),(0,r.jsxs)("section",{className:"space-y-3 rounded-md border p-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:["Range",r.jsx("select",{"data-testid":"usage-range-select",value:p,onChange:e=>f(e.target.value),className:"rounded-md border bg-background px-2 py-1 text-sm",children:Object.keys(n.IE).map(e=>r.jsx("option",{value:e,children:n.IE[e]},e))})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Applies to the totals and trend below — the per-run chart above follows Date."})]}),r.jsx("dl",{"data-testid":"usage-range-totals",className:"grid grid-cols-2 gap-x-4 gap-y-1 text-sm sm:grid-cols-4",children:[["Total cost",(0,n.jP)("cost_usd",P.cost_usd)],["Total tokens",(0,n.CZ)(P.tokens)],["Calls",(0,n.CZ)(P.calls)],["Days logged",(0,n.CZ)(P.days)]].map(([e,t])=>(0,r.jsxs)("div",{className:"flex justify-between gap-2",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsx("dd",{className:"font-medium tabular-nums",children:t})]},e))}),0===C.length?r.jsx("p",{"data-testid":"usage-range-empty",className:"text-sm text-muted-foreground",children:"No days in this range."}):"all"!==m?(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground",children:["Daily trend (",n.IE[p],") — ",n.tB[m]]}),r.jsx(o,{summary:C,metric:m})]}):null]}),r.jsx("div",{className:"min-h-[7rem]","aria-live":"polite",role:"status",children:$?r.jsx("dl",{"data-testid":"usage-detail",className:"grid grid-cols-2 gap-x-4 gap-y-1 rounded-md border p-3 text-sm sm:grid-cols-3",children:n.fW.map(e=>(0,r.jsxs)("div",{className:"flex justify-between gap-2",children:[r.jsx("dt",{className:"text-muted-foreground",children:n.Ou[e]}),r.jsx("dd",{className:"font-medium",children:(0,n.he)(e,$[e])})]},e))}):r.jsx("p",{"data-testid":"usage-detail-hint",className:"text-sm text-muted-foreground",children:"Hover or focus a bar to see its details."})})]})}},567:(e,t,a)=>{"use strict";a.d(t,{C:()=>l});var r=a(10326);a(17577);var s=a(79360),n=a(77863);let i=(0,s.j)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function l({className:e,variant:t,...a}){return r.jsx("div",{className:(0,n.cn)(i({variant:t}),e),...a})}},90772:(e,t,a)=>{"use strict";a.d(t,{z:()=>d});var r=a(10326),s=a(17577),n=a(34214),i=a(79360),l=a(77863);let o=(0,i.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),d=s.forwardRef(({className:e,variant:t,size:a,asChild:s=!1,...i},d)=>{let c=s?n.g7:"button";return r.jsx(c,{className:(0,l.cn)(o({variant:t,size:a,className:e})),ref:d,...i})});d.displayName="Button"},33071:(e,t,a)=>{"use strict";a.d(t,{Ol:()=>l,SZ:()=>d,Zb:()=>i,aY:()=>c,eW:()=>u,ll:()=>o});var r=a(10326),s=a(17577),n=a(77863);let i=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("rounded-xl border bg-card text-card-foreground shadow",e),...t}));i.displayName="Card";let l=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",e),...t}));l.displayName="CardHeader";let o=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("font-semibold leading-none tracking-tight",e),...t}));o.displayName="CardTitle";let d=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("text-sm text-muted-foreground",e),...t}));d.displayName="CardDescription";let c=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("p-6 pt-0",e),...t}));c.displayName="CardContent";let u=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("flex items-center p-6 pt-0",e),...t}));u.displayName="CardFooter"},62288:(e,t,a)=>{"use strict";a.d(t,{$N:()=>p,Be:()=>f,Vq:()=>o,cN:()=>x,cZ:()=>h,fK:()=>m,hg:()=>d});var r=a(10326),s=a(17577),n=a(84813),i=a(80380),l=a(77863);let o=n.fC,d=n.xz,c=n.h_;n.x8;let u=s.forwardRef(({className:e,...t},a)=>r.jsx(n.aV,{ref:a,className:(0,l.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));u.displayName=n.aV.displayName;let h=s.forwardRef(({className:e,children:t,...a},s)=>(0,r.jsxs)(c,{children:[r.jsx(u,{}),(0,r.jsxs)(n.VY,{ref:s,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a,children:[t,(0,r.jsxs)(n.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsx(i.Z,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));h.displayName=n.VY.displayName;let m=({className:e,...t})=>r.jsx("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});m.displayName="DialogHeader";let x=({className:e,...t})=>r.jsx("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});x.displayName="DialogFooter";let p=s.forwardRef(({className:e,...t},a)=>r.jsx(n.Dx,{ref:a,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",e),...t}));p.displayName=n.Dx.displayName;let f=s.forwardRef(({className:e,...t},a)=>r.jsx(n.dk,{ref:a,className:(0,l.cn)("text-sm text-muted-foreground",e),...t}));f.displayName=n.dk.displayName},54432:(e,t,a)=>{"use strict";a.d(t,{I:()=>i});var r=a(10326),s=a(17577),n=a(77863);let i=s.forwardRef(({className:e,type:t,...a},s)=>r.jsx("input",{type:t,className:(0,n.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...a}));i.displayName="Input"},25947:(e,t,a)=>{"use strict";a.d(t,{DV:()=>l,RO:()=>n,W1:()=>c,aA:()=>i,nf:()=>d,o_:()=>o});var r=a(10326);let s={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"};function n({className:e}){return r.jsx("svg",{...s,className:e,"aria-hidden":!0,children:r.jsx("path",{d:"M1.75 4.25c0-.55.45-1 1-1h3l1.5 1.5h5c.55 0 1 .45 1 1v5.5c0 .55-.45 1-1 1H2.75c-.55 0-1-.45-1-1v-6z"})})}function i({className:e,color:t}){return(0,r.jsxs)("svg",{...s,stroke:t??s.stroke,className:e,"aria-hidden":!0,children:[r.jsx("path",{d:"M4 1.75h5l3 3v9.5c0 .14-.11.25-.25.25H4a.25.25 0 0 1-.25-.25V2A.25.25 0 0 1 4 1.75z"}),r.jsx("path",{d:"M9 1.75v3h3"})]})}function l({className:e,open:t}){return r.jsx("svg",{...s,className:e,style:{transform:t?"rotate(90deg)":void 0},"aria-hidden":!0,children:r.jsx("path",{d:"M6 4l4 4-4 4"})})}function o({className:e}){return(0,r.jsxs)("svg",{...s,className:e,"aria-hidden":!0,children:[r.jsx("path",{d:"M4 5.5l4 3 4-3"}),r.jsx("path",{d:"M4 9.5l4 3 4-3"})]})}function d({className:e}){return(0,r.jsxs)("svg",{...s,className:e,"aria-hidden":!0,children:[r.jsx("path",{d:"M4 10.5l4-3 4 3"}),r.jsx("path",{d:"M4 6.5l4-3 4 3"})]})}function c({className:e}){return(0,r.jsxs)("svg",{...s,className:e,"aria-hidden":!0,children:[r.jsx("circle",{cx:"6.75",cy:"6.75",r:"4"}),r.jsx("path",{d:"M9.75 9.75L13.25 13.25"})]})}},13074:(e,t,a)=>{"use strict";a.d(t,{ChatJobStateProvider:()=>d,w:()=>c});var r=a(10326),s=a(45377);let n={jobId:null,status:"idle",question:"",date:"",searchHistory:!1,assistantContent:"",error:null,sessionExpired:!1,staleSession:!1},i=e=>"pending"===e||"running"===e,{Provider:l,useStore:o}=(0,s.U)({storageKey:"ai-agent:chat-job:v1",initialState:n,getJobId:e=>e.jobId,isInFlight:e=>i(e.status),isPersistable:e=>!!e.jobId&&i(e.status),serializeForStorage:e=>({...e,assistantContent:"",sessionExpired:!1,staleSession:!1}),start:async({question:e,date:t,image_path:a,search_history:r},{setState:s})=>{s(()=>({...n,status:"pending",question:e,date:t,searchHistory:!!r}));try{let i=await fetch("/api/chat",{method:"POST",cache:"no-store",headers:{"content-type":"application/json"},body:JSON.stringify({date:t,question:e,...a?{image_path:a}:{},...r?{search_history:!0}:{}})});if(401===i.status){s(()=>({...n,sessionExpired:!0}));return}if(!i.ok){let e=await i.text().catch(()=>"");s(t=>({...t,status:"failed",error:`POST /api/chat failed (HTTP ${i.status}): ${e}`}));return}let l=await i.json();if(!l.job_id){s(e=>({...e,status:"failed",error:"POST /api/chat returned no job_id"}));return}s(e=>({...e,jobId:l.job_id??null,status:"running"}))}catch(e){s(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}))}},watch:async(e,{signal:t,setState:a})=>{let r;a(e=>({...e,assistantContent:""}));try{r=await fetch(`/api/chat/${e}/stream`,{method:"GET",cache:"no-store",signal:t})}catch(e){if(t.aborted)return;a(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}));return}if(t.aborted)return;if(401===r.status){a(e=>({...e,sessionExpired:!0,status:"failed"}));return}if(404===r.status){a(()=>({...n,status:"failed",error:"The previous chat job is no longer available — please ask again."}));return}if(!r.ok||!r.body){let t=await r.text().catch(()=>"");a(a=>({...a,status:"failed",error:`GET /api/chat/${e}/stream failed (HTTP ${r.status}): ${t}`}));return}let s=r.body.getReader(),i=new TextDecoder,l="";try{for(;;){let{value:e,done:r}=await s.read();if(r)break;if(t.aborted)return;l+=i.decode(e,{stream:!0});let{events:n,rest:o}=function(e){let t;let a=[],r=e;for(;-1!==(t=r.indexOf("\n\n"));){let e=function(e){let t="message",a=[];for(let r of e.split("\n"))r.startsWith("event:")?t=r.slice(6).replace(/^ /,""):r.startsWith("data:")&&a.push(r.slice(5).replace(/^ /,""));return 0===a.length&&"message"===t?null:{type:t,data:a.join("\n")}}(r.slice(0,t));r=r.slice(t+2),null!==e&&a.push(e)}return{events:a,rest:r}}(l);for(let e of(l=o,n)){if(t.aborted)return;"message"===e.type?a(t=>({...t,assistantContent:function(e,t){return e?`${e}
|
|
22
|
-
${t}`:t}(t.assistantContent,e.data)})):"stale_session"===e.type?a(e=>({...e,staleSession:!0})):"error"===e.type&&a(t=>({...t,error:e.data||"stream error"}))}}}catch(e){if(t.aborted)return;a(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Stream read error"}));return}t.aborted||a(e=>({...e,status:e.error?"failed":"done"}))}});function d({children:e}){return r.jsx(l,{children:e})}function c(){return o()}},17861:(e,t,a)=>{"use strict";a.d(t,{ChatStateProvider:()=>i,R:()=>l});var r=a(10326),s=a(17577);let n=(0,s.createContext)(null);function i({children:e}){let[t,a]=(0,s.useState)([]),[i,l]=(0,s.useState)(!1),o=(0,s.useCallback)(e=>{a(t=>{var a;return(a="function"==typeof e?e(t):e).length<=50?a:a.slice(a.length-50)})},[]),d=(0,s.useCallback)(()=>{a([])},[]),c=(0,s.useMemo)(()=>({messages:t,setMessages:o,reset:d,hydrated:i}),[t,o,d,i]);return r.jsx(n.Provider,{value:c,children:e})}function l(){let e=(0,s.useContext)(n);if(!e)throw Error("useChatState must be used inside <ChatStateProvider>");return e}},45377:(e,t,a)=>{"use strict";a.d(t,{U:()=>n});var r=a(10326),s=a(17577);function n(e){let{storageKey:t,initialState:a,getJobId:n,isInFlight:i,isPersistable:l,isUnresumable:o=e=>i(e)&&null===n(e),serializeForStorage:d=e=>e,start:c,watch:u}=e,h=(0,s.createContext)(null);return{Provider:function({children:e}){let[t,l]=(0,s.useState)(a),[o,d]=(0,s.useState)(!1);n(t);let u=i(t),m=(0,s.useCallback)(async e=>{await c(e,{setState:e=>{l(e)}})},[]),x=(0,s.useCallback)(()=>{l(a)},[]),p=(0,s.useMemo)(()=>({...t,isBackgrounded:u,startJob:m,reset:x}),[t,u,m,x]);return r.jsx(h.Provider,{value:p,children:e})},useStore:function(){let e=(0,s.useContext)(h);if(!e)throw Error("useStore must be used inside the Provider returned by createJobStoreProvider");return e}}}},52640:(e,t,a)=>{"use strict";a.d(t,{CO:()=>o,C_:()=>d,JM:()=>x,MH:()=>u,Yb:()=>i,dH:()=>h});let r={py:"#3776AB",js:"#F7DF1E",jsx:"#61DAFB",ts:"#3178C6",tsx:"#3178C6",json:"#F7DF1E",md:"#42A5F5",markdown:"#42A5F5",html:"#E34C26",css:"#2965F1",scss:"#CC6699",yml:"#CB171E",yaml:"#CB171E",toml:"#9C4221",sh:"#4EAA25",bash:"#4EAA25",rs:"#DEA584",go:"#00ADD8",java:"#EA2D2E",rb:"#CC342D",php:"#777BB4",sql:"#4479A1",svg:"#FFB13B",png:"#A78BFA",jpg:"#A78BFA",jpeg:"#A78BFA",gif:"#A78BFA",webp:"#A78BFA",bmp:"#A78BFA",ico:"#A78BFA",pdf:"#EC4C47",txt:"#9CA3AF",env:"#ECD53F",lock:"#9CA3AF",log:"#8B95A5"};function s(e){let t=e.lastIndexOf(".");return -1===t?"":e.slice(t+1).toLowerCase()}function n(e){return/^\.env(\.|$)/i.test(e)}function i(e){return"log"===s(e)}let l=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","svg"]);function o(e){return l.has(s(e))}function d(e){return"pdf"===s(e)}let c=new Set(["zip","gz","tgz","bz2","xz","7z","rar","jar","xlsx","xls","docx","doc","pptx","ppt","woff","woff2","ttf","otf","eot","mp3","wav","flac","ogg","mp4","mov","avi","mkv","webm","so","dylib","dll","exe","bin","wasm","sqlite","db","pyc"]);function u(e){return o(e)||d(e)||c.has(s(e))}function h(e){return n(e)?r.env:r[s(e)]??"currentColor"}let m={py:"python",js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",html:"markup",css:"css",scss:"scss",yml:"yaml",yaml:"yaml",toml:"toml",sh:"bash",bash:"bash",rs:"rust",go:"go",java:"java",rb:"ruby",php:"php",sql:"sql"};function x(e){return n(e)?"ini":m[s(e)]??null}},31986:(e,t,a)=>{"use strict";async function r(){throw Error("This browser does not support the File System Access API")}async function s(e){let t=[];for await(let a of e.values())t.push({name:a.name,kind:a.kind,handle:a});return[...t].sort((e,t)=>e.kind!==t.kind?"directory"===e.kind?-1:1:e.name.localeCompare(t.name))}function n(e,t){if(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")||e.startsWith("#")||e.startsWith("/"))return null;let[a]=e.split("#");if(""===a)return null;let r=t.includes("/")?t.slice(0,t.lastIndexOf("/")):"",s=""===r?[]:r.split("/");for(let e of a.split("/"))if(""!==e&&"."!==e){if(".."===e){if(0===s.length)return null;s.pop();continue}s.push(e)}return s.join("/")}async function i(e,t){let a=await e.createWritable();await a.write(t),await a.close()}async function l(e){let t={};return await e.queryPermission?.(t)==="granted"||await e.requestPermission?.(t)==="granted"}a.d(t,{BI:()=>i,Mz:()=>r,SK:()=>l,X2:()=>s,X5:()=>n,ib:()=>d});let o="handles";async function d(e){var t,a;await (t="readwrite",a=t=>t.put(e,"rootHandle"),new Promise((e,t)=>{let a=indexedDB.open("workspace",1);a.onupgradeneeded=()=>a.result.createObjectStore(o),a.onsuccess=()=>e(a.result),a.onerror=()=>t(a.error)}).then(e=>new Promise((r,s)=>{let n=a(e.transaction(o,t).objectStore(o));n.onsuccess=()=>r(n.result),n.onerror=()=>s(n.error)})))}},38706:(e,t,a)=>{"use strict";function r(e,t,a,r=20){if(""===t.trim())return e.slice(0,r);let s=[];for(let r of e){let e=function(e,t){if(0===e.length)return 0;let a=e.toLowerCase(),r=t.toLowerCase(),s=0,n=0,i=!1;for(let e=0;e<r.length&&s<a.length;e++)r[e]===a[s]?(n+=i?3:1,(0===e||"/"===r[e-1])&&(n+=2),i=!0,s++):i=!1;return s===a.length?n:null}(t,a(r));null!==e&&s.push({item:r,score:e})}return s.sort((e,t)=>t.score-e.score),s.slice(0,r).map(e=>e.item)}a.d(t,{s:()=>r})},54640:(e,t,a)=>{"use strict";a.d(t,{L:()=>s});var r=a(17577);function s({storageKey:e,defaultWidth:t,minWidth:a,maxWidth:s,edge:n="right"}){let[i,l]=(0,r.useState)(t),o=(0,r.useCallback)(t=>{t.preventDefault();let r=t.clientX,o="left"===n?-1:1,d=e=>Math.min(s,Math.max(a,e)),c=new AbortController,{signal:u}=c,h=i,m=()=>{c.abort();try{localStorage.setItem(e,String(h))}catch{}};window.addEventListener("pointermove",e=>{l(h=d(i+o*(e.clientX-r)))},{signal:u}),window.addEventListener("pointerup",m,{signal:u}),window.addEventListener("pointercancel",m,{signal:u})},[i,e,a,s,n]);return{width:i,startResize:o}}},82701:(e,t,a)=>{"use strict";a.d(t,{JobStateProvider:()=>c,h:()=>u});var r=a(10326),s=a(45377);let n={jobId:null,status:"idle",dryRun:!1,startedAt:null,finishedAt:null,error:null,sessionExpired:!1},i=e=>"pending"===e||"running"===e,l=e=>"done"===e||"failed"===e,{Provider:o,useStore:d}=(0,s.U)({storageKey:"ai-agent:run-job:v1",initialState:n,getJobId:e=>e.jobId,isInFlight:e=>i(e.status),isPersistable:e=>!!e.jobId||!!e.error,serializeForStorage:e=>({...e,sessionExpired:!1}),start:async({dryRun:e},{setState:t})=>{t(()=>({...n,status:"pending",dryRun:e}));try{let a=await fetch(`/api/run${e?"?dry_run=true":""}`,{method:"POST",cache:"no-store"});if(401===a.status){t(()=>({...n,sessionExpired:!0}));return}if(!a.ok){let e=await a.text();t(t=>({...t,status:"failed",error:`POST /api/run failed (HTTP ${a.status}): ${e}`}));return}let r=await a.json();t(e=>({...e,jobId:r.job_id??null,status:r.status,startedAt:r.started_at??e.startedAt,finishedAt:r.finished_at??e.finishedAt,dryRun:r.dry_run??e.dryRun}))}catch(e){t(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}))}},watch:async(e,{signal:t,setState:a})=>{let r=Date.now();for(;!t.aborted;){if(await new Promise(e=>setTimeout(e,2e3)),t.aborted)return;if(Date.now()-r>6e5){a(e=>({...e,status:"failed",error:"Timed out waiting for the job to finish"}));return}try{let r=await fetch(`/api/run/${e}`,{cache:"no-store",signal:t});if(t.aborted)return;if(401===r.status){a(e=>({...e,sessionExpired:!0}));return}if(404===r.status){a(()=>({...n,error:"The previous background job is no longer available — please run it again."}));return}if(!r.ok){a(t=>({...t,status:"failed",error:`GET /api/run/${e} failed (HTTP ${r.status})`}));return}let s=await r.json();if(t.aborted||(a(e=>({...e,status:s.status,startedAt:s.started_at??e.startedAt,finishedAt:s.finished_at??e.finishedAt,dryRun:s.dry_run??e.dryRun,error:"failed"===s.status?s.error??"Job failed without an error message":e.error})),l(s.status)))return}catch(e){if(t.aborted)return;a(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}));return}}}});function c({children:e}){return r.jsx(o,{children:e})}function u(){return d()}},36298:(e,t,a)=>{"use strict";a.d(t,{JournalChatJobStateProvider:()=>o,R:()=>d});var r=a(10326),s=a(17577);let n={jobId:null,status:"idle",question:"",targetEntryId:null,imagePath:null,assistantContent:"",error:null},i=e=>"pending"===e||"running"===e,l=(0,s.createContext)(null);function o({children:e}){let[t,a]=(0,s.useState)(n),[o,d]=(0,s.useState)(!1),c=(0,s.useRef)(!1);t.jobId,i(t.status);let u=(0,s.useCallback)(async e=>{let t;c.current=!1,a(()=>({...n,status:"pending",question:e.question,targetEntryId:e.targetEntryId,imagePath:e.imagePath??null}));try{t=await fetch("/api/journal/chat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({question:e.question,...e.imagePath?{image_path:e.imagePath}:{}})})}catch(e){a(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}));return}if(!t.ok){let e=await t.text().catch(()=>""),r=404===t.status?"No journal entries yet — record something first.":`Brainstorm failed (HTTP ${t.status}): ${e}`;a(e=>({...e,status:"failed",error:r}));return}let r=await t.json();if(!r.job_id){a(e=>({...e,status:"failed",error:"POST /api/journal/chat returned no job_id"}));return}if(c.current){fetch(`/api/chat/${r.job_id}`,{method:"DELETE",cache:"no-store"}),c.current=!1,a(()=>n);return}a(e=>"pending"===e.status?{...e,jobId:r.job_id??null,status:"running"}:e)},[]),h=(0,s.useCallback)(()=>{t.jobId?(fetch(`/api/chat/${t.jobId}`,{method:"DELETE",cache:"no-store"}),a(n)):c.current=!0},[t.jobId]),m=(0,s.useCallback)(()=>{a(n)},[]),x=(0,s.useCallback)(e=>{a(t=>({...t,status:"failed",error:e}))},[]),p=(0,s.useMemo)(()=>({...t,startJob:u,cancelJob:h,reset:m,setError:x}),[t,u,h,m,x]);return r.jsx(l.Provider,{value:p,children:e})}function d(){let e=(0,s.useContext)(l);if(!e)throw Error("useJournalChatJobState must be used inside <JournalChatJobStateProvider>");return e}},12711:(e,t,a)=>{"use strict";a.d(t,{JournalChatStateProvider:()=>i,l:()=>l});var r=a(10326),s=a(17577);let n=(0,s.createContext)(null);function i({children:e}){let[t,a]=(0,s.useState)([]),[i,l]=(0,s.useState)(null),[o,d]=(0,s.useState)(!1),c=(0,s.useCallback)(e=>{a(t=>{var a;return(a=[...t,e]).length<=50?a:a.slice(a.length-50)})},[]),u=(0,s.useCallback)(e=>{l(e)},[]),h=(0,s.useCallback)(()=>{a([]),l(null)},[]),m=(0,s.useMemo)(()=>({turns:t,entryId:i,addTurn:c,setEntryId:u,reset:h}),[t,i,c,u,h]);return r.jsx(n.Provider,{value:m,children:e})}function l(){let e=(0,s.useContext)(n);if(!e)throw Error("useJournalChatState must be used inside <JournalChatStateProvider>");return e}},2632:(e,t,a)=>{"use strict";a.d(t,{JournalNavProvider:()=>d,O:()=>c});var r=a(10326),s=a(35047),n=a(17577),i=a(36298),l=a(12711);let o=(0,n.createContext)(null);function d({children:e}){let[t,a]=(0,n.useState)([]),[d,c]=(0,n.useState)(null),[u,h]=(0,n.useState)([]),[m,x]=(0,n.useState)(!1),[p,f]=(0,n.useState)(null),[g,b]=(0,n.useState)(!1),[y,v]=(0,n.useState)(""),j=(0,n.useRef)(0),[w,N]=(0,n.useState)(null),[k,S]=(0,n.useState)(""),C=(0,n.useRef)(0),P=(0,l.l)();(0,i.R)();let $=(0,s.usePathname)();"/journal"===$||$?.startsWith("/journal/");let E=(0,n.useRef)(0),T=(0,n.useCallback)(async()=>{try{c(null);let e=await fetch("/api/journal",{cache:"no-store"});if(!e.ok){c(`Failed to load entries (HTTP ${e.status})`);return}let t=await e.json();return a(t.entries),t.entries}catch(e){c(`Failed to load entries: ${String(e)}`)}},[]),_=(0,n.useCallback)(async e=>{let t;let a=++j.current;f(e),b(!1),x(!1),N(null),E.current+=1,P.reset(),P.setEntryId(e),v("");try{t=await fetch(`/api/journal/${e}`,{cache:"no-store"})}catch{return}if(a!==j.current||!t.ok)return;let r=await t.json();a===j.current&&v(r.content)},[P]),A=(0,n.useCallback)(async e=>{let t;let a=++C.current;N(e),S("");try{t=await fetch(`/api/journal/trash/${e}`,{cache:"no-store"})}catch{return}if(a!==C.current||!t.ok)return;let r=await t.json();a===C.current&&S(r.content)},[]),I=(0,n.useCallback)(async()=>{try{c(null);let e=await fetch("/api/journal/trash",{cache:"no-store"});if(!e.ok){c(`Failed to load trash (HTTP ${e.status})`);return}let t=await e.json();h(t.entries)}catch(e){c(`Failed to load trash: ${String(e)}`)}},[]),O=(0,n.useCallback)(()=>{f(null),b(!1),N(null),P.setEntryId(null)},[P]),D=(0,n.useCallback)(()=>{f(null),N(null),x(!1),E.current+=1,P.reset(),b(!0)},[P]),R=(0,n.useCallback)(async e=>{try{let t=await fetch(`/api/journal/${e}`,{method:"DELETE"});if(!t.ok){c(`Delete failed (HTTP ${t.status})`);return}f(t=>t===e?null:t),await T()}catch(e){c(`Delete failed: ${String(e)}`)}},[T]),M=(0,n.useCallback)(async e=>{try{let t=await fetch(`/api/journal/${e}/restore`,{method:"POST"});if(!t.ok){c(`Restore failed (HTTP ${t.status})`);return}N(t=>t===e?null:t),await Promise.all([T(),I()])}catch(e){c(`Restore failed: ${String(e)}`)}},[T,I]),J=(0,n.useCallback)(async e=>{try{let t=await fetch(`/api/journal/${e}?purge=true`,{method:"DELETE"});if(!t.ok){c(`Permanent delete failed (HTTP ${t.status})`);return}N(t=>t===e?null:t),await I()}catch(e){c(`Permanent delete failed: ${String(e)}`)}},[I]),F=(0,n.useCallback)(()=>{let e=!m;x(e),f(null),b(!1),N(null),E.current+=1,P.reset(),e&&I()},[m,I,P]),z=(0,n.useMemo)(()=>[...t].sort((e,t)=>t.id.localeCompare(e.id)),[t]),H=z.find(e=>e.id===p),L=u.find(e=>e.id===w),B=null!==p||g||null!==w,U=(0,n.useMemo)(()=>({entries:t,sortedEntries:z,entriesError:d,trash:u,showTrash:m,selected:p,composing:g,trashPreview:w,content:y,trashContent:k,panelOpen:B,selectedMeta:H,trashMeta:L,viewEpoch:E,loadDates:T,loadEntry:_,loadTrashEntry:A,loadTrash:I,deleteEntry:R,restoreEntry:M,purgeEntry:J,toggleTrash:F,startCompose:D,closePanel:O}),[t,z,d,u,m,p,g,w,y,k,B,H,L,T,_,A,I,R,M,J,F,D,O]);return r.jsx(o.Provider,{value:U,children:e})}function c(){let e=(0,n.useContext)(o);if(!e)throw Error("useJournalNav must be used inside <JournalNavProvider>");return e}},29766:(e,t,a)=>{"use strict";a.d(t,{ML:()=>l});let r="**You:**",s="**AI:**",n=[r,s].map(e=>[e,e.replaceAll("*","\\*")]);function i(e){return e.map(e=>{let t=n.find(([,t])=>e.trim()===t);return t?e.replace(t[1],t[0]):e}).join("\n")}function l(e){let t=e.split("\n"),a=t.flatMap((e,t)=>e.trim()===r?[t]:[]);return 0===a.length?null:{preamble:t.slice(0,a[0]).join("\n").trim(),turns:a.map((e,r)=>{let n=r+1<a.length?a[r+1]:t.length,l=t.slice(e+1,n),o=l.findIndex(e=>e.trim()===s),d=i(-1===o?l:l.slice(0,o)),c=-1===o?"":i(l.slice(o+1));return{question:d.trim(),answer:c.trim().replace(/\n*-{3,}$/,"").trim()}})}}},7854:(e,t,a)=>{"use strict";a.d(t,{A:()=>h,I:()=>m});var r=a(30360),s=a(33341),n=a(71045),i=a(80533),l=a(47981),o=a(97418),d=a(73990),c=a(21468),u=a(12687);let h=[{id:"briefing",label:"Briefing",icon:r.Z,defaultHref:"/portfolio",items:[{href:"/portfolio",label:"Portfolio",icon:s.Z},{href:"/watch-sectors",label:"Watch Sectors",icon:n.Z},{href:"/geopolitical",label:"Geopolitical Risks",icon:i.Z},{href:"/run",label:"Run",icon:l.Z},{href:"/chat",label:"Q&A Chat",icon:o.Z},{href:"/briefing",label:"Briefing",icon:r.Z}]},{id:"journal",label:"Journal",icon:d.Z,defaultHref:"/journal",items:[{href:"/journal",label:"Journal",icon:d.Z}]},{id:"monitor",label:"Monitor",icon:c.Z,defaultHref:"/monitor",items:[{href:"/monitor",label:"Monitor",icon:c.Z}]},{id:"workspace",label:"Workspace",icon:u.Z,defaultHref:"/workspace",items:[{href:"/workspace",label:"Workspace",icon:u.Z}]}];function m(e){for(let t of h)for(let a of t.items)if(e===a.href||e.startsWith(a.href+"/"))return t;return h[0]}},44547:(e,t,a)=>{"use strict";a.d(t,{Iy:()=>o,K0:()=>r,N8:()=>s,is:()=>i,kv:()=>d,oS:()=>n,od:()=>l});let r="ai-agent:sidebar-collapsed",s="data-sidebar-collapsed",n="ai-agent:sidebar-width",i="--sidebar-width",l=180,o=480,d=240},40708:(e,t,a)=>{"use strict";a.d(t,{Fh:()=>n,k4:()=>l,nY:()=>s,yU:()=>r,zE:()=>i});let r=["light","dark"],s=["default","soft"],n="ai-agent:theme",i="ai-agent:background";function l(e){return"default"===e||"soft"===e}},81828:(e,t,a)=>{"use strict";a.d(t,{CZ:()=>v,DI:()=>w,Ep:()=>i,Gt:()=>h,IE:()=>s,Ou:()=>x,S:()=>u,TE:()=>d,fW:()=>p,gT:()=>c,he:()=>P,iS:()=>C,jP:()=>j,tB:()=>o,t_:()=>m,vM:()=>k,xY:()=>l});var r=a(77863);let s={"7d":"Last 7 days","30d":"Last 30 days",all:"All time"},n={"7d":7,"30d":30,all:null};function i(e,t,a){let s=n[t];if(null===s)return e;let i=new Date(`${a}T00:00:00`);i.setDate(i.getDate()-(s-1));let l=(0,r._)(i);return e.filter(e=>e.date>=l&&e.date<=a)}function l(e){return e.reduce((e,t)=>({days:e.days+1,calls:e.calls+t.calls,cost_usd:e.cost_usd+t.cost_usd,tokens:e.tokens+t.input_tokens+t.output_tokens+t.cache_read_tokens+t.cache_creation_tokens}),{days:0,calls:0,cost_usd:0,tokens:0})}let o={cost_usd:"Cost (USD)",input_tokens:"Input tokens",output_tokens:"Output tokens",cache_read_tokens:"Cache read tokens",cache_creation_tokens:"Cache creation tokens",duration_ms:"Duration (ms)",all:"All tokens (stacked)"},d=[{key:"input_tokens",label:"Input",className:"bg-gradient-to-t from-blue-700 to-blue-600",swatchClassName:"bg-blue-700"},{key:"output_tokens",label:"Output",className:"bg-gradient-to-t from-blue-600 to-blue-500",swatchClassName:"bg-blue-600"},{key:"cache_read_tokens",label:"Cache read",className:"bg-gradient-to-t from-blue-500 to-blue-400",swatchClassName:"bg-blue-500"},{key:"cache_creation_tokens",label:"Cache creation",className:"bg-gradient-to-t from-blue-400 to-blue-300",swatchClassName:"bg-blue-400"}];function c(e){return d.reduce((t,a)=>t+(e[a.key]??0),0)}function u(e,t){return e[t]??0}function h(e,t){let a=e[t];return"number"==typeof a?a:0}function m(e,t=7){if(!(e>0)||!Number.isFinite(e))return{niceMax:1,step:1,ticks:[0,1]};let a=e/t,r=10**Math.floor(Math.log10(a)),s=a/r,n=(s<=1?1:s<=2?2:s<=5?5:10)*r,i=Math.ceil(e/n)*n,l=[],o=Math.round(i/n);for(let e=0;e<=o;e++)l.push(Number((n*e).toPrecision(12)));return{niceMax:i,step:n,ticks:l}}let x={timestamp:"Timestamp",label:"Label",cost_usd:"Cost (USD)",input_tokens:"Input tokens",output_tokens:"Output tokens",cache_read_tokens:"Cache read tokens",cache_creation_tokens:"Cache creation tokens",duration_ms:"Duration"},p=Object.keys(x),f=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:4}),g=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}),b=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:4}),y=new Intl.NumberFormat("en-US");function v(e){return y.format(e)}function j(e,t){return"cost_usd"===e?(.1>Math.abs(t)?b:g).format(t):"duration_ms"===e?`${(t/1e3).toFixed(1)}s`:y.format(Number(t.toFixed(4)))}function w(e,t){if(e<=0||t<=0)return[];if(e<=t)return Array.from({length:e},(e,t)=>t);if(1===t)return[0];let a=Math.ceil((e-1)/(t-1)),r=[];for(let t=0;t<e-1;t+=a)r.push(t);return r.push(e-1),r}let N=/T(\d{2}):(\d{2})/;function k(e){let t=N.exec(e);return t?`${t[1]}:${t[2]}`:e}let S=/^(\d{4})-(\d{2})-(\d{2})$/;function C(e){let t=S.exec(e);return t?`${t[2]}/${t[3]}`:e}function P(e,t){return null==t?"—":"cost_usd"===e&&"number"==typeof t?f.format(t):"duration_ms"===e&&"number"==typeof t?`${(t/1e3).toFixed(1)}s`:"number"==typeof t?y.format(t):String(t)}},77863:(e,t,a)=>{"use strict";a.d(t,{E:()=>i,_:()=>l,cn:()=>n});var r=a(41135),s=a(31009);function n(...e){return(0,s.m6)((0,r.W)(e))}function i(e){let t=e.replace(/[\\/]+$/,"").split(/[\\/]/);return t[t.length-1]||e}function l(e=new Date){let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${a}-${r}`}},41210:(e,t,a)=>{"use strict";a.d(t,{WorkspaceStateProvider:()=>l,w:()=>o});var r=a(10326),s=a(17577),n=a(31986);let i=(0,s.createContext)(null);function l({children:e}){let[t,a]=(0,s.useState)(null),[l,o]=(0,s.useState)(!1),[d,c]=(0,s.useState)(null),[u,h]=(0,s.useState)([]),[m,x]=(0,s.useState)(!1),p=async()=>{let e=await (0,n.Mz)();if(await (0,n.SK)(e)){try{await (0,n.ib)(e)}catch{}a(e),o(!1),c(null)}},f=(0,s.useMemo)(()=>({root:t,rootName:t?.name??null,needsReopen:l,openFolder:p,selected:d,selectFile:c,fileIndex:u,indexing:m}),[t,l,d,u,m]);return r.jsx(i.Provider,{value:f,children:e})}function o(){let e=(0,s.useContext)(i);if(null===e)throw Error("useWorkspaceState must be used within a WorkspaceStateProvider");return e}},17593:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>y,dynamic:()=>b});var r=a(19510),s=a(58585),n=a(10687),i=a(68570);let l=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/Sidebar.tsx#Sidebar`),o=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ServiceTabs.tsx#ServiceTabs`),d=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/journal/JournalChatBridge.tsx#JournalChatBridge`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatJobStore.tsx#CHAT_JOB_STORAGE_KEY`);let c=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatJobStore.tsx#ChatJobStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatJobStore.tsx#useChatJobState`);let u=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatStore.tsx#ChatStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatStore.tsx#useChatState`);let h=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/jobStore.tsx#JobStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/jobStore.tsx#useJobState`),(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatJobStore.tsx#JOURNAL_CHAT_JOB_STORAGE_KEY`);let m=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatJobStore.tsx#JournalChatJobStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatJobStore.tsx#useJournalChatJobState`),(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatStore.tsx#JOURNAL_CHAT_HISTORY_STORAGE_KEY`);let x=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatStore.tsx#JournalChatStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatStore.tsx#useJournalChatState`);let p=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalNavStore.tsx#JournalNavProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalNavStore.tsx#useJournalNav`);let f=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/workspaceStore.tsx#WorkspaceStateProvider`);async function g(){try{let e=await (0,n.S)("/api/state");if(!e.ok)return!1;return!!(await e.json()).onboarded}catch{return!1}}(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/workspaceStore.tsx#useWorkspaceState`);let b="force-dynamic";async function y({children:e}){return await g()||(0,s.redirect)("/"),r.jsx(h,{children:r.jsx(u,{children:r.jsx(c,{children:r.jsx(x,{children:r.jsx(m,{children:r.jsx(p,{children:(0,r.jsxs)(f,{children:[r.jsx(d,{}),(0,r.jsxs)("div",{className:"flex h-dvh overflow-hidden",children:[r.jsx(l,{}),(0,r.jsxs)("main",{className:"flex flex-1 flex-col overflow-hidden",children:[r.jsx(o,{}),r.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:e})]})]})]})})})})})})})}},28869:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>h,metadata:()=>u});var r=a(19510),s=a(68215),n=a.n(s),i=a(20623),l=a.n(i),o=a(68570);let d=(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#ThemeProvider`);(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#useTheme`);let c=(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#themeBootScript`);(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#isBackground`),(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#isTheme`),a(67272);let u={title:"ai-agent",description:"Daily briefing & Q&A web UI"};function h({children:e}){return(0,r.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,children:[r.jsx("head",{children:r.jsx("script",{dangerouslySetInnerHTML:{__html:c}})}),r.jsx("body",{className:`${n().variable} ${l().variable} antialiased`,children:r.jsx(d,{children:e})})]})}},10687:(e,t,a)=>{"use strict";a.d(t,{S:()=>l});var r=a(87561),s=a(49411);let n=process.env.API_BASE??"http://127.0.0.1:8000",i=process.env.AI_AGENT_TOKEN_PATH??(0,s.join)(process.cwd(),".token");async function l(e,t={}){let a=new Headers(t.headers);return a.set("Authorization",`Bearer ${(0,r.readFileSync)(i,"utf8").trim()}`),fetch(`${n}${e}`,{...t,cache:"no-store",headers:a})}},24697:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>s});var r=a(66621);let s=e=>[{type:"image/svg+xml",sizes:"any",url:(0,r.fillMetadataSegment)(".",e.params,"icon.svg")+"?8b6de60c40220b8a"}]},67272:()=>{}};
|
|
21
|
+
`},48768:(e,t,a)=>{"use strict";a.d(t,{Qq:()=>i,Tw:()=>l,XH:()=>o,h0:()=>d,jG:()=>n});var r=a(10326);function s({size:e=14,children:t}){return r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t})}function n(e){return(0,r.jsxs)(s,{...e,children:[r.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),r.jsx("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),r.jsx("path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}),r.jsx("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]})}function i(e){return(0,r.jsxs)(s,{...e,children:[r.jsx("path",{d:"M15 3h6v6"}),r.jsx("path",{d:"M9 21H3v-6"}),r.jsx("path",{d:"M21 3l-7 7"}),r.jsx("path",{d:"M3 21l7-7"})]})}function l(e){return(0,r.jsxs)(s,{...e,children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function o({size:e=14}){return(0,r.jsxs)(s,{size:e,children:[r.jsx("polyline",{points:"3 6 5 6 21 6"}),r.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),r.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),r.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function d({size:e=12}){return(0,r.jsxs)(s,{size:e,children:[r.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),r.jsx("polyline",{points:"15 3 21 3 21 9"}),r.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}},84739:(e,t,a)=>{"use strict";a.d(t,{JournalChatBridge:()=>l});var r=a(17577);a(29766);var s=a(36298),n=a(12711),i=a(2632);function l(){let e=(0,s.R)(),t=(0,n.l)(),{loadDates:a}=(0,i.O)();(0,r.useRef)(new Set);let{status:l,jobId:o,question:d,assistantContent:c,targetEntryId:u,setError:h,reset:m}=e,{addTurn:x,setEntryId:p}=t;return null}},94397:(e,t,a)=>{"use strict";a.d(t,{AuthModeForm:()=>u});var r=a(10326),s=a(90434),n=a(35047),i=a(17577),l=a(90772),o=a(33071),d=a(18660);let c=[{value:"cli",label:"Claude Pro / Max subscription (CLI)",hint:"Uses the OAuth session from `claude login`. No API key billing."},{value:"api",label:"Anthropic API key",hint:"Pay-per-use via ANTHROPIC_API_KEY (stored in the keychain)."}];function u({initialAuthMode:e,anthropicKeySet:t}){let a=(0,n.useRouter)(),[u,h]=(0,i.useState)(e),[m,x]=(0,i.useState)("idle"),[p,f]=(0,i.useState)(null),g="api"===u&&!t,b=async()=>{if(g){f("Set ANTHROPIC_API_KEY in Credentials before switching to API mode."),x("error");return}x("saving"),f(null);let e=await fetch("/api/auth/mode",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({auth_mode:u})});if(!e.ok){f(`PUT /api/auth/mode failed (HTTP ${e.status})`),x("error");return}x("saved"),a.refresh()};return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("fieldset",{className:"space-y-3","data-testid":"auth-options",children:[r.jsx("legend",{className:"sr-only",children:"Authentication mode"}),c.map(e=>r.jsx(o.Zb,{children:r.jsx(o.aY,{className:"pt-6",children:(0,r.jsxs)("label",{className:"flex cursor-pointer items-start gap-3",children:[r.jsx("input",{type:"radio",name:"auth-mode",value:e.value,checked:u===e.value,onChange:()=>h(e.value),className:"mt-1","data-testid":`auth-radio-${e.value}`}),(0,r.jsxs)("span",{className:"flex flex-col",children:[r.jsx("span",{className:"font-medium",children:e.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e.hint})]})]})})},e.value))]}),g&&(0,r.jsxs)("p",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive","data-testid":"api-blocked",children:["API mode requires ",r.jsx("code",{className:"font-mono",children:"ANTHROPIC_API_KEY"})," ","in the keychain. Open"," ",r.jsx(s.default,{href:"/credentials",className:"underline underline-offset-2",children:"Credentials"})," ","to set it, then come back."]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[r.jsx(l.z,{onClick:()=>void b(),disabled:"saving"===m||u===e,"data-testid":"auth-save",children:"Save"}),r.jsx(d.Q,{status:m})]}),p&&r.jsx("p",{className:"text-sm text-destructive","data-testid":"generic-error",children:p})]})}},23492:(e,t,a)=>{"use strict";a.d(t,{CredentialsForm:()=>h});var r=a(10326),s=a(35047),n=a(17577),i=a(567),l=a(90772),o=a(33071),d=a(62288),c=a(54432);let u=[{name:"DISCORD_TOKEN",label:"Discord bot token",secret:!0},{name:"CHANNEL_ID",label:"Discord channel id",secret:!1},{name:"NOTION_API_KEY",label:"Notion integration key",secret:!0},{name:"NOTION_DATABASE_ID",label:"Notion database id",secret:!1},{name:"NOTION_DATABASE_ID_JOURNAL",label:"Notion journal database id",secret:!1},{name:"ANTHROPIC_API_KEY",label:"Anthropic API key",secret:!0}];function h({initial:e}){let t=(0,s.useRouter)(),[a,h]=(0,n.useState)(e),[m,x]=(0,n.useState)(null),[p,f]=(0,n.useState)(""),[g,b]=(0,n.useState)(null),[y,v]=(0,n.useState)(null),j=e=>{x(e),f(""),v(null)},w=()=>{x(null),f("")},N=async()=>{if(!m)return;let e=p.trim();if(""===e){v("Value is required");return}b(m.name),v(null);let a=await fetch(`/api/credentials/${encodeURIComponent(m.name)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:e})});if(b(null),!a.ok){v(`PUT failed (HTTP ${a.status})`);return}h(e=>({...e,[m.name]:!0})),w(),t.refresh()},k=async e=>{b(e),v(null);let a=await fetch(`/api/credentials/${encodeURIComponent(e)}`,{method:"DELETE"});if(b(null),!a.ok){v(`DELETE failed (HTTP ${a.status})`);return}h(t=>({...t,[e]:!1})),t.refresh()};return(0,r.jsxs)("div",{className:"space-y-3",children:[u.map(e=>{let t=!!a[e.name];return r.jsx(o.Zb,{children:(0,r.jsxs)(o.aY,{className:"flex items-center justify-between gap-4 pt-6",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[r.jsx("p",{className:"font-medium",children:e.label}),r.jsx("p",{className:"text-xs font-mono text-muted-foreground",children:e.name})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[r.jsx(i.C,{variant:t?"default":"secondary","data-testid":`status-${e.name}`,children:t?"Set":"Not set"}),r.jsx(l.z,{variant:"outline",size:"sm",onClick:()=>j(e),disabled:g===e.name,"data-testid":`update-${e.name}`,children:t?"Update":"Set"}),r.jsx(l.z,{variant:"ghost",size:"sm",onClick:()=>void k(e.name),disabled:!t||g===e.name,"data-testid":`delete-${e.name}`,children:"Delete"})]})]})},e.name)}),r.jsx(d.Vq,{open:null!==m,onOpenChange:e=>{e||w()},children:r.jsx(d.cZ,{children:m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(d.fK,{children:[(0,r.jsxs)(d.$N,{children:[a[m.name]?"Update":"Set"," ",m.label]}),(0,r.jsxs)(d.Be,{children:["Stored in the OS keychain under",r.jsx("code",{className:"ml-1 font-mono",children:m.name}),"."]})]}),r.jsx(c.I,{autoFocus:!0,type:m.secret?"password":"text",value:p,onChange:e=>f(e.target.value),placeholder:m.secret?"••••••••••":"Paste the value",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),N())},"data-testid":"credential-draft"}),y&&r.jsx("p",{className:"text-sm text-destructive","data-testid":"credential-error",children:y}),(0,r.jsxs)(d.cN,{children:[r.jsx(l.z,{variant:"ghost",onClick:w,children:"Cancel"}),r.jsx(l.z,{onClick:()=>void N(),disabled:g===m.name,"data-testid":"credential-save",children:"Save"})]})]})})}),y&&!m&&r.jsx("p",{className:"text-sm text-destructive","data-testid":"generic-error",children:y})]})}},5266:(e,t,a)=>{"use strict";a.d(t,{UsageDashboard:()=>c});var r=a(10326),s=a(17577),n=a(81828),i=a(77863);function l({records:e,metric:t,activeIndex:a=null,onActiveChange:l}){let o=(0,s.useRef)([]);if(0===e.length)return r.jsx("p",{"data-testid":"usage-chart-empty",className:"text-sm text-muted-foreground",children:"No usage records for this date."});let d="all"===t,c=e.map(e=>d?(0,n.gT)(e):(0,n.S)(e,t)),{niceMax:u,ticks:h}=(0,n.t_)(Math.max(...c,1)),m=new Set((0,n.DI)(e.length,12)),x=t=>{let a=Math.max(0,Math.min(e.length-1,t));o.current[a]?.focus()},p=e=>{let t=e.relatedTarget;t&&e.currentTarget.parentElement?.contains(t)||l?.(null)},f=(e,t)=>{"ArrowRight"===t.key?(t.preventDefault(),x(e+1)):"ArrowLeft"===t.key&&(t.preventDefault(),x(e-1))};return(0,r.jsxs)("div",{"data-testid":"usage-bar-chart",role:"group","aria-label":"Usage bar chart",className:"flex pt-6",children:[r.jsx("div",{"aria-hidden":!0,className:"relative shrink-0",style:{height:240,width:48},children:h.map(e=>r.jsx("span",{"data-testid":`usage-y-tick-${e}`,className:"absolute right-2 -translate-y-1/2 text-[11px] tabular-nums text-muted-foreground",style:{bottom:`${e/u*100}%`},children:(0,n.jP)(t,e)},e))}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{"data-testid":"usage-plot-area",className:"relative w-full border-b border-l border-border",style:{height:240},onMouseLeave:()=>l?.(null),children:[h.map(e=>0===e?null:r.jsx("div",{"data-testid":`usage-gridline-${e}`,"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 border-t border-muted-foreground/60",style:{bottom:`${e/u*100}%`}},e)),r.jsx("div",{className:"absolute inset-0 flex items-end gap-1",children:e.map((e,s)=>{let h=c[s],m=h/u*100,x=a===s;return r.jsx("button",{ref:e=>{o.current[s]=e},type:"button","data-testid":`usage-bar-${s}`,"data-active":x,"aria-label":`${e.label} ${(0,n.vM)(e.timestamp)}: ${(0,n.jP)(t,h)}`,title:e.label,className:"flex h-full flex-1 flex-col justify-end",onMouseEnter:()=>l?.(s),onFocus:()=>l?.(s),onBlur:p,onKeyDown:e=>f(s,e),children:d?r.jsx("span",{"data-testid":`usage-bar-fill-${s}`,className:(0,i.cn)("flex w-full flex-col-reverse overflow-hidden rounded-t transition-all",x?"brightness-110":"brightness-100"),style:{height:`${m}%`},children:n.TE.map(t=>{let a=e[t.key]??0,n=h||1;return r.jsx("span",{"data-testid":`usage-bar-segment-${s}-${t.key}`,className:(0,i.cn)("w-full",t.className),style:{height:`${a/n*100}%`}},t.key)})}):r.jsx("span",{"data-testid":`usage-bar-fill-${s}`,className:(0,i.cn)("w-full rounded-t bg-gradient-to-t transition-colors",x?"from-blue-700 to-blue-400":"from-blue-600 to-blue-300 hover:from-blue-700 hover:to-blue-400"),style:{height:`${m}%`}})},`${e.timestamp}-${s}`)})})]}),r.jsx("div",{className:"flex gap-1","aria-hidden":!0,children:e.map((e,t)=>r.jsx("span",{"data-testid":m.has(t)?`usage-bar-x-label-${t}`:void 0,className:"min-w-0 flex-1 truncate pt-1 text-center text-[11px] tabular-nums text-muted-foreground",children:m.has(t)?(0,n.vM)(e.timestamp):""},`${e.timestamp}-label-${t}`))})]}),d&&r.jsx("ul",{"data-testid":"usage-stack-legend",className:"ml-2 flex shrink-0 flex-col justify-start gap-1 self-center text-xs text-muted-foreground",children:n.TE.map(e=>(0,r.jsxs)("li",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:(0,i.cn)("h-2.5 w-2.5 rounded-sm",e.swatchClassName),"aria-hidden":!0}),e.label]},e.key))})]})}function o({summary:e,metric:t}){let a=(0,s.useId)(),[i,l]=(0,s.useState)(null);if(0===e.length)return r.jsx("p",{"data-testid":"usage-trend-empty",className:"text-sm text-muted-foreground",children:"No daily summary available yet."});let o=e.map(e=>(0,n.Gt)(e,t)),{niceMax:d,ticks:c}=(0,n.t_)(Math.max(...o,1)),u=e.length,h=e=>1===u?50:8+e/(u-1)*84,m=e=>(1-e/d)*100,x=o.map((t,a)=>({x:h(a),y:m(t),v:t,day:e[a].date})),p=x.map((e,t)=>`${0===t?"M":"L"} ${e.x} ${e.y}`).join(" "),f=new Set((0,n.DI)(u,8));return(0,r.jsxs)("div",{"data-testid":"usage-trend-chart",role:"group","aria-label":"Usage daily trend chart",className:"pt-6",children:[(0,r.jsxs)("div",{className:"flex",children:[r.jsx("div",{"aria-hidden":!0,className:"relative shrink-0",style:{height:200,width:48},children:c.map(e=>r.jsx("span",{className:"absolute right-2 -translate-y-1/2 text-[11px] tabular-nums text-muted-foreground",style:{bottom:`${e/d*100}%`},children:(0,n.jP)(t,e)},e))}),(0,r.jsxs)("div",{"data-testid":"usage-trend-plot",className:"relative flex-1 border-b border-l border-border",style:{height:200},children:[c.map(e=>0===e?null:r.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 border-t border-muted-foreground/60",style:{bottom:`${e/d*100}%`}},e)),(0,r.jsxs)("svg",{className:"absolute inset-0 h-full w-full overflow-visible",viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":!0,children:[r.jsx("defs",{children:(0,r.jsxs)("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"0%",stopColor:"rgb(37 99 235)",stopOpacity:"0.3"}),r.jsx("stop",{offset:"100%",stopColor:"rgb(37 99 235)",stopOpacity:"0"})]})}),u>1&&r.jsx("path",{d:`${p} L ${x[u-1].x} 100 L ${x[0].x} 100 Z`,fill:`url(#${a})`,stroke:"none"}),u>1&&r.jsx("path",{"data-testid":"usage-trend-line",d:p,fill:"none",stroke:"rgb(37 99 235)",strokeWidth:1.5,vectorEffect:"non-scaling-stroke"})]}),i&&r.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-10 -translate-x-1/2 -translate-y-full rounded bg-foreground px-2 py-1 text-[11px] tabular-nums text-background shadow",style:{left:`${i.x}%`,top:`${i.y}%`,marginTop:"-6px"},children:i.label}),x.map((e,a)=>{let s=`${e.day}: ${(0,n.jP)(t,e.v)}`;return r.jsx("span",{"data-testid":`usage-trend-point-${a}`,role:"img","aria-label":s,tabIndex:0,className:"absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 cursor-pointer rounded-full bg-blue-600 outline-none ring-offset-0 focus-visible:ring-2 focus-visible:ring-blue-400",style:{left:`${e.x}%`,top:`${e.y}%`},onMouseEnter:()=>l({x:e.x,y:e.y,label:s}),onMouseLeave:()=>l(null),onFocus:()=>l({x:e.x,y:e.y,label:s}),onBlur:()=>l(null)},e.day)})]})]}),(0,r.jsxs)("div",{className:"flex","aria-hidden":!0,children:[r.jsx("div",{className:"shrink-0",style:{width:48}}),r.jsx("div",{className:"relative h-5 flex-1",children:x.map((e,t)=>f.has(t)?r.jsx("span",{"data-testid":`usage-trend-x-label-${t}`,className:"absolute top-1 -translate-x-1/2 whitespace-nowrap text-[11px] tabular-nums text-muted-foreground",style:{left:`${e.x}%`},children:(0,n.iS)(e.day)},e.day):null)})]})]})}let d=["cost_usd","input_tokens","output_tokens","cache_read_tokens","cache_creation_tokens","duration_ms","all"];function c(){let[e,t]=(0,s.useState)(null),[a,c]=(0,s.useState)(null),[u,h]=(0,s.useState)([]),[m,x]=(0,s.useState)("cost_usd"),[p,f]=(0,s.useState)("7d"),[g,b]=(0,s.useState)([]),[y,v]=(0,s.useState)(null),[j,w]=(0,s.useState)(null),[N,k]=(0,s.useState)(!1),S=(0,s.useRef)(null);if((0,s.useCallback)(e=>{k(!0),w(null),v(null),S.current=e,fetch(`/api/usage?date=${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{S.current===e&&h(t.records)}).catch(t=>{S.current===e&&w(String(t))}).finally(()=>{S.current===e&&k(!1)})},[]),j)return(0,r.jsxs)("p",{"data-testid":"usage-error",className:"text-sm text-destructive",children:["Failed to load usage data: ",j]});if(null===e)return r.jsx("p",{"data-testid":"usage-dates-loading",className:"text-sm text-muted-foreground",children:"Loading usage dates…"});if(0===e.length)return r.jsx("p",{"data-testid":"usage-no-dates",className:"text-sm text-muted-foreground",children:"No usage logs found."});let C=(0,n.Ep)(g,p,(0,i._)()),P=(0,n.xY)(C),$=null!==y?u[y]:null;return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:["Date",r.jsx("select",{"data-testid":"usage-date-select",value:a??"",onChange:e=>c(e.target.value),className:"rounded-md border bg-background px-2 py-1 text-sm",children:e.map(e=>r.jsx("option",{value:e,children:e},e))})]}),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:["Metric",r.jsx("select",{"data-testid":"usage-metric-select",value:m,onChange:e=>x(e.target.value),className:"rounded-md border bg-background px-2 py-1 text-sm",children:d.map(e=>r.jsx("option",{value:e,children:n.tB[e]},e))})]})]}),(0,r.jsxs)("section",{className:"space-y-1",children:[(0,r.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground",children:["Per run (",a,") — ",n.tB[m]]}),N?r.jsx("p",{"data-testid":"usage-loading",className:"text-sm text-muted-foreground",children:"Loading…"}):r.jsx(l,{records:u,metric:m,activeIndex:y,onActiveChange:v})]}),(0,r.jsxs)("section",{className:"space-y-3 rounded-md border p-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:["Range",r.jsx("select",{"data-testid":"usage-range-select",value:p,onChange:e=>f(e.target.value),className:"rounded-md border bg-background px-2 py-1 text-sm",children:Object.keys(n.IE).map(e=>r.jsx("option",{value:e,children:n.IE[e]},e))})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Applies to the totals and trend below — the per-run chart above follows Date."})]}),r.jsx("dl",{"data-testid":"usage-range-totals",className:"grid grid-cols-2 gap-x-4 gap-y-1 text-sm sm:grid-cols-4",children:[["Total cost",(0,n.jP)("cost_usd",P.cost_usd)],["Total tokens",(0,n.CZ)(P.tokens)],["Calls",(0,n.CZ)(P.calls)],["Days logged",(0,n.CZ)(P.days)]].map(([e,t])=>(0,r.jsxs)("div",{className:"flex justify-between gap-2",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsx("dd",{className:"font-medium tabular-nums",children:t})]},e))}),0===C.length?r.jsx("p",{"data-testid":"usage-range-empty",className:"text-sm text-muted-foreground",children:"No days in this range."}):"all"!==m?(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground",children:["Daily trend (",n.IE[p],") — ",n.tB[m]]}),r.jsx(o,{summary:C,metric:m})]}):null]}),r.jsx("div",{className:"min-h-[7rem]","aria-live":"polite",role:"status",children:$?r.jsx("dl",{"data-testid":"usage-detail",className:"grid grid-cols-2 gap-x-4 gap-y-1 rounded-md border p-3 text-sm sm:grid-cols-3",children:n.fW.map(e=>(0,r.jsxs)("div",{className:"flex justify-between gap-2",children:[r.jsx("dt",{className:"text-muted-foreground",children:n.Ou[e]}),r.jsx("dd",{className:"font-medium",children:(0,n.he)(e,$[e])})]},e))}):r.jsx("p",{"data-testid":"usage-detail-hint",className:"text-sm text-muted-foreground",children:"Hover or focus a bar to see its details."})})]})}},567:(e,t,a)=>{"use strict";a.d(t,{C:()=>l});var r=a(10326);a(17577);var s=a(79360),n=a(77863);let i=(0,s.j)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function l({className:e,variant:t,...a}){return r.jsx("div",{className:(0,n.cn)(i({variant:t}),e),...a})}},90772:(e,t,a)=>{"use strict";a.d(t,{z:()=>d});var r=a(10326),s=a(17577),n=a(34214),i=a(79360),l=a(77863);let o=(0,i.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),d=s.forwardRef(({className:e,variant:t,size:a,asChild:s=!1,...i},d)=>{let c=s?n.g7:"button";return r.jsx(c,{className:(0,l.cn)(o({variant:t,size:a,className:e})),ref:d,...i})});d.displayName="Button"},33071:(e,t,a)=>{"use strict";a.d(t,{Ol:()=>l,SZ:()=>d,Zb:()=>i,aY:()=>c,eW:()=>u,ll:()=>o});var r=a(10326),s=a(17577),n=a(77863);let i=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("rounded-xl border bg-card text-card-foreground shadow",e),...t}));i.displayName="Card";let l=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",e),...t}));l.displayName="CardHeader";let o=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("font-semibold leading-none tracking-tight",e),...t}));o.displayName="CardTitle";let d=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("text-sm text-muted-foreground",e),...t}));d.displayName="CardDescription";let c=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("p-6 pt-0",e),...t}));c.displayName="CardContent";let u=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{ref:a,className:(0,n.cn)("flex items-center p-6 pt-0",e),...t}));u.displayName="CardFooter"},62288:(e,t,a)=>{"use strict";a.d(t,{$N:()=>p,Be:()=>f,Vq:()=>o,cN:()=>x,cZ:()=>h,fK:()=>m,hg:()=>d});var r=a(10326),s=a(17577),n=a(84813),i=a(80380),l=a(77863);let o=n.fC,d=n.xz,c=n.h_;n.x8;let u=s.forwardRef(({className:e,...t},a)=>r.jsx(n.aV,{ref:a,className:(0,l.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));u.displayName=n.aV.displayName;let h=s.forwardRef(({className:e,children:t,...a},s)=>(0,r.jsxs)(c,{children:[r.jsx(u,{}),(0,r.jsxs)(n.VY,{ref:s,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a,children:[t,(0,r.jsxs)(n.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsx(i.Z,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));h.displayName=n.VY.displayName;let m=({className:e,...t})=>r.jsx("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});m.displayName="DialogHeader";let x=({className:e,...t})=>r.jsx("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});x.displayName="DialogFooter";let p=s.forwardRef(({className:e,...t},a)=>r.jsx(n.Dx,{ref:a,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",e),...t}));p.displayName=n.Dx.displayName;let f=s.forwardRef(({className:e,...t},a)=>r.jsx(n.dk,{ref:a,className:(0,l.cn)("text-sm text-muted-foreground",e),...t}));f.displayName=n.dk.displayName},54432:(e,t,a)=>{"use strict";a.d(t,{I:()=>i});var r=a(10326),s=a(17577),n=a(77863);let i=s.forwardRef(({className:e,type:t,...a},s)=>r.jsx("input",{type:t,className:(0,n.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...a}));i.displayName="Input"},25947:(e,t,a)=>{"use strict";a.d(t,{DV:()=>l,RO:()=>n,W1:()=>c,aA:()=>i,nf:()=>d,o_:()=>o});var r=a(10326);let s={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"};function n({className:e}){return r.jsx("svg",{...s,className:e,"aria-hidden":!0,children:r.jsx("path",{d:"M1.75 4.25c0-.55.45-1 1-1h3l1.5 1.5h5c.55 0 1 .45 1 1v5.5c0 .55-.45 1-1 1H2.75c-.55 0-1-.45-1-1v-6z"})})}function i({className:e,color:t}){return(0,r.jsxs)("svg",{...s,stroke:t??s.stroke,className:e,"aria-hidden":!0,children:[r.jsx("path",{d:"M4 1.75h5l3 3v9.5c0 .14-.11.25-.25.25H4a.25.25 0 0 1-.25-.25V2A.25.25 0 0 1 4 1.75z"}),r.jsx("path",{d:"M9 1.75v3h3"})]})}function l({className:e,open:t}){return r.jsx("svg",{...s,className:e,style:{transform:t?"rotate(90deg)":void 0},"aria-hidden":!0,children:r.jsx("path",{d:"M6 4l4 4-4 4"})})}function o({className:e}){return(0,r.jsxs)("svg",{...s,className:e,"aria-hidden":!0,children:[r.jsx("path",{d:"M4 5.5l4 3 4-3"}),r.jsx("path",{d:"M4 9.5l4 3 4-3"})]})}function d({className:e}){return(0,r.jsxs)("svg",{...s,className:e,"aria-hidden":!0,children:[r.jsx("path",{d:"M4 10.5l4-3 4 3"}),r.jsx("path",{d:"M4 6.5l4-3 4 3"})]})}function c({className:e}){return(0,r.jsxs)("svg",{...s,className:e,"aria-hidden":!0,children:[r.jsx("circle",{cx:"6.75",cy:"6.75",r:"4"}),r.jsx("path",{d:"M9.75 9.75L13.25 13.25"})]})}},13074:(e,t,a)=>{"use strict";a.d(t,{ChatJobStateProvider:()=>d,w:()=>c});var r=a(10326),s=a(45377);let n={jobId:null,status:"idle",question:"",date:"",searchHistory:!1,imagePaths:[],assistantContent:"",error:null,sessionExpired:!1,staleSession:!1},i=e=>"pending"===e||"running"===e,{Provider:l,useStore:o}=(0,s.U)({storageKey:"ai-agent:chat-job:v1",initialState:n,getJobId:e=>e.jobId,isInFlight:e=>i(e.status),isPersistable:e=>!!e.jobId&&i(e.status),serializeForStorage:e=>({...e,assistantContent:"",sessionExpired:!1,staleSession:!1}),start:async({question:e,date:t,image_paths:a,search_history:r},{setState:s})=>{s(()=>({...n,status:"pending",question:e,date:t,searchHistory:!!r,imagePaths:a??[]}));try{let i=await fetch("/api/chat",{method:"POST",cache:"no-store",headers:{"content-type":"application/json"},body:JSON.stringify({date:t,question:e,...a?.length?{image_paths:a}:{},...r?{search_history:!0}:{}})});if(401===i.status){s(()=>({...n,sessionExpired:!0}));return}if(!i.ok){let e=await i.text().catch(()=>"");s(t=>({...t,status:"failed",error:`POST /api/chat failed (HTTP ${i.status}): ${e}`}));return}let l=await i.json();if(!l.job_id){s(e=>({...e,status:"failed",error:"POST /api/chat returned no job_id"}));return}s(e=>({...e,jobId:l.job_id??null,status:"running"}))}catch(e){s(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}))}},watch:async(e,{signal:t,setState:a})=>{let r;a(e=>({...e,assistantContent:""}));try{r=await fetch(`/api/chat/${e}/stream`,{method:"GET",cache:"no-store",signal:t})}catch(e){if(t.aborted)return;a(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}));return}if(t.aborted)return;if(401===r.status){a(e=>({...e,sessionExpired:!0,status:"failed"}));return}if(404===r.status){a(()=>({...n,status:"failed",error:"The previous chat job is no longer available — please ask again."}));return}if(!r.ok||!r.body){let t=await r.text().catch(()=>"");a(a=>({...a,status:"failed",error:`GET /api/chat/${e}/stream failed (HTTP ${r.status}): ${t}`}));return}let s=r.body.getReader(),i=new TextDecoder,l="";try{for(;;){let{value:e,done:r}=await s.read();if(r)break;if(t.aborted)return;l+=i.decode(e,{stream:!0});let{events:n,rest:o}=function(e){let t;let a=[],r=e;for(;-1!==(t=r.indexOf("\n\n"));){let e=function(e){let t="message",a=[];for(let r of e.split("\n"))r.startsWith("event:")?t=r.slice(6).replace(/^ /,""):r.startsWith("data:")&&a.push(r.slice(5).replace(/^ /,""));return 0===a.length&&"message"===t?null:{type:t,data:a.join("\n")}}(r.slice(0,t));r=r.slice(t+2),null!==e&&a.push(e)}return{events:a,rest:r}}(l);for(let e of(l=o,n)){if(t.aborted)return;"message"===e.type?a(t=>({...t,assistantContent:function(e,t){return e?`${e}
|
|
22
|
+
${t}`:t}(t.assistantContent,e.data)})):"stale_session"===e.type?a(e=>({...e,staleSession:!0})):"error"===e.type&&a(t=>({...t,error:e.data||"stream error"}))}}}catch(e){if(t.aborted)return;a(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Stream read error"}));return}t.aborted||a(e=>({...e,status:e.error?"failed":"done"}))}});function d({children:e}){return r.jsx(l,{children:e})}function c(){return o()}},17861:(e,t,a)=>{"use strict";a.d(t,{ChatStateProvider:()=>i,R:()=>l});var r=a(10326),s=a(17577);let n=(0,s.createContext)(null);function i({children:e}){let[t,a]=(0,s.useState)([]),[i,l]=(0,s.useState)(!1),o=(0,s.useCallback)(e=>{a(t=>{var a;return(a="function"==typeof e?e(t):e).length<=50?a:a.slice(a.length-50)})},[]),d=(0,s.useCallback)(()=>{a([])},[]),c=(0,s.useMemo)(()=>({messages:t,setMessages:o,reset:d,hydrated:i}),[t,o,d,i]);return r.jsx(n.Provider,{value:c,children:e})}function l(){let e=(0,s.useContext)(n);if(!e)throw Error("useChatState must be used inside <ChatStateProvider>");return e}},45377:(e,t,a)=>{"use strict";a.d(t,{U:()=>n});var r=a(10326),s=a(17577);function n(e){let{storageKey:t,initialState:a,getJobId:n,isInFlight:i,isPersistable:l,isUnresumable:o=e=>i(e)&&null===n(e),serializeForStorage:d=e=>e,start:c,watch:u}=e,h=(0,s.createContext)(null);return{Provider:function({children:e}){let[t,l]=(0,s.useState)(a),[o,d]=(0,s.useState)(!1);n(t);let u=i(t),m=(0,s.useCallback)(async e=>{await c(e,{setState:e=>{l(e)}})},[]),x=(0,s.useCallback)(()=>{l(a)},[]),p=(0,s.useMemo)(()=>({...t,isBackgrounded:u,startJob:m,reset:x}),[t,u,m,x]);return r.jsx(h.Provider,{value:p,children:e})},useStore:function(){let e=(0,s.useContext)(h);if(!e)throw Error("useStore must be used inside the Provider returned by createJobStoreProvider");return e}}}},52640:(e,t,a)=>{"use strict";a.d(t,{CO:()=>o,C_:()=>d,JM:()=>x,MH:()=>u,Yb:()=>i,dH:()=>h});let r={py:"#3776AB",js:"#F7DF1E",jsx:"#61DAFB",ts:"#3178C6",tsx:"#3178C6",json:"#F7DF1E",md:"#42A5F5",markdown:"#42A5F5",html:"#E34C26",css:"#2965F1",scss:"#CC6699",yml:"#CB171E",yaml:"#CB171E",toml:"#9C4221",sh:"#4EAA25",bash:"#4EAA25",rs:"#DEA584",go:"#00ADD8",java:"#EA2D2E",rb:"#CC342D",php:"#777BB4",sql:"#4479A1",svg:"#FFB13B",png:"#A78BFA",jpg:"#A78BFA",jpeg:"#A78BFA",gif:"#A78BFA",webp:"#A78BFA",bmp:"#A78BFA",ico:"#A78BFA",pdf:"#EC4C47",txt:"#9CA3AF",env:"#ECD53F",lock:"#9CA3AF",log:"#8B95A5"};function s(e){let t=e.lastIndexOf(".");return -1===t?"":e.slice(t+1).toLowerCase()}function n(e){return/^\.env(\.|$)/i.test(e)}function i(e){return"log"===s(e)}let l=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","svg"]);function o(e){return l.has(s(e))}function d(e){return"pdf"===s(e)}let c=new Set(["zip","gz","tgz","bz2","xz","7z","rar","jar","xlsx","xls","docx","doc","pptx","ppt","woff","woff2","ttf","otf","eot","mp3","wav","flac","ogg","mp4","mov","avi","mkv","webm","so","dylib","dll","exe","bin","wasm","sqlite","db","pyc"]);function u(e){return o(e)||d(e)||c.has(s(e))}function h(e){return n(e)?r.env:r[s(e)]??"currentColor"}let m={py:"python",js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",html:"markup",css:"css",scss:"scss",yml:"yaml",yaml:"yaml",toml:"toml",sh:"bash",bash:"bash",rs:"rust",go:"go",java:"java",rb:"ruby",php:"php",sql:"sql"};function x(e){return n(e)?"ini":m[s(e)]??null}},31986:(e,t,a)=>{"use strict";async function r(){throw Error("This browser does not support the File System Access API")}async function s(e){let t=[];for await(let a of e.values())t.push({name:a.name,kind:a.kind,handle:a});return[...t].sort((e,t)=>e.kind!==t.kind?"directory"===e.kind?-1:1:e.name.localeCompare(t.name))}function n(e,t){if(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")||e.startsWith("#")||e.startsWith("/"))return null;let[a]=e.split("#");if(""===a)return null;let r=t.includes("/")?t.slice(0,t.lastIndexOf("/")):"",s=""===r?[]:r.split("/");for(let e of a.split("/"))if(""!==e&&"."!==e){if(".."===e){if(0===s.length)return null;s.pop();continue}s.push(e)}return s.join("/")}async function i(e,t){let a=await e.createWritable();await a.write(t),await a.close()}async function l(e){let t={};return await e.queryPermission?.(t)==="granted"||await e.requestPermission?.(t)==="granted"}a.d(t,{BI:()=>i,Mz:()=>r,SK:()=>l,X2:()=>s,X5:()=>n,ib:()=>d});let o="handles";async function d(e){var t,a;await (t="readwrite",a=t=>t.put(e,"rootHandle"),new Promise((e,t)=>{let a=indexedDB.open("workspace",1);a.onupgradeneeded=()=>a.result.createObjectStore(o),a.onsuccess=()=>e(a.result),a.onerror=()=>t(a.error)}).then(e=>new Promise((r,s)=>{let n=a(e.transaction(o,t).objectStore(o));n.onsuccess=()=>r(n.result),n.onerror=()=>s(n.error)})))}},38706:(e,t,a)=>{"use strict";function r(e,t,a,r=20){if(""===t.trim())return e.slice(0,r);let s=[];for(let r of e){let e=function(e,t){if(0===e.length)return 0;let a=e.toLowerCase(),r=t.toLowerCase(),s=0,n=0,i=!1;for(let e=0;e<r.length&&s<a.length;e++)r[e]===a[s]?(n+=i?3:1,(0===e||"/"===r[e-1])&&(n+=2),i=!0,s++):i=!1;return s===a.length?n:null}(t,a(r));null!==e&&s.push({item:r,score:e})}return s.sort((e,t)=>t.score-e.score),s.slice(0,r).map(e=>e.item)}a.d(t,{s:()=>r})},54640:(e,t,a)=>{"use strict";a.d(t,{L:()=>s});var r=a(17577);function s({storageKey:e,defaultWidth:t,minWidth:a,maxWidth:s,edge:n="right"}){let[i,l]=(0,r.useState)(t),o=(0,r.useCallback)(t=>{t.preventDefault();let r=t.clientX,o="left"===n?-1:1,d=e=>Math.min(s,Math.max(a,e)),c=new AbortController,{signal:u}=c,h=i,m=()=>{c.abort();try{localStorage.setItem(e,String(h))}catch{}};window.addEventListener("pointermove",e=>{l(h=d(i+o*(e.clientX-r)))},{signal:u}),window.addEventListener("pointerup",m,{signal:u}),window.addEventListener("pointercancel",m,{signal:u})},[i,e,a,s,n]);return{width:i,startResize:o}}},82701:(e,t,a)=>{"use strict";a.d(t,{JobStateProvider:()=>c,h:()=>u});var r=a(10326),s=a(45377);let n={jobId:null,status:"idle",dryRun:!1,startedAt:null,finishedAt:null,error:null,sessionExpired:!1},i=e=>"pending"===e||"running"===e,l=e=>"done"===e||"failed"===e,{Provider:o,useStore:d}=(0,s.U)({storageKey:"ai-agent:run-job:v1",initialState:n,getJobId:e=>e.jobId,isInFlight:e=>i(e.status),isPersistable:e=>!!e.jobId||!!e.error,serializeForStorage:e=>({...e,sessionExpired:!1}),start:async({dryRun:e},{setState:t})=>{t(()=>({...n,status:"pending",dryRun:e}));try{let a=await fetch(`/api/run${e?"?dry_run=true":""}`,{method:"POST",cache:"no-store"});if(401===a.status){t(()=>({...n,sessionExpired:!0}));return}if(!a.ok){let e=await a.text();t(t=>({...t,status:"failed",error:`POST /api/run failed (HTTP ${a.status}): ${e}`}));return}let r=await a.json();t(e=>({...e,jobId:r.job_id??null,status:r.status,startedAt:r.started_at??e.startedAt,finishedAt:r.finished_at??e.finishedAt,dryRun:r.dry_run??e.dryRun}))}catch(e){t(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}))}},watch:async(e,{signal:t,setState:a})=>{let r=Date.now();for(;!t.aborted;){if(await new Promise(e=>setTimeout(e,2e3)),t.aborted)return;if(Date.now()-r>6e5){a(e=>({...e,status:"failed",error:"Timed out waiting for the job to finish"}));return}try{let r=await fetch(`/api/run/${e}`,{cache:"no-store",signal:t});if(t.aborted)return;if(401===r.status){a(e=>({...e,sessionExpired:!0}));return}if(404===r.status){a(()=>({...n,error:"The previous background job is no longer available — please run it again."}));return}if(!r.ok){a(t=>({...t,status:"failed",error:`GET /api/run/${e} failed (HTTP ${r.status})`}));return}let s=await r.json();if(t.aborted||(a(e=>({...e,status:s.status,startedAt:s.started_at??e.startedAt,finishedAt:s.finished_at??e.finishedAt,dryRun:s.dry_run??e.dryRun,error:"failed"===s.status?s.error??"Job failed without an error message":e.error})),l(s.status)))return}catch(e){if(t.aborted)return;a(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}));return}}}});function c({children:e}){return r.jsx(o,{children:e})}function u(){return d()}},36298:(e,t,a)=>{"use strict";a.d(t,{JournalChatJobStateProvider:()=>o,R:()=>d});var r=a(10326),s=a(17577);let n={jobId:null,status:"idle",question:"",targetEntryId:null,imagePaths:[],assistantContent:"",error:null},i=e=>"pending"===e||"running"===e,l=(0,s.createContext)(null);function o({children:e}){let[t,a]=(0,s.useState)(n),[o,d]=(0,s.useState)(!1),c=(0,s.useRef)(!1);t.jobId,i(t.status);let u=(0,s.useCallback)(async e=>{let t;c.current=!1,a(()=>({...n,status:"pending",question:e.question,targetEntryId:e.targetEntryId,imagePaths:e.imagePaths??[]}));try{t=await fetch("/api/journal/chat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({question:e.question,...e.imagePaths?.length?{image_paths:e.imagePaths}:{}})})}catch(e){a(t=>({...t,status:"failed",error:e instanceof Error?e.message:"Network error"}));return}if(!t.ok){let e=await t.text().catch(()=>""),r=404===t.status?"No journal entries yet — record something first.":`Brainstorm failed (HTTP ${t.status}): ${e}`;a(e=>({...e,status:"failed",error:r}));return}let r=await t.json();if(!r.job_id){a(e=>({...e,status:"failed",error:"POST /api/journal/chat returned no job_id"}));return}if(c.current){fetch(`/api/chat/${r.job_id}`,{method:"DELETE",cache:"no-store"}),c.current=!1,a(()=>n);return}a(e=>"pending"===e.status?{...e,jobId:r.job_id??null,status:"running"}:e)},[]),h=(0,s.useCallback)(()=>{t.jobId?(fetch(`/api/chat/${t.jobId}`,{method:"DELETE",cache:"no-store"}),a(n)):c.current=!0},[t.jobId]),m=(0,s.useCallback)(()=>{a(n)},[]),x=(0,s.useCallback)(e=>{a(t=>({...t,status:"failed",error:e}))},[]),p=(0,s.useMemo)(()=>({...t,startJob:u,cancelJob:h,reset:m,setError:x}),[t,u,h,m,x]);return r.jsx(l.Provider,{value:p,children:e})}function d(){let e=(0,s.useContext)(l);if(!e)throw Error("useJournalChatJobState must be used inside <JournalChatJobStateProvider>");return e}},12711:(e,t,a)=>{"use strict";a.d(t,{JournalChatStateProvider:()=>i,l:()=>l});var r=a(10326),s=a(17577);let n=(0,s.createContext)(null);function i({children:e}){let[t,a]=(0,s.useState)([]),[i,l]=(0,s.useState)(null),[o,d]=(0,s.useState)(!1),c=(0,s.useCallback)(e=>{a(t=>{var a;return(a=[...t,e]).length<=50?a:a.slice(a.length-50)})},[]),u=(0,s.useCallback)(e=>{l(e)},[]),h=(0,s.useCallback)(()=>{a([]),l(null)},[]),m=(0,s.useMemo)(()=>({turns:t,entryId:i,addTurn:c,setEntryId:u,reset:h}),[t,i,c,u,h]);return r.jsx(n.Provider,{value:m,children:e})}function l(){let e=(0,s.useContext)(n);if(!e)throw Error("useJournalChatState must be used inside <JournalChatStateProvider>");return e}},2632:(e,t,a)=>{"use strict";a.d(t,{JournalNavProvider:()=>d,O:()=>c});var r=a(10326),s=a(35047),n=a(17577),i=a(36298),l=a(12711);let o=(0,n.createContext)(null);function d({children:e}){let[t,a]=(0,n.useState)([]),[d,c]=(0,n.useState)(null),[u,h]=(0,n.useState)([]),[m,x]=(0,n.useState)(!1),[p,f]=(0,n.useState)(null),[g,b]=(0,n.useState)(!1),[y,v]=(0,n.useState)(""),j=(0,n.useRef)(0),[w,N]=(0,n.useState)(null),[k,S]=(0,n.useState)(""),C=(0,n.useRef)(0),P=(0,l.l)();(0,i.R)();let $=(0,s.usePathname)();"/journal"===$||$?.startsWith("/journal/");let E=(0,n.useRef)(0),T=(0,n.useCallback)(async()=>{try{c(null);let e=await fetch("/api/journal",{cache:"no-store"});if(!e.ok){c(`Failed to load entries (HTTP ${e.status})`);return}let t=await e.json();return a(t.entries),t.entries}catch(e){c(`Failed to load entries: ${String(e)}`)}},[]),_=(0,n.useCallback)(async e=>{let t;let a=++j.current;f(e),b(!1),x(!1),N(null),E.current+=1,P.reset(),P.setEntryId(e),v("");try{t=await fetch(`/api/journal/${e}`,{cache:"no-store"})}catch{return}if(a!==j.current||!t.ok)return;let r=await t.json();a===j.current&&v(r.content)},[P]),A=(0,n.useCallback)(async e=>{let t;let a=++C.current;N(e),S("");try{t=await fetch(`/api/journal/trash/${e}`,{cache:"no-store"})}catch{return}if(a!==C.current||!t.ok)return;let r=await t.json();a===C.current&&S(r.content)},[]),I=(0,n.useCallback)(async()=>{try{c(null);let e=await fetch("/api/journal/trash",{cache:"no-store"});if(!e.ok){c(`Failed to load trash (HTTP ${e.status})`);return}let t=await e.json();h(t.entries)}catch(e){c(`Failed to load trash: ${String(e)}`)}},[]),O=(0,n.useCallback)(()=>{f(null),b(!1),N(null),P.setEntryId(null)},[P]),D=(0,n.useCallback)(()=>{f(null),N(null),x(!1),E.current+=1,P.reset(),b(!0)},[P]),R=(0,n.useCallback)(async e=>{try{let t=await fetch(`/api/journal/${e}`,{method:"DELETE"});if(!t.ok){c(`Delete failed (HTTP ${t.status})`);return}f(t=>t===e?null:t),await T()}catch(e){c(`Delete failed: ${String(e)}`)}},[T]),M=(0,n.useCallback)(async e=>{try{let t=await fetch(`/api/journal/${e}/restore`,{method:"POST"});if(!t.ok){c(`Restore failed (HTTP ${t.status})`);return}N(t=>t===e?null:t),await Promise.all([T(),I()])}catch(e){c(`Restore failed: ${String(e)}`)}},[T,I]),J=(0,n.useCallback)(async e=>{try{let t=await fetch(`/api/journal/${e}?purge=true`,{method:"DELETE"});if(!t.ok){c(`Permanent delete failed (HTTP ${t.status})`);return}N(t=>t===e?null:t),await I()}catch(e){c(`Permanent delete failed: ${String(e)}`)}},[I]),F=(0,n.useCallback)(()=>{let e=!m;x(e),f(null),b(!1),N(null),E.current+=1,P.reset(),e&&I()},[m,I,P]),z=(0,n.useMemo)(()=>[...t].sort((e,t)=>t.id.localeCompare(e.id)),[t]),H=z.find(e=>e.id===p),L=u.find(e=>e.id===w),B=null!==p||g||null!==w,U=(0,n.useMemo)(()=>({entries:t,sortedEntries:z,entriesError:d,trash:u,showTrash:m,selected:p,composing:g,trashPreview:w,content:y,trashContent:k,panelOpen:B,selectedMeta:H,trashMeta:L,viewEpoch:E,loadDates:T,loadEntry:_,loadTrashEntry:A,loadTrash:I,deleteEntry:R,restoreEntry:M,purgeEntry:J,toggleTrash:F,startCompose:D,closePanel:O}),[t,z,d,u,m,p,g,w,y,k,B,H,L,T,_,A,I,R,M,J,F,D,O]);return r.jsx(o.Provider,{value:U,children:e})}function c(){let e=(0,n.useContext)(o);if(!e)throw Error("useJournalNav must be used inside <JournalNavProvider>");return e}},29766:(e,t,a)=>{"use strict";a.d(t,{ML:()=>l});let r="**You:**",s="**AI:**",n=[r,s].map(e=>[e,e.replaceAll("*","\\*")]);function i(e){return e.map(e=>{let t=n.find(([,t])=>e.trim()===t);return t?e.replace(t[1],t[0]):e}).join("\n")}function l(e){let t=e.split("\n"),a=t.flatMap((e,t)=>e.trim()===r?[t]:[]);return 0===a.length?null:{preamble:t.slice(0,a[0]).join("\n").trim(),turns:a.map((e,r)=>{let n=r+1<a.length?a[r+1]:t.length,l=t.slice(e+1,n),o=l.findIndex(e=>e.trim()===s),d=i(-1===o?l:l.slice(0,o)),c=-1===o?"":i(l.slice(o+1));return{question:d.trim(),answer:c.trim().replace(/\n*-{3,}$/,"").trim()}})}}},7854:(e,t,a)=>{"use strict";a.d(t,{A:()=>h,I:()=>m});var r=a(30360),s=a(33341),n=a(71045),i=a(80533),l=a(47981),o=a(97418),d=a(73990),c=a(21468),u=a(12687);let h=[{id:"briefing",label:"Briefing",icon:r.Z,defaultHref:"/portfolio",items:[{href:"/portfolio",label:"Portfolio",icon:s.Z},{href:"/watch-sectors",label:"Watch Sectors",icon:n.Z},{href:"/geopolitical",label:"Geopolitical Risks",icon:i.Z},{href:"/run",label:"Run",icon:l.Z},{href:"/chat",label:"Q&A Chat",icon:o.Z},{href:"/briefing",label:"Briefing",icon:r.Z}]},{id:"journal",label:"Journal",icon:d.Z,defaultHref:"/journal",items:[{href:"/journal",label:"Journal",icon:d.Z}]},{id:"monitor",label:"Monitor",icon:c.Z,defaultHref:"/monitor",items:[{href:"/monitor",label:"Monitor",icon:c.Z}]},{id:"workspace",label:"Workspace",icon:u.Z,defaultHref:"/workspace",items:[{href:"/workspace",label:"Workspace",icon:u.Z}]}];function m(e){for(let t of h)for(let a of t.items)if(e===a.href||e.startsWith(a.href+"/"))return t;return h[0]}},44547:(e,t,a)=>{"use strict";a.d(t,{Iy:()=>o,K0:()=>r,N8:()=>s,is:()=>i,kv:()=>d,oS:()=>n,od:()=>l});let r="ai-agent:sidebar-collapsed",s="data-sidebar-collapsed",n="ai-agent:sidebar-width",i="--sidebar-width",l=180,o=480,d=240},40708:(e,t,a)=>{"use strict";a.d(t,{Fh:()=>n,k4:()=>l,nY:()=>s,yU:()=>r,zE:()=>i});let r=["light","dark"],s=["default","soft"],n="ai-agent:theme",i="ai-agent:background";function l(e){return"default"===e||"soft"===e}},81828:(e,t,a)=>{"use strict";a.d(t,{CZ:()=>v,DI:()=>w,Ep:()=>i,Gt:()=>h,IE:()=>s,Ou:()=>x,S:()=>u,TE:()=>d,fW:()=>p,gT:()=>c,he:()=>P,iS:()=>C,jP:()=>j,tB:()=>o,t_:()=>m,vM:()=>k,xY:()=>l});var r=a(77863);let s={"7d":"Last 7 days","30d":"Last 30 days",all:"All time"},n={"7d":7,"30d":30,all:null};function i(e,t,a){let s=n[t];if(null===s)return e;let i=new Date(`${a}T00:00:00`);i.setDate(i.getDate()-(s-1));let l=(0,r._)(i);return e.filter(e=>e.date>=l&&e.date<=a)}function l(e){return e.reduce((e,t)=>({days:e.days+1,calls:e.calls+t.calls,cost_usd:e.cost_usd+t.cost_usd,tokens:e.tokens+t.input_tokens+t.output_tokens+t.cache_read_tokens+t.cache_creation_tokens}),{days:0,calls:0,cost_usd:0,tokens:0})}let o={cost_usd:"Cost (USD)",input_tokens:"Input tokens",output_tokens:"Output tokens",cache_read_tokens:"Cache read tokens",cache_creation_tokens:"Cache creation tokens",duration_ms:"Duration (ms)",all:"All tokens (stacked)"},d=[{key:"input_tokens",label:"Input",className:"bg-gradient-to-t from-blue-700 to-blue-600",swatchClassName:"bg-blue-700"},{key:"output_tokens",label:"Output",className:"bg-gradient-to-t from-blue-600 to-blue-500",swatchClassName:"bg-blue-600"},{key:"cache_read_tokens",label:"Cache read",className:"bg-gradient-to-t from-blue-500 to-blue-400",swatchClassName:"bg-blue-500"},{key:"cache_creation_tokens",label:"Cache creation",className:"bg-gradient-to-t from-blue-400 to-blue-300",swatchClassName:"bg-blue-400"}];function c(e){return d.reduce((t,a)=>t+(e[a.key]??0),0)}function u(e,t){return e[t]??0}function h(e,t){let a=e[t];return"number"==typeof a?a:0}function m(e,t=7){if(!(e>0)||!Number.isFinite(e))return{niceMax:1,step:1,ticks:[0,1]};let a=e/t,r=10**Math.floor(Math.log10(a)),s=a/r,n=(s<=1?1:s<=2?2:s<=5?5:10)*r,i=Math.ceil(e/n)*n,l=[],o=Math.round(i/n);for(let e=0;e<=o;e++)l.push(Number((n*e).toPrecision(12)));return{niceMax:i,step:n,ticks:l}}let x={timestamp:"Timestamp",label:"Label",cost_usd:"Cost (USD)",input_tokens:"Input tokens",output_tokens:"Output tokens",cache_read_tokens:"Cache read tokens",cache_creation_tokens:"Cache creation tokens",duration_ms:"Duration"},p=Object.keys(x),f=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:4}),g=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}),b=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:4}),y=new Intl.NumberFormat("en-US");function v(e){return y.format(e)}function j(e,t){return"cost_usd"===e?(.1>Math.abs(t)?b:g).format(t):"duration_ms"===e?`${(t/1e3).toFixed(1)}s`:y.format(Number(t.toFixed(4)))}function w(e,t){if(e<=0||t<=0)return[];if(e<=t)return Array.from({length:e},(e,t)=>t);if(1===t)return[0];let a=Math.ceil((e-1)/(t-1)),r=[];for(let t=0;t<e-1;t+=a)r.push(t);return r.push(e-1),r}let N=/T(\d{2}):(\d{2})/;function k(e){let t=N.exec(e);return t?`${t[1]}:${t[2]}`:e}let S=/^(\d{4})-(\d{2})-(\d{2})$/;function C(e){let t=S.exec(e);return t?`${t[2]}/${t[3]}`:e}function P(e,t){return null==t?"—":"cost_usd"===e&&"number"==typeof t?f.format(t):"duration_ms"===e&&"number"==typeof t?`${(t/1e3).toFixed(1)}s`:"number"==typeof t?y.format(t):String(t)}},77863:(e,t,a)=>{"use strict";a.d(t,{E:()=>i,_:()=>l,cn:()=>n});var r=a(41135),s=a(31009);function n(...e){return(0,s.m6)((0,r.W)(e))}function i(e){let t=e.replace(/[\\/]+$/,"").split(/[\\/]/);return t[t.length-1]||e}function l(e=new Date){let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${a}-${r}`}},41210:(e,t,a)=>{"use strict";a.d(t,{WorkspaceStateProvider:()=>l,w:()=>o});var r=a(10326),s=a(17577),n=a(31986);let i=(0,s.createContext)(null);function l({children:e}){let[t,a]=(0,s.useState)(null),[l,o]=(0,s.useState)(!1),[d,c]=(0,s.useState)(null),[u,h]=(0,s.useState)([]),[m,x]=(0,s.useState)(!1),p=async()=>{let e=await (0,n.Mz)();if(await (0,n.SK)(e)){try{await (0,n.ib)(e)}catch{}a(e),o(!1),c(null)}},f=(0,s.useMemo)(()=>({root:t,rootName:t?.name??null,needsReopen:l,openFolder:p,selected:d,selectFile:c,fileIndex:u,indexing:m}),[t,l,d,u,m]);return r.jsx(i.Provider,{value:f,children:e})}function o(){let e=(0,s.useContext)(i);if(null===e)throw Error("useWorkspaceState must be used within a WorkspaceStateProvider");return e}},17593:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>y,dynamic:()=>b});var r=a(19510),s=a(58585),n=a(10687),i=a(68570);let l=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/Sidebar.tsx#Sidebar`),o=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ServiceTabs.tsx#ServiceTabs`),d=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/journal/JournalChatBridge.tsx#JournalChatBridge`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatJobStore.tsx#CHAT_JOB_STORAGE_KEY`);let c=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatJobStore.tsx#ChatJobStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatJobStore.tsx#useChatJobState`);let u=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatStore.tsx#ChatStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/chatStore.tsx#useChatState`);let h=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/jobStore.tsx#JobStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/jobStore.tsx#useJobState`),(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatJobStore.tsx#JOURNAL_CHAT_JOB_STORAGE_KEY`);let m=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatJobStore.tsx#JournalChatJobStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatJobStore.tsx#useJournalChatJobState`),(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatStore.tsx#JOURNAL_CHAT_HISTORY_STORAGE_KEY`);let x=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatStore.tsx#JournalChatStateProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalChatStore.tsx#useJournalChatState`);let p=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalNavStore.tsx#JournalNavProvider`);(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/journalNavStore.tsx#useJournalNav`);let f=(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/workspaceStore.tsx#WorkspaceStateProvider`);async function g(){try{let e=await (0,n.S)("/api/state");if(!e.ok)return!1;return!!(await e.json()).onboarded}catch{return!1}}(0,i.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/lib/workspaceStore.tsx#useWorkspaceState`);let b="force-dynamic";async function y({children:e}){return await g()||(0,s.redirect)("/"),r.jsx(h,{children:r.jsx(u,{children:r.jsx(c,{children:r.jsx(x,{children:r.jsx(m,{children:r.jsx(p,{children:(0,r.jsxs)(f,{children:[r.jsx(d,{}),(0,r.jsxs)("div",{className:"flex h-dvh overflow-hidden",children:[r.jsx(l,{}),(0,r.jsxs)("main",{className:"flex flex-1 flex-col overflow-hidden",children:[r.jsx(o,{}),r.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:e})]})]})]})})})})})})})}},28869:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>h,metadata:()=>u});var r=a(19510),s=a(68215),n=a.n(s),i=a(20623),l=a.n(i),o=a(68570);let d=(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#ThemeProvider`);(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#useTheme`);let c=(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#themeBootScript`);(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#isBackground`),(0,o.createProxy)(String.raw`/home/runner/work/ai-agent-cli/ai-agent-cli/apps/web/components/ThemeProvider.tsx#isTheme`),a(67272);let u={title:"ai-agent",description:"Daily briefing & Q&A web UI"};function h({children:e}){return(0,r.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,children:[r.jsx("head",{children:r.jsx("script",{dangerouslySetInnerHTML:{__html:c}})}),r.jsx("body",{className:`${n().variable} ${l().variable} antialiased`,children:r.jsx(d,{children:e})})]})}},10687:(e,t,a)=>{"use strict";a.d(t,{S:()=>l});var r=a(87561),s=a(49411);let n=process.env.API_BASE??"http://127.0.0.1:8000",i=process.env.AI_AGENT_TOKEN_PATH??(0,s.join)(process.cwd(),".token");async function l(e,t={}){let a=new Headers(t.headers);return a.set("Authorization",`Bearer ${(0,r.readFileSync)(i,"utf8").trim()}`),fetch(`${n}${e}`,{...t,cache:"no-store",headers:a})}},24697:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>s});var r=a(66621);let s=e=>[{type:"image/svg+xml",sizes:"any",url:(0,r.fillMetadataSegment)(".",e.params,"icon.svg")+"?8b6de60c40220b8a"}]},67272:()=>{}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.id=899,exports.ids=[899],exports.modules={60459:(e,t,a)=>{a.d(t,{W:()=>j});var n=a(10326),r=a(35315);let l=(0,r.Z)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),s=(0,r.Z)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),i=(0,r.Z)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);var c=a(17577),u=a(90772);async function o(e){let t=new FormData;t.append("file",e);let a=await fetch("/api/images/upload",{method:"POST",body:t}),n=await a.json();if(!a.ok||!n.url||!n.path)throw Error(n.error??"Upload failed, please try again");return{url:n.url,path:n.path}}async function d(e){let t=await Promise.allSettled(e.map(o)),a=[],n=null;for(let e of t)"fulfilled"===e.status?a.push(e.value):null===n&&(n=e.reason instanceof Error?e.reason.message:"Upload failed, please try again");return{attachments:a,error:n}}function h({onAttach:e,disabled:t,onUploadingChange:a}){let r=(0,c.useRef)(null),[l,s]=(0,c.useState)(null),[i,u]=(0,c.useState)(!1);async function o(t){let n=Array.from(t.target.files??[]);if(0===n.length)return;s(null),u(!0),a?.(!0);let{attachments:l,error:i}=await d(n);l.forEach(t=>e(t)),s(i),u(!1),a?.(!1),r.current&&(r.current.value="")}return(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[n.jsx("input",{ref:r,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",multiple:!0,className:"hidden",onChange:o}),n.jsx("button",{type:"button","aria-label":"Attach image",disabled:t||i,onClick:()=>r.current?.click(),className:"flex h-8 w-8 items-center justify-center rounded-md border bg-background text-sm font-medium hover:bg-accent disabled:opacity-50",children:i?"…":"+"}),l&&n.jsx("p",{className:"text-xs text-destructive",children:l})]})}var m=a(80380);function p({image:e,onRemove:t,index:a}){return(0,n.jsxs)("div",{className:"relative inline-block",children:[n.jsx("img",{src:e.url,alt:"Attached image","aria-label":"Attached image",className:"h-16 w-16 rounded-md border object-cover"}),n.jsx("button",{type:"button","aria-label":void 0===a?"Remove attached image":`Remove attached image ${a+1}`,onClick:t,className:"absolute -right-1 -top-1 flex h-4 w-4 items-center justify-center rounded-full bg-destructive text-[10px] text-destructive-foreground",children:n.jsx(m.Z,{"aria-hidden":!0,className:"h-3 w-3"})})]})}let f=(0,r.Z)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),g=(0,r.Z)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);async function x(e){let t=new FormData;t.append("file",e);let a=await fetch("/api/attachments/upload",{method:"POST",body:t}),n=await a.json();if(!a.ok||!n.url||!n.path||!n.name)throw Error(n.error??"Upload failed, please try again");return{url:n.url,path:n.path,name:n.name}}function b({onAttachImage:e,onInsertFile:t,disabled:a,onUploadingChange:r}){let l=(0,c.useRef)(null),s=(0,c.useRef)(null),i=(0,c.useRef)(null),[u,o]=(0,c.useState)(!1),[h,m]=(0,c.useState)(!1);function p(e){m(e),r?.(e)}let[b,v]=(0,c.useState)(null);async function y(t){let a=Array.from(t.target.files??[]);if(0===a.length)return;v(null),p(!0);let{attachments:n,error:r}=await d(a);n.forEach(t=>e(t)),v(r),p(!1),l.current&&(l.current.value="")}async function j(e){let a=e.target.files?.[0];if(a){v(null),p(!0);try{let e=await x(a);t(`[${e.name}](${e.url})`)}catch(e){v(e instanceof Error?e.message:"Upload failed, please try again")}finally{p(!1),s.current&&(s.current.value="")}}}return(0,n.jsxs)("div",{ref:i,className:"relative flex flex-col gap-1",children:[n.jsx("input",{ref:l,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",multiple:!0,className:"hidden",onChange:y}),n.jsx("input",{ref:s,type:"file",accept:".pdf,.csv,.txt,.md",className:"hidden",onChange:j}),n.jsx("button",{type:"button","aria-label":"Attach","aria-haspopup":"menu","aria-expanded":u,disabled:a||h,onClick:()=>o(e=>!e),className:"flex h-8 w-8 items-center justify-center rounded-md border bg-background text-sm font-medium hover:bg-accent disabled:opacity-50",children:h?"…":"+"}),u&&(0,n.jsxs)("div",{role:"menu",className:"absolute bottom-full left-0 z-10 mb-1 min-w-[10rem] overflow-hidden rounded-md border bg-popover py-1 text-sm shadow-md",children:[(0,n.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{o(!1),l.current?.click()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-accent",children:[n.jsx(f,{"aria-hidden":!0,className:"h-4 w-4"}),"Insert image"]}),(0,n.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{o(!1),s.current?.click()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-accent",children:[n.jsx(g,{"aria-hidden":!0,className:"h-4 w-4"}),"Attach file"]})]}),b&&n.jsx("p",{className:"text-xs text-destructive",children:b})]})}function v({attachedImages:e,onAttach:t,onRemove:a,disabled:r,isDragging:l,onInsertFile:s,onUploadingChange:i}){return(0,n.jsxs)("div",{className:`flex items-center gap-2 ${l?"ring-2 ring-primary rounded-md":""}`,children:[s?n.jsx(b,{onAttachImage:t,onInsertFile:s,disabled:r,onUploadingChange:i}):n.jsx(h,{onAttach:t,disabled:r,onUploadingChange:i}),e.map((t,r)=>n.jsx(p,{image:t,index:e.length>1?r:void 0,onRemove:()=>a(r)},t.path))]})}var y=a(77863);function j({input:e,setInput:t,busy:a,supportsMic:r,listening:o,onToggleMic:d,onSend:h,onCancel:m,onHistoryKeyDown:p,searchHistory:f=!1,onToggleSearchHistory:g,placeholder:x="Ask about today's briefing…",sendLabel:b="Send",cancelLabel:j="Cancel"}){let w=(0,c.useRef)(!1),k=(0,c.useRef)(null),{images:N,attach:C,remove:R,take:S,error:A,isDragging:E,uploading:U,onPickerUploadingChange:z}=function(e){let[t,a]=(0,c.useState)([]),n=(0,c.useRef)([]),[r,l]=(0,c.useState)(null),[s,i]=(0,c.useState)(!1),u=(0,c.useCallback)(e=>{n.current=e,a(e)},[]),o=(0,c.useCallback)(e=>{if(n.current.length>=5){l("Up to 5 images per message");return}u([...n.current,e])},[u]),d=(0,c.useCallback)(e=>u(n.current.filter((t,a)=>a!==e)),[u]),h=(0,c.useCallback)(()=>{let e=n.current.map(e=>e.path);return u([]),l(null),e},[u]),{isDragging:m,dropping:p}=function(e,t){let[a,n]=(0,c.useState)(!1),[r,l]=(0,c.useState)(!1);return(0,c.useRef)(0),(0,c.useRef)(t).current=t,{isDragging:a,dropping:r}}(0,o),{pasting:f}=function(e,t,a){let[n,r]=(0,c.useState)(!1);return(0,c.useRef)(t).current=t,(0,c.useRef)(a).current=a,(0,c.useRef)(0),{pasting:n}}(0,o,l);return{images:t,attach:o,remove:d,take:h,error:r,isDragging:m,uploading:f||p||s,onPickerUploadingChange:i}}(0);function $(){0===e.trim().length||U||h(S())}return(0,n.jsxs)("div",{className:"mx-auto w-full max-w-3xl px-1",children:[(0,n.jsxs)("div",{className:(0,y.cn)("rounded-3xl border bg-card shadow-sm",E&&"ring-2 ring-primary"),children:[n.jsx("div",{className:"px-3 pt-3",children:n.jsx("textarea",{ref:k,"aria-label":"Chat message",value:e,onChange:e=>{t(e.target.value),function(e){e.style.height="auto";let t=Math.min(Math.max(e.scrollHeight,40),200);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>200?"auto":"hidden"}(e.target)},onCompositionStart:()=>{w.current=!0},onCompositionEnd:()=>{w.current=!1},onKeyDown:e=>{if(!w.current&&!e.nativeEvent.isComposing){if("Enter"===e.key&&!e.shiftKey){e.preventDefault(),$();return}p?.(e)}},placeholder:x,rows:2,className:"w-full resize-none overflow-hidden bg-transparent px-1 text-sm outline-none placeholder:text-muted-foreground","data-testid":"chat-input"})}),(0,n.jsxs)("div",{className:"flex items-center gap-1 px-2 pb-2",children:[n.jsx(v,{attachedImages:N,onAttach:C,onRemove:R,onUploadingChange:z,disabled:a,isDragging:E,onInsertFile:a=>t(function(e,t,a){if(!e)return t+a;let n=e.value,r=e.selectionStart??n.length,l=e.selectionEnd??n.length,s=n.slice(0,r)+a+n.slice(l),i=r+a.length;return requestAnimationFrame(()=>{e.focus(),e.setSelectionRange(i,i)}),s}(k.current,e,a))}),r&&n.jsx(u.z,{type:"button",variant:o?"destructive":"ghost",size:"icon",className:"rounded-full",onClick:()=>d(e),"data-testid":"mic-button","aria-label":o?"音声入力停止":"音声入力開始","aria-pressed":o,title:o?"音声入力停止":"音声入力開始 (ja-JP)",children:o?n.jsx(l,{"aria-hidden":!0,className:"h-4 w-4"}):n.jsx(s,{"aria-hidden":!0,className:"h-4 w-4"})}),g&&(0,n.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsx("input",{type:"checkbox",checked:f,onChange:e=>g(e.target.checked),disabled:a,"data-testid":"search-history-toggle"}),"過去ブリーフィングを検索"]}),n.jsx("div",{className:"flex-1"}),a?n.jsx(u.z,{type:"button",variant:"destructive",className:"rounded-full",onClick:m,"data-testid":"cancel-button",title:"送信中の応答を中止 (Esc)",children:j}):n.jsx(u.z,{onClick:$,disabled:0===e.trim().length||U,"data-testid":"send-button",size:"icon",className:"shrink-0 rounded-full","aria-label":b,children:n.jsx(i,{"aria-hidden":!0,className:"h-4 w-4"})})]})]}),A&&n.jsx("p",{className:"px-2 pt-2 text-xs text-destructive",role:"alert","data-testid":"attach-error",children:A}),!r&&n.jsx("p",{className:"px-2 pt-2 text-xs text-muted-foreground","data-testid":"mic-unsupported",children:"Voice input is unavailable in this browser (Chrome / Edge supported)."})]})}},68517:(e,t,a)=>{a.d(t,{x:()=>l});var n=a(10326),r=a(77863);function l({label:e="Thinking",className:t,...a}){return(0,n.jsxs)("span",{role:"status","aria-label":e||"loading",className:(0,r.cn)("inline-flex items-center gap-1.5 text-current",t),...a,children:[e&&n.jsx("span",{className:"text-xs text-muted-foreground",children:e}),(0,n.jsxs)("span",{className:"inline-flex items-end gap-1",children:[n.jsx("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-current opacity-70 [animation-delay:-0.3s]"}),n.jsx("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-current opacity-70 [animation-delay:-0.15s]"}),n.jsx("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-current opacity-70"})]})]})}},94557:(e,t,a)=>{a.d(t,{fO:()=>i,od:()=>c,zC:()=>s});var n=a(64455),r=a(95732);function l(){let e=new Map;return t=>{let a=t.toLowerCase().replace(/[\s]+/g,"-").replace(/["'`()[\]{}<>()「」、。,.!?!?::;;/\\|#*~]/g,""),n=e.get(a)??0;return e.set(a,n+1),0===n?a:`${a}-${n}`}}function s(){return e=>{let t=l();(0,r.Vn)(e,"element",e=>{/^h[1-3]$/.test(e.tagName)&&(e.properties={...e.properties,id:t(function e(t){return"text"===t.type?t.value:"children"in t?t.children.map(e).join(""):""}(e))})})}}let i={...n.R,clobberPrefix:"",attributes:{...n.R.attributes,h1:[...n.R.attributes?.h1??[],"id"],h2:[...n.R.attributes?.h2??[],"id"],h3:[...n.R.attributes?.h3??[],"id"]}};function c(e){let t=l(),a=[];for(let n of e.split("\n")){let e=n.match(/^(#{1,3})\s+(.+)/);if(!e)continue;let r=e[2].trim();a.push({id:t(r),text:r,level:e[1].length})}return a}},57273:(e,t,a)=>{a.d(t,{h:()=>r});var n=a(17577);function r(e,{followFromStart:t=!0,followOnNewUserMessage:a=!0}={}){let r=(0,n.useRef)(null),l=(0,n.useRef)(t);(0,n.useRef)(0);let s=(0,n.useCallback)(()=>{let e=r.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;l.current=t<=40},[]),i=(0,n.useCallback)(()=>{l.current=!0;let e=r.current;e&&(e.scrollTop=e.scrollHeight)},[]);return{ref:r,onScroll:s,follow:i,stopFollowing:(0,n.useCallback)(()=>{l.current=!1},[])}}},55786:(e,t,a)=>{a.d(t,{x:()=>r});var n=a(17577);function r({onTranscript:e,lang:t="ja-JP"}){let[a,r]=(0,n.useState)(!1),[l,s]=(0,n.useState)(!1),i=(0,n.useRef)(null),c=(0,n.useRef)("");((0,n.useRef)(!0),(0,n.useRef)(e)).current=e;let u=(0,n.useCallback)(e=>{if(l){i.current?.stop();return}},[t,l]);return{supportsMic:a,listening:l,toggle:u,stop:(0,n.useCallback)(()=>{let e=i.current;e&&(i.current=null,c.current="",s(!1),e.stop())},[])}}}};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/4473ecc91f70f139-s.p.woff" as="font" crossorigin="" type="font/woff"/><link rel="preload" href="/_next/static/media/463dafcda517f24f-s.p.woff" as="font" crossorigin="" type="font/woff"/><link rel="stylesheet" href="/_next/static/css/
|
|
1
|
+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/4473ecc91f70f139-s.p.woff" as="font" crossorigin="" type="font/woff"/><link rel="preload" href="/_next/static/media/463dafcda517f24f-s.p.woff" as="font" crossorigin="" type="font/woff"/><link rel="stylesheet" href="/_next/static/css/eeafe748380067e9.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-0da09fbf75ba315d.js"/><script src="/_next/static/chunks/fd9d1056-0ebe245da16ea449.js" async=""></script><script src="/_next/static/chunks/2117-81e10e03dd478c48.js" async=""></script><script src="/_next/static/chunks/main-app-68edfd76c487cd3c.js" async=""></script><script src="/_next/static/chunks/app/layout-d9572ae2078388a5.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>ai-agent</title><meta name="description" content="Daily briefing & Q&A web UI"/><meta name="next-size-adjust"/><script>
|
|
2
2
|
(function(){try{
|
|
3
3
|
var THEMES = ["light","dark"];
|
|
4
4
|
var BGS = ["default","soft"];
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
document.documentElement.style.setProperty("--sidebar-width", sw + "px");
|
|
19
19
|
}
|
|
20
20
|
}catch(e){}})();
|
|
21
|
-
</script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body class="__variable_1e4310 __variable_c3aa02 antialiased"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/_next/static/chunks/webpack-0da09fbf75ba315d.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/media/4473ecc91f70f139-s.p.woff\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff\"}]\n2:HL[\"/_next/static/media/463dafcda517f24f-s.p.woff\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff\"}]\n3:HL[\"/_next/static/css/
|
|
21
|
+
</script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body class="__variable_1e4310 __variable_c3aa02 antialiased"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/_next/static/chunks/webpack-0da09fbf75ba315d.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/media/4473ecc91f70f139-s.p.woff\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff\"}]\n2:HL[\"/_next/static/media/463dafcda517f24f-s.p.woff\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff\"}]\n3:HL[\"/_next/static/css/eeafe748380067e9.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[12846,[],\"\"]\n6:I[4707,[],\"\"]\n7:I[36423,[],\"\"]\n8:I[75495,[\"3185\",\"static/chunks/app/layout-d9572ae2078388a5.js\"],\"themeBootScript\"]\n9:I[75495,[\"3185\",\"static/chunks/app/layout-d9572ae2078388a5.js\"],\"ThemeProvider\"]\nf:I[61060,[],\"\"]\na:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\nb:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\nc:{\"display\":\"inline-block\"}\nd:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\n10:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"HRelvfbIJ8aRo0S_dK4jo\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"_not-found\"],\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null],null],null]},[null,[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/eeafe748380067e9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$8\"}}]}],[\"$\",\"body\",null,{\"className\":\"__variable_1e4310 __variable_c3aa02 antialiased\",\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$a\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$b\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$c\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$d\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],\"$Le\"],\"globalErrorComponent\":\"$f\",\"missingSlots\":\"$W10\"}]\n"])</script><script>self.__next_f.push([1,"e:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"ai-agent\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Daily briefing \u0026 Q\u0026A web UI\"}],[\"$\",\"meta\",\"4\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>500: Internal Server Error</title><meta name="next-head-count" content="3"/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-0da09fbf75ba315d.js" defer=""></script><script src="/_next/static/chunks/framework-8e0e0f4a6b83a956.js" defer=""></script><script src="/_next/static/chunks/main-e43e212c0d46ce45.js" defer=""></script><script src="/_next/static/chunks/pages/_app-3c9ca398d360b709.js" defer=""></script><script src="/_next/static/chunks/pages/_error-cf5ca766ac8f493f.js" defer=""></script><script src="/_next/static/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>500: Internal Server Error</title><meta name="next-head-count" content="3"/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-0da09fbf75ba315d.js" defer=""></script><script src="/_next/static/chunks/framework-8e0e0f4a6b83a956.js" defer=""></script><script src="/_next/static/chunks/main-e43e212c0d46ce45.js" defer=""></script><script src="/_next/static/chunks/pages/_app-3c9ca398d360b709.js" defer=""></script><script src="/_next/static/chunks/pages/_error-cf5ca766ac8f493f.js" defer=""></script><script src="/_next/static/HRelvfbIJ8aRo0S_dK4jo/_buildManifest.js" defer=""></script><script src="/_next/static/HRelvfbIJ8aRo0S_dK4jo/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"HRelvfbIJ8aRo0S_dK4jo","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"files":["../../../node_modules/next/dist/pages/_app.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../node_modules/react/cjs/react.development.js","../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/index.js","../../../node_modules/react/jsx-runtime.js","../../../node_modules/react/package.json","../../../package.json","../../package.json","../chunks/1093.js","../chunks/1105.js","../chunks/1167.js","../chunks/135.js","../chunks/1425.js","../chunks/1442.js","../chunks/1473.js","../chunks/1535.js","../chunks/1651.js","../chunks/1678.js","../chunks/1682.js","../chunks/184.js","../chunks/1878.js","../chunks/2027.js","../chunks/2269.js","../chunks/2301.js","../chunks/2542.js","../chunks/2868.js","../chunks/2918.js","../chunks/2923.js","../chunks/3118.js","../chunks/3179.js","../chunks/3189.js","../chunks/3209.js","../chunks/3277.js","../chunks/330.js","../chunks/
|
|
1
|
+
{"version":1,"files":["../../../node_modules/next/dist/pages/_app.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../node_modules/react/cjs/react.development.js","../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/index.js","../../../node_modules/react/jsx-runtime.js","../../../node_modules/react/package.json","../../../package.json","../../package.json","../chunks/1093.js","../chunks/1105.js","../chunks/1167.js","../chunks/135.js","../chunks/1425.js","../chunks/1442.js","../chunks/1473.js","../chunks/1535.js","../chunks/1651.js","../chunks/1678.js","../chunks/1682.js","../chunks/184.js","../chunks/1878.js","../chunks/2027.js","../chunks/2269.js","../chunks/2301.js","../chunks/2542.js","../chunks/2868.js","../chunks/2918.js","../chunks/2923.js","../chunks/3118.js","../chunks/3179.js","../chunks/3189.js","../chunks/3209.js","../chunks/3277.js","../chunks/330.js","../chunks/3483.js","../chunks/3530.js","../chunks/3627.js","../chunks/3703.js","../chunks/3754.js","../chunks/4018.js","../chunks/405.js","../chunks/4094.js","../chunks/4597.js","../chunks/4605.js","../chunks/4815.js","../chunks/4931.js","../chunks/5011.js","../chunks/5175.js","../chunks/5205.js","../chunks/5214.js","../chunks/5267.js","../chunks/5972.js","../chunks/6049.js","../chunks/6061.js","../chunks/6167.js","../chunks/6282.js","../chunks/6373.js","../chunks/6435.js","../chunks/6492.js","../chunks/6509.js","../chunks/6562.js","../chunks/6751.js","../chunks/6963.js","../chunks/7188.js","../chunks/7367.js","../chunks/7597.js","../chunks/7700.js","../chunks/7952.js","../chunks/8117.js","../chunks/8134.js","../chunks/8177.js","../chunks/8332.js","../chunks/8617.js","../chunks/8698.js","../chunks/8720.js","../chunks/8739.js","../chunks/8791.js","../chunks/8948.js","../chunks/899.js","../chunks/9120.js","../chunks/9143.js","../chunks/9201.js","../chunks/9759.js","../chunks/9860.js","../chunks/9896.js","../chunks/font-manifest.json","../webpack-runtime.js"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"files":["../../../node_modules/client-only/index.js","../../../node_modules/client-only/package.json","../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../node_modules/next/dist/compiled/jsonwebtoken/index.js","../../../node_modules/next/dist/compiled/jsonwebtoken/package.json","../../../node_modules/next/dist/compiled/next-server/pages.runtime.prod.js","../../../node_modules/next/dist/compiled/node-html-parser/index.js","../../../node_modules/next/dist/compiled/node-html-parser/package.json","../../../node_modules/next/dist/lib/semver-noop.js","../../../node_modules/next/dist/pages/_document.js","../../../node_modules/next/dist/server/lib/trace/constants.js","../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../node_modules/next/package.json","../../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js","../../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js","../../../node_modules/react-dom/cjs/react-dom-server.browser.development.js","../../../node_modules/react-dom/cjs/react-dom-server.browser.production.min.js","../../../node_modules/react-dom/package.json","../../../node_modules/react-dom/server.browser.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../node_modules/react/cjs/react.development.js","../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/index.js","../../../node_modules/react/jsx-runtime.js","../../../node_modules/react/package.json","../../../node_modules/styled-jsx/dist/index/index.js","../../../node_modules/styled-jsx/index.js","../../../node_modules/styled-jsx/package.json","../../../package.json","../../package.json","../chunks/1093.js","../chunks/1105.js","../chunks/1167.js","../chunks/135.js","../chunks/1425.js","../chunks/1442.js","../chunks/1473.js","../chunks/1535.js","../chunks/1651.js","../chunks/1678.js","../chunks/1682.js","../chunks/184.js","../chunks/1878.js","../chunks/2027.js","../chunks/2269.js","../chunks/2301.js","../chunks/2542.js","../chunks/2868.js","../chunks/2918.js","../chunks/2923.js","../chunks/3118.js","../chunks/3179.js","../chunks/3189.js","../chunks/3209.js","../chunks/3277.js","../chunks/330.js","../chunks/
|
|
1
|
+
{"version":1,"files":["../../../node_modules/client-only/index.js","../../../node_modules/client-only/package.json","../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../node_modules/next/dist/compiled/jsonwebtoken/index.js","../../../node_modules/next/dist/compiled/jsonwebtoken/package.json","../../../node_modules/next/dist/compiled/next-server/pages.runtime.prod.js","../../../node_modules/next/dist/compiled/node-html-parser/index.js","../../../node_modules/next/dist/compiled/node-html-parser/package.json","../../../node_modules/next/dist/lib/semver-noop.js","../../../node_modules/next/dist/pages/_document.js","../../../node_modules/next/dist/server/lib/trace/constants.js","../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../node_modules/next/package.json","../../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js","../../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js","../../../node_modules/react-dom/cjs/react-dom-server.browser.development.js","../../../node_modules/react-dom/cjs/react-dom-server.browser.production.min.js","../../../node_modules/react-dom/package.json","../../../node_modules/react-dom/server.browser.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../node_modules/react/cjs/react.development.js","../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/index.js","../../../node_modules/react/jsx-runtime.js","../../../node_modules/react/package.json","../../../node_modules/styled-jsx/dist/index/index.js","../../../node_modules/styled-jsx/index.js","../../../node_modules/styled-jsx/package.json","../../../package.json","../../package.json","../chunks/1093.js","../chunks/1105.js","../chunks/1167.js","../chunks/135.js","../chunks/1425.js","../chunks/1442.js","../chunks/1473.js","../chunks/1535.js","../chunks/1651.js","../chunks/1678.js","../chunks/1682.js","../chunks/184.js","../chunks/1878.js","../chunks/2027.js","../chunks/2269.js","../chunks/2301.js","../chunks/2542.js","../chunks/2868.js","../chunks/2918.js","../chunks/2923.js","../chunks/3118.js","../chunks/3179.js","../chunks/3189.js","../chunks/3209.js","../chunks/3277.js","../chunks/330.js","../chunks/3483.js","../chunks/3530.js","../chunks/3627.js","../chunks/3703.js","../chunks/3754.js","../chunks/4018.js","../chunks/405.js","../chunks/4094.js","../chunks/4597.js","../chunks/4605.js","../chunks/4815.js","../chunks/4931.js","../chunks/5011.js","../chunks/5175.js","../chunks/5205.js","../chunks/5214.js","../chunks/5267.js","../chunks/5972.js","../chunks/6049.js","../chunks/6061.js","../chunks/6167.js","../chunks/6282.js","../chunks/6373.js","../chunks/6435.js","../chunks/6492.js","../chunks/6509.js","../chunks/6562.js","../chunks/6751.js","../chunks/6963.js","../chunks/7188.js","../chunks/7367.js","../chunks/7597.js","../chunks/7700.js","../chunks/7952.js","../chunks/8117.js","../chunks/8134.js","../chunks/8177.js","../chunks/8332.js","../chunks/8617.js","../chunks/8698.js","../chunks/8720.js","../chunks/8739.js","../chunks/8791.js","../chunks/8948.js","../chunks/899.js","../chunks/9120.js","../chunks/9143.js","../chunks/9201.js","../chunks/9759.js","../chunks/9860.js","../chunks/9896.js","../chunks/font-manifest.json","../webpack-runtime.js"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"files":["../../../node_modules/client-only/index.js","../../../node_modules/client-only/package.json","../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../node_modules/next/dist/compiled/jsonwebtoken/index.js","../../../node_modules/next/dist/compiled/jsonwebtoken/package.json","../../../node_modules/next/dist/compiled/next-server/pages.runtime.prod.js","../../../node_modules/next/dist/compiled/node-html-parser/index.js","../../../node_modules/next/dist/compiled/node-html-parser/package.json","../../../node_modules/next/dist/lib/semver-noop.js","../../../node_modules/next/dist/server/lib/trace/constants.js","../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../node_modules/next/package.json","../../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js","../../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js","../../../node_modules/react-dom/cjs/react-dom-server.browser.development.js","../../../node_modules/react-dom/cjs/react-dom-server.browser.production.min.js","../../../node_modules/react-dom/package.json","../../../node_modules/react-dom/server.browser.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../node_modules/react/cjs/react.development.js","../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/index.js","../../../node_modules/react/jsx-runtime.js","../../../node_modules/react/package.json","../../../node_modules/styled-jsx/dist/index/index.js","../../../node_modules/styled-jsx/index.js","../../../node_modules/styled-jsx/package.json","../../package.json","../chunks/1093.js","../chunks/1105.js","../chunks/1167.js","../chunks/135.js","../chunks/1425.js","../chunks/1442.js","../chunks/1473.js","../chunks/1535.js","../chunks/1651.js","../chunks/1678.js","../chunks/1682.js","../chunks/184.js","../chunks/1878.js","../chunks/2027.js","../chunks/2269.js","../chunks/2301.js","../chunks/2542.js","../chunks/2868.js","../chunks/2918.js","../chunks/2923.js","../chunks/3118.js","../chunks/3179.js","../chunks/3189.js","../chunks/3209.js","../chunks/3277.js","../chunks/330.js","../chunks/
|
|
1
|
+
{"version":1,"files":["../../../node_modules/client-only/index.js","../../../node_modules/client-only/package.json","../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../node_modules/next/dist/compiled/jsonwebtoken/index.js","../../../node_modules/next/dist/compiled/jsonwebtoken/package.json","../../../node_modules/next/dist/compiled/next-server/pages.runtime.prod.js","../../../node_modules/next/dist/compiled/node-html-parser/index.js","../../../node_modules/next/dist/compiled/node-html-parser/package.json","../../../node_modules/next/dist/lib/semver-noop.js","../../../node_modules/next/dist/server/lib/trace/constants.js","../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../node_modules/next/package.json","../../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js","../../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js","../../../node_modules/react-dom/cjs/react-dom-server.browser.development.js","../../../node_modules/react-dom/cjs/react-dom-server.browser.production.min.js","../../../node_modules/react-dom/package.json","../../../node_modules/react-dom/server.browser.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../node_modules/react/cjs/react.development.js","../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/index.js","../../../node_modules/react/jsx-runtime.js","../../../node_modules/react/package.json","../../../node_modules/styled-jsx/dist/index/index.js","../../../node_modules/styled-jsx/index.js","../../../node_modules/styled-jsx/package.json","../../package.json","../chunks/1093.js","../chunks/1105.js","../chunks/1167.js","../chunks/135.js","../chunks/1425.js","../chunks/1442.js","../chunks/1473.js","../chunks/1535.js","../chunks/1651.js","../chunks/1678.js","../chunks/1682.js","../chunks/184.js","../chunks/1878.js","../chunks/2027.js","../chunks/2269.js","../chunks/2301.js","../chunks/2542.js","../chunks/2868.js","../chunks/2918.js","../chunks/2923.js","../chunks/3118.js","../chunks/3179.js","../chunks/3189.js","../chunks/3209.js","../chunks/3277.js","../chunks/330.js","../chunks/3483.js","../chunks/3530.js","../chunks/3627.js","../chunks/3703.js","../chunks/3754.js","../chunks/4018.js","../chunks/405.js","../chunks/4094.js","../chunks/4597.js","../chunks/4605.js","../chunks/4815.js","../chunks/4931.js","../chunks/5011.js","../chunks/5175.js","../chunks/5205.js","../chunks/5214.js","../chunks/5267.js","../chunks/5972.js","../chunks/6049.js","../chunks/6061.js","../chunks/6167.js","../chunks/6282.js","../chunks/6373.js","../chunks/6435.js","../chunks/6492.js","../chunks/6509.js","../chunks/6562.js","../chunks/6751.js","../chunks/6963.js","../chunks/7188.js","../chunks/7367.js","../chunks/7597.js","../chunks/7700.js","../chunks/7952.js","../chunks/8117.js","../chunks/8134.js","../chunks/8177.js","../chunks/8332.js","../chunks/8617.js","../chunks/8698.js","../chunks/8720.js","../chunks/8739.js","../chunks/8791.js","../chunks/8948.js","../chunks/899.js","../chunks/9120.js","../chunks/9143.js","../chunks/9201.js","../chunks/9759.js","../chunks/9860.js","../chunks/9896.js","../chunks/font-manifest.json","../webpack-runtime.js"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"node":{},"edge":{},"encryptionKey":"
|
|
1
|
+
{"node":{},"edge":{},"encryptionKey":"s+mPpm4MIRrLWeT9kqpmIupqjCid9ckAK+O08FwYV3s="}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2793],{99376:function(e,t,n){var r=n(35475);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}})},98575:function(e,t,n){n.d(t,{F:function(){return i},e:function(){return o}});var r=n(2265);function l(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function i(...e){return t=>{let n=!1,r=e.map(e=>{let r=l(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():l(e[t],null)}}}}function o(...e){return r.useCallback(i(...e),e)}},37053:function(e,t,n){n.d(t,{g7:function(){return f}});var r,l=n(2265),i=n(98575),o=n(57437),u=Symbol.for("react.lazy"),a=(r||(r=n.t(l,2)))[" use ".trim().toString()];function c(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===u&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var f=function(e){let t=function(e){let t=l.forwardRef((e,t)=>{let{children:n,...r}=e;if(c(n)&&"function"==typeof a&&(n=a(n._payload)),l.isValidElement(n)){var o;let e,u;let a=(o=n,(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?o.ref:(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?o.props.ref:o.props.ref||o.ref),c=function(e,t){let n={...t};for(let r in t){let l=e[r],i=t[r];/^on[A-Z]/.test(r)?l&&i?n[r]=(...e)=>{let t=i(...e);return l(...e),t}:l&&(n[r]=l):"style"===r?n[r]={...l,...i}:"className"===r&&(n[r]=[l,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==l.Fragment&&(c.ref=t?(0,i.F)(t,a):a),l.cloneElement(n,c)}return l.Children.count(n)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}(e),n=l.forwardRef((e,n)=>{let{children:r,...i}=e;c(r)&&"function"==typeof a&&(r=a(r._payload));let u=l.Children.toArray(r),f=u.find(d);if(f){let e=f.props.children,r=u.map(t=>t!==f?t:l.Children.count(e)>1?l.Children.only(null):l.isValidElement(e)?e.props.children:null);return(0,o.jsx)(t,{...i,ref:n,children:l.isValidElement(e)?l.cloneElement(e,void 0,r):null})}return(0,o.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}("Slot"),s=Symbol("radix.slottable");function d(e){return l.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===s}},90535:function(e,t,n){n.d(t,{j:function(){return o}});var r=n(61994);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=r.W,o=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return i(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:o,defaultVariants:u}=t,a=Object.keys(o).map(e=>{let t=null==n?void 0:n[e],r=null==u?void 0:u[e];if(null===t)return null;let i=l(t)||l(r);return o[e][i]}),c=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return i(e,a,null==t?void 0:null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...l}=t;return Object.entries(l).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...u,...c}[t]):({...u,...c})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}},58135:function(e,t,n){n.d(t,{Z:function(){return p}});var r=n(2265);let l=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((e,t,n)=>!!e&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim()},i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),u=e=>{let t=o(e);return t.charAt(0).toUpperCase()+t.slice(1)};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1},f=(0,r.createContext)({}),s=()=>(0,r.useContext)(f),d=(0,r.forwardRef)((e,t)=>{var n,i,o;let{color:u,size:f,strokeWidth:d,absoluteStrokeWidth:p,className:y="",children:h,iconNode:m,...v}=e,{size:g=24,strokeWidth:k=2,absoluteStrokeWidth:w=!1,color:b="currentColor",className:x=""}=null!==(n=s())&&void 0!==n?n:{},C=(null!=p?p:w)?24*Number(null!=d?d:k)/Number(null!=f?f:g):null!=d?d:k;return(0,r.createElement)("svg",{ref:t,...a,width:null!==(i=null!=f?f:g)&&void 0!==i?i:a.width,height:null!==(o=null!=f?f:g)&&void 0!==o?o:a.height,stroke:null!=u?u:b,strokeWidth:C,className:l("lucide",x,y),...!h&&!c(v)&&{"aria-hidden":"true"},...v},[...m.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(h)?h:[h]])}),p=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:a,...c}=n;return(0,r.createElement)(d,{ref:o,iconNode:t,className:l("lucide-".concat(i(u(e))),"lucide-".concat(e),a),...c})});return n.displayName=u(e),n}},58843:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(58135).Z)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]])},31623:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(58135).Z)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])},67608:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(58135).Z)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]])},40704:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(58135).Z)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]])},83922:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(58135).Z)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},54891:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(58135).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4397],{6970:function(e,t,n){n.d(t,{O:function(){return a}});var r=n(57437),l=n(94508);function a(e){let{onPointerDown:t,edge:n="right",ariaLabel:a="Resize panel",className:o,...i}=e;return(0,r.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":a,"data-testid":i["data-testid"],onPointerDown:t,className:(0,l.cn)("group absolute inset-y-0 z-10 w-3 cursor-col-resize bg-transparent","left"===n?"left-0":"right-0",o),children:(0,r.jsx)("div",{className:(0,l.cn)("pointer-events-none absolute inset-y-0 w-1 group-hover:bg-primary/50","left"===n?"left-0":"right-0")})})}},10644:function(e,t,n){n.d(t,{Y:function(){return m}});var r=n(57437),l=n(2265),a=n(20200),o=n(78537),i=n(43713),s=n(54367),c=n(52115),u=n(94508);function d(e){let{entries:t,scrollContainer:n,activeId:l,onClose:a}=e;if(0===t.length)return null;let o=e=>{var t;let r=null===(t=n.current)||void 0===t?void 0:t.querySelector('[id="'.concat(CSS.escape(e),'"]'));null==r||r.scrollIntoView({behavior:"smooth",block:"start"}),a()};return(0,r.jsxs)("nav",{"data-testid":"briefing-toc",className:"absolute right-0 top-0 bottom-0 w-56 overflow-y-auto border-l bg-background/30 px-3 py-4 backdrop-blur-sm",children:[(0,r.jsx)("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"目次"}),(0,r.jsx)("ul",{className:"space-y-0.5",children:t.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)("button",{onClick:()=>o(e.id),className:(0,u.cn)("w-full rounded px-2 py-1 text-left text-xs transition-colors hover:bg-accent hover:text-accent-foreground",1===e.level&&"font-medium",2===e.level&&"pl-4 text-muted-foreground",3===e.level&&"pl-6 text-muted-foreground/70",l===e.id&&"bg-accent/60 text-accent-foreground"),children:e.text})},e.id))})]})}var f=n(20580);let h="rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground",p={a:e=>{let{children:t,...n}=e;return(0,r.jsx)("a",{...n,target:"_blank",rel:"noopener noreferrer",children:t})}};function m(e){let{file:t,content:n,loading:m,error:x,fullSize:v=!1,onToggleFullSize:b,onClose:g}=e,[w,j]=(0,l.useState)(!1),y=(0,l.useRef)(null),k=(0,l.useMemo)(()=>n?(0,s.od)(n):[],[n]),N=function(e,t){let[n,r]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let t=e.current;if(!t||"undefined"==typeof IntersectionObserver)return;let n=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting){r(t.target.getAttribute("id"));break}},{root:t,rootMargin:"0px 0px -80% 0px",threshold:0});return t.querySelectorAll("h1[id], h2[id], h3[id]").forEach(e=>n.observe(e)),()=>n.disconnect()},[e,t]),n}(y,n);return(0,r.jsxs)("div",{"data-testid":"briefing-panel",className:(0,u.cn)("flex h-full flex-col overflow-hidden bg-background transition-all",v?"rounded-lg border":"border-l"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between border-b px-4 py-2",children:[(0,r.jsxs)("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{"data-testid":"panel-type",children:(0,c.C)(t.type)}),(0,r.jsx)("span",{"data-testid":"panel-date",children:t.date}),(0,r.jsxs)("span",{"data-testid":"panel-size",children:[(t.size/1024).toFixed(1)," KB"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[k.length>0&&(0,r.jsx)("button",{"data-testid":"panel-toc-btn",onClick:()=>j(e=>!e),"aria-label":"Toggle table of contents",className:(0,u.cn)("rounded p-1 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground",w&&"bg-accent text-accent-foreground"),children:"目次"}),b&&(0,r.jsx)("button",{"data-testid":"panel-fullsize-btn",onClick:b,"aria-label":v?"Collapse":"Full size",className:h,children:v?(0,r.jsx)(f.jG,{}):(0,r.jsx)(f.Qq,{})}),g&&(0,r.jsx)("button",{"data-testid":"panel-close-btn",onClick:g,"aria-label":"Close panel",className:h,children:(0,r.jsx)(f.Tw,{})})]})]}),(0,r.jsx)("div",{className:"border-b px-4 py-3",children:(0,r.jsx)("h2",{className:"text-sm font-semibold","data-testid":"panel-title",children:t.name})}),(0,r.jsxs)("div",{className:"relative min-h-0 flex-1 overflow-hidden",children:[(0,r.jsx)("div",{ref:y,className:"h-full overflow-y-auto px-4 py-4 pr-6",children:m?(0,r.jsx)("p",{"data-testid":"briefing-content-loading",className:"text-sm text-muted-foreground",children:"Loading…"}):null!==x?(0,r.jsxs)("p",{"data-testid":"briefing-content-error",className:"text-sm text-destructive",children:["Failed to load content: ",x]}):null!==n?(0,r.jsx)("div",{"data-testid":"briefing-content",className:"prose prose-sm max-w-none dark:prose-invert prose-headings:scroll-mt-4 prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline dark:prose-a:text-blue-400",children:(0,r.jsx)(a.UG,{remarkPlugins:[i.Z],rehypePlugins:[s.zC,[o.Z,s.fO]],components:p,children:n})}):null}),(0,r.jsx)("div",{className:(0,u.cn)("pointer-events-none absolute inset-y-0 right-0 transition-opacity duration-200",w?"pointer-events-auto opacity-100":"opacity-0"),children:(0,r.jsx)(d,{entries:k,scrollContainer:y,activeId:N,onClose:()=>j(!1)})})]})]})}},52115:function(e,t,n){n.d(t,{C:function(){return l}});let r={briefing:"Briefing",local:"Local","weekly-summary":"Weekly"};function l(e){var t;return null!==(t=r[e])&&void 0!==t?t:e?e[0].toUpperCase()+e.slice(1):e}},46915:function(e,t,n){n.d(t,{N:function(){return o}});var r=n(2265);function l(e){return"/api/briefing/".concat(encodeURIComponent(e))}async function a(e){let t=await fetch(e,{cache:"no-store"});if(!t.ok)throw Error("HTTP ".concat(t.status));return t.json()}function o(){let[e,t]=(0,r.useState)(null),[n,o]=(0,r.useState)(null),[i,s]=(0,r.useState)(null),[c,u]=(0,r.useState)(!1),[d,f]=(0,r.useState)(null),[h,p]=(0,r.useState)(null),m=(0,r.useRef)(new Map),x=(0,r.useRef)(null),v=(0,r.useCallback)(e=>{x.current=e.name,o(e);let t=m.current.get(e.name);if(void 0!==t){s(t),u(!1),p(null);return}u(!0),s(null),p(null),a(l(e.name)).then(t=>{m.current.set(e.name,t.content),x.current===e.name&&(s(t.content),u(!1))}).catch(t=>{x.current===e.name&&(p(String(t)),u(!1))})},[]),b=(0,r.useCallback)(e=>{m.current.has(e.name)||a(l(e.name)).then(t=>m.current.set(e.name,t.content)).catch(()=>{})},[]),g=(0,r.useCallback)(e=>{x.current===e&&(m.current.delete(e),a(l(e)).then(t=>{m.current.set(e,t.content),x.current===e&&(s(t.content),p(null))}).catch(t=>{console.warn("Failed to refresh briefing content:",e,t)}))},[]),w=(0,r.useCallback)(()=>{x.current=null,o(null),s(null),p(null)},[]);return(0,r.useEffect)(()=>{let e=!1;return a("/api/briefing").then(n=>{e||t(n.files)}).catch(t=>{e||f(String(t))}),()=>{e=!0}},[]),{files:e,selected:n,content:i,loadingContent:c,listError:d,contentError:h,fetchContent:v,prefetch:b,refreshContent:g,close:w}}},12886:function(e,t,n){n.d(t,{L:function(){return l}});var r=n(2265);function l(e){let{storageKey:t,defaultWidth:n,minWidth:l,maxWidth:a,edge:o="right"}=e,[i,s]=(0,r.useState)(n);(0,r.useEffect)(()=>{try{let e=Number(localStorage.getItem(t));e>=l&&e<=a&&s(e)}catch(e){}},[t,l,a]);let c=(0,r.useCallback)(e=>{e.preventDefault();let n=e.clientX,r="left"===o?-1:1,c=e=>Math.min(a,Math.max(l,e)),u=new AbortController,{signal:d}=u,f=i,h=()=>{u.abort();try{localStorage.setItem(t,String(f))}catch(e){}};window.addEventListener("pointermove",e=>{s(f=c(i+r*(e.clientX-n)))},{signal:d}),window.addEventListener("pointerup",h,{signal:d}),window.addEventListener("pointercancel",h,{signal:d})},[i,t,l,a,o]);return{width:i,startResize:c}}},90535:function(e,t,n){n.d(t,{j:function(){return o}});var r=n(61994);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=r.W,o=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return a(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(e=>{let t=null==n?void 0:n[e],r=null==i?void 0:i[e];if(null===t)return null;let a=l(t)||l(r);return o[e][a]}),c=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return a(e,s,null==t?void 0:null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...l}=t;return Object.entries(l).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...c}[t]):({...i,...c})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}},58135:function(e,t,n){n.d(t,{Z:function(){return h}});var r=n(2265);let l=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((e,t,n)=>!!e&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim()},a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),i=e=>{let t=o(e);return t.charAt(0).toUpperCase()+t.slice(1)};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1},u=(0,r.createContext)({}),d=()=>(0,r.useContext)(u),f=(0,r.forwardRef)((e,t)=>{var n,a,o;let{color:i,size:u,strokeWidth:f,absoluteStrokeWidth:h,className:p="",children:m,iconNode:x,...v}=e,{size:b=24,strokeWidth:g=2,absoluteStrokeWidth:w=!1,color:j="currentColor",className:y=""}=null!==(n=d())&&void 0!==n?n:{},k=(null!=h?h:w)?24*Number(null!=f?f:g)/Number(null!=u?u:b):null!=f?f:g;return(0,r.createElement)("svg",{ref:t,...s,width:null!==(a=null!=u?u:b)&&void 0!==a?a:s.width,height:null!==(o=null!=u?u:b)&&void 0!==o?o:s.height,stroke:null!=i?i:j,strokeWidth:k,className:l("lucide",y,p),...!m&&!c(v)&&{"aria-hidden":"true"},...v},[...x.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(m)?m:[m]])}),h=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:s,...c}=n;return(0,r.createElement)(f,{ref:o,iconNode:t,className:l("lucide-".concat(a(i(e))),"lucide-".concat(e),s),...c})});return n.displayName=i(e),n}},54891:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(58135).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])}}]);
|