import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{Mi as s,ki as t}from"./vendor-frame-CwiylG4Y.js";import{Pm as r}from"./shared-1-3-6x7RKF.js";import{rn as o}from"./vendor-all-2-BJdkbLSj.js";import{I as i,O as n}from"./shared-7-VxUxSmVa.js";import{Pn as a,ln as d}from"./shared-11-EQw1fy-I.js";import{n as l}from"./ca57da402-BvRnTggt.js";import{ChatTooltipV1 as u}from"./c8ce600ec-DPQVWFlp.js";var m=e(s()),c=t(),f=(0,m.memo)(({enabled:e,onDismiss:s,onAction:t})=>{const{model:f,isSettled:p}=l(),g=i(),b=a("chat-tooltip"),j=p&&g(f),x=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!p||j||x.current||(x.current=!0,s())},[p,j,s]);const{shouldGate:h,memberCanRequest:y,isUsageCreditsFunded:k,creditsRequiredClickRoute:q,isBillingStateSettled:M,creditPromoOutranksGate:R}=d({enabled:j}),P=h||y,v=o(),A=(0,m.useMemo)(()=>{if(!f)return;const e={model:n(f)},s={type:"model-selector",nuxTitle:r({id:"fxw77i",intl:v,dangerouslyVisiblePublicValues:e}),nuxText:r({id:k?"1yod0ea":"request"===q?y?"p3jdos":"1o1tfnn":"enable"===q?"1g2ehd2":"1o1tfnn",intl:v,dangerouslyVisiblePublicValues:e})};return P?{...s,ctaAction:{text:"request"===q?v.formatMessage({defaultMessage:"Request usage credits",id:"3gNFS1DF0J"}):"enable"===q?v.formatMessage({defaultMessage:"Turn on usage credits",id:"RF538op5DA"}):r({id:"hgk1x2",intl:v}),type:"credits_required_modal",value:f}}:s},[f,P,y,k,q,v]);return j&&e&&M&&!R&&A?(0,c.jsx)(u,{experienceKey:b?.key??b?.id??"",experienceId:b?.id??"",content:A,enabled:e,onDismiss:s,onAction:t}):null});export{f as CreditsTransitionTooltip};