import{_ as k}from"./BtsG96Qa.js";import{d as x,f as C,g as f,e as d,o,E as h,m as e,l as i,ag as N,a as p,c as w,w as c,n as u,t as g}from"./Dk4AzF7j.js";const B={key:0,class:"absolute -top-2 left-2 flex gap-1 z-10"},P={key:2,class:"text-xs text-gray-500 dark:text-gray-400 italic p-2 text-center"},S=x({__name:"PolicyGuard",props:{flagName:{},defaultState:{default:"open"},debugger:{type:Boolean,default:!1},trackingContext:{}},setup(m){const r=m;if(!r.flagName)throw new Error('PolicyGuard: "flagName" prop is required');const{usePolicyGuardDetailedReactive:_}=C(),a=_(()=>r.flagName,{skipWhileLoading:!0,defaultState:r.defaultState,trackingContext:r.trackingContext}),n=f(()=>!1),b=f(()=>n.value?`relative border-2 border-dashed p-2 rounded-md ${a.value.enabled?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-red-500 bg-red-50 dark:bg-red-950/20"}`:""),y=t=>({policy:"primary",envPolicy:"secondary",sku:"warning",envSku:"warning",environment:"neutral",devOverride:"error",default:"neutral",loading:"info"})[t]||"neutral",v=t=>t.length>30?t.substring(0,27)+"...":t;return(t,s)=>{const l=k;return o(),d("div",{class:h(e(b))},[e(n)?(o(),d("div",B,[p(l,{color:y(e(a).source),variant:"solid",size:"xs"},{default:c(()=>[u(g(t.flagName),1)]),_:1},8,["color"]),p(l,{color:e(a).enabled?"success":"error",variant:"outline",size:"xs",title:e(a).reason},{default:c(()=>[u(g(v(e(a).reason)),1)]),_:1},8,["color","title"]),e(a).hasOverride?(o(),w(l,{key:0,color:"error",variant:"solid",size:"xs"},{default:c(()=>[...s[0]||(s[0]=[u(" override ",-1)])]),_:1})):i("",!0)])):i("",!0),e(a).enabled?N(t.$slots,"default",{key:1}):e(n)?(o(),d("div",P," Content hidden by policy: "+g(e(a).reason),1)):i("",!0)],2)}}}),D=Object.assign(S,{__name:"PolicyGuard"});export{D as _};
