larkup 0.1.39 → 0.1.40
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/diagnostics/route-bundle-stats.json +22 -21
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +18 -18
- package/.next/server/app/_not-found.segments/_full.segment.rsc +18 -18
- package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_index.segment.rsc +12 -12
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/analytics/page.js.nft.json +1 -1
- package/.next/server/app/analytics/page_client-reference-manifest.js +1 -1
- package/.next/server/app/analytics.html +1 -1
- package/.next/server/app/analytics.rsc +19 -19
- package/.next/server/app/analytics.segments/_full.segment.rsc +19 -19
- package/.next/server/app/analytics.segments/_head.segment.rsc +4 -4
- package/.next/server/app/analytics.segments/_index.segment.rsc +12 -12
- package/.next/server/app/analytics.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/analytics.segments/analytics/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/analytics.segments/analytics.segment.rsc +3 -3
- package/.next/server/app/chat/page.js.nft.json +1 -1
- package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/chat.html +1 -1
- package/.next/server/app/chat.rsc +19 -19
- package/.next/server/app/chat.segments/_full.segment.rsc +19 -19
- package/.next/server/app/chat.segments/_head.segment.rsc +4 -4
- package/.next/server/app/chat.segments/_index.segment.rsc +12 -12
- package/.next/server/app/chat.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/chat.segments/chat.segment.rsc +3 -3
- package/.next/server/app/data/page.js.nft.json +1 -1
- package/.next/server/app/data/page_client-reference-manifest.js +1 -1
- package/.next/server/app/data.html +1 -1
- package/.next/server/app/data.rsc +25 -26
- package/.next/server/app/data.segments/_full.segment.rsc +25 -26
- package/.next/server/app/data.segments/_head.segment.rsc +4 -4
- package/.next/server/app/data.segments/_index.segment.rsc +12 -12
- package/.next/server/app/data.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/data.segments/data/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/data.segments/data.segment.rsc +3 -3
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +17 -17
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +17 -17
- package/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/server/app/index.segments/_index.segment.rsc +12 -12
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +19 -19
- package/.next/server/app/settings.segments/_full.segment.rsc +19 -19
- package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/server/app/settings.segments/_index.segment.rsc +12 -12
- package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/server/chunks/0598_next_dist_esm_build_templates_app-route_0kbcuk-.js +6 -6
- package/.next/server/chunks/0598_next_dist_esm_build_templates_app-route_0sbf4ny.js +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__0m21fli._.js → [root-of-the-server]__0pgotbk._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__1k1mxo2._.js +3 -0
- package/.next/server/chunks/ssr/_169pdlf._.js +4 -4
- package/.next/server/chunks/ssr/_18jagqc._.js +2 -2
- package/.next/server/chunks/ssr/_1hetwwu._.js +2 -2
- package/.next/{standalone/apps/web/.next/server/chunks/ssr/_0s8403d._.js → server/chunks/ssr/_1p6lb7s._.js} +2 -2
- package/.next/server/chunks/ssr/_1yqlx1m._.js +1 -1
- package/.next/server/chunks/ssr/apps_web_components_analytics_analytics-dashboard_tsx_1056-z3._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/required-server-files.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +18 -18
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +18 -18
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +12 -12
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/analytics/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/analytics/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/analytics.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/analytics.rsc +19 -19
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/_full.segment.rsc +19 -19
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/_index.segment.rsc +12 -12
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/analytics/__PAGE__.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/analytics.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/chat/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat.rsc +19 -19
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_full.segment.rsc +19 -19
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_index.segment.rsc +12 -12
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/chat.segments/chat.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/data/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/data/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/data.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/data.rsc +25 -26
- package/.next/standalone/apps/web/.next/server/app/data.segments/_full.segment.rsc +25 -26
- package/.next/standalone/apps/web/.next/server/app/data.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/data.segments/_index.segment.rsc +12 -12
- package/.next/standalone/apps/web/.next/server/app/data.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/data.segments/data/__PAGE__.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/data.segments/data.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.rsc +17 -17
- package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +17 -17
- package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +12 -12
- package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.rsc +19 -19
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +19 -19
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +12 -12
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/chunks/0598_next_dist_esm_build_templates_app-route_0kbcuk-.js +6 -6
- package/.next/standalone/apps/web/.next/server/chunks/0598_next_dist_esm_build_templates_app-route_0sbf4ny.js +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__0m21fli._.js → [root-of-the-server]__0pgotbk._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__1k1mxo2._.js +3 -0
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_169pdlf._.js +4 -4
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_18jagqc._.js +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_1hetwwu._.js +2 -2
- package/.next/{server/chunks/ssr/_0s8403d._.js → standalone/apps/web/.next/server/chunks/ssr/_1p6lb7s._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_1yqlx1m._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_components_analytics_analytics-dashboard_tsx_1056-z3._.js +1 -1
- package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/0f_k7h1yraes3.js +1 -0
- package/.next/{static/chunks/1ov69q-i9ybqi.js → standalone/apps/web/.next/static/chunks/1b9srvyupwcjz.js} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/1j_-mc43_9-b3.js +121 -0
- package/.next/standalone/apps/web/.next/static/chunks/23efo4rpc31kr.js +1 -0
- package/.next/standalone/apps/web/.next/static/chunks/2_qbhu4zxkm7j.js +11 -0
- package/.next/standalone/apps/web/.next/static/chunks/{2ljwki2xxnblc.js → 2h-80z3n8mi3d.js} +7 -7
- package/.next/standalone/apps/web/.next/static/chunks/37j20in7beze4.js +1 -0
- package/.next/standalone/apps/web/.next/static/chunks/{1cxabi5yzqz57.js → 38f3p67a1uufx.js} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/3fe06cefiv690.css +1 -0
- package/.next/standalone/apps/web/CHANGELOG.md +12 -0
- package/.next/standalone/apps/web/app/api/chat/route.ts +25 -11
- package/.next/standalone/apps/web/app/api/media/process/route.ts +34 -1
- package/.next/standalone/apps/web/app/settings/page.tsx +16 -5
- package/.next/standalone/apps/web/bin/larkup.js +12 -1
- package/.next/standalone/apps/web/components/chat/message-item.tsx +68 -3
- package/.next/standalone/apps/web/components/data/data-workspace.tsx +53 -120
- package/.next/standalone/apps/web/components/data/firecrawl-notice.tsx +1 -11
- package/.next/standalone/apps/web/components/data/media-panel.tsx +187 -25
- package/.next/standalone/apps/web/components/data/scrape-panel.tsx +1 -1
- package/.next/standalone/apps/web/components/data/upload-panel.tsx +0 -1
- package/.next/standalone/apps/web/components/index/index-workspace.tsx +48 -25
- package/.next/standalone/apps/web/components/settings/marketplace-section.tsx +1 -1
- package/.next/standalone/apps/web/components/settings/settings-layout.tsx +1 -2
- package/.next/standalone/apps/web/package.json +1 -1
- package/.next/standalone/apps/web/server.js +1 -1
- package/.next/standalone/packages/tools/doc-editor/CHANGELOG.md +7 -0
- package/.next/standalone/packages/tools/doc-editor/dist/editor.js +1 -15
- package/.next/standalone/packages/tools/doc-editor/package.json +1 -1
- package/.next/standalone/packages/tools/doc-editor/src/editor.ts +1 -15
- package/.next/static/chunks/0f_k7h1yraes3.js +1 -0
- package/.next/{standalone/apps/web/.next/static/chunks/1ov69q-i9ybqi.js → static/chunks/1b9srvyupwcjz.js} +1 -1
- package/.next/static/chunks/1j_-mc43_9-b3.js +121 -0
- package/.next/static/chunks/23efo4rpc31kr.js +1 -0
- package/.next/static/chunks/2_qbhu4zxkm7j.js +11 -0
- package/.next/static/chunks/{2ljwki2xxnblc.js → 2h-80z3n8mi3d.js} +7 -7
- package/.next/static/chunks/37j20in7beze4.js +1 -0
- package/.next/static/chunks/{1cxabi5yzqz57.js → 38f3p67a1uufx.js} +1 -1
- package/.next/static/chunks/3fe06cefiv690.css +1 -0
- package/CHANGELOG.md +12 -0
- package/app/api/chat/route.ts +25 -11
- package/app/api/media/process/route.ts +34 -1
- package/app/settings/page.tsx +16 -5
- package/bin/larkup.js +12 -1
- package/components/chat/message-item.tsx +68 -3
- package/components/data/data-workspace.tsx +53 -120
- package/components/data/firecrawl-notice.tsx +1 -11
- package/components/data/media-panel.tsx +187 -25
- package/components/data/scrape-panel.tsx +1 -1
- package/components/data/upload-panel.tsx +0 -1
- package/components/index/index-workspace.tsx +48 -25
- package/components/settings/marketplace-section.tsx +1 -1
- package/components/settings/settings-layout.tsx +1 -2
- package/package.json +6 -6
- package/.next/server/chunks/ssr/[root-of-the-server]__0t8ud_u._.js +0 -3
- package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0t8ud_u._.js +0 -3
- package/.next/standalone/apps/web/.next/static/chunks/03ju_837pa9ul.js +0 -11
- package/.next/standalone/apps/web/.next/static/chunks/0ge3nirnmx_np.js +0 -1
- package/.next/standalone/apps/web/.next/static/chunks/19krxv-ou9c8c.js +0 -121
- package/.next/standalone/apps/web/.next/static/chunks/1_nk3imchwn8a.css +0 -1
- package/.next/standalone/apps/web/.next/static/chunks/25rt2v27sz0io.js +0 -1
- package/.next/static/chunks/03ju_837pa9ul.js +0 -11
- package/.next/static/chunks/0ge3nirnmx_np.js +0 -1
- package/.next/static/chunks/19krxv-ou9c8c.js +0 -121
- package/.next/static/chunks/1_nk3imchwn8a.css +0 -1
- package/.next/static/chunks/25rt2v27sz0io.js +0 -1
- /package/.next/standalone/apps/web/.next/static/{iCALZzxFfElF4z3wYZwsC → 7yuxi3XYqMr4kxUl6T-qk}/_buildManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{iCALZzxFfElF4z3wYZwsC → 7yuxi3XYqMr4kxUl6T-qk}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{iCALZzxFfElF4z3wYZwsC → 7yuxi3XYqMr4kxUl6T-qk}/_ssgManifest.js +0 -0
- /package/.next/static/{iCALZzxFfElF4z3wYZwsC → 7yuxi3XYqMr4kxUl6T-qk}/_buildManifest.js +0 -0
- /package/.next/static/{iCALZzxFfElF4z3wYZwsC → 7yuxi3XYqMr4kxUl6T-qk}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{iCALZzxFfElF4z3wYZwsC → 7yuxi3XYqMr4kxUl6T-qk}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1717,e=>{"use strict";var t=e.i(523829),s=e.i(178328),a=e.i(668548),r=e.i(831892),i=e.i(501375),n=e.i(887216),o=e.i(112786),l=e.i(104872),d=e.i(597343),c=e.i(7544),x=e.i(794189),u=e.i(370317),m=e.i(134018),h=e.i(300033),p=e.i(874822);let f=(0,p.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var j=e.i(518864),g=e.i(501706);let y=(0,p.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),v=(0,p.default)("zap",[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]);var C=e.i(842646);let b=e=>fetch(e).then(e=>e.json());function k(e,t,s){if("all"===t||!e)return e||[];let a=30;"7d"===t?a=7:"14d"===t?a=14:"30d"===t?a=30:"90d"===t&&(a=90);let r=[],i=new Date,n=new Map(e.map(e=>[e.date,e]));for(let e=a-1;e>=0;e--){let t=new Date(i);t.setDate(t.getDate()-e);let a=t.toISOString().split("T")[0];n.has(a)?r.push(n.get(a)):r.push({date:a,...s()})}return r}function N(e){return e<1e3?e.toLocaleString():e<1e6?`${(e/1e3).toFixed(+(e<1e4))}K`:`${(e/1e6).toFixed(2)}M`}e.s(["AnalyticsDashboard",0,function(){var e;let[p,w]=(0,s.useState)("indexing"),[T,S]=(0,s.useState)("14d"),{data:L,isLoading:D,error:A}=(0,C.default)(`/api/analytics?timeframe=${T}`,b);if(D)return(0,t.jsxs)("div",{className:"p-8 flex-col gap-2 text-center text-muted-foreground animate-pulse flex items-center justify-center h-full",children:[(0,t.jsx)(g.Loader2,{className:"size-6 animate-spin"}),(0,t.jsx)("span",{className:"text-[15px]",children:"Loading analytics data..."})]});if(A||!L)return(0,t.jsx)("div",{className:"p-8 text-center text-destructive",children:"Failed to load analytics data."});let z=!L.serverTimeSeries?.length||L.serverTimeSeries.every(e=>0===e.requests),I=!L.embeddingTimeSeries?.length||L.embeddingTimeSeries.every(e=>0===e.tokens),O=!L.chatTimeSeries?.length||L.chatTimeSeries.every(e=>0===e.tokens),R=({title:e,description:s})=>(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-md",children:(0,t.jsxs)("div",{className:"flex flex-col items-center space-y-2 dark:bg-zinc-900/90 px-5 py-4 rounded-lg max-w-xl text-center",children:[(0,t.jsx)("div",{className:"p-2 border border-border/70 rounded-lg bg-white",children:(0,t.jsx)(f,{className:"size-6 text-black/80"})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-[16px] font-semibold text-foreground",children:e}),(0,t.jsx)("p",{className:"text-[13px] text-muted-foreground",children:s})]})]})});return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Total Cost"}),(0,t.jsx)(f,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:0===(e=L.totalCost)?"$0.00":e<.01?e<1e-4?"<$0.0001":`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Across all paid models"})]})]}),(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Chat Tokens"}),(0,t.jsx)(y,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:N(L.totalChatTokens)}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Processed in conversations"})]})]}),(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Embedding Tokens"}),(0,t.jsx)(j.Database,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:N(L.totalEmbeddingTokens)}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Processed during indexing"})]})]}),(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,t.jsx)(u.CardTitle,{className:"text-sm font-medium",children:"Total Requests"}),(0,t.jsx)(v,{className:"size-4 text-muted-foreground"})]}),(0,t.jsxs)(u.CardContent,{children:[(0,t.jsx)("div",{className:"text-2xl font-bold",children:L.totalRequests.toLocaleString()}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"To local RAG server this week"})]})]})]}),(0,t.jsxs)(m.Tabs,{value:p,onValueChange:w,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[(0,t.jsxs)(m.TabsList,{className:"inline-flex bg-white/70 dark:bg-muted/70 h-9 items-center justify-center rounded-lg border border-border p-0.5 text-muted-foreground",children:[(0,t.jsxs)(m.TabsTrigger,{value:"indexing",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,t.jsx)(j.Database,{className:"size-3.5 mr-1.5"}),"Indexing Usage"]}),(0,t.jsxs)(m.TabsTrigger,{value:"chat",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,t.jsx)(y,{className:"size-3.5 mr-1.5"}),"Chat Usage"]}),(0,t.jsxs)(m.TabsTrigger,{value:"overview",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,t.jsx)(f,{className:"size-3.5 mr-1.5"}),"Server Traffic"]})]}),(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsxs)(h.Select,{value:T,onValueChange:e=>e&&S(e),children:[(0,t.jsx)(h.SelectTrigger,{className:"w-[140px] h-10! text-sm bg-white dark:bg-background focus:ring-0 focus:border-input data-[state=open]:ring-0 data-[state=open]:border-input outline-none focus:outline-none",children:(0,t.jsxs)(h.SelectValue,{placeholder:"Select timeframe",children:["7d"===T&&"Last 7 days","14d"===T&&"Last 14 days","30d"===T&&"Last 30 days","90d"===T&&"Last 90 days","all"===T&&"All time"]})}),(0,t.jsxs)(h.SelectContent,{children:[(0,t.jsx)(h.SelectItem,{value:"7d",children:"Last 7 days"}),(0,t.jsx)(h.SelectItem,{value:"14d",children:"Last 14 days"}),(0,t.jsx)(h.SelectItem,{value:"30d",children:"Last 30 days"}),(0,t.jsx)(h.SelectItem,{value:"90d",children:"Last 90 days"}),(0,t.jsx)(h.SelectItem,{value:"all",children:"All time"})]})]})})]}),(0,t.jsx)(m.TabsContent,{value:"overview",className:"space-y-4",children:(0,t.jsxs)(u.Card,{className:"shadow-none! rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{children:[(0,t.jsx)(u.CardTitle,{children:"Requests to RAG Server"}),(0,t.jsx)(u.CardDescription,{children:"Daily requests sent to your local or remote deployed RAG endpoints."})]}),(0,t.jsx)(u.CardContent,{className:"px-2 sm:p-6",children:(0,t.jsxs)("div",{className:"h-[300px] w-full relative",children:[z&&(0,t.jsx)(R,{title:"No Server Traffic Yet",description:"Once you start sending requests to the RAG server, usage will appear here."}),(0,t.jsx)(l.ResponsiveContainer,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,t.jsxs)(n.BarChart,{data:k(L.serverTimeSeries,T,()=>({requests:0,avgLatencyMs:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,t.jsx)(o.CartesianGrid,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,t.jsx)(c.XAxis,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:e=>{if(!e.includes("-"))return e;let[t,s,a]=e.split("-");return new Date(parseInt(t,10),parseInt(s,10)-1,parseInt(a,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,t.jsx)(x.YAxis,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}`}),(0,t.jsx)(d.Tooltip,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"},cursor:{fill:"var(--color-muted)",opacity:.4}}),(0,t.jsx)(i.Bar,{dataKey:"requests",fill:"#3b82f6",radius:[4,4,0,0],maxBarSize:40,activeBar:{className:"outline-none focus:outline-none"}})]})})]})})]})}),(0,t.jsx)(m.TabsContent,{value:"indexing",className:"space-y-4",children:(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{children:[(0,t.jsx)(u.CardTitle,{children:"Indexing Token Usage"}),(0,t.jsx)(u.CardDescription,{children:"Daily tokens processed for document indexing."})]}),(0,t.jsx)(u.CardContent,{className:"px-2 sm:p-6",children:(0,t.jsxs)("div",{className:"h-[300px] w-full relative",children:[I&&(0,t.jsx)(R,{title:"No Indexing Data Yet",description:"Add documents to your knowledge bases to see embedding token usage here."}),(0,t.jsx)(l.ResponsiveContainer,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,t.jsxs)(r.AreaChart,{data:k(L.embeddingTimeSeries,T,()=>({tokens:0,cost:0,requests:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"colorIndexing",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"5%",stopColor:"#f97316",stopOpacity:.3}),(0,t.jsx)("stop",{offset:"95%",stopColor:"#f97316",stopOpacity:0})]})}),(0,t.jsx)(o.CartesianGrid,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,t.jsx)(c.XAxis,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:e=>{if(!e.includes("-"))return e;let[t,s,a]=e.split("-");return new Date(parseInt(t,10),parseInt(s,10)-1,parseInt(a,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,t.jsx)(x.YAxis,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:e=>`${e>=1e3?e/1e3+"k":e}`}),(0,t.jsx)(d.Tooltip,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"}}),(0,t.jsx)(a.Area,{type:"monotone",dataKey:"tokens",stroke:"#f97316",strokeWidth:2,fillOpacity:1,fill:"url(#colorIndexing)",activeDot:{r:4,className:"outline-none focus:outline-none",strokeWidth:0}})]})})]})})]})}),(0,t.jsx)(m.TabsContent,{value:"chat",className:"space-y-4",children:(0,t.jsxs)(u.Card,{className:"shadow-none rounded-xl",children:[(0,t.jsxs)(u.CardHeader,{children:[(0,t.jsx)(u.CardTitle,{children:"Chat Token Usage"}),(0,t.jsx)(u.CardDescription,{children:"Daily tokens processed for chat completions."})]}),(0,t.jsx)(u.CardContent,{className:"px-2 sm:p-6",children:(0,t.jsxs)("div",{className:"h-[300px] w-full relative",children:[O&&(0,t.jsx)(R,{title:"No Chat Data Yet",description:"Chat with the AI to see your token usage metrics here."}),(0,t.jsx)(l.ResponsiveContainer,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,t.jsxs)(r.AreaChart,{data:k(L.chatTimeSeries,T,()=>({tokens:0,cost:0,requests:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"colorChat",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),(0,t.jsx)("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]})}),(0,t.jsx)(o.CartesianGrid,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,t.jsx)(c.XAxis,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:e=>{if(!e.includes("-"))return e;let[t,s,a]=e.split("-");return new Date(parseInt(t,10),parseInt(s,10)-1,parseInt(a,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,t.jsx)(x.YAxis,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:e=>`${e>=1e3?e/1e3+"k":e}`}),(0,t.jsx)(d.Tooltip,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"}}),(0,t.jsx)(a.Area,{type:"monotone",dataKey:"tokens",stroke:"#3b82f6",strokeWidth:2,fillOpacity:1,fill:"url(#colorChat)",activeDot:{r:4,className:"outline-none focus:outline-none",strokeWidth:0}})]})})]})})]})})]})]})}],1717)}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,721606,e=>{"use strict";var t=e.i(199910),s=e.i(178328),a=e.i(732684);function n(){return"u">typeof window}function r(){return"production"}function i(){return"development"===((n()?window.vam:r())||"production")}function l(e){return RegExp(`/${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?=[/?#]|$)`)}function o(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`/${e}`}function d(e){return(0,s.useEffect)(()=>{var t;e.beforeSend&&(null==(t=window.va)||t.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]),(0,s.useEffect)(()=>{!function(e={debug:!0},t){var s;if(!n())return;let{beforeSend:a,src:l,dataset:d}=function(e,t){var s,a;let n=e;if(t)try{n={...null==(s=JSON.parse(t))?void 0:s.analytics,...e}}catch{}!function(e="auto"){if("auto"===e){window.vam=r();return}window.vam=e}(n.mode);let l={sdkn:"@vercel/analytics"+(n.framework?`/${n.framework}`:""),sdkv:"2.0.1"};return n.disableAutoTrack&&(l.disableAutoTrack="1"),n.viewEndpoint&&(l.viewEndpoint=o(n.viewEndpoint)),n.eventEndpoint&&(l.eventEndpoint=o(n.eventEndpoint)),n.sessionEndpoint&&(l.sessionEndpoint=o(n.sessionEndpoint)),i()&&!1===n.debug&&(l.debug="false"),n.dsn&&(l.dsn=n.dsn),n.endpoint?l.endpoint=n.endpoint:n.basePath&&(l.endpoint=o(`${n.basePath}/insights`)),{beforeSend:n.beforeSend,src:(a=n).scriptSrc?o(a.scriptSrc):i()?"https://va.vercel-scripts.com/v1/script.debug.js":a.basePath?o(`${a.basePath}/insights/script.js`):"/_vercel/insights/script.js",dataset:l}}(e,t);if(window.va||(window.va=function(...e){window.vaq||(window.vaq=[]),window.vaq.push(e)}),a&&(null==(s=window.va)||s.call(window,"beforeSend",a)),document.head.querySelector(`script[src*="${l}"]`))return;let c=document.createElement("script");for(let[e,t]of(c.src=l,Object.entries(d)))c.dataset[e]=t;c.defer=!0,c.onerror=()=>{let e=i()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${l}. ${e}`)},document.head.appendChild(c)}({framework:e.framework||"react",basePath:e.basePath??function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}(),...void 0!==e.route&&{disableAutoTrack:!0},...e},e.configString??function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}())},[]),(0,s.useEffect)(()=>{e.route&&e.path&&function({route:e,path:t}){var s;null==(s=window.va)||s.call(window,"pageview",{route:e,path:t})}({route:e.route,path:e.path})},[e.route,e.path]),null}function c(e){let n,r,i,{route:o,path:c}=(n=(0,a.useParams)(),r=(0,a.useSearchParams)(),i=(0,a.usePathname)(),n?{route:function(e,t){if(!e||!t)return e;let s=e;try{let e=Object.entries(t);for(let[t,a]of e)if(!Array.isArray(a)){let e=l(a);e.test(s)&&(s=s.replace(e,`/[${t}]`))}for(let[t,a]of e)if(Array.isArray(a)){let e=l(a.join("/"));e.test(s)&&(s=s.replace(e,`/[...${t}]`))}return s}catch{return e}}(i,Object.keys(n).length?n:Object.fromEntries(r.entries())),path:i}:{route:null,path:i});return s.default.createElement(d,{path:c,route:o,...e,basePath:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH}(),configString:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_CLIENT_CONFIG}(),framework:"next"})}e.s(["Analytics",0,function(e){return s.default.createElement(s.Suspense,{fallback:null},s.default.createElement(c,{...e}))}])},7012,e=>{"use strict";var t=e.i(523829),s=e.i(178328),a=(e,t,s,a,n,r,i,l)=>{let o=document.documentElement,d=["light","dark"];function c(t){var s;(Array.isArray(e)?e:[e]).forEach(e=>{let s="class"===e,a=s&&r?n.map(e=>r[e]||e):n;s?(o.classList.remove(...a),o.classList.add(r&&r[t]?r[t]:t)):o.setAttribute(e,t)}),s=t,l&&d.includes(s)&&(o.style.colorScheme=s)}if(a)c(a);else try{let e=localStorage.getItem(t)||s,a=i&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;c(a)}catch(e){}},n=s.createContext(void 0),r={setTheme:e=>{},themes:[]};s.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:l,value:o,themes:d,nonce:c,scriptProps:u})=>{let m=JSON.stringify([n,t,l,e,d,o,r,i]).slice(1,-1);return s.createElement("script",{...u,suppressHydrationWarning:!0,nonce:"u"<typeof window?c:"",dangerouslySetInnerHTML:{__html:`(${a.toString()})(${m})`}})});var i=e.i(746632),l=e.i(795360),l=l,o=e.i(951482),o=o,d=e.i(195300),d=d,c=e.i(909042),c=c,u=e.i(964548),u=u;e.s(["Toaster",0,({...e})=>{var a;let{theme:m="system"}=null!=(a=s.useContext(n))?a:r;return(0,t.jsx)(i.Toaster,{closeButton:!0,theme:m,className:"toaster group z-9999999! ",icons:{success:(0,t.jsx)(l.default,{className:"size-5 text-white",fill:"#10b981"}),info:(0,t.jsx)(o.default,{className:"size-5 text-white",fill:"#3b82f6"}),warning:(0,t.jsx)(d.default,{className:"size-5 text-white",fill:"#f59e0b"}),error:(0,t.jsx)(c.default,{className:"size-5 text-white",fill:"#ef4444"}),loading:(0,t.jsx)(u.default,{className:"size-5 animate-spin text-muted-foreground"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)",zIndex:999999},toastOptions:{classNames:{toast:"group toast items-start group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900 group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:",icon:"mt-0.5",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",success:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",error:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",warning:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",info:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900"}},...e})}],7012)},266186,e=>{"use strict";var t=e.i(523829),s=e.i(82100),a=e.i(178328),n=e.i(334347),r=e.i(732684),i=e.i(301470),l=e.i(518864),o=e.i(487779),d=e.i(874822);let c=(0,d.default)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);var u=e.i(708909),m=e.i(37126),x=e.i(152236),h=e.i(839717),p=e.i(133058);let f=(0,d.default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var g=e.i(980369),b=e.i(379702),j=e.i(885131),v=e.i(440087),y=e.i(624529),N=e.i(874560),w=e.i(746632),k=e.i(501706),C=e.i(466691),A=e.i(282879);function F({target:e,open:s,onOpenChange:n}){let{deleteServer:r}=(0,y.useWorkspace)(),[i,l]=(0,a.useState)(!1);async function o(){if(e){l(!0);try{await r(e.id),w.toast.success(`Deleted "${e.name}".`),n(!1)}catch{w.toast.error("Could not delete the server.")}finally{l(!1)}}}return(0,t.jsx)(A.Dialog,{open:s,onOpenChange:n,children:(0,t.jsxs)(A.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsxs)(A.DialogTitle,{children:["Delete “",e?.name,"”?"]}),(0,t.jsx)(A.DialogDescription,{children:"This permanently removes the server's documents, index, vector data, and generated files. This cannot be undone."})]}),(0,t.jsxs)(A.DialogFooter,{children:[(0,t.jsx)(C.Button,{variant:"outline",onClick:()=>n(!1),disabled:i,children:"Cancel"}),(0,t.jsxs)(C.Button,{variant:"destructive",onClick:()=>void o(),disabled:i,children:[i&&(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}),"Delete server"]})]})]})})}function S(){let{servers:e,activeServer:s,activateServer:n}=(0,y.useWorkspace)(),[r,i]=(0,a.useState)(!1),[l,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(null);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(v.DropdownMenu,{children:[(0,t.jsxs)(v.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-lg border border-border bg-card px-2 py-1.5 text-left transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),children:[(0,t.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-primary/12 text-primary",children:(0,t.jsx)(m.Server,{className:"size-3.5"})}),(0,t.jsx)("span",{className:"flex min-w-0 flex-1 flex-col",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:s?.name??"No server"}),s?.running&&(0,t.jsx)(z,{})]})}),(0,t.jsx)(f,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,t.jsxs)(v.DropdownMenuContent,{align:"start",sideOffset:6,className:"w-(--anchor-width) min-w-[260px]",children:[(0,t.jsxs)(v.DropdownMenuGroup,{children:[(0,t.jsx)(v.DropdownMenuLabel,{children:"Your servers"}),e.map(e=>{let a=e.id===s?.id;return(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>{a||n(e.id)},className:"gap-2",children:[(0,t.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:(0,t.jsx)(m.Server,{className:"size-3.5"})}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"truncate font-medium",children:e.name}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-[11px] text-muted-foreground tabular-nums",children:[(0,t.jsxs)("span",{children:[e.docCount," docs"]}),e.indexed&&(0,t.jsx)("span",{children:"· indexed"}),e.running&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-500",children:[(0,t.jsx)(z,{}),"live"]})]})]}),a&&(0,t.jsx)(p.Check,{className:"size-4 shrink-0 text-primary"})]},e.id)})]}),(0,t.jsx)(v.DropdownMenuSeparator,{}),(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>i(!0),className:"gap-2 h-9",children:[(0,t.jsx)(b.Plus,{className:"size-4"}),"New server"]}),s&&(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>o(s),className:"gap-2 h-9",children:[(0,t.jsx)(g.Pencil,{className:"size-4"}),"Rename current"]}),s&&e.length>1&&(0,t.jsxs)(v.DropdownMenuItem,{variant:"destructive",onClick:()=>c(s),className:"gap-2",children:[(0,t.jsx)(j.Trash2,{className:"size-4"}),"Delete current"]})]})]}),(0,t.jsx)(N.ServerFormDialog,{mode:"create",open:r,onOpenChange:i}),(0,t.jsx)(N.ServerFormDialog,{mode:"rename",target:l,open:null!==l,onOpenChange:e=>!e&&o(null)}),(0,t.jsx)(F,{target:d,open:null!==d,onOpenChange:e=>!e&&c(null)})]})}function z(){return(0,t.jsxs)("span",{className:"relative flex size-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-500"})]})}let E={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},D=[{id:"chat",label:"Chat",href:"/chat",icon:i.MessageCircle},{id:"data",label:"Data",href:"/data",icon:l.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function T(){let e=(0,r.usePathname)(),{pageStyle:i,navBg:l}=(0,s.useThemeCustomizer)(),{activeServer:o}=(0,y.useWorkspace)(),[d,c]=(0,a.useState)(!0);(0,a.useEffect)(()=>{"false"===localStorage.getItem("sidebar-collapsed")&&c(!1)},[]);let p=()=>{let e=!d;c(e),localStorage.setItem("sidebar-collapsed",String(e))},f=l?E[l]:void 0;return(0,t.jsx)(h.TooltipProvider,{delay:150,children:(0,t.jsxs)("aside",{className:(0,x.cn)("sticky top-0 hidden h-screen shrink-0 flex-col self-start py-4 md:flex transition-all duration-300 ease-in-out",d?"w-18":"w-60",f?"":"bg-background","fused"===i?"border-r border-border":""),style:f?{backgroundColor:f}:void 0,children:[(0,t.jsx)("div",{className:(0,x.cn)("flex w-full items-center mb-6",d?"justify-center px-3":"justify-between px-4"),children:d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:p,"aria-label":"Expand sidebar",className:"flex size-10 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105"}),children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)(h.TooltipContent,{side:"right",sideOffset:10,children:"Expand sidebar"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.default,{href:"/chat",className:"flex items-center gap-2.5",children:[(0,t.jsx)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Larkup"})]}),(0,t.jsx)("button",{onClick:p,className:"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors","aria-label":"Collapse sidebar",children:(0,t.jsx)(u.ChevronLeft,{className:"size-3.5"})})]})}),(0,t.jsx)("nav",{className:(0,x.cn)("flex flex-1 flex-col w-full",d?"items-center px-3 gap-3":"px-3 gap-1.5"),children:D.map(s=>{let a=s.icon,r=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)(n.default,{href:s.href,"aria-current":r?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,x.cn)("group relative flex size-10 items-center justify-center rounded-xl transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"bg-[#F0F0F0] text-foreground":"text-muted-foreground hover:bg-[#EBEBEB] hover:text-foreground")}),children:(0,t.jsx)(a,{className:"size-4.5",strokeWidth:r?2.25:1.75})}),(0,t.jsx)(h.TooltipContent,{side:"right",sideOffset:10,children:s.label})]},s.id):(0,t.jsxs)(n.default,{href:s.href,"aria-current":r?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,x.cn)("group relative flex items-center gap-3 rounded-xl px-3 py-2.5 text-[13px] font-medium transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"bg-[#F0F0F0] text-foreground":"text-muted-foreground hover:bg-[#EBEBEB] hover:text-foreground"),children:[(0,t.jsx)(a,{className:"size-4.5 shrink-0",strokeWidth:r?2.25:1.75}),(0,t.jsx)("span",{className:"truncate",children:s.label})]},s.id)})}),(0,t.jsx)("div",{className:(0,x.cn)("w-full pt-3",d?"px-2":"px-3"),children:d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:p,className:"flex w-full items-center justify-center py-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors"}),children:(0,t.jsxs)("div",{className:"relative size-8 rounded-lg border border-border bg-card flex items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:[(0,t.jsx)(m.Server,{className:"size-4"}),(0,t.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-2.5",children:o?.running?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-green-500 border border-card"})]}):(0,t.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-gray-500 border border-card"})})]})}),(0,t.jsxs)(h.TooltipContent,{side:"right",sideOffset:10,children:[o?.name??"No server"," (",o?.running?"Live":"Offline",")"]})]}):(0,t.jsx)(S,{})})]})})}let I={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},M=[{id:"chat",label:"Chat",href:"/chat",icon:i.MessageCircle},{id:"data",label:"Data",href:"/data",icon:l.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function P(){let e=(0,r.usePathname)(),{username:a}=(0,y.useWorkspace)(),{navBg:i}=(0,s.useThemeCustomizer)(),l=i?I[i]:void 0;return(0,t.jsx)(h.TooltipProvider,{delay:150,children:(0,t.jsxs)("header",{className:(0,x.cn)("sticky top-0 z-50 flex h-14 shrink-0 items-center gap-6 border-b border-border px-4 md:px-6",l?"":"bg-[#F5F5F4]"),style:l?{backgroundColor:l}:void 0,children:[(0,t.jsxs)(n.default,{href:"/chat","aria-label":"larkup home",className:"flex items-center gap-2.5 shrink-0",children:[(0,t.jsx)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)("span",{className:"font-semibold tracking-tight text-foreground hidden sm:inline-block",children:"Larkup"})]}),(0,t.jsx)("nav",{className:"flex h-full items-center gap-1",children:M.map(s=>{let a=s.icon,r=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return(0,t.jsxs)(n.default,{href:s.href,"aria-current":r?"page":void 0,className:(0,x.cn)("group relative flex items-center gap-2 h-full px-3 text-[13px] font-medium transition-colors outline-none",r?"text-primary":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(a,{className:"size-[16px]",strokeWidth:r?2.25:1.75}),(0,t.jsx)("span",{className:"hidden md:inline",children:s.label}),(0,t.jsx)("span",{className:(0,x.cn)("absolute bottom-0 left-2 right-2 h-[2px] rounded-full bg-primary transition-opacity",r?"opacity-100":"opacity-0")})]},s.id)})}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(S,{}),a&&(0,t.jsxs)("span",{className:"hidden text-sm text-muted-foreground md:block",children:["Hi, ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:a})]})]})]})})}let _=(0,d.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var B=e.i(570764),O=e.i(18928),O=O,L=e.i(562949),R=e.i(741445),V=e.i(924911),$=e.i(300033),W=e.i(856474),K=e.i(266741);let U=["vercel_ai_gateway","openai","google","mistral","custom"];function H(){let{setUsername:e,createServer:s,refresh:n}=(0,y.useWorkspace)(),i=(0,r.useRouter)(),[l,o]=(0,a.useState)(""),[d,c]=(0,a.useState)("vercel_ai_gateway"),[u,m]=(0,a.useState)(""),[x,h]=(0,a.useState)(null),[p,f]=(0,a.useState)("vercel_ai_gateway"),[b,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(null),[F,S]=(0,a.useState)(!1),[z,E]=(0,a.useState)(!1),[D,T]=(0,a.useState)(!1),[I,M]=(0,a.useState)(!1),[P,H]=(0,a.useState)(null),q="custom"===d,Y="custom"===p,J=z||q||d!==p?b:u,G=async()=>{S(!0);try{let t=await fetch("/api/config"),{config:a}=await t.json(),r={...a};q&&x?(r.embeddingProvider="custom",r.embeddingModelId=`custom:${x.modelName}`,r.embeddingApiKey=x.apiKey||void 0,r.customEmbeddings=[x]):(r.embeddingProvider=d,r.embeddingApiKey=u),z?Y&&v?(r.chatProvider="custom",r.chatModelId=`custom:${v.modelName}`,r.chatApiKey=v.apiKey||void 0,r.customChatModels=[v]):(r.chatProvider=p,r.chatApiKey=J):q&&x||(r.chatProvider=d,r.chatApiKey=u);let o=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embeddingProvider:r.embeddingProvider,embeddingApiKey:r.embeddingApiKey,embeddingModelId:r.embeddingModelId,customEmbeddings:r.customEmbeddings,chatProvider:r.chatProvider,chatApiKey:r.chatApiKey,chatModelId:r.chatModelId,customChatModels:r.customChatModels})});if(!o.ok){let e=await o.json();w.toast.error(e.error||"Verification failed — please check your API key.",{duration:8e3}),S(!1);return}l.trim()&&await e(l.trim()),await s("my-larkup"),await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n(),i.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},X=async()=>{S(!0);try{l.trim()&&await e(l.trim()),await s("my-larkup"),n(),i.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},Z=(e,s)=>(0,t.jsxs)($.Select,{value:e,onValueChange:e=>{var t;"custom"===(t=e??"")?("embedding"===s?c("custom"):f("custom"),H(s)):"embedding"===s?(c(t),h(null),!z&&f(t)):(f(t),N(null))},children:[(0,t.jsx)($.SelectTrigger,{className:"w-full bg-white/90 hover:bg-white",children:(0,t.jsx)("span",{className:"flex items-center gap-2",children:W.PROVIDER_META[e]?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W.ProviderIcon,{src:W.PROVIDER_META[e].iconSrc,alt:W.PROVIDER_META[e].label,pillBg:W.PROVIDER_META[e].pillBg,size:16}),W.PROVIDER_META[e].label]}):"Select provider"})}),(0,t.jsx)($.SelectContent,{children:U.map(e=>{let s=W.PROVIDER_META[e];return s?(0,t.jsx)($.SelectItem,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(W.ProviderIcon,{src:s.iconSrc,alt:s.label,pillBg:s.pillBg,size:16}),(0,t.jsxs)("span",{children:[s.label,"vercel_ai_gateway"===e&&" (Recommended)","custom"===e&&" (OpenAI-compatible)"]})]})},e):null})})]}),Q=(e,s)=>(0,t.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 rounded-lg border border-green-200 bg-green-50/50 px-3 py-2",children:[(0,t.jsx)("span",{className:"text-green-600 text-xs",children:"✓"}),(0,t.jsx)("span",{className:"flex-1 truncate text-xs font-medium text-foreground",children:e.modelName}),(0,t.jsx)("button",{type:"button",onClick:()=>H(s),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(g.Pencil,{className:"size-3"})})]});return(0,t.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-background",children:[(0,t.jsxs)("div",{className:"pointer-events-none fixed inset-0 overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute -left-20 -top-20 h-125 w-125 rounded-full bg-stone-200/40 blur-3xl animate-pulse"}),(0,t.jsx)("div",{className:"absolute -bottom-32 -right-32 h-150 w-150 rounded-full bg-amber-100/30 blur-3xl animate-pulse [animation-delay:1s]"})]}),(0,t.jsx)("div",{className:"relative z-10 flex min-h-full w-full flex-col items-center justify-center px-6 py-12",children:(0,t.jsxs)("div",{className:"flex w-full max-w-lg flex-col items-center gap-8 animate-fade-up",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[(0,t.jsx)("div",{className:"flex size-14 items-center justify-center rounded-xl bg-primary text-primary-foreground ",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-8",alt:"Larkup"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Welcome to Larkup"}),(0,t.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Let's set up your AI models. You can change these later in Settings."})]})]}),(0,t.jsxs)("div",{className:"w-full space-y-5 rounded-2xl p-6 backdrop-blur-xl",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Your Name (Optional)"}),(0,t.jsx)(V.Input,{value:l,onChange:e=>o(e.target.value),placeholder:"How should we call you?",className:"bg-background/50"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Embedding Provider"}),Z(d,"embedding"),q&&x&&Q(x,"embedding"),q&&!x&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!q&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("label",{className:"text-xs font-medium text-foreground",children:["API Key",!z&&(0,t.jsxs)("span",{className:"text-muted-foreground font-normal",children:[" ","(used for both embedding & chat)"]})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(V.Input,{type:D?"text":"password",value:u,onChange:e=>m(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,t.jsx)("button",{type:"button","aria-label":D?"Hide API key":"Show API key",onClick:()=>T(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:D?(0,t.jsx)(R.EyeOff,{className:"size-4"}):(0,t.jsx)(L.Eye,{className:"size-4"})})]})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>E(!z),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[z?(0,t.jsx)(O.default,{className:"size-3.5"}):(0,t.jsx)(B.ChevronDown,{className:"size-3.5"}),"Use a different chat model"]}),z&&(0,t.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat Provider"}),Z(p,"chat"),Y&&v&&Q(v,"chat"),Y&&!v&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!Y&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat API Key"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(V.Input,{type:I?"text":"password",value:b,onChange:e=>j(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,t.jsx)("button",{type:"button","aria-label":I?"Hide chat API key":"Show chat API key",onClick:()=>M(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:I?(0,t.jsx)(R.EyeOff,{className:"size-4"}):(0,t.jsx)(L.Eye,{className:"size-4"})})]})]})]}),(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"More providers and fine-grained model selection available in Settings → AI Models."}),(0,t.jsxs)("div",{className:"pt-2 flex gap-3",children:[(0,t.jsx)(C.Button,{variant:"outline",className:"flex-1",onClick:X,disabled:F,children:"Skip for now"}),(0,t.jsx)(C.Button,{className:"flex-1",onClick:G,disabled:F||!(()=>{if(q){if(!x)return!1}else if(!u)return!1;if(z){if(Y){if(!v)return!1}else if(!J)return!1}return!0})(),children:F?(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}):(0,t.jsxs)(t.Fragment,{children:["Continue ",(0,t.jsx)(_,{className:"ml-1.5 size-4"})]})})]})]})]})}),(0,t.jsx)(A.Dialog,{open:null!==P,onOpenChange:e=>{e||("embedding"!==P||x||c("vercel_ai_gateway"),"chat"!==P||v||f("vercel_ai_gateway"),H(null))},children:(0,t.jsxs)(A.DialogContent,{className:"max-w-xl",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsxs)(A.DialogTitle,{children:["Custom ","embedding"===P?"Embedding":"Chat"," Model"]}),(0,t.jsxs)(A.DialogDescription,{children:["Connect an OpenAI-compatible ","embedding"===P?"embedding":"chat"," ","model. Test the connection before adding."]})]}),P&&(0,t.jsx)(K.CustomModelForm,{type:P,onSave:e=>{"embedding"===P?(h(e),c("custom")):"chat"===P&&(N(e),f("custom")),H(null)},onCancel:()=>{"embedding"!==P||x||c("vercel_ai_gateway"),"chat"!==P||v||f("vercel_ai_gateway"),H(null)}})]})})]})}let q={"panel-default":"#FAFAFA","panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"};e.s(["ClientLayoutWrapper",0,function({children:e}){let{pageStyle:a,panelBg:n,layout:i}=(0,s.useThemeCustomizer)(),l=(0,r.usePathname)(),o=l?.includes("/chat"),{isFirstRun:d,isLoading:c}=(0,y.useWorkspace)(),u=q[n],m=u?{backgroundColor:u}:void 0;return!c&&d?(0,t.jsx)(H,{}):c?(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsx)("div",{className:"size-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):"topnav"===i?(0,t.jsxs)("div",{className:"flex flex-col h-screen overflow-hidden",children:[(0,t.jsx)(P,{}),(0,t.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full flex flex-col bg-background text-foreground",style:m,children:(0,t.jsx)("div",{className:(0,x.cn)("flex-1 min-h-0",o||l?.includes("/settings")||l?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||l?.includes("/settings")||l?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]}):(0,t.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,t.jsx)(T,{}),(0,t.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,t.jsx)("div",{className:"fused"===a?"h-screen flex flex-col bg-background text-foreground overflow-hidden":"h-screen flex flex-col md:rounded-l-2xl border-l border-border bg-panel text-panel-foreground overflow-hidden",style:m,children:(0,t.jsx)("div",{className:(0,x.cn)("flex-1 min-h-0",o||l?.includes("/settings")||l?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||l?.includes("/settings")||l?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]})}],266186)},953159,e=>{"use strict";var t=e.i(523829),s=e.i(842646),a=e.i(501706),n=e.i(178328),r=e.i(866657),i=e.i(874822);let l=(0,i.default)("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);var o=e.i(871942);let d=(0,i.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var c=e.i(518864),u=e.i(702938);let m=(0,i.default)("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);var x=e.i(743118),h=e.i(714809),p=e.i(241491),f=e.i(539352);let g=(0,i.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);var b=e.i(682458),j=e.i(161351),v=e.i(466691),y=e.i(861947),N=e.i(323621),w=e.i(524365),k=e.i(534792),C=e.i(746632),A=e.i(878835),F=e.i(282879);let S=e=>fetch(e).then(e=>e.json()),z=["chunking","embedding","upserting"];function E({open:e,onOpenChange:i,trigger:l}){let[o,d]=(0,n.useState)(!1),[c,u]=(0,n.useState)(!1),m=void 0!==e,g=m?e:c,b=m&&i?i:u,{data:j,isLoading:y,mutate:N}=(0,s.default)("/api/index",S,{refreshInterval:e=>e?.run&&z.includes(e.run.status)?1e3:0}),T=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{let e=j?.run?.warning;e&&e!==T.current?C.toast.warning(e,{id:"rate-limit-warning",duration:7e4}):!e&&T.current&&(C.toast.dismiss("rate-limit-warning"),C.toast.success("Rate limit resolved — resuming indexing.",{duration:3e3})),T.current=e},[j?.run?.warning]);let[M,P]=(0,n.useState)(!1);async function _(e=!1){d(!0);try{let t=await fetch("/api/index",{method:"POST",body:JSON.stringify({incremental:e}),headers:{"Content-Type":"application/json"}}),s=await t.json();if(!t.ok)return void C.toast.error(s.error??"Could not start indexing.");C.toast.success("Indexing started."),N()}catch{C.toast.error("Could not start indexing.")}finally{d(!1)}}async function B(){d(!0);try{if(!(await fetch("/api/index",{method:"DELETE"})).ok)return void C.toast.error("Could not cancel indexing.");C.toast.success("Indexing cancelled."),N()}catch{C.toast.error("Could not cancel indexing.")}finally{d(!1)}}return(0,n.useEffect)(()=>{let e=j?.run?.status;e&&z.includes(e)?P(!0):M&&"completed"===e&&(P(!1),b(!1),C.toast.success("Indexing completed successfully!"))},[j?.run?.status,M,b]),(0,t.jsxs)(F.Dialog,{open:g,onOpenChange:b,children:[l?(0,t.jsx)(F.DialogTrigger,{render:(0,n.isValidElement)(l)?l:(0,t.jsx)("button",{children:l})}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j?.run?.status==="completed"&&(0,t.jsxs)(A.AlertDialog,{children:[(0,t.jsx)(A.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o,variant:"outline",children:[(0,t.jsx)(f.RotateCcw,{className:"size-4 mr-2"}),"Re-Index Data"]})}),(0,t.jsxs)(A.AlertDialogContent,{children:[(0,t.jsxs)(A.AlertDialogHeader,{children:[(0,t.jsx)(A.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(A.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(A.AlertDialogFooter,{children:[(0,t.jsx)(A.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(A.AlertDialogAction,{onClick:()=>{b(!0),_(!1)},children:"Continue"})]})]})]}),(0,t.jsx)(F.DialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j?.ready||j?.unindexedCount===0,children:[(0,t.jsx)(h.Layers,{className:"size-4 mr-2"}),"Index Data"]})})]}),(0,t.jsxs)(F.DialogContent,{className:"max-w-2xl max-h-[90vh] overflow-y-auto ",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsx)(F.DialogTitle,{children:"Index Data"}),(0,t.jsx)(F.DialogDescription,{children:"Chunk, embed, and index into your selected vector database."})]}),y||!j?(0,t.jsx)("div",{className:"py-6",children:(0,t.jsx)(k.Skeleton,{className:"h-40 w-full"})}):(0,t.jsxs)("div",{className:"space-y-6 py-4",children:[(0,t.jsx)(D,{config:j.config,docCount:j.docCount,charCount:j.charCount}),!j.ready&&(0,t.jsxs)(w.Alert,{variant:"default",children:[(0,t.jsx)(r.AlertTriangle,{className:"size-4 text-orange-500!"}),(0,t.jsx)(w.AlertTitle,{className:"text-orange-500!",children:"Not ready to index"}),(0,t.jsx)(w.AlertDescription,{children:(0,t.jsx)("ul",{className:"list-disc pl-4",children:j.blockers.map(e=>(0,t.jsx)("li",{children:e},e))})})]}),(0,t.jsx)(I,{run:j.run,running:!!(j.run&&z.includes(j.run.status))}),j.ready&&!j.run&&(0,t.jsxs)(w.Alert,{children:[(0,t.jsx)(x.Info,{className:"size-4 text-blue-500!"}),(0,t.jsx)(w.AlertTitle,{className:"text-blue-600 dark:text-blue-400",children:"Before you start indexing"}),(0,t.jsxs)(w.AlertDescription,{className:"text-muted-foreground space-y-1",children:[(0,t.jsxs)("p",{children:["Once indexing begins, two settings become"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:"locked"})," to the existing index:"]}),(0,t.jsxs)("ul",{className:"list-disc pl-4 space-y-0.5",children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Embedding model"})," — you can swap to any model with the"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:"same vector dimensions"}),", but switching to a model with different dimensions will require a full re-index."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Vector store"})," — changing the store after indexing requires starting fresh."]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)(v.Button,{onClick:()=>_(j.run?.status==="completed"),disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o||j.run?.status==="completed"&&0===j.unindexedCount,size:"lg",children:[j.run&&z.includes(j.run.status)||o?(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin mr-2"}):(0,t.jsx)(p.Play,{className:"size-4 mr-2"}),j.run&&z.includes(j.run.status)?"Indexing…":o?"Starting…":j.run?.status==="completed"?`Index new documents (${j.unindexedCount})`:`Start indexing (${j.unindexedCount})`]}),j.run?.status==="completed"&&!(j.run&&z.includes(j.run.status))&&(0,t.jsxs)(A.AlertDialog,{children:[(0,t.jsx)(A.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{variant:"outline",size:"lg",disabled:o,children:[(0,t.jsx)(f.RotateCcw,{className:"size-4 mr-2"}),"Re-Index All"]})}),(0,t.jsxs)(A.AlertDialogContent,{children:[(0,t.jsxs)(A.AlertDialogHeader,{children:[(0,t.jsx)(A.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(A.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(A.AlertDialogFooter,{children:[(0,t.jsx)(A.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(A.AlertDialogAction,{onClick:()=>{b(!0),_(!1)},children:"Continue"})]})]})]}),!!(j.run&&z.includes(j.run.status))&&(0,t.jsx)(v.Button,{onClick:B,disabled:o,size:"lg",variant:"destructive",children:"Cancel"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"lg",onClick:()=>b(!1),children:"Close"})]})]})]})]})}function D({config:e,docCount:s,charCount:a}){let n=(0,b.getEmbeddingModel)(e.embeddingModelId),r=(0,j.getVectorStore)(e.vectorStore),i=[{icon:d,label:"Embedding model",value:n?.label??e.embeddingModelId,hint:n?`${n.dimensions} dims`:void 0},{icon:c.Database,label:"Vector store",value:r?.label??e.vectorStore},{icon:l,label:"Index type",value:e.indexType.toUpperCase()},{icon:g,label:"Chunking",value:`${e.chunking.chunkSize} / ${e.chunking.chunkOverlap}`,hint:"size / overlap"},{icon:u.FileText,label:"Corpus",value:`${s.toLocaleString()} docs`,hint:`${a.toLocaleString()} chars`}];return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold mb-4",children:[(0,t.jsx)(h.Layers,{className:"size-4 text-primary"}),"Index configuration"]}),(0,t.jsx)("dl",{className:"grid grid-cols-2 gap-x-6 gap-y-5 sm:grid-cols-3",children:i.map(e=>(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("dt",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(e.icon,{className:"size-3.5"}),e.label]}),(0,t.jsxs)("dd",{className:"text-sm font-medium leading-tight",children:[e.value,e.hint&&(0,t.jsx)("span",{className:"ml-1.5 font-mono text-[11px] font-normal text-muted-foreground",children:e.hint})]})]},e.label))})]})}let T={idle:{label:"Idle"},chunking:{label:"Chunking",phase:"Splitting documents into chunks"},embedding:{label:"Embedding",phase:"Generating vector embeddings"},upserting:{label:"Storing",phase:"Writing vectors to the store"},completed:{label:"Completed"},failed:{label:"Failed"}};function I({run:e,running:s}){if(!e)return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground flex flex-col items-center justify-center gap-1 py-8 text-center",children:[(0,t.jsx)(m,{className:"mb-1 size-6 text-muted-foreground/60"}),(0,t.jsx)("p",{className:"text-sm font-medium",children:"No index built yet"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Build a Larkup index to embed your corpus and make it searchable."})]});let n=T[e.status],i=e.totalChunks>0?Math.round(e.processedChunks/e.totalChunks*100):5*!!s;return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4 space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold",children:["completed"===e.status?(0,t.jsx)(o.CheckCircle2,{className:"size-4 text-primary"}):"failed"===e.status?(0,t.jsx)(r.AlertTriangle,{className:"size-4 text-destructive"}):(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin text-primary"}),n.label]}),(0,t.jsx)(P,{status:e.status})]}),"failed"===e.status?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:n.phase??"Done"}),(0,t.jsxs)("span",{className:"font-mono tabular-nums",children:[e.processedChunks.toLocaleString(),e.totalChunks>0&&` / ${e.totalChunks.toLocaleString()}`," chunks"]})]}),(0,t.jsx)(y.Progress,{value:i,className:"**:data-[slot=progress-indicator]:bg-green-600"})]}),(0,t.jsxs)("dl",{className:"grid grid-cols-2 gap-4 pt-1 sm:grid-cols-4",children:[(0,t.jsx)(M,{label:"Documents",value:e.docCount.toLocaleString()}),(0,t.jsx)(M,{label:"Chunks",value:e.totalChunks.toLocaleString()}),(0,t.jsx)(M,{label:"Dimensions",value:e.dimensions?e.dimensions.toLocaleString():"—"}),(0,t.jsx)(M,{label:"Duration",value:e.durationMs?`${(e.durationMs/1e3).toFixed(1)}s`:s?"running…":"—"})]})]})]})}function M({label:e,value:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("dt",{className:"text-xs text-muted-foreground",children:e}),(0,t.jsx)("dd",{className:"font-mono text-sm tabular-nums",children:s})]})}function P({status:e}){return"completed"===e?(0,t.jsx)(N.Badge,{className:"bg-primary/12 text-primary hover:bg-primary/12",children:"Ready"}):"failed"===e?(0,t.jsx)(N.Badge,{variant:"destructive",children:"Failed"}):z.includes(e)?(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-green-600",children:[(0,t.jsxs)("span",{className:"relative flex size-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-600 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-600"})]}),"Live"]}):null}let _=e=>fetch(e).then(e=>e.json()),B=["chunking","embedding","upserting"];e.s(["GlobalIndexProgress",0,function(){let{data:e}=(0,s.default)("/api/index",_,{refreshInterval:e=>e?.run&&B.includes(e.run.status)?1e3:0});if(!(e?.run&&B.includes(e.run.status))||!e?.run)return null;let{run:n}=e,r=n.totalChunks>0?Math.round(n.processedChunks/n.totalChunks*100):5;return(0,t.jsx)("div",{className:"fixed bottom-6 right-6 z-50",children:(0,t.jsx)(E,{trigger:(0,t.jsxs)("button",{className:"flex items-center gap-3 rounded-full border bg-background px-4 py-2 text-sm font-medium transition-all hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin text-primary"}),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:"Storing..."}),(0,t.jsxs)("span",{className:"leading-none",children:[r,"%"]})]})]})})})}],953159)},232295,e=>{"use strict";var t=e.i(199910),s=e.i(523829),a=e.i(178328),n=e.i(960198),r=e.i(133058),i=e.i(736484),l=e.i(417368),o=e.i(466691);let d="larkup-update-dismissed",c={docker:"docker compose pull && docker compose up -d",npm:"larkup update"};e.s(["UpdateBanner",0,function(){let[u,m]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[p,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),j="0.1.39",v="__TAURI__"in window?"desktop":"true"===t.default.env.NEXT_PUBLIC_DOCKER_ENV||"true"===t.default.env.NEXT_PUBLIC_RUNNING_IN_DOCKER?"docker":"npm";(0,a.useEffect)(()=>{if(function(){try{let e=localStorage.getItem(d);if(!e)return!1;let{timestamp:t}=JSON.parse(e);return Date.now()-t<864e5}catch{return!1}}())return;let e=new AbortController;return fetch("https://larkup.de/api/version",{signal:e.signal,cache:"no-store"}).then(e=>e.json()).then(e=>{e.version&&function(e,t){let s=e.replace(/^v/,"").split(".").map(Number),a=t.replace(/^v/,"").split(".").map(Number);for(let e=0;e<3;e++){let t=s[e]||0,n=a[e]||0;if(t>n)return 1;if(t<n)return -1}return 0}(e.version,j)>0&&(m(e.version),h(!0))}).catch(()=>{}),()=>e.abort()},[j]);let y=async()=>{if("desktop"===v){f(!0);try{let{check:t}=await e.A(963347),{relaunch:s}=await e.A(995308),a=await t();a?(await a.downloadAndInstall(),await s()):f(!1)}catch(e){console.error("Auto-update failed:",e),f(!1),window.open("https://larkup.de/download","_blank")}}else try{await navigator.clipboard.writeText(c[v]),b(!0),window.setTimeout(()=>b(!1),2e3)}catch(e){console.error("Could not copy update command:",e)}};return x&&u?(0,s.jsx)("div",{role:"status","aria-live":"polite",className:"relative z-50 border-b border-border bg-background px-3 py-2 text-foreground sm:px-4",children:(0,s.jsxs)("div",{className:"mx-auto flex min-h-7 max-w-screen-2xl items-center gap-2.5",children:[(0,s.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background",children:(0,s.jsx)(n.ArrowUp,{className:"size-3.5","aria-hidden":"true"})}),(0,s.jsxs)("p",{className:"min-w-0 text-xs sm:text-sm",children:[(0,s.jsxs)("span",{className:"font-medium",children:["Larkup v",u," is available."]})," ",(0,s.jsxs)("span",{className:"hidden text-muted-foreground sm:inline",children:["You're using v",j,"."]})]}),"desktop"!==v&&(0,s.jsx)("code",{className:"ml-auto hidden max-w-[38rem] truncate rounded-[5px] border border-border bg-muted/40 px-2 py-1 font-mono text-[11px] text-muted-foreground lg:block",children:c[v]}),(0,s.jsx)(o.Button,{type:"button",variant:"desktop"===v?"default":"outline",size:"xs",onClick:y,disabled:p,"aria-label":"desktop"===v?"Update Larkup now":"Copy update command",className:"desktop"===v?"ml-auto":"ml-auto lg:ml-0",children:"desktop"===v?p?"Updating...":"Update now":g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.Check,{"aria-hidden":"true"}),"Copied"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Copy,{"aria-hidden":"true"}),"Copy command"]})}),(0,s.jsx)(o.Button,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>{try{localStorage.setItem(d,JSON.stringify({timestamp:Date.now()}))}catch{}h(!1)},"aria-label":"Dismiss update notification",title:"Remind me tomorrow",children:(0,s.jsx)(l.X,{"aria-hidden":"true"})})]})}):null}])}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,721606,e=>{"use strict";var t=e.i(199910),s=e.i(178328),a=e.i(732684);function n(){return"u">typeof window}function r(){return"production"}function i(){return"development"===((n()?window.vam:r())||"production")}function l(e){return RegExp(`/${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?=[/?#]|$)`)}function o(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`/${e}`}function d(e){return(0,s.useEffect)(()=>{var t;e.beforeSend&&(null==(t=window.va)||t.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]),(0,s.useEffect)(()=>{!function(e={debug:!0},t){var s;if(!n())return;let{beforeSend:a,src:l,dataset:d}=function(e,t){var s,a;let n=e;if(t)try{n={...null==(s=JSON.parse(t))?void 0:s.analytics,...e}}catch{}!function(e="auto"){if("auto"===e){window.vam=r();return}window.vam=e}(n.mode);let l={sdkn:"@vercel/analytics"+(n.framework?`/${n.framework}`:""),sdkv:"2.0.1"};return n.disableAutoTrack&&(l.disableAutoTrack="1"),n.viewEndpoint&&(l.viewEndpoint=o(n.viewEndpoint)),n.eventEndpoint&&(l.eventEndpoint=o(n.eventEndpoint)),n.sessionEndpoint&&(l.sessionEndpoint=o(n.sessionEndpoint)),i()&&!1===n.debug&&(l.debug="false"),n.dsn&&(l.dsn=n.dsn),n.endpoint?l.endpoint=n.endpoint:n.basePath&&(l.endpoint=o(`${n.basePath}/insights`)),{beforeSend:n.beforeSend,src:(a=n).scriptSrc?o(a.scriptSrc):i()?"https://va.vercel-scripts.com/v1/script.debug.js":a.basePath?o(`${a.basePath}/insights/script.js`):"/_vercel/insights/script.js",dataset:l}}(e,t);if(window.va||(window.va=function(...e){window.vaq||(window.vaq=[]),window.vaq.push(e)}),a&&(null==(s=window.va)||s.call(window,"beforeSend",a)),document.head.querySelector(`script[src*="${l}"]`))return;let c=document.createElement("script");for(let[e,t]of(c.src=l,Object.entries(d)))c.dataset[e]=t;c.defer=!0,c.onerror=()=>{let e=i()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${l}. ${e}`)},document.head.appendChild(c)}({framework:e.framework||"react",basePath:e.basePath??function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}(),...void 0!==e.route&&{disableAutoTrack:!0},...e},e.configString??function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}())},[]),(0,s.useEffect)(()=>{e.route&&e.path&&function({route:e,path:t}){var s;null==(s=window.va)||s.call(window,"pageview",{route:e,path:t})}({route:e.route,path:e.path})},[e.route,e.path]),null}function c(e){let n,r,i,{route:o,path:c}=(n=(0,a.useParams)(),r=(0,a.useSearchParams)(),i=(0,a.usePathname)(),n?{route:function(e,t){if(!e||!t)return e;let s=e;try{let e=Object.entries(t);for(let[t,a]of e)if(!Array.isArray(a)){let e=l(a);e.test(s)&&(s=s.replace(e,`/[${t}]`))}for(let[t,a]of e)if(Array.isArray(a)){let e=l(a.join("/"));e.test(s)&&(s=s.replace(e,`/[...${t}]`))}return s}catch{return e}}(i,Object.keys(n).length?n:Object.fromEntries(r.entries())),path:i}:{route:null,path:i});return s.default.createElement(d,{path:c,route:o,...e,basePath:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH}(),configString:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_CLIENT_CONFIG}(),framework:"next"})}e.s(["Analytics",0,function(e){return s.default.createElement(s.Suspense,{fallback:null},s.default.createElement(c,{...e}))}])},7012,e=>{"use strict";var t=e.i(523829),s=e.i(178328),a=(e,t,s,a,n,r,i,l)=>{let o=document.documentElement,d=["light","dark"];function c(t){var s;(Array.isArray(e)?e:[e]).forEach(e=>{let s="class"===e,a=s&&r?n.map(e=>r[e]||e):n;s?(o.classList.remove(...a),o.classList.add(r&&r[t]?r[t]:t)):o.setAttribute(e,t)}),s=t,l&&d.includes(s)&&(o.style.colorScheme=s)}if(a)c(a);else try{let e=localStorage.getItem(t)||s,a=i&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;c(a)}catch(e){}},n=s.createContext(void 0),r={setTheme:e=>{},themes:[]};s.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:l,value:o,themes:d,nonce:c,scriptProps:u})=>{let m=JSON.stringify([n,t,l,e,d,o,r,i]).slice(1,-1);return s.createElement("script",{...u,suppressHydrationWarning:!0,nonce:"u"<typeof window?c:"",dangerouslySetInnerHTML:{__html:`(${a.toString()})(${m})`}})});var i=e.i(746632),l=e.i(795360),l=l,o=e.i(951482),o=o,d=e.i(195300),d=d,c=e.i(909042),c=c,u=e.i(964548),u=u;e.s(["Toaster",0,({...e})=>{var a;let{theme:m="system"}=null!=(a=s.useContext(n))?a:r;return(0,t.jsx)(i.Toaster,{closeButton:!0,theme:m,className:"toaster group z-9999999! ",icons:{success:(0,t.jsx)(l.default,{className:"size-5 text-white",fill:"#10b981"}),info:(0,t.jsx)(o.default,{className:"size-5 text-white",fill:"#3b82f6"}),warning:(0,t.jsx)(d.default,{className:"size-5 text-white",fill:"#f59e0b"}),error:(0,t.jsx)(c.default,{className:"size-5 text-white",fill:"#ef4444"}),loading:(0,t.jsx)(u.default,{className:"size-5 animate-spin text-muted-foreground"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)",zIndex:999999},toastOptions:{classNames:{toast:"group toast items-start group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900 group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:",icon:"mt-0.5",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",success:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",error:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",warning:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",info:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900"}},...e})}],7012)},266186,e=>{"use strict";var t=e.i(523829),s=e.i(82100),a=e.i(178328),n=e.i(334347),r=e.i(732684),i=e.i(301470),l=e.i(518864),o=e.i(487779),d=e.i(874822);let c=(0,d.default)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);var u=e.i(708909),m=e.i(37126),x=e.i(152236),h=e.i(839717),p=e.i(133058);let f=(0,d.default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var g=e.i(980369),b=e.i(379702),j=e.i(885131),v=e.i(440087),y=e.i(624529),N=e.i(874560),w=e.i(746632),k=e.i(501706),C=e.i(466691),A=e.i(282879);function F({target:e,open:s,onOpenChange:n}){let{deleteServer:r}=(0,y.useWorkspace)(),[i,l]=(0,a.useState)(!1);async function o(){if(e){l(!0);try{await r(e.id),w.toast.success(`Deleted "${e.name}".`),n(!1)}catch{w.toast.error("Could not delete the server.")}finally{l(!1)}}}return(0,t.jsx)(A.Dialog,{open:s,onOpenChange:n,children:(0,t.jsxs)(A.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsxs)(A.DialogTitle,{children:["Delete “",e?.name,"”?"]}),(0,t.jsx)(A.DialogDescription,{children:"This permanently removes the server's documents, index, vector data, and generated files. This cannot be undone."})]}),(0,t.jsxs)(A.DialogFooter,{children:[(0,t.jsx)(C.Button,{variant:"outline",onClick:()=>n(!1),disabled:i,children:"Cancel"}),(0,t.jsxs)(C.Button,{variant:"destructive",onClick:()=>void o(),disabled:i,children:[i&&(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}),"Delete server"]})]})]})})}function S(){let{servers:e,activeServer:s,activateServer:n}=(0,y.useWorkspace)(),[r,i]=(0,a.useState)(!1),[l,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(null);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(v.DropdownMenu,{children:[(0,t.jsxs)(v.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-lg border border-border bg-card px-2 py-1.5 text-left transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),children:[(0,t.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-primary/12 text-primary",children:(0,t.jsx)(m.Server,{className:"size-3.5"})}),(0,t.jsx)("span",{className:"flex min-w-0 flex-1 flex-col",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:s?.name??"No server"}),s?.running&&(0,t.jsx)(z,{})]})}),(0,t.jsx)(f,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,t.jsxs)(v.DropdownMenuContent,{align:"start",sideOffset:6,className:"w-(--anchor-width) min-w-[260px]",children:[(0,t.jsxs)(v.DropdownMenuGroup,{children:[(0,t.jsx)(v.DropdownMenuLabel,{children:"Your servers"}),e.map(e=>{let a=e.id===s?.id;return(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>{a||n(e.id)},className:"gap-2",children:[(0,t.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:(0,t.jsx)(m.Server,{className:"size-3.5"})}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"truncate font-medium",children:e.name}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-[11px] text-muted-foreground tabular-nums",children:[(0,t.jsxs)("span",{children:[e.docCount," docs"]}),e.indexed&&(0,t.jsx)("span",{children:"· indexed"}),e.running&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-500",children:[(0,t.jsx)(z,{}),"live"]})]})]}),a&&(0,t.jsx)(p.Check,{className:"size-4 shrink-0 text-primary"})]},e.id)})]}),(0,t.jsx)(v.DropdownMenuSeparator,{}),(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>i(!0),className:"gap-2 h-9",children:[(0,t.jsx)(b.Plus,{className:"size-4"}),"New server"]}),s&&(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>o(s),className:"gap-2 h-9",children:[(0,t.jsx)(g.Pencil,{className:"size-4"}),"Rename current"]}),s&&e.length>1&&(0,t.jsxs)(v.DropdownMenuItem,{variant:"destructive",onClick:()=>c(s),className:"gap-2",children:[(0,t.jsx)(j.Trash2,{className:"size-4"}),"Delete current"]})]})]}),(0,t.jsx)(N.ServerFormDialog,{mode:"create",open:r,onOpenChange:i}),(0,t.jsx)(N.ServerFormDialog,{mode:"rename",target:l,open:null!==l,onOpenChange:e=>!e&&o(null)}),(0,t.jsx)(F,{target:d,open:null!==d,onOpenChange:e=>!e&&c(null)})]})}function z(){return(0,t.jsxs)("span",{className:"relative flex size-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-500"})]})}let E={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},D=[{id:"chat",label:"Chat",href:"/chat",icon:i.MessageCircle},{id:"data",label:"Data",href:"/data",icon:l.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function T(){let e=(0,r.usePathname)(),{pageStyle:i,navBg:l}=(0,s.useThemeCustomizer)(),{activeServer:o}=(0,y.useWorkspace)(),[d,c]=(0,a.useState)(!0);(0,a.useEffect)(()=>{"false"===localStorage.getItem("sidebar-collapsed")&&c(!1)},[]);let p=()=>{let e=!d;c(e),localStorage.setItem("sidebar-collapsed",String(e))},f=l?E[l]:void 0;return(0,t.jsx)(h.TooltipProvider,{delay:150,children:(0,t.jsxs)("aside",{className:(0,x.cn)("sticky top-0 hidden h-screen shrink-0 flex-col self-start py-4 md:flex transition-all duration-300 ease-in-out",d?"w-18":"w-60",f?"":"bg-background","fused"===i?"border-r border-border":""),style:f?{backgroundColor:f}:void 0,children:[(0,t.jsx)("div",{className:(0,x.cn)("flex w-full items-center mb-6",d?"justify-center px-3":"justify-between px-4"),children:d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:p,"aria-label":"Expand sidebar",className:"flex size-10 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105"}),children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)(h.TooltipContent,{side:"right",sideOffset:10,children:"Expand sidebar"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.default,{href:"/chat",className:"flex items-center gap-2.5",children:[(0,t.jsx)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Larkup"})]}),(0,t.jsx)("button",{onClick:p,className:"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors","aria-label":"Collapse sidebar",children:(0,t.jsx)(u.ChevronLeft,{className:"size-3.5"})})]})}),(0,t.jsx)("nav",{className:(0,x.cn)("flex flex-1 flex-col w-full",d?"items-center px-3 gap-3":"px-3 gap-1.5"),children:D.map(s=>{let a=s.icon,r=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)(n.default,{href:s.href,"aria-current":r?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,x.cn)("group relative flex size-10 items-center justify-center rounded-xl transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"bg-[#F0F0F0] text-foreground":"text-muted-foreground hover:bg-[#EBEBEB] hover:text-foreground")}),children:(0,t.jsx)(a,{className:"size-4.5",strokeWidth:r?2.25:1.75})}),(0,t.jsx)(h.TooltipContent,{side:"right",sideOffset:10,children:s.label})]},s.id):(0,t.jsxs)(n.default,{href:s.href,"aria-current":r?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,x.cn)("group relative flex items-center gap-3 rounded-xl px-3 py-2.5 text-[13px] font-medium transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"bg-[#F0F0F0] text-foreground":"text-muted-foreground hover:bg-[#EBEBEB] hover:text-foreground"),children:[(0,t.jsx)(a,{className:"size-4.5 shrink-0",strokeWidth:r?2.25:1.75}),(0,t.jsx)("span",{className:"truncate",children:s.label})]},s.id)})}),(0,t.jsx)("div",{className:(0,x.cn)("w-full pt-3",d?"px-2":"px-3"),children:d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:p,className:"flex w-full items-center justify-center py-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors"}),children:(0,t.jsxs)("div",{className:"relative size-8 rounded-lg border border-border bg-card flex items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:[(0,t.jsx)(m.Server,{className:"size-4"}),(0,t.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-2.5",children:o?.running?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-green-500 border border-card"})]}):(0,t.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-gray-500 border border-card"})})]})}),(0,t.jsxs)(h.TooltipContent,{side:"right",sideOffset:10,children:[o?.name??"No server"," (",o?.running?"Live":"Offline",")"]})]}):(0,t.jsx)(S,{})})]})})}let I={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},M=[{id:"chat",label:"Chat",href:"/chat",icon:i.MessageCircle},{id:"data",label:"Data",href:"/data",icon:l.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function P(){let e=(0,r.usePathname)(),{username:a}=(0,y.useWorkspace)(),{navBg:i}=(0,s.useThemeCustomizer)(),l=i?I[i]:void 0;return(0,t.jsx)(h.TooltipProvider,{delay:150,children:(0,t.jsxs)("header",{className:(0,x.cn)("sticky top-0 z-50 flex h-14 shrink-0 items-center gap-6 border-b border-border px-4 md:px-6",l?"":"bg-[#F5F5F4]"),style:l?{backgroundColor:l}:void 0,children:[(0,t.jsxs)(n.default,{href:"/chat","aria-label":"larkup home",className:"flex items-center gap-2.5 shrink-0",children:[(0,t.jsx)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)("span",{className:"font-semibold tracking-tight text-foreground hidden sm:inline-block",children:"Larkup"})]}),(0,t.jsx)("nav",{className:"flex h-full items-center gap-1",children:M.map(s=>{let a=s.icon,r=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return(0,t.jsxs)(n.default,{href:s.href,"aria-current":r?"page":void 0,className:(0,x.cn)("group relative flex items-center gap-2 h-full px-3 text-[13px] font-medium transition-colors outline-none",r?"text-primary":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(a,{className:"size-[16px]",strokeWidth:r?2.25:1.75}),(0,t.jsx)("span",{className:"hidden md:inline",children:s.label}),(0,t.jsx)("span",{className:(0,x.cn)("absolute bottom-0 left-2 right-2 h-[2px] rounded-full bg-primary transition-opacity",r?"opacity-100":"opacity-0")})]},s.id)})}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(S,{}),a&&(0,t.jsxs)("span",{className:"hidden text-sm text-muted-foreground md:block",children:["Hi, ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:a})]})]})]})})}let _=(0,d.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var B=e.i(570764),O=e.i(18928),O=O,L=e.i(562949),R=e.i(741445),V=e.i(924911),$=e.i(300033),W=e.i(856474),K=e.i(266741);let U=["vercel_ai_gateway","openai","google","mistral","custom"];function H(){let{setUsername:e,createServer:s,refresh:n}=(0,y.useWorkspace)(),i=(0,r.useRouter)(),[l,o]=(0,a.useState)(""),[d,c]=(0,a.useState)("vercel_ai_gateway"),[u,m]=(0,a.useState)(""),[x,h]=(0,a.useState)(null),[p,f]=(0,a.useState)("vercel_ai_gateway"),[b,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(null),[F,S]=(0,a.useState)(!1),[z,E]=(0,a.useState)(!1),[D,T]=(0,a.useState)(!1),[I,M]=(0,a.useState)(!1),[P,H]=(0,a.useState)(null),q="custom"===d,Y="custom"===p,J=z||q||d!==p?b:u,G=async()=>{S(!0);try{let t=await fetch("/api/config"),{config:a}=await t.json(),r={...a};q&&x?(r.embeddingProvider="custom",r.embeddingModelId=`custom:${x.modelName}`,r.embeddingApiKey=x.apiKey||void 0,r.customEmbeddings=[x]):(r.embeddingProvider=d,r.embeddingApiKey=u),z?Y&&v?(r.chatProvider="custom",r.chatModelId=`custom:${v.modelName}`,r.chatApiKey=v.apiKey||void 0,r.customChatModels=[v]):(r.chatProvider=p,r.chatApiKey=J):q&&x||(r.chatProvider=d,r.chatApiKey=u);let o=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embeddingProvider:r.embeddingProvider,embeddingApiKey:r.embeddingApiKey,embeddingModelId:r.embeddingModelId,customEmbeddings:r.customEmbeddings,chatProvider:r.chatProvider,chatApiKey:r.chatApiKey,chatModelId:r.chatModelId,customChatModels:r.customChatModels})});if(!o.ok){let e=await o.json();w.toast.error(e.error||"Verification failed — please check your API key.",{duration:8e3}),S(!1);return}l.trim()&&await e(l.trim()),await s("my-larkup"),await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n(),i.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},X=async()=>{S(!0);try{l.trim()&&await e(l.trim()),await s("my-larkup"),n(),i.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},Z=(e,s)=>(0,t.jsxs)($.Select,{value:e,onValueChange:e=>{var t;"custom"===(t=e??"")?("embedding"===s?c("custom"):f("custom"),H(s)):"embedding"===s?(c(t),h(null),!z&&f(t)):(f(t),N(null))},children:[(0,t.jsx)($.SelectTrigger,{className:"w-full bg-white/90 hover:bg-white",children:(0,t.jsx)("span",{className:"flex items-center gap-2",children:W.PROVIDER_META[e]?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W.ProviderIcon,{src:W.PROVIDER_META[e].iconSrc,alt:W.PROVIDER_META[e].label,pillBg:W.PROVIDER_META[e].pillBg,size:16}),W.PROVIDER_META[e].label]}):"Select provider"})}),(0,t.jsx)($.SelectContent,{children:U.map(e=>{let s=W.PROVIDER_META[e];return s?(0,t.jsx)($.SelectItem,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(W.ProviderIcon,{src:s.iconSrc,alt:s.label,pillBg:s.pillBg,size:16}),(0,t.jsxs)("span",{children:[s.label,"vercel_ai_gateway"===e&&" (Recommended)","custom"===e&&" (OpenAI-compatible)"]})]})},e):null})})]}),Q=(e,s)=>(0,t.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 rounded-lg border border-green-200 bg-green-50/50 px-3 py-2",children:[(0,t.jsx)("span",{className:"text-green-600 text-xs",children:"✓"}),(0,t.jsx)("span",{className:"flex-1 truncate text-xs font-medium text-foreground",children:e.modelName}),(0,t.jsx)("button",{type:"button",onClick:()=>H(s),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(g.Pencil,{className:"size-3"})})]});return(0,t.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-background",children:[(0,t.jsxs)("div",{className:"pointer-events-none fixed inset-0 overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute -left-20 -top-20 h-125 w-125 rounded-full bg-stone-200/40 blur-3xl animate-pulse"}),(0,t.jsx)("div",{className:"absolute -bottom-32 -right-32 h-150 w-150 rounded-full bg-amber-100/30 blur-3xl animate-pulse [animation-delay:1s]"})]}),(0,t.jsx)("div",{className:"relative z-10 flex min-h-full w-full flex-col items-center justify-center px-6 py-12",children:(0,t.jsxs)("div",{className:"flex w-full max-w-lg flex-col items-center gap-8 animate-fade-up",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[(0,t.jsx)("div",{className:"flex size-14 items-center justify-center rounded-xl bg-primary text-primary-foreground ",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-8",alt:"Larkup"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Welcome to Larkup"}),(0,t.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Let's set up your AI models. You can change these later in Settings."})]})]}),(0,t.jsxs)("div",{className:"w-full space-y-5 rounded-2xl p-6 backdrop-blur-xl",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Your Name (Optional)"}),(0,t.jsx)(V.Input,{value:l,onChange:e=>o(e.target.value),placeholder:"How should we call you?",className:"bg-background/50"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Embedding Provider"}),Z(d,"embedding"),q&&x&&Q(x,"embedding"),q&&!x&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!q&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("label",{className:"text-xs font-medium text-foreground",children:["API Key",!z&&(0,t.jsxs)("span",{className:"text-muted-foreground font-normal",children:[" ","(used for both embedding & chat)"]})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(V.Input,{type:D?"text":"password",value:u,onChange:e=>m(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,t.jsx)("button",{type:"button","aria-label":D?"Hide API key":"Show API key",onClick:()=>T(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:D?(0,t.jsx)(R.EyeOff,{className:"size-4"}):(0,t.jsx)(L.Eye,{className:"size-4"})})]})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>E(!z),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[z?(0,t.jsx)(O.default,{className:"size-3.5"}):(0,t.jsx)(B.ChevronDown,{className:"size-3.5"}),"Use a different chat model"]}),z&&(0,t.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat Provider"}),Z(p,"chat"),Y&&v&&Q(v,"chat"),Y&&!v&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!Y&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat API Key"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(V.Input,{type:I?"text":"password",value:b,onChange:e=>j(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,t.jsx)("button",{type:"button","aria-label":I?"Hide chat API key":"Show chat API key",onClick:()=>M(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:I?(0,t.jsx)(R.EyeOff,{className:"size-4"}):(0,t.jsx)(L.Eye,{className:"size-4"})})]})]})]}),(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"More providers and fine-grained model selection available in Settings → AI Models."}),(0,t.jsxs)("div",{className:"pt-2 flex gap-3",children:[(0,t.jsx)(C.Button,{variant:"outline",className:"flex-1",onClick:X,disabled:F,children:"Skip for now"}),(0,t.jsx)(C.Button,{className:"flex-1",onClick:G,disabled:F||!(()=>{if(q){if(!x)return!1}else if(!u)return!1;if(z){if(Y){if(!v)return!1}else if(!J)return!1}return!0})(),children:F?(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}):(0,t.jsxs)(t.Fragment,{children:["Continue ",(0,t.jsx)(_,{className:"ml-1.5 size-4"})]})})]})]})]})}),(0,t.jsx)(A.Dialog,{open:null!==P,onOpenChange:e=>{e||("embedding"!==P||x||c("vercel_ai_gateway"),"chat"!==P||v||f("vercel_ai_gateway"),H(null))},children:(0,t.jsxs)(A.DialogContent,{className:"max-w-xl",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsxs)(A.DialogTitle,{children:["Custom ","embedding"===P?"Embedding":"Chat"," Model"]}),(0,t.jsxs)(A.DialogDescription,{children:["Connect an OpenAI-compatible ","embedding"===P?"embedding":"chat"," ","model. Test the connection before adding."]})]}),P&&(0,t.jsx)(K.CustomModelForm,{type:P,onSave:e=>{"embedding"===P?(h(e),c("custom")):"chat"===P&&(N(e),f("custom")),H(null)},onCancel:()=>{"embedding"!==P||x||c("vercel_ai_gateway"),"chat"!==P||v||f("vercel_ai_gateway"),H(null)}})]})})]})}let q={"panel-default":"#FAFAFA","panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"};e.s(["ClientLayoutWrapper",0,function({children:e}){let{pageStyle:a,panelBg:n,layout:i}=(0,s.useThemeCustomizer)(),l=(0,r.usePathname)(),o=l?.includes("/chat"),{isFirstRun:d,isLoading:c}=(0,y.useWorkspace)(),u=q[n],m=u?{backgroundColor:u}:void 0;return!c&&d?(0,t.jsx)(H,{}):c?(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsx)("div",{className:"size-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):"topnav"===i?(0,t.jsxs)("div",{className:"flex flex-col h-screen overflow-hidden",children:[(0,t.jsx)(P,{}),(0,t.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full flex flex-col bg-background text-foreground",style:m,children:(0,t.jsx)("div",{className:(0,x.cn)("flex-1 min-h-0",o||l?.includes("/settings")||l?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||l?.includes("/settings")||l?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]}):(0,t.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,t.jsx)(T,{}),(0,t.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,t.jsx)("div",{className:"fused"===a?"h-screen flex flex-col bg-background text-foreground overflow-hidden":"h-screen flex flex-col md:rounded-l-2xl border-l border-border bg-panel text-panel-foreground overflow-hidden",style:m,children:(0,t.jsx)("div",{className:(0,x.cn)("flex-1 min-h-0",o||l?.includes("/settings")||l?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||l?.includes("/settings")||l?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]})}],266186)},953159,e=>{"use strict";var t=e.i(523829),s=e.i(842646),a=e.i(501706),n=e.i(178328),r=e.i(866657),i=e.i(874822);let l=(0,i.default)("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);var o=e.i(871942);let d=(0,i.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var c=e.i(518864),u=e.i(702938);let m=(0,i.default)("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);var x=e.i(743118),h=e.i(714809),p=e.i(241491),f=e.i(539352);let g=(0,i.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);var b=e.i(682458),j=e.i(161351),v=e.i(466691),y=e.i(861947),N=e.i(323621),w=e.i(524365),k=e.i(534792),C=e.i(746632),A=e.i(878835),F=e.i(282879);let S=e=>fetch(e).then(e=>e.json()),z=["chunking","embedding","upserting"];function E({open:e,onOpenChange:i,trigger:l}){let[o,d]=(0,n.useState)(!1),[c,u]=(0,n.useState)(!1),m=void 0!==e,g=m?e:c,b=m&&i?i:u,{data:j,isLoading:y,mutate:N}=(0,s.default)("/api/index",S,{refreshInterval:e=>e?.run&&z.includes(e.run.status)?1e3:0}),T=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{let e=j?.run?.warning;e&&e!==T.current?C.toast.warning(e,{id:"rate-limit-warning",duration:7e4}):!e&&T.current&&(C.toast.dismiss("rate-limit-warning"),C.toast.success("Rate limit resolved — resuming indexing.",{duration:3e3})),T.current=e},[j?.run?.warning]);let[M,P]=(0,n.useState)(!1);async function _(e=!1){d(!0);try{let t=await fetch("/api/index",{method:"POST",body:JSON.stringify({incremental:e}),headers:{"Content-Type":"application/json"}}),s=await t.json();if(!t.ok)return void C.toast.error(s.error??"Could not start indexing.");C.toast.success("Indexing started."),N()}catch{C.toast.error("Could not start indexing.")}finally{d(!1)}}async function B(){d(!0);try{if(!(await fetch("/api/index",{method:"DELETE"})).ok)return void C.toast.error("Could not cancel indexing.");C.toast.success("Indexing cancelled."),N()}catch{C.toast.error("Could not cancel indexing.")}finally{d(!1)}}return(0,n.useEffect)(()=>{let e=j?.run?.status;e&&z.includes(e)?P(!0):M&&"completed"===e&&(P(!1),b(!1),C.toast.success("Indexing completed successfully!"))},[j?.run?.status,M,b]),(0,t.jsxs)(F.Dialog,{open:g,onOpenChange:b,children:[l?(0,t.jsx)(F.DialogTrigger,{render:(0,n.isValidElement)(l)?l:(0,t.jsx)("button",{children:l})}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j?.run?.status==="completed"&&(0,t.jsxs)(A.AlertDialog,{children:[(0,t.jsx)(A.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o,variant:"outline",children:[(0,t.jsx)(f.RotateCcw,{className:"size-4 mr-2"}),"Re-Index Data"]})}),(0,t.jsxs)(A.AlertDialogContent,{children:[(0,t.jsxs)(A.AlertDialogHeader,{children:[(0,t.jsx)(A.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(A.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(A.AlertDialogFooter,{children:[(0,t.jsx)(A.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(A.AlertDialogAction,{onClick:()=>{b(!0),_(!1)},children:"Continue"})]})]})]}),(0,t.jsx)(F.DialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j?.ready||j?.unindexedCount===0,children:[(0,t.jsx)(h.Layers,{className:"size-4 mr-2"}),"Index Data"]})})]}),(0,t.jsxs)(F.DialogContent,{className:"max-w-2xl max-h-[90vh] overflow-y-auto ",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsx)(F.DialogTitle,{children:"Index Data"}),(0,t.jsx)(F.DialogDescription,{children:"Chunk, embed, and index into your selected vector database."})]}),y||!j?(0,t.jsx)("div",{className:"py-6",children:(0,t.jsx)(k.Skeleton,{className:"h-40 w-full"})}):(0,t.jsxs)("div",{className:"space-y-6 py-4",children:[(0,t.jsx)(D,{config:j.config,docCount:j.docCount,charCount:j.charCount}),!j.ready&&(0,t.jsxs)(w.Alert,{variant:"default",children:[(0,t.jsx)(r.AlertTriangle,{className:"size-4 text-orange-500!"}),(0,t.jsx)(w.AlertTitle,{className:"text-orange-500!",children:"Not ready to index"}),(0,t.jsx)(w.AlertDescription,{children:(0,t.jsx)("ul",{className:"list-disc pl-4",children:j.blockers.map(e=>(0,t.jsx)("li",{children:e},e))})})]}),(0,t.jsx)(I,{run:j.run,running:!!(j.run&&z.includes(j.run.status))}),j.ready&&!j.run&&(0,t.jsxs)(w.Alert,{children:[(0,t.jsx)(x.Info,{className:"size-4 text-blue-500!"}),(0,t.jsx)(w.AlertTitle,{className:"text-blue-600 dark:text-blue-400",children:"Before you start indexing"}),(0,t.jsxs)(w.AlertDescription,{className:"text-muted-foreground space-y-1",children:[(0,t.jsxs)("p",{children:["Once indexing begins, two settings become"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:"locked"})," to the existing index:"]}),(0,t.jsxs)("ul",{className:"list-disc pl-4 space-y-0.5",children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Embedding model"})," — you can swap to any model with the"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:"same vector dimensions"}),", but switching to a model with different dimensions will require a full re-index."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Vector store"})," — changing the store after indexing requires starting fresh."]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)(v.Button,{onClick:()=>_(j.run?.status==="completed"),disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o||j.run?.status==="completed"&&0===j.unindexedCount,size:"lg",children:[j.run&&z.includes(j.run.status)||o?(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin mr-2"}):(0,t.jsx)(p.Play,{className:"size-4 mr-2"}),j.run&&z.includes(j.run.status)?"Indexing…":o?"Starting…":j.run?.status==="completed"?`Index new documents (${j.unindexedCount})`:`Start indexing (${j.unindexedCount})`]}),j.run?.status==="completed"&&!(j.run&&z.includes(j.run.status))&&(0,t.jsxs)(A.AlertDialog,{children:[(0,t.jsx)(A.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{variant:"outline",size:"lg",disabled:o,children:[(0,t.jsx)(f.RotateCcw,{className:"size-4 mr-2"}),"Re-Index All"]})}),(0,t.jsxs)(A.AlertDialogContent,{children:[(0,t.jsxs)(A.AlertDialogHeader,{children:[(0,t.jsx)(A.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(A.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(A.AlertDialogFooter,{children:[(0,t.jsx)(A.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(A.AlertDialogAction,{onClick:()=>{b(!0),_(!1)},children:"Continue"})]})]})]}),!!(j.run&&z.includes(j.run.status))&&(0,t.jsx)(v.Button,{onClick:B,disabled:o,size:"lg",variant:"destructive",children:"Cancel"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"lg",onClick:()=>b(!1),children:"Close"})]})]})]})]})}function D({config:e,docCount:s,charCount:a}){let n=(0,b.getEmbeddingModel)(e.embeddingModelId),r=(0,j.getVectorStore)(e.vectorStore),i=[{icon:d,label:"Embedding model",value:n?.label??e.embeddingModelId,hint:n?`${n.dimensions} dims`:void 0},{icon:c.Database,label:"Vector store",value:r?.label??e.vectorStore},{icon:l,label:"Index type",value:e.indexType.toUpperCase()},{icon:g,label:"Chunking",value:`${e.chunking.chunkSize} / ${e.chunking.chunkOverlap}`,hint:"size / overlap"},{icon:u.FileText,label:"Corpus",value:`${s.toLocaleString()} docs`,hint:`${a.toLocaleString()} chars`}];return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold mb-4",children:[(0,t.jsx)(h.Layers,{className:"size-4 text-primary"}),"Index configuration"]}),(0,t.jsx)("dl",{className:"grid grid-cols-2 gap-x-6 gap-y-5 sm:grid-cols-3",children:i.map(e=>(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("dt",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(e.icon,{className:"size-3.5"}),e.label]}),(0,t.jsxs)("dd",{className:"text-sm font-medium leading-tight",children:[e.value,e.hint&&(0,t.jsx)("span",{className:"ml-1.5 font-mono text-[11px] font-normal text-muted-foreground",children:e.hint})]})]},e.label))})]})}let T={idle:{label:"Idle"},chunking:{label:"Chunking",phase:"Splitting documents into chunks"},embedding:{label:"Embedding",phase:"Generating vector embeddings"},upserting:{label:"Storing",phase:"Writing vectors to the store"},completed:{label:"Completed"},failed:{label:"Failed"}};function I({run:e,running:s}){if(!e)return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground flex flex-col items-center justify-center gap-1 py-8 text-center",children:[(0,t.jsx)(m,{className:"mb-1 size-6 text-muted-foreground/60"}),(0,t.jsx)("p",{className:"text-sm font-medium",children:"No index built yet"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Build a Larkup index to embed your corpus and make it searchable."})]});let n=T[e.status],i=e.totalChunks>0?Math.round(e.processedChunks/e.totalChunks*100):5*!!s;return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4 space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold",children:["completed"===e.status?(0,t.jsx)(o.CheckCircle2,{className:"size-4 text-primary"}):"failed"===e.status?(0,t.jsx)(r.AlertTriangle,{className:"size-4 text-destructive"}):(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin text-primary"}),n.label]}),(0,t.jsx)(P,{status:e.status})]}),"failed"===e.status?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:n.phase??"Done"}),(0,t.jsxs)("span",{className:"font-mono tabular-nums",children:[e.processedChunks.toLocaleString(),e.totalChunks>0&&` / ${e.totalChunks.toLocaleString()}`," chunks"]})]}),(0,t.jsx)(y.Progress,{value:i,className:"**:data-[slot=progress-indicator]:bg-green-600"})]}),(0,t.jsxs)("dl",{className:"grid grid-cols-2 gap-4 pt-1 sm:grid-cols-4",children:[(0,t.jsx)(M,{label:"Documents",value:e.docCount.toLocaleString()}),(0,t.jsx)(M,{label:"Chunks",value:e.totalChunks.toLocaleString()}),(0,t.jsx)(M,{label:"Dimensions",value:e.dimensions?e.dimensions.toLocaleString():"—"}),(0,t.jsx)(M,{label:"Duration",value:e.durationMs?`${(e.durationMs/1e3).toFixed(1)}s`:s?"running…":"—"})]})]})]})}function M({label:e,value:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("dt",{className:"text-xs text-muted-foreground",children:e}),(0,t.jsx)("dd",{className:"font-mono text-sm tabular-nums",children:s})]})}function P({status:e}){return"completed"===e?(0,t.jsx)(N.Badge,{className:"bg-primary/12 text-primary hover:bg-primary/12",children:"Ready"}):"failed"===e?(0,t.jsx)(N.Badge,{variant:"destructive",children:"Failed"}):z.includes(e)?(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-green-600",children:[(0,t.jsxs)("span",{className:"relative flex size-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-600 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-600"})]}),"Live"]}):null}let _=e=>fetch(e).then(e=>e.json()),B=["chunking","embedding","upserting"];e.s(["GlobalIndexProgress",0,function(){let{data:e}=(0,s.default)("/api/index",_,{refreshInterval:e=>e?.run&&B.includes(e.run.status)?1e3:0});if(!(e?.run&&B.includes(e.run.status))||!e?.run)return null;let{run:n}=e,r=n.totalChunks>0?Math.round(n.processedChunks/n.totalChunks*100):5;return(0,t.jsx)("div",{className:"fixed bottom-6 right-6 z-50",children:(0,t.jsx)(E,{trigger:(0,t.jsxs)("button",{className:"flex items-center gap-3 rounded-full border bg-background px-4 py-2 text-sm font-medium transition-all hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin text-primary"}),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:"Storing..."}),(0,t.jsxs)("span",{className:"leading-none",children:[r,"%"]})]})]})})})}],953159)},232295,e=>{"use strict";var t=e.i(199910),s=e.i(523829),a=e.i(178328),n=e.i(960198),r=e.i(133058),i=e.i(736484),l=e.i(417368),o=e.i(466691);let d="larkup-update-dismissed",c={docker:"docker compose pull && docker compose up -d",npm:"larkup update"};e.s(["UpdateBanner",0,function(){let[u,m]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[p,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),j="0.1.40",v="__TAURI__"in window?"desktop":"true"===t.default.env.NEXT_PUBLIC_DOCKER_ENV||"true"===t.default.env.NEXT_PUBLIC_RUNNING_IN_DOCKER?"docker":"npm";(0,a.useEffect)(()=>{if(function(){try{let e=localStorage.getItem(d);if(!e)return!1;let{timestamp:t}=JSON.parse(e);return Date.now()-t<864e5}catch{return!1}}())return;let e=new AbortController;return fetch("https://larkup.de/api/version",{signal:e.signal,cache:"no-store"}).then(e=>e.json()).then(e=>{e.version&&function(e,t){let s=e.replace(/^v/,"").split(".").map(Number),a=t.replace(/^v/,"").split(".").map(Number);for(let e=0;e<3;e++){let t=s[e]||0,n=a[e]||0;if(t>n)return 1;if(t<n)return -1}return 0}(e.version,j)>0&&(m(e.version),h(!0))}).catch(()=>{}),()=>e.abort()},[j]);let y=async()=>{if("desktop"===v){f(!0);try{let{check:t}=await e.A(963347),{relaunch:s}=await e.A(995308),a=await t();a?(await a.downloadAndInstall(),await s()):f(!1)}catch(e){console.error("Auto-update failed:",e),f(!1),window.open("https://larkup.de/download","_blank")}}else try{await navigator.clipboard.writeText(c[v]),b(!0),window.setTimeout(()=>b(!1),2e3)}catch(e){console.error("Could not copy update command:",e)}};return x&&u?(0,s.jsx)("div",{role:"status","aria-live":"polite",className:"relative z-50 border-b border-border bg-background px-3 py-2 text-foreground sm:px-4",children:(0,s.jsxs)("div",{className:"mx-auto flex min-h-7 max-w-screen-2xl items-center gap-2.5",children:[(0,s.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background",children:(0,s.jsx)(n.ArrowUp,{className:"size-3.5","aria-hidden":"true"})}),(0,s.jsxs)("p",{className:"min-w-0 text-xs sm:text-sm",children:[(0,s.jsxs)("span",{className:"font-medium",children:["Larkup v",u," is available."]})," ",(0,s.jsxs)("span",{className:"hidden text-muted-foreground sm:inline",children:["You're using v",j,"."]})]}),"desktop"!==v&&(0,s.jsx)("code",{className:"ml-auto hidden max-w-[38rem] truncate rounded-[5px] border border-border bg-muted/40 px-2 py-1 font-mono text-[11px] text-muted-foreground lg:block",children:c[v]}),(0,s.jsx)(o.Button,{type:"button",variant:"desktop"===v?"default":"outline",size:"xs",onClick:y,disabled:p,"aria-label":"desktop"===v?"Update Larkup now":"Copy update command",className:"desktop"===v?"ml-auto":"ml-auto lg:ml-0",children:"desktop"===v?p?"Updating...":"Update now":g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.Check,{"aria-hidden":"true"}),"Copied"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Copy,{"aria-hidden":"true"}),"Copy command"]})}),(0,s.jsx)(o.Button,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>{try{localStorage.setItem(d,JSON.stringify({timestamp:Date.now()}))}catch{}h(!1)},"aria-label":"Dismiss update notification",title:"Remind me tomorrow",children:(0,s.jsx)(l.X,{"aria-hidden":"true"})})]})}):null}])}]);
|