larkup 0.2.13 → 0.2.14

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.
Files changed (66) hide show
  1. package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
  2. package/.next/standalone/apps/web/.next/app-path-routes-manifest.json +20 -20
  3. package/.next/standalone/apps/web/.next/build-manifest.json +2 -2
  4. package/.next/standalone/apps/web/.next/required-server-files.json +1 -1
  5. package/.next/standalone/apps/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
  7. package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
  13. package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +10 -10
  14. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +10 -10
  15. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +10 -10
  16. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  17. package/.next/standalone/apps/web/.next/server/app/add/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/apps/web/.next/server/app/add.html +1 -1
  19. package/.next/standalone/apps/web/.next/server/app/add.rsc +10 -10
  20. package/.next/standalone/apps/web/.next/server/app/add.segments/_full.segment.rsc +10 -10
  21. package/.next/standalone/apps/web/.next/server/app/add.segments/_tree.segment.rsc +1 -1
  22. package/.next/standalone/apps/web/.next/server/app/add.segments/add/__PAGE__.segment.rsc +10 -10
  23. package/.next/standalone/apps/web/.next/server/app/api/chat/route.js +1 -1
  24. package/.next/standalone/apps/web/.next/server/app/chat/[id]/page_client-reference-manifest.js +1 -1
  25. package/.next/standalone/apps/web/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  26. package/.next/standalone/apps/web/.next/server/app/chat.html +1 -1
  27. package/.next/standalone/apps/web/.next/server/app/chat.rsc +10 -10
  28. package/.next/standalone/apps/web/.next/server/app/chat.segments/_full.segment.rsc +10 -10
  29. package/.next/standalone/apps/web/.next/server/app/chat.segments/_tree.segment.rsc +1 -1
  30. package/.next/standalone/apps/web/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +10 -10
  31. package/.next/standalone/apps/web/.next/server/app/data/page_client-reference-manifest.js +1 -1
  32. package/.next/standalone/apps/web/.next/server/app/data.html +1 -1
  33. package/.next/standalone/apps/web/.next/server/app/data.rsc +10 -10
  34. package/.next/standalone/apps/web/.next/server/app/data.segments/_full.segment.rsc +10 -10
  35. package/.next/standalone/apps/web/.next/server/app/data.segments/_tree.segment.rsc +1 -1
  36. package/.next/standalone/apps/web/.next/server/app/data.segments/data/__PAGE__.segment.rsc +10 -10
  37. package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
  38. package/.next/standalone/apps/web/.next/server/app/index.rsc +10 -10
  39. package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +10 -10
  40. package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +10 -10
  41. package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  42. package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  44. package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
  45. package/.next/standalone/apps/web/.next/server/app/settings.rsc +10 -10
  46. package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +10 -10
  47. package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  48. package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +10 -10
  49. package/.next/standalone/apps/web/.next/server/app/widget-demo/page_client-reference-manifest.js +1 -1
  50. package/.next/standalone/apps/web/.next/server/app/widget-demo.html +1 -1
  51. package/.next/standalone/apps/web/.next/server/app/widget-demo.rsc +10 -10
  52. package/.next/standalone/apps/web/.next/server/app/widget-demo.segments/_full.segment.rsc +10 -10
  53. package/.next/standalone/apps/web/.next/server/app/widget-demo.segments/_tree.segment.rsc +1 -1
  54. package/.next/standalone/apps/web/.next/server/app/widget-demo.segments/widget-demo/__PAGE__.segment.rsc +10 -10
  55. package/.next/standalone/apps/web/.next/server/app-paths-manifest.json +20 -20
  56. package/.next/standalone/apps/web/.next/server/chunks/2683.js +1 -1
  57. package/.next/standalone/apps/web/.next/server/chunks/4188.js +1 -1
  58. package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +1 -1
  59. package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
  60. package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
  61. package/.next/standalone/apps/web/.next/static/chunks/app/{layout-b915f8aecbb6e586.js → layout-eea33807e2757122.js} +1 -1
  62. package/.next/standalone/apps/web/package.json +1 -1
  63. package/.next/standalone/apps/web/server.js +1 -1
  64. package/package.json +1 -1
  65. /package/.next/standalone/apps/web/.next/static/{3a-Yp8Tao7I-rZrHO2nhQ → 2agjdRRH7rqG82mu-A6B0}/_buildManifest.js +0 -0
  66. /package/.next/standalone/apps/web/.next/static/{3a-Yp8Tao7I-rZrHO2nhQ → 2agjdRRH7rqG82mu-A6B0}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- exports.id=2683,exports.ids=[2683],exports.modules={2223:(a,b,c)=>{"use strict";c.d(b,{UpdateBanner:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call UpdateBanner() from the server but UpdateBanner is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/update-banner.tsx","UpdateBanner")},5955:(a,b,c)=>{"use strict";c.d(b,{S:()=>m});var d=c(16358),e=c(46407),f=c(77802),g=c(87821),h=c(40950),i=c(30322),j=c(94636),k=c(48814),l=c(71665);function m({mode:a,target:b,open:c,onOpenChange:n}){let{createProject:o,renameProject:p}=(0,l.B)(),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(!1);async function u(){let c=q.trim();if(!c)return void f.oR.error("Enter a project name.");t(!0);try{if("create"===a){let a=await o(c);a&&f.oR.success(`Created "${a.name}" and switched to it.`)}else b&&(await p(b.id,c),f.oR.success("Project renamed."));n(!1)}catch{f.oR.error("Something went wrong. Try again.")}finally{t(!1)}}return(0,d.jsx)(i.lG,{open:c,onOpenChange:n,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:"create"===a?"New project":"Rename project"}),(0,d.jsx)(i.rr,{children:"create"===a?"Each project is an isolated environment with its own documents, index, and settings.":"Give this project a clearer name."})]}),(0,d.jsxs)("div",{className:"grid gap-2",children:[(0,d.jsx)(k.J,{htmlFor:"server-name",children:"Project name"}),(0,d.jsx)(j.p,{id:"server-name",value:q,autoFocus:!0,placeholder:"e.g. docs-assistant",onChange:a=>r(a.target.value),onKeyDown:a=>{"Enter"===a.key&&u()}})]}),(0,d.jsxs)(i.Es,{children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>n(!1),disabled:s,children:"Cancel"}),(0,d.jsxs)(h.$,{onClick:()=>void u(),disabled:s,children:[s&&(0,d.jsx)(g.A,{className:"size-4 animate-spin"}),"create"===a?"Create project":"Save"]})]})]})})}},9249:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,97638,23))},9714:(a,b,c)=>{"use strict";c.d(b,{GpuActivityIndicator:()=>i});var d=c(16358),e=c(15670),f=c(91725);let g=a=>fetch(a).then(a=>a.json());function h({percent:a}){let b=2*Math.PI*14,c=Math.max(0,Math.min(100,a));return(0,d.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",className:"shrink-0 -rotate-90",children:[(0,d.jsx)("circle",{cx:"16",cy:"16",r:14,className:"stroke-emerald-500/20",strokeWidth:"3",fill:"none"}),(0,d.jsx)("circle",{cx:"16",cy:"16",r:14,className:"stroke-emerald-500 transition-[stroke-dashoffset] duration-500",strokeWidth:"3",fill:"none",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:b-c/100*b})]})}function i(){let{data:a}=(0,f.u)("/api/gpu-activity",g,{refreshInterval:a=>a?.activity?.phase==="waking-up"?1e3:4e3}),b=a?.activity;return!b||"waking-up"!==b.phase||b.toolCallId?null:(0,d.jsx)("div",{className:"fixed bottom-24 right-6 z-50",children:(0,d.jsxs)("div",{className:"flex items-center gap-3 rounded-xl border bg-white dark:bg-background px-3 py-2 text-sm font-medium shadow-xs",children:[(0,d.jsx)(h,{percent:b.percent}),(0,d.jsxs)("div",{className:"flex flex-col items-start gap-0.5 pr-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(e.A,{className:"size-4"}),(0,d.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:b.label})]}),(0,d.jsx)("span",{className:"larkup-shimmer-text leading-none",children:b.message}),(0,d.jsxs)("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[Math.round(b.percent),"%"]})]})]})})}},13139:(a,b,c)=>{"use strict";c.d(b,{D_:()=>g,Qd:()=>f,rb:()=>h});var d=c(16358),e=c(90241);let f={vercel_ai_gateway:{label:"Vercel AI Gateway",iconSrc:"/icons/vercel.svg",pillBg:"bg-white dark:bg-white text-white dark:text-black"},openai:{label:"OpenAI",iconSrc:"/icons/openai.svg",pillBg:"bg-neutral-100 dark:bg-neutral-800"},anthropic:{label:"Anthropic",iconSrc:"https://models.dev/logos/anthropic.svg",pillBg:"bg-amber-50 dark:bg-amber-950/40"},google:{label:"Google",iconSrc:"/icons/gemini.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},meta:{label:"Meta",iconSrc:"https://models.dev/logos/meta.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},mistral:{label:"Mistral",iconSrc:"/icons/mistral.svg",pillBg:"bg-amber-50 dark:bg-amber-950/40"},cohere:{label:"Cohere",iconSrc:"/icons/cohere.svg",pillBg:"bg-orange-50 dark:bg-orange-950/40"},deepseek:{label:"DeepSeek",iconSrc:"https://models.dev/logos/deepseek.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},amazon:{label:"Amazon",iconSrc:"/icons/aws.svg",pillBg:"bg-orange-50 dark:bg-orange-950/40"},xai:{label:"xAI",iconSrc:"https://models.dev/logos/xai.svg",pillBg:"bg-neutral-100 dark:bg-neutral-800"},perplexity:{label:"Perplexity",iconSrc:"https://models.dev/logos/perplexity.svg",pillBg:"bg-teal-50 dark:bg-teal-950/40"},alibaba:{label:"Alibaba",iconSrc:"https://models.dev/logos/alibaba.svg",pillBg:"bg-orange-50 dark:bg-orange-950/40"},groq:{label:"Groq",iconSrc:"https://models.dev/logos/groq.svg",pillBg:"bg-orange-50 dark:bg-orange-950/40"},"together-ai":{label:"Together AI",iconSrc:"https://models.dev/logos/together-ai.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},fireworks:{label:"Fireworks",iconSrc:"https://models.dev/logos/fireworks.svg",pillBg:"bg-purple-50 dark:bg-purple-950/40"},cerebras:{label:"Cerebras",iconSrc:"https://models.dev/logos/cerebras.svg",pillBg:"bg-green-50 dark:bg-green-950/40"},voyage:{label:"Voyage AI",iconSrc:"/icons/voyage-light.png",pillBg:"bg-slate-100 dark:bg-slate-800"},jina:{label:"Jina AI",iconSrc:"/icons/jina.svg",pillBg:"bg-rose-50 dark:bg-rose-950/40"},nomic:{label:"Nomic",iconSrc:"/icons/nomic.png",pillBg:"bg-teal-50 dark:bg-teal-950/40"},minimax:{label:"MiniMax",iconSrc:"https://models.dev/logos/minimax.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},elevenlabs:{label:"ElevenLabs",iconSrc:"https://models.dev/logos/elevenlabs.svg",pillBg:"bg-neutral-100 dark:bg-neutral-800"},custom:{label:"Custom",iconSrc:"/logo.png",pillBg:"bg-slate-100 dark:bg-slate-800"}};function g(a){return f[a]??{label:a.charAt(0).toUpperCase()+a.slice(1),iconSrc:`https://models.dev/logos/${a}.svg`,pillBg:"bg-slate-100 dark:bg-slate-800"}}function h({src:a,alt:b,pillBg:c,size:f=20}){return(0,d.jsx)("span",{className:(0,e.cn)("inline-flex shrink-0 items-center justify-center rounded",c),style:{width:f,height:f},children:a?(0,d.jsx)("img",{src:a,alt:b,width:f-4,height:f-4,className:"object-contain",style:{maxWidth:f-4,maxHeight:f-4}}):null})}},15478:(a,b,c)=>{"use strict";c.d(b,{bq:()=>x,eb:()=>z,gC:()=>y,l6:()=>v,yv:()=>w});var d=c(16358);c(46407);var e=c(47471),f=c(95853),g=c(21241),h=c(24745),i=c(62111),j=c(35331),k=c(24473),l=c(69943),m=c(70401),n=c(67274),o=c(61416),p=c(16209),q=c(13443),r=c(90241),s=c(63323),t=c(73775),u=c(97768);let v=e.H;function w({className:a,...b}){return(0,d.jsx)(f.y,{"data-slot":"select-value",className:(0,r.cn)("flex flex-1 text-left",a),...b})}function x({className:a,size:b="default",children:c,...e}){return(0,d.jsxs)(g.b,{"data-slot":"select-trigger","data-size":b,className:(0,r.cn)("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-background","pr-3 pl-3 text-sm whitespace-nowrap select-none outline-none","transition-all duration-150","hover:border-foreground/7 hover:bg-accent/90","data-[state=open]:border-primary/60 data-[state=open]:ring-2 data-[state=open]:ring-primary/15","data-[size=default]:h-10 data-[size=sm]:h-7 data-[size=sm]:rounded-lg","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5","disabled:cursor-not-allowed disabled:opacity-50","aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20","dark:bg-input/30 dark:hover:bg-input/50","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...e,children:[c,(0,d.jsx)(h.w,{render:(0,d.jsx)(s.A,{className:"pointer-events-none size-4 text-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-180"})})]})}function y({className:a,children:b,side:c="bottom",sideOffset:e=6,align:f="center",alignOffset:g=0,alignItemWithTrigger:h=!0,...m}){return(0,d.jsx)(i.V,{children:(0,d.jsx)(j.l,{side:c,sideOffset:e,align:f,alignOffset:g,alignItemWithTrigger:h,className:"isolate z-50",children:(0,d.jsxs)(k.t,{"data-slot":"select-content","data-align-trigger":h,className:(0,r.cn)("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-40","origin-(--transform-origin) overflow-x-hidden overflow-y-auto","rounded-xl bg-popover p-1 text-popover-foreground"," ring-1 ring-foreground/8","duration-150","data-[align-trigger=true]:animate-none","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2","data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2","data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95","data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...m,children:[(0,d.jsx)(A,{}),(0,d.jsx)(l.B,{children:b}),(0,d.jsx)(B,{})]})})})}function z({className:a,children:b,...c}){return(0,d.jsxs)(m.e,{"data-slot":"select-item",className:(0,r.cn)("group relative flex w-full cursor-pointer items-center gap-2 rounded-md","py-2 pr-8 pl-2 text-sm outline-hidden select-none","transition-colors duration-150","hover:bg-accent hover:text-accent-foreground","data-highlighted:bg-accent data-highlighted:text-accent-foreground","data-disabled:pointer-events-none data-disabled:opacity-40","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...c,children:[(0,d.jsx)(n.h,{className:"flex flex-1 shrink-0 gap-2 items-center",children:b}),(0,d.jsx)(o.h,{render:(0,d.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,d.jsx)(t.A,{className:"pointer-events-none text-primary"})})]})}function A({className:a,...b}){return(0,d.jsx)(p.w,{"data-slot":"select-scroll-up-button",className:(0,r.cn)("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",a),...b,children:(0,d.jsx)(u.A,{})})}function B({className:a,...b}){return(0,d.jsx)(q.d,{"data-slot":"select-scroll-down-button",className:(0,r.cn)("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",a),...b,children:(0,d.jsx)(s.A,{})})}},16402:(a,b,c)=>{"use strict";c.d(b,{GlobalIndexProgress:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call GlobalIndexProgress() from the server but GlobalIndexProgress is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/index/global-index-progress.tsx","GlobalIndexProgress")},18353:(a,b,c)=>{"use strict";c.d(b,{UpdateBanner:()=>l});var d=c(16358),e=c(46407),f=c(1790),g=c(73775),h=c(56398),i=c(94239),j=c(40950);let k={docker:"docker compose pull && docker compose up -d",npm:"larkup update"};function l(){let[a,b]=(0,e.useState)(null),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),r="true"===process.env.NEXT_PUBLIC_DOCKER_ENV||"true"===process.env.NEXT_PUBLIC_RUNNING_IN_DOCKER?"docker":"npm",s=async()=>{if("desktop"===r){o(!0);try{let{check:a}=await c.e(4506).then(c.bind(c,44506)),{relaunch:b}=await c.e(4956).then(c.bind(c,94956)),d=await a();d?(await d.downloadAndInstall(),await b()):o(!1)}catch(a){console.error("Auto-update failed:",a),o(!1),window.open("https://www.larkup.de/download","_blank")}}else try{await navigator.clipboard.writeText(k[r]),q(!0),window.setTimeout(()=>q(!1),2e3)}catch(a){console.error("Could not copy update command:",a)}};return l&&a?(0,d.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,d.jsxs)("div",{className:"mx-auto flex min-h-7 max-w-screen-2xl items-center gap-2.5",children:[(0,d.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background",children:(0,d.jsx)(f.A,{className:"size-3.5","aria-hidden":"true"})}),(0,d.jsxs)("p",{className:"min-w-0 text-xs sm:text-sm",children:[(0,d.jsxs)("span",{className:"font-medium",children:["Larkup v",a," is available."]})," ",(0,d.jsxs)("span",{className:"hidden text-muted-foreground sm:inline",children:["You're using v","0.2.13","."]})]}),"desktop"!==r&&(0,d.jsx)("code",{className:"ml-auto hidden max-w-152 truncate rounded-[5px] border border-border bg-muted/40 px-2 py-1 font-mono text-[11px] text-muted-foreground lg:block",children:k[r]}),(0,d.jsx)(j.$,{type:"button",variant:"desktop"===r?"default":"outline",size:"xs",onClick:s,disabled:n,"aria-label":"desktop"===r?"Update Larkup now":"Copy update command",className:"desktop"===r?"ml-auto":"ml-auto lg:ml-0",children:"desktop"===r?n?"Updating...":"Update now":p?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.A,{"aria-hidden":"true"}),"Copied"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{"aria-hidden":"true"}),"Copy command"]})}),(0,d.jsx)(j.$,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>{try{localStorage.setItem("larkup-update-dismissed",JSON.stringify({timestamp:Date.now()}))}catch{}m(!1)},"aria-label":"Dismiss update notification",title:"Remind me tomorrow",children:(0,d.jsx)(i.A,{"aria-hidden":"true"})})]})}):null}},21077:()=>{},23223:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/ui/sonner.tsx","Toaster")},24474:(a,b,c)=>{"use strict";c.d(b,{Fc:()=>h,T2:()=>k,TN:()=>j,XL:()=>i});var d=c(16358);c(46407);var e=c(2437),f=c(90241);let g=(0,e.F)("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function h({className:a,variant:b,...c}){return(0,d.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,f.cn)(g({variant:b}),a),...c})}function i({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-title",className:(0,f.cn)("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",a),...b})}function j({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-description",className:(0,f.cn)("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",a),...b})}function k({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-action",className:(0,f.cn)("absolute top-2 right-2",a),...b})}},28173:(a,b,c)=>{"use strict";c.d(b,{Bc:()=>m,ZI:()=>p,k$:()=>o,m_:()=>n});var d=c(16358),e=c(81797),f=c(44494),g=c(35254),h=c(87893),i=c(49753),j=c(14121),k=c(62551),l=c(90241);function m({delay:a=0,...b}){return(0,d.jsx)(e.B,{"data-slot":"tooltip-provider",delay:a,...b})}function n({...a}){return(0,d.jsx)(f.s,{"data-slot":"tooltip",...a})}function o({...a}){return(0,d.jsx)(g.k,{"data-slot":"tooltip-trigger",...a})}function p({className:a,side:b="top",sideOffset:c=4,align:e="center",alignOffset:f=0,children:g,...m}){return(0,d.jsx)(h.K,{children:(0,d.jsx)(i.o,{align:e,alignOffset:f,side:b,sideOffset:c,className:"isolate z-50",children:(0,d.jsxs)(j.o,{"data-slot":"tooltip-content",className:(0,l.cn)("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...m,children:[g,(0,d.jsx)(k.P,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-xs bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}},28475:(a,b,c)=>{"use strict";c.d(b,{ClientLayoutWrapper:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call ClientLayoutWrapper() from the server but ClientLayoutWrapper is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/client-layout-wrapper.tsx","ClientLayoutWrapper")},29623:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,97638,23)),Promise.resolve().then(c.t.bind(c,77657,23)),Promise.resolve().then(c.t.bind(c,31457,23)),Promise.resolve().then(c.t.bind(c,9208,23)),Promise.resolve().then(c.t.bind(c,14056,23)),Promise.resolve().then(c.t.bind(c,58428,23)),Promise.resolve().then(c.t.bind(c,82317,23)),Promise.resolve().then(c.bind(c,33164))},30015:(a,b,c)=>{"use strict";c.d(b,{GlobalIndexProgress:()=>G});var d=c(16358),e=c(91725),f=c(87821),g=c(46407),h=c(56150),i=c(53319),j=c(15772),k=c(20849),l=c(14715),m=c(81277),n=c(99166);c(37960),c(61172);var o=c(40950),p=c(70367),q=c(73181),r=c(24474),s=c(90241);function t({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"skeleton",className:(0,s.cn)("animate-pulse rounded-md bg-muted",a),...b})}var u=c(77802),v=c(46089),w=c(30322);let x=a=>fetch(a).then(a=>a.json()),y=["chunking","embedding","upserting"];function z({open:a,onOpenChange:b,trigger:c}){let[m,n]=(0,g.useState)(!1),[p,q]=(0,g.useState)(!1),s=void 0!==a,A=s&&b?b:q,{data:C,isLoading:D,mutate:E}=(0,e.u)("/api/index",x,{refreshInterval:a=>a?.run&&y.includes(a.run.status)?1e3:0});(0,g.useRef)(void 0);let[F,G]=(0,g.useState)(!1);async function H(a=!1){n(!0);try{let b=await fetch("/api/index",{method:"POST",body:JSON.stringify({incremental:a}),headers:{"Content-Type":"application/json"}}),c=await b.json();if(!b.ok)return void u.oR.error(c.error??"Could not start indexing.");u.oR.success("Indexing started."),E()}catch{u.oR.error("Could not start indexing.")}finally{n(!1)}}async function I(){n(!0);try{if(!(await fetch("/api/index",{method:"DELETE"})).ok)return void u.oR.error("Could not cancel indexing.");u.oR.success("Indexing cancelled."),E()}catch{u.oR.error("Could not cancel indexing.")}finally{n(!1)}}return(0,d.jsxs)(w.lG,{open:s?a:p,onOpenChange:A,children:[c?(0,d.jsx)(w.zM,{render:(0,g.isValidElement)(c)?c:(0,d.jsx)("button",{children:c})}):(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[C?.run?.status==="completed"&&(0,d.jsxs)(v.Lt,{children:[(0,d.jsx)(v.tv,{render:(0,d.jsxs)(o.$,{disabled:!C.ready||!!(C.run&&y.includes(C.run.status))||m,variant:"outline",children:[(0,d.jsx)(h.A,{className:"size-4 mr-2"}),"Re-Index Data"]})}),(0,d.jsxs)(v.EO,{children:[(0,d.jsxs)(v.wd,{children:[(0,d.jsx)(v.r7,{children:"Are you sure you want to re-index data?"}),(0,d.jsx)(v.$v,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,d.jsxs)(v.ck,{children:[(0,d.jsx)(v.Zr,{children:"Cancel"}),(0,d.jsx)(v.Rx,{onClick:()=>{A(!0),H(!1)},children:"Continue"})]})]})]}),(0,d.jsx)(w.zM,{render:(0,d.jsxs)(o.$,{disabled:!C?.ready||C?.unindexedCount===0,children:[(0,d.jsx)(i.A,{className:"size-4 mr-2"}),"Index Data"]})})]}),(0,d.jsxs)(w.Cf,{className:"max-w-2xl max-h-[90vh] overflow-y-auto ",children:[(0,d.jsxs)(w.c7,{children:[(0,d.jsx)(w.L3,{children:"Index Data"}),(0,d.jsx)(w.rr,{children:"Chunk, embed, and index into your selected vector database."})]}),D||!C?(0,d.jsx)("div",{className:"py-6",children:(0,d.jsx)(t,{className:"h-40 w-full"})}):(0,d.jsxs)("div",{className:"space-y-6 py-4",children:[!C.ready&&(0,d.jsxs)(r.Fc,{variant:"default",children:[(0,d.jsx)(j.A,{className:"size-4 text-orange-500!"}),(0,d.jsx)(r.XL,{className:"text-orange-500!",children:"Not ready to index"}),(0,d.jsx)(r.TN,{children:(0,d.jsx)("ul",{className:"list-disc pl-4",children:C.blockers.map(a=>(0,d.jsx)("li",{children:a},a))})})]}),(0,d.jsx)(B,{run:C.run,running:!!(C.run&&y.includes(C.run.status))}),C.ready&&!C.run&&(0,d.jsxs)(r.Fc,{children:[(0,d.jsx)(k.A,{className:"size-4 text-blue-500!"}),(0,d.jsx)(r.XL,{className:"text-blue-600 dark:text-blue-400",children:"Before you start indexing"}),(0,d.jsxs)(r.TN,{className:"text-muted-foreground space-y-1",children:[(0,d.jsxs)("p",{children:["Once indexing begins, two settings become"," ",(0,d.jsx)("span",{className:"font-medium text-foreground",children:"locked"})," to the existing index:"]}),(0,d.jsxs)("ul",{className:"list-disc pl-4 space-y-0.5",children:[(0,d.jsxs)("li",{children:[(0,d.jsx)("span",{className:"font-medium text-foreground",children:"Embedding model"})," — you can swap to any model with the"," ",(0,d.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,d.jsxs)("li",{children:[(0,d.jsx)("span",{className:"font-medium text-foreground",children:"Vector store"})," — changing the store after indexing requires starting fresh."]})]})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)(o.$,{onClick:()=>H(C.run?.status==="completed"),disabled:!C.ready||!!(C.run&&y.includes(C.run.status))||m||C.run?.status==="completed"&&0===C.unindexedCount,size:"lg",children:[C.run&&y.includes(C.run.status)||m?(0,d.jsx)(f.A,{className:"size-4 animate-spin mr-2"}):(0,d.jsx)(l.A,{className:"size-4 mr-2"}),C.run&&y.includes(C.run.status)?"Indexing…":m?"Starting…":C.run?.status==="completed"?`Index new documents (${C.unindexedCount})`:`Start indexing (${C.unindexedCount})`]}),C.run?.status==="completed"&&!(C.run&&y.includes(C.run.status))&&(0,d.jsxs)(v.Lt,{children:[(0,d.jsx)(v.tv,{render:(0,d.jsxs)(o.$,{variant:"outline",size:"lg",disabled:m,children:[(0,d.jsx)(h.A,{className:"size-4 mr-2"}),"Re-Index All"]})}),(0,d.jsxs)(v.EO,{children:[(0,d.jsxs)(v.wd,{children:[(0,d.jsx)(v.r7,{children:"Are you sure you want to re-index data?"}),(0,d.jsx)(v.$v,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,d.jsxs)(v.ck,{children:[(0,d.jsx)(v.Zr,{children:"Cancel"}),(0,d.jsx)(v.Rx,{onClick:()=>{A(!0),H(!1)},children:"Continue"})]})]})]}),!!(C.run&&y.includes(C.run.status))&&(0,d.jsx)(o.$,{onClick:I,disabled:m,size:"lg",variant:"destructive",children:"Cancel"})]}),(0,d.jsx)(o.$,{variant:"ghost",size:"lg",onClick:()=>A(!1),children:"Close"})]})]})]})]})}let A={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 B({run:a,running:b}){if(!a)return(0,d.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,d.jsx)(m.A,{className:"mb-1 size-6 text-muted-foreground/60"}),(0,d.jsx)("p",{className:"text-sm font-medium",children:"No index built yet"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Build a Larkup index to embed your corpus and make it searchable."})]});let c=A[a.status],e=a.totalChunks>0?Math.round(a.processedChunks/a.totalChunks*100):5*!!b;return(0,d.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4 space-y-4",children:[(0,d.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold",children:["completed"===a.status?(0,d.jsx)(n.A,{className:"size-4 text-primary"}):"failed"===a.status?(0,d.jsx)(j.A,{className:"size-4 text-destructive"}):(0,d.jsx)(f.A,{className:"size-4 animate-spin text-primary"}),c.label]}),(0,d.jsx)(D,{status:a.status})]}),"failed"===a.status?(0,d.jsx)(d.Fragment,{}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:c.phase??"Done"}),(0,d.jsxs)("span",{className:"font-mono tabular-nums",children:[a.processedChunks.toLocaleString(),a.totalChunks>0&&` / ${a.totalChunks.toLocaleString()}`," chunks"]})]}),(0,d.jsx)(p.ke,{value:e,className:"**:data-[slot=progress-indicator]:bg-green-600"})]}),(0,d.jsxs)("dl",{className:"grid grid-cols-2 gap-4 pt-1 sm:grid-cols-4",children:[(0,d.jsx)(C,{label:"Documents",value:a.docCount.toLocaleString()}),(0,d.jsx)(C,{label:"Chunks",value:a.totalChunks.toLocaleString()}),(0,d.jsx)(C,{label:"Dimensions",value:a.dimensions?a.dimensions.toLocaleString():"—"}),(0,d.jsx)(C,{label:"Duration",value:a.durationMs?`${(a.durationMs/1e3).toFixed(1)}s`:b?"running…":"—"})]})]})]})}function C({label:a,value:b}){return(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("dt",{className:"text-xs text-muted-foreground",children:a}),(0,d.jsx)("dd",{className:"font-mono text-sm tabular-nums",children:b})]})}function D({status:a}){return"completed"===a?(0,d.jsx)(q.E,{className:"bg-primary/12 text-primary hover:bg-primary/12",children:"Ready"}):"failed"===a?(0,d.jsx)(q.E,{variant:"destructive",children:"Failed"}):y.includes(a)?(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-green-600",children:[(0,d.jsxs)("span",{className:"relative flex size-2",children:[(0,d.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-600 opacity-75"}),(0,d.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-600"})]}),"Live"]}):null}let E=a=>fetch(a).then(a=>a.json()),F=["chunking","embedding","upserting"];function G(){let{data:a}=(0,e.u)("/api/index",E,{refreshInterval:a=>a?.run&&F.includes(a.run.status)?1e3:0});if(!(a?.run&&F.includes(a.run.status))||!a?.run)return null;let{run:b}=a,c=b.totalChunks>0?Math.round(b.processedChunks/b.totalChunks*100):5;return(0,d.jsx)("div",{className:"fixed bottom-6 right-6 z-50",children:(0,d.jsx)(z,{trigger:(0,d.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,d.jsx)(f.A,{className:"size-4 animate-spin text-primary"}),(0,d.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,d.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:"Storing..."}),(0,d.jsxs)("span",{className:"leading-none",children:[c,"%"]})]})]})})})}},30322:(a,b,c)=>{"use strict";c.d(b,{Cf:()=>u,Es:()=>w,HM:()=>s,L3:()=>x,c7:()=>v,lG:()=>p,rr:()=>y,zM:()=>q});var d=c(16358);c(46407);var e=c(86179),f=c(98121),g=c(10671),h=c(98065),i=c(80211),j=c(66924),k=c(96533),l=c(16165),m=c(90241),n=c(40950),o=c(94239);function p({...a}){return(0,d.jsx)(e.D,{"data-slot":"dialog",...a})}function q({...a}){return(0,d.jsx)(f.z,{"data-slot":"dialog-trigger",...a})}function r({...a}){return(0,d.jsx)(g.Z,{"data-slot":"dialog-portal",...a})}function s({...a}){return(0,d.jsx)(h.H,{"data-slot":"dialog-close",...a})}function t({className:a,...b}){return(0,d.jsx)(i.X,{"data-slot":"dialog-overlay",className:(0,m.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",a),...b})}function u({className:a,children:b,showCloseButton:c=!0,...e}){return(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{}),(0,d.jsxs)(j.h,{"data-slot":"dialog-content",className:(0,m.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-card p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...e,children:[b,c&&(0,d.jsxs)(h.H,{"data-slot":"dialog-close",render:(0,d.jsx)(n.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,d.jsx)(o.A,{}),(0,d.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function v({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"dialog-header",className:(0,m.cn)("flex flex-col gap-2",a),...b})}function w({className:a,showCloseButton:b=!1,children:c,...e}){return(0,d.jsxs)("div",{"data-slot":"dialog-footer",className:(0,m.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",a),...e,children:[c,b&&(0,d.jsx)(h.H,{render:(0,d.jsx)(n.$,{variant:"outline"}),children:"Close"})]})}function x({className:a,...b}){return(0,d.jsx)(k.L,{"data-slot":"dialog-title",className:(0,m.cn)("font-heading text-base leading-none font-medium",a),...b})}function y({className:a,...b}){return(0,d.jsx)(l.r,{"data-slot":"dialog-description",className:(0,m.cn)("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",a),...b})}},32561:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>l});var d=c(16358),e=c(43883),f=c(77802),g=c(99166),h=c(20849),i=c(11616),j=c(64662),k=c(87821);let l=({...a})=>{let{theme:b="system"}=(0,e.D)();return(0,d.jsx)(f.l$,{closeButton:!0,theme:b,className:"toaster group z-9999999! ",icons:{success:(0,d.jsx)(g.A,{className:"size-5 text-white",fill:"#10b981"}),info:(0,d.jsx)(h.A,{className:"size-5 text-white",fill:"#3b82f6"}),warning:(0,d.jsx)(i.A,{className:"size-5 text-white",fill:"#f59e0b"}),error:(0,d.jsx)(j.A,{className:"size-5 text-white",fill:"#ef4444"}),loading:(0,d.jsx)(k.A,{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"}},...a})}},36952:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>f});var d=c(16358),e=c(36279);function f({children:a}){return(0,d.jsx)(e.P.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"h-full w-full",children:a})}},37136:(a,b,c)=>{"use strict";c.d(b,{ThemeCustomizerProvider:()=>e});var d=c(43044);(0,d.registerClientReference)(function(){throw Error("Attempted to call DEFAULT_THEME() from the server but DEFAULT_THEME is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/theme-customizer-provider.tsx","DEFAULT_THEME"),(0,d.registerClientReference)(function(){throw Error("Attempted to call useThemeCustomizer() from the server but useThemeCustomizer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/theme-customizer-provider.tsx","useThemeCustomizer");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call ThemeCustomizerProvider() from the server but ThemeCustomizerProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/theme-customizer-provider.tsx","ThemeCustomizerProvider")},37295:(a,b,c)=>{"use strict";c.d(b,{ProjectProvider:()=>e});var d=c(43044);(0,d.registerClientReference)(function(){throw Error("Attempted to call useProject() from the server but useProject is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/projects/project-provider.tsx","useProject");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call ProjectProvider() from the server but ProjectProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/projects/project-provider.tsx","ProjectProvider")},37960:(a,b,c)=>{"use strict";c.d(b,{vx:()=>e,yN:()=>d});let d={"openai/text-embedding-3-small":{dimensions:1536,maxInputTokens:8191},"openai/text-embedding-3-large":{dimensions:3072,maxInputTokens:8191},"openai/text-embedding-ada-002":{dimensions:1536,maxInputTokens:8191},"google/gemini-embedding-2":{dimensions:3072,maxInputTokens:8192},"google/gemini-embedding-001":{dimensions:3072,maxInputTokens:2048},"cohere/embed-english-v3.0":{dimensions:1024,maxInputTokens:512},"cohere/embed-multilingual-v3.0":{dimensions:1024,maxInputTokens:512},"voyage/voyage-3":{dimensions:1024,maxInputTokens:32e3},"voyage/voyage-3-lite":{dimensions:512,maxInputTokens:32e3},"voyage/voyage-code-3":{dimensions:1024,maxInputTokens:32e3},"mistral/mistral-embed":{dimensions:1024,maxInputTokens:8192},"jina/jina-embeddings-v3":{dimensions:1024,maxInputTokens:8192},"jina/jina-clip-v2":{dimensions:1024,maxInputTokens:8192},"nomic/nomic-embed-text-v1.5":{dimensions:768,maxInputTokens:8192}},e=[{id:"openai/text-embedding-3-small",label:"text-embedding-3-small",provider:"openai",dimensions:1536,maxInputTokens:8191,description:"Fast, cheap, strong general-purpose default."},{id:"openai/text-embedding-3-large",label:"text-embedding-3-large",provider:"openai",dimensions:3072,maxInputTokens:8191,description:"Highest quality OpenAI embeddings, larger vectors."},{id:"openai/text-embedding-ada-002",label:"text-embedding-ada-002",provider:"openai",dimensions:1536,maxInputTokens:8191,description:"Legacy model — kept for backward compatibility."},{id:"google/gemini-embedding-2",label:"gemini-embedding-2",provider:"google",dimensions:3072,maxInputTokens:8192,description:"Current Gemini embedding model with multilingual retrieval support."},{id:"google/gemini-embedding-001",label:"gemini-embedding-001",provider:"google",dimensions:3072,maxInputTokens:2048,description:"Gemini embedding 001."},{id:"cohere/embed-english-v3.0",label:"embed-english-v3.0",provider:"cohere",dimensions:1024,maxInputTokens:512,description:"Tuned for retrieval; great for English-heavy corpora."},{id:"cohere/embed-multilingual-v3.0",label:"embed-multilingual-v3.0",provider:"cohere",dimensions:1024,maxInputTokens:512,description:"100+ language multilingual retrieval embeddings."},{id:"voyage/voyage-3",label:"voyage-3",provider:"voyage",dimensions:1024,maxInputTokens:32e3,description:"Voyage's best general-purpose retrieval model."},{id:"voyage/voyage-3-lite",label:"voyage-3-lite",provider:"voyage",dimensions:512,maxInputTokens:32e3,description:"Optimized for latency and cost with strong performance."},{id:"voyage/voyage-code-3",label:"voyage-code-3",provider:"voyage",dimensions:1024,maxInputTokens:32e3,description:"Specialized for code retrieval tasks."},{id:"mistral/mistral-embed",label:"mistral-embed",provider:"mistral",dimensions:1024,maxInputTokens:8192,description:"Mistral's efficient embedding model for retrieval."},{id:"jina/jina-embeddings-v3",label:"jina-embeddings-v3",provider:"jina",dimensions:1024,maxInputTokens:8192,description:"Multilingual, task-specific embeddings from Jina AI."},{id:"jina/jina-clip-v2",label:"jina-clip-v2",provider:"jina",dimensions:1024,maxInputTokens:8192,description:"Multimodal embeddings for text and images."},{id:"nomic/nomic-embed-text-v1.5",label:"nomic-embed-text-v1.5",provider:"nomic",dimensions:768,maxInputTokens:8192,description:"Open-source, highly capable text embeddings."}]},40950:(a,b,c)=>{"use strict";c.d(b,{$:()=>i,r:()=>h});var d=c(16358),e=c(53160),f=c(2437),g=c(90241);let h=(0,f.F)("group/button cursor-pointer inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-white hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-muted border-border/50 hover:border-border aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted hover:border-border aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive text-white hover:bg-destructive/80 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function i({className:a,variant:b="default",size:c="default",...f}){return(0,d.jsx)(e.$,{"data-slot":"button",className:(0,g.cn)(h({variant:b,size:c,className:a})),...f})}},43735:(a,b,c)=>{Promise.resolve().then(c.bind(c,9714)),Promise.resolve().then(c.bind(c,99538)),Promise.resolve().then(c.bind(c,30015)),Promise.resolve().then(c.bind(c,71665)),Promise.resolve().then(c.bind(c,94638)),Promise.resolve().then(c.bind(c,32561)),Promise.resolve().then(c.bind(c,18353)),Promise.resolve().then(c.bind(c,96805)),Promise.resolve().then(c.bind(c,43883))},46089:(a,b,c)=>{"use strict";c.d(b,{$v:()=>x,EO:()=>s,Lt:()=>o,Rx:()=>y,Zr:()=>z,ck:()=>u,r7:()=>w,tv:()=>p,wd:()=>t,zu:()=>v});var d=c(16358);c(46407);var e=c(84682),f=c(44684),g=c(10671),h=c(80211),i=c(66924),j=c(96533),k=c(16165),l=c(98065),m=c(90241),n=c(40950);function o({...a}){return(0,d.jsx)(e.V,{"data-slot":"alert-dialog",...a})}function p({...a}){return(0,d.jsx)(f.t,{"data-slot":"alert-dialog-trigger",...a})}function q({...a}){return(0,d.jsx)(g.Z,{"data-slot":"alert-dialog-portal",...a})}function r({className:a,...b}){return(0,d.jsx)(h.X,{"data-slot":"alert-dialog-overlay",className:(0,m.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",a),...b})}function s({className:a,size:b="default",...c}){return(0,d.jsxs)(q,{children:[(0,d.jsx)(r,{}),(0,d.jsx)(i.h,{"data-slot":"alert-dialog-content","data-size":b,className:(0,m.cn)("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...c})]})}function t({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,m.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",a),...b})}function u({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,m.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",a),...b})}function v({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-dialog-media",className:(0,m.cn)("mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",a),...b})}function w({className:a,...b}){return(0,d.jsx)(j.L,{"data-slot":"alert-dialog-title",className:(0,m.cn)("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",a),...b})}function x({className:a,...b}){return(0,d.jsx)(k.r,{"data-slot":"alert-dialog-description",className:(0,m.cn)("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",a),...b})}function y({className:a,...b}){return(0,d.jsx)(n.$,{"data-slot":"alert-dialog-action",className:(0,m.cn)(a),...b})}function z({className:a,variant:b="outline",size:c="default",...e}){return(0,d.jsx)(l.H,{"data-slot":"alert-dialog-cancel",className:(0,m.cn)(a),render:(0,d.jsx)(n.$,{variant:b,size:c}),...e})}},48814:(a,b,c)=>{"use strict";c.d(b,{J:()=>f});var d=c(16358);c(46407);var e=c(90241);function f({className:a,...b}){return(0,d.jsx)("label",{"data-slot":"label",className:(0,e.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...b})}},52406:(a,b,c)=>{"use strict";function d(){return[{type:"image/x-icon",sizes:"16x16",url:"/favicon.ico?f418db460f797530"}]}c.r(b),c.d(b,{default:()=>d})},57693:(a,b,c)=>{"use strict";c.d(b,{I:()=>u,M5:()=>z,SQ:()=>t,_2:()=>w,lp:()=>v,lv:()=>x,mB:()=>A,nV:()=>y,rI:()=>r,ty:()=>s});var d=c(16358);c(46407);var e=c(34157),f=c(90560),g=c(30999),h=c(38671),i=c(65151),j=c(96999),k=c(47648),l=c(17629),m=c(40270),n=c(73332),o=c(36346),p=c(90241),q=c(35803);function r({...a}){return(0,d.jsx)(e.i,{"data-slot":"dropdown-menu",...a})}function s({...a}){return(0,d.jsx)(f.c,{"data-slot":"dropdown-menu-trigger",...a,className:(0,p.cn)("cursor-pointer",a.className)})}function t({align:a="start",alignOffset:b=0,side:c="bottom",sideOffset:e=4,className:f,...j}){return(0,d.jsx)(g.g,{children:(0,d.jsx)(h.y,{className:"isolate z-50 outline-none",align:a,alignOffset:b,side:c,sideOffset:e,children:(0,d.jsx)(i._,{"data-slot":"dropdown-menu-content",className:(0,p.cn)("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",f),...j})})})}function u({...a}){return(0,d.jsx)(j.r,{"data-slot":"dropdown-menu-group",...a})}function v({className:a,inset:b,...c}){return(0,d.jsx)(k.N,{"data-slot":"dropdown-menu-label","data-inset":b,className:(0,p.cn)("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",a),...c})}function w({className:a,inset:b,variant:c="default",...e}){return(0,d.jsx)(l.D,{"data-slot":"dropdown-menu-item","data-inset":b,"data-variant":c,className:(0,p.cn)("group/dropdown-menu-item relative flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-1.5 text-sm outline-hidden select-none not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive"," hover:bg-background ",a),...e})}function x({...a}){return(0,d.jsx)(m.h,{"data-slot":"dropdown-menu-sub",...a})}function y({className:a,inset:b,children:c,...e}){return(0,d.jsxs)(n.f,{"data-slot":"dropdown-menu-sub-trigger","data-inset":b,className:(0,p.cn)("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","h-8",a),...e,children:[c,(0,d.jsx)(q.A,{className:"ml-auto"})]})}function z({align:a="start",alignOffset:b=-3,side:c="right",sideOffset:e=0,className:f,...g}){return(0,d.jsx)(t,{"data-slot":"dropdown-menu-sub-content",className:(0,p.cn)("w-auto min-w-49! rounded-md bg-popover p-1 text-popover-foreground ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","",f),align:a,alignOffset:b,side:c,sideOffset:e,...g})}function A({className:a,...b}){return(0,d.jsx)(o.w,{"data-slot":"dropdown-menu-separator",className:(0,p.cn)("-mx-1 my-1 h-px bg-border",a),...b})}},61172:(a,b,c)=>{"use strict";c.d(b,{KB:()=>h,VY:()=>e,cj:()=>g,jX:()=>f});let d={lancedb:{id:"lancedb",label:"LanceDB",description:"Embedded vector database for local development, LanceDB Cloud, or persistent S3-compatible storage such as Cloudflare R2.",runtime:"both",installStatus:"installed",docsUrl:"https://lancedb.github.io/lancedb/",serverDependencies:{"@lancedb/lancedb":"^0.30.0"},fields:[{key:"mode",label:"Mode",type:"select",required:!0,defaultValue:"local",help:"Use a local disk, LanceDB Cloud, or an S3-compatible bucket for persistent serverless deployments.",options:[{label:"Local (on-disk)",value:"local"},{label:"S3-compatible (Vercel / R2 / S3)",value:"s3"},{label:"Cloud",value:"cloud"}]},{key:"dbPath",label:"Database path",type:"path",required:!0,defaultValue:"./.larkup/lancedb",placeholder:"./.larkup/lancedb",help:"Directory where the LanceDB tables are stored.",showWhen:{key:"mode",equals:["local"]}},{key:"s3Uri",label:"Database URI",type:"text",required:!0,placeholder:"s3://my-bucket/larkup/my-server",help:"A dedicated, private bucket prefix for LanceDB table files. This is persistent across Vercel invocations.",showWhen:{key:"mode",equals:["s3"]}},{key:"s3Endpoint",label:"S3 endpoint",type:"text",required:!1,placeholder:"https://<account-id>.r2.cloudflarestorage.com",help:"Required for Cloudflare R2 and other S3-compatible providers. Leave blank for AWS S3.",showWhen:{key:"mode",equals:["s3"]}},{key:"s3Region",label:"Region",type:"text",required:!0,defaultValue:"auto",placeholder:"auto",help:"Use “auto” for Cloudflare R2, or your bucket region for AWS S3.",showWhen:{key:"mode",equals:["s3"]}},{key:"s3AccessKeyId",label:"Access key ID",type:"password",required:!0,secret:!0,help:"Use an object read/write credential restricted to this bucket.",showWhen:{key:"mode",equals:["s3"]}},{key:"s3SecretAccessKey",label:"Secret access key",type:"password",required:!0,secret:!0,help:"Stored as a deployment environment variable; never expose it in the browser.",showWhen:{key:"mode",equals:["s3"]}},{key:"uri",label:"Cloud URI",type:"text",required:!0,placeholder:"db://my-database",help:"Your LanceDB Cloud database URI.",showWhen:{key:"mode",equals:["cloud"]}},{key:"apiKey",label:"API key",type:"password",required:!0,secret:!0,placeholder:"sk_...",help:"LanceDB Cloud API key. Stored as an env var in the generated server.",showWhen:{key:"mode",equals:["cloud"]}},{key:"tableName",label:"Table name",type:"text",required:!0,defaultValue:"documents",help:"The table that holds your embedded chunks."}]},pinecone:{id:"pinecone",label:"Pinecone",description:"Fully-managed cloud vector database. Cloud-only — requires an API key and an existing index.",runtime:"cloud",installStatus:"installed",docsUrl:"https://docs.pinecone.io/",serverDependencies:{"@pinecone-database/pinecone":"^6.0.0"},fields:[{key:"apiKey",label:"API key",type:"password",required:!0,secret:!0,placeholder:"pcsk_...",help:"Pinecone API key. Stored as an env var in the generated server."},{key:"indexName",label:"Index name",type:"text",required:!0,placeholder:"rag-index",help:"Name of the Pinecone index to upsert into / query. For hybrid/lexical mode this index must use the 'dotproduct' metric."},{key:"namespace",label:"Namespace",type:"text",required:!1,placeholder:"default",help:"Optional namespace to isolate this dataset within the index."},{key:"sparseModel",label:"Sparse model",type:"text",required:!0,defaultValue:"pinecone-sparse-english-v0",help:"Pinecone-hosted sparse model used to generate keyword vectors via the Inference API. Both dense and sparse vectors are stored in the same index.",showWhenIndexType:["lexical","hybrid"]}]},weaviate:{id:"weaviate",label:"Weaviate",description:"Open-source AI-native vector database with built-in hybrid search, BM25, and multi-tenancy.",runtime:"both",installStatus:"coming-soon",docsUrl:"https://weaviate.io/developers/weaviate",serverDependencies:{weaviate:"^3.0.0"},fields:[{key:"host",label:"Host URL",type:"text",required:!0,placeholder:"https://my-cluster.weaviate.network",help:"Weaviate Cloud URL or self-hosted host address."},{key:"apiKey",label:"API key",type:"password",required:!1,secret:!0,placeholder:"weaviate-api-key",help:"Weaviate Cloud API key (optional for self-hosted)."},{key:"className",label:"Collection name",type:"text",required:!0,defaultValue:"Documents",help:"The Weaviate collection (class) that holds your embedded chunks."}]},qdrant:{id:"qdrant",label:"Qdrant",description:"High-performance vector search engine with rich filtering, built for production-scale RAG.",runtime:"both",installStatus:"coming-soon",docsUrl:"https://qdrant.tech/documentation/",serverDependencies:{"@qdrant/js-client-rest":"^1.9.0"},fields:[{key:"url",label:"Host URL",type:"text",required:!0,placeholder:"http://localhost:6333",help:"Qdrant server URL (local or Qdrant Cloud endpoint)."},{key:"apiKey",label:"API key",type:"password",required:!1,secret:!0,placeholder:"qdrant-api-key",help:"Qdrant Cloud API key (leave blank for local)."},{key:"collectionName",label:"Collection name",type:"text",required:!0,defaultValue:"documents",help:"Qdrant collection to upsert into and query."}]},chroma:{id:"chroma",label:"Chroma",description:"Open-source, developer-friendly embedding database. Great for rapid local prototyping.",runtime:"both",installStatus:"installable",docsUrl:"https://docs.trychroma.com/",serverDependencies:{chromadb:"^1.9.0"},fields:[{key:"mode",label:"Mode",type:"select",required:!0,defaultValue:"server",help:"Server connects to a self-hosted Chroma instance. Cloud connects to Chroma Cloud.",options:[{label:"Server (Self-hosted)",value:"server"},{label:"Cloud (Chroma Cloud)",value:"cloud"}]},{key:"host",label:"Server URL",type:"text",required:!0,placeholder:"http://localhost:8000",defaultValue:"http://localhost:8000",help:"Chroma server URL (local Docker or remote).",showWhen:{key:"mode",equals:["server"]}},{key:"authToken",label:"Auth Token",type:"password",required:!1,secret:!0,placeholder:"chroma-token",help:"Optional static auth token for Chroma server.",showWhen:{key:"mode",equals:["server"]}},{key:"apiKey",label:"API Key",type:"password",required:!0,secret:!0,placeholder:"sk_...",help:"Chroma Cloud API Key.",showWhen:{key:"mode",equals:["cloud"]}},{key:"tenant",label:"Tenant",type:"text",required:!0,defaultValue:"default_tenant",help:"Tenant name for Chroma Cloud.",showWhen:{key:"mode",equals:["cloud"]}},{key:"database",label:"Database",type:"text",required:!0,defaultValue:"default_database",help:"Database name for Chroma Cloud.",showWhen:{key:"mode",equals:["cloud"]}},{key:"collectionName",label:"Collection name",type:"text",required:!0,defaultValue:"documents",help:"Chroma collection to store and retrieve embeddings."}]},pgvector:{id:"pgvector",label:"pgvector",description:"PostgreSQL extension for vector similarity search. Self-host vectors alongside your relational data.",runtime:"both",installStatus:"coming-soon",docsUrl:"https://github.com/pgvector/pgvector",serverDependencies:{pg:"^8.11.0",pgvector:"^0.2.0"},fields:[{key:"connectionString",label:"Connection string",type:"password",required:!0,secret:!0,placeholder:"postgresql://user:pass@localhost:5432/db",help:"Full PostgreSQL connection string."},{key:"tableName",label:"Table name",type:"text",required:!0,defaultValue:"embeddings",help:"The table used to store vector embeddings. Created automatically if absent."}]},supabase:{id:"supabase",label:"Supabase",description:"Postgres-backed vector store via the pgvector extension with Supabase's managed infrastructure.",runtime:"cloud",installStatus:"coming-soon",docsUrl:"https://supabase.com/docs/guides/ai",serverDependencies:{"@supabase/supabase-js":"^2.43.0"},fields:[{key:"url",label:"Project URL",type:"text",required:!0,placeholder:"https://xyz.supabase.co",help:"Your Supabase project URL."},{key:"serviceKey",label:"Service role key",type:"password",required:!0,secret:!0,placeholder:"eyJhbGci...",help:"Supabase service_role key (not the anon key). Stored as an env var."},{key:"tableName",label:"Table name",type:"text",required:!0,defaultValue:"documents",help:"Supabase table with a vector column for embeddings."}]}},e=Object.values(d);function f(a){return d[a]}function g(a,b,c){return a.fields.filter(a=>{if(a.showWhen){let c=b[a.showWhen.key]??"";if(!a.showWhen.equals.includes(c))return!1}return!a.showWhenIndexType||!c||!!a.showWhenIndexType.includes(c)})}function h(a,b,c){let d={};for(let e of g(a,b,c))e.required&&!b[e.key]?.trim()&&(d[e.key]=`${e.label} is required`);return d}},62350:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/app/template.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/app/template.tsx","default")},64108:(a,b,c)=>{Promise.resolve().then(c.bind(c,36952))},70367:(a,b,c)=>{"use strict";c.d(b,{ke:()=>i});var d=c(16358),e=c(64479),f=c(75103),g=c(53475),h=c(90241);function i({className:a,children:b,value:c,...f}){return(0,d.jsxs)(e.w,{value:c,"data-slot":"progress",className:(0,h.cn)("flex flex-wrap gap-3",a),...f,children:[b,(0,d.jsx)(j,{children:(0,d.jsx)(k,{})})]})}function j({className:a,...b}){return(0,d.jsx)(f.X,{className:(0,h.cn)("relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",a),"data-slot":"progress-track",...b})}function k({className:a,...b}){return(0,d.jsx)(g.Z,{"data-slot":"progress-indicator",className:(0,h.cn)("h-full bg-primary transition-all",a),...b})}},71236:(a,b,c)=>{"use strict";c.d(b,{GpuActivityIndicator:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call GpuActivityIndicator() from the server but GpuActivityIndicator is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/chat/gpu-activity-indicator.tsx","GpuActivityIndicator")},71665:(a,b,c)=>{"use strict";c.d(b,{B:()=>j,ProjectProvider:()=>k});var d=c(16358),e=c(46407),f=c(91725),g=c(39290);let h=a=>fetch(a).then(a=>a.json()),i=(0,e.createContext)(null);function j(){let a=(0,e.useContext)(i);if(!a)throw Error("useProject must be used within a ProjectProvider");return a}function k({children:a}){let{data:b,isLoading:c,mutate:j}=(0,f.u)("/api/projects",h,{revalidateOnFocus:!1}),l=b?.projects??[],m=l.find(a=>a.id===b?.activeProjectId),n=!c&&0===l.length,o=(0,e.useCallback)(async()=>{await (0,g.k)(()=>!0)},[]),p=(0,e.useCallback)(async a=>{let b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})}),c=await b.json();return await j(),await o(),c.project},[j,o]),q=(0,e.useCallback)(async a=>{await fetch("/api/projects",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"activate",projectId:a})}),await j(),await o()},[j,o]),r=(0,e.useCallback)(async(a,b)=>{await fetch("/api/projects",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",projectId:a,name:b})}),await j()},[j]),s=(0,e.useCallback)(async a=>{await fetch(`/api/projects?id=${encodeURIComponent(a)}`,{method:"DELETE"}),await j(),await o()},[j,o]);return(0,d.jsx)(i.Provider,{value:{isLoading:c,projects:l,activeProject:m,isFirstRun:n,refresh:()=>{j()},createProject:p,activateProject:q,renameProject:r,deleteProject:s},children:a})}},72801:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,35852,23))},73181:(a,b,c)=>{"use strict";c.d(b,{E:()=>i});var d=c(36967),e=c(66463),f=c(2437),g=c(90241);let h=(0,f.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function i({className:a,variant:b="default",render:c,...f}){return(0,e.C)({defaultTagName:"span",props:(0,d.v6)({className:(0,g.cn)(h({variant:b}),a)},f),render:c,state:{slot:"badge",variant:b}})}},77260:(a,b,c)=>{Promise.resolve().then(c.bind(c,62350))},78565:(a,b,c)=>{"use strict";c.d(b,{B:()=>o,q:()=>p});var d=c(16358),e=c(46407),f=c(77802),g=c(30322),h=c(40950),i=c(94636),j=c(48814),k=c(81040),l=c(46352),m=c(87821),n=c(56020);function o({onSave:a,type:b,onCancel:c}){let[g,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1),C=async()=>{if(!g||!u)return void f.oR.error("Base URL and Model Name are required");z(!0);try{if("embedding"===b){let a=await fetch("/api/config/test-embedding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:g,apiKey:q,modelName:u})}),b=await a.json();if(!a.ok)throw Error(b.error||"Connection failed");x(b.dimensions),B(!0),f.oR.success(`Success! Detected ${b.dimensions} dimensions.`)}else{let a=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify("vision"===b?{visionProvider:"custom",visionApiKey:q,visionModelId:`custom:${u}`,customVisionModels:[{baseUrl:g,apiKey:q,modelName:u}]}:{chatProvider:"custom",chatApiKey:q,customChatModels:[{baseUrl:g,apiKey:q,modelName:u}]})}),c=await a.json();if(!a.ok)throw Error(c.error||"Connection failed");B(!0),f.oR.success(`Success! ${"vision"===b?"Vision":"Chat"} model connected.`)}}catch(a){f.oR.error(a instanceof Error?a.message:"Test failed"),x(null),B(!1)}finally{z(!1)}};return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,d.jsxs)("div",{className:"grid gap-2",children:[(0,d.jsx)(j.J,{htmlFor:"baseUrl",children:"Base URL"}),(0,d.jsx)(i.p,{id:"baseUrl",placeholder:"https://api.example.com/v1",value:g,onChange:a=>{p(a.target.value),B(!1)}})]}),(0,d.jsxs)("div",{className:"grid gap-2",children:[(0,d.jsx)(j.J,{htmlFor:"apiKey",children:"API Key (Optional)"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(i.p,{id:"apiKey",type:s?"text":"password",placeholder:"sk-...",value:q,onChange:a=>{r(a.target.value),B(!1)},className:"pr-10"}),(0,d.jsx)("button",{type:"button",onClick:()=>t(!s),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground",children:s?(0,d.jsx)(k.A,{className:"size-4"}):(0,d.jsx)(l.A,{className:"size-4"})})]})]}),(0,d.jsxs)("div",{className:"grid gap-2",children:[(0,d.jsx)(j.J,{htmlFor:"modelName",children:"Model Name"}),(0,d.jsx)(i.p,{id:"modelName",placeholder:"embedding"===b?"my-embedding-model":"vision"===b?"my-vision-model":"my-chat-model",value:u,onChange:a=>{v(a.target.value),B(!1)}})]}),A&&(0,d.jsxs)("div",{className:"text-sm text-green-600 dark:text-green-400 font-medium",children:["✓ Connection verified ",w?`(${w} dimensions)`:""]})]}),(0,d.jsxs)("div",{className:"flex flex-row justify-between sm:justify-between items-center gap-2",children:[(0,d.jsxs)(h.$,{variant:"outline",type:"button",onClick:C,disabled:y,children:[y?(0,d.jsx)(m.A,{className:"size-4 animate-spin mr-2"}):(0,d.jsx)(n.A,{className:"size-4 mr-2"}),"Test Connection"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[c&&(0,d.jsx)(h.$,{variant:"ghost",type:"button",onClick:c,children:"Cancel"}),(0,d.jsx)(h.$,{className:"px-5",type:"button",onClick:()=>{g&&u&&A?a({baseUrl:g,apiKey:q,modelName:u,dimensions:w??void 0}):f.oR.error("Please test the connection first.")},disabled:!A,children:"Add Model"})]})]})]})}function p({open:a,onOpenChange:b,onSave:c,type:e}){return(0,d.jsx)(g.lG,{open:a,onOpenChange:b,children:(0,d.jsxs)(g.Cf,{className:"max-w-xl",children:[(0,d.jsxs)(g.c7,{children:[(0,d.jsxs)(g.L3,{children:["Custom ","embedding"===e?"Embedding":"vision"===e?"Vision":"Chat"," ","Model"]}),(0,d.jsxs)(g.rr,{children:["Connect an OpenAI-compatible"," ","embedding"===e?"embedding":"vision"===e?"vision":"chat"," model."]})]}),(0,d.jsx)(o,{type:e,onSave:a=>{c(a),b(!1)}})]})})}},82170:()=>{},83487:(a,b,c)=>{Promise.resolve().then(c.bind(c,71236)),Promise.resolve().then(c.bind(c,28475)),Promise.resolve().then(c.bind(c,16402)),Promise.resolve().then(c.bind(c,37295)),Promise.resolve().then(c.bind(c,37136)),Promise.resolve().then(c.bind(c,23223)),Promise.resolve().then(c.bind(c,2223)),Promise.resolve().then(c.bind(c,94763)),Promise.resolve().then(c.bind(c,73605))},84594:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>o,metadata:()=>n});var d=c(92576),e=c(94763);c(21077);var f=c(23223),g=c(37295),h=c(37136),i=c(28475),j=c(16402),k=c(71236),l=c(2223),m=c(73605);let n={title:"larkup",description:"larkup — a toolkit to build, index, and serve your own AI model and knowledge base."};function o({children:a}){return(0,d.jsx)("html",{lang:"en",suppressHydrationWarning:!0,className:"bg-transparent",children:(0,d.jsxs)("body",{suppressHydrationWarning:!0,className:"theme-gaia font-sans antialiased",children:[(0,d.jsx)("script",{dangerouslySetInnerHTML:{__html:"(function(){try{var t=localStorage.getItem('app-theme');var d=document.body;if(!t)return;d.classList.remove('theme-larkup','theme-gaia','theme-linear');if(t!=='default')d.classList.add(t);}catch(e){}})();"}}),(0,d.jsxs)(m.ThemeProvider,{attribute:"class",defaultTheme:"light",enableSystem:!0,disableTransitionOnChange:!0,children:[(0,d.jsx)(l.UpdateBanner,{}),(0,d.jsx)(h.ThemeCustomizerProvider,{children:(0,d.jsxs)(g.ProjectProvider,{children:[(0,d.jsx)(i.ClientLayoutWrapper,{children:a}),(0,d.jsx)(f.Toaster,{position:"bottom-right"}),(0,d.jsx)(j.GlobalIndexProgress,{}),(0,d.jsx)(k.GpuActivityIndicator,{})]})})]}),(0,d.jsx)(e.Analytics,{})]})})}},90241:(a,b,c)=>{"use strict";c.d(b,{cn:()=>f});var d=c(63671),e=c(89891);function f(...a){return(0,e.QP)((0,d.$)(a))}},92671:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,35852,23)),Promise.resolve().then(c.t.bind(c,38807,23)),Promise.resolve().then(c.t.bind(c,42971,23)),Promise.resolve().then(c.t.bind(c,64142,23)),Promise.resolve().then(c.t.bind(c,6858,23)),Promise.resolve().then(c.t.bind(c,12270,23)),Promise.resolve().then(c.t.bind(c,80619,23)),Promise.resolve().then(c.t.bind(c,56334,23))},92786:()=>{},94636:(a,b,c)=>{"use strict";c.d(b,{p:()=>g});var d=c(16358);c(46407);var e=c(72236),f=c(90241);function g({className:a,type:b,...c}){return(0,d.jsx)(e.p,{type:b,"data-slot":"input",className:(0,f.cn)("h-10 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/60 placeholder:text-xs focus-visible:ring-ring/10 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...c})}},94638:(a,b,c)=>{"use strict";c.d(b,{S:()=>f,ThemeCustomizerProvider:()=>i,y:()=>h});var d=c(16358),e=c(46407);let f="theme-gaia",g=(0,e.createContext)(null);function h(){let a=(0,e.useContext)(g);if(!a)throw Error("useThemeCustomizer must be used within a ThemeCustomizerProvider");return a}function i({children:a}){let[b,c]=(0,e.useState)(!1),[h,j]=(0,e.useState)(f),[k,l]=(0,e.useState)("sidebar");return(0,d.jsx)(g.Provider,{value:{theme:h,setTheme:(a,b=!0)=>{j(a)},layout:k,setLayout:(a,b=!0)=>{l(a)},isMounted:b},children:a})}},99538:(a,b,c)=>{"use strict";c.d(b,{ClientLayoutWrapper:()=>U});var d=c(16358),e=c(94638),f=c(46407),g=c(32829),h=c.n(g),i=c(37904),j=c(40491),k=c(79265),l=c(20626),m=c(51714),n=c(6164),o=c(45351),p=c(90241),q=c(28173),r=c(59322),s=c(73775),t=c(14206),u=c(55444),v=c(57693),w=c(71665),x=c(5955),y=c(77802),z=c(87821),A=c(40950),B=c(30322);function C({target:a,open:b,onOpenChange:c}){let{deleteProject:e}=(0,w.B)(),[g,h]=(0,f.useState)(!1);async function i(){if(a){h(!0);try{await e(a.id),y.oR.success(`Deleted "${a.name}".`),c(!1)}catch{y.oR.error("Could not delete the Project.")}finally{h(!1)}}}return(0,d.jsx)(B.lG,{open:b,onOpenChange:c,children:(0,d.jsxs)(B.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(B.c7,{children:[(0,d.jsxs)(B.L3,{children:["Delete “",a?.name,"”?"]}),(0,d.jsx)(B.rr,{children:"This permanently removes the Project's documents, index, vector data, and generated files. This cannot be undone."})]}),(0,d.jsxs)(B.Es,{children:[(0,d.jsx)(A.$,{variant:"outline",onClick:()=>c(!1),disabled:g,children:"Cancel"}),(0,d.jsxs)(A.$,{variant:"destructive",onClick:()=>void i(),disabled:g,children:[g&&(0,d.jsx)(z.A,{className:"size-4 animate-spin"}),"Delete Project"]})]})]})})}function D(){let{projects:a,activeProject:b,activateProject:c}=(0,w.B)(),[e,g]=(0,f.useState)(!1),[h,i]=(0,f.useState)(null),[j,l]=(0,f.useState)(null);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(v.rI,{children:[(0,d.jsxs)(v.ty,{render:(0,d.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,d.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-primary/12 text-primary",children:(0,d.jsx)(o.A,{className:"size-3.5"})}),(0,d.jsx)("span",{className:"flex min-w-0 flex-1 flex-col",children:(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:b?.name??"No project"}),b?.running&&(0,d.jsx)(E,{})]})}),(0,d.jsx)(r.A,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,d.jsxs)(v.SQ,{align:"start",sideOffset:6,className:"w-(--anchor-width) min-w-65",children:[(0,d.jsxs)(v.I,{children:[(0,d.jsx)(v.lp,{children:"Your projects"}),a.map(a=>{let e=a.id===b?.id;return(0,d.jsxs)(v._2,{onClick:()=>{e||c(a.id)},className:"gap-2",children:[(0,d.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:(0,d.jsx)(o.A,{className:"size-3.5"})}),(0,d.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,d.jsx)("span",{className:"truncate font-medium",children:a.name}),(0,d.jsxs)("span",{className:"flex items-center gap-2 text-[11px] text-muted-foreground tabular-nums",children:[(0,d.jsxs)("span",{children:[a.sourceCount," sources"]}),a.indexed&&(0,d.jsx)("span",{children:"\xb7 indexed"}),a.running&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-green-500",children:[(0,d.jsx)(E,{}),"live"]})]})]}),e&&(0,d.jsx)(s.A,{className:"size-4 shrink-0 text-primary"})]},a.id)})]}),(0,d.jsx)(v.mB,{}),(0,d.jsxs)(v._2,{onClick:()=>g(!0),className:"gap-2 h-9",children:[(0,d.jsx)(k.A,{className:"size-4"}),"New project"]}),b&&(0,d.jsxs)(v._2,{onClick:()=>i(b),className:"gap-2 h-9",children:[(0,d.jsx)(t.A,{className:"size-4"}),"Rename current"]}),b&&a.length>1&&(0,d.jsxs)(v._2,{variant:"destructive",onClick:()=>l(b),className:"gap-2",children:[(0,d.jsx)(u.A,{className:"size-4"}),"Delete current project"]})]})]}),(0,d.jsx)(x.S,{mode:"create",open:e,onOpenChange:g}),(0,d.jsx)(x.S,{mode:"rename",target:h,open:null!==h,onOpenChange:a=>!a&&i(null)}),(0,d.jsx)(C,{target:j,open:null!==j,onOpenChange:a=>!a&&l(null)})]})}function E(){return(0,d.jsxs)("span",{className:"relative flex size-2",children:[(0,d.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,d.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-500"})]})}let F=[{id:"chat",label:"Chat",href:"/chat",icon:j.A},{id:"add",label:"Add",href:"/add",icon:k.A},{id:"data",label:"Data",href:"/data",icon:l.A},{id:"settings",label:"Settings",href:"/settings",icon:m.A}];function G(){let a=(0,i.usePathname)(),{activeProject:b}=(0,w.B)(),[c,e]=(0,f.useState)(!0),g=()=>{let a=!c;e(a),localStorage.setItem("sidebar-collapsed",String(a))};return(0,d.jsx)(q.Bc,{delay:150,children:(0,d.jsxs)("aside",{className:(0,p.cn)("sticky top-0 hidden h-screen shrink-0 flex-col self-start py-4 md:flex transition-all duration-300 ease-in-out bg-sidebar",c?"w-18":"w-60"),children:[(0,d.jsx)("div",{className:(0,p.cn)("flex w-full items-center mb-6",c?"justify-center px-3":"justify-between px-4"),children:c?(0,d.jsxs)(q.m_,{children:[(0,d.jsxs)(q.k$,{render:(0,d.jsx)("button",{onClick:g,"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,d.jsx)("img",{src:"/logo9.png",className:"size-5 dark:hidden",alt:"logo"}),(0,d.jsx)("img",{src:"/logo.png",className:"size-5 hidden dark:block",alt:"logo"})]}),(0,d.jsx)(q.ZI,{side:"right",sideOffset:10,children:"Expand sidebar"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(h(),{href:"/chat",className:"flex items-center gap-2.5",children:[(0,d.jsxs)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:[(0,d.jsx)("img",{src:"/logo9.png",className:"size-5 dark:hidden",alt:"logo"}),(0,d.jsx)("img",{src:"/logo.png",className:"size-5 hidden dark:block",alt:"logo"})]}),(0,d.jsx)("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Larkup"})]}),(0,d.jsx)("button",{onClick:g,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,d.jsx)(n.A,{className:"size-3.5"})})]})}),(0,d.jsx)("nav",{className:(0,p.cn)("flex flex-1 flex-col w-full",c?"items-center px-3 gap-3":"px-3 gap-1.5"),children:F.map(b=>{let e=b.icon,f=a===b.href||"/"!==b.href&&a?.startsWith(b.href);return c?(0,d.jsxs)(q.m_,{children:[(0,d.jsx)(q.k$,{className:"",render:(0,d.jsx)(h(),{href:b.href,"aria-current":f?"page":void 0,onClick:c=>{"chat"===b.id&&"/chat"===a&&(c.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,p.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",f?"bg-sidebar-accent/60 text-sidebar-accent-foreground hover:bg-sidebar-accent":"text-muted-foreground hover:bg-white/65 hover:text-foreground")}),children:(0,d.jsx)(e,{className:"size-4.5",strokeWidth:f?2.25:1.75})}),(0,d.jsx)(q.ZI,{side:"right",sideOffset:10,children:b.label})]},b.id):(0,d.jsxs)(h(),{href:b.href,"aria-current":f?"page":void 0,onClick:c=>{"chat"===b.id&&"/chat"===a&&(c.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,p.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",f?"bg-sidebar-accent/70 text-sidebar-accent-foreground hover:bg-sidebar-accent/70":"text-muted-foreground hover:bg-white/65 hover:text-foreground"),children:[(0,d.jsx)(e,{className:"size-4.5 shrink-0",strokeWidth:f?2.25:1.75}),(0,d.jsx)("span",{className:"truncate",children:b.label})]},b.id)})}),(0,d.jsx)("div",{className:(0,p.cn)("w-full pt-3",c?"px-2":"px-3"),children:c?(0,d.jsxs)(q.m_,{children:[(0,d.jsx)(q.k$,{render:(0,d.jsx)("button",{onClick:g,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,d.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,d.jsx)(o.A,{className:"size-4"}),(0,d.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-2.5",children:b?.running?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,d.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-green-500 border border-card"})]}):(0,d.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-gray-500 border border-card"})})]})}),(0,d.jsxs)(q.ZI,{side:"right",sideOffset:10,children:[b?.name??"No project"," (",b?.running?"Live":"Offline",")"]})]}):(0,d.jsx)(D,{})})]})})}let H=[{id:"chat",label:"Chat",href:"/chat",icon:j.A},{id:"add",label:"Add",href:"/add",icon:k.A},{id:"data",label:"Data",href:"/data",icon:l.A},{id:"settings",label:"Settings",href:"/settings",icon:m.A}];function I(){let a=(0,i.usePathname)();return(0,d.jsx)(q.Bc,{delay:150,children:(0,d.jsxs)("header",{className:(0,p.cn)("sticky top-0 z-50 flex h-14 shrink-0 items-center gap-6 border-b border-border px-4 md:px-6 bg-sidebar"),children:[(0,d.jsxs)(h(),{href:"/chat","aria-label":"larkup home",className:"flex items-center gap-2.5 shrink-0",children:[(0,d.jsxs)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:[(0,d.jsx)("img",{src:"/logo9.png",className:"size-5 dark:hidden",alt:"logo"}),(0,d.jsx)("img",{src:"/logo.png",className:"size-5 hidden dark:block",alt:"logo"})]}),(0,d.jsx)("span",{className:"font-semibold tracking-tight text-foreground hidden sm:inline-block",children:"Larkup"})]}),(0,d.jsx)("nav",{className:"flex h-full items-center gap-1",children:H.map(b=>{let c=b.icon,e=a===b.href||"/"!==b.href&&a?.startsWith(b.href);return(0,d.jsxs)(h(),{href:b.href,"aria-current":e?"page":void 0,className:(0,p.cn)("group relative flex items-center gap-2 h-full px-3 text-[13px] font-medium transition-colors outline-none",e?"text-primary":"text-muted-foreground hover:text-foreground"),children:[(0,d.jsx)(c,{className:"size-4",strokeWidth:e?2.25:1.75}),(0,d.jsx)("span",{className:"hidden md:inline",children:b.label}),(0,d.jsx)("span",{className:(0,p.cn)("absolute bottom-0 left-2 right-2 h-0.5 rounded-full bg-primary transition-opacity",e?"opacity-100":"opacity-0")})]},b.id)})}),(0,d.jsx)("div",{className:"flex-1"}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(D,{}),""]})]})})}var J=c(81040),K=c(46352),L=c(97768),M=c(63323),N=c(22229),O=c(94636),P=c(15478),Q=c(13139),R=c(78565);let S=["vercel_ai_gateway","openai","google","mistral","custom"];function T(){let{createProject:a,refresh:b}=(0,w.B)(),c=(0,i.useRouter)(),[e,g]=(0,f.useState)(""),[h,j]=(0,f.useState)("vercel_ai_gateway"),[k,l]=(0,f.useState)(""),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)("vercel_ai_gateway"),[q,r]=(0,f.useState)(""),[s,u]=(0,f.useState)(null),[v,x]=(0,f.useState)(!1),[C,D]=(0,f.useState)(!1),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)("vercel_ai_gateway"),[I,T]=(0,f.useState)(""),[U,V]=(0,f.useState)(!1),[W,X]=(0,f.useState)(!1),[Y,Z]=(0,f.useState)(!1),[$,_]=(0,f.useState)(null),aa="custom"===h,ab="custom"===o,ac=C||aa||h!==o?q:k,ad=async()=>{x(!0);try{let d=await fetch("/api/config"),{config:f}=await d.json(),g={...f};aa&&m?(g.embeddingProvider="custom",g.embeddingModelId=`custom:${m.modelName}`,g.embeddingApiKey=m.apiKey||void 0,g.customEmbeddings=[m]):(g.embeddingProvider=h,g.embeddingApiKey=k),C?ab&&s?(g.chatProvider="custom",g.chatModelId=`custom:${s.modelName}`,g.chatApiKey=s.apiKey||void 0,g.customChatModels=[s]):(g.chatProvider=o,g.chatApiKey=ac):aa&&m||(g.chatProvider=h,g.chatApiKey=k),g.visionProvider=E?G:g.chatProvider,g.visionApiKey=E?I:g.chatApiKey,g.visionModelId="";let i=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embeddingProvider:g.embeddingProvider,embeddingApiKey:g.embeddingApiKey,embeddingModelId:g.embeddingModelId,customEmbeddings:g.customEmbeddings,chatProvider:g.chatProvider,chatApiKey:g.chatApiKey,chatModelId:g.chatModelId,customChatModels:g.customChatModels,visionProvider:g.visionProvider,visionApiKey:g.visionApiKey,visionModelId:g.visionModelId})});if(!i.ok){let a=await i.json();y.oR.error(a.error||"Verification failed — please check your API key.",{duration:8e3}),x(!1);return}await a(e.trim()||"my-larkup"),await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),b(),c.push("/chat")}catch(a){y.oR.error("Failed to complete setup")}finally{x(!1)}},ae=async()=>{x(!0);try{await a(e.trim()||"my-larkup"),b(),c.push("/chat")}catch(a){y.oR.error("Failed to complete setup")}finally{x(!1)}},af=(a,b)=>(0,d.jsxs)(P.l6,{value:a,onValueChange:a=>{var c;"custom"===(c=a??"")?("embedding"===b?j("custom"):p("custom"),_(b)):"embedding"===b?(j(c),n(null),!C&&p(c),!E&&H(c)):(p(c),u(null))},children:[(0,d.jsx)(P.bq,{className:"w-full bg-white/90 hover:bg-white",children:(0,d.jsx)("span",{className:"flex items-center gap-2",children:Q.Qd[a]?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Q.rb,{src:Q.Qd[a].iconSrc,alt:Q.Qd[a].label,pillBg:Q.Qd[a].pillBg,size:16}),Q.Qd[a].label]}):"Select provider"})}),(0,d.jsx)(P.gC,{children:S.map(a=>{let b=Q.Qd[a];return b?(0,d.jsx)(P.eb,{value:a,children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(Q.rb,{src:b.iconSrc,alt:b.label,pillBg:b.pillBg,size:16}),(0,d.jsxs)("span",{children:[b.label,"vercel_ai_gateway"===a&&" (Recommended)","custom"===a&&" (OpenAI-compatible)"]})]})},a):null})})]}),ag=(a,b)=>(0,d.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,d.jsx)("span",{className:"text-green-600 text-xs",children:"✓"}),(0,d.jsx)("span",{className:"flex-1 truncate text-xs font-medium text-foreground",children:a.modelName}),(0,d.jsx)("button",{type:"button",onClick:()=>_(b),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,d.jsx)(t.A,{className:"size-3"})})]});return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-background",children:[(0,d.jsxs)("div",{className:"pointer-events-none fixed inset-0 overflow-hidden",children:[(0,d.jsx)("div",{className:"absolute -left-20 -top-20 h-125 w-125 rounded-full bg-stone-200/40 blur-3xl animate-pulse"}),(0,d.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,d.jsx)("div",{className:"relative z-10 flex min-h-full w-full flex-col items-center justify-center px-6 py-12",children:(0,d.jsxs)("div",{className:"flex w-full max-w-lg flex-col items-center gap-8 animate-fade-up",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[(0,d.jsx)("div",{className:"flex size-14 items-center justify-center rounded-xl bg-primary text-primary-foreground ",children:(0,d.jsx)("img",{src:"/logo9.png",className:"size-8",alt:"Larkup"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Welcome to Larkup"}),(0,d.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,d.jsxs)("div",{className:"w-full space-y-5 rounded-2xl p-6 backdrop-blur-xl",children:[(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Your Name (Optional)"}),(0,d.jsx)(O.p,{value:e,onChange:a=>g(a.target.value),placeholder:"How should we call you?",className:"bg-white"})]}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Embedding Provider"}),af(h,"embedding"),aa&&m&&ag(m,"embedding"),aa&&!m&&(0,d.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!aa&&(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsxs)("label",{className:"text-xs font-medium text-foreground",children:["API Key",!C&&(0,d.jsxs)("span",{className:"text-muted-foreground font-normal",children:[" ","(used for both embedding & chat)"]})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(O.p,{type:U?"text":"password",value:k,onChange:a=>l(a.target.value),placeholder:"sk-...",className:"bg-white pr-10"}),(0,d.jsx)("button",{type:"button","aria-label":U?"Hide API key":"Show API key",onClick:()=>V(a=>!a),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:U?(0,d.jsx)(J.A,{className:"size-4"}):(0,d.jsx)(K.A,{className:"size-4"})})]})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>D(!C),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[C?(0,d.jsx)(L.A,{className:"size-3.5"}):(0,d.jsx)(M.A,{className:"size-3.5"}),"Use a different chat model"]}),C&&(0,d.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat Provider"}),af(o,"chat"),ab&&s&&ag(s,"chat"),ab&&!s&&(0,d.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!ab&&(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat API Key"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(O.p,{type:W?"text":"password",value:q,onChange:a=>r(a.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,d.jsx)("button",{type:"button","aria-label":W?"Hide chat API key":"Show chat API key",onClick:()=>X(a=>!a),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:W?(0,d.jsx)(J.A,{className:"size-4"}):(0,d.jsx)(K.A,{className:"size-4"})})]})]})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>F(!E),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[E?(0,d.jsx)(L.A,{className:"size-3.5"}):(0,d.jsx)(M.A,{className:"size-3.5"}),"Use a dedicated vision model for video and images"]}),E&&(0,d.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Vision Provider"}),(0,d.jsxs)(P.l6,{value:G,onValueChange:a=>H(a??""),children:[(0,d.jsx)(P.bq,{className:"w-full bg-white/90 hover:bg-white",children:(0,d.jsx)("span",{className:"flex items-center gap-2",children:Q.Qd[G]?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Q.rb,{src:Q.Qd[G].iconSrc,alt:Q.Qd[G].label,pillBg:Q.Qd[G].pillBg,size:16}),Q.Qd[G].label]}):"Select provider"})}),(0,d.jsx)(P.gC,{children:S.filter(a=>"custom"!==a).map(a=>{let b=Q.Qd[a];return b?(0,d.jsx)(P.eb,{value:a,children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(Q.rb,{src:b.iconSrc,alt:b.label,pillBg:b.pillBg,size:16}),(0,d.jsx)("span",{children:b.label})]})},a):null})})]}),(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Only vision-capable models are used; the default is selected automatically."})]}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Vision API Key"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(O.p,{type:Y?"text":"password",value:I,onChange:a=>T(a.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,d.jsx)("button",{type:"button","aria-label":Y?"Hide vision API key":"Show vision API key",onClick:()=>Z(a=>!a),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:Y?(0,d.jsx)(J.A,{className:"size-4"}):(0,d.jsx)(K.A,{className:"size-4"})})]})]})]}),(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"More providers and fine-grained model selection available in Settings → AI Models."}),(0,d.jsxs)("div",{className:"pt-2 flex gap-3",children:[(0,d.jsx)(A.$,{variant:"outline",className:"flex-1 h-10",onClick:ae,disabled:v,children:"Skip for now"}),(0,d.jsx)(A.$,{className:"flex-1 h-10",onClick:ad,disabled:v||!(()=>{if(aa){if(!m)return!1}else if(!k)return!1;if(C){if(ab){if(!s)return!1}else if(!ac)return!1}return!E||!!I})(),children:v?(0,d.jsx)(z.A,{className:"size-4 animate-spin"}):(0,d.jsxs)(d.Fragment,{children:["Continue ",(0,d.jsx)(N.A,{className:"ml-1.5 size-4"})]})})]})]})]})}),(0,d.jsx)(B.lG,{open:null!==$,onOpenChange:a=>{a||("embedding"!==$||m||j("vercel_ai_gateway"),"chat"!==$||s||p("vercel_ai_gateway"),_(null))},children:(0,d.jsxs)(B.Cf,{className:"max-w-xl",children:[(0,d.jsxs)(B.c7,{children:[(0,d.jsxs)(B.L3,{children:["Custom ","embedding"===$?"Embedding":"Chat"," Model"]}),(0,d.jsxs)(B.rr,{children:["Connect an OpenAI-compatible ","embedding"===$?"embedding":"chat"," ","model. Test the connection before adding."]})]}),$&&(0,d.jsx)(R.B,{type:$,onSave:a=>{"embedding"===$?(n(a),j("custom")):"chat"===$&&(u(a),p("custom")),_(null)},onCancel:()=>{"embedding"!==$||m||j("vercel_ai_gateway"),"chat"!==$||s||p("vercel_ai_gateway"),_(null)}})]})})]})}function U({children:a}){let{layout:b}=(0,e.y)(),c=(0,i.usePathname)(),f=c?.includes("/chat"),{isFirstRun:g,isLoading:h}=(0,w.B)();return!h&&g?(0,d.jsx)(T,{}):h?(0,d.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,d.jsx)("div",{className:"size-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):"topnav"===b?(0,d.jsxs)("div",{className:"flex flex-col h-screen overflow-hidden",children:[(0,d.jsx)(I,{}),(0,d.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,d.jsx)("div",{className:"h-full flex flex-col bg-background text-foreground",children:(0,d.jsx)("div",{className:(0,p.cn)("flex-1 min-h-0",f||c?.includes("/settings")||c?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,d.jsx)("div",{className:(0,p.cn)("h-full w-full",f||c?.includes("/settings")||c?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:a})})})})]}):(0,d.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,d.jsx)(G,{}),(0,d.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,d.jsx)("div",{className:"h-screen flex flex-col border-l border-border/90 bg-background text-foreground overflow-hidden",children:(0,d.jsx)("div",{className:(0,p.cn)("flex-1 min-h-0",f||c?.includes("/settings")||c?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,d.jsx)("div",{className:(0,p.cn)("h-full w-full",f||c?.includes("/settings")||c?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:a})})})})]})}}};
1
+ exports.id=2683,exports.ids=[2683],exports.modules={2223:(a,b,c)=>{"use strict";c.d(b,{UpdateBanner:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call UpdateBanner() from the server but UpdateBanner is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/update-banner.tsx","UpdateBanner")},5955:(a,b,c)=>{"use strict";c.d(b,{S:()=>m});var d=c(16358),e=c(46407),f=c(77802),g=c(87821),h=c(40950),i=c(30322),j=c(94636),k=c(48814),l=c(71665);function m({mode:a,target:b,open:c,onOpenChange:n}){let{createProject:o,renameProject:p}=(0,l.B)(),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(!1);async function u(){let c=q.trim();if(!c)return void f.oR.error("Enter a project name.");t(!0);try{if("create"===a){let a=await o(c);a&&f.oR.success(`Created "${a.name}" and switched to it.`)}else b&&(await p(b.id,c),f.oR.success("Project renamed."));n(!1)}catch{f.oR.error("Something went wrong. Try again.")}finally{t(!1)}}return(0,d.jsx)(i.lG,{open:c,onOpenChange:n,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:"create"===a?"New project":"Rename project"}),(0,d.jsx)(i.rr,{children:"create"===a?"Each project is an isolated environment with its own documents, index, and settings.":"Give this project a clearer name."})]}),(0,d.jsxs)("div",{className:"grid gap-2",children:[(0,d.jsx)(k.J,{htmlFor:"server-name",children:"Project name"}),(0,d.jsx)(j.p,{id:"server-name",value:q,autoFocus:!0,placeholder:"e.g. docs-assistant",onChange:a=>r(a.target.value),onKeyDown:a=>{"Enter"===a.key&&u()}})]}),(0,d.jsxs)(i.Es,{children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>n(!1),disabled:s,children:"Cancel"}),(0,d.jsxs)(h.$,{onClick:()=>void u(),disabled:s,children:[s&&(0,d.jsx)(g.A,{className:"size-4 animate-spin"}),"create"===a?"Create project":"Save"]})]})]})})}},9249:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,97638,23))},9714:(a,b,c)=>{"use strict";c.d(b,{GpuActivityIndicator:()=>i});var d=c(16358),e=c(15670),f=c(91725);let g=a=>fetch(a).then(a=>a.json());function h({percent:a}){let b=2*Math.PI*14,c=Math.max(0,Math.min(100,a));return(0,d.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",className:"shrink-0 -rotate-90",children:[(0,d.jsx)("circle",{cx:"16",cy:"16",r:14,className:"stroke-emerald-500/20",strokeWidth:"3",fill:"none"}),(0,d.jsx)("circle",{cx:"16",cy:"16",r:14,className:"stroke-emerald-500 transition-[stroke-dashoffset] duration-500",strokeWidth:"3",fill:"none",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:b-c/100*b})]})}function i(){let{data:a}=(0,f.u)("/api/gpu-activity",g,{refreshInterval:a=>a?.activity?.phase==="waking-up"?1e3:4e3}),b=a?.activity;return!b||"waking-up"!==b.phase||b.toolCallId?null:(0,d.jsx)("div",{className:"fixed bottom-24 right-6 z-50",children:(0,d.jsxs)("div",{className:"flex items-center gap-3 rounded-xl border bg-white dark:bg-background px-3 py-2 text-sm font-medium shadow-xs",children:[(0,d.jsx)(h,{percent:b.percent}),(0,d.jsxs)("div",{className:"flex flex-col items-start gap-0.5 pr-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(e.A,{className:"size-4"}),(0,d.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:b.label})]}),(0,d.jsx)("span",{className:"larkup-shimmer-text leading-none",children:b.message}),(0,d.jsxs)("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[Math.round(b.percent),"%"]})]})]})})}},13139:(a,b,c)=>{"use strict";c.d(b,{D_:()=>g,Qd:()=>f,rb:()=>h});var d=c(16358),e=c(90241);let f={vercel_ai_gateway:{label:"Vercel AI Gateway",iconSrc:"/icons/vercel.svg",pillBg:"bg-white dark:bg-white text-white dark:text-black"},openai:{label:"OpenAI",iconSrc:"/icons/openai.svg",pillBg:"bg-neutral-100 dark:bg-neutral-800"},anthropic:{label:"Anthropic",iconSrc:"https://models.dev/logos/anthropic.svg",pillBg:"bg-amber-50 dark:bg-amber-950/40"},google:{label:"Google",iconSrc:"/icons/gemini.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},meta:{label:"Meta",iconSrc:"https://models.dev/logos/meta.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},mistral:{label:"Mistral",iconSrc:"/icons/mistral.svg",pillBg:"bg-amber-50 dark:bg-amber-950/40"},cohere:{label:"Cohere",iconSrc:"/icons/cohere.svg",pillBg:"bg-orange-50 dark:bg-orange-950/40"},deepseek:{label:"DeepSeek",iconSrc:"https://models.dev/logos/deepseek.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},amazon:{label:"Amazon",iconSrc:"/icons/aws.svg",pillBg:"bg-orange-50 dark:bg-orange-950/40"},xai:{label:"xAI",iconSrc:"https://models.dev/logos/xai.svg",pillBg:"bg-neutral-100 dark:bg-neutral-800"},perplexity:{label:"Perplexity",iconSrc:"https://models.dev/logos/perplexity.svg",pillBg:"bg-teal-50 dark:bg-teal-950/40"},alibaba:{label:"Alibaba",iconSrc:"https://models.dev/logos/alibaba.svg",pillBg:"bg-orange-50 dark:bg-orange-950/40"},groq:{label:"Groq",iconSrc:"https://models.dev/logos/groq.svg",pillBg:"bg-orange-50 dark:bg-orange-950/40"},"together-ai":{label:"Together AI",iconSrc:"https://models.dev/logos/together-ai.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},fireworks:{label:"Fireworks",iconSrc:"https://models.dev/logos/fireworks.svg",pillBg:"bg-purple-50 dark:bg-purple-950/40"},cerebras:{label:"Cerebras",iconSrc:"https://models.dev/logos/cerebras.svg",pillBg:"bg-green-50 dark:bg-green-950/40"},voyage:{label:"Voyage AI",iconSrc:"/icons/voyage-light.png",pillBg:"bg-slate-100 dark:bg-slate-800"},jina:{label:"Jina AI",iconSrc:"/icons/jina.svg",pillBg:"bg-rose-50 dark:bg-rose-950/40"},nomic:{label:"Nomic",iconSrc:"/icons/nomic.png",pillBg:"bg-teal-50 dark:bg-teal-950/40"},minimax:{label:"MiniMax",iconSrc:"https://models.dev/logos/minimax.svg",pillBg:"bg-blue-50 dark:bg-blue-950/40"},elevenlabs:{label:"ElevenLabs",iconSrc:"https://models.dev/logos/elevenlabs.svg",pillBg:"bg-neutral-100 dark:bg-neutral-800"},custom:{label:"Custom",iconSrc:"/logo.png",pillBg:"bg-slate-100 dark:bg-slate-800"}};function g(a){return f[a]??{label:a.charAt(0).toUpperCase()+a.slice(1),iconSrc:`https://models.dev/logos/${a}.svg`,pillBg:"bg-slate-100 dark:bg-slate-800"}}function h({src:a,alt:b,pillBg:c,size:f=20}){return(0,d.jsx)("span",{className:(0,e.cn)("inline-flex shrink-0 items-center justify-center rounded",c),style:{width:f,height:f},children:a?(0,d.jsx)("img",{src:a,alt:b,width:f-4,height:f-4,className:"object-contain",style:{maxWidth:f-4,maxHeight:f-4}}):null})}},15478:(a,b,c)=>{"use strict";c.d(b,{bq:()=>x,eb:()=>z,gC:()=>y,l6:()=>v,yv:()=>w});var d=c(16358);c(46407);var e=c(47471),f=c(95853),g=c(21241),h=c(24745),i=c(62111),j=c(35331),k=c(24473),l=c(69943),m=c(70401),n=c(67274),o=c(61416),p=c(16209),q=c(13443),r=c(90241),s=c(63323),t=c(73775),u=c(97768);let v=e.H;function w({className:a,...b}){return(0,d.jsx)(f.y,{"data-slot":"select-value",className:(0,r.cn)("flex flex-1 text-left",a),...b})}function x({className:a,size:b="default",children:c,...e}){return(0,d.jsxs)(g.b,{"data-slot":"select-trigger","data-size":b,className:(0,r.cn)("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-background","pr-3 pl-3 text-sm whitespace-nowrap select-none outline-none","transition-all duration-150","hover:border-foreground/7 hover:bg-accent/90","data-[state=open]:border-primary/60 data-[state=open]:ring-2 data-[state=open]:ring-primary/15","data-[size=default]:h-10 data-[size=sm]:h-7 data-[size=sm]:rounded-lg","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5","disabled:cursor-not-allowed disabled:opacity-50","aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20","dark:bg-input/30 dark:hover:bg-input/50","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...e,children:[c,(0,d.jsx)(h.w,{render:(0,d.jsx)(s.A,{className:"pointer-events-none size-4 text-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-180"})})]})}function y({className:a,children:b,side:c="bottom",sideOffset:e=6,align:f="center",alignOffset:g=0,alignItemWithTrigger:h=!0,...m}){return(0,d.jsx)(i.V,{children:(0,d.jsx)(j.l,{side:c,sideOffset:e,align:f,alignOffset:g,alignItemWithTrigger:h,className:"isolate z-50",children:(0,d.jsxs)(k.t,{"data-slot":"select-content","data-align-trigger":h,className:(0,r.cn)("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-40","origin-(--transform-origin) overflow-x-hidden overflow-y-auto","rounded-xl bg-popover p-1 text-popover-foreground"," ring-1 ring-foreground/8","duration-150","data-[align-trigger=true]:animate-none","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2","data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2","data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95","data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...m,children:[(0,d.jsx)(A,{}),(0,d.jsx)(l.B,{children:b}),(0,d.jsx)(B,{})]})})})}function z({className:a,children:b,...c}){return(0,d.jsxs)(m.e,{"data-slot":"select-item",className:(0,r.cn)("group relative flex w-full cursor-pointer items-center gap-2 rounded-md","py-2 pr-8 pl-2 text-sm outline-hidden select-none","transition-colors duration-150","hover:bg-accent hover:text-accent-foreground","data-highlighted:bg-accent data-highlighted:text-accent-foreground","data-disabled:pointer-events-none data-disabled:opacity-40","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...c,children:[(0,d.jsx)(n.h,{className:"flex flex-1 shrink-0 gap-2 items-center",children:b}),(0,d.jsx)(o.h,{render:(0,d.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,d.jsx)(t.A,{className:"pointer-events-none text-primary"})})]})}function A({className:a,...b}){return(0,d.jsx)(p.w,{"data-slot":"select-scroll-up-button",className:(0,r.cn)("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",a),...b,children:(0,d.jsx)(u.A,{})})}function B({className:a,...b}){return(0,d.jsx)(q.d,{"data-slot":"select-scroll-down-button",className:(0,r.cn)("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",a),...b,children:(0,d.jsx)(s.A,{})})}},16402:(a,b,c)=>{"use strict";c.d(b,{GlobalIndexProgress:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call GlobalIndexProgress() from the server but GlobalIndexProgress is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/index/global-index-progress.tsx","GlobalIndexProgress")},18353:(a,b,c)=>{"use strict";c.d(b,{UpdateBanner:()=>l});var d=c(16358),e=c(46407),f=c(1790),g=c(73775),h=c(56398),i=c(94239),j=c(40950);let k={docker:"docker compose pull && docker compose up -d",npm:"larkup update"};function l(){let[a,b]=(0,e.useState)(null),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),r="true"===process.env.NEXT_PUBLIC_DOCKER_ENV||"true"===process.env.NEXT_PUBLIC_RUNNING_IN_DOCKER?"docker":"npm",s=async()=>{if("desktop"===r){o(!0);try{let{check:a}=await c.e(4506).then(c.bind(c,44506)),{relaunch:b}=await c.e(4956).then(c.bind(c,94956)),d=await a();d?(await d.downloadAndInstall(),await b()):o(!1)}catch(a){console.error("Auto-update failed:",a),o(!1),window.open("https://www.larkup.de/download","_blank")}}else try{await navigator.clipboard.writeText(k[r]),q(!0),window.setTimeout(()=>q(!1),2e3)}catch(a){console.error("Could not copy update command:",a)}};return l&&a?(0,d.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,d.jsxs)("div",{className:"mx-auto flex min-h-7 max-w-screen-2xl items-center gap-2.5",children:[(0,d.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background",children:(0,d.jsx)(f.A,{className:"size-3.5","aria-hidden":"true"})}),(0,d.jsxs)("p",{className:"min-w-0 text-xs sm:text-sm",children:[(0,d.jsxs)("span",{className:"font-medium",children:["Larkup v",a," is available."]})," ",(0,d.jsxs)("span",{className:"hidden text-muted-foreground sm:inline",children:["You're using v","0.2.14","."]})]}),"desktop"!==r&&(0,d.jsx)("code",{className:"ml-auto hidden max-w-152 truncate rounded-[5px] border border-border bg-muted/40 px-2 py-1 font-mono text-[11px] text-muted-foreground lg:block",children:k[r]}),(0,d.jsx)(j.$,{type:"button",variant:"desktop"===r?"default":"outline",size:"xs",onClick:s,disabled:n,"aria-label":"desktop"===r?"Update Larkup now":"Copy update command",className:"desktop"===r?"ml-auto":"ml-auto lg:ml-0",children:"desktop"===r?n?"Updating...":"Update now":p?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.A,{"aria-hidden":"true"}),"Copied"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{"aria-hidden":"true"}),"Copy command"]})}),(0,d.jsx)(j.$,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>{try{localStorage.setItem("larkup-update-dismissed",JSON.stringify({timestamp:Date.now()}))}catch{}m(!1)},"aria-label":"Dismiss update notification",title:"Remind me tomorrow",children:(0,d.jsx)(i.A,{"aria-hidden":"true"})})]})}):null}},21077:()=>{},23223:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/ui/sonner.tsx","Toaster")},24474:(a,b,c)=>{"use strict";c.d(b,{Fc:()=>h,T2:()=>k,TN:()=>j,XL:()=>i});var d=c(16358);c(46407);var e=c(2437),f=c(90241);let g=(0,e.F)("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function h({className:a,variant:b,...c}){return(0,d.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,f.cn)(g({variant:b}),a),...c})}function i({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-title",className:(0,f.cn)("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",a),...b})}function j({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-description",className:(0,f.cn)("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",a),...b})}function k({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-action",className:(0,f.cn)("absolute top-2 right-2",a),...b})}},28173:(a,b,c)=>{"use strict";c.d(b,{Bc:()=>m,ZI:()=>p,k$:()=>o,m_:()=>n});var d=c(16358),e=c(81797),f=c(44494),g=c(35254),h=c(87893),i=c(49753),j=c(14121),k=c(62551),l=c(90241);function m({delay:a=0,...b}){return(0,d.jsx)(e.B,{"data-slot":"tooltip-provider",delay:a,...b})}function n({...a}){return(0,d.jsx)(f.s,{"data-slot":"tooltip",...a})}function o({...a}){return(0,d.jsx)(g.k,{"data-slot":"tooltip-trigger",...a})}function p({className:a,side:b="top",sideOffset:c=4,align:e="center",alignOffset:f=0,children:g,...m}){return(0,d.jsx)(h.K,{children:(0,d.jsx)(i.o,{align:e,alignOffset:f,side:b,sideOffset:c,className:"isolate z-50",children:(0,d.jsxs)(j.o,{"data-slot":"tooltip-content",className:(0,l.cn)("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...m,children:[g,(0,d.jsx)(k.P,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-xs bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}},28475:(a,b,c)=>{"use strict";c.d(b,{ClientLayoutWrapper:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call ClientLayoutWrapper() from the server but ClientLayoutWrapper is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/client-layout-wrapper.tsx","ClientLayoutWrapper")},29623:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,97638,23)),Promise.resolve().then(c.t.bind(c,77657,23)),Promise.resolve().then(c.t.bind(c,31457,23)),Promise.resolve().then(c.t.bind(c,9208,23)),Promise.resolve().then(c.t.bind(c,14056,23)),Promise.resolve().then(c.t.bind(c,58428,23)),Promise.resolve().then(c.t.bind(c,82317,23)),Promise.resolve().then(c.bind(c,33164))},30015:(a,b,c)=>{"use strict";c.d(b,{GlobalIndexProgress:()=>G});var d=c(16358),e=c(91725),f=c(87821),g=c(46407),h=c(56150),i=c(53319),j=c(15772),k=c(20849),l=c(14715),m=c(81277),n=c(99166);c(37960),c(61172);var o=c(40950),p=c(70367),q=c(73181),r=c(24474),s=c(90241);function t({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"skeleton",className:(0,s.cn)("animate-pulse rounded-md bg-muted",a),...b})}var u=c(77802),v=c(46089),w=c(30322);let x=a=>fetch(a).then(a=>a.json()),y=["chunking","embedding","upserting"];function z({open:a,onOpenChange:b,trigger:c}){let[m,n]=(0,g.useState)(!1),[p,q]=(0,g.useState)(!1),s=void 0!==a,A=s&&b?b:q,{data:C,isLoading:D,mutate:E}=(0,e.u)("/api/index",x,{refreshInterval:a=>a?.run&&y.includes(a.run.status)?1e3:0});(0,g.useRef)(void 0);let[F,G]=(0,g.useState)(!1);async function H(a=!1){n(!0);try{let b=await fetch("/api/index",{method:"POST",body:JSON.stringify({incremental:a}),headers:{"Content-Type":"application/json"}}),c=await b.json();if(!b.ok)return void u.oR.error(c.error??"Could not start indexing.");u.oR.success("Indexing started."),E()}catch{u.oR.error("Could not start indexing.")}finally{n(!1)}}async function I(){n(!0);try{if(!(await fetch("/api/index",{method:"DELETE"})).ok)return void u.oR.error("Could not cancel indexing.");u.oR.success("Indexing cancelled."),E()}catch{u.oR.error("Could not cancel indexing.")}finally{n(!1)}}return(0,d.jsxs)(w.lG,{open:s?a:p,onOpenChange:A,children:[c?(0,d.jsx)(w.zM,{render:(0,g.isValidElement)(c)?c:(0,d.jsx)("button",{children:c})}):(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[C?.run?.status==="completed"&&(0,d.jsxs)(v.Lt,{children:[(0,d.jsx)(v.tv,{render:(0,d.jsxs)(o.$,{disabled:!C.ready||!!(C.run&&y.includes(C.run.status))||m,variant:"outline",children:[(0,d.jsx)(h.A,{className:"size-4 mr-2"}),"Re-Index Data"]})}),(0,d.jsxs)(v.EO,{children:[(0,d.jsxs)(v.wd,{children:[(0,d.jsx)(v.r7,{children:"Are you sure you want to re-index data?"}),(0,d.jsx)(v.$v,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,d.jsxs)(v.ck,{children:[(0,d.jsx)(v.Zr,{children:"Cancel"}),(0,d.jsx)(v.Rx,{onClick:()=>{A(!0),H(!1)},children:"Continue"})]})]})]}),(0,d.jsx)(w.zM,{render:(0,d.jsxs)(o.$,{disabled:!C?.ready||C?.unindexedCount===0,children:[(0,d.jsx)(i.A,{className:"size-4 mr-2"}),"Index Data"]})})]}),(0,d.jsxs)(w.Cf,{className:"max-w-2xl max-h-[90vh] overflow-y-auto ",children:[(0,d.jsxs)(w.c7,{children:[(0,d.jsx)(w.L3,{children:"Index Data"}),(0,d.jsx)(w.rr,{children:"Chunk, embed, and index into your selected vector database."})]}),D||!C?(0,d.jsx)("div",{className:"py-6",children:(0,d.jsx)(t,{className:"h-40 w-full"})}):(0,d.jsxs)("div",{className:"space-y-6 py-4",children:[!C.ready&&(0,d.jsxs)(r.Fc,{variant:"default",children:[(0,d.jsx)(j.A,{className:"size-4 text-orange-500!"}),(0,d.jsx)(r.XL,{className:"text-orange-500!",children:"Not ready to index"}),(0,d.jsx)(r.TN,{children:(0,d.jsx)("ul",{className:"list-disc pl-4",children:C.blockers.map(a=>(0,d.jsx)("li",{children:a},a))})})]}),(0,d.jsx)(B,{run:C.run,running:!!(C.run&&y.includes(C.run.status))}),C.ready&&!C.run&&(0,d.jsxs)(r.Fc,{children:[(0,d.jsx)(k.A,{className:"size-4 text-blue-500!"}),(0,d.jsx)(r.XL,{className:"text-blue-600 dark:text-blue-400",children:"Before you start indexing"}),(0,d.jsxs)(r.TN,{className:"text-muted-foreground space-y-1",children:[(0,d.jsxs)("p",{children:["Once indexing begins, two settings become"," ",(0,d.jsx)("span",{className:"font-medium text-foreground",children:"locked"})," to the existing index:"]}),(0,d.jsxs)("ul",{className:"list-disc pl-4 space-y-0.5",children:[(0,d.jsxs)("li",{children:[(0,d.jsx)("span",{className:"font-medium text-foreground",children:"Embedding model"})," — you can swap to any model with the"," ",(0,d.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,d.jsxs)("li",{children:[(0,d.jsx)("span",{className:"font-medium text-foreground",children:"Vector store"})," — changing the store after indexing requires starting fresh."]})]})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)(o.$,{onClick:()=>H(C.run?.status==="completed"),disabled:!C.ready||!!(C.run&&y.includes(C.run.status))||m||C.run?.status==="completed"&&0===C.unindexedCount,size:"lg",children:[C.run&&y.includes(C.run.status)||m?(0,d.jsx)(f.A,{className:"size-4 animate-spin mr-2"}):(0,d.jsx)(l.A,{className:"size-4 mr-2"}),C.run&&y.includes(C.run.status)?"Indexing…":m?"Starting…":C.run?.status==="completed"?`Index new documents (${C.unindexedCount})`:`Start indexing (${C.unindexedCount})`]}),C.run?.status==="completed"&&!(C.run&&y.includes(C.run.status))&&(0,d.jsxs)(v.Lt,{children:[(0,d.jsx)(v.tv,{render:(0,d.jsxs)(o.$,{variant:"outline",size:"lg",disabled:m,children:[(0,d.jsx)(h.A,{className:"size-4 mr-2"}),"Re-Index All"]})}),(0,d.jsxs)(v.EO,{children:[(0,d.jsxs)(v.wd,{children:[(0,d.jsx)(v.r7,{children:"Are you sure you want to re-index data?"}),(0,d.jsx)(v.$v,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,d.jsxs)(v.ck,{children:[(0,d.jsx)(v.Zr,{children:"Cancel"}),(0,d.jsx)(v.Rx,{onClick:()=>{A(!0),H(!1)},children:"Continue"})]})]})]}),!!(C.run&&y.includes(C.run.status))&&(0,d.jsx)(o.$,{onClick:I,disabled:m,size:"lg",variant:"destructive",children:"Cancel"})]}),(0,d.jsx)(o.$,{variant:"ghost",size:"lg",onClick:()=>A(!1),children:"Close"})]})]})]})]})}let A={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 B({run:a,running:b}){if(!a)return(0,d.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,d.jsx)(m.A,{className:"mb-1 size-6 text-muted-foreground/60"}),(0,d.jsx)("p",{className:"text-sm font-medium",children:"No index built yet"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Build a Larkup index to embed your corpus and make it searchable."})]});let c=A[a.status],e=a.totalChunks>0?Math.round(a.processedChunks/a.totalChunks*100):5*!!b;return(0,d.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4 space-y-4",children:[(0,d.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold",children:["completed"===a.status?(0,d.jsx)(n.A,{className:"size-4 text-primary"}):"failed"===a.status?(0,d.jsx)(j.A,{className:"size-4 text-destructive"}):(0,d.jsx)(f.A,{className:"size-4 animate-spin text-primary"}),c.label]}),(0,d.jsx)(D,{status:a.status})]}),"failed"===a.status?(0,d.jsx)(d.Fragment,{}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:c.phase??"Done"}),(0,d.jsxs)("span",{className:"font-mono tabular-nums",children:[a.processedChunks.toLocaleString(),a.totalChunks>0&&` / ${a.totalChunks.toLocaleString()}`," chunks"]})]}),(0,d.jsx)(p.ke,{value:e,className:"**:data-[slot=progress-indicator]:bg-green-600"})]}),(0,d.jsxs)("dl",{className:"grid grid-cols-2 gap-4 pt-1 sm:grid-cols-4",children:[(0,d.jsx)(C,{label:"Documents",value:a.docCount.toLocaleString()}),(0,d.jsx)(C,{label:"Chunks",value:a.totalChunks.toLocaleString()}),(0,d.jsx)(C,{label:"Dimensions",value:a.dimensions?a.dimensions.toLocaleString():"—"}),(0,d.jsx)(C,{label:"Duration",value:a.durationMs?`${(a.durationMs/1e3).toFixed(1)}s`:b?"running…":"—"})]})]})]})}function C({label:a,value:b}){return(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("dt",{className:"text-xs text-muted-foreground",children:a}),(0,d.jsx)("dd",{className:"font-mono text-sm tabular-nums",children:b})]})}function D({status:a}){return"completed"===a?(0,d.jsx)(q.E,{className:"bg-primary/12 text-primary hover:bg-primary/12",children:"Ready"}):"failed"===a?(0,d.jsx)(q.E,{variant:"destructive",children:"Failed"}):y.includes(a)?(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-green-600",children:[(0,d.jsxs)("span",{className:"relative flex size-2",children:[(0,d.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-600 opacity-75"}),(0,d.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-600"})]}),"Live"]}):null}let E=a=>fetch(a).then(a=>a.json()),F=["chunking","embedding","upserting"];function G(){let{data:a}=(0,e.u)("/api/index",E,{refreshInterval:a=>a?.run&&F.includes(a.run.status)?1e3:0});if(!(a?.run&&F.includes(a.run.status))||!a?.run)return null;let{run:b}=a,c=b.totalChunks>0?Math.round(b.processedChunks/b.totalChunks*100):5;return(0,d.jsx)("div",{className:"fixed bottom-6 right-6 z-50",children:(0,d.jsx)(z,{trigger:(0,d.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,d.jsx)(f.A,{className:"size-4 animate-spin text-primary"}),(0,d.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,d.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:"Storing..."}),(0,d.jsxs)("span",{className:"leading-none",children:[c,"%"]})]})]})})})}},30322:(a,b,c)=>{"use strict";c.d(b,{Cf:()=>u,Es:()=>w,HM:()=>s,L3:()=>x,c7:()=>v,lG:()=>p,rr:()=>y,zM:()=>q});var d=c(16358);c(46407);var e=c(86179),f=c(98121),g=c(10671),h=c(98065),i=c(80211),j=c(66924),k=c(96533),l=c(16165),m=c(90241),n=c(40950),o=c(94239);function p({...a}){return(0,d.jsx)(e.D,{"data-slot":"dialog",...a})}function q({...a}){return(0,d.jsx)(f.z,{"data-slot":"dialog-trigger",...a})}function r({...a}){return(0,d.jsx)(g.Z,{"data-slot":"dialog-portal",...a})}function s({...a}){return(0,d.jsx)(h.H,{"data-slot":"dialog-close",...a})}function t({className:a,...b}){return(0,d.jsx)(i.X,{"data-slot":"dialog-overlay",className:(0,m.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",a),...b})}function u({className:a,children:b,showCloseButton:c=!0,...e}){return(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{}),(0,d.jsxs)(j.h,{"data-slot":"dialog-content",className:(0,m.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-card p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...e,children:[b,c&&(0,d.jsxs)(h.H,{"data-slot":"dialog-close",render:(0,d.jsx)(n.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,d.jsx)(o.A,{}),(0,d.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function v({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"dialog-header",className:(0,m.cn)("flex flex-col gap-2",a),...b})}function w({className:a,showCloseButton:b=!1,children:c,...e}){return(0,d.jsxs)("div",{"data-slot":"dialog-footer",className:(0,m.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",a),...e,children:[c,b&&(0,d.jsx)(h.H,{render:(0,d.jsx)(n.$,{variant:"outline"}),children:"Close"})]})}function x({className:a,...b}){return(0,d.jsx)(k.L,{"data-slot":"dialog-title",className:(0,m.cn)("font-heading text-base leading-none font-medium",a),...b})}function y({className:a,...b}){return(0,d.jsx)(l.r,{"data-slot":"dialog-description",className:(0,m.cn)("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",a),...b})}},32561:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>l});var d=c(16358),e=c(43883),f=c(77802),g=c(99166),h=c(20849),i=c(11616),j=c(64662),k=c(87821);let l=({...a})=>{let{theme:b="system"}=(0,e.D)();return(0,d.jsx)(f.l$,{closeButton:!0,theme:b,className:"toaster group z-9999999! ",icons:{success:(0,d.jsx)(g.A,{className:"size-5 text-white",fill:"#10b981"}),info:(0,d.jsx)(h.A,{className:"size-5 text-white",fill:"#3b82f6"}),warning:(0,d.jsx)(i.A,{className:"size-5 text-white",fill:"#f59e0b"}),error:(0,d.jsx)(j.A,{className:"size-5 text-white",fill:"#ef4444"}),loading:(0,d.jsx)(k.A,{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"}},...a})}},36952:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>f});var d=c(16358),e=c(36279);function f({children:a}){return(0,d.jsx)(e.P.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"h-full w-full",children:a})}},37136:(a,b,c)=>{"use strict";c.d(b,{ThemeCustomizerProvider:()=>e});var d=c(43044);(0,d.registerClientReference)(function(){throw Error("Attempted to call DEFAULT_THEME() from the server but DEFAULT_THEME is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/theme-customizer-provider.tsx","DEFAULT_THEME"),(0,d.registerClientReference)(function(){throw Error("Attempted to call useThemeCustomizer() from the server but useThemeCustomizer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/theme-customizer-provider.tsx","useThemeCustomizer");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call ThemeCustomizerProvider() from the server but ThemeCustomizerProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/theme-customizer-provider.tsx","ThemeCustomizerProvider")},37295:(a,b,c)=>{"use strict";c.d(b,{ProjectProvider:()=>e});var d=c(43044);(0,d.registerClientReference)(function(){throw Error("Attempted to call useProject() from the server but useProject is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/projects/project-provider.tsx","useProject");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call ProjectProvider() from the server but ProjectProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/projects/project-provider.tsx","ProjectProvider")},37960:(a,b,c)=>{"use strict";c.d(b,{vx:()=>e,yN:()=>d});let d={"openai/text-embedding-3-small":{dimensions:1536,maxInputTokens:8191},"openai/text-embedding-3-large":{dimensions:3072,maxInputTokens:8191},"openai/text-embedding-ada-002":{dimensions:1536,maxInputTokens:8191},"google/gemini-embedding-2":{dimensions:3072,maxInputTokens:8192},"google/gemini-embedding-001":{dimensions:3072,maxInputTokens:2048},"cohere/embed-english-v3.0":{dimensions:1024,maxInputTokens:512},"cohere/embed-multilingual-v3.0":{dimensions:1024,maxInputTokens:512},"voyage/voyage-3":{dimensions:1024,maxInputTokens:32e3},"voyage/voyage-3-lite":{dimensions:512,maxInputTokens:32e3},"voyage/voyage-code-3":{dimensions:1024,maxInputTokens:32e3},"mistral/mistral-embed":{dimensions:1024,maxInputTokens:8192},"jina/jina-embeddings-v3":{dimensions:1024,maxInputTokens:8192},"jina/jina-clip-v2":{dimensions:1024,maxInputTokens:8192},"nomic/nomic-embed-text-v1.5":{dimensions:768,maxInputTokens:8192}},e=[{id:"openai/text-embedding-3-small",label:"text-embedding-3-small",provider:"openai",dimensions:1536,maxInputTokens:8191,description:"Fast, cheap, strong general-purpose default."},{id:"openai/text-embedding-3-large",label:"text-embedding-3-large",provider:"openai",dimensions:3072,maxInputTokens:8191,description:"Highest quality OpenAI embeddings, larger vectors."},{id:"openai/text-embedding-ada-002",label:"text-embedding-ada-002",provider:"openai",dimensions:1536,maxInputTokens:8191,description:"Legacy model — kept for backward compatibility."},{id:"google/gemini-embedding-2",label:"gemini-embedding-2",provider:"google",dimensions:3072,maxInputTokens:8192,description:"Current Gemini embedding model with multilingual retrieval support."},{id:"google/gemini-embedding-001",label:"gemini-embedding-001",provider:"google",dimensions:3072,maxInputTokens:2048,description:"Gemini embedding 001."},{id:"cohere/embed-english-v3.0",label:"embed-english-v3.0",provider:"cohere",dimensions:1024,maxInputTokens:512,description:"Tuned for retrieval; great for English-heavy corpora."},{id:"cohere/embed-multilingual-v3.0",label:"embed-multilingual-v3.0",provider:"cohere",dimensions:1024,maxInputTokens:512,description:"100+ language multilingual retrieval embeddings."},{id:"voyage/voyage-3",label:"voyage-3",provider:"voyage",dimensions:1024,maxInputTokens:32e3,description:"Voyage's best general-purpose retrieval model."},{id:"voyage/voyage-3-lite",label:"voyage-3-lite",provider:"voyage",dimensions:512,maxInputTokens:32e3,description:"Optimized for latency and cost with strong performance."},{id:"voyage/voyage-code-3",label:"voyage-code-3",provider:"voyage",dimensions:1024,maxInputTokens:32e3,description:"Specialized for code retrieval tasks."},{id:"mistral/mistral-embed",label:"mistral-embed",provider:"mistral",dimensions:1024,maxInputTokens:8192,description:"Mistral's efficient embedding model for retrieval."},{id:"jina/jina-embeddings-v3",label:"jina-embeddings-v3",provider:"jina",dimensions:1024,maxInputTokens:8192,description:"Multilingual, task-specific embeddings from Jina AI."},{id:"jina/jina-clip-v2",label:"jina-clip-v2",provider:"jina",dimensions:1024,maxInputTokens:8192,description:"Multimodal embeddings for text and images."},{id:"nomic/nomic-embed-text-v1.5",label:"nomic-embed-text-v1.5",provider:"nomic",dimensions:768,maxInputTokens:8192,description:"Open-source, highly capable text embeddings."}]},40950:(a,b,c)=>{"use strict";c.d(b,{$:()=>i,r:()=>h});var d=c(16358),e=c(53160),f=c(2437),g=c(90241);let h=(0,f.F)("group/button cursor-pointer inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-white hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-muted border-border/50 hover:border-border aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted hover:border-border aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive text-white hover:bg-destructive/80 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function i({className:a,variant:b="default",size:c="default",...f}){return(0,d.jsx)(e.$,{"data-slot":"button",className:(0,g.cn)(h({variant:b,size:c,className:a})),...f})}},43735:(a,b,c)=>{Promise.resolve().then(c.bind(c,9714)),Promise.resolve().then(c.bind(c,99538)),Promise.resolve().then(c.bind(c,30015)),Promise.resolve().then(c.bind(c,71665)),Promise.resolve().then(c.bind(c,94638)),Promise.resolve().then(c.bind(c,32561)),Promise.resolve().then(c.bind(c,18353)),Promise.resolve().then(c.bind(c,96805)),Promise.resolve().then(c.bind(c,43883))},46089:(a,b,c)=>{"use strict";c.d(b,{$v:()=>x,EO:()=>s,Lt:()=>o,Rx:()=>y,Zr:()=>z,ck:()=>u,r7:()=>w,tv:()=>p,wd:()=>t,zu:()=>v});var d=c(16358);c(46407);var e=c(84682),f=c(44684),g=c(10671),h=c(80211),i=c(66924),j=c(96533),k=c(16165),l=c(98065),m=c(90241),n=c(40950);function o({...a}){return(0,d.jsx)(e.V,{"data-slot":"alert-dialog",...a})}function p({...a}){return(0,d.jsx)(f.t,{"data-slot":"alert-dialog-trigger",...a})}function q({...a}){return(0,d.jsx)(g.Z,{"data-slot":"alert-dialog-portal",...a})}function r({className:a,...b}){return(0,d.jsx)(h.X,{"data-slot":"alert-dialog-overlay",className:(0,m.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",a),...b})}function s({className:a,size:b="default",...c}){return(0,d.jsxs)(q,{children:[(0,d.jsx)(r,{}),(0,d.jsx)(i.h,{"data-slot":"alert-dialog-content","data-size":b,className:(0,m.cn)("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...c})]})}function t({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,m.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",a),...b})}function u({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,m.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",a),...b})}function v({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"alert-dialog-media",className:(0,m.cn)("mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",a),...b})}function w({className:a,...b}){return(0,d.jsx)(j.L,{"data-slot":"alert-dialog-title",className:(0,m.cn)("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",a),...b})}function x({className:a,...b}){return(0,d.jsx)(k.r,{"data-slot":"alert-dialog-description",className:(0,m.cn)("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",a),...b})}function y({className:a,...b}){return(0,d.jsx)(n.$,{"data-slot":"alert-dialog-action",className:(0,m.cn)(a),...b})}function z({className:a,variant:b="outline",size:c="default",...e}){return(0,d.jsx)(l.H,{"data-slot":"alert-dialog-cancel",className:(0,m.cn)(a),render:(0,d.jsx)(n.$,{variant:b,size:c}),...e})}},48814:(a,b,c)=>{"use strict";c.d(b,{J:()=>f});var d=c(16358);c(46407);var e=c(90241);function f({className:a,...b}){return(0,d.jsx)("label",{"data-slot":"label",className:(0,e.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...b})}},52406:(a,b,c)=>{"use strict";function d(){return[{type:"image/x-icon",sizes:"16x16",url:"/favicon.ico?f418db460f797530"}]}c.r(b),c.d(b,{default:()=>d})},57693:(a,b,c)=>{"use strict";c.d(b,{I:()=>u,M5:()=>z,SQ:()=>t,_2:()=>w,lp:()=>v,lv:()=>x,mB:()=>A,nV:()=>y,rI:()=>r,ty:()=>s});var d=c(16358);c(46407);var e=c(34157),f=c(90560),g=c(30999),h=c(38671),i=c(65151),j=c(96999),k=c(47648),l=c(17629),m=c(40270),n=c(73332),o=c(36346),p=c(90241),q=c(35803);function r({...a}){return(0,d.jsx)(e.i,{"data-slot":"dropdown-menu",...a})}function s({...a}){return(0,d.jsx)(f.c,{"data-slot":"dropdown-menu-trigger",...a,className:(0,p.cn)("cursor-pointer",a.className)})}function t({align:a="start",alignOffset:b=0,side:c="bottom",sideOffset:e=4,className:f,...j}){return(0,d.jsx)(g.g,{children:(0,d.jsx)(h.y,{className:"isolate z-50 outline-none",align:a,alignOffset:b,side:c,sideOffset:e,children:(0,d.jsx)(i._,{"data-slot":"dropdown-menu-content",className:(0,p.cn)("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",f),...j})})})}function u({...a}){return(0,d.jsx)(j.r,{"data-slot":"dropdown-menu-group",...a})}function v({className:a,inset:b,...c}){return(0,d.jsx)(k.N,{"data-slot":"dropdown-menu-label","data-inset":b,className:(0,p.cn)("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",a),...c})}function w({className:a,inset:b,variant:c="default",...e}){return(0,d.jsx)(l.D,{"data-slot":"dropdown-menu-item","data-inset":b,"data-variant":c,className:(0,p.cn)("group/dropdown-menu-item relative flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-1.5 text-sm outline-hidden select-none not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive"," hover:bg-background ",a),...e})}function x({...a}){return(0,d.jsx)(m.h,{"data-slot":"dropdown-menu-sub",...a})}function y({className:a,inset:b,children:c,...e}){return(0,d.jsxs)(n.f,{"data-slot":"dropdown-menu-sub-trigger","data-inset":b,className:(0,p.cn)("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","h-8",a),...e,children:[c,(0,d.jsx)(q.A,{className:"ml-auto"})]})}function z({align:a="start",alignOffset:b=-3,side:c="right",sideOffset:e=0,className:f,...g}){return(0,d.jsx)(t,{"data-slot":"dropdown-menu-sub-content",className:(0,p.cn)("w-auto min-w-49! rounded-md bg-popover p-1 text-popover-foreground ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","",f),align:a,alignOffset:b,side:c,sideOffset:e,...g})}function A({className:a,...b}){return(0,d.jsx)(o.w,{"data-slot":"dropdown-menu-separator",className:(0,p.cn)("-mx-1 my-1 h-px bg-border",a),...b})}},61172:(a,b,c)=>{"use strict";c.d(b,{KB:()=>h,VY:()=>e,cj:()=>g,jX:()=>f});let d={lancedb:{id:"lancedb",label:"LanceDB",description:"Embedded vector database for local development, LanceDB Cloud, or persistent S3-compatible storage such as Cloudflare R2.",runtime:"both",installStatus:"installed",docsUrl:"https://lancedb.github.io/lancedb/",serverDependencies:{"@lancedb/lancedb":"^0.30.0"},fields:[{key:"mode",label:"Mode",type:"select",required:!0,defaultValue:"local",help:"Use a local disk, LanceDB Cloud, or an S3-compatible bucket for persistent serverless deployments.",options:[{label:"Local (on-disk)",value:"local"},{label:"S3-compatible (Vercel / R2 / S3)",value:"s3"},{label:"Cloud",value:"cloud"}]},{key:"dbPath",label:"Database path",type:"path",required:!0,defaultValue:"./.larkup/lancedb",placeholder:"./.larkup/lancedb",help:"Directory where the LanceDB tables are stored.",showWhen:{key:"mode",equals:["local"]}},{key:"s3Uri",label:"Database URI",type:"text",required:!0,placeholder:"s3://my-bucket/larkup/my-server",help:"A dedicated, private bucket prefix for LanceDB table files. This is persistent across Vercel invocations.",showWhen:{key:"mode",equals:["s3"]}},{key:"s3Endpoint",label:"S3 endpoint",type:"text",required:!1,placeholder:"https://<account-id>.r2.cloudflarestorage.com",help:"Required for Cloudflare R2 and other S3-compatible providers. Leave blank for AWS S3.",showWhen:{key:"mode",equals:["s3"]}},{key:"s3Region",label:"Region",type:"text",required:!0,defaultValue:"auto",placeholder:"auto",help:"Use “auto” for Cloudflare R2, or your bucket region for AWS S3.",showWhen:{key:"mode",equals:["s3"]}},{key:"s3AccessKeyId",label:"Access key ID",type:"password",required:!0,secret:!0,help:"Use an object read/write credential restricted to this bucket.",showWhen:{key:"mode",equals:["s3"]}},{key:"s3SecretAccessKey",label:"Secret access key",type:"password",required:!0,secret:!0,help:"Stored as a deployment environment variable; never expose it in the browser.",showWhen:{key:"mode",equals:["s3"]}},{key:"uri",label:"Cloud URI",type:"text",required:!0,placeholder:"db://my-database",help:"Your LanceDB Cloud database URI.",showWhen:{key:"mode",equals:["cloud"]}},{key:"apiKey",label:"API key",type:"password",required:!0,secret:!0,placeholder:"sk_...",help:"LanceDB Cloud API key. Stored as an env var in the generated server.",showWhen:{key:"mode",equals:["cloud"]}},{key:"tableName",label:"Table name",type:"text",required:!0,defaultValue:"documents",help:"The table that holds your embedded chunks."}]},pinecone:{id:"pinecone",label:"Pinecone",description:"Fully-managed cloud vector database. Cloud-only — requires an API key and an existing index.",runtime:"cloud",installStatus:"installed",docsUrl:"https://docs.pinecone.io/",serverDependencies:{"@pinecone-database/pinecone":"^6.0.0"},fields:[{key:"apiKey",label:"API key",type:"password",required:!0,secret:!0,placeholder:"pcsk_...",help:"Pinecone API key. Stored as an env var in the generated server."},{key:"indexName",label:"Index name",type:"text",required:!0,placeholder:"rag-index",help:"Name of the Pinecone index to upsert into / query. For hybrid/lexical mode this index must use the 'dotproduct' metric."},{key:"namespace",label:"Namespace",type:"text",required:!1,placeholder:"default",help:"Optional namespace to isolate this dataset within the index."},{key:"sparseModel",label:"Sparse model",type:"text",required:!0,defaultValue:"pinecone-sparse-english-v0",help:"Pinecone-hosted sparse model used to generate keyword vectors via the Inference API. Both dense and sparse vectors are stored in the same index.",showWhenIndexType:["lexical","hybrid"]}]},weaviate:{id:"weaviate",label:"Weaviate",description:"Open-source AI-native vector database with built-in hybrid search, BM25, and multi-tenancy.",runtime:"both",installStatus:"coming-soon",docsUrl:"https://weaviate.io/developers/weaviate",serverDependencies:{weaviate:"^3.0.0"},fields:[{key:"host",label:"Host URL",type:"text",required:!0,placeholder:"https://my-cluster.weaviate.network",help:"Weaviate Cloud URL or self-hosted host address."},{key:"apiKey",label:"API key",type:"password",required:!1,secret:!0,placeholder:"weaviate-api-key",help:"Weaviate Cloud API key (optional for self-hosted)."},{key:"className",label:"Collection name",type:"text",required:!0,defaultValue:"Documents",help:"The Weaviate collection (class) that holds your embedded chunks."}]},qdrant:{id:"qdrant",label:"Qdrant",description:"High-performance vector search engine with rich filtering, built for production-scale RAG.",runtime:"both",installStatus:"coming-soon",docsUrl:"https://qdrant.tech/documentation/",serverDependencies:{"@qdrant/js-client-rest":"^1.9.0"},fields:[{key:"url",label:"Host URL",type:"text",required:!0,placeholder:"http://localhost:6333",help:"Qdrant server URL (local or Qdrant Cloud endpoint)."},{key:"apiKey",label:"API key",type:"password",required:!1,secret:!0,placeholder:"qdrant-api-key",help:"Qdrant Cloud API key (leave blank for local)."},{key:"collectionName",label:"Collection name",type:"text",required:!0,defaultValue:"documents",help:"Qdrant collection to upsert into and query."}]},chroma:{id:"chroma",label:"Chroma",description:"Open-source, developer-friendly embedding database. Great for rapid local prototyping.",runtime:"both",installStatus:"installable",docsUrl:"https://docs.trychroma.com/",serverDependencies:{chromadb:"^1.9.0"},fields:[{key:"mode",label:"Mode",type:"select",required:!0,defaultValue:"server",help:"Server connects to a self-hosted Chroma instance. Cloud connects to Chroma Cloud.",options:[{label:"Server (Self-hosted)",value:"server"},{label:"Cloud (Chroma Cloud)",value:"cloud"}]},{key:"host",label:"Server URL",type:"text",required:!0,placeholder:"http://localhost:8000",defaultValue:"http://localhost:8000",help:"Chroma server URL (local Docker or remote).",showWhen:{key:"mode",equals:["server"]}},{key:"authToken",label:"Auth Token",type:"password",required:!1,secret:!0,placeholder:"chroma-token",help:"Optional static auth token for Chroma server.",showWhen:{key:"mode",equals:["server"]}},{key:"apiKey",label:"API Key",type:"password",required:!0,secret:!0,placeholder:"sk_...",help:"Chroma Cloud API Key.",showWhen:{key:"mode",equals:["cloud"]}},{key:"tenant",label:"Tenant",type:"text",required:!0,defaultValue:"default_tenant",help:"Tenant name for Chroma Cloud.",showWhen:{key:"mode",equals:["cloud"]}},{key:"database",label:"Database",type:"text",required:!0,defaultValue:"default_database",help:"Database name for Chroma Cloud.",showWhen:{key:"mode",equals:["cloud"]}},{key:"collectionName",label:"Collection name",type:"text",required:!0,defaultValue:"documents",help:"Chroma collection to store and retrieve embeddings."}]},pgvector:{id:"pgvector",label:"pgvector",description:"PostgreSQL extension for vector similarity search. Self-host vectors alongside your relational data.",runtime:"both",installStatus:"coming-soon",docsUrl:"https://github.com/pgvector/pgvector",serverDependencies:{pg:"^8.11.0",pgvector:"^0.2.0"},fields:[{key:"connectionString",label:"Connection string",type:"password",required:!0,secret:!0,placeholder:"postgresql://user:pass@localhost:5432/db",help:"Full PostgreSQL connection string."},{key:"tableName",label:"Table name",type:"text",required:!0,defaultValue:"embeddings",help:"The table used to store vector embeddings. Created automatically if absent."}]},supabase:{id:"supabase",label:"Supabase",description:"Postgres-backed vector store via the pgvector extension with Supabase's managed infrastructure.",runtime:"cloud",installStatus:"coming-soon",docsUrl:"https://supabase.com/docs/guides/ai",serverDependencies:{"@supabase/supabase-js":"^2.43.0"},fields:[{key:"url",label:"Project URL",type:"text",required:!0,placeholder:"https://xyz.supabase.co",help:"Your Supabase project URL."},{key:"serviceKey",label:"Service role key",type:"password",required:!0,secret:!0,placeholder:"eyJhbGci...",help:"Supabase service_role key (not the anon key). Stored as an env var."},{key:"tableName",label:"Table name",type:"text",required:!0,defaultValue:"documents",help:"Supabase table with a vector column for embeddings."}]}},e=Object.values(d);function f(a){return d[a]}function g(a,b,c){return a.fields.filter(a=>{if(a.showWhen){let c=b[a.showWhen.key]??"";if(!a.showWhen.equals.includes(c))return!1}return!a.showWhenIndexType||!c||!!a.showWhenIndexType.includes(c)})}function h(a,b,c){let d={};for(let e of g(a,b,c))e.required&&!b[e.key]?.trim()&&(d[e.key]=`${e.label} is required`);return d}},62350:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/app/template.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/app/template.tsx","default")},64108:(a,b,c)=>{Promise.resolve().then(c.bind(c,36952))},70367:(a,b,c)=>{"use strict";c.d(b,{ke:()=>i});var d=c(16358),e=c(64479),f=c(75103),g=c(53475),h=c(90241);function i({className:a,children:b,value:c,...f}){return(0,d.jsxs)(e.w,{value:c,"data-slot":"progress",className:(0,h.cn)("flex flex-wrap gap-3",a),...f,children:[b,(0,d.jsx)(j,{children:(0,d.jsx)(k,{})})]})}function j({className:a,...b}){return(0,d.jsx)(f.X,{className:(0,h.cn)("relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",a),"data-slot":"progress-track",...b})}function k({className:a,...b}){return(0,d.jsx)(g.Z,{"data-slot":"progress-indicator",className:(0,h.cn)("h-full bg-primary transition-all",a),...b})}},71236:(a,b,c)=>{"use strict";c.d(b,{GpuActivityIndicator:()=>d});let d=(0,c(43044).registerClientReference)(function(){throw Error("Attempted to call GpuActivityIndicator() from the server but GpuActivityIndicator is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/abdelrahmanabounida/Desktop/my-ai-startup/larkup/larkup/apps/web/components/chat/gpu-activity-indicator.tsx","GpuActivityIndicator")},71665:(a,b,c)=>{"use strict";c.d(b,{B:()=>j,ProjectProvider:()=>k});var d=c(16358),e=c(46407),f=c(91725),g=c(39290);let h=a=>fetch(a).then(a=>a.json()),i=(0,e.createContext)(null);function j(){let a=(0,e.useContext)(i);if(!a)throw Error("useProject must be used within a ProjectProvider");return a}function k({children:a}){let{data:b,isLoading:c,mutate:j}=(0,f.u)("/api/projects",h,{revalidateOnFocus:!1}),l=b?.projects??[],m=l.find(a=>a.id===b?.activeProjectId),n=!c&&0===l.length,o=(0,e.useCallback)(async()=>{await (0,g.k)(()=>!0)},[]),p=(0,e.useCallback)(async a=>{let b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})}),c=await b.json();return await j(),await o(),c.project},[j,o]),q=(0,e.useCallback)(async a=>{await fetch("/api/projects",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"activate",projectId:a})}),await j(),await o()},[j,o]),r=(0,e.useCallback)(async(a,b)=>{await fetch("/api/projects",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",projectId:a,name:b})}),await j()},[j]),s=(0,e.useCallback)(async a=>{await fetch(`/api/projects?id=${encodeURIComponent(a)}`,{method:"DELETE"}),await j(),await o()},[j,o]);return(0,d.jsx)(i.Provider,{value:{isLoading:c,projects:l,activeProject:m,isFirstRun:n,refresh:()=>{j()},createProject:p,activateProject:q,renameProject:r,deleteProject:s},children:a})}},72801:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,35852,23))},73181:(a,b,c)=>{"use strict";c.d(b,{E:()=>i});var d=c(36967),e=c(66463),f=c(2437),g=c(90241);let h=(0,f.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function i({className:a,variant:b="default",render:c,...f}){return(0,e.C)({defaultTagName:"span",props:(0,d.v6)({className:(0,g.cn)(h({variant:b}),a)},f),render:c,state:{slot:"badge",variant:b}})}},77260:(a,b,c)=>{Promise.resolve().then(c.bind(c,62350))},78565:(a,b,c)=>{"use strict";c.d(b,{B:()=>o,q:()=>p});var d=c(16358),e=c(46407),f=c(77802),g=c(30322),h=c(40950),i=c(94636),j=c(48814),k=c(81040),l=c(46352),m=c(87821),n=c(56020);function o({onSave:a,type:b,onCancel:c}){let[g,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1),C=async()=>{if(!g||!u)return void f.oR.error("Base URL and Model Name are required");z(!0);try{if("embedding"===b){let a=await fetch("/api/config/test-embedding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:g,apiKey:q,modelName:u})}),b=await a.json();if(!a.ok)throw Error(b.error||"Connection failed");x(b.dimensions),B(!0),f.oR.success(`Success! Detected ${b.dimensions} dimensions.`)}else{let a=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify("vision"===b?{visionProvider:"custom",visionApiKey:q,visionModelId:`custom:${u}`,customVisionModels:[{baseUrl:g,apiKey:q,modelName:u}]}:{chatProvider:"custom",chatApiKey:q,customChatModels:[{baseUrl:g,apiKey:q,modelName:u}]})}),c=await a.json();if(!a.ok)throw Error(c.error||"Connection failed");B(!0),f.oR.success(`Success! ${"vision"===b?"Vision":"Chat"} model connected.`)}}catch(a){f.oR.error(a instanceof Error?a.message:"Test failed"),x(null),B(!1)}finally{z(!1)}};return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,d.jsxs)("div",{className:"grid gap-2",children:[(0,d.jsx)(j.J,{htmlFor:"baseUrl",children:"Base URL"}),(0,d.jsx)(i.p,{id:"baseUrl",placeholder:"https://api.example.com/v1",value:g,onChange:a=>{p(a.target.value),B(!1)}})]}),(0,d.jsxs)("div",{className:"grid gap-2",children:[(0,d.jsx)(j.J,{htmlFor:"apiKey",children:"API Key (Optional)"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(i.p,{id:"apiKey",type:s?"text":"password",placeholder:"sk-...",value:q,onChange:a=>{r(a.target.value),B(!1)},className:"pr-10"}),(0,d.jsx)("button",{type:"button",onClick:()=>t(!s),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground",children:s?(0,d.jsx)(k.A,{className:"size-4"}):(0,d.jsx)(l.A,{className:"size-4"})})]})]}),(0,d.jsxs)("div",{className:"grid gap-2",children:[(0,d.jsx)(j.J,{htmlFor:"modelName",children:"Model Name"}),(0,d.jsx)(i.p,{id:"modelName",placeholder:"embedding"===b?"my-embedding-model":"vision"===b?"my-vision-model":"my-chat-model",value:u,onChange:a=>{v(a.target.value),B(!1)}})]}),A&&(0,d.jsxs)("div",{className:"text-sm text-green-600 dark:text-green-400 font-medium",children:["✓ Connection verified ",w?`(${w} dimensions)`:""]})]}),(0,d.jsxs)("div",{className:"flex flex-row justify-between sm:justify-between items-center gap-2",children:[(0,d.jsxs)(h.$,{variant:"outline",type:"button",onClick:C,disabled:y,children:[y?(0,d.jsx)(m.A,{className:"size-4 animate-spin mr-2"}):(0,d.jsx)(n.A,{className:"size-4 mr-2"}),"Test Connection"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[c&&(0,d.jsx)(h.$,{variant:"ghost",type:"button",onClick:c,children:"Cancel"}),(0,d.jsx)(h.$,{className:"px-5",type:"button",onClick:()=>{g&&u&&A?a({baseUrl:g,apiKey:q,modelName:u,dimensions:w??void 0}):f.oR.error("Please test the connection first.")},disabled:!A,children:"Add Model"})]})]})]})}function p({open:a,onOpenChange:b,onSave:c,type:e}){return(0,d.jsx)(g.lG,{open:a,onOpenChange:b,children:(0,d.jsxs)(g.Cf,{className:"max-w-xl",children:[(0,d.jsxs)(g.c7,{children:[(0,d.jsxs)(g.L3,{children:["Custom ","embedding"===e?"Embedding":"vision"===e?"Vision":"Chat"," ","Model"]}),(0,d.jsxs)(g.rr,{children:["Connect an OpenAI-compatible"," ","embedding"===e?"embedding":"vision"===e?"vision":"chat"," model."]})]}),(0,d.jsx)(o,{type:e,onSave:a=>{c(a),b(!1)}})]})})}},82170:()=>{},83487:(a,b,c)=>{Promise.resolve().then(c.bind(c,71236)),Promise.resolve().then(c.bind(c,28475)),Promise.resolve().then(c.bind(c,16402)),Promise.resolve().then(c.bind(c,37295)),Promise.resolve().then(c.bind(c,37136)),Promise.resolve().then(c.bind(c,23223)),Promise.resolve().then(c.bind(c,2223)),Promise.resolve().then(c.bind(c,94763)),Promise.resolve().then(c.bind(c,73605))},84594:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>o,metadata:()=>n});var d=c(92576),e=c(94763);c(21077);var f=c(23223),g=c(37295),h=c(37136),i=c(28475),j=c(16402),k=c(71236),l=c(2223),m=c(73605);let n={title:"larkup",description:"larkup — a toolkit to build, index, and serve your own AI model and knowledge base."};function o({children:a}){return(0,d.jsx)("html",{lang:"en",suppressHydrationWarning:!0,className:"bg-transparent",children:(0,d.jsxs)("body",{suppressHydrationWarning:!0,className:"theme-gaia font-sans antialiased",children:[(0,d.jsx)("script",{dangerouslySetInnerHTML:{__html:"(function(){try{var t=localStorage.getItem('app-theme');var d=document.body;if(!t)return;d.classList.remove('theme-larkup','theme-gaia','theme-linear');if(t!=='default')d.classList.add(t);}catch(e){}})();"}}),(0,d.jsxs)(m.ThemeProvider,{attribute:"class",defaultTheme:"light",enableSystem:!0,disableTransitionOnChange:!0,children:[(0,d.jsx)(l.UpdateBanner,{}),(0,d.jsx)(h.ThemeCustomizerProvider,{children:(0,d.jsxs)(g.ProjectProvider,{children:[(0,d.jsx)(i.ClientLayoutWrapper,{children:a}),(0,d.jsx)(f.Toaster,{position:"bottom-right"}),(0,d.jsx)(j.GlobalIndexProgress,{}),(0,d.jsx)(k.GpuActivityIndicator,{})]})})]}),(0,d.jsx)(e.Analytics,{})]})})}},90241:(a,b,c)=>{"use strict";c.d(b,{cn:()=>f});var d=c(63671),e=c(89891);function f(...a){return(0,e.QP)((0,d.$)(a))}},92671:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,35852,23)),Promise.resolve().then(c.t.bind(c,38807,23)),Promise.resolve().then(c.t.bind(c,42971,23)),Promise.resolve().then(c.t.bind(c,64142,23)),Promise.resolve().then(c.t.bind(c,6858,23)),Promise.resolve().then(c.t.bind(c,12270,23)),Promise.resolve().then(c.t.bind(c,80619,23)),Promise.resolve().then(c.t.bind(c,56334,23))},92786:()=>{},94636:(a,b,c)=>{"use strict";c.d(b,{p:()=>g});var d=c(16358);c(46407);var e=c(72236),f=c(90241);function g({className:a,type:b,...c}){return(0,d.jsx)(e.p,{type:b,"data-slot":"input",className:(0,f.cn)("h-10 w-full min-w-0 rounded-lg border border-input bg-background px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/60 placeholder:text-xs focus-visible:ring-ring/10 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...c})}},94638:(a,b,c)=>{"use strict";c.d(b,{S:()=>f,ThemeCustomizerProvider:()=>i,y:()=>h});var d=c(16358),e=c(46407);let f="theme-gaia",g=(0,e.createContext)(null);function h(){let a=(0,e.useContext)(g);if(!a)throw Error("useThemeCustomizer must be used within a ThemeCustomizerProvider");return a}function i({children:a}){let[b,c]=(0,e.useState)(!1),[h,j]=(0,e.useState)(f),[k,l]=(0,e.useState)("sidebar");return(0,d.jsx)(g.Provider,{value:{theme:h,setTheme:(a,b=!0)=>{j(a)},layout:k,setLayout:(a,b=!0)=>{l(a)},isMounted:b},children:a})}},99538:(a,b,c)=>{"use strict";c.d(b,{ClientLayoutWrapper:()=>U});var d=c(16358),e=c(94638),f=c(46407),g=c(32829),h=c.n(g),i=c(37904),j=c(40491),k=c(79265),l=c(20626),m=c(51714),n=c(6164),o=c(45351),p=c(90241),q=c(28173),r=c(59322),s=c(73775),t=c(14206),u=c(55444),v=c(57693),w=c(71665),x=c(5955),y=c(77802),z=c(87821),A=c(40950),B=c(30322);function C({target:a,open:b,onOpenChange:c}){let{deleteProject:e}=(0,w.B)(),[g,h]=(0,f.useState)(!1);async function i(){if(a){h(!0);try{await e(a.id),y.oR.success(`Deleted "${a.name}".`),c(!1)}catch{y.oR.error("Could not delete the Project.")}finally{h(!1)}}}return(0,d.jsx)(B.lG,{open:b,onOpenChange:c,children:(0,d.jsxs)(B.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(B.c7,{children:[(0,d.jsxs)(B.L3,{children:["Delete “",a?.name,"”?"]}),(0,d.jsx)(B.rr,{children:"This permanently removes the Project's documents, index, vector data, and generated files. This cannot be undone."})]}),(0,d.jsxs)(B.Es,{children:[(0,d.jsx)(A.$,{variant:"outline",onClick:()=>c(!1),disabled:g,children:"Cancel"}),(0,d.jsxs)(A.$,{variant:"destructive",onClick:()=>void i(),disabled:g,children:[g&&(0,d.jsx)(z.A,{className:"size-4 animate-spin"}),"Delete Project"]})]})]})})}function D(){let{projects:a,activeProject:b,activateProject:c}=(0,w.B)(),[e,g]=(0,f.useState)(!1),[h,i]=(0,f.useState)(null),[j,l]=(0,f.useState)(null);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(v.rI,{children:[(0,d.jsxs)(v.ty,{render:(0,d.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,d.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-primary/12 text-primary",children:(0,d.jsx)(o.A,{className:"size-3.5"})}),(0,d.jsx)("span",{className:"flex min-w-0 flex-1 flex-col",children:(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:b?.name??"No project"}),b?.running&&(0,d.jsx)(E,{})]})}),(0,d.jsx)(r.A,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,d.jsxs)(v.SQ,{align:"start",sideOffset:6,className:"w-(--anchor-width) min-w-65",children:[(0,d.jsxs)(v.I,{children:[(0,d.jsx)(v.lp,{children:"Your projects"}),a.map(a=>{let e=a.id===b?.id;return(0,d.jsxs)(v._2,{onClick:()=>{e||c(a.id)},className:"gap-2",children:[(0,d.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:(0,d.jsx)(o.A,{className:"size-3.5"})}),(0,d.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,d.jsx)("span",{className:"truncate font-medium",children:a.name}),(0,d.jsxs)("span",{className:"flex items-center gap-2 text-[11px] text-muted-foreground tabular-nums",children:[(0,d.jsxs)("span",{children:[a.sourceCount," sources"]}),a.indexed&&(0,d.jsx)("span",{children:"\xb7 indexed"}),a.running&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-green-500",children:[(0,d.jsx)(E,{}),"live"]})]})]}),e&&(0,d.jsx)(s.A,{className:"size-4 shrink-0 text-primary"})]},a.id)})]}),(0,d.jsx)(v.mB,{}),(0,d.jsxs)(v._2,{onClick:()=>g(!0),className:"gap-2 h-9",children:[(0,d.jsx)(k.A,{className:"size-4"}),"New project"]}),b&&(0,d.jsxs)(v._2,{onClick:()=>i(b),className:"gap-2 h-9",children:[(0,d.jsx)(t.A,{className:"size-4"}),"Rename current"]}),b&&a.length>1&&(0,d.jsxs)(v._2,{variant:"destructive",onClick:()=>l(b),className:"gap-2",children:[(0,d.jsx)(u.A,{className:"size-4"}),"Delete current project"]})]})]}),(0,d.jsx)(x.S,{mode:"create",open:e,onOpenChange:g}),(0,d.jsx)(x.S,{mode:"rename",target:h,open:null!==h,onOpenChange:a=>!a&&i(null)}),(0,d.jsx)(C,{target:j,open:null!==j,onOpenChange:a=>!a&&l(null)})]})}function E(){return(0,d.jsxs)("span",{className:"relative flex size-2",children:[(0,d.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,d.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-500"})]})}let F=[{id:"chat",label:"Chat",href:"/chat",icon:j.A},{id:"add",label:"Add",href:"/add",icon:k.A},{id:"data",label:"Data",href:"/data",icon:l.A},{id:"settings",label:"Settings",href:"/settings",icon:m.A}];function G(){let a=(0,i.usePathname)(),{activeProject:b}=(0,w.B)(),[c,e]=(0,f.useState)(!0),g=()=>{let a=!c;e(a),localStorage.setItem("sidebar-collapsed",String(a))};return(0,d.jsx)(q.Bc,{delay:150,children:(0,d.jsxs)("aside",{className:(0,p.cn)("sticky top-0 hidden h-screen shrink-0 flex-col self-start py-4 md:flex transition-all duration-300 ease-in-out bg-sidebar",c?"w-18":"w-60"),children:[(0,d.jsx)("div",{className:(0,p.cn)("flex w-full items-center mb-6",c?"justify-center px-3":"justify-between px-4"),children:c?(0,d.jsxs)(q.m_,{children:[(0,d.jsxs)(q.k$,{render:(0,d.jsx)("button",{onClick:g,"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,d.jsx)("img",{src:"/logo9.png",className:"size-5 dark:hidden",alt:"logo"}),(0,d.jsx)("img",{src:"/logo.png",className:"size-5 hidden dark:block",alt:"logo"})]}),(0,d.jsx)(q.ZI,{side:"right",sideOffset:10,children:"Expand sidebar"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(h(),{href:"/chat",className:"flex items-center gap-2.5",children:[(0,d.jsxs)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:[(0,d.jsx)("img",{src:"/logo9.png",className:"size-5 dark:hidden",alt:"logo"}),(0,d.jsx)("img",{src:"/logo.png",className:"size-5 hidden dark:block",alt:"logo"})]}),(0,d.jsx)("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Larkup"})]}),(0,d.jsx)("button",{onClick:g,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,d.jsx)(n.A,{className:"size-3.5"})})]})}),(0,d.jsx)("nav",{className:(0,p.cn)("flex flex-1 flex-col w-full",c?"items-center px-3 gap-3":"px-3 gap-1.5"),children:F.map(b=>{let e=b.icon,f=a===b.href||"/"!==b.href&&a?.startsWith(b.href);return c?(0,d.jsxs)(q.m_,{children:[(0,d.jsx)(q.k$,{className:"",render:(0,d.jsx)(h(),{href:b.href,"aria-current":f?"page":void 0,onClick:c=>{"chat"===b.id&&"/chat"===a&&(c.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,p.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",f?"bg-sidebar-accent/60 text-sidebar-accent-foreground hover:bg-sidebar-accent":"text-muted-foreground hover:bg-white/65 hover:text-foreground")}),children:(0,d.jsx)(e,{className:"size-4.5",strokeWidth:f?2.25:1.75})}),(0,d.jsx)(q.ZI,{side:"right",sideOffset:10,children:b.label})]},b.id):(0,d.jsxs)(h(),{href:b.href,"aria-current":f?"page":void 0,onClick:c=>{"chat"===b.id&&"/chat"===a&&(c.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,p.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",f?"bg-sidebar-accent/70 text-sidebar-accent-foreground hover:bg-sidebar-accent/70":"text-muted-foreground hover:bg-white/65 hover:text-foreground"),children:[(0,d.jsx)(e,{className:"size-4.5 shrink-0",strokeWidth:f?2.25:1.75}),(0,d.jsx)("span",{className:"truncate",children:b.label})]},b.id)})}),(0,d.jsx)("div",{className:(0,p.cn)("w-full pt-3",c?"px-2":"px-3"),children:c?(0,d.jsxs)(q.m_,{children:[(0,d.jsx)(q.k$,{render:(0,d.jsx)("button",{onClick:g,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,d.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,d.jsx)(o.A,{className:"size-4"}),(0,d.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-2.5",children:b?.running?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,d.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-green-500 border border-card"})]}):(0,d.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-gray-500 border border-card"})})]})}),(0,d.jsxs)(q.ZI,{side:"right",sideOffset:10,children:[b?.name??"No project"," (",b?.running?"Live":"Offline",")"]})]}):(0,d.jsx)(D,{})})]})})}let H=[{id:"chat",label:"Chat",href:"/chat",icon:j.A},{id:"add",label:"Add",href:"/add",icon:k.A},{id:"data",label:"Data",href:"/data",icon:l.A},{id:"settings",label:"Settings",href:"/settings",icon:m.A}];function I(){let a=(0,i.usePathname)();return(0,d.jsx)(q.Bc,{delay:150,children:(0,d.jsxs)("header",{className:(0,p.cn)("sticky top-0 z-50 flex h-14 shrink-0 items-center gap-6 border-b border-border px-4 md:px-6 bg-sidebar"),children:[(0,d.jsxs)(h(),{href:"/chat","aria-label":"larkup home",className:"flex items-center gap-2.5 shrink-0",children:[(0,d.jsxs)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:[(0,d.jsx)("img",{src:"/logo9.png",className:"size-5 dark:hidden",alt:"logo"}),(0,d.jsx)("img",{src:"/logo.png",className:"size-5 hidden dark:block",alt:"logo"})]}),(0,d.jsx)("span",{className:"font-semibold tracking-tight text-foreground hidden sm:inline-block",children:"Larkup"})]}),(0,d.jsx)("nav",{className:"flex h-full items-center gap-1",children:H.map(b=>{let c=b.icon,e=a===b.href||"/"!==b.href&&a?.startsWith(b.href);return(0,d.jsxs)(h(),{href:b.href,"aria-current":e?"page":void 0,className:(0,p.cn)("group relative flex items-center gap-2 h-full px-3 text-[13px] font-medium transition-colors outline-none",e?"text-primary":"text-muted-foreground hover:text-foreground"),children:[(0,d.jsx)(c,{className:"size-4",strokeWidth:e?2.25:1.75}),(0,d.jsx)("span",{className:"hidden md:inline",children:b.label}),(0,d.jsx)("span",{className:(0,p.cn)("absolute bottom-0 left-2 right-2 h-0.5 rounded-full bg-primary transition-opacity",e?"opacity-100":"opacity-0")})]},b.id)})}),(0,d.jsx)("div",{className:"flex-1"}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(D,{}),""]})]})})}var J=c(81040),K=c(46352),L=c(97768),M=c(63323),N=c(22229),O=c(94636),P=c(15478),Q=c(13139),R=c(78565);let S=["vercel_ai_gateway","openai","google","mistral","custom"];function T(){let{createProject:a,refresh:b}=(0,w.B)(),c=(0,i.useRouter)(),[e,g]=(0,f.useState)(""),[h,j]=(0,f.useState)("vercel_ai_gateway"),[k,l]=(0,f.useState)(""),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)("vercel_ai_gateway"),[q,r]=(0,f.useState)(""),[s,u]=(0,f.useState)(null),[v,x]=(0,f.useState)(!1),[C,D]=(0,f.useState)(!1),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)("vercel_ai_gateway"),[I,T]=(0,f.useState)(""),[U,V]=(0,f.useState)(!1),[W,X]=(0,f.useState)(!1),[Y,Z]=(0,f.useState)(!1),[$,_]=(0,f.useState)(null),aa="custom"===h,ab="custom"===o,ac=C||aa||h!==o?q:k,ad=async()=>{x(!0);try{let d=await fetch("/api/config"),{config:f}=await d.json(),g={...f};aa&&m?(g.embeddingProvider="custom",g.embeddingModelId=`custom:${m.modelName}`,g.embeddingApiKey=m.apiKey||void 0,g.customEmbeddings=[m]):(g.embeddingProvider=h,g.embeddingApiKey=k),C?ab&&s?(g.chatProvider="custom",g.chatModelId=`custom:${s.modelName}`,g.chatApiKey=s.apiKey||void 0,g.customChatModels=[s]):(g.chatProvider=o,g.chatApiKey=ac):aa&&m||(g.chatProvider=h,g.chatApiKey=k),g.visionProvider=E?G:g.chatProvider,g.visionApiKey=E?I:g.chatApiKey,g.visionModelId="";let i=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embeddingProvider:g.embeddingProvider,embeddingApiKey:g.embeddingApiKey,embeddingModelId:g.embeddingModelId,customEmbeddings:g.customEmbeddings,chatProvider:g.chatProvider,chatApiKey:g.chatApiKey,chatModelId:g.chatModelId,customChatModels:g.customChatModels,visionProvider:g.visionProvider,visionApiKey:g.visionApiKey,visionModelId:g.visionModelId})});if(!i.ok){let a=await i.json();y.oR.error(a.error||"Verification failed — please check your API key.",{duration:8e3}),x(!1);return}await a(e.trim()||"my-larkup"),await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),b(),c.push("/chat")}catch(a){y.oR.error("Failed to complete setup")}finally{x(!1)}},ae=async()=>{x(!0);try{await a(e.trim()||"my-larkup"),b(),c.push("/chat")}catch(a){y.oR.error("Failed to complete setup")}finally{x(!1)}},af=(a,b)=>(0,d.jsxs)(P.l6,{value:a,onValueChange:a=>{var c;"custom"===(c=a??"")?("embedding"===b?j("custom"):p("custom"),_(b)):"embedding"===b?(j(c),n(null),!C&&p(c),!E&&H(c)):(p(c),u(null))},children:[(0,d.jsx)(P.bq,{className:"w-full bg-white/90 hover:bg-white",children:(0,d.jsx)("span",{className:"flex items-center gap-2",children:Q.Qd[a]?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Q.rb,{src:Q.Qd[a].iconSrc,alt:Q.Qd[a].label,pillBg:Q.Qd[a].pillBg,size:16}),Q.Qd[a].label]}):"Select provider"})}),(0,d.jsx)(P.gC,{children:S.map(a=>{let b=Q.Qd[a];return b?(0,d.jsx)(P.eb,{value:a,children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(Q.rb,{src:b.iconSrc,alt:b.label,pillBg:b.pillBg,size:16}),(0,d.jsxs)("span",{children:[b.label,"vercel_ai_gateway"===a&&" (Recommended)","custom"===a&&" (OpenAI-compatible)"]})]})},a):null})})]}),ag=(a,b)=>(0,d.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,d.jsx)("span",{className:"text-green-600 text-xs",children:"✓"}),(0,d.jsx)("span",{className:"flex-1 truncate text-xs font-medium text-foreground",children:a.modelName}),(0,d.jsx)("button",{type:"button",onClick:()=>_(b),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,d.jsx)(t.A,{className:"size-3"})})]});return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-background",children:[(0,d.jsxs)("div",{className:"pointer-events-none fixed inset-0 overflow-hidden",children:[(0,d.jsx)("div",{className:"absolute -left-20 -top-20 h-125 w-125 rounded-full bg-stone-200/40 blur-3xl animate-pulse"}),(0,d.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,d.jsx)("div",{className:"relative z-10 flex min-h-full w-full flex-col items-center justify-center px-6 py-12",children:(0,d.jsxs)("div",{className:"flex w-full max-w-lg flex-col items-center gap-8 animate-fade-up",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[(0,d.jsx)("div",{className:"flex size-14 items-center justify-center rounded-xl bg-primary text-primary-foreground ",children:(0,d.jsx)("img",{src:"/logo9.png",className:"size-8",alt:"Larkup"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Welcome to Larkup"}),(0,d.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,d.jsxs)("div",{className:"w-full space-y-5 rounded-2xl p-6 backdrop-blur-xl",children:[(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Your Name (Optional)"}),(0,d.jsx)(O.p,{value:e,onChange:a=>g(a.target.value),placeholder:"How should we call you?",className:"bg-white"})]}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Embedding Provider"}),af(h,"embedding"),aa&&m&&ag(m,"embedding"),aa&&!m&&(0,d.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!aa&&(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsxs)("label",{className:"text-xs font-medium text-foreground",children:["API Key",!C&&(0,d.jsxs)("span",{className:"text-muted-foreground font-normal",children:[" ","(used for both embedding & chat)"]})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(O.p,{type:U?"text":"password",value:k,onChange:a=>l(a.target.value),placeholder:"sk-...",className:"bg-white pr-10"}),(0,d.jsx)("button",{type:"button","aria-label":U?"Hide API key":"Show API key",onClick:()=>V(a=>!a),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:U?(0,d.jsx)(J.A,{className:"size-4"}):(0,d.jsx)(K.A,{className:"size-4"})})]})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>D(!C),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[C?(0,d.jsx)(L.A,{className:"size-3.5"}):(0,d.jsx)(M.A,{className:"size-3.5"}),"Use a different chat model"]}),C&&(0,d.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat Provider"}),af(o,"chat"),ab&&s&&ag(s,"chat"),ab&&!s&&(0,d.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!ab&&(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat API Key"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(O.p,{type:W?"text":"password",value:q,onChange:a=>r(a.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,d.jsx)("button",{type:"button","aria-label":W?"Hide chat API key":"Show chat API key",onClick:()=>X(a=>!a),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:W?(0,d.jsx)(J.A,{className:"size-4"}):(0,d.jsx)(K.A,{className:"size-4"})})]})]})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>F(!E),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[E?(0,d.jsx)(L.A,{className:"size-3.5"}):(0,d.jsx)(M.A,{className:"size-3.5"}),"Use a dedicated vision model for video and images"]}),E&&(0,d.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Vision Provider"}),(0,d.jsxs)(P.l6,{value:G,onValueChange:a=>H(a??""),children:[(0,d.jsx)(P.bq,{className:"w-full bg-white/90 hover:bg-white",children:(0,d.jsx)("span",{className:"flex items-center gap-2",children:Q.Qd[G]?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Q.rb,{src:Q.Qd[G].iconSrc,alt:Q.Qd[G].label,pillBg:Q.Qd[G].pillBg,size:16}),Q.Qd[G].label]}):"Select provider"})}),(0,d.jsx)(P.gC,{children:S.filter(a=>"custom"!==a).map(a=>{let b=Q.Qd[a];return b?(0,d.jsx)(P.eb,{value:a,children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(Q.rb,{src:b.iconSrc,alt:b.label,pillBg:b.pillBg,size:16}),(0,d.jsx)("span",{children:b.label})]})},a):null})})]}),(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Only vision-capable models are used; the default is selected automatically."})]}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Vision API Key"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(O.p,{type:Y?"text":"password",value:I,onChange:a=>T(a.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,d.jsx)("button",{type:"button","aria-label":Y?"Hide vision API key":"Show vision API key",onClick:()=>Z(a=>!a),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:Y?(0,d.jsx)(J.A,{className:"size-4"}):(0,d.jsx)(K.A,{className:"size-4"})})]})]})]}),(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"More providers and fine-grained model selection available in Settings → AI Models."}),(0,d.jsxs)("div",{className:"pt-2 flex gap-3",children:[(0,d.jsx)(A.$,{variant:"outline",className:"flex-1 h-10",onClick:ae,disabled:v,children:"Skip for now"}),(0,d.jsx)(A.$,{className:"flex-1 h-10",onClick:ad,disabled:v||!(()=>{if(aa){if(!m)return!1}else if(!k)return!1;if(C){if(ab){if(!s)return!1}else if(!ac)return!1}return!E||!!I})(),children:v?(0,d.jsx)(z.A,{className:"size-4 animate-spin"}):(0,d.jsxs)(d.Fragment,{children:["Continue ",(0,d.jsx)(N.A,{className:"ml-1.5 size-4"})]})})]})]})]})}),(0,d.jsx)(B.lG,{open:null!==$,onOpenChange:a=>{a||("embedding"!==$||m||j("vercel_ai_gateway"),"chat"!==$||s||p("vercel_ai_gateway"),_(null))},children:(0,d.jsxs)(B.Cf,{className:"max-w-xl",children:[(0,d.jsxs)(B.c7,{children:[(0,d.jsxs)(B.L3,{children:["Custom ","embedding"===$?"Embedding":"Chat"," Model"]}),(0,d.jsxs)(B.rr,{children:["Connect an OpenAI-compatible ","embedding"===$?"embedding":"chat"," ","model. Test the connection before adding."]})]}),$&&(0,d.jsx)(R.B,{type:$,onSave:a=>{"embedding"===$?(n(a),j("custom")):"chat"===$&&(u(a),p("custom")),_(null)},onCancel:()=>{"embedding"!==$||m||j("vercel_ai_gateway"),"chat"!==$||s||p("vercel_ai_gateway"),_(null)}})]})})]})}function U({children:a}){let{layout:b}=(0,e.y)(),c=(0,i.usePathname)(),f=c?.includes("/chat"),{isFirstRun:g,isLoading:h}=(0,w.B)();return!h&&g?(0,d.jsx)(T,{}):h?(0,d.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,d.jsx)("div",{className:"size-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):"topnav"===b?(0,d.jsxs)("div",{className:"flex flex-col h-screen overflow-hidden",children:[(0,d.jsx)(I,{}),(0,d.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,d.jsx)("div",{className:"h-full flex flex-col bg-background text-foreground",children:(0,d.jsx)("div",{className:(0,p.cn)("flex-1 min-h-0",f||c?.includes("/settings")||c?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,d.jsx)("div",{className:(0,p.cn)("h-full w-full",f||c?.includes("/settings")||c?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:a})})})})]}):(0,d.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,d.jsx)(G,{}),(0,d.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,d.jsx)("div",{className:"h-screen flex flex-col border-l border-border/90 bg-background text-foreground overflow-hidden",children:(0,d.jsx)("div",{className:(0,p.cn)("flex-1 min-h-0",f||c?.includes("/settings")||c?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,d.jsx)("div",{className:(0,p.cn)("h-full w-full",f||c?.includes("/settings")||c?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:a})})})})]})}}};
@@ -1 +1 @@
1
- "use strict";exports.id=4188,exports.ids=[4188],exports.modules={14188:(a,b,c)=>{c.d(b,{GV:()=>r,PE:()=>t,Ys:()=>u,cG:()=>q,l4:()=>w,tI:()=>s});var d=c(31421),e=c(77598),f=c(71553),g=c(73024),h=c(77030),i=c(76760),j=c.n(i),k=c(46466),l=c(57075),m=c(58894),n=c.n(m);function o(a){let b=Number(a);return Number.isFinite(b)&&b>0?b:void 0}function p(a){if(a)try{let b=new URL(a);if("youtu.be"===b.hostname)return b.pathname.split("/").filter(Boolean)[0];return b.searchParams.get("v")??void 0}catch{return/^[\w-]{6,}$/.test(a)?a:void 0}}function q(a){let b=Object.entries(a.configuration??{}).filter(([,a])=>void 0!==a).sort(([a],[b])=>a.localeCompare(b));return(0,e.createHash)("sha256").update(JSON.stringify({...a,configuration:b})).digest("hex")}function r(a){return a.replace(/\s+/g," ").trim().slice(-500)}function s(a,b=2){let c,d=[];for(let e of[...a].sort((a,b)=>a.startSecs-b.startSecs)){let a=new Set((c?.text??"").toLocaleLowerCase().match(/[\p{Letter}\p{Number}]+/gu)??[]),f=new Set(e.text.toLocaleLowerCase().match(/[\p{Letter}\p{Number}]+/gu)??[]),g=[...f].filter(b=>!a.has(b)).length;d.push({timestampSecs:e.startSecs,transcriptChange:0===f.size?0:Math.min(1,g/f.size),silenceBoundary:!!(c&&e.startSecs-c.endSecs>=b)}),c=e}return d}async function t(a){let b=JSON.parse(await C(process.env.LARKUP_FFPROBE_PATH?.trim()||n().path,["-v","error","-show_entries","format=duration:format_tags=probe_score","-of","json",a])),c=Number(b.format?.duration??0);return{durationSecs:Number.isFinite(c)?Math.max(0,c):0,hasCorruptionSignals:!Number.isFinite(c)||c<=0}}async function u(a){let b=F(a);if(I(b)){var c;let b,d,e,f,g,h,i,j=await A(["--dump-single-json","--simulate","--flat-playlist",a]),k=(b=(c=JSON.parse(j)).entries??[],d=p(a),e=b.find(a=>d&&[a.id,p(a.url),p(a.webpage_url)].includes(d))??b[0],f=e?.id??p(e?.webpage_url)??p(e?.url)??d,g=b.reduce((a,b)=>a+(o(b.duration)??0),0),h=o(c.duration)??(g||void 0),i=o(e?.duration)??(b.length<=1?h:void 0),{originalUrl:a,title:c.title,durationSecs:h,singleItemDurationSecs:i,singleItemUrl:f?`https://www.youtube.com/watch?v=${encodeURIComponent(f)}`:void 0,entryCount:Math.max(1,b.length),mediaType:"video",isYouTube:!0});if((k.entryCount??1)>1&&!k.singleItemDurationSecs&&k.singleItemUrl){let a=JSON.parse(await A(["--dump-single-json","--simulate","--no-playlist",k.singleItemUrl]));k.singleItemDurationSecs=o(a.duration)}return k}let d=await v(a,{method:"HEAD"});if((405===d.status||501===d.status)&&(d=await v(a,{headers:{Range:"bytes=0-0"}})),!d.ok)throw Error(`Unable to inspect media URL (${d.status}).`);let e=d.headers.get("content-type")?.split(";")[0],f="unknown"===J(e)?K(j().extname(b.pathname).slice(1)):e,g=d.headers.get("content-range")?.match(/\/(\d+)$/)?.[1];return await d.body?.cancel(),{originalUrl:a,mimeType:f,mediaType:J(f),contentLength:Number(g??d.headers.get("content-length"))||void 0,durationSecs:Number(d.headers.get("content-duration"))||void 0,entryCount:1,isYouTube:!1}}async function v(a,b){try{return await G(a,{...b,signal:AbortSignal.timeout(7e3)})}catch(a){if(a instanceof DOMException&&"TimeoutError"===a.name)throw Error("The media URL did not respond within 7 seconds. Check that it is public and try again.");throw a}}async function w(a,b){let c,d=F(a);if(await g.promises.mkdir(b.outputDir,{recursive:!0}),I(d)){let c=j().join(b.outputDir,"%(title).120B [%(id)s].%(ext)s"),d=await A(["--no-playlist","--playlist-end",String(b.playlistMax??10),"--socket-timeout","20","--retries","2","--newline","--format","best[height<=360]/bestvideo[height<=360]+bestaudio/best","--merge-output-format","mp4","-o",c,"--print",'after_move:{"path":%(filepath)j,"title":%(title)j,"originalUrl":%(webpage_url)j,"ext":%(ext)j}',a],b.onProgress);return await Promise.all(d.split("\n").filter(Boolean).map(async c=>{let d=JSON.parse(c),e=await x(d.path,b.outputDir),f=K(j().extname(e).slice(1))??K(d.ext);return{path:e,title:d.title,originalUrl:d.originalUrl||a,mimeType:f,mediaType:J(f)}}))}let f=Date.now();b.onProgress?.({message:"Connecting to the media source…",elapsedSeconds:0});let h=b.onProgress?setInterval(()=>{let a=Math.floor((Date.now()-f)/1e3);b.onProgress?.({message:`Connecting to the media source \xb7 ${a}s`,elapsedSeconds:a})},1e3):void 0;try{c=await G(a)}finally{h&&clearInterval(h)}if(!c.ok||!c.body)throw Error(`Media download failed (${c.status}).`);let i=b.maxBytes??524288e3,m=Number(c.headers.get("content-length"));if(m>i)throw Error(`Media exceeds download limit of ${i} bytes.`);let n=(j().basename(new URL(c.url).pathname)||"download").replace(/[^a-zA-Z0-9._-]/g,"_").slice(0,180)||"download",o=c.headers.get("content-type")?.split(";")[0],p="unknown"===J(o)?K(j().extname(n).slice(1)):o,q=j().join(b.outputDir,`${(0,e.randomUUID)()}-${n}`),r=0,s=0,t=Number.isFinite(m)&&m>0,u=l.Readable.fromWeb(c.body);u.on("data",a=>{(r+=a.length)>i&&u.destroy(Error(`Media exceeds download limit of ${i} bytes.`));let c=Date.now(),d=t&&r>=m;if(!b.onProgress||c-s<500&&!d)return;s=c;let e=Math.max(0,Math.floor((c-f)/1e3)),g=r/Math.max(1,(c-f)/1e3),h=t?Math.max(0,Math.round((m-r)/Math.max(1,g))):void 0;b.onProgress({...t?{percent:Math.min(99,r/m*100),total:m}:{},current:r,unit:"bytes",elapsedSeconds:e,estimatedRemainingSeconds:h,message:`Downloading media \xb7 ${E(r)}${t?` / ${E(m)}`:""} \xb7 ${E(g)}/s`})});try{await (0,k.pipeline)(u,(0,g.createWriteStream)(q,{flags:"wx"}))}catch(a){throw await g.promises.rm(q,{force:!0}),a}return[{path:q,originalUrl:a,title:n,mimeType:p,mediaType:J(p)}]}async function x(a,b){let c=j().resolve(b),d=j().resolve(a);if(!y(d,c))throw Error("Video downloader returned a file outside its import directory.");try{if((await g.promises.stat(d)).isFile())return d}catch(a){if(!(a instanceof Error&&"code"in a&&"ENOENT"===a.code))throw a}let e=j().basename(a).match(/\[([\w-]+)\](?:\.[^.]+)?$/)?.[1],f=(await g.promises.readdir(c,{withFileTypes:!0})).filter(a=>a.isFile()&&!!K(j().extname(a.name).slice(1))).map(a=>j().join(c,a.name)).filter(a=>y(a,c));if(!f.length)throw Error("Video download completed but did not produce a readable media file.");let h=j().extname(a).toLowerCase();return f.sort((a,b)=>z(b,e,h)-z(a,e,h))[0]}function y(a,b){let c=j().relative(b,a);return""!==c&&!c.startsWith(`..${j().sep}`)&&".."!==c&&!j().isAbsolute(c)}function z(a,b,c){let d=j().basename(a),e=j().extname(d).toLowerCase(),f=K(e.slice(1));return(b&&d.includes(`[${b}]`)?100:0)+20*!!f?.startsWith("video/")+10*(e===c)}async function A(a,b){let c=process.env.LARKUP_YTDLP_PATH?.trim()||j().join(process.cwd(),".larkup","tools","bin","win32"===process.platform?"yt-dlp.exe":"yt-dlp"),d=Date.now();b?.({message:"Preparing the video downloader…",elapsedSeconds:0});let e=b?setInterval(()=>{let a=Math.floor((Date.now()-d)/1e3);b({message:`Preparing the video downloader \xb7 ${a}s`,elapsedSeconds:a})},1e3):void 0;try{await B(c)}finally{e&&clearInterval(e)}return b?.({message:"Connecting to the video source…",elapsedSeconds:0}),C(c,["--js-runtimes","nodejs:node",...a],b)}async function B(a){if(process.env.LARKUP_YTDLP_PATH?.trim())return;try{await g.promises.access(a);return}catch{}let b="darwin"===process.platform?"yt-dlp_macos":"win32"===process.platform?"yt-dlp.exe":"arm64"===process.arch?"yt-dlp_linux_aarch64":"yt-dlp_linux",c=`${a}.${(0,e.randomUUID)()}.download`;try{await g.promises.mkdir(j().dirname(a),{recursive:!0});let d=await fetch(`https://github.com/yt-dlp/yt-dlp/releases/latest/download/${b}`,{redirect:"follow",signal:AbortSignal.timeout(12e4)});if(!d.ok)throw Error(`download returned HTTP ${d.status}`);await g.promises.writeFile(c,Buffer.from(await d.arrayBuffer()),{mode:493}),"win32"!==process.platform&&await g.promises.chmod(c,493),await g.promises.rename(c,a)}catch(b){await g.promises.rm(c,{force:!0}).catch(()=>void 0);let a=b instanceof Error?b.message:String(b);throw Error(`Could not prepare the built-in YouTube downloader (${a}).`)}}function C(a,b,c){return new Promise((e,f)=>{let g,h=(0,d.spawn)(a,b,{shell:!1}),i="",k="",l="",m=Date.now(),n=setTimeout(()=>h.kill("SIGTERM"),12e4),o=c?setInterval(()=>{let a=Math.floor((Date.now()-m)/1e3);c({...g,elapsedSeconds:a,message:g?.percent?`${g.message} \xb7 active ${a}s`:`Connecting to the video source \xb7 ${a}s`})},1e3):void 0;h.stdout.on("data",a=>i+=String(a)),h.stderr.on("data",a=>{let b=String(a);k+=b;let d=(l+=b).split(/[\r\n]+/);for(let a of(l=d.pop()??"",d)){let b=D(a,Math.floor((Date.now()-m)/1e3));b&&(g=b,c?.(b))}}),h.on("error",a=>{clearTimeout(n),o&&clearInterval(o),f(a)}),h.on("close",b=>{clearTimeout(n),o&&clearInterval(o);let d=D(l,Math.floor((Date.now()-m)/1e3));d&&c?.(d),0===b?e(i.trim()):f(Error(`${j().basename(a)} failed (${b}): ${k.trim()}`))})})}function D(a,b=0){let c,d=a.match(/(\d+(?:\.\d+)?)%/);if(!d)return null;let e=Math.min(99,Math.max(0,Number(d[1])));if(!Number.isFinite(e))return null;let f=a.match(/\bof\s+~?\s*([\d.]+)\s*(KiB|MiB|GiB|KB|MB|GB)\b/i),g=f?function(a,b){if(!Number.isFinite(a)||a<0)return;let c={KiB:1,MiB:2,GiB:3,KB:1,MB:2,GB:3}[b];if(void 0===c)return;let d=b.endsWith("iB")?1024:1e3;return a*d**c}(Number(f[1]),f[2]):void 0,h=g?g*e/100:void 0,i=a.match(/\bat\s+([^\s]+\/s)\b/i)?.[1],j=a.match(/\bETA\s+(\d{1,2}:\d{2}(?::\d{2})?)\b/i)?.[1],k=j?function(a){let b=a.split(":").map(Number);if(!b.some(a=>!Number.isFinite(a))){if(2===b.length)return 60*b[0]+b[1];if(3===b.length)return 3600*b[0]+60*b[1]+b[2]}}(j):void 0;return{percent:e,...void 0!==h?{current:h}:{},...void 0!==g?{total:g,unit:"bytes"}:{},elapsedSeconds:b,estimatedRemainingSeconds:k,message:[`Downloading video \xb7 ${Number.isInteger(c=Math.round(10*e)/10)?String(c):c.toFixed(1)}%`,i,j?`${j} left`:void 0].filter(Boolean).join(" \xb7 ")}}function E(a){return!Number.isFinite(a)||a<1024?`${Math.max(0,Math.round(a))} B`:a<1048576?`${(a/1024).toFixed(1)} KiB`:a<0x40000000?`${(a/1048576).toFixed(1)} MiB`:`${(a/0x40000000).toFixed(2)} GiB`}function F(a){let b=new URL(a);if("http:"!==b.protocol&&"https:"!==b.protocol)throw Error("Only http(s) media URLs are supported.");return b}async function G(a,b={}){let c=F(a);for(let a=0;a<=5;a++){await H(c.hostname);let a=await fetch(c,{...b,redirect:"manual"});if(![301,302,303,307,308].includes(a.status))return a;let d=a.headers.get("location");if(!d)throw Error("Media URL redirected without a location.");c=F(new URL(d,c).toString())}throw Error("Media URL redirected too many times.")}async function H(a){let b=(0,h.isIP)(a)?[{address:a}]:await (0,f.lookup)(a,{all:!0,verbatim:!0});if(!b.length||b.some(({address:a})=>(function(a){let b=a.toLowerCase();if("::1"===b||"::"===b||b.startsWith("fe80:")||b.startsWith("fc")||b.startsWith("fd"))return!0;let c=(b.startsWith("::ffff:")?b.slice(7):b).split(".").map(Number);if(4!==c.length||c.some(Number.isNaN))return!1;let[d,e]=c;return 0===d||10===d||127===d||169===d&&254===e||172===d&&e>=16&&e<=31||192===d&&168===e||d>=224})(a)))throw Error("Private or local media URLs are not supported.")}function I(a){return/(^|\.)youtube\.com$|(^|\.)youtu\.be$/.test(a.hostname)}function J(a){return a?.startsWith("video/")?"video":a?.startsWith("audio/")?"audio":"unknown"}function K(a){return({mp4:"video/mp4",webm:"video/webm",mkv:"video/x-matroska",mov:"video/quicktime",mp3:"audio/mpeg",m4a:"audio/mp4",wav:"audio/wav",ogg:"audio/ogg",flac:"audio/flac"})[a.toLowerCase()]}}};
1
+ "use strict";exports.id=4188,exports.ids=[4188],exports.modules={14188:(a,b,c)=>{c.d(b,{GV:()=>r,PE:()=>t,Ys:()=>u,cG:()=>q,l4:()=>w,tI:()=>s});var d=c(31421),e=c(77598),f=c(71553),g=c(73024),h=c(77030),i=c(76760),j=c.n(i),k=c(46466),l=c(57075),m=c(58894),n=c.n(m);function o(a){let b=Number(a);return Number.isFinite(b)&&b>0?b:void 0}function p(a){if(a)try{let b=new URL(a);if("youtu.be"===b.hostname)return b.pathname.split("/").filter(Boolean)[0];return b.searchParams.get("v")??void 0}catch{return/^[\w-]{6,}$/.test(a)?a:void 0}}function q(a){let b=Object.entries(a.configuration??{}).filter(([,a])=>void 0!==a).sort(([a],[b])=>a.localeCompare(b));return(0,e.createHash)("sha256").update(JSON.stringify({...a,configuration:b})).digest("hex")}function r(a){return a.replace(/\s+/g," ").trim().slice(-500)}function s(a,b=2){let c,d=[];for(let e of[...a].sort((a,b)=>a.startSecs-b.startSecs)){let a=new Set((c?.text??"").toLocaleLowerCase().match(/[\p{Letter}\p{Number}]+/gu)??[]),f=new Set(e.text.toLocaleLowerCase().match(/[\p{Letter}\p{Number}]+/gu)??[]),g=[...f].filter(b=>!a.has(b)).length;d.push({timestampSecs:e.startSecs,transcriptChange:0===f.size?0:Math.min(1,g/f.size),silenceBoundary:!!(c&&e.startSecs-c.endSecs>=b)}),c=e}return d}async function t(a){let b=JSON.parse(await C(function(){let a=process.env.LARKUP_FFPROBE_PATH?.trim()||n().path;if(a===n().path)try{(0,g.chmodSync)(a,493)}catch{}return a}(),["-v","error","-show_entries","format=duration:format_tags=probe_score","-of","json",a])),c=Number(b.format?.duration??0);return{durationSecs:Number.isFinite(c)?Math.max(0,c):0,hasCorruptionSignals:!Number.isFinite(c)||c<=0}}async function u(a){let b=F(a);if(I(b)){var c;let b,d,e,f,g,h,i,j=await A(["--dump-single-json","--simulate","--flat-playlist",a]),k=(b=(c=JSON.parse(j)).entries??[],d=p(a),e=b.find(a=>d&&[a.id,p(a.url),p(a.webpage_url)].includes(d))??b[0],f=e?.id??p(e?.webpage_url)??p(e?.url)??d,g=b.reduce((a,b)=>a+(o(b.duration)??0),0),h=o(c.duration)??(g||void 0),i=o(e?.duration)??(b.length<=1?h:void 0),{originalUrl:a,title:c.title,durationSecs:h,singleItemDurationSecs:i,singleItemUrl:f?`https://www.youtube.com/watch?v=${encodeURIComponent(f)}`:void 0,entryCount:Math.max(1,b.length),mediaType:"video",isYouTube:!0});if((k.entryCount??1)>1&&!k.singleItemDurationSecs&&k.singleItemUrl){let a=JSON.parse(await A(["--dump-single-json","--simulate","--no-playlist",k.singleItemUrl]));k.singleItemDurationSecs=o(a.duration)}return k}let d=await v(a,{method:"HEAD"});if((405===d.status||501===d.status)&&(d=await v(a,{headers:{Range:"bytes=0-0"}})),!d.ok)throw Error(`Unable to inspect media URL (${d.status}).`);let e=d.headers.get("content-type")?.split(";")[0],f="unknown"===J(e)?K(j().extname(b.pathname).slice(1)):e,g=d.headers.get("content-range")?.match(/\/(\d+)$/)?.[1];return await d.body?.cancel(),{originalUrl:a,mimeType:f,mediaType:J(f),contentLength:Number(g??d.headers.get("content-length"))||void 0,durationSecs:Number(d.headers.get("content-duration"))||void 0,entryCount:1,isYouTube:!1}}async function v(a,b){try{return await G(a,{...b,signal:AbortSignal.timeout(7e3)})}catch(a){if(a instanceof DOMException&&"TimeoutError"===a.name)throw Error("The media URL did not respond within 7 seconds. Check that it is public and try again.");throw a}}async function w(a,b){let c,d=F(a);if(await g.promises.mkdir(b.outputDir,{recursive:!0}),I(d)){let c=j().join(b.outputDir,"%(title).120B [%(id)s].%(ext)s"),d=await A(["--no-playlist","--playlist-end",String(b.playlistMax??10),"--socket-timeout","20","--retries","2","--newline","--format","best[height<=360]/bestvideo[height<=360]+bestaudio/best","--merge-output-format","mp4","-o",c,"--print",'after_move:{"path":%(filepath)j,"title":%(title)j,"originalUrl":%(webpage_url)j,"ext":%(ext)j}',a],b.onProgress);return await Promise.all(d.split("\n").filter(Boolean).map(async c=>{let d=JSON.parse(c),e=await x(d.path,b.outputDir),f=K(j().extname(e).slice(1))??K(d.ext);return{path:e,title:d.title,originalUrl:d.originalUrl||a,mimeType:f,mediaType:J(f)}}))}let f=Date.now();b.onProgress?.({message:"Connecting to the media source…",elapsedSeconds:0});let h=b.onProgress?setInterval(()=>{let a=Math.floor((Date.now()-f)/1e3);b.onProgress?.({message:`Connecting to the media source \xb7 ${a}s`,elapsedSeconds:a})},1e3):void 0;try{c=await G(a)}finally{h&&clearInterval(h)}if(!c.ok||!c.body)throw Error(`Media download failed (${c.status}).`);let i=b.maxBytes??524288e3,m=Number(c.headers.get("content-length"));if(m>i)throw Error(`Media exceeds download limit of ${i} bytes.`);let n=(j().basename(new URL(c.url).pathname)||"download").replace(/[^a-zA-Z0-9._-]/g,"_").slice(0,180)||"download",o=c.headers.get("content-type")?.split(";")[0],p="unknown"===J(o)?K(j().extname(n).slice(1)):o,q=j().join(b.outputDir,`${(0,e.randomUUID)()}-${n}`),r=0,s=0,t=Number.isFinite(m)&&m>0,u=l.Readable.fromWeb(c.body);u.on("data",a=>{(r+=a.length)>i&&u.destroy(Error(`Media exceeds download limit of ${i} bytes.`));let c=Date.now(),d=t&&r>=m;if(!b.onProgress||c-s<500&&!d)return;s=c;let e=Math.max(0,Math.floor((c-f)/1e3)),g=r/Math.max(1,(c-f)/1e3),h=t?Math.max(0,Math.round((m-r)/Math.max(1,g))):void 0;b.onProgress({...t?{percent:Math.min(99,r/m*100),total:m}:{},current:r,unit:"bytes",elapsedSeconds:e,estimatedRemainingSeconds:h,message:`Downloading media \xb7 ${E(r)}${t?` / ${E(m)}`:""} \xb7 ${E(g)}/s`})});try{await (0,k.pipeline)(u,(0,g.createWriteStream)(q,{flags:"wx"}))}catch(a){throw await g.promises.rm(q,{force:!0}),a}return[{path:q,originalUrl:a,title:n,mimeType:p,mediaType:J(p)}]}async function x(a,b){let c=j().resolve(b),d=j().resolve(a);if(!y(d,c))throw Error("Video downloader returned a file outside its import directory.");try{if((await g.promises.stat(d)).isFile())return d}catch(a){if(!(a instanceof Error&&"code"in a&&"ENOENT"===a.code))throw a}let e=j().basename(a).match(/\[([\w-]+)\](?:\.[^.]+)?$/)?.[1],f=(await g.promises.readdir(c,{withFileTypes:!0})).filter(a=>a.isFile()&&!!K(j().extname(a.name).slice(1))).map(a=>j().join(c,a.name)).filter(a=>y(a,c));if(!f.length)throw Error("Video download completed but did not produce a readable media file.");let h=j().extname(a).toLowerCase();return f.sort((a,b)=>z(b,e,h)-z(a,e,h))[0]}function y(a,b){let c=j().relative(b,a);return""!==c&&!c.startsWith(`..${j().sep}`)&&".."!==c&&!j().isAbsolute(c)}function z(a,b,c){let d=j().basename(a),e=j().extname(d).toLowerCase(),f=K(e.slice(1));return(b&&d.includes(`[${b}]`)?100:0)+20*!!f?.startsWith("video/")+10*(e===c)}async function A(a,b){let c=process.env.LARKUP_YTDLP_PATH?.trim()||j().join(process.cwd(),".larkup","tools","bin","win32"===process.platform?"yt-dlp.exe":"yt-dlp"),d=Date.now();b?.({message:"Preparing the video downloader…",elapsedSeconds:0});let e=b?setInterval(()=>{let a=Math.floor((Date.now()-d)/1e3);b({message:`Preparing the video downloader \xb7 ${a}s`,elapsedSeconds:a})},1e3):void 0;try{await B(c)}finally{e&&clearInterval(e)}return b?.({message:"Connecting to the video source…",elapsedSeconds:0}),C(c,["--js-runtimes","nodejs:node",...a],b)}async function B(a){if(process.env.LARKUP_YTDLP_PATH?.trim())return;try{await g.promises.access(a);return}catch{}let b="darwin"===process.platform?"yt-dlp_macos":"win32"===process.platform?"yt-dlp.exe":"arm64"===process.arch?"yt-dlp_linux_aarch64":"yt-dlp_linux",c=`${a}.${(0,e.randomUUID)()}.download`;try{await g.promises.mkdir(j().dirname(a),{recursive:!0});let d=await fetch(`https://github.com/yt-dlp/yt-dlp/releases/latest/download/${b}`,{redirect:"follow",signal:AbortSignal.timeout(12e4)});if(!d.ok)throw Error(`download returned HTTP ${d.status}`);await g.promises.writeFile(c,Buffer.from(await d.arrayBuffer()),{mode:493}),"win32"!==process.platform&&await g.promises.chmod(c,493),await g.promises.rename(c,a)}catch(b){await g.promises.rm(c,{force:!0}).catch(()=>void 0);let a=b instanceof Error?b.message:String(b);throw Error(`Could not prepare the built-in YouTube downloader (${a}).`)}}function C(a,b,c){return new Promise((e,f)=>{let g,h=(0,d.spawn)(a,b,{shell:!1}),i="",k="",l="",m=Date.now(),n=setTimeout(()=>h.kill("SIGTERM"),12e4),o=c?setInterval(()=>{let a=Math.floor((Date.now()-m)/1e3);c({...g,elapsedSeconds:a,message:g?.percent?`${g.message} \xb7 active ${a}s`:`Connecting to the video source \xb7 ${a}s`})},1e3):void 0;h.stdout.on("data",a=>i+=String(a)),h.stderr.on("data",a=>{let b=String(a);k+=b;let d=(l+=b).split(/[\r\n]+/);for(let a of(l=d.pop()??"",d)){let b=D(a,Math.floor((Date.now()-m)/1e3));b&&(g=b,c?.(b))}}),h.on("error",a=>{clearTimeout(n),o&&clearInterval(o),f(a)}),h.on("close",b=>{clearTimeout(n),o&&clearInterval(o);let d=D(l,Math.floor((Date.now()-m)/1e3));d&&c?.(d),0===b?e(i.trim()):f(Error(`${j().basename(a)} failed (${b}): ${k.trim()}`))})})}function D(a,b=0){let c,d=a.match(/(\d+(?:\.\d+)?)%/);if(!d)return null;let e=Math.min(99,Math.max(0,Number(d[1])));if(!Number.isFinite(e))return null;let f=a.match(/\bof\s+~?\s*([\d.]+)\s*(KiB|MiB|GiB|KB|MB|GB)\b/i),g=f?function(a,b){if(!Number.isFinite(a)||a<0)return;let c={KiB:1,MiB:2,GiB:3,KB:1,MB:2,GB:3}[b];if(void 0===c)return;let d=b.endsWith("iB")?1024:1e3;return a*d**c}(Number(f[1]),f[2]):void 0,h=g?g*e/100:void 0,i=a.match(/\bat\s+([^\s]+\/s)\b/i)?.[1],j=a.match(/\bETA\s+(\d{1,2}:\d{2}(?::\d{2})?)\b/i)?.[1],k=j?function(a){let b=a.split(":").map(Number);if(!b.some(a=>!Number.isFinite(a))){if(2===b.length)return 60*b[0]+b[1];if(3===b.length)return 3600*b[0]+60*b[1]+b[2]}}(j):void 0;return{percent:e,...void 0!==h?{current:h}:{},...void 0!==g?{total:g,unit:"bytes"}:{},elapsedSeconds:b,estimatedRemainingSeconds:k,message:[`Downloading video \xb7 ${Number.isInteger(c=Math.round(10*e)/10)?String(c):c.toFixed(1)}%`,i,j?`${j} left`:void 0].filter(Boolean).join(" \xb7 ")}}function E(a){return!Number.isFinite(a)||a<1024?`${Math.max(0,Math.round(a))} B`:a<1048576?`${(a/1024).toFixed(1)} KiB`:a<0x40000000?`${(a/1048576).toFixed(1)} MiB`:`${(a/0x40000000).toFixed(2)} GiB`}function F(a){let b=new URL(a);if("http:"!==b.protocol&&"https:"!==b.protocol)throw Error("Only http(s) media URLs are supported.");return b}async function G(a,b={}){let c=F(a);for(let a=0;a<=5;a++){await H(c.hostname);let a=await fetch(c,{...b,redirect:"manual"});if(![301,302,303,307,308].includes(a.status))return a;let d=a.headers.get("location");if(!d)throw Error("Media URL redirected without a location.");c=F(new URL(d,c).toString())}throw Error("Media URL redirected too many times.")}async function H(a){let b=(0,h.isIP)(a)?[{address:a}]:await (0,f.lookup)(a,{all:!0,verbatim:!0});if(!b.length||b.some(({address:a})=>(function(a){let b=a.toLowerCase();if("::1"===b||"::"===b||b.startsWith("fe80:")||b.startsWith("fc")||b.startsWith("fd"))return!0;let c=(b.startsWith("::ffff:")?b.slice(7):b).split(".").map(Number);if(4!==c.length||c.some(Number.isNaN))return!1;let[d,e]=c;return 0===d||10===d||127===d||169===d&&254===e||172===d&&e>=16&&e<=31||192===d&&168===e||d>=224})(a)))throw Error("Private or local media URLs are not supported.")}function I(a){return/(^|\.)youtube\.com$|(^|\.)youtu\.be$/.test(a.hostname)}function J(a){return a?.startsWith("video/")?"video":a?.startsWith("audio/")?"audio":"unknown"}function K(a){return({mp4:"video/mp4",webm:"video/webm",mkv:"video/x-matroska",mov:"video/quicktime",mp3:"audio/mpeg",m4a:"audio/mp4",wav:"audio/wav",ogg:"audio/ogg",flac:"audio/flac"})[a.toLowerCase()]}}};