import{bN as f,L as b,bc as x,ay as v,p as A,aJ as C,aI as E,iw as I,v as N,f as j,e as T,ao as e,aP as d,ap as m,dL as _,d as L}from"./app-k0jcl5PQ.js";import{S as P}from"./EHuWazu9.chunk.js";import{a as w}from"./ApI7cEru.chunk.js";import"./CCtuxSlD.chunk.js";import"./CPXlV0fg.chunk.js";import"./DXxHdeNz.chunk.js";import"./CpGXOT1_.chunk.js";import"./DkDkjje4.chunk.js";import"./hKqzfsO4.chunk.js";import"./fstW5ZQE.chunk.js";import"./9ls1F1Ve.chunk.js";import"./DRKUY7jf.chunk.js";const y="_themeCard_19dai_1",k="_themeImageWrapper_19dai_10",H="_themeImage_19dai_10",p={themeCard:y,themeImageWrapper:k,themeImage:H},R="settings.appearanceSettings",t=b.encloseNamespace(R);function g({label:a,imageUrl:i,isSelected:n,onSelect:s}){const o=m("d-flex align-items-stretch border rounded-3 overflow-hidden bg-transparent p-0 cursor-pointer",p.themeCard,n&&"border-blue bg-light-blue");return e.jsxs("button",{type:"button",className:o,onClick:s,children:[e.jsx("div",{className:m("d-flex align-items-center justify-content-center flex-shrink-0 overflow-hidden",p.themeImageWrapper),children:e.jsx("img",{src:i,alt:"",role:"presentation",className:m("object-fit-cover",p.themeImage)})}),e.jsx("div",{className:"d-flex align-items-center flex-grow-1 p-3",children:a})]})}function F(){f({title:t("pageTitle")});const a=x(),{canAccess:i,isLoaded:n}=w(),{preferredTheme:s,updateCustomerSetting:o,isLoadingSettings:c}=v(A.Settings),[r,l]=C.useState(s);E.useEffect(()=>{c||l(s)},[c]);const h=I();if(n&&!i){N.trigger({application:T.SETTINGS,action:j.Settings.HOME},{replace:!0});return}function u(){const S={name:L.PreferredTheme,value:r,kind:_.Setting};o(S,()=>{a.success(t("saveSuccess")),h(["classifications","^classification:","widget","search:trending:topics","search:suggestions"])},()=>a.error(t("saveError")))}return c||!n?null:e.jsxs(P,{heading:t("heading"),breadcrumbs:[t("breadcrumb")],children:[e.jsx("p",{children:t("description")}),e.jsxs("div",{className:"d-flex flex-column flex-sm-row gap-3 mb-4",children:[e.jsx(g,{label:t("illustration"),imageUrl:d.Settings.APPEARANCE.ILLUSTRATION_THEME,isSelected:r==="",onSelect:()=>l("")}),e.jsx(g,{label:t("photography"),imageUrl:d.Settings.APPEARANCE.PHOTO_THEME,isSelected:r==="photo",onSelect:()=>l("photo")})]}),e.jsx("button",{type:"button",className:"btn btn-dark",onClick:u,disabled:r===s,children:t("saveChanges")})]})}export{F as AppearanceSettingsView};
//# sourceMappingURL=Bwnp0GBb.chunk.js.map
