solorice/config/spicetify/Extracted/Raw/xpui/xpui-routes-desktop-settings.js
Kristofers Solo a42ded1119 Use dotter
2024-08-28 09:02:07 +03:00

2 lines
46 KiB
JavaScript
Executable File

"use strict";(("undefined"!=typeof self?self:global).webpackChunkclient_web=("undefined"!=typeof self?self:global).webpackChunkclient_web||[]).push([[2391,6457],{92382:(e,t,s)=>{s.r(t),s.d(t,{DesktopSettings:()=>Cs,default:()=>Ms});var n=s(30758),i=s(81987),r=s(11808),a=s(41978),l=s(9183),o=s(57735),c=s(13548),d=s(60137),u=s(94479),g=s(52352),h=s(38273);const p="xpVsqMQfmc20cBLG04zw";var x=s(86070);const m=({dsaModeEnabled:e,setDsaModeEnabled:t})=>{const s=(0,a.wA)(),i=(0,l.zy)(),m=new URLSearchParams(i.search).get("highlight"),j=(0,n.useRef)(null);return(0,n.useEffect)((()=>{m?.includes("dsa")&&j.current&&(j.current.focus(),document.documentElement.classList.remove("no-focus-outline"))}),[m]),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("web-player.settings.personalized-recommendations"),children:[(0,x.jsxs)(g.q,{className:p,children:[(0,x.jsx)(c.W,{htmlFor:"settings.dsaMode",children:r.Ru.get("web-player.settings.personalized-recommendations")}),(0,x.jsx)(c.W,{htmlFor:"settings.dsaMode",variant:"marginal",children:r.Ru.get("web-player.settings.personalized-recommendations-body-text")})]}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.dsaMode",value:!e,onSelected:e=>{e?t(!e):s(h.UU.actions.open({onConfirm:()=>t(!e)}))},inputRef:j})})]})};var j=s(97500),f=s.n(j),y=s(81549),k=s(15549),v=s(69203);const R={section:"x-settings-section",hidden:"afyQ2L5zTtlSDtn9WPjd"};function b({children:e,filterMatchQuery:t}){const{filter:s}=(0,n.useContext)(k.g),{setSectionMatch:i,sectionContainsMatch:r}=(0,v.A)(),a=(0,y.C)(s,t);(0,n.useEffect)((()=>{i(a)}),[a,i]);const l=!a&&!r;return(0,x.jsx)("div",{className:f()(R.section,{[R.hidden]:l}),children:e})}function w(e){return(0,x.jsx)(v.R,{children:(0,x.jsx)(b,{...e})})}var S=s(12783),C=s(26694);function M({children:e,className:t,semanticColor:s="textBase"}){const{filter:i}=(0,n.useContext)(k.g);return(0,x.jsx)(S.E,{as:"h2",variant:"bodyMediumBold",semanticColor:s,className:t,children:(0,x.jsx)(C.M,{searchWords:[i],textToHighlight:e})})}var F=s(69898),Q=s(25639),N=s(24563),A=s(39733);const q=new(s(15742).l)("changeAttributes","mutation","ac50e9d82b3b8303c73512f297140e774a69eb0d6250769b5669e69b4be28886",null);var E=s(52608),_=s(67196),W=(s(40814),s(74494));const L=["personalizedRecommendations"],z=()=>{const{getGraphQLLoader:e}=(0,A.mv)(),t=e(),s=(0,F.jE)(),i=((0,_.g)(),(0,a.wA)()),r=!(0,E.n)(),l="1"===(0,W.$)("dsa-mode-enabled"),o="1"===(0,W.$)("dsa-mode-available"),c=(0,n.useCallback)((async e=>{if(r)throw new Error("User has to be online");await async function(e,t){const s=await e(q,{input:{dsaModeEnabled:t,birthdate:null,filterAgeRestrictedContent:null,filterExplicitContent:null,lockFilterExplicitContent:null,optInTrialPremiumOnlyMarket:null}}),{errors:n,data:i}=s||{};if(!i?.changeUserAccountAttributes)throw n&&n.length>0?new Error(`GraphQL error: ${n[0].message}`):new Error("Unknown GraphQL error!");if("ChangeUserAccountAttributesResult"!==i.changeUserAccountAttributes.__typename||"ChangeUserAccountAttributesResult"===i.changeUserAccountAttributes.__typename&&!i.changeUserAccountAttributes.success)throw new Error("Couldn't successfully set new value")}(t,e)}),[r,t]),d=(0,n.useRef)(l);d.current=l;const{data:u}=(0,Q.I)({queryKey:L,queryFn:()=>d.current});return[o??!1,u??!1,(0,N.n)({mutationFn:c,onMutate:async e=>{await s.cancelQueries({queryKey:L});const t=s.getQueryData(L);return s.setQueryData(L,e),{prevState:t,newState:e}},onError:(e,t,n)=>{s.setQueryData(L,n?.prevState),i(h.bL.actions.open())},onSuccess:()=>{0}}).mutate]},O=({sectionAbove:e})=>{const[t,s,n]=z();return t||e?(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("web-player.settings.content-preferences"),children:[(0,x.jsx)(M,{children:r.Ru.get("web-player.settings.content-preferences")}),e,t&&(0,x.jsx)(m,{dsaModeEnabled:s,setDsaModeEnabled:n})]}):null};let I=function(e){return e.LIBRARY_COMPACT_MODE="library-compact-mode",e.NOW_PLAYING_VIEW="now-playing-view",e.CANVAS_VIDEOS="canvas-videos",e}({});var V=s(37114);const T=e=>{const{spec:t,logger:s}=(0,V.h)();return(0,n.useCallback)((n=>{n?s.logInteraction(t.settingsRowFactory({identifier:e}).hitSettingEnable()):s.logInteraction(t.settingsRowFactory({identifier:e}).hitSettingDisable())}),[e,s,t])};var D=s(39395);const K=()=>{const{libraryRowMode:e,setLibraryRowMode:t}=(0,D.q)(),s=T(I.LIBRARY_COMPACT_MODE),i=(0,n.useCallback)((e=>{s(e),t(e?D.A.COMPACT:D.A.DEFAULT)}),[s,t]);return(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("settings.library.compactMode"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.library.compact-mode",children:r.Ru.get("settings.library.compactMode")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.library.compact-mode",value:e===D.A.COMPACT,onSelected:i})})]})},U=({children:e})=>(0,x.jsx)(x.Fragment,{children:(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("settings.library"),children:[(0,x.jsx)(M,{children:r.Ru.get("settings.library")}),e]})}),H="_czgnX6y44Or6X9pI6gc",B=({children:e,outerRef:t})=>(0,x.jsx)(k.s,{uri:"spotify:internal:settings",children:(0,x.jsx)("div",{ref:t,className:H,"data-testid":"settings-page",children:e})});var P=s(21953),G=s(25763);const Z="O2vRz41OsAH0O7xVA4La",$="y4CT4_q630fWtqu7Zggt";function Y({containerRef:e}){return(0,x.jsxs)("div",{className:Z,children:[(0,x.jsx)(S.E,{as:"h1",variant:"titleMedium",className:$,semanticColor:"textBase",paddingBottom:P.CD,children:r.Ru.get("desktop.settings.settings")}),(0,x.jsx)("div",{children:(0,x.jsx)(G.S,{placeholder:"",alwaysExpanded:!1,clearOnEscapeInElementRef:e,debounceFilterChangeTimeout:0})})]})}const J=({settings:{values:e},setValue:t})=>navigator&&/^win/i.test(navigator.platform)?(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.compatibility"),children:[(0,x.jsx)(M,{children:r.Ru.get("desktop.settings.compatibility")}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.enableHardwareAcceleration"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.enableHardwareAcceleration",children:r.Ru.get("desktop.settings.enableHardwareAcceleration")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.enableHardwareAcceleration",value:!!e["ui.hardware_acceleration"],onSelected:e=>{t("ui.hardware_acceleration",e)}})})]})]}):null;var X=s(21048),ee=s(8159);function te(e){return`${e>0?`+${e}`:e}dB`}var se=s(38389),ne=s(36118);function ie(){const e=(0,ne.G)(),[t,s]=(0,n.useState)(e.getPreset()),i=(0,n.useCallback)((t=>{e.setPreset(t)}),[e]);return(0,n.useEffect)((()=>e.subscribeToPresetChange((e=>{s(e)})))),[t,i]}const re={wrapper:"x-settings-equalizerPanelWrapper",preset:"x-settings-equalizerPanelPreset",filters:"x-settings-equalizerPanelFilters",filter:"x-settings-equalizerPanelFilter",input:"x-settings-equalizerPanelInput",label:"x-settings-equalizerPanelLabel",gainLabel:"x-settings-equalizerPanelGainLabel",gainLabelUp:"x-settings-equalizerPanelGainLabelUp",gainLabelDown:"x-settings-equalizerPanelGainLabelDown",canvas:"x-settings-equalizerPanelCanvas"};function ae({filter:e,onChange:t}){const s=(0,ne.G)(),i=(0,n.useRef)(null),[a]=ie();(0,n.useEffect)((()=>{const t=a.filters.find((t=>t.key===e.key));i.current&&t&&(i.current.value=`${t.gain}`)}),[a,e.key]),(0,n.useEffect)((()=>{i.current&&i.current.setAttribute("aria-valuetext",r.Ru.get("equalizer.filterA11yValueText",e.gain))}),[]);const l=(0,ee.YQ)(((e,t)=>{s.setFilterGain(e,t)}),100,{maxWait:200});return(0,x.jsxs)("div",{className:re.filter,children:[(0,x.jsx)("input",{"aria-label":r.Ru.get("equalizer.filterLabel",e.frequency),ref:i,type:"range",min:-se.Zs,max:se.Zs,step:.1,defaultValue:e.gain,className:re.input,onChange:s=>{const n=parseFloat(s.target.value);s.target.setAttribute("aria-valuetext",r.Ru.get("equalizer.filterA11yValueText",n)),l(e.key,n),t(n)}}),(0,x.jsx)("label",{className:re.label,children:(o=e.frequency,o>=1e3?o/1e3+"KHz":`${o}Hz`)})]});var o}function le(e,t){e.moveTo(t[0],t[1]);for(let s=2;s<t.length-1;s+=2)e.lineTo(t[s],t[s+1])}function oe(e){const t=.6,s=[],n=e.reduce(((e,t)=>(e.push(t.x),e.push(t.y),e)),[]);n.unshift(e[0].y),n.unshift(e[0].x),n.push(e[e.length-1].x),n.push(e[e.length-1].y);for(let e=2;e<n.length-4;e+=2)for(let i=0;i<=16;i++){const r=(n[e+2]-n[e-2])*t,a=(n[e+4]-n[e])*t,l=(n[e+3]-n[e-1])*t,o=(n[e+5]-n[e+1])*t,c=i/16,d=2*Math.pow(c,3)-3*Math.pow(c,2)+1,u=-2*Math.pow(c,3)+3*Math.pow(c,2),g=Math.pow(c,3)-2*Math.pow(c,2)+c,h=Math.pow(c,3)-Math.pow(c,2),p=d*n[e]+u*n[e+2]+g*r+h*a,x=d*n[e+1]+u*n[e+3]+g*l+h*o;s.push(p),s.push(x)}return s}var ce=s(71306);function de(e,t){const s=e.getContext("2d");s&&(s.clearRect(0,0,e.clientWidth,e.clientHeight),function(e,t,s){const n=t.clientWidth,i=t.clientHeight,r=n/s.length/2;e.beginPath();const a=e.createLinearGradient(n/2,0,n/2,i);a.addColorStop(0,"rgba(11%, 73%, 33%, 100%)"),a.addColorStop(1,"rgba(11%, 73%, 33%, 0%)"),e.fillStyle=a,le(e,oe(s)),e.lineTo(n-r,i),e.lineTo(r,i),e.fill()}(s,e,t),function(e,t){e.beginPath(),e.strokeStyle="rgb(11%, 73%, 33%)",e.lineWidth=4,le(e,oe(t)),e.stroke()}(s,t),function(e,t){e.fillStyle=ce.ONy,t.forEach((t=>{e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fill()}))}(s,t))}const ue=60,ge=300;function he(e,t){const s=t.clientWidth/e.length;return e.map(((e,n)=>({x:n*s+s/2,y:t.clientHeight-(e+se.Zs+3)/(2*se.Zs+6)*t.clientHeight})))}const pe=()=>{const[e,t]=(0,n.useState)(window.devicePixelRatio||1);return(0,n.useEffect)((()=>{const e=()=>{matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`).addEventListener("change",(()=>{t(window.devicePixelRatio),e()}),{once:!0})};e()}),[]),e};var xe=s(26969);function me(e){const t=(0,n.useRef)(null),s=pe(),i=(0,n.useCallback)((()=>{if(!t.current)return;const e=s,n=t.current.getBoundingClientRect();t.current.width=n.width*e,t.current.height=n.height*e,t.current.getContext("2d")?.scale(e,e)}),[s]),r=(0,n.useCallback)((()=>{if(!t.current||!e.current)return;const s=he(e.current,t.current);de(t.current,s)}),[e]),a=(0,n.useCallback)((s=>{if(!t.current||!e.current)return;const n=he(e.current,t.current),i=he(s,t.current);!function(e,t,s){const n=ue*(ge/1e3);let i=0;const r=JSON.parse(JSON.stringify(t)),a=s.map(((e,s)=>e.y-t[s].y)),l=()=>{if(!(i>=n)){for(let e=0;e<r.length;e++){const l=t[e].y,d=a[e];r[e].y=(s=l,o=d,c=i,(c/=n/2)<1?o/2*Math.pow(c,3)+s:(c-=2,o/2*(Math.pow(c,3)+2)+s))}var s,o,c;de(e,r),i++,window.requestAnimationFrame(l)}};window.requestAnimationFrame(l)}(t.current,n,i)}),[e]);return(0,n.useEffect)((()=>{i(),r()}),[i,r]),(0,xe.w)({refOrElement:t,onResize:()=>{i(),r()}}),{canvasRef:t,drawCanvas:r,animateCanvas:a}}function je(){const e=(0,ne.G)(),[t,s]=(0,n.useState)(!1),i=(0,n.useCallback)((t=>{e.setEnabledState(t)}),[e]);return(0,n.useEffect)((()=>e.subscribeToEnabledState(s)),[e]),[t,i]}function fe(){const[e,t]=je(),[s,i]=ie(),a=(0,n.useRef)(s.filters.map((e=>e.gain))),{canvasRef:l,drawCanvas:o,animateCanvas:c}=me(a);return(0,n.useEffect)((()=>{const e=s.filters.map((e=>e.gain));"custom"!==s.key&&c(e),a.current=e}),[s,c]),(0,x.jsxs)("div",{className:re.wrapper,children:[(0,x.jsx)("canvas",{"aria-label":r.Ru.get("equalizer.equalizer"),role:"img",className:re.canvas,ref:l}),(0,x.jsx)("label",{className:f()(re.gainLabel,re.gainLabelUp),children:te(se.Zs)}),(0,x.jsx)("label",{className:f()(re.gainLabel,re.gainLabelDown),children:te(-se.Zs)}),(0,x.jsx)("div",{className:re.filters,dir:"ltr",children:s.filters.map(((s,n)=>(0,x.jsx)(ae,{filter:s,onChange:s=>{a.current[n]=s,o(),e||t(!0),i((0,se.zP)(a.current))}},s.key)))})]})}var ye=s(61074);const ke={container:"x-settings-equalizerPresetsContainer",label:"x-settings-equalizerPresetsLabel"};function ve(){const[e,t]=je(),[s,n]=ie();return(0,x.jsxs)("div",{className:ke.container,children:[(0,x.jsx)(S.E,{as:"label",variant:"bodySmall",semanticColor:"textSubdued",htmlFor:"desktop.equalizer.preset",className:ke.label,children:r.Ru.get("equalizer.presets")}),(0,x.jsxs)(ye.C,{id:"desktop.equalizer.preset",value:s.key,onSelect:s=>{n(s),e||t(!0)},children:["custom"===s.key&&(0,x.jsx)("option",{value:s.key,children:s.displayName}),Object.entries(se.fG).map((([e,t])=>(0,x.jsx)("option",{value:e,children:t.displayName},e)))]})]})}var Re=s(49217);function be(){const[e,t]=je(),[,s]=ie();return(0,x.jsx)(Re.n,{onClick:()=>{s(se.fG.flat.key),e||t(!0)},size:"small",children:r.Ru.get("equalizer.reset")})}function we(){const[e,t]=je();return(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("equalizer.equalizer"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.equalizer",children:r.Ru.get("equalizer.equalizer")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.equalizer",value:e,onSelected:t})})]})}var Se=s(62943);const Ce="x-settings-equalizerSection",Me="x-settings-equalizerWrapper",Fe="x-settings-equalizerResetButtonWrapper";function Qe(){const e=(0,ne.G)();return(0,i.NC)(Se.AM,{loadingValue:!1})&&e.isSupported()?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(we,{}),(0,x.jsx)(d.i,{filterMatchQuery:r.Ru.get("equalizer.equalizer"),children:(0,x.jsxs)("div",{className:Ce,children:[(0,x.jsx)(ve,{}),(0,x.jsx)("div",{className:Me,children:(0,x.jsx)(fe,{})}),(0,x.jsx)("div",{className:Fe,children:(0,x.jsx)(be,{})})]})})]}):null}var Ne=s(19159);const Ae="x-settings-crossFadeContainer",qe=12e3,Ee=({settings:{values:e},setValue:t})=>{const s=(0,i.NC)(Ne.$GE),a=(0,i.NC)(Ne.UrL),l=(0,i.NC)(Ne.tsC),[h,p]=(0,n.useState)(-1),m=-1===h?Number(e["audio.crossfade.time_v2"]):h,j=`${Math.round(m/1e3)} ${r.Ru.get("desktop.settings.sec")}`;return(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.playback"),children:[(0,x.jsx)(M,{children:r.Ru.get("desktop.settings.playback")}),void 0!==e["audio.crossfade_v2"]&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.crossfadeTracks"),children:[(0,x.jsxs)(g.q,{children:[(0,x.jsx)(c.W,{htmlFor:"desktop.settings.crossfadeTracks",children:r.Ru.get("desktop.settings.crossfadeTracks")}),e["audio.crossfade_v2"]&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{className:Ae,children:(0,x.jsx)(X.z2,{value:m,max:qe,step:1e3,labelText:r.Ru.get("desktop.settings.crossfadeTracks"),onStepBackward:()=>{p(Math.max(0,m-1e3))},onStepForward:()=>{p(Math.min(qe,m+1e3))},onDragStart:e=>{p(e*qe)},onDragMove:e=>{p(e*qe)},onDragEnd:e=>{const s=Math.floor(e*qe);p(s),t("audio.crossfade.time_v2",s)}})}),(0,x.jsx)(S.E,{variant:"bodySmall",semanticColor:"textSubdued",children:j})]})]}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.crossfadeTracks",value:!!e["audio.crossfade_v2"],onSelected:e=>{t("audio.crossfade_v2",e)}})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.automixInfo"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.automixInfo",children:r.Ru.get("desktop.settings.automixInfo")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.automixInfo",value:!!e["audio.automix"],onSelected:e=>{t("audio.automix",e)}})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.monoDownmixer"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.monoDownmixer",children:r.Ru.get("desktop.settings.monoDownmixer")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.monoDownmixer",value:!!e["audio.downmixer_v2"],onSelected:e=>{t("audio.downmixer_v2",e)}})})]}),s&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.silenceTrimmer"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.silenceTrimmer",children:r.Ru.get("desktop.settings.silenceTrimmer")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.silenceTrimmer",value:!!e["audio.silence_trimmer_v2"],onSelected:e=>{t("audio.silence_trimmer_v2",e)}})})]}),a&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.dynamicNormalizer"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.dynamicNormalizer",children:r.Ru.get("desktop.settings.dynamicNormalizer")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.dynamicNormalizer",value:!!e["audio.dynamic_normalizer_v2"],onSelected:e=>{t("audio.dynamic_normalizer_v2",e)}})})]}),l&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.otfn"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.otfn",children:r.Ru.get("desktop.settings.otfn")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.otfn",value:!!e["audio.otfn_v2"],onSelected:e=>{t("audio.otfn_v2",e)}})})]}),(0,x.jsx)(Qe,{})]})};var _e=s(26328),We=s(21233),Le=s(65835);const ze={get[_e.WZ.MINIMIZED](){return r.Ru.get("desktop.settings.autostartMinimized")},get[_e.WZ.NORMAL](){return r.Ru.get("desktop.settings.autostartNormal")},get[_e.WZ.OFF](){return r.Ru.get("desktop.settings.autostartOff")}},Oe=(0,We.D)()===Le.f.macOS,Ie=({settings:{values:e},setValue:t})=>(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.startupAndWindowBehavior"),children:[(0,x.jsx)(M,{children:r.Ru.get("desktop.settings.startupAndWindowBehavior")}),void 0!==e["app.autostart-mode"]&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.autostart"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.autostart",children:r.Ru.get("desktop.settings.autostart")})}),(0,x.jsx)(u.n,{children:(0,x.jsxs)(ye.C,{id:"desktop.settings.autostart",value:e["app.autostart-mode"],onSelect:e=>{t("app.autostart-mode",e)},children:[(0,x.jsx)("option",{value:_e.WZ.MINIMIZED,children:ze[_e.WZ.MINIMIZED]}),(0,x.jsx)("option",{value:_e.WZ.NORMAL,children:ze[_e.WZ.NORMAL]}),(0,x.jsx)("option",{value:_e.WZ.OFF,children:ze[_e.WZ.OFF]})]})})]}),!Oe&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.closeShouldMinimize"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.closeShouldMinimize",children:r.Ru.get("desktop.settings.closeShouldMinimize")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.closeShouldMinimize",value:!!e["ui.minimize_to_tray"],onSelected:e=>{t("ui.minimize_to_tray",e)}})})]})]}),Ve={"auto-detect":{label:()=>r.Ru.get("desktop.settings.proxy.autodetect")},"no-proxy":{label:()=>r.Ru.get("desktop.settings.proxy.noproxy")},http:{label:()=>r.Ru.get("desktop.settings.proxy.http")},socks4:{label:()=>r.Ru.get("desktop.settings.proxy.socks4")},socks5:{label:()=>r.Ru.get("desktop.settings.proxy.socks5")}},Te=[{enumKey:"auto-detect",enumValue:0},{enumKey:"no-proxy",enumValue:1},{enumKey:"http",enumValue:2},{enumKey:"socks4",enumValue:3},{enumKey:"socks5",enumValue:4}];var De=s(24538);const Ke="mpdBa62OP4Fr5wvCsa89",Ue="x-proxySettings-ProxySettings",He="x-proxySettings-fullWidth",Be="x-settings-input",Pe="x-proxySettings-horizontalPair",Ge=({id:e,type:t,placeHolder:s,inputRef:n,handleOnChange:i})=>(0,x.jsx)("input",{type:t||"text",id:e,"data-testid":e,className:Be,placeholder:s,ref:n,onChange:i}),Ze=({children:e,label:t})=>(0,x.jsx)(De.g,{label:t,className:Pe,children:e}),$e="wjxwX0Alq8DVfoBObi3R";function Ye({onClick:e}){return(0,x.jsx)(Re.n,{className:$e,onClick:e,children:r.Ru.get("settings.restartApp")})}const Je=(e,t,s)=>{let n=`${e}:${t}`;switch(s){case 2:n+="@http";break;case 3:n+="@socks4";break;case 4:n+="@socks5"}return n},Xe=({addr:e,mode:t="0",pass:s,user:i,setValue:a,restartContainer:l,fullWidth:o})=>{const c=(0,n.useRef)(null),d=(0,n.useRef)(null),u=(0,n.useRef)(null),g=(0,n.useRef)(null),h=Number(t),[p,m]=(0,n.useState)(""),[j,y]=(0,n.useState)(""),[k,v]=(0,n.useState)(!1);(0,n.useEffect)((()=>{const[t,s]=e?.split(/[:@]+/)||["",""];m(t),y(s),c.current&&(c.current.value=t),d.current&&(d.current.value=s)}),[e]),(0,n.useEffect)((()=>{g.current&&s&&(g.current.value=s.toString())}),[s]),(0,n.useEffect)((()=>{u.current&&i&&(u.current.value=i.toString())}),[i]);const R=(0,n.useCallback)((({target:e})=>{const t=Je(e.value,j,h);m(e.value),a("network.proxy.addr",t),v(!0)}),[h,j,a]),b=(0,n.useCallback)((({target:e})=>{const t=Je(p,e.value,h);y(e.value),a("network.proxy.addr",t),v(!0)}),[h,p,a]),S=(0,n.useCallback)((({target:e})=>{a("network.proxy.user",e.value),v(!0)}),[a]),C=(0,n.useCallback)((({target:e})=>{a("network.proxy.pass",e.value),v(!0)}),[a]),F=0!==h&&1!==h,Q=3!==h;return(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.proxy.title"),children:[(0,x.jsx)(M,{children:r.Ru.get("desktop.settings.proxy.title")}),(0,x.jsxs)("div",{className:f()(Ue,o?He:null),children:[(0,x.jsx)(Ze,{label:r.Ru.get("desktop.settings.proxy.type"),children:(0,x.jsx)(ye.C,{id:"network.proxy.mode",value:t,onSelect:e=>{const t=parseInt(e,10);a("network.proxy.mode",t),v(!0)},children:Te.map((({enumKey:e,enumValue:t})=>(0,x.jsx)("option",{value:t,"data-testid":e,children:Ve[e]?Ve[e].label():""},e)))})}),F?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:Ke,children:[(0,x.jsx)(Ze,{label:r.Ru.get("desktop.settings.proxy.host"),children:(0,x.jsx)(Ge,{id:"network.proxy.host",handleOnChange:R,placeHolder:r.Ru.get("desktop.settings.proxy.host"),inputRef:c})}),(0,x.jsx)(Ze,{label:r.Ru.get("desktop.settings.proxy.port"),children:(0,x.jsx)(Ge,{id:"network.proxy.port",type:"number",handleOnChange:b,placeHolder:r.Ru.get("desktop.settings.proxy.port"),inputRef:d})})]}),(0,x.jsxs)("div",{className:Q?Ke:void 0,children:[(0,x.jsx)(Ze,{label:r.Ru.get("desktop.settings.proxy.user"),children:(0,x.jsx)(Ge,{id:"network.proxy.user",handleOnChange:S,placeHolder:r.Ru.get("desktop.settings.proxy.user"),inputRef:u})}),Q?(0,x.jsx)(Ze,{label:r.Ru.get("desktop.settings.proxy.pass"),children:(0,x.jsx)(Ge,{id:"network.proxy.pass",handleOnChange:C,placeHolder:r.Ru.get("desktop.settings.proxy.pass"),type:"password",inputRef:g})}):null]})]}):null,k&&(0,x.jsx)("div",{children:(0,x.jsx)(Ye,{onClick:l})})]})]})};var et=s(90751),tt=s(37929),st=s(45235),nt=s(11926);function it(){const e=(0,nt.B)(),[t,s]=(0,n.useState)(null),[i,r]=(0,n.useState)(!0),[a,l]=(0,n.useState)(null);return(0,n.useEffect)((()=>{const t=window.setInterval((()=>{!async function(){if(null===a){try{const t=await e.getStatistics();s(t)}catch(e){l(e instanceof Error?e:new Error("Error when fetching storage statistics."))}r(!1)}}()}),1500);return()=>clearInterval(t)}),[e,a]),[t,i,a]}const rt="x-settings-button",at="x-settings-wordBreakAll",lt=({settings:e,setValue:t})=>{const s=(0,st.A)(),i=(0,tt.t)(),l=!(0,E.n)(),[o,h]=(0,n.useState)(!1),p=(0,n.useCallback)((()=>{i.applyUpdate()}),[i]),[m,j,f]=it(),y=(0,a.wA)();let k="",v="",R=0;j?(k=r.Ru.get("page.loading"),v=r.Ru.get("page.loading")):f||null===m?(k=r.Ru.get("error.generic"),v=r.Ru.get("error.generic")):(R=m.currentSizeMB-m.currentLockedSizeMB,k=` ${R} MB`,v=` ${m.currentLockedSizeMB} MB`);const b=e.values["storage.location"];return(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.storage"),children:[(0,x.jsx)(M,{children:r.Ru.get("desktop.settings.storage")}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.storage.downloads.heading"),children:[(0,x.jsx)(g.q,{children:(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{children:[(0,x.jsx)(c.W,{htmlFor:"desktop.settings.downloads",semanticColor:"textBase",children:r.Ru.get("desktop.settings.storage.downloads.heading")}),(0,x.jsx)(c.W,{htmlFor:"desktop.settings.downloads",children:v})]}),(0,x.jsx)(c.W,{htmlFor:"desktop.settings.downloads",children:r.Ru.get("desktop.settings.storage.downloads.text")})]})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(Re.n,{id:"desktop.settings.downloads",size:"small",onClick:()=>{y((0,et.KB)())},disabled:l||!m||0===m.currentLockedSizeMB,className:rt,children:r.Ru.get("desktop.settings.storage.downloads.button")})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.storage.cache.heading"),children:[(0,x.jsx)(g.q,{children:(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{children:[(0,x.jsx)(c.W,{htmlFor:"desktop.settings.cache",semanticColor:"textBase",children:r.Ru.get("desktop.settings.storage.cache.heading")}),(0,x.jsx)(c.W,{htmlFor:"desktop.settings.cache",children:k})]}),(0,x.jsx)(c.W,{htmlFor:"desktop.settings.cache",children:r.Ru.get("desktop.settings.storage.cache.text")})]})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(Re.n,{id:"desktop.settings.cache",size:"small",onClick:()=>{y((0,et.cd)())},disabled:0===R,className:rt,children:r.Ru.get("desktop.settings.storage.cache.button")})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.offlineStorageLocation"),children:[(0,x.jsx)(g.q,{children:(0,x.jsxs)("div",{children:[(0,x.jsx)("div",{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.offline-storage",semanticColor:"textBase",children:r.Ru.get("desktop.settings.offlineStorageLocation")})}),(0,x.jsx)(c.W,{htmlFor:"desktop.settings.offline-storage",className:at,children:b})]})}),(0,x.jsxs)(u.n,{children:[(0,x.jsx)(Re.n,{id:"desktop.settings.offline-storage",size:"small",onClick:async()=>{const n=await s.browseForFolder();n.path&&(t("storage.location",n.path),n.path!==e.values["storage.location"]&&h(!0))},className:rt,children:r.Ru.get("desktop.settings.offlineStorageChangeLocation")}),o&&(0,x.jsx)(Ye,{onClick:p})]})]})]})},ot=({settings:e,setValue:t})=>{const s=(0,tt.t)(),i=(0,n.useCallback)((()=>{s.applyUpdate()}),[s]),{values:r}=e;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Ee,{settings:e,setValue:t}),(0,x.jsx)(Ie,{settings:e,setValue:t}),(0,x.jsx)(lt,{settings:e,setValue:t}),(0,x.jsx)(Xe,{setValue:t,restartContainer:i,mode:r["network.proxy.mode"],addr:r["network.proxy.addr"],user:r["network.proxy.user"],pass:r["network.proxy.pass"]}),(0,x.jsx)(J,{settings:e,setValue:t})]})};var ct=s(29107),dt=s(39867),ut=s(45346);const gt="H6jjgcz7zPs9Aaaa8YIG",ht=({settings:{values:e}})=>{const t=(0,ut.W)(),s="1"===e["dsa-mode-enabled"],n=(0,ct.t)(),[{data:i},{mutate:a}]=(0,dt.K)(n.autoPlay);return(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.autoplay"),children:[(0,x.jsx)(M,{className:s?gt:void 0,semanticColor:s?"textSubdued":void 0,children:r.Ru.get("desktop.settings.autoplay")}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.autoplayInfo"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"global.settings.autoplayInfo",className:s?gt:void 0,children:s?r.Ru.get("web-player.settings.autoplay-dsa-enabled"):r.Ru.get("desktop.settings.autoplayInfo")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"global.settings.autoplayInfo",value:!!i,onSelected:e=>{t({intent:e?"enable_autoplay":"disable_autoplay",type:"click"}),a(e)},disabled:s})})]})]})};var pt=s(64245),xt=s(62338),mt=s(93766),jt=s(18024),ft=s(73356);const yt=()=>{const[e,t]=(0,jt.J)(),s=(0,ft.j)(),i=T(I.CANVAS_VIDEOS),a=(0,n.useCallback)((e=>{i(e),t(e)}),[t,i]);return(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("settings.canvasVideos"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.canvasVideos",children:r.Ru.get("settings.canvasVideos")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.canvasVideos",value:e,onSelected:a,disabled:s})})]})};var kt=s(86800);const vt=()=>{const[e,t]=(0,kt.N)(),s=T(I.NOW_PLAYING_VIEW),i=(0,n.useCallback)((e=>{s(e),t(e)}),[t,s]);return(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("settings.npv"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.npv",children:r.Ru.get("settings.npv")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.npv",value:e,onSelected:i})})]})};var Rt=s(45874);const bt=({settings:{values:e},setValue:t})=>{const s=void 0===e.catalogue||"string"==typeof e.catalogue&&"free"===e.catalogue.toLowerCase(),n=(0,Rt.d)(),a=(0,i.NC)(Ne.yJ8),l=n?.client_capabilities?.can_show_system_media_controls,h=n?.client_capabilities?.can_show_track_notifications,{isActive:p,panelSend:m}=(0,pt.AI)(mt.Z.BuddyFeed,mt.Z.BuddyFeedOverlay);return(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("settings.display"),children:[(0,x.jsx)(M,{children:r.Ru.get("settings.display")}),(0,x.jsx)(vt,{}),a!==Ne.NtL.CONTROL&&(0,x.jsx)(yt,{}),!s&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("settings.showMusicAnnouncements"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.showMusicAnnouncements",children:r.Ru.get("settings.showMusicAnnouncements")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.showMusicAnnouncements",value:!e["ui.hide_hpto"],onSelected:e=>{t("ui.hide_hpto",!e)}})})]}),h&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("settings.showTrackNotifications"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.trackNotifications",children:r.Ru.get("settings.showTrackNotifications")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.trackNotifications",value:!!e["ui.track_notifications_enabled"],onSelected:e=>{t("ui.track_notifications_enabled",e)}})})]}),l&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.showSystemMediaControls"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.systemMediaControlsEnabled",children:r.Ru.get("desktop.settings.showSystemMediaControls")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.systemMediaControlsEnabled",value:!!e["ui.system_media_controls_enabled"],onSelected:e=>{t("ui.system_media_controls_enabled",e)}})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("buddy-feed.see-what-your-friends-are-playing"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.showFriendActivity",children:r.Ru.get("buddy-feed.see-what-your-friends-are-playing")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.showFriendActivity",value:p,onSelected:()=>{m(xt.$S.BUDDY_FEED_BUTTON_CLICK)}})})]})]})};var wt=s(64343),St=s(7939),Ct=s(89734);const Mt="m7e5wHq6US9u3BbLQXEX",Ft="ul4DB6lq_3qO_aCiEbcc",Qt=()=>{const e=(0,a.wA)(),{locale:t,user:s,overrides:i}=(0,a.d4)(St.Ht),r=(0,n.useRef)(null),l=(0,n.useRef)(null),o=(0,n.useCallback)((t=>{r.current&&r.current.value&&e((0,Ct.Rv)(t?r.current.value:""))}),[e]),c=(0,n.useCallback)((t=>{l.current&&l.current.value&&e((0,Ct.zf)(t?l.current.value:""))}),[e]),h=i?.country||s?.country,p=i?.locale||t;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.i,{filterMatchQuery:h??"",children:[(0,x.jsx)(g.q,{children:(0,x.jsx)("div",{className:Mt,children:(0,x.jsx)(wt.c,{id:"overrides.country",onChange:e=>{const t=e.target.checked;o(t)},defaultChecked:!!i?.country,children:(0,x.jsx)(S.E,{variant:"bodySmall",semanticColor:"textSubdued",children:"Country"})})})}),(0,x.jsx)(u.n,{children:(0,x.jsx)("input",{type:"text",id:"overrides.country.input",className:Ft,disabled:!i?.country,ref:r,defaultValue:h,onChange:()=>o(!0)})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:i?.locale??"",children:[(0,x.jsx)(g.q,{children:(0,x.jsx)("div",{className:Mt,children:(0,x.jsx)(wt.c,{id:"overrides.locale",onChange:e=>{const t=e.target.checked;c(t)},defaultChecked:!!i?.locale,children:(0,x.jsx)(S.E,{variant:"bodySmall",semanticColor:"textSubdued",children:"Language"})})})}),(0,x.jsx)(u.n,{children:(0,x.jsx)("input",{type:"text",id:"overrides.locale.input",className:Ft,disabled:!i?.locale,ref:l,defaultValue:p,onChange:()=>c(!0)})})]})]})};var Nt=s(42330);const At=({settings:{values:e},setValue:t})=>{const s=(0,Nt.Q)(e),i=(0,tt.t)(),[a,l]=(0,n.useState)(!1),h=(0,n.useCallback)((()=>{i.applyUpdate()}),[i]);return s?(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("settings.employee"),children:[(0,x.jsx)(M,{children:r.Ru.get("settings.employee")}),(0,x.jsx)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.language-override"),children:(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"",children:r.Ru.get("desktop.settings.language-override")})})}),(0,x.jsx)(Qt,{}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.enableDeveloperMode"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.developerMode",children:r.Ru.get("desktop.settings.enableDeveloperMode")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.developerMode",value:!!e["app.enable-developer-mode"],onSelected:e=>{t("app.enable-developer-mode",e),l(!0)}})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.showChromeToolbar"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.chromiumToolbar",children:r.Ru.get("desktop.settings.showChromeToolbar")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.chromiumToolbar",value:!!e["app.show-chrome-toolbar"],onSelected:e=>{t("app.show-chrome-toolbar",e),l(!0)}})})]}),a&&(0,x.jsx)("div",{children:(0,x.jsx)(Ye,{onClick:h})})]}):null},qt=({settings:{values:e},setValue:t})=>{const s="1"===e["lock-filter-explicit-content"],n="0"===e["filter-explicit-content"]||void 0===e["filter-explicit-content"],i=s?r.Ru.get("desktop.settings.explicitContentFilterSettingLocked"):r.Ru.get("desktop.settings.explicitContentFilterSetting");return(0,x.jsxs)(d.i,{filterMatchQuery:i,children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.explicitContentFilter",children:i})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.explicitContentFilter",disabled:s,value:n,onSelected:e=>{t("filter-explicit-content",e?"0":"1")}})})]})},Et=({settings:e,setValue:t})=>(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.explicitContentFilter"),children:[(0,x.jsx)(M,{children:r.Ru.get("desktop.settings.explicitContentFilter")}),(0,x.jsx)(qt,{settings:e,setValue:t})]});var _t=s(26119);const Wt=()=>{const e=(0,tt.t)(),t=(0,ct.t)(),[{data:s},{mutate:i}]=(0,dt.K)(t.language),a=(0,n.useCallback)((()=>{e.applyUpdate()}),[e]);return void 0===s?null:(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.language"),children:[(0,x.jsx)(M,{children:r.Ru.get("desktop.settings.language")}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.selectLanguage"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.selectLanguage",children:r.Ru.get("desktop.settings.selectLanguage")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(ye.C,{dir:"auto",value:s,id:"desktop.settings.selectLanguage",onSelect:i,children:_t.J2.map((e=>(0,x.jsx)("option",{value:e,children:`${_t.IB[e].displayName} (${_t.IB[e].displayNameEn})`},e)))})})]}),r.Ru.getLocaleForTranslation()!==s?(0,x.jsx)(Ye,{onClick:a}):null]})};var Lt=s(76149);const zt=()=>{const[e,t]=(0,Lt.y)();return(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("settings.showLocalFiles"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"settings.showLocalFiles",children:r.Ru.get("settings.showLocalFiles")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"settings.showLocalFiles",value:e,onSelected:e=>{t(e)}})})]})};var Ot=s(87832),It=s(48168);const Vt=e=>void 0!==e.id;function Tt(e){let t;if(!Vt(e))return e.path;switch(e.id){case It.kW.DOWNLOADS:t=r.Ru.get("local-files.source.downloads");break;case It.kW.ITUNES:t=r.Ru.get("local-files.source.itunes");break;case It.kW.MY_MUSIC:t=r.Ru.get("local-files.source.my_music");break;case It.kW.WINDOWS_MUSIC_LIBRARY:t=r.Ru.get("local-files.source.windows_music_library");break;default:t=String(e.id)}return t}const Dt=({source:e,onAddOrRemoveSource:t})=>{const[s,i]=(0,n.useState)(!Vt(e)||e.enabled),r=Vt(e)?String(e.id):e.path;return(0,x.jsxs)(d.i,{filterMatchQuery:Tt(e),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:`settings.local-files.${r}`,children:Tt(e)})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:`settings.local-files.${r}`,value:s,onSelected:s=>{i(s),t(e,s)}})})]})},Kt=()=>{const[e,t]=(0,n.useState)(),s=(0,st.A)(),i=(0,Ot.i)(),a=(0,n.useCallback)((async()=>t(await s.getSources())),[s]);(0,n.useEffect)((()=>{a()}),[a]);const l=(0,n.useCallback)((async()=>{const{path:e}=await s.browseForFolder();e&&(await s.addFolder({path:e}),a(),i.say(r.Ru.get("settings.localFilesFolderAdded",e)))}),[i,s,a]),o=(0,n.useCallback)(((e,t)=>{e.enabled=t,s.mutateDefaultSource(e)}),[s]),c=(0,n.useCallback)(((e,t)=>{t?s.addFolder(e):s.removeFolder(e)}),[s]);return(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("settings.showSongsFrom"),children:[(0,x.jsx)(M,{children:r.Ru.get("settings.showSongsFrom")}),e?.defaultSources.map((e=>(0,x.jsx)(Dt,{source:e,onAddOrRemoveSource:o},String(e.id)))),e?.folders.map((e=>(0,x.jsx)(Dt,{source:e,onAddOrRemoveSource:c},e.path))),(0,x.jsx)("div",{children:(0,x.jsx)(Re.n,{size:"small","aria-label":r.Ru.get("settings.addASource"),onClick:()=>{l()},children:r.Ru.get("settings.addASource")})})]})};var Ut=s(91087);function Ht(){const e=(0,ct.t)(),[{data:t},{mutate:s}]=(0,dt.K)(e.quality.autoAdjustQuality);return void 0===t?null:(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.automatic-downgrade.title"),children:[(0,x.jsxs)(g.q,{children:[(0,x.jsx)(c.W,{htmlFor:"desktop.settings.automatic-downgrade",children:r.Ru.get("desktop.settings.automatic-downgrade.title")}),(0,x.jsx)(Ut.f,{message:r.Ru.get("desktop.settings.automatic-downgrade.info")})]}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.automatic-downgrade",value:t,onSelected:s})})]})}var Bt=s(49447),Pt=s(1032);const Gt={get[_e.a1.AUTOMATIC](){return r.Ru.get("desktop.settings.streamingQualityAutomatic")},get[_e.a1.LOW](){return r.Ru.get("desktop.settings.streamingQualityLow")},get[_e.a1.MEDIUM](){return r.Ru.get("desktop.settings.streamingQualityNormal")},get[_e.a1.HIGH](){return r.Ru.get("desktop.settings.streamingQualityHigh")},get[_e.a1.VERY_HIGH](){return r.Ru.get("desktop.settings.streamingQualityVeryHigh")},get[_e.a1.LOSSLESS](){return r.Ru.get("web-player.pigeon.audio-quality.lossless")}};function Zt({maxQuality:e,formats:t}){const s=e===_e.Qi.LOSSLESS,n=e>=_e.Qi.VERY_HIGH;return(0,x.jsx)(x.Fragment,{children:t.filter((({quality:e})=>{switch(e){case _e.a1.AUTOMATIC:return!s;case _e.a1.LOW:case _e.a1.MEDIUM:case _e.a1.HIGH:return!0;case _e.a1.VERY_HIGH:return n;case _e.a1.LOSSLESS:return s;default:return!1}})).map((({quality:e})=>(0,x.jsx)("option",{value:e.toString(),children:Gt[e]},e)))})}function $t(){const e=(0,ct.t)(),[{data:t},{mutate:s}]=(0,dt.K)(e.quality.downloadAudioQuality),[{data:n}]=(0,dt.K)(e.quality.maxSupportedQuality),i=(0,Bt.x)();return void 0===t||void 0===n||void 0===i?null:(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.downloadQuality.title"),children:[(0,x.jsxs)(g.q,{children:[(0,x.jsx)(c.W,{htmlFor:"desktop.settings.downloadQuality",children:r.Ru.get("desktop.settings.downloadQuality.title")}),(0,x.jsx)(Ut.f,{message:r.Ru.get("desktop.settings.downloadQuality.info").replace(/(<([^>]+)>)/gi,"")})]}),(0,x.jsx)(u.n,{children:(0,x.jsx)(ye.C,{id:"desktop.settings.downloadQuality",value:t.toString(),onSelect:e=>{const t=(0,Pt.FB)(e);t&&s(t)},children:(0,x.jsx)(Zt,{formats:i,maxQuality:n})})})]})}var Yt=s(92601),Jt=s(91815),Xt=s(77527),es=s(55101);const ts=()=>{const e=(0,Xt.N)(),{deviceFilterState:t}=(0,Yt.j)(),[s,i]=(0,n.useState)((()=>e.isNormalizationOverriden())),r=s&&t.isOnboarded;return(0,es.G)(Jt.n.NORMALIZATION_OVERRIDE_DISABLED,(()=>{i(!1)})),{isOverriden:r,disableOverride:()=>e.disableNormalizationOverride()}};var ss=s(76174),ns=s(36485);let is=function(e){return e[e["volume-increase"]=0]="volume-increase",e[e["normalization-turn-off"]=1]="normalization-turn-off",e[e["normalization-turn-on"]=2]="normalization-turn-on",e}({});const rs=({type:e,onClose:t,onConfirm:s})=>{const{disableOverride:n}=ts(),i="Normalisation";let r="";switch(e){case is["volume-increase"]:r="Increasing the volume level while your headphones are optimized may cause occasional distortion.";break;case is["normalization-turn-off"]:r="Turning off audio normalization while your headphones are optimized may cause audio distortion.";break;case is["normalization-turn-on"]:r='We\'d recommend changing your volume level to "Quiet" after turning on audio normalization to avoid audio distortion (while your headphones are optimized).';break;default:(0,ns.k)(e)}return(0,x.jsx)(ss.T,{onConfirm:()=>{n(),s(),t()},onClose:t,titleText:i,"aria-label":i,descriptionText:r,cancelText:"Cancel",confirmText:"Confirm"})},as={get[_e.KR.QUIET](){return r.Ru.get("desktop.settings.loudnessQuiet")},get[_e.KR.NORMAL](){return r.Ru.get("desktop.settings.loudnessNormal")},get[_e.KR.LOUD](){return r.Ru.get("desktop.settings.loudnessLoud")}};function ls(){const e=(0,ct.t)(),[{data:t},{mutate:s}]=(0,dt.K)(e.quality.normalizeVolume),[{data:i},{mutate:a}]=(0,dt.K)(e.quality.volumeLevel),{dialog:l,setNormalizeValue:h,setVolumeLevel:p}=((e,t)=>{const{isOverriden:s}=ts(),[i,r]=(0,n.useState)(null),a=(0,n.useRef)(null);return{setNormalizeValue:(0,n.useCallback)((t=>{s?(r(t?is["normalization-turn-on"]:is["normalization-turn-off"]),a.current=()=>{e(t)}):e(t)}),[s,e]),setVolumeLevel:(0,n.useCallback)((e=>{s&&e!==_e.KR.QUIET?(r(is["volume-increase"]),a.current=()=>{t(e)}):t(e)}),[s,t]),dialog:null!==i?(0,x.jsx)(rs,{type:i,onClose:()=>{r(null)},onConfirm:()=>{a.current?.()}}):null}})(s,a),{isOverriden:m}=ts();if(void 0===t)return null;const j=m?_e.KR.QUIET:i;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.normalize"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.normalize",children:r.Ru.get("desktop.settings.normalize")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.normalize",value:!!t,onSelected:h})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.loudnessEnvironment_with_limiter_details"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.loudnessEnvironment",children:r.Ru.get("desktop.settings.loudnessEnvironment_with_limiter_details")})}),(0,x.jsx)(u.n,{children:(0,x.jsxs)(ye.C,{id:"desktop.settings.loudnessEnvironment",disabled:!t,value:j,onSelect:e=>{const t=(0,Pt.dt)(e);null!==t&&p(t)},children:[(0,x.jsx)("option",{value:_e.KR.QUIET,children:as[_e.KR.QUIET]}),(0,x.jsx)("option",{value:_e.KR.NORMAL,children:as[_e.KR.NORMAL]}),(0,x.jsx)("option",{value:_e.KR.LOUD,children:as[_e.KR.LOUD]})]})})]}),l]})}var os=s(52586),cs=s(75296),ds=s(73015);const us="teokJIHsNR2G8sc4ne4S";function gs(){const e=(0,ct.t)(),{enqueueSnackbar:t}=(0,ds.d)(),s=(0,cs.K)(cs.X.VeryHighQualityAudio),[{data:i},{mutate:a}]=(0,dt.K)(e.quality.streamingQuality),[{data:l}]=(0,dt.K)(e.quality.maxSupportedQuality),o=(0,Bt.x)();return(0,n.useEffect)((()=>{s&&t(r.Ru.get("web-player.feature-activation-shelf.audio_quality_toast_message"))}),[s,t]),void 0===i||void 0===l||void 0===o?null:(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.streamingQuality"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.streamingQuality",children:r.Ru.get("desktop.settings.streamingQuality")})}),(0,x.jsxs)(u.n,{children:[(0,x.jsx)(ye.C,{id:"desktop.settings.streamingQuality",value:i.toString(),onSelect:e=>{const t=(0,Pt.FB)(e);t&&a(t)},children:(0,x.jsx)(Zt,{formats:o,maxQuality:l})}),s?(0,x.jsx)(os.Z,{className:us}):null]})]})}const hs=()=>(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.musicQuality"),children:[(0,x.jsx)(M,{children:r.Ru.get("desktop.settings.musicQuality")}),(0,x.jsx)(gs,{}),(0,x.jsx)($t,{}),(0,x.jsx)(Ht,{}),(0,x.jsx)(ls,{})]});var ps=s(6900),xs=s(40312),ms=s(46361),js=s(79973);const fs=()=>{const[e,t]=(()=>{const e=(0,F.jE)(),{user:t}=(0,a.d4)(St.Ht),s=t?.uri??"",{enqueueSnackbar:i}=(0,ds.d)(),{data:l,queryKey:o}=(0,js.Z)(ms.kp,[{uri:s}]),c=(0,n.useCallback)((async({showFollows:e})=>{await(0,ms.gN)(xs.n.getInstance(),{uri:s,showFollows:e})}),[s]),d=(0,N.n)({mutationFn:c,onMutate:async t=>{await e.cancelQueries({queryKey:o});const s=e.getQueryData(o);return e.setQueryData(o,t),{prevState:s,newState:t}},onError:(t,s,n)=>{e.setQueryData(o,n?.prevState),i(r.Ru.get("error.generic"))},onSettled:()=>{e.invalidateQueries({queryKey:o})}});return[l?.showFollows??!0,d.mutate]})();return(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.showFollows"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.showFollows",children:r.Ru.get("desktop.settings.showFollows")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.showFollows",value:e,onSelected:e=>t({showFollows:e})})})]})};var ys=s(24153),ks=s(60102);const vs=ys.tv.CONNECTION_STATE_CHANGE;function Rs(){const e=(0,ks.N)(ys._7),[t,s]=(0,n.useState)(null),i=(0,n.useCallback)((t=>{e.connect(t)}),[e]),r=(0,n.useCallback)((()=>{e.disconnect()}),[e]);return(0,n.useEffect)((()=>e.addListener(vs,(e=>{s(e.data)}))),[e,s]),[t,i,r]}const bs="AdlLcqW4qEqJzOzM4IzX";const ws=({settings:{values:e},setValue:t})=>{const[s,a,l]=Rs(),h=(0,i.NC)(Ne.Rww,{loadingValue:!1}),p=(0,n.useCallback)((()=>{s?.connection?l():a({window:{width:Math.max(800,window.outerWidth-100),height:Math.max(600,window.outerHeight-100)}})}),[s,a,l]);if(!(void 0!==e["publish-playlist"]&&void 0!==e["incognito-enabled"]))return null;const m=!!e["incognito-enabled"];return(0,x.jsxs)(w,{filterMatchQuery:r.Ru.get("desktop.settings.social"),children:[(0,x.jsx)(M,{children:r.Ru.get("desktop.settings.social")}),s?.show_connect_option&&(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.facebook"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.facebook",children:r.Ru.get("desktop.settings.facebook")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(Re.n,{id:"desktop.settings.facebook",size:"small",className:bs,onClick:p,iconLeading:ps.G,children:!0===s.connection?r.Ru.get("desktop.settings.facebook.disconnect"):r.Ru.get("desktop.settings.facebook.connect")})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.newPlaylistsPublic"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.newPlaylistsPublic",children:r.Ru.get("desktop.settings.newPlaylistsPublic")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.newPlaylistsPublic",value:"1"===e["publish-playlist"],onSelected:e=>{t("publish-playlist",e?"1":"0")}})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.privateSession"),children:[(0,x.jsxs)(g.q,{children:[(0,x.jsx)(c.W,{htmlFor:"desktop.settings.privateSession",children:r.Ru.get("desktop.settings.privateSession")}),(0,x.jsx)(Ut.f,{message:r.Ru.get("desktop.settings.privateSession.tooltip")})]}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.privateSession",value:!!e["incognito-enabled"],onSelected:e=>{t("incognito-enabled",e)}})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.publishActivity"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.publishActivity",children:r.Ru.get("desktop.settings.publishActivity")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.publishActivity",disabled:m,value:"0"!==e["publish-activity"],onSelected:e=>{t("publish-activity",e?"1":"0")}})})]}),(0,x.jsxs)(d.i,{filterMatchQuery:r.Ru.get("desktop.settings.publishTopArtists"),children:[(0,x.jsx)(g.q,{children:(0,x.jsx)(c.W,{htmlFor:"desktop.settings.publishTopArtists",children:r.Ru.get("desktop.settings.publishTopArtists")})}),(0,x.jsx)(u.n,{children:(0,x.jsx)(o.l,{id:"desktop.settings.publishTopArtists",disabled:m,value:"1"===e["public-toplist"],onSelected:e=>{t("public-toplist",e?"1":"0")}})})]}),h&&(0,x.jsx)(fs,{})]})};var Ss=s(56909);const Cs=()=>{const{settings:e,setValue:t}=(0,Ss.t0)(),s=(0,n.useRef)(null),[r]=(0,Lt.y)(),a=(0,i.NC)(Ne.YSK),l=(0,i.NC)(Ne.AEN);return(0,x.jsxs)(B,{outerRef:s,children:[(0,x.jsx)(Y,{containerRef:s}),(0,x.jsx)(Wt,{}),a?(0,x.jsx)(O,{sectionAbove:(0,x.jsx)(qt,{settings:e,setValue:t})}):(0,x.jsx)(Et,{settings:e,setValue:t}),(0,x.jsx)(ht,{settings:e,setValue:t}),(0,x.jsx)(hs,{}),(0,x.jsxs)(U,{children:[!l&&(0,x.jsx)(K,{}),(0,x.jsx)(zt,{})]}),r?(0,x.jsx)(Kt,{}):null,(0,x.jsx)(bt,{settings:e,setValue:t}),(0,x.jsx)(ws,{settings:e,setValue:t}),(0,x.jsx)(ot,{settings:e,setValue:t}),(0,x.jsx)(At,{settings:e,setValue:t})]})},Ms=Cs},45874:(e,t,s)=>{s.d(t,{d:()=>r});var n=s(30758),i=s(10034);const r=()=>(0,n.useContext)(i.D)}}]);
//# sourceMappingURL=xpui-routes-desktop-settings.js.map