import{r as e,s as t}from"./rolldown-runtime-C5c2KzVm.js";import{$P as n}from"./lucide-C4oWPzu4.js";import{r}from"./bundle-mjs-C4g7ASB5.js";import{n as i}from"./dist-Cw-z5Xb0.js";import{t as a}from"./switch-BRdc8lwR.js";import{t as o}from"./button-B-NlEi4h.js";import{t as s}from"./textarea-BJ2TI6HZ.js";import{Zn as c,qn as l}from"./console-BA0IzvI-.js";import{t as u}from"./page-container-5wXiFE1n.js";var d=e({default:()=>m}),f=t(n(),1),p=r();function m(){let[e,t]=(0,f.useState)(!1),[n,r]=(0,f.useState)(``),{data:d,isLoading:m}=l(),h=c();return(0,f.useEffect)(()=>{d&&(t(d.enabled),r(d.notice||``))},[d]),(0,p.jsx)(u,{children:(0,p.jsxs)(`div`,{className:`space-y-4 px-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h1`,{className:`text-lg font-semibold`,children:`卡密设置`}),(0,p.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`配置卡密相关功能`})]}),(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(`h2`,{className:`text-[14px] font-medium`,children:`是否启用功能`}),(0,p.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`开启或关闭卡密兑换功能`})]}),(0,p.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,p.jsx)(a,{checked:e,onCheckedChange:t}),(0,p.jsx)(`span`,{className:`text-sm`,children:e?`已启用`:`已禁用`})]}),(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(`h2`,{className:`text-[14px] font-medium`,children:`兑换须知`}),(0,p.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`用户兑换卡密时需要了解的重要信息`})]}),(0,p.jsx)(s,{value:n,onChange:e=>r(e.target.value),placeholder:`请输入兑换须知内容，每条须知占一行...`,className:`min-h-32 w-full resize-none md:w-md`,rows:6}),(0,p.jsx)(`div`,{className:`flex justify-start`,children:(0,p.jsx)(o,{onClick:async()=>{try{await h.mutateAsync({enabled:e,notice:n.trim()||void 0}),i.success(`保存成功`)}catch(e){i.error(e?.message||`保存失败`)}},loading:h.isPending||m,children:`保存`})})]})})}export{d as n,m as t};