import{u as i,d as l,t as m,z as h,j as e,aO as d,aP as u}from"./vendor-laZsiqLO.js";import{u as g}from"./useTranslation-BW0o-tkY.js";import{B as p}from"./button-B8f8jW4H.js";import{D as k,a as x,b as j,c as n}from"./dropdown-menu-CpMN0BZ0.js";function f(){const{auth:r}=i().props,s=r.user;return{updateTheme:async t=>{if(!s){console.log("Guest theme changed. Not saving to backend.");return}const o=s.role==="admin"?"/api/admin/theme":"/api/user/theme";try{await l.patch(o,{theme:t})}catch(c){console.error("Failed to save theme preference:",c),m.error("Could not save your theme preference.")}}}}function y(){const{setTheme:r}=h(),{updateTheme:s}=f(),{t:a}=g(),t=o=>{r(o),s(o)};return e.jsxs(k,{children:[e.jsx(x,{asChild:!0,children:e.jsxs(p,{variant:"ghost",size:"icon",children:[e.jsx(d,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(u,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),e.jsx("span",{className:"sr-only",children:a("_toggle_theme","Toggle theme")})]})}),e.jsxs(j,{align:"end",children:[e.jsx(n,{onClick:()=>t("light"),children:a("_theme_light","Light")}),e.jsx(n,{onClick:()=>t("dark"),children:a("_theme_dark","Dark")}),e.jsx(n,{onClick:()=>t("system"),children:a("_theme_system","System")})]})]})}function C({className:r="h-8 w-auto"}){const{site_settings:s}=i().props,a=s?.site_name||"Titan News",t=s?.site_logo_light||s?.site_logo,o=s?.site_logo_dark||t;return!t&&!o?e.jsx("span",{className:`font-black font-serif tracking-tight text-primary ${r} flex items-center`,children:a}):e.jsxs(e.Fragment,{children:[t&&e.jsx("img",{src:t,alt:a,className:`block dark:hidden object-contain ${r}`}),o&&e.jsx("img",{src:o,alt:a,className:`${t?"hidden dark:block":"block"} object-contain ${r}`})]})}export{C as S,y as T};
