import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{L_ as o}from"./shared-0-C4kdVF7Y.js";import{Mi as a,ki as s}from"./vendor-frame-CwiylG4Y.js";import{Th as t,h_ as r,hp as n,iv as i,nv as l,rv as d}from"./shared-1-3-6x7RKF.js";import{fo as c,io as m,uo as p,xo as f}from"./shared-6-Cf_fMhRZ.js";import{rn as k}from"./vendor-all-2-BJdkbLSj.js";import{J as u,X as h,lt as w}from"./shared-frame-DbQbH4Yr.js";import{w as b}from"./vendor-all-3-CWo5e8Lw.js";import{Qn as g}from"./shared-7-VxUxSmVa.js";import{t as j}from"./cc3ddf513-nvsaALAX.js";var v=e(a()),C=s();function x(){}var M=(0,v.memo)(({content:e,enabled:a,onDismiss:s,onAction:M})=>{const _=e,D=h(50),y=k(),E=o("claude_ai_sot_has_desktop"),T=l(),q=i(),U=d(),A=m(),I="cowork-upsell"===_.ctaType,O=g({when:a&&I}),P=r(),B=w(),[N,S]=(0,v.useState)(null);(0,v.useEffect)(()=>{f().then(e=>S(e))},[]);const[Y,z]=(0,v.useState)(!1),{downloadAndOpenModal:F,modal:G}=p("home_nudge_v1",{onClose:()=>{z(!1),M({cta:"download"})}}),H=(0,v.useCallback)(()=>{M()},[M]),J=(0,v.useCallback)(()=>{M({cta:"open-cowork"})},[M]),L=(0,v.useCallback)(()=>{M({cta:"open-desktop"})},[M]),Q=(0,v.useCallback)(e=>{e.preventDefault(),F(N),z(!0)},[F,N]),X=(0,v.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),s()},[s]);if(!a)return null;const K=!U&&(T||q);let R,V,W;if(I&&O.routesInApp)R={kind:"open-cowork"};else if(I&&K&&E)R={kind:"open-desktop"};else if(I&&K&&A)R={kind:"download"};else{const e=_.buttonHref,o=/^https?:\/\//i.test(e);R={kind:"href",href:o?e:t(e),isExternal:o}}let Z,$=!1;switch(R.kind){case"open-cowork":V=P,W=_.buttonText??y.formatMessage({defaultMessage:"Open Cowork",id:"PfEq6+YMsC"}),Z=J;break;case"open-desktop":V="claude://cowork/new",W=y.formatMessage({defaultMessage:"Open Cowork",id:"PfEq6+YMsC"}),Z=L;break;case"download":V="#",W=y.formatMessage({defaultMessage:"Download",id:"5q3qC0sC3r"}),Z=Q;break;case"href":V=R.href,W=_.buttonText,$=R.isExternal,Z=H}const ee={..._,buttonText:W,imageUrl:"dark"===B&&_.imageUrlDark?_.imageUrlDark:_.imageUrl};return(0,C.jsxs)(C.Fragment,{children:[!Y&&(0,C.jsx)(b.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"fixed bottom-10 right-10",style:{zIndex:D},children:(0,C.jsx)(u,{children:(0,C.jsx)(n,{href:V,webBehavior:$?"new-tab":"navigate",desktopBehavior:$?"open-in-browser":"navigate",rel:"noreferrer",onClick:Z,className:"block cursor-pointer",children:(0,C.jsx)(j,{content:ee,onCtaClick:"href"===R.kind?H:x,onDismiss:X,ImageComponent:c})})})}),"download"===R.kind&&G]})});export{M as HomeNudgeV1};