import{r as c,d as h,o as p,c as d,f,a as b,e as n,F as g,j as w,t as k}from"./vendor-nt8ldNfT.js";const y=c(""),o=c("light"),C=async()=>{try{const a=await(await fetch("/api/webset")).json();a.status===200&&a.data?(!localStorage.getItem("theme-selected")&&a.data.theme?(o.value=a.data.theme,document.documentElement.setAttribute("data-theme",o.value),localStorage.setItem("theme",o.value)):r(),a.data.backgroundUrl&&(y.value=a.data.backgroundUrl)):r()}catch(e){console.error("加载主题和背景失败",e),r()}},r=()=>{const e=localStorage.getItem("theme");e&&(o.value=e,document.documentElement.setAttribute("data-theme",e))},i=e=>{o.value=e,document.documentElement.setAttribute("data-theme",e),localStorage.setItem("theme",e),localStorage.setItem("theme-selected","1")},_={key:0,class:"fixed bottom-4 right-4 z-50"},x={class:"dropdown dropdown-top dropdown-end"},S={tabindex:"0",class:"dropdown-content z-[100] flex flex-col gap-2 p-4 shadow bg-base-200 rounded-box w-52 max-h-96 overflow-auto"},T=["onClick"],U=h({__name:"ThemeSwitcher",setup(e){const a=[{label:"浅色",value:"light"},{label:"暗色",value:"dark"},{label:"可爱",value:"cupcake"},{label:"小蜜蜂",value:"bumblebee"},{label:"祖母绿",value:"emerald"},{label:"公司风",value:"corporate"},{label:"合成波",value:"synthwave"},{label:"复古",value:"retro"},{label:"赛博朋克",value:"cyberpunk"},{label:"情人节",value:"valentine"},{label:"万圣节",value:"halloween"},{label:"花园",value:"garden"},{label:"森林",value:"forest"},{label:"水世界",value:"aqua"},{label:"怀旧风",value:"lofi"},{label:"粉彩",value:"pastel"},{label:"魔幻",value:"fantasy"},{label:"线框",value:"wireframe"},{label:"纯黑",value:"black"},{label:"奢华",value:"luxury"},{label:"德古拉",value:"dracula"},{label:"CMYK印刷",value:"cmyk"},{label:"秋季",value:"autumn"},{label:"商业",value:"business"},{label:"酸性",value:"acid"},{label:"柠檬水",value:"lemonade"},{label:"夜晚",value:"night"},{label:"咖啡",value:"coffee"},{label:"冬季",value:"winter"},{label:"微暗",value:"dim"},{label:"北欧",value:"nord"},{label:"夕阳",value:"sunset"},{label:"焦糖拿铁",value:"caramellatte"},{label:"深渊",value:"abyss"},{label:"丝绸",value:"silk"}],s=c(!1),m=l=>{i(l)};function v(){const t=new URL(window.location.href).pathname.replace(/\/+$/,"");s.value=t===""||t==="/login.html"}return p(()=>{v();const l=localStorage.getItem("theme");l&&i(l)}),(l,t)=>s.value?(b(),d("div",_,[n("div",x,[t[0]||(t[0]=n("label",{tabindex:"0",class:"text-2xl text-white bg-primary p-3 rounded-full shadow-lg cursor-pointer hover:bg-secondary iconfont icon-qiehuanzhuti","data-tip":"切换主题"},null,-1)),n("div",S,[(b(),d(g,null,w(a,u=>n("button",{key:u.value,class:"btn btn-sm btn-block justify-start capitalize",onClick:I=>m(u.value)},k(u.label),9,T)),64))])])])):f("",!0)}});export{U as _,y as c,C as l};
