import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useState as d}from"react";import{D as c,a as p,b as f,c as h}from"./dialog-BfGkTFdF.js";import{B as g}from"./button-BvFBRYHq.js";import{L as u}from"./label-DMnntKPk.js";import{C as x}from"./checkbox-DXBO59MA.js";import"@radix-ui/react-dialog";import"lucide-react";import"./utils-CMbmcP35.js";import"clsx";import"tailwind-merge";import"@radix-ui/react-slot";import"class-variance-authority";import"@radix-ui/react-label";import"@radix-ui/react-checkbox";function B({isOpen:l,onClose:s,news:o}){const[r,n]=d(!1),a=()=>{if(o&&r){const t=`news_popup_dismissed_${o.id}`;if(o.popup_frequency==="daily"){const m=Date.now()+864e5;localStorage.setItem(t,JSON.stringify({dismissed:!0,expiry:m}))}else localStorage.setItem(t,"true")}s()};return o?e(c,{open:l,onOpenChange:a,children:i(p,{className:"max-w-2xl overflow-hidden flex flex-col p-0 gap-0",children:[e(f,{className:"p-6 pb-2",children:e("div",{className:"flex items-center justify-between",children:e(h,{className:"text-xl font-bold",children:o.title})})}),i("div",{className:"px-6 py-2 overflow-y-auto",children:[o.image&&e("div",{className:"mb-4 rounded-lg overflow-hidden border bg-muted/50 flex items-center justify-center",children:e("img",{src:`/storage/${o.image}`,alt:o.title,className:"max-w-full max-h-64 object-contain"})}),e("div",{className:"prose prose-sm dark:prose-invert max-w-none text-muted-foreground",dangerouslySetInnerHTML:{__html:o.content}})]}),i("div",{className:"p-6 pt-4 mt-4 border-t bg-muted/20 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[i("div",{className:"flex items-center space-x-2",children:[e(x,{id:"dont-show-again",checked:r,onCheckedChange:t=>n(t)}),e(u,{htmlFor:"dont-show-again",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Don't show this again"})]}),e(g,{onClick:a,children:"Close"})]})]})}):null}export{B as WelcomeModal};
