1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{b as A,a as M,r as f}from"./vendor-react-E98sgxjj.js";import{u as T,b as F,c as $,F as G,j as u,S as L,G as I,p as R}from"./index-BKzE8EQ8.js";import{u as W,a as x}from"./vendor-query-bOUN_gKe.js";import{du as B}from"./vendor-fa-Bn2dnpnC.js";import{u as U}from"./useDevModelsVisible-BHgONHQI.js";import{S as V}from"./SettingsPageShell-wmP4-RpH.js";function X(){const{t:s,i18n:p}=T("settings"),{user:r,refreshUser:b}=F(),{setTheme:k,isDark:o}=$(),{lang:m}=A(),v=M(),[l,y]=U(),[c,P]=G(),{data:n,refetch:D}=W({queryKey:["notification-preferences"],queryFn:u.getNotificationPreferences,enabled:!!r}),C=x({mutationFn:u.updateNotificationPreferences,onSuccess:()=>{D()}}),j=(t,a)=>{C.mutate({[t]:a})},[S,w]=f.useState(null),d=S??r?.ads_enabled??!0,N=x({mutationFn:t=>u.updateProfile({ads_enabled:t}),onSuccess:()=>{b()},onError:()=>w(null)}),_=()=>{const t=!d;w(t),N.mutate(t)},[E,h]=f.useState(r?.engine_preference??null);f.useEffect(()=>{h(r?.engine_preference??null)},[r?.engine_preference]);const g=x({mutationFn:t=>u.setEnginePreference(t),onSuccess:()=>{b()},onError:()=>{h(r?.engine_preference??null)}});return e.jsxs(V,{title:s("pages.preferences.pageTitle","Preferences | Tesana"),heading:s("pages.preferences.heading","Preferences"),subtitle:s("pages.preferences.subtitle","Personalize how Tesana looks and how it notifies you."),children:[e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg text-foreground mb-4",children:s("appearance.title")}),e.jsx("div",{className:"bg-card rounded-md border border-border p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-base text-foreground",children:s("appearance.theme")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("appearance.themeDescription")})]}),e.jsx("button",{onClick:()=>k(o?"light":"dark"),className:"relative w-14 h-8 rounded-full transition-colors duration-300 cursor-pointer flex-shrink-0",style:{backgroundColor:o?"var(--color-green-500)":"var(--color-surface)"},"aria-label":s("appearance.switchToMode",{mode:s(o?"appearance.light":"appearance.dark")}),children:e.jsx("div",{className:`absolute top-1 w-6 h-6 rounded-full ${o?"bg-white":"bg-background"} shadow-sm flex items-center justify-center transition-all duration-300`,style:{left:o?"calc(100% - 28px)":"4px"},children:e.jsx(B,{icon:["far",o?"moon":"sun-bright"],className:`text-[10px] ${o?"text-background":"text-foreground"}`})})})]})})]}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg text-foreground mb-4",children:s("language.title")}),e.jsx("div",{className:"bg-card rounded-md border border-border p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-base text-foreground",children:s("language.label")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("language.description")})]}),e.jsx("select",{value:m||p.language,onChange:t=>{const a=t.target.value;p.changeLanguage(a),localStorage.setItem("onetap_language",a);const i=m?v.pathname.replace(`/${m}`,""):v.pathname;window.location.href=R(i||"/",a)},className:"h-9 px-3 rounded-md text-sm bg-transparent border border-border text-foreground focus:outline-none focus:border-foreground transition-all cursor-pointer appearance-none pr-8",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 8px center"},children:L.map(t=>e.jsx("option",{value:t,children:I[t]},t))})]})})]}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg text-foreground mb-4",children:s("ads.title","Ads")}),e.jsx("div",{className:"bg-card rounded-md border border-border p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"pr-6",children:[e.jsx("p",{className:"text-base text-foreground",children:s("ads.showAds","Show ads in games")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("ads.showAdsDescription","Turn this off and games never show you an ad. It applies everywhere, including games that allow ads.")})]}),e.jsx("button",{onClick:_,disabled:N.isPending,className:"relative w-14 h-8 rounded-full transition-colors duration-300 cursor-pointer flex-shrink-0 disabled:opacity-50",style:{backgroundColor:d?"var(--color-green-500)":"var(--color-surface)"},role:"switch","aria-checked":d,"aria-label":s("ads.showAds","Show ads in games"),children:e.jsx("div",{className:`absolute top-1 w-6 h-6 rounded-full ${d?"bg-foreground":"bg-background"} shadow-sm transition-all duration-300`,style:{left:d?"calc(100% - 28px)":"4px"}})})]})})]}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg text-foreground mb-4",children:s("notifications.title")}),e.jsxs("div",{className:"bg-card rounded-md border border-border p-6 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-base text-foreground",children:s("notifications.emailNotifications")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("notifications.emailDescription")})]}),e.jsx("button",{onClick:()=>j("email_enabled",!n?.email_enabled),className:"relative w-14 h-8 rounded-full transition-colors duration-300 cursor-pointer flex-shrink-0",style:{backgroundColor:n?.email_enabled?"var(--color-green-500)":"var(--color-surface)"},children:e.jsx("div",{className:`absolute top-1 w-6 h-6 rounded-full ${n?.email_enabled?"bg-white":"bg-background"} shadow-sm transition-all duration-300`,style:{left:n?.email_enabled?"calc(100% - 28px)":"4px"}})})]}),e.jsxs("div",{className:"pt-3 border-t border-border",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:s("notifications.notifyMeAbout")}),e.jsx("div",{className:"space-y-3",children:[{key:"game_status_updates",label:s("notifications.pref.gameStatusUpdates"),desc:s("notifications.pref.gameStatusUpdatesDesc")},{key:"game_purchases",label:s("notifications.pref.gamePurchases"),desc:s("notifications.pref.gamePurchasesDesc")},{key:"iap_purchases",label:s("notifications.pref.iapPurchases"),desc:s("notifications.pref.iapPurchasesDesc")}
1,{key:"game_comments",label:s("notifications.pref.gameComments"),desc:s("notifications.pref.gameCommentsDesc")},{key:"game_favorites",label:s("notifications.pref.gameFavorites"),desc:s("notifications.pref.gameFavoritesDesc")},{key:"analytics_digest",label:s("notifications.pref.analyticsDigest"),desc:s("notifications.pref.analyticsDigestDesc")}].map(({key:t,label:a,desc:i})=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-foreground",children:a}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i})]}),e.jsx("button",{onClick:()=>j(t,!n?.[t]),className:"relative w-12 h-7 rounded-full transition-colors duration-300 cursor-pointer flex-shrink-0",style:{backgroundColor:n?.[t]?"var(--color-green-500)":"var(--color-surface)"},children:e.jsx("div",{className:`absolute top-0.5 w-6 h-6 rounded-full ${n?.[t]?"bg-white":"bg-background"} shadow-sm transition-all duration-300`,style:{left:n?.[t]?"calc(100% - 26px)":"2px"}})})]},t))})]})]})]}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg text-foreground mb-4",children:s("engine.title","Engine")}),e.jsx("div",{className:"bg-card rounded-md border border-border p-6",children:e.jsxs("div",{className:"flex items-center justify-between gap-6",children:[e.jsxs("div",{className:"pr-6",children:[e.jsx("p",{className:"text-base text-foreground",children:s("engine.label","Engine for new games")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("engine.description","Which engine builds your next game. Games you have already made are not affected â each one keeps the engine it was built with.")}),g.isError&&e.jsx("p",{className:"text-sm text-red-500 mt-2",children:s("engine.saveFailed","Couldn't save that. Please try again.")})]}),e.jsxs("select",{value:E??"",onChange:t=>{const a=t.target.value,i=a===""?null:a;h(i),g.mutate(i)},disabled:g.isPending,"aria-label":s("engine.label","Engine for new games"),className:"h-9 px-3 rounded-md text-sm bg-transparent border border-border text-foreground focus:outline-none focus:border-foreground transition-all cursor-pointer appearance-none pr-8 flex-shrink-0 disabled:opacity-50",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 8px center"},children:[e.jsx("option",{value:"",children:s("engine.optionDefault","Default (Web)")}),e.jsx("option",{value:"web",children:s("engine.optionWeb","Web")}),e.jsx("option",{value:"godot",children:s("engine.optionGodot","Godot")})]})]})})]}),r?.can_use_dev_models&&e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg text-foreground mb-4",children:s("developer.title","Developer")}),e.jsx("div",{className:"bg-card rounded-md border border-border p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"pr-6",children:[e.jsx("p",{className:"text-base text-foreground",children:s("developer.showDevModels","Show internal models")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("developer.showDevModelsDescription","Include the internal dev-only tiers in the model picker. Turn off to see the picker exactly as a customer does. Only affects this browser â it does not change your access.")})]}),e.jsx("button",{onClick:()=>y(!l),className:"relative w-14 h-8 rounded-full transition-colors duration-300 cursor-pointer flex-shrink-0",style:{backgroundColor:l?"var(--color-green-500)":"var(--color-surface)"},role:"switch","aria-checked":l,"aria-label":s("developer.showDevModels","Show internal models"),children:e.jsx("div",{className:`absolute top-1 w-6 h-6 rounded-full ${l?"bg-white":"bg-background"} shadow-sm transition-all duration-300`,style:{left:l?"calc(100% - 28px)":"4px"}})})]})})]}),r?.is_staff&&e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg text-foreground mb-4",children:"Staff"}),e.jsx("div",{className:"bg-card rounded-md border border-border p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"pr-6",children:[e.jsx("p",{className:"text-base text-foreground",children:"Show routing details"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:`Route pills on messages (Auto â Guide, Talk or Build, with the router's reason on hover), the "Working out what you need" line while it decides, and Details under error references. Only affects this browser.`})]}),e.jsx("button",{"data-testid":"staff-diagnostics-switch",onClick:()=>P(!c),className:"relative w-14 h-8 rounded-full transition-colors duration-300 cursor-pointer flex-shrink-0",style:{backgroundColor:c?"var(--color-green-500)":"var(--color-surface)"},role:"switch","aria-checked":c,"aria-label":"Show routing details",children:e.jsx("div",{className:`absolute top-1 w-6 h-6 rounded-full ${c?"bg-white":"bg-background"} shadow-sm transition-all duration-300`,style:{left:c?"calc(100% - 28px)":"4px"}})})]})})]})]})}export{X as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.