const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ApplicationStarterHotkeys.client-3balDwuU.js","assets/event-client-CV4ssJpW.js","assets/icons-xTj2hkG8.js","assets/rolldown-runtime-9r-HBx0o.js","assets/useHotkey-Fg-Vz-CZ.js","assets/store-Cj3QexLS.js","assets/DeployDialog-Cq7n1Wt1.js","assets/index-B9NJHisQ.js","assets/tanstack-router-U0H7bmeq.js","assets/tanstack-query-BttgOCQn.js","assets/shared-constants-yNCBtlN_.js","assets/index-Drgb1pa5.css","assets/shared-DL3H0Hsz.js","assets/client-generation-RcaKuoDI.js","assets/Icons-q42Z9Dpx.js"])))=>i.map(i=>d[i]); import{Ai as B,F as mr,Ii as Rt,Kn as Gr,Oi as z,Si as b,Tr as It,Wr as qt,ci as Ft,er as _t,fi as me,ji as S,n as Vr,pi as hr,st as Nt,tn as Re,wi as $,wr as Zr}from"./icons-xTj2hkG8.js";import{C as Wr}from"./tanstack-router-U0H7bmeq.js";import{d as a,f as m}from"./tanstack-query-BttgOCQn.js";import{t as Yr}from"./Icons-q42Z9Dpx.js";import{$n as Kr,Ba as Xr,Ga as Jr,Ha as Qr,Ia as gr,Ka as ea,Qn as Lt,Ua as ta,Va as br,Wa as ra,Xn as aa,Yn as na,Zn as At,ao as oa,ar as ia,co as fr,do as re,er as sa,ga as la,hi as ca,ii as $e,io as yr,ir as Ut,jo as T,lo as Ie,mi as ct,no as da,nr as ua,oi as pa,oo as ma,pi as dt,qa as vr,ro as ha,rr as xr,sr as ga,tr as kr,yo as ba}from"./index-B9NJHisQ.js";import{t as fa}from"./usePartnerPlacementContext-COo3TXOB.js";import{t as Gt}from"./useDebouncedValue-CV-ebLIG.js";var ya=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),va="VisuallyHidden",wr=me((e,t)=>a(yr.span,{...e,ref:t,style:{...ya,...e.style}}));wr.displayName=va;var xa=wr,[pt,ro]=ma("Tooltip",[vr]),mt=vr(),Sr="TooltipProvider",ka=700,Dt="tooltip.open",[wa,jt]=pt(Sr),Cr=e=>{const{__scopeTooltip:t,delayDuration:r=ka,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:l}=e,d=B(!0),h=B(!1),c=B(0);return $(()=>{const f=c.current;return()=>window.clearTimeout(f)},[]),a(wa,{scope:t,isOpenDelayedRef:d,delayDuration:r,onOpen:b(()=>{window.clearTimeout(c.current),d.current=!1},[]),onClose:b(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>d.current=!0,n)},[n]),isPointerInTransitRef:h,onPointerInTransitChange:b(f=>{h.current=f},[]),disableHoverableContent:i,children:l})};Cr.displayName=Sr;var He="Tooltip",[Sa,qe]=pt(He),Nr=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:i,onOpenChange:l,disableHoverableContent:d,delayDuration:h}=e,c=jt(He,e.__scopeTooltip),f=mt(t),[p,u]=S(null),y=da(),k=B(0),w=d??c.disableHoverableContent,x=h??c.delayDuration,N=B(!1),[E,R]=Xr({prop:n,defaultProp:i??!1,onChange:le=>{le?(c.onOpen(),document.dispatchEvent(new CustomEvent(Dt))):c.onClose(),l?.(le)},caller:He}),Z=z(()=>E?N.current?"delayed-open":"instant-open":"closed",[E]),H=b(()=>{window.clearTimeout(k.current),k.current=0,N.current=!1,R(!0)},[R]),J=b(()=>{window.clearTimeout(k.current),k.current=0,R(!1)},[R]),se=b(()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>{N.current=!0,R(!0),k.current=0},x)},[x,R]);return $(()=>()=>{k.current&&(window.clearTimeout(k.current),k.current=0)},[]),a(ea,{...f,children:a(Sa,{scope:t,contentId:y,open:E,stateAttribute:Z,trigger:p,onTriggerChange:u,onTriggerEnter:b(()=>{c.isOpenDelayedRef.current?se():H()},[c.isOpenDelayedRef,se,H]),onTriggerLeave:b(()=>{w?J():(window.clearTimeout(k.current),k.current=0)},[J,w]),onOpen:H,onClose:J,disableHoverableContent:w,children:r})})};Nr.displayName=He;var Mt="TooltipTrigger",Pr=me((e,t)=>{const{__scopeTooltip:r,...n}=e,i=qe(Mt,r),l=jt(Mt,r),d=mt(r),h=fr(t,B(null),i.onTriggerChange),c=B(!1),f=B(!1),p=b(()=>c.current=!1,[]);return $(()=>()=>document.removeEventListener("pointerup",p),[p]),a(ta,{asChild:!0,...d,children:a(yr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:h,onPointerMove:Ie(e.onPointerMove,u=>{u.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ie(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Ie(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Ie(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ie(e.onBlur,i.onClose),onClick:Ie(e.onClick,i.onClose)})})});Pr.displayName=Mt;var zt="TooltipPortal",[Ca,Na]=pt(zt,{forceMount:void 0}),Tr=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:i}=e,l=qe(zt,t);return a(Ca,{scope:t,forceMount:r,children:a(br,{present:r||l.open,children:a(Qr,{asChild:!0,container:i,children:n})})})};Tr.displayName=zt;var Le="TooltipContent",Rr=me((e,t)=>{const r=Na(Le,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...l}=e,d=qe(Le,e.__scopeTooltip);return a(br,{present:n||d.open,children:d.disableHoverableContent?a(Ir,{side:i,...l,ref:t}):a(Pa,{side:i,...l,ref:t})})}),Pa=me((e,t)=>{const r=qe(Le,e.__scopeTooltip),n=jt(Le,e.__scopeTooltip),i=B(null),l=fr(t,i),[d,h]=S(null),{trigger:c,onClose:f}=r,p=i.current,{onPointerInTransitChange:u}=n,y=b(()=>{h(null),u(!1)},[u]),k=b((w,x)=>{const N=w.currentTarget,E={x:w.clientX,y:w.clientY},R=Aa(E,La(E,N.getBoundingClientRect())),Z=Da(x.getBoundingClientRect());h(Oa([...R,...Z])),u(!0)},[u]);return $(()=>()=>y(),[y]),$(()=>{if(c&&p){const w=N=>k(N,p),x=N=>k(N,c);return c.addEventListener("pointerleave",w),p.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",w),p.removeEventListener("pointerleave",x)}}},[c,p,k,y]),$(()=>{if(d){const w=x=>{const N=x.target,E={x:x.clientX,y:x.clientY},R=c?.contains(N)||p?.contains(N),Z=!Ma(E,d);R?y():Z&&(y(),f())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[c,p,d,f,y]),a(Ir,{...e,ref:l})}),[Ta,Ra]=pt(He,{isInside:!1}),Ia=oa("TooltipContent"),Ir=me((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:l,onPointerDownOutside:d,...h}=e,c=qe(Le,r),f=mt(r),{onClose:p}=c;return $(()=>(document.addEventListener(Dt,p),()=>document.removeEventListener(Dt,p)),[p]),$(()=>{if(c.trigger){const u=y=>{y.target?.contains(c.trigger)&&p()};return window.addEventListener("scroll",u,{capture:!0}),()=>window.removeEventListener("scroll",u,{capture:!0})}},[c.trigger,p]),a(ha,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:u=>u.preventDefault(),onDismiss:p,children:m(Jr,{"data-state":c.stateAttribute,...f,...h,ref:t,style:{...h.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a(Ia,{children:n}),a(Ta,{scope:r,isInside:!0,children:a(xa,{id:c.contentId,role:"tooltip",children:i||n})})]})})});Rr.displayName=Le;var _r="TooltipArrow",_a=me((e,t)=>{const{__scopeTooltip:r,...n}=e,i=mt(r);return Ra(_r,r).isInside?null:a(ra,{...i,...n,ref:t})});_a.displayName=_r;function La(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(r,n,i,l)){case l:return"left";case i:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Aa(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function Da(e){const{top:t,right:r,bottom:n,left:i}=e;return[{x:i,y:t},{x:r,y:t},{x:r,y:n},{x:i,y:n}]}function Ma(e,t){const{x:r,y:n}=e;let i=!1;for(let l=0,d=t.length-1;ln!=y>n&&r<(u-f)*(n-p)/(y-p)+f&&(i=!i)}return i}function Oa(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),Ea(t)}function Ea(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const l=t[t.length-1],d=t[t.length-2];if((l.x-d.x)*(i.y-d.y)>=(l.y-d.y)*(i.x-d.x))t.pop();else break}t.push(i)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const i=e[n];for(;r.length>=2;){const l=r[r.length-1],d=r[r.length-2];if((l.x-d.x)*(i.y-d.y)>=(l.y-d.y)*(i.x-d.x))r.pop();else break}r.push(i)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var Ua=Cr,ja=Nr,za=Pr,Ba=Tr,$a=Rr,Vt="npx @tanstack/intent@latest install",Zt="npx @tanstack/intent@latest list",Wt="Use the installed TanStack Intent skills and package-shipped guidance before making architectural or library-specific changes. Do not guess when a shipped skill can tell you the current pattern.",ao="Update the repo agent config files that TanStack Intent targets (for example CLAUDE.md, .cursorrules, or equivalent) if needed. In AGENTS.md or the project equivalent, keep durable project context, the exact CLI command used, chosen stack and integrations, environment variable requirements, deployment notes, key architectural decisions, known gotchas, and next steps.";function Yt(){return"Keep durable project context in AGENTS.md (or equivalent), including the exact TanStack CLI command used, any follow-up TanStack Intent commands, the chosen stack and integrations, environment variable requirements, deployment notes, key architectural decisions, known gotchas, and next steps."}function Kt(){return["If the execution environment starts from an existing platform template or custom starter instead of the TanStack CLI output, still run the TanStack CLI command in a separate scratch directory.","Then merge the generated integrations, dependencies, config, scripts, and relevant file structure into the actual project instead of skipping the TanStack CLI result.","Do not drop requested partner integrations or stack choices just because the host platform bootstraps its own template. Represent them in the final project somehow, or explicitly call out what could not be represented and why."]}var Ha=[/(?:^|[\s,;])((?:do not|don't|avoid|without|never)\s+[^.;\n]+)/gi,/(?:^|[\s,;])((?`- ${r}`)]}var Ga=/(?:^|\n)Legacy repository URL:\s*(https?:\/\/\S+|git@\S+|ssh:\/\/\S+)/i;function Lr(e){return e.match(Ga)?.[1]?.trim()}function Va(e){const t=Lr(e);return t?[`Legacy repository URL: ${t}`,"After scaffolding, clone the legacy project into ./legacy-source and treat it as reference material only.","Do not copy the legacy .git directory into the new app or overwrite the fresh scaffold with the old repo.","Migrate the existing app incrementally from ./legacy-source into the new TanStack app, route by route and feature by feature."]:[]}function Za(e){return e.replace(/[\s\S]*?<\/system-reminder>/gi,"").replace(/<[^>]+>[\s\S]*?<\/[^>]+>/g,"").replace(/^\s*(Context|User request|Resolved starter plan|Resolved CLI command|Resolved summary):.*$/gim,"").replace(/^\s*[-*]\s*(target|framework|template|package manager|add-ons|deployment|toolchain):.*$/gim,"").replace(/\n{3,}/g,` `).trim()}var Bt="my-tanstack-app",Jt=[{label:"Blank starter",input:"Create a blank TanStack Start app with no extra integrations or feature scaffolding."},{label:"Migrate from Next.js",input:"Migrate an existing Next.js app to TanStack Start. Preserve the current UX, auth integration, routing structure, and data fetching behavior. Start by scaffolding a fresh TanStack Start app, then migrate the existing app incrementally route by route and feature by feature."},{label:"Build a blog",input:"Build a blog or content site with a CMS, great routing, and a clean editorial reading experience."},{label:"SaaS dashboard",input:"Build a SaaS dashboard app with auth, billing-ready structure, Postgres, nested routes, data tables, filters, forms, monitoring, and charts-ready data fetching."},{label:"Build a shop",input:"Build a Shopify-backed storefront with product catalog, shopping cart, customer accounts, and checkout."}];function Ar(e){const t=new Set;return[...e.features,e.deployment,e.toolchain].filter(r=>!r||t.has(r)?!1:(t.add(r),!0))}var Wa={home:Jt,start:[{label:"Blank starter",input:"Create a blank TanStack Start app with no extra integrations or feature scaffolding."},{label:"Full-stack app",input:"Build a full-stack TanStack Start app with auth, database access, forms, and monitoring."},{label:"Auth + database",input:"Build a product app with authentication, Postgres, forms, and Sentry. Use pnpm."},{label:"Migrate from Next.js",input:"Migrate an existing Next.js app to TanStack Start. Preserve the current UX, auth integration, routing structure, and data fetching behavior. Start by scaffolding a fresh TanStack Start app, then migrate the existing app incrementally route by route and feature by feature."},{label:"Build a blog",input:"Build a content-driven TanStack Start app for a blog or CMS-backed publishing workflow."}],router:[{label:"Blank starter",input:"Create a blank TanStack Router app with no extra integrations or feature scaffolding."},{label:"Route-heavy app",input:"Build a route-heavy application with nested layouts, search params, data loaders, and protected routes."},{label:"Dashboard routes",input:"Build a dashboard with nested routes, auth, tables, query-driven loaders, and forms."},{label:"Router-only mode",input:"Build a router-only React SPA with file-based routing, search params, and TanStack Query, no TanStack Start SSR."},{label:"Build a blog",input:"Build a content-focused app with strong routing, nested layouts, and a clean blog-style reading flow."}],builder:Jt},Ya={migration:[/\bmigrat(?:e|ing|ion)\b/i,/\bport\b/i,/\bconvert\b/i,/\bexisting app\b/i,/\bmove (?:it|this|everything|things) over\b/i,/\bfrom next(?:\.js)?\b/i,/\bfrom remix\b/i,/\bfrom react router\b/i,/\bfrom vite\b/i,/\bfrom cra\b/i],saas:[/\bsaas\b/i,/\bb2b\b/i,/\bmulti[- ]tenant\b/i,/\bteam accounts?\b/i,/\bbilling\b/i,/\bsubscriptions?\b/i],dashboard:[/\bdashboard\b/i,/\badmin\b/i,/\bbackoffice\b/i,/\bpanel\b/i,/\bmetrics\b/i,/\banalytics\b/i],content:[/\bblog\b/i,/\bcms\b/i,/\bcontent\b/i,/\bmarketing site\b/i,/\bdocs?\b/i,/\bknowledge base\b/i],api:[/\bapi\b/i,/\bapi keys?\b/i,/\bbackend\b/i,/\bdeveloper platform\b/i,/\btrpc\b/i,/\borpc\b/i,/\bgraphql\b/i,/\brate limit(?:ing)?\b/i,/\brpc\b/i],ai:[/\bai\b/i,/\bllm\b/i,/\bchat\b/i,/\bagent\b/i,/\brag\b/i,/\bprompt\b/i],realtime:[/\brealtime\b/i,/\bcollaborat(?:e|ive|ion)\b/i,/\blive updates?\b/i,/\bsync\b/i,/\bmultiplayer\b/i,/\bpresence\b/i],ecommerce:[/\bshopify\b/i,/\bstorefront\b/i,/\be[- ]?commerce\b/i,/\bonline store\b/i,/\bproduct catalog\b/i,/\bsell(?:ing)? products?\b/i,/\bcheckout\b/i,/\bshopping cart\b/i,/\bmerch(?:andise)?\b/i]},Ka=[/\bcustomer accounts?\b/i,/\bcustomer login\b/i,/\border history\b/i,/\bsign[- ]?in\b/i,/\blogin\b/i,/\baddresses\b/i],Xa=["astro","cra","next.js","next","react router","remix","vite"];function Ja(e){return Wa[e]}async function Qa({context:e,input:t}){const r=tn(Ut(t)),n=xr(t),i=kr(t),l=rn(r),d=an(r,l,e,{inferredPartnerIds:i,selectedPartnerIds:n}),h=bn(l);return en({input:t,rationale:yn(r,l,d),recipe:d,resultType:h})}function en({input:e,prompt:t,rationale:r,recipe:n,resultType:i}){return{advancedBuilderUrl:n.target==="start"?kn(n):void 0,cliCommand:Mr(n),downloadUrl:n.target==="start"?Pn(n):void 0,headline:i==="migration"?"Your migration prompt is ready":"Your prompt is ready",prompt:Za(t||vn({input:e,resultType:i,recipe:n})),rationale:r,recipe:n,resultType:i,summary:fn(i,n)}}function tn(e){return e.replace(/\s+/g," ").trim()}function rn(e){const t=new Map;for(const[n,i]of Object.entries(Ya)){let l=0;for(const d of i)d.test(e)&&(l+=1);t.set(n,l)}if((t.get("migration")??0)>0)return"migration";const r=Array.from(t.entries()).filter(([n])=>n!=="migration").sort((n,i)=>i[1]-n[1]);return!r[0]||r[0][1]===0?"fallback":r[0][0]}function an(e,t,r,n){const i=xn(e),l=pn(e),d=un(e),h=dn(e),c=hn(e),f=!/(?:\bwithout tailwind\b|\bno tailwind\b|\btailwind-heavy styling\b)/i.test(e),p=r!=="builder"&&mn(e)&&!/\bssr\b/i.test(e)&&!/\bserver functions?\b/i.test(e),u={deployment:h,featureOptions:{},features:[],framework:d,packageManager:l,projectName:gn(e),routerOnly:p,tailwind:f,target:p?"router":"start",toolchain:c};switch(t){case"migration":u.target=p?"router":"start",u.template="saas",C(u,"better-auth","neon","drizzle","sentry");break;case"saas":u.template="saas",C(u,"better-auth","neon","drizzle","form","sentry","shadcn","tanstack-query");break;case"dashboard":u.template="dashboard",C(u,"form","shadcn","table","tanstack-query");break;case"content":u.template="blog",C(u,"strapi","tanstack-query");break;case"api":u.template="api-first",C(u,"tanstack-query","tRPC");break;case"ai":u.template="ai-chat",C(u,"ai","shadcn","store");break;case"realtime":u.template="realtime",C(u,"convex","tanstack-query");break;case"ecommerce":u.template="shopify-storefront",Ka.some(w=>w.test(e))&&(u.featureOptions.shopify={customerAccount:"enabled"});break;case"fallback":u.template=i?"blank":r==="router"?"dashboard":"blank",i||C(u,"tanstack-query");break}const y=At(n.selectedPartnerIds),k=At(n.inferredPartnerIds.filter(w=>!ga(w,y)));return nn(u,{partnerIds:[...y,...k]}),ln(e,u),cn(u),u}function C(e,...t){e.features.push(...t)}function nn(e,t){const r=new Set(t.partnerIds);r.has("cloudflare")?e.deployment="cloudflare":r.has("netlify")?e.deployment="netlify":r.has("railway")&&(e.deployment="railway"),r.has("workos")?j(e,["better-auth","clerk","workos"],"workos"):r.has("clerk")&&j(e,["better-auth","clerk","workos"],"clerk"),r.has("strapi")&&C(e,"strapi"),r.has("sentry")&&C(e,"sentry"),r.has("neon")&&(j(e,["convex"],"neon"),r.has("prisma")||j(e,["drizzle","prisma"],"drizzle")),r.has("prisma")&&(j(e,["convex","drizzle","prisma"],"prisma"),C(e,"neon"))}function on(e){return/\b(do not use|don't use|avoid|without)\s+(?:a\s+)?hosted database\b/i.test(e)}function sn(e){return/\bavoid\s+adding\s+auth\s+and\s+api\s+key\s+providers?\s+that\s+overlap\s+in\s+purpose\b/i.test(e)}function Qt(e,t){return new RegExp(`\\b(?:do not use|don't use|avoid|without|no)\\s+(?:the\\s+)?${t}\\b`,"i").test(e)}function ln(e,t){Qt(e,"clerk")?t.features=t.features.filter(r=>r!=="clerk"):/\bclerk\b/i.test(e)?j(t,["better-auth","clerk","workos"],"clerk"):/\b(sso|saml|scim|directory sync|enterprise auth|enterprise identity|b2b auth)\b/i.test(e)?j(t,["better-auth","clerk","workos"],"workos"):/\bworkos\b/i.test(e)?j(t,["better-auth","clerk","workos"],"workos"):!sn(e)&&/\b(authentication|auth|login|sign ?in|sign ?up|oauth|sessions?)\b/i.test(e)&&j(t,["better-auth","clerk","workos"],"better-auth"),on(e)?t.features=t.features.filter(r=>r!=="convex"&&r!=="neon"):/\bconvex\b/i.test(e)?j(t,["convex","drizzle","neon","prisma"],"convex"):/\bprisma\b/i.test(e)?(j(t,["convex","drizzle","prisma"],"prisma"),C(t,"neon")):/\bdrizzle\b/i.test(e)?(j(t,["convex","drizzle","prisma"],"drizzle"),C(t,"neon")):/\bpostgres\b|\bpostgre?s\b|\bdatabase\b|\bdb\b|\bneon\b/i.test(e)&&(j(t,["convex"],"neon"),j(t,["drizzle","prisma"],"drizzle")),/\bquery\b|\bloaders?\b|\bdata fetching\b/i.test(e)&&C(t,"tanstack-query"),/\btable\b|\bdatagrid\b|\bgrid\b/i.test(e)&&C(t,"table"),/\bform\b|\bforms\b/i.test(e)&&C(t,"form"),/\bposthog\b|\banalytics\b/i.test(e)&&C(t,"posthog"),/\bsentry\b|\bmonitoring\b|\berrors?\b/i.test(e)&&C(t,"sentry"),/\bi18n\b|\binternational\b|\blocali[sz]ation\b/i.test(e)&&C(t,"paraglide"),Qt(e,"shadcn")?t.features=t.features.filter(r=>r!=="shadcn"):/\bshadcn\b|\bui\b|\bdesign system\b/i.test(e)&&C(t,"shadcn"),/\btrpc\b/i.test(e)&&C(t,"tRPC","tanstack-query"),/\borpc\b/i.test(e)&&(t.features=t.features.filter(r=>r!=="tRPC"),C(t,"oRPC","tanstack-query")),/\bapollo\b|\bgraphql\b/i.test(e)&&(t.features=t.features.filter(r=>r!=="tRPC"&&r!=="oRPC"),C(t,"apollo-client")),/\bai\b|\bllm\b|\bchat\b|\bagent\b/i.test(e)&&C(t,"ai","store"),/\brealtime\b|\bcollaborat(?:e|ive|ion)\b|\blive\b/i.test(e)&&(t.features=t.features.filter(r=>r!=="neon"&&r!=="drizzle"&&r!=="prisma"),C(t,"convex","tanstack-query"))}function j(e,t,r){e.features=e.features.filter(n=>!t.includes(n)),e.features.push(r)}function cn(e){const t=new Set,r=Array();for(const n of e.features)n===e.deployment||n===e.toolchain||t.has(n)||(t.add(n),r.push(n));e.features=r,e.routerOnly&&(e.template=void 0)}function dn(e){if(/\bcloudflare\b|\bworkers\b/i.test(e))return"cloudflare";if(/\bnetlify\b/i.test(e))return"netlify";if(/\brailway\b/i.test(e))return"railway";if(/\bnitro\b/i.test(e))return"nitro"}function un(e){return/\bsolid\b/i.test(e)?"solid":"react"}function pn(e){return/\bbun\b/i.test(e)?"bun":/\byarn\b/i.test(e)?"yarn":/\bnpm\b/i.test(e)?"npm":"pnpm"}function mn(e){return Kr(e)||/\brouter-only\b|\brouter only\b|\bspa\b|\bsingle page app\b|\bclient-side only\b|\bjust tanstack router\b/i.test(e)}function hn(e){if(/\bbiome\b/i.test(e))return"biome";if(/\beslint\b/i.test(e))return"eslint"}function gn(e){const t=e.match(/(?:called|named|name it|project name is)\s+["']?([a-z0-9-]{2,})["']?/i);if(t?.[1])return t[1].toLowerCase()}function bn(e){return e==="migration"?"migration":e==="fallback"?"fallback":"scaffoldable"}function fn(e,t){const r=Array();return r.push(t.target==="router"?"Router-only starter":"TanStack Start starter"),e==="migration"&&r.push("migration-first prompt"),r.push(t.framework==="solid"?"Solid":"React"),t.features.length>0&&r.push(t.features.slice(0,4).join(", ")),t.deployment&&r.push(`deploy to ${t.deployment}`),r.join(" • ")}function yn(e,t,r){const n=Array();switch(t){case"migration":{const i=Dr(e);n.push(i?`Detected migration from ${i}`:"Detected migration workflow"),n.push("Scaffold a fresh target app first, then move behavior over");break}case"saas":n.push("Detected a product app with auth, data, and production concerns");break;case"dashboard":n.push("Detected a route-heavy UI with tables, loaders, and forms");break;case"content":n.push("Detected a content-oriented app or CMS-backed site");break;case"api":n.push("Detected an API-first or RPC-heavy application");break;case"ai":n.push("Detected an AI-assisted or chat-driven application");break;case"realtime":n.push("Detected live updates or collaborative product requirements");break;case"fallback":n.push("Kept the result deliberately conservative because the request was broad");break}return r.routerOnly?n.push("Using router-only mode because the request explicitly avoided TanStack Start SSR"):n.push("Defaulting to TanStack Start as the application-level starting point"),r.deployment&&n.push(`Matched deployment target: ${r.deployment}`),n}function vn({input:e,resultType:t,recipe:r}){const n=Ut(e),i=sa(e),l=Mr(r),d=r.features.length?r.features.join(", "):"no extra add-ons",h=r.routerOnly?"TanStack Router router-only application":"TanStack Start application",c=r.framework==="solid"?"Solid":"React",f=[`Use ${c}`,r.template?`the ${r.template} starter`:null,r.features.length>0?`with ${d}`:null,r.deployment?`targeting ${r.deployment}`:null].filter(Boolean).join(", ");if(t==="migration"){const p=Dr(n)??"the existing app",u=Va(e);return[`Migrate ${p} into a fresh ${h}.`,"","Do not incrementally mutate the old app in place.","Start by scaffolding a fresh project with the TanStack CLI.",`Use this command: ${l}`,...Kt(),"",`After scaffolding, run ${Vt} and ${Zt}.`,Wt,Yt(),...i,...Xt(e),...u,"","Migration strategy:","1. Inventory routes, layouts, auth, data loading, forms, and environment variables in the existing app.","2. Recreate the destination structure in the fresh TanStack project first.","3. Port one vertical slice at a time.","4. Preserve behavior and UX, not framework-specific implementation details.","5. Stop and call out anything that cannot be migrated 1:1 before forcing a rewrite.","",`Stack: ${f||`Use ${c}`}.`,`Original user brief: ${n}`].join(` `)}return[n,"",...i,"","Start by scaffolding the project with the TanStack CLI.",`Use this command: ${l}`,...Kt(),"",`After scaffolding, run ${Vt} and ${Zt}.`,Wt,Yt(),...Xt(e),"",`Stack: ${f||`Use ${c}`}.`,r.toolchain?`Toolchain: ${r.toolchain}.`:"Toolchain: keep the default CLI toolchain.","Preserve the generated project structure unless there is a clear reason to change it.","Explain any environment variables and follow-up setup steps after scaffolding."].join(` `)}function Dr(e){for(const t of Xa)if(e.toLowerCase().includes(t))return t}function xn(e){return/\bblank\b|\bminimal\b|\bminimum\b|\bbarebones\b|\bfrom scratch\b|\bempty\b/i.test(e)}function kn(e){const t=new URLSearchParams,r=Ar(e);return t.set("name",e.projectName||Bt),e.framework!=="react"&&t.set("framework",e.framework),e.tailwind||t.set("tailwind","false"),e.packageManager!=="pnpm"&&t.set("pm",e.packageManager),e.template&&t.set("template",e.template),r.length>0&&t.set("features",r.join(",")),`/builder?${t.toString()}`}var wn=new Set(["shopify-storefront"]);function Sn(e){return e!==void 0&&wn.has(e)}function Cn(e){return`'${e.replace(/'/g,"'\\''")}'`}function Nn(e){const t=Object.entries(e).filter(([,r])=>r&&Object.keys(r).length>0);return t.length===0?null:Cn(JSON.stringify(Object.fromEntries(t)))}function Mr(e){const t=["npx","@tanstack/cli@latest","create"];t.push(e.projectName||Bt),t.push("--agent"),e.framework==="solid"&&t.push("--framework","Solid"),e.routerOnly&&t.push("--router-only"),t.push("--package-manager",e.packageManager),t.push(e.tailwind?"--tailwind":"--no-tailwind"),e.deployment&&t.push("--deployment",e.deployment),e.toolchain&&t.push("--toolchain",e.toolchain),Sn(e.template)&&t.push("--template",e.template),e.features.length>0&&t.push("--add-ons",e.features.join(","));const r=Nn(e.featureOptions);return r&&t.push("--add-on-config",r),t.join(" ")}function Pn(e){const t=new URLSearchParams,r=Ar(e);return t.set("name",e.projectName||Bt),t.set("framework",e.framework),t.set("pm",e.packageManager),e.tailwind||t.set("tailwind","false"),r.length>0&&t.set("features",r.join(",")),`/api/builder/download?${t.toString()}`}var Tn=/migrat(?:e|ing|ion).*(next(?:\.js)?)|(next(?:\.js)?).*(migrat(?:e|ing|ion))/i,Rn=/^(https?:\/\/\S+|git@\S+|ssh:\/\/\S+)$/i,ht=["start","router","intent","cli"],Or=["query","table","form","store","db","ai","hotkeys","pacer","virtual"],In=[...ht,...Or],Ot=In.flatMap(e=>{const t=ba.find(r=>r.id===e);return t?[{description:t.description,id:t.id,label:t.name.replace(/^TanStack\s+/,""),locked:ht.some(r=>r===t.id),tagline:t.tagline,textStyle:t.textStyle}]:[]}),_n={cyan:{button:"cyan",chip:"border-gray-200 bg-white text-gray-600 hover:border-cyan-200 hover:text-cyan-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-300 dark:hover:border-cyan-900 dark:hover:text-cyan-200",chipSelected:"border-cyan-300 bg-cyan-50 text-cyan-700 dark:border-cyan-800 dark:bg-cyan-950/40 dark:text-cyan-200",ring:"focus:ring-cyan-500"},emerald:{button:"emerald",chip:"border-gray-200 bg-white text-gray-600 hover:border-emerald-200 hover:text-emerald-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-300 dark:hover:border-emerald-900 dark:hover:text-emerald-200",chipSelected:"border-emerald-300 bg-emerald-50 text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/40 dark:text-emerald-200",ring:"focus:ring-emerald-500"},violet:{button:"purple",chip:"border-gray-200 bg-white text-gray-600 hover:border-violet-200 hover:text-violet-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-300 dark:hover:border-violet-900 dark:hover:text-violet-200",chipSelected:"border-violet-300 bg-violet-50 text-violet-700 dark:border-violet-800 dark:bg-violet-950/40 dark:text-violet-200",ring:"focus:ring-violet-500"}},Pt=["Charting the route...","Smoothing the shoreline...","Scanning the horizon...","Catching a better breeze...","Hoisting a fresh draft...","Finding calmer waters..."];function ut(e,t){switch(e){case"lovable":{const r=new URL("https://lovable.dev/");return r.searchParams.set("autosubmit","true"),r.searchParams.set("utm_source","tanstack"),r.hash=`prompt=${encodeURIComponent(t)}`,r.toString()}case"netlify":{const r=new URL("https://app.netlify.com/start");return r.searchParams.set("prompt",t),r.searchParams.set("utm_source","tanstack"),r.toString()}}}function Er(e){return ht.some(t=>t===e)}function Et(e){return Tn.test(e)}function Ur(e){return e.trim()}function Ln(e){return Rn.test(e)}function er({forceRouterOnly:e=!1,inferredPartners:t,input:r,migrationRepositoryUrl:n,packageManager:i,selectedLibraries:l,selectedPartners:d,toolchain:h}){const c=aa(r,d,t,{forceRouterOnly:e}),f=Ur(n),p=Ot.filter(y=>l.includes(y.id)),u=[c,p.filter(y=>!y.locked).length?`Include and demonstrate these TanStack libraries in the project: ${p.map(y=>`TanStack ${y.label}`).join(", ")}.`:"",i?`Use ${i} for package management.`:"",h?`Use ${h} as the project toolchain.`:""].filter(Boolean).join(` `);return!Et(r)||!f?u:[u,"",`Legacy repository URL: ${f}`,"After scaffolding the new app, clone the legacy project into ./legacy-source and migrate it incrementally into the fresh TanStack app."].filter(Boolean).join(` `)}function Tt(e,t){if(!e?.startsWith("#"))return;const r=e.length===4?e.slice(1).split("").map(n=>`${n}${n}`).join(""):e.slice(1);if(r.length===6)return`rgba(${Number.parseInt(r.slice(0,2),16)}, ${Number.parseInt(r.slice(2,4),16)}, ${Number.parseInt(r.slice(4,6),16)}, ${t})`}function _e({className:e,children:t,compact:r=!1,disabled:n=!1,onClick:i,palette:l,selected:d,size:h="default"}){return a("button",{type:"button","aria-pressed":d,disabled:n,onClick:i,className:T(r||h==="compact"?"rounded-lg border-2 px-2.5 py-1.5 text-[12px] font-medium transition-all duration-200":"rounded-lg border-2 px-3 py-1.5 text-[13px] font-medium transition-all duration-200",d?T(l.chipSelected,"translate-y-[-1px] opacity-100 shadow-[0_4px_12px_rgba(15,23,42,0.08)]"):l.chip,n&&"cursor-default opacity-70",e),children:t})}function tr({children:e}){return a(Ua,{delayDuration:1e3,skipDelayDuration:500,children:e})}function rr({compact:e=!1,selectedLibraries:t,toggleLibrary:r}){return a("div",{className:"flex flex-wrap gap-1.5",children:[...Ot.filter(n=>!n.locked),...Ot.filter(n=>n.locked)].map(n=>a(jr,{content:a(Mn,{library:n}),children:a(An,{compact:e,library:n,onClick:()=>{Er(n.id)||r(n.id)},selected:n.locked||t.includes(n.id)})},n.id))})}var An=me(function({compact:t=!1,library:r,selected:n,...i},l){const d=t?"inline-flex items-center rounded-md border-2 px-2 py-1 text-[10px] leading-none transition-all duration-200":"inline-flex items-center rounded-md border-2 px-2.5 py-1 text-[11px] leading-none transition-all duration-200",h=r.locked||n?"translate-y-[-1px] border-current bg-white shadow-[0_4px_12px_rgba(15,23,42,0.08)] dark:bg-gray-950":"border-gray-200 hover:border-current/45 dark:border-gray-800";return a("button",{...i,ref:l,type:"button","aria-disabled":r.locked||void 0,"aria-pressed":n,"aria-label":`TanStack ${r.label}`,className:T(d,r.textStyle,h,i.className),children:m("span",{className:"inline-flex items-center gap-1 leading-none font-black uppercase tracking-[-0.03em]",children:[r.locked?a(Dn,{className:"h-2.5 w-2.5 shrink-0 opacity-80"}):null,r.label]})})});function Dn({className:e}){return a("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:e,children:a("path",{d:"M5.5 6V4.75a2.5 2.5 0 1 1 5 0V6h.75A1.75 1.75 0 0 1 13 7.75v4.5A1.75 1.75 0 0 1 11.25 14h-6.5A1.75 1.75 0 0 1 3 12.25v-4.5A1.75 1.75 0 0 1 4.75 6h.75Zm1.25 0h2.5V4.75a1.25 1.25 0 1 0-2.5 0V6Z"})})}function Mn({library:e}){return m("div",{className:"w-[min(22rem,calc(100vw-1rem))] rounded-xl border border-gray-200 bg-white/95 px-3.5 py-3 text-left shadow-lg shadow-gray-950/10 dark:border-gray-800 dark:bg-gray-950/95",children:[m("div",{className:"flex items-center gap-2 text-[11px] font-medium uppercase tracking-[0.18em] text-gray-400 dark:text-gray-500",children:[a(mr,{className:"h-3.5 w-3.5"}),"TanStack ",e.label]}),a("div",{className:"mt-2 flex flex-wrap gap-1.5",children:a("span",{className:"rounded-full border border-gray-200 bg-gray-50 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.14em] text-gray-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300",children:e.locked?"Included":"Optional"})}),a("div",{className:"mt-2 text-sm leading-5 text-gray-600 dark:text-gray-300",children:e.description??e.tagline})]})}var On=me(function({compact:t=!1,muted:r,palette:n,partner:i,selected:l,size:d="default",...h},c){const f=i.brandColor??"#64748B",p=i.label,u=i.tags[0],y=i.tier===1,k=i.tier===2,w=i.tier===3,x=y||k,N=k,E=x?t?"rounded-xl text-[13px] font-semibold":"rounded-xl text-sm font-semibold":t||d==="compact"?"rounded-lg px-2.5 py-1.5 text-[12px] font-medium":"rounded-lg px-3 py-1.5 text-[13px] font-medium",R=y?"h-17 min-w-18":t?"h-11 min-w-16":"h-12 min-w-18",Z=y?"w-36":t||d==="compact"?"w-20":"w-22",H=k?"items-center":"items-start",J=k?"text-center self-center":"",se=y?l?"translate-y-[-1px] border-transparent":"border-gray-200 bg-white hover:border-[var(--starter-partner-hover-border-color)] active:border-[var(--starter-partner-active-border-color)] dark:border-gray-800 dark:bg-gray-950 dark:hover:border-[var(--starter-partner-hover-border-color)] dark:active:border-[var(--starter-partner-active-border-color)]":null,le=w?l?"translate-y-[-1px] border-current bg-white shadow-[0_4px_12px_rgba(15,23,42,0.08)] dark:bg-gray-950":"border-gray-200 bg-white text-gray-700 hover:border-[var(--starter-partner-hover-border-color)] hover:text-current active:border-[var(--starter-partner-active-border-color)] dark:border-gray-800 dark:bg-gray-950 dark:text-gray-200 dark:hover:border-[var(--starter-partner-hover-border-color)] dark:active:border-[var(--starter-partner-active-border-color)]":null,ce=Tt(f,.5)??f,he={"--starter-partner-active-border-color":f,"--starter-partner-border-hover":N?ce:void 0,"--starter-partner-hover-border-color":ce,backgroundColor:void 0,borderColor:y&&l||l&&N?f:void 0,color:w&&l?f:void 0,boxShadow:l?N?void 0:`0 6px 16px ${Tt(f,.12)}`:N?void 0:`0 1px 2px ${Tt(f,.08)}`};return a("button",{...h,ref:c,type:"button","aria-pressed":l,"aria-label":r?`${p}, inactive while another exclusive partner is selected`:p,className:T("inline-flex items-center text-gray-800 transition-all duration-200 dark:text-gray-100","border-2",E,l&&"translate-y-[-1px]",x?"justify-start text-left":"gap-2 text-left",se,N&&n.chip,N&&"hover:border-[var(--starter-partner-border-hover)] active:border-[var(--starter-partner-active-border-color)]",le,r&&"border-transparent opacity-60 saturate-50 grayscale hover:border-transparent hover:text-gray-700 active:border-transparent dark:border-transparent dark:hover:border-transparent dark:hover:text-gray-200 dark:active:border-transparent",h.className),style:he,children:x?m("span",{className:T("flex h-full flex-col px-3 py-1.5",H,R),children:[a("span",{className:T("flex flex-1 items-center justify-start",Z),children:a(na,{className:"block w-full max-h-7 object-contain",config:i.image,alt:""})}),u?a("span",{className:T("mt-auto text-[9px] font-medium tracking-[0.02em] text-gray-400 dark:text-gray-500",J),children:u}):null,a("span",{className:"sr-only",children:p})]}):m("span",{className:"flex flex-col items-start gap-px",children:[a("span",{children:i.label}),u?a("span",{className:"text-[9px] font-medium tracking-[0.02em] text-gray-400 dark:text-gray-500",children:u}):null]})})});function ar({compact:e=!1,palette:t,partnerSuggestions:r,selectedPartners:n,size:i="default",togglePartner:l}){const d=z(()=>{const h=new Set;for(const c of n){const f=r.find(p=>p.id===c);if(f)for(const p of Lt(f,r))h.add(p)}for(const c of n)h.delete(c);return h},[r,n]);return a("div",{className:"space-y-4.5",children:[1,2,3].map(h=>({tier:h,partners:r.filter(c=>c.tier===h)})).filter(h=>h.partners.length>0).map(h=>a("div",{className:"flex flex-wrap gap-1.5",children:h.partners.map(c=>{const f=n.includes(c.id),p=d.has(c.id);return a(jr,{content:a(En,{partner:c}),children:a(On,{compact:e,onClick:()=>l(c,f),muted:p,palette:t,partner:c,selected:f,size:i})},c.id)})},h.tier))})}function En({partner:e}){return m("div",{className:"w-[min(22rem,calc(100vw-1rem))] rounded-xl border border-gray-200 bg-white/95 px-3.5 py-3 text-left shadow-lg shadow-gray-950/10 dark:border-gray-800 dark:bg-gray-950/95",children:[m("div",{className:"flex items-center gap-2 text-[11px] font-medium uppercase tracking-[0.18em] text-gray-400 dark:text-gray-500",children:[a(mr,{className:"h-3.5 w-3.5"}),e.label]}),e.tags.length>0?a("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.tags.map(t=>a("span",{className:"rounded-full border border-gray-200 bg-gray-50 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.14em] text-gray-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300",children:t},t))}):null,a("div",{className:"mt-2 text-sm leading-5 text-gray-600 dark:text-gray-300",children:e.description})]})}function jr({children:e,content:t}){return m(ja,{children:[a(za,{asChild:!0,children:e}),a(Ba,{children:a($a,{side:"bottom",align:"center",sideOffset:8,className:"z-[500] transition-opacity duration-150 data-[state=closed]:opacity-0 data-[state=delayed-open]:opacity-100",children:t})})]})}function zr({copiedPrompt:e=!1,copyNotice:t,onDismissCopyNotice:r,onCopyPrompt:n,title:i="Prompt Preview"}){return m("div",{className:"border-b border-gray-200 bg-gray-50/70 px-4 py-3 dark:border-gray-800 dark:bg-gray-900/70",children:[m("div",{className:"flex items-center justify-between gap-3",children:[a("div",{children:a("div",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-gray-400 dark:text-gray-500",children:i})}),a("div",{className:"flex items-center gap-2",children:n?a(re,{variant:"secondary",size:"sm",type:"button",onClick:n,children:e?m(Rt,{children:[a(It,{className:"h-4 w-4"}),"Copied"]}):m(Rt,{children:[a(_t,{className:"h-4 w-4"}),"Copy Prompt"]})}):null})]}),t?m("div",{className:"mt-3 flex items-start justify-between gap-3 rounded-lg border border-emerald-200 bg-emerald-50/80 px-3 py-2.5 dark:border-emerald-900/70 dark:bg-emerald-950/30",children:[m("div",{children:[a("div",{className:"text-sm font-medium text-emerald-900 dark:text-emerald-200",children:"Prompt copied to clipboard"}),a("div",{className:"mt-1 text-[11px] leading-5 text-emerald-800/80 dark:text-emerald-300/80",children:"Paste it into your favorite AI or coding agent."})]}),r?a("button",{type:"button",onClick:r,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-emerald-200/80 text-emerald-800 transition-colors hover:bg-emerald-100 dark:border-emerald-800 dark:text-emerald-300 dark:hover:bg-emerald-900/50","aria-label":"Dismiss copied prompt notice",children:a(Vr,{className:"h-4 w-4"})}):null]}):null]})}function Br({prompt:e}){return a("div",{className:"px-4 py-4",children:a("pre",{className:"min-w-0 max-w-full max-h-40 overflow-y-auto !overflow-x-hidden whitespace-pre-wrap break-words !text-gray-700 dark:!text-gray-200 text-xs leading-6",style:{color:"inherit"},children:a("code",{className:"block min-w-0 max-w-full !whitespace-pre-wrap break-words font-sans !text-inherit [word-break:normal]",style:{color:"inherit"},children:e})})})}function Un({children:e}){return a("div",{className:"border-t border-gray-200 bg-gray-50/70 px-4 py-3 dark:border-gray-800 dark:bg-gray-900/70",children:e})}function no({copiedPrompt:e=!1,copyNotice:t,footer:r,onDismissCopyNotice:n,onCopyPrompt:i,prompt:l,title:d="Prompt Preview"}){return m("div",{className:"overflow-hidden rounded-[1rem] border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-950",children:[a(zr,{copiedPrompt:e,copyNotice:t,onDismissCopyNotice:n,onCopyPrompt:i,title:d}),a(Br,{prompt:l}),r?a(Un,{children:r}):null]})}var jn="data:image/svg+xml,%3csvg%20fill='%23ffff'%20fill-rule='evenodd'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAnthropic%3c/title%3e%3cpath%20d='M13.827%203.52h3.603L24%2020h-3.603l-6.57-16.48zm-7.258%200h3.767L16.906%2020h-3.674l-1.343-3.461H5.017l-1.344%203.46H0L6.57%203.522zm4.132%209.959L8.453%207.687%206.205%2013.48H10.7z'/%3e%3c/svg%3e",zn="data:image/svg+xml,%3csvg%20fill='%23000'%20fill-rule='evenodd'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAnthropic%3c/title%3e%3cpath%20d='M13.827%203.52h3.603L24%2020h-3.603l-6.57-16.48zm-7.258%200h3.767L16.906%2020h-3.674l-1.343-3.461H5.017l-1.344%203.46H0L6.57%203.522zm4.132%209.959L8.453%207.687%206.205%2013.48H10.7z'/%3e%3c/svg%3e",nr="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='256'%20height='260'%20preserveAspectRatio='xMidYMid'%20viewBox='0%200%20256%20260'%3e%3cpath%20fill='%23fff'%20d='M239.184%20106.203a64.716%2064.716%200%200%200-5.576-53.103C219.452%2028.459%20191%2015.784%20163.213%2021.74A65.586%2065.586%200%200%200%2052.096%2045.22a64.716%2064.716%200%200%200-43.23%2031.36c-14.31%2024.602-11.061%2055.634%208.033%2076.74a64.665%2064.665%200%200%200%205.525%2053.102c14.174%2024.65%2042.644%2037.324%2070.446%2031.36a64.72%2064.72%200%200%200%2048.754%2021.744c28.481.025%2053.714-18.361%2062.414-45.481a64.767%2064.767%200%200%200%2043.229-31.36c14.137-24.558%2010.875-55.423-8.083-76.483Zm-97.56%20136.338a48.397%2048.397%200%200%201-31.105-11.255l1.535-.87%2051.67-29.825a8.595%208.595%200%200%200%204.247-7.367v-72.85l21.845%2012.636c.218.111.37.32.409.563v60.367c-.056%2026.818-21.783%2048.545-48.601%2048.601Zm-104.466-44.61a48.345%2048.345%200%200%201-5.781-32.589l1.534.921%2051.722%2029.826a8.339%208.339%200%200%200%208.441%200l63.181-36.425v25.221a.87.87%200%200%201-.358.665l-52.335%2030.184c-23.257%2013.398-52.97%205.431-66.404-17.803ZM23.549%2085.38a48.499%2048.499%200%200%201%2025.58-21.333v61.39a8.288%208.288%200%200%200%204.195%207.316l62.874%2036.272-21.845%2012.636a.819.819%200%200%201-.767%200L41.353%20151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466%2041.695-63.08-36.63L161.73%2077.86a.819.819%200%200%201%20.768%200l52.233%2030.184a48.6%2048.6%200%200%201-7.316%2087.635v-61.391a8.544%208.544%200%200%200-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39%208.39%200%200%200-8.492%200L99.98%2099.808V74.587a.716.716%200%200%201%20.307-.665l52.233-30.133a48.652%2048.652%200%200%201%2072.236%2050.391v.205ZM88.061%20139.097l-21.845-12.585a.87.87%200%200%201-.41-.614V65.685a48.652%2048.652%200%200%201%2079.757-37.346l-1.535.87-51.67%2029.825a8.595%208.595%200%200%200-4.246%207.367l-.051%2072.697Zm11.868-25.58%2028.138-16.217%2028.188%2016.218v32.434l-28.086%2016.218-28.188-16.218-.052-32.434Z'/%3e%3c/svg%3e",or="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='256'%20height='260'%20preserveAspectRatio='xMidYMid'%20viewBox='0%200%20256%20260'%3e%3cpath%20d='M239.184%20106.203a64.716%2064.716%200%200%200-5.576-53.103C219.452%2028.459%20191%2015.784%20163.213%2021.74A65.586%2065.586%200%200%200%2052.096%2045.22a64.716%2064.716%200%200%200-43.23%2031.36c-14.31%2024.602-11.061%2055.634%208.033%2076.74a64.665%2064.665%200%200%200%205.525%2053.102c14.174%2024.65%2042.644%2037.324%2070.446%2031.36a64.72%2064.72%200%200%200%2048.754%2021.744c28.481.025%2053.714-18.361%2062.414-45.481a64.767%2064.767%200%200%200%2043.229-31.36c14.137-24.558%2010.875-55.423-8.083-76.483Zm-97.56%20136.338a48.397%2048.397%200%200%201-31.105-11.255l1.535-.87%2051.67-29.825a8.595%208.595%200%200%200%204.247-7.367v-72.85l21.845%2012.636c.218.111.37.32.409.563v60.367c-.056%2026.818-21.783%2048.545-48.601%2048.601Zm-104.466-44.61a48.345%2048.345%200%200%201-5.781-32.589l1.534.921%2051.722%2029.826a8.339%208.339%200%200%200%208.441%200l63.181-36.425v25.221a.87.87%200%200%201-.358.665l-52.335%2030.184c-23.257%2013.398-52.97%205.431-66.404-17.803ZM23.549%2085.38a48.499%2048.499%200%200%201%2025.58-21.333v61.39a8.288%208.288%200%200%200%204.195%207.316l62.874%2036.272-21.845%2012.636a.819.819%200%200%201-.767%200L41.353%20151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466%2041.695-63.08-36.63L161.73%2077.86a.819.819%200%200%201%20.768%200l52.233%2030.184a48.6%2048.6%200%200%201-7.316%2087.635v-61.391a8.544%208.544%200%200%200-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39%208.39%200%200%200-8.492%200L99.98%2099.808V74.587a.716.716%200%200%201%20.307-.665l52.233-30.133a48.652%2048.652%200%200%201%2072.236%2050.391v.205ZM88.061%20139.097l-21.845-12.585a.87.87%200%200%201-.41-.614V65.685a48.652%2048.652%200%200%201%2079.757-37.346l-1.535.87-51.67%2029.825a8.595%208.595%200%200%200-4.246%207.367l-.051%2072.697Zm11.868-25.58%2028.138-16.217%2028.188%2016.218v32.434l-28.086%2016.218-28.188-16.218-.052-32.434Z'/%3e%3c/svg%3e";function ir(e){const t=window.open("","_blank");return t&&(t.opener=null,t.document.title=`Opening ${e}`,t.document.body.textContent=`Opening ${e}...`),t}function sr(e,t){if(e){e.location.href=t,e.focus();return}window.location.assign(t)}function lr(e){e?.close()}function Bn({builderIntegration:e,context:t,forceRouterOnly:r=!1,onDirtyStateChange:n,onResolvedResult:i,revealOptionsImmediately:l=!1,suggestionContext:d=t}){const{notify:h}=la(),c=Ja(d),f=fa({orderStrategy:"tier-rotated",surface:"application_starter_suggestions"}),p=z(()=>ua(f),[f]),[u,y]=S(()=>c[0]?.input??""),[k,w]=S(l),[x,N]=S(null),[E,R]=S(null),[Z,H]=S(!1),[J,se]=S(Pt[0]),[le,ce]=S(null),[he,ke]=S(!1),[W,ae]=S(!1),[ge,Ae]=S(!1),[Fe,we]=S(!1),[be,Ge]=S(()=>Lr(c[0]?.input??"")??""),[De]=Gt(u,{wait:300}),[Me]=Gt(be,{wait:300}),[Se,Ve]=S({}),[Ze,Q]=S({}),[de,We]=S(void 0),[ue,Ce]=S(void 0),ne=B(0),Ye=B(!1),Ke=B(null),G=z(()=>p.flatMap(o=>Ze[o.id]===!0?[o.id]:[]),[Ze,p]),q=z(()=>At(G,p),[G,p]),Oe=z(()=>ia(p,q),[p,q]),Ee=z(()=>Or.flatMap(o=>Se[o]===!0?[o]:[]),[Se]),M=z(()=>[...ht,...Ee],[Ee]),ee=B(pa),Ue=b(o=>{ee.current={...ee.current,idea_used:o}},[]),_=b(o=>{ne.current+=1,x&&ae(!0),(o?.clearResult??!0)&&(N(null),i?.(null)),H(!1)},[i,x]),O=b(()=>{Ye.current=!0},[]),fe=b(()=>{O(),_({clearResult:!1})},[_,O]);$(()=>{l&&w(!0)},[l]),$(()=>{n?.(W)},[W,n]);const D=Ur(be),oe=Et(u)||D.length>0,Xe=D.length>0&&!Ln(D);$(()=>{if(!oe)return;const o=window.setTimeout(()=>{Ke.current?.focus()},0);return()=>{window.clearTimeout(o)}},[oe]);const ie=b((o=G,g=[],v=M)=>er({forceRouterOnly:r,inferredPartners:g,input:u,migrationRepositoryUrl:be,packageManager:de,selectedLibraries:v,selectedPartners:o,toolchain:ue}),[G,r,u,be,de,M,ue]),Ne=b((o=G,g=[],v=M)=>er({forceRouterOnly:r,inferredPartners:g,input:De,migrationRepositoryUrl:Me,packageManager:de,selectedLibraries:v,selectedPartners:o,toolchain:ue}),[De,Me,G,r,de,M,ue]),Je=b(o=>{if(Er(o))return;O(),_();const g=M.includes(o);Ve(v=>({...v,[o]:!g}))},[_,O,M]),Y=b((o,g)=>{O(),_(),Q(v=>{const I=!g,s={...v,[o.id]:I};if(I)for(const A of Lt(o,p))s[A]=!1;return s})},[_,O,p]),Qe=b(o=>{O(),_(),We(g=>g===o?void 0:o)},[_,O]),gt=b(o=>{O(),_(),Ce(g=>g===o?void 0:o)},[_,O]),et=b(()=>{H(!1)},[]),tt=b(()=>{H(!0)},[]),ye=b((o,g)=>{R(o),setTimeout(()=>R(v=>v===o?null:v),1800),o==="prompt"&&g?.showPromptNotice&&tt(),(g?.trigger??"user")==="user"&&o==="prompt"&&$e("builder_activated",{...ee.current,action:"copy_prompt",surface:"result_panel",automatic:!1})},[tt]),ve=b(async(o,g,v)=>{await navigator.clipboard.writeText(o),ye(g,{showPromptNotice:v?.showPromptNotice,trigger:v?.trigger}),v?.notify!==!1&&h(m("div",{children:[m("div",{className:"font-medium",children:["Copied ",g]}),a("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Paste it into your AI tool or terminal."})]}))},[ye,h]),rt=b(o=>{ae(!1),N(o),i?.(o)},[i]),K=b(async(o,g)=>{const v=o.trim();if(!v)return null;const I=ne.current+1;ne.current=I,se(Pt[Math.floor(Math.random()*Pt.length)]),Ae(!0);try{const s=await Qa({context:t,input:v});return I!==ne.current?null:(rt(s),g?.applyBuilder&&e&&await e.applyResult(s,{silent:g.silentBuilder}),s)}catch(s){return I===ne.current&&(h(m("div",{children:[a("div",{className:"font-medium",children:"Could not rebuild the prompt"}),a("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:s instanceof Error?s.message:"Please try again."})]})),$e("builder_failed",{...ee.current,stage:"generation",error_message:s instanceof Error?s.message:"unknown_error"})),null}finally{I===ne.current&&Ae(!1)}},[rt,e,t,h]),je=b((o,g)=>{const v=xr(g),I=kr(g),s=[...new Set([...v,...I])],A=[...new Set([...o.recipe.features,o.recipe.deployment,o.recipe.toolchain].filter(pe=>!!pe))],te=`${o.prompt} ${o.cliCommand}`.toLowerCase(),F=A.filter(pe=>te.includes(pe.toLowerCase()));$e("builder_generated",{...ee.current,final_deployment:o.recipe.deployment,final_package_manager:o.recipe.packageManager,final_library_count:M.length,final_partner_count:s.length,final_addon_count:F.length,library_ids:M.join(","),partner_ids:s.join(","),addon_ids:F.join(",")})},[M]);$(()=>{if(!k)return;const o=Ne();o.trim()&&K(o,{applyBuilder:Ye.current,silentBuilder:!0})},[Ne,k,K]);const at=b(async({suggestion:o})=>{fe(),y(o.input),Et(o.input)||Ge(""),Ue(o.label)},[fe,Ue]),xe=b(async()=>{const o=ie();return o.trim()?x&&!W?x:K(o):null},[ie,W,K,x]),nt=b(async o=>{const g=await xe();g&&await ve(o==="prompt"?g.prompt:g.cliCommand,o,o==="prompt"?{notify:!1}:void 0)},[xe,ve]),V=b(o=>{$e("builder_activated",{...ee.current,action:o.action,surface:o.surface,provider:o.provider,automatic:o.automatic??!1})},[]),L=b((o,g)=>{V({action:o,surface:"result_panel",provider:g??void 0})},[V]),X=b(async o=>{const g=await xe();return g?o(g):null},[xe]),P=b(async o=>X(async g=>{if(g.prompt)return o(g)}),[X]),Pe=b(async o=>{await X(g=>{if(L(o==="advanced"?"open_advanced":"download"),o==="download"&&e?.downloadResult)return e.downloadResult(g);const v=o==="download"?g.downloadUrl:g.advancedBuilderUrl;v&&window.location.assign(v)})},[e,L,X]),ot=b(async o=>{await X(g=>{g.recipe.target==="start"&&(L(o?"deploy":"clone_repo",o),ce(o),ke(!0))})},[L,X]),it=b(async()=>{const o=ir("Netlify");let g=!1;const v=p.find(F=>F.id==="netlify"),I=v?Lt(v,p):["cloudflare"],s=G.filter(F=>!I.includes(F)),A=s.length!==G.length;A&&(Q(F=>{const pe={...F};for(const Ct of I)pe[Ct]=!1;return pe}),_());const te=ie(s,[],M);try{if(!te.trim())return;const F=!A&&x&&!W?x:await K(te);if(!F?.prompt)return;$e("builder_activated",{...ee.current,action:"netlify_start",surface:"result_panel",provider:"netlify",automatic:!1}),g=!0,sr(o,ut("netlify",F.prompt))}finally{g||lr(o)}},[ie,G,_,W,p,x,K,M]),U=b(async()=>{const o=ir("Lovable");let g=!1;try{await P(v=>{V({action:"deploy",surface:"result_panel",provider:"lovable"}),g=!0,sr(o,ut("lovable",v.prompt))})}finally{g||lr(o)}},[V,P]),Te=b(async()=>{await P(o=>{L("open_codex"),window.location.assign(`codex://new?prompt=${encodeURIComponent(o.prompt)}`)})},[L,P]),ze=b(async()=>{await P(o=>{L("open_claude"),window.open(`https://claude.ai/code?q=${encodeURIComponent(o.prompt)}`,"_blank","noopener,noreferrer")})},[L,P]),bt=b(async()=>{await P(o=>{L("open_cursor"),window.open(`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(o.prompt)}`,"_blank","noopener,noreferrer")})},[L,P]),st=b(async()=>{const o=ie(),g=x&&!W?x:await K(o);g&&(je(g,o),e&&await e.applyResult(g,{silent:!1})&&h(m("div",{children:[a("div",{className:"font-medium",children:"Builder configured"}),a("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"The prompt was applied to the builder immediately."})]})),await ve(g.prompt,"prompt",{notify:!1,showPromptNotice:!0}))},[ie,e,ve,W,h,K,x,je]),ft=ie().trim().length>0,yt=!!x?.prompt,vt=ge,xt=!1,kt=ge,wt=b(o=>{fe(),y(o)},[fe]),St=b(o=>{O(),_(),Ge(o)},[_,O]);return{copiedKind:E,copyResultValue:nt,dismissPromptCopyNotice:et,deployDialogProvider:le,generatePrompt:st,hasGeneratedPrompt:yt,hasRevealedOptions:k,hasInput:ft,hasMigrationRepositoryUrlError:Xe,input:u,isDeployDialogOpen:he,isGenerating:kt,isGeneratingNetlify:xt,isGeneratingPrompt:vt,isModHeld:Fe,loadingPhrase:J,migrationRepositoryInputRef:Ke,migrationRepositoryUrl:be,navigateToResult:Pe,openClaudeStart:ze,openCursorStart:bt,openCodexStart:Te,openDeployDialog:ot,openLovableStart:U,openNetlifyStart:it,partnerSuggestions:Oe,promptCopyNotice:Z,result:x,selectSuggestion:at,selectedPackageManager:de,selectedLibraries:M,selectedPartners:q,selectedToolchain:ue,setIsDeployDialogOpen:ke,setIsModHeld:we,showMigrationRepositoryInput:oe,trackActivation:V,submitCurrentInput:b(async()=>{u.trim()&&w(!0)},[u]),suggestions:c,toggleLibrary:Je,togglePackageManager:Qe,togglePartner:Y,toggleToolchain:gt,updateInput:wt,updateMigrationRepositoryUrl:St}}var $n=hr(()=>gr(()=>import("./ApplicationStarterHotkeys.client-3balDwuU.js").then(e=>({default:e.ApplicationStarterHotkeys})),__vite__mapDeps([0,1,2,3,4,5]))),Hn=hr(()=>gr(()=>import("./DeployDialog-Cq7n1Wt1.js").then(e=>({default:e.DeployDialog})),__vite__mapDeps([6,7,3,8,9,2,10,11,12,1,5,13,14]))),cr=["pnpm","npm","yarn","bun"],dr=["biome","eslint"],ur={cloudflare:"Cloudflare",lovable:"Lovable",netlify:"Netlify",railway:"Railway"};function qn(e){switch(e){case"cloudflare":case"lovable":case"netlify":case"railway":return e;default:return}}function Fn(e){switch(e){case"lovable":case"netlify":return e;case"cloudflare":case"railway":return}}function Gn(e){return`codex://new?prompt=${encodeURIComponent(e)}`}function Vn(e){return`https://claude.ai/code?q=${encodeURIComponent(e)}`}function Zn(e){return`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(e)}`}function oo({builderIntegration:e,className:t,context:r,footerContent:n,enableHotkeys:i=!1,forceRouterOnly:l=!1,formId:d,headerAction:h,mode:c="full",onDirtyStateChange:f,onResolvedResult:p,primaryActionLabel:u="Copy Prompt",revealOptionsImmediately:y=!1,secondaryActionLabel:k="Build with Netlify",showCliExportActions:w=!0,showPromptPreview:x=!0,suggestionContext:N,submitButton:E,title:R="What would you like to build?",tone:Z="cyan"}){const{copiedKind:H,copyResultValue:J,dismissPromptCopyNotice:se,deployDialogProvider:le,generatePrompt:ce,hasGeneratedPrompt:he,hasRevealedOptions:ke,hasInput:W,hasMigrationRepositoryUrlError:ae,input:ge,isDeployDialogOpen:Ae,isGenerating:Fe,isGeneratingPrompt:we,isModHeld:be,loadingPhrase:Ge,migrationRepositoryInputRef:De,migrationRepositoryUrl:Me,openDeployDialog:Se,partnerSuggestions:Ve,promptCopyNotice:Ze,result:Q,selectSuggestion:de,selectedPackageManager:We,selectedLibraries:ue,selectedPartners:Ce,selectedToolchain:ne,setIsDeployDialogOpen:Ye,setIsModHeld:Ke,showMigrationRepositoryInput:G,trackActivation:q,submitCurrentInput:Oe,suggestions:Ee,toggleLibrary:M,togglePackageManager:ee,togglePartner:Ue,toggleToolchain:_,updateInput:O,updateMigrationRepositoryUrl:fe}=Bn({builderIntegration:e,context:r,forceRouterOnly:l,mode:c,onDirtyStateChange:f,onResolvedResult:p,revealOptionsImmediately:y,suggestionContext:N}),D=_n[Z],oe=c==="compact",[Xe,ie]=S(!1),[Ne,Je]=S(null),[Y,Qe]=S(null),[gt,et]=S(!1),[tt,ye]=S(!1),[ve,rt]=S(!1),[K,je]=S(!1),[at,xe]=S(!1),nt=W&&!ae&&!Fe,V=ke&&W&&!ae&&!Fe,L=B(null),X=b(s=>{L.current&&clearTimeout(L.current),Qe(s),L.current=setTimeout(()=>{Qe(A=>A===s?null:A),L.current=null},1800)},[]),P=z(()=>Ce.flatMap(s=>{const A=qn(s);return A?[A]:[]})[0],[Ce]),Pe=Ne!==null&&Ne===P||Y==="deploy",ot=H==="prompt",it=H==="command",U=Q?.prompt,Te=P?Fn(P):void 0,ze=z(()=>Te&&Q?.prompt?ut(Te,Q.prompt):void 0,[Q?.prompt,Te]),bt=z(()=>U?ut("netlify",U):void 0,[U]),st=z(()=>U?Gn(U):void 0,[U]),ft=z(()=>U?Vn(U):void 0,[U]),yt=z(()=>U?Zn(U):void 0,[U]),vt=Q?.downloadUrl,xt=b(()=>{P&&q({action:P==="netlify"?"netlify_start":"deploy",surface:"result_panel",provider:P})},[P,q]),kt=async()=>{if(P){Je(P);try{switch(P){case"cloudflare":await Se("cloudflare");break;case"lovable":break;case"netlify":break;case"railway":await Se("railway");break}}finally{Je(null)}}},wt=()=>m(re,{color:"emerald",variant:P?"secondary":"primary",size:"sm",type:"button",onClick:()=>{ce()},disabled:!V,children:[we?a(Re,{className:"h-4 w-4 animate-spin"}):ot?a(It,{className:"h-4 w-4"}):a(_t,{className:"h-4 w-4"}),we?Ge:ot?"Copied":u]}),St=()=>m(re,{variant:"secondary",size:"sm",type:"button",onClick:()=>{J("command")},disabled:!V,children:[we?a(Re,{className:"h-4 w-4 animate-spin"}):it?a(It,{className:"h-4 w-4"}):a(_t,{className:"h-4 w-4"}),we?"Preparing...":it?"Copied":"Copy CLI Command"]}),o=({action:s,className:A,href:te,icon:F,label:pe,onTrack:Ct,rel:$r="noopener noreferrer",size:$t,target:Hr="_blank",variant:qr="primary"})=>{const Be=!V||!te||Y===s,Ht=!te;return m(re,{as:"a",variant:qr,size:$t,href:Be?void 0:te,target:Hr,rel:$r,"aria-disabled":Be,tabIndex:Be?-1:void 0,onClick:Fr=>{if(Be){Fr.preventDefault();return}Ct(),X(s)},className:T(A,Be&&"pointer-events-none opacity-50"),children:[Y===s||Ht?a(Re,{className:T("animate-spin",$t==="xs"?"h-3 w-3":"h-4 w-4")}):F,Y===s?"Opening...":Ht?"Preparing...":pe]})},g=()=>{if(!P)return null;if(Te){const s=!V||!ze||Y==="deploy",A=!ze;return m(re,{as:"a",color:"emerald",variant:"primary",size:"sm",href:s?void 0:ze,target:"_blank",rel:"noopener noreferrer","aria-disabled":s,tabIndex:s?-1:void 0,onClick:te=>{if(s){te.preventDefault();return}xt(),X("deploy")},className:s?"pointer-events-none opacity-50":void 0,"aria-label":`Deploy to ${ur[P]}`,children:[Pe||A?a(Re,{className:"h-4 w-4 animate-spin"}):a(Nt,{className:"h-4 w-4"}),Pe?"Opening...":A?"Preparing...":"Deploy"]})}return m(re,{color:"emerald",variant:"primary",size:"sm",type:"button",onClick:()=>{X("deploy"),kt()},disabled:!V||Ne!==null||Y==="deploy","aria-label":`Deploy to ${ur[P]}`,children:[Pe?a(Re,{className:"h-4 w-4 animate-spin"}):a(Nt,{className:"h-4 w-4"}),Pe?"Opening...":"Deploy"]})},v=ke||he,I=ke||he;return $(()=>()=>{L.current&&clearTimeout(L.current)},[]),$(()=>{typeof navigator>"u"||rt(/Mac|iPhone|iPad|iPod/i.test(navigator.platform))},[]),m("div",{className:T("relative",t),children:[i&&!oe&>?a(Wr,{children:a(Ft,{fallback:null,children:a($n,{onSubmit:()=>{I?ce():Oe()},onModKeyChange:Ke,promptFocused:tt})})}):null,Ae?a(Ft,{fallback:null,children:a(Hn,{isOpen:Ae,onClose:()=>Ye(!1),provider:le,starterRecipe:Q?.recipe??null,onTrackActivation:q})}):null,m("div",{className:"relative",children:[oe?a("div",{className:"space-y-2",children:a("h3",{className:T("font-semibold tracking-[-0.03em] text-gray-950 dark:text-white","text-base tracking-[-0.02em]"),children:R})}):null,m("form",{id:d,className:T("space-y-3",oe?"mt-3":"mt-0"),onSubmit:async s=>{s.preventDefault(),await Oe()},children:[oe?m(Rt,{children:[m("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-950",children:[m("div",{className:"border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[a("div",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500",children:"Ideas"}),a("div",{className:"mt-2 flex flex-wrap gap-2",children:Ee.map(s=>a(_e,{compact:!0,onClick:()=>{de({suggestion:s})},palette:D,selected:ge===s.input,children:s.label},s.label))})]}),G?m("div",{className:"border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[a("div",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500",children:"Existing Repository URL"}),a("input",{ref:De,type:"text",value:Me,onChange:s=>{fe(s.target.value)},placeholder:"https://github.com/acme/legacy-next-app",className:T("mt-2 h-9 w-full rounded-md border border-gray-200 bg-white px-3 text-xs text-gray-900 outline-none transition-colors placeholder:text-gray-400 dark:border-gray-800 dark:bg-gray-950 dark:text-white dark:placeholder:text-gray-500",D.ring,ae&&"border-red-300 dark:border-red-800")}),ae?a("div",{className:"mt-2 text-[11px] text-red-600 dark:text-red-400",children:"Enter a valid Git or GitHub repository URL."}):null]}):null,m("div",{className:"relative",children:[a("div",{className:"px-3 pt-2 text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500",children:"Prompt"}),a("textarea",{value:ge,onChange:s=>{O(s.target.value)},onFocus:()=>{et(!0),ye(!0)},onBlur:()=>{ye(!1)},rows:3,placeholder:"Build a SaaS app with auth, Postgres, nested routes, and Sentry. Use pnpm and deploy to Cloudflare.",className:T("w-full min-h-20 bg-transparent px-3 pb-2 pt-1 text-xs leading-5 text-gray-900 outline-none transition-colors dark:text-white",D.ring)})]}),v?null:a("div",{className:"border-t border-gray-200 px-3 py-2 dark:border-gray-800",children:m(re,{color:"emerald",className:"pr-1",size:"xs",type:"submit",disabled:!nt,children:[a(qt,{className:"h-4 w-4"}),"Next",i?a(pr,{isMac:ve}):null]})})]}),a(dt,{open:v,children:a(ct,{className:"mt-3",children:v?a(tr,{children:m("div",{className:"space-y-2 rounded-lg border border-gray-200 bg-white px-3 py-3 dark:border-gray-800 dark:bg-gray-950",children:[m("div",{className:"mb-3",children:[a("div",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500",children:"TanStack Libraries"}),a("div",{className:"mt-2 space-y-2",children:a(rr,{compact:!0,selectedLibraries:ue,toggleLibrary:M})})]}),a("div",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500",children:"Partner Integrations"}),a(ar,{compact:!0,palette:D,partnerSuggestions:Ve,selectedPartners:Ce,togglePartner:Ue}),a(lt,{compact:!0,onOpenChange:xe,open:at,title:"Toolchain",children:a("div",{className:"mt-2 flex flex-wrap gap-2",children:dr.map(s=>a(_e,{compact:!0,onClick:()=>{_(s)},palette:D,selected:ne===s,children:s},s))})}),a(lt,{compact:!0,onOpenChange:je,open:K,title:"Package Manager",children:a("div",{className:"mt-2 flex flex-wrap gap-2",children:cr.map(s=>a(_e,{compact:!0,onClick:()=>{ee(s)},palette:D,selected:We===s,children:s},s))})})]})}):null})})]}):a("div",{className:"relative overflow-hidden rounded-[1rem] border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-950",children:m("div",{children:[m("div",{className:"border-b border-gray-200 bg-gray-50/70 px-5 py-4 dark:border-gray-800 dark:bg-gray-900/50",children:[m("div",{className:"flex items-center justify-between gap-3",children:[a("h3",{className:"font-semibold tracking-[-0.04em] text-[1.375rem] md:text-[1.5rem] text-gray-950 dark:text-white",children:R}),h?a("div",{className:"shrink-0",children:h}):null]}),a("div",{className:"mt-4 flex flex-wrap gap-2",children:Ee.map(s=>a(_e,{onClick:()=>{de({suggestion:s})},palette:D,selected:ge===s.input,children:s.label},s.label))})]}),m("div",{className:"relative border-b border-gray-200 dark:border-gray-800",children:[G?m("div",{className:"border-b border-gray-200 px-5 py-4 dark:border-gray-800",children:[a("div",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500",children:"Existing Repository URL"}),a("input",{ref:De,type:"text",value:Me,onChange:s=>{fe(s.target.value)},placeholder:"https://github.com/acme/legacy-next-app",className:T("mt-3 h-10 w-full rounded-lg border border-gray-200 bg-white px-3 text-sm text-gray-900 outline-none transition-colors placeholder:text-gray-400 dark:border-gray-800 dark:bg-gray-950 dark:text-white dark:placeholder:text-gray-500",D.ring,ae&&"border-red-300 dark:border-red-800")}),ae?a("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:"Enter a valid Git or GitHub repository URL."}):null]}):null,a("div",{className:"px-5 pt-4 text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500",children:"Prompt"}),a("textarea",{value:ge,onChange:s=>{O(s.target.value)},onFocus:()=>{et(!0),ye(!0)},onBlur:()=>{ye(!1)},onClick:s=>{i&&be&&(s.preventDefault(),I?ce():Oe())},rows:4,placeholder:"Build a SaaS app with auth, Postgres, nested routes, and Sentry. Use pnpm and deploy to Cloudflare.",className:T("w-full min-h-28 bg-transparent px-5 pb-4 pt-1 text-sm leading-6 text-gray-900 outline-none transition-colors dark:text-white",D.ring)}),I?null:a("div",{className:"border-t border-gray-200 px-5 py-4 dark:border-gray-800",children:a("div",{className:"flex flex-wrap items-center gap-3",children:m(re,{color:"emerald",className:"pr-1.5",size:"sm",type:"submit",disabled:!nt,children:[a(qt,{className:"h-4 w-4"}),"Next",i?a(pr,{isMac:ve}):null]})})})]}),a(dt,{open:v,children:a(ct,{children:v?m("div",{className:"bg-gray-50/70 px-5 py-4 dark:bg-gray-900/50",children:[a(tr,{children:m("div",{children:[m("div",{className:"mb-4",children:[a("div",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500",children:"TanStack Libraries"}),a("div",{className:"mt-3 space-y-2.5",children:a(rr,{selectedLibraries:ue,toggleLibrary:M})})]}),a("div",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500",children:"Add Integrations"}),a("div",{className:"mt-3",children:a(ar,{palette:D,partnerSuggestions:Ve,selectedPartners:Ce,size:"compact",togglePartner:Ue})}),a(lt,{onOpenChange:xe,open:at,title:"Toolchain",children:a("div",{className:"mt-3 flex flex-wrap gap-2",children:dr.map(s=>a(_e,{onClick:()=>{_(s)},palette:D,selected:ne===s,size:"compact",children:s},s))})}),a(lt,{onOpenChange:je,open:K,title:"Package Manager",children:a("div",{className:"mt-3 flex flex-wrap gap-2",children:cr.map(s=>a(_e,{onClick:()=>{ee(s)},palette:D,selected:We===s,size:"compact",children:s},s))})})]})}),n?a("div",{className:"mt-4",children:n}):null]}):null})}),a(dt,{open:I,children:a(ct,{children:I?a("div",{className:"bg-gray-50/70 px-5 py-4 dark:bg-gray-900/50",children:m("div",{className:"flex flex-col gap-4",children:[w?null:m("div",{className:"flex flex-wrap items-center gap-3",children:[P?null:o({action:"netlify",className:"border-[#00AD9F] bg-[#00AD9F] text-white hover:bg-[#009a8e]",href:bt,icon:a(Nt,{className:"h-4 w-4"}),label:k,onTrack:()=>{q({action:"netlify_start",surface:"result_panel",provider:"netlify"})},size:"sm"}),o({action:"codex",className:"border-gray-900 bg-gray-900 text-white hover:bg-gray-800 dark:border-gray-100 dark:bg-gray-100 dark:text-gray-950 dark:hover:bg-gray-200",href:st,icon:m("span",{className:"relative h-4 w-4 shrink-0",children:[a("img",{src:nr,alt:"","aria-hidden":"true",className:"h-4 w-4 dark:hidden"}),a("img",{src:or,alt:"","aria-hidden":"true",className:"hidden h-4 w-4 dark:block"})]}),label:"Open in Codex",onTrack:()=>{q({action:"open_codex",surface:"result_panel"})},size:"sm"})]}),m("div",{className:"flex flex-wrap items-center gap-3",children:[g(),wt(),w?St():null]}),w&&!Xe?a("div",{className:"flex flex-wrap items-center gap-3",children:a(re,{variant:"ghost",size:"xs",type:"button",onClick:()=>ie(!0),className:"h-auto border-transparent bg-transparent px-1 py-0 text-[11px] font-medium text-gray-500 hover:bg-transparent hover:text-gray-700 dark:text-gray-500 dark:hover:bg-transparent dark:hover:text-gray-300",children:"Show More"})}):null,w&&Xe?m("div",{className:"flex flex-wrap items-center gap-2",children:[o({action:"codex",className:"h-6 gap-1 px-2 text-[11px] border-gray-900 bg-gray-900 text-white hover:bg-gray-800 dark:border-gray-100 dark:bg-gray-100 dark:text-gray-950 dark:hover:bg-gray-200",href:st,icon:m("span",{className:"relative h-3 w-3 shrink-0",children:[a("img",{src:nr,alt:"","aria-hidden":"true",className:"h-3 w-3 dark:hidden"}),a("img",{src:or,alt:"","aria-hidden":"true",className:"hidden h-3 w-3 dark:block"})]}),label:"Open in Codex",onTrack:()=>{q({action:"open_codex",surface:"result_panel"})},size:"xs"}),o({action:"claude",className:"h-6 gap-1 px-2 text-[11px] border-[#D4A373] bg-[#D4A373] text-white hover:bg-[#C6905C] dark:border-[#E6C49A] dark:bg-[#E6C49A] dark:text-gray-950 dark:hover:bg-[#DBB684]",href:ft,icon:m("span",{className:"relative h-3 w-3 shrink-0",children:[a("img",{src:jn,alt:"","aria-hidden":"true",className:"h-3 w-3 dark:hidden"}),a("img",{src:zn,alt:"","aria-hidden":"true",className:"hidden h-3 w-3 dark:block"})]}),label:"Open in Claude",onTrack:()=>{q({action:"open_claude",surface:"result_panel"})},size:"xs"}),o({action:"cursor",className:"h-6 gap-1 px-2 text-[11px] border-black bg-black text-white hover:bg-gray-900 dark:border-white dark:bg-white dark:text-black dark:hover:bg-gray-100",href:yt,icon:a(Wn,{className:"h-3 w-3"}),label:"Open in Cursor",onTrack:()=>{q({action:"open_cursor",surface:"result_panel"})},size:"xs"}),m(re,{variant:"secondary",size:"xs",type:"button",onClick:()=>{X("clone"),Se(null)},disabled:!V||Y==="clone",className:"h-6 gap-1 px-2 text-[11px]",children:[Y==="clone"?a(Re,{className:"h-3 w-3 animate-spin"}):a(Yr,{className:"h-3 w-3"}),Y==="clone"?"Opening...":"Clone to GitHub"]}),o({action:"download",className:"h-6 gap-1 px-2 text-[11px]",href:vt,icon:a(Gr,{className:"h-3 w-3"}),label:"Download ZIP",onTrack:()=>{q({action:"download",surface:"result_panel"})},size:"xs",variant:"secondary"})]}):null]})}):null})}),x&&he?m("div",{className:"border-t border-gray-200 dark:border-gray-800",children:[a(zr,{copiedPrompt:H==="prompt",copyNotice:Ze,onDismissCopyNotice:se,onCopyPrompt:()=>{J("prompt")}}),a(Br,{prompt:Q?.prompt??""})]}):null]})}),oe?E:null]})]})]})}function Wn({className:e}){return a("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:e,children:a("path",{d:"M22.106 5.68 12.5.135a.998.998 0 0 0-.998 0L1.893 5.68a.84.84 0 0 0-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 0 0 .998 0l9.608-5.547a.84.84 0 0 0 .42-.727V6.407a.84.84 0 0 0-.42-.726Zm-.603 1.176-9.275 16.064c-.063.108-.228.064-.228-.061V12.34a.59.59 0 0 0-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514Z"})})}function pr({isMac:e}){return m("span",{className:"ml-1 inline-flex items-center gap-0.5",children:[a("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded bg-white px-1 text-[10px] leading-none text-gray-950 dark:bg-gray-900 dark:text-white",children:e?"⌘":"⌃"}),a("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded bg-white px-1 text-[10px] leading-none text-gray-950 dark:bg-gray-900 dark:text-white",children:"↵"})]})}function lt({children:e,compact:t=!1,onOpenChange:r,open:n,title:i}){return a(dt,{open:n,onOpenChange:r,children:m("div",{className:T(t?"pt-1":"pt-2"),children:[m(ca,{className:T("inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 transition-colors hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300",t&&"text-[10px]"),children:[i,a(Zr,{className:T("h-3 w-3 transition-transform duration-200",n&&"rotate-180")})]}),a(ct,{children:n?e:null})]})})}export{Zt as a,Ar as c,Vt as i,Sn as l,no as n,Wt as o,ao as r,Ja as s,oo as t,Qa as u};