import{Dt as e,I as t,It as n,O as r,Q as i,S as a,T as o,Wt as s,bt as c,cn as l,g as u,j as d,k as f,mt as p,rn as m,tt as h,w as g,x as _}from"./_plugin-vue_export-helper-BVhEvvHC.js";import{ar as v,kn as y}from"./src-CD6Jsigc.js";import{r as b,t as x}from"./axios-DSyjHw-i.js";import{t as S}from"./useFeatureNames-x1xeIENn.js";import{t as C}from"./sessionSettingStore-ZHUB-lwo.js";import{a as w,i as T,l as E,n as D,o as O,r as k,s as A,t as j}from"./alert-dialog-R0_ON7dy.js";t(),c(),s();var M={key:0,class:`flex h-full w-full flex-col items-center justify-center gap-3 rounded-lg bg-secondarybackground p-6 text-center`},N={class:`text-sm font-bold text-text`},P={key:0,class:`text-xs text-muted-foreground`},F={key:1,class:`relative min-w-0`},I={class:`pointer-events-none select-none opacity-50`,"aria-hidden":`true`},L=[`title`],R={key:0,class:`flex items-center justify-center rounded-full bg-card/95 p-1.5 shadow-sm`},z={class:`flex items-center gap-2`},B={class:`text-sm font-semibold`},V={key:0,class:`text-xs text-muted-foreground`},H={class:`text-xs font-medium text-highlights`},U=d({__name:`FeatureGate`,props:{requiredFeature:{},variant:{default:`overlay`},title:{},description:{},compact:{type:Boolean,default:!1},overlayClass:{},boxClass:{}},emits:[`lockedClick`,`upgradeClick`],setup(t,{emit:s}){let{t:c}=b({useScope:`global`}),d=t,U=s,W=C(),{featureName:G}=S(),K=e(!1),q=_(()=>!W.hasFeature(d.requiredFeature)),J=_(()=>G(d.requiredFeature));function Y(){U(`lockedClick`),K.value=!0}function X(){U(`upgradeClick`),K.value=!1,x.post(`/account/plan/open`).catch(e=>console.error(`Failed to open plans page:`,e))}return(e,s)=>q.value?(i(),o(u,{key:1},[t.variant===`panel`?(i(),o(`div`,M,[f(n(y),{class:`h-8 w-8 text-muted-foreground`}),a(`p`,N,l(t.title??n(c)(`featureGate.upgradeTitle`)),1),t.description?(i(),o(`p`,P,l(t.description),1)):g(``,!0),f(n(v),{variant:`outline`,class:`mt-1`,onClick:Y},{default:p(()=>[r(l(n(c)(`featureLock.unlock`,{tier:J.value}))+` `,1),f(n(y),{class:`ml-2 h-4 w-4`})]),_:1})])):(i(),o(`div`,F,[a(`div`,I,[h(e.$slots,`default`)]),a(`button`,{type:`button`,class:m([`absolute inset-0 z-10 flex cursor-pointer items-center justify-center rounded bg-background/50`,t.overlayClass]),title:n(c)(`featureGate.upgradeTitle`),onClick:Y},[t.compact?(i(),o(`span`,R,[f(n(y),{class:`h-3.5 w-3.5`})])):(i(),o(`span`,{key:1,class:m([`flex max-w-sm flex-col items-center gap-1.5 rounded-lg border border-border bg-card/95 px-4 py-3 text-center shadow-sm`,t.boxClass])},[a(`span`,z,[f(n(y),{class:`h-4 w-4`}),a(`span`,B,l(t.title??n(c)(`featureGate.upgradeTitle`)),1)]),t.description?(i(),o(`span`,V,l(t.description),1)):g(``,!0),a(`span`,H,l(n(c)(`featureGate.viewPlans`)),1)],2))],10,L)])),f(n(E),{open:K.value,"onUpdate:open":s[1]||=e=>K.value=e},{default:p(()=>[f(n(A),null,{default:p(()=>[f(n(O),null,{default:p(()=>[f(n(w),null,{default:p(()=>[r(l(n(c)(`featureGate.upgradeTitle`)),1)]),_:1}),f(n(T),null,{default:p(()=>[r(l(t.description??n(c)(`featureGate.upgradeDescription`,{feature:J.value})),1)]),_:1})]),_:1}),f(n(k),null,{default:p(()=>[f(n(j),{onClick:s[0]||=e=>K.value=!1},{default:p(()=>[r(l(n(c)(`button.cancel`)),1)]),_:1}),f(n(D),{onClick:X},{default:p(()=>[r(l(n(c)(`featureGate.viewPlans`)),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`open`])],64)):h(e.$slots,`default`,{},void 0,void 0,0)}});export{U as t};