diff --git a/src/theme.js b/src/theme.js index b72b0e0..091d879 100644 --- a/src/theme.js +++ b/src/theme.js @@ -1,7 +1,7 @@ -(async()=>{for(;!Spicetify.React||!Spicetify.ReactDOM;)await new Promise(e=>setTimeout(e,10));var U=Object.create,T=Object.defineProperty,D=Object.defineProperties,$=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,F=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,G=(e,t,a)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,o=(e,t)=>{for(var a in t=t||{})H.call(t,a)&&G(e,a,t[a]);if(V)for(var a of V(t))q.call(t,a)&&G(e,a,t[a]);return e},l=(e,t)=>D(e,j(t)),W=(e,t)=>{var a={};for(r in e)H.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(null!=e&&V)for(var r of V(e))t.indexOf(r)<0&&q.call(e,r)&&(a[r]=e[r]);return a},e=(e,t,a)=>(a=null!=e?U(F(e)):{},((t,a,r,n)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let e of z(a))H.call(t,e)||e===r||T(t,e,{get:()=>a[e],enumerable:!(n=$(a,e))||n.enumerable});return t})(!t&&e&&e.__esModule?a:T(a,"default",{value:e,enumerable:!0}),e)),r=(a=(e,t)=>function(){return t||(0,e[z(e)[0]])((t={exports:{}}).exports,t),t.exports})({"external-global-plugin:react"(e,t){t.exports=Spicetify.React}}),Z=a({"node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(e){function o(e){for(var t=arguments.length,a=new Array(1{if(c[e])return c[e];var t=s.exec(e);if(t){var a,r={weight:"normal",style:"normal",stretch:"normal",variant:"normal",size:parseFloat(t[1]),unit:t[2],family:t[3].replace(/["']/g,"").replace(/ *, */g,",")},t=e.substring(0,t.index);switch((a=n.exec(t))&&(r.weight=a[1]),(a=i.exec(t))&&(r.style=a[1]),(a=l.exec(t))&&(r.variant=a[1]),(a=o.exec(t))&&(r.stretch=a[1]),r.unit){case"pt":r.size/=.75;break;case"pc":r.size*=16;break;case"in":r.size*=96;break;case"cm":r.size*=96/2.54;break;case"mm":r.size*=96/25.4;break;case"%":break;case"em":case"rem":r.size*=16/.75;break;case"q":r.size*=96/25.4/4}return c[e]=r}}}}),a=a({"node_modules/canvas/browser.js"(e){var t=X();e.parseFont=t,e.createCanvas=function(e,t){return Object.assign(document.createElement("canvas"),{width:e,height:t})},e.createImageData=function(e,t,a){switch(arguments.length){case 0:return new ImageData;case 1:return new ImageData(e);case 2:return new ImageData(e,t);default:return new ImageData(e,t,a)}},e.loadImage=function(n,i){return new Promise(function(e,t){let a=Object.assign(document.createElement("img"),i);function r(){a.onload=null,a.onerror=null}a.onload=function(){r(),e(a)},a.onerror=function(){r(),t(new Error('Failed to load the image "'+n+'"'))},a.src=n})}}}),i=e(r()),Q=(0,i.memo)(({title:e,children:t,headingChild:a,onClose:r,isOpen:n=!1})=>n?i.default.createElement("div",{className:"modal-container"},i.default.createElement("div",{className:"modal-overlay "+(n&&"open"),style:{zIndex:20},onClick:r}),i.default.createElement("dialog",{open:n,className:"modal-section "+(n&&"open"),"aria-label":e,"aria-modal":"true"},i.default.createElement("div",{className:"main-embedWidgetGenerator-container"},i.default.createElement("div",{className:"main-trackCreditsModal-header"},i.default.createElement("h1",{className:"encore-text encore-title-body-medium"},e),a&&i.default.createElement("div",null,a),i.default.createElement("button",{type:"button","aria-label":"Close",className:"main-trackCreditsModal-closeBtn",onClick:()=>r()},i.default.createElement("svg",{width:"18",height:"18",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg"},i.default.createElement("title",null,"Close"),i.default.createElement("path",{d:"M31.098 29.794L16.955 15.65 31.097 1.51 29.683.093 15.54 14.237 1.4.094-.016 1.508 14.126 15.65-.016 29.795l1.414 1.414L15.54 17.065l14.144 14.143",fill:"currentColor","fill-rule":"evenodd"})))),i.default.createElement("div",{className:"modal-contents"},i.default.createElement("main",{className:"modal-wrapper"},t))))):null),Y=e(r()),L=({title:e,description:t,children:a})=>Y.default.createElement("div",{className:"setting-section"},Y.default.createElement("div",{className:"heading-wrapper"},Y.default.createElement("h3",{className:"title encore-text encore-text-title-small"},e),t&&Y.default.createElement("p",{className:"desc encore-text encore-text-body-small"},t)),a),ee=[{label:"Animated",value:"animated"},{label:"Static",value:"static"},{label:"Solid",value:"solid"}],te=[{label:"Compact",value:"compact"},{label:"Default",value:"default"},{label:"Rounded",value:"rounded"}],ae=[{label:"Starry",value:"starry"},{label:"Default",value:"default"},{label:"none",value:"none"}],re=[{label:"Now Playing",value:"now-playing"},{label:"Playlist Cover",value:"inherit"},{label:"none",value:"none"}],ne=[{label:"Card",value:"card"},{label:"Compact Card",value:"compact-card"},{label:"Compact",value:"compact"},{label:"Default",value:"default"}],ie=[{label:"None",value:"none"},{label:"Hidden",value:"hidden"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"},{label:"Solid",value:"solid"},{label:"Double",value:"double"},{label:"Groove",value:"groove"},{label:"Ridge",value:"ridge"},{label:"Inset",value:"inset"},{label:"Outset",value:"outset"}],le=[{label:"Profile Context Menu",value:"context-menu"},{label:"Global Nav",value:"nav"}],oe={},se=e=>{let r,n=new Set;var t=(e,a)=>{e="function"==typeof e?e(r):e;if(!Object.is(e,r)){let t=r;r=(null!=a?a:"object"!=typeof e||null===e)?e:Object.assign({},r,e),n.forEach(e=>e(r,t))}},a=()=>r,i={setState:t,getState:a,getInitialState:()=>l,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{"production"!==(oe.env?oe.env.MODE:void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};let l=r=e(t,a,i);return i},ce=e=>e?se(e):se,n=e(r(),1),t=e(t(),1),ue={},de=n.default.useDebugValue,ge=t.default.useSyncExternalStoreWithSelector,me=!1,pe=e=>e,fe=e=>{"production"!==(ue.env?ue.env.MODE:void 0)&&"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let r="function"==typeof e?ce(e):e;e=(e,t)=>{return[e,t=pe,a]=[r,e,t],"production"!==(ue.env?ue.env.MODE:void 0)&&a&&!me&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),me=!0),e=ge(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,a),de(e),e;var a};return Object.assign(e,r),e},be={},b=a=>e=>{try{let t=a(e);return t instanceof Promise?t:{then(e){return b(e)(t)},catch(e){return this}}}catch(t){return{then(e){return this},catch(e){return b(e)(t)}}}},ye=(m,p)=>(a,r,e)=>{let n={storage:((e,a)=>{let r;try{r=e()}catch(e){return}return{getItem:e=>{var t=e=>null===e?null:JSON.parse(e,null==a?void 0:a.reviver),e=null!=(e=r.getItem(e))?e:null;return e instanceof Promise?e.then(t):t(e)},setItem:(e,t)=>r.setItem(e,JSON.stringify(t,null==a?void 0:a.replacer)),removeItem:e=>r.removeItem(e)}})(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...p},i=!1,l=new Set,o=new Set,s=n.storage;if(!s)return m((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${n.name}', the given storage is currently unavailable.`),a(...e)},r,e);let c=()=>{var e=n.partialize({...r()});return s.setItem(n.name,{state:e,version:n.version})},u=e.setState,d=(e.setState=(e,t)=>{u(e,t),c()},m((...e)=>{a(...e),c()},r,e));e.getInitialState=()=>d;let g,t=()=>{var e;if(s){i=!1,l.forEach(e=>e(null!=(e=r())?e:d));let t=(null==(e=n.onRehydrateStorage)?void 0:e.call(n,null!=(e=r())?e:d))||void 0;return b(s.getItem.bind(s))(n.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===n.version)return[!1,e.state];if(n.migrate)return[!0,n.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var[e,t]=e;if(g=n.merge(t,null!=(t=r())?t:d),a(g,!0),e)return c()}).then(()=>{null!=t&&t(g,void 0),g=r(),i=!0,o.forEach(e=>e(g))}).catch(e=>{null!=t&&t(void 0,e)})}};return e.persist={setOptions:e=>{n={...n,...e},e.storage&&(s=e.storage)},clearStorage:()=>{null!=s&&s.removeItem(n.name)},getOptions:()=>n,rehydrate:()=>t(),hasHydrated:()=>i,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(o.add(e),()=>{o.delete(e)})},n.skipHydration||t(),g||d},ve={isUseLocalImage:!1,selectedLocalImage:null},he=(n=e=>e?fe(e):fe)((t=(e,t)=>{var p,f;return"getStorage"in t||"serialize"in t||"deserialize"in t?("production"!==(be.env?be.env.MODE:void 0)&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),p=e,f=t,(a,r,e)=>{let n={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...f},i=!1,l=new Set,o=new Set,s;try{s=n.getStorage()}catch(e){}if(!s)return p((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${n.name}', the given storage is currently unavailable.`),a(...e)},r,e);let c=b(n.serialize),u=()=>{var e=n.partialize({...r()});let t;e=c({state:e,version:n.version}).then(e=>s.setItem(n.name,e)).catch(e=>{t=e});if(t)throw t;return e},d=e.setState,g=(e.setState=(e,t)=>{d(e,t),u()},p((...e)=>{a(...e),u()},r,e)),m,t=()=>{var e;if(s){i=!1,l.forEach(e=>e(r()));let t=(null==(e=n.onRehydrateStorage)?void 0:e.call(n,r()))||void 0;return b(s.getItem.bind(s))(n.name).then(e=>{if(e)return n.deserialize(e)}).then(e=>{if(e)return"number"!=typeof e.version||e.version===n.version?e.state:n.migrate?n.migrate(e.state,e.version):void console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}).then(e=>(m=n.merge(e,null!=(e=r())?e:g),a(m,!0),u())).then(()=>{null!=t&&t(m,void 0),i=!0,o.forEach(e=>e(m))}).catch(e=>{null!=t&&t(void 0,e)})}};return e.persist={setOptions:e=>{n={...n,...e},e.getStorage&&(s=e.getStorage())},clearStorage:()=>{null!=s&&s.removeItem(n.name)},getOptions:()=>n,rehydrate:()=>t(),hasHydrated:()=>i,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(o.add(e),()=>{o.delete(e)})},t(),m||g}):ye(e,t)})(t=>l(o({},ve),{setUseLocalImage:e=>t(()=>({isUseLocalImage:e})),setSelectedLocalImage:e=>t(()=>({selectedLocalImage:e})),clearSelectedLocalImage:()=>t(()=>o({},ve))}),{name:"lucid-bg-image"})),Se={backgroundSettings:{mode:"static",styles:{solid:{opacity:1,backgroundColor:"var(--spice-main)"},static:{blur:32,opacity:1,saturation:1.1,contrast:1.2,brightness:.5},animated:{blur:32,time:45,opacity:1,saturation:1.1,contrast:1.2,brightness:.475}},customBackgroundOverride:{url:null}},interfaceSettings:{controlSettings:{height:64},fontSettings:{body:{url:"https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap",fontFamily:"Poppins"}},grainSettings:{grainEffect:"default"},pagesSettings:{isScrollMode:!1,backgroundImageMode:"inherit",playlistViewMode:"card"},borderSettings:{color:"rgba(var(--spice-rgb-selected-row, var(--spice-rgb-text)), 0.125)",style:"inset",thickness:1,roundedRadius:12}},colorSettings:{isDynamicColor:!1},playbarSettings:{mode:"default",styles:{compact:{height:64,opacity:1,saturation:1.1,contrast:1.2,brightness:.8,borderRadius:8,backdropBlur:32,paddingX:6,backgroundColor:"rgba(var(--spice-rgb-player, var(--spice-rgb-card)), 0.5)"},default:{height:80,opacity:1,paddingX:6,saturation:1.1,contrast:1.2,borderRadius:8,brightness:.8,backdropBlur:32,backgroundColor:"rgba(var(--spice-rgb-player, var(--spice-rgb-card)), 0.5)"},rounded:{height:80,opacity:1,paddingX:20,saturation:1.1,contrast:1.2,borderRadius:999,brightness:.8,backdropBlur:32,backgroundColor:"rgba(var(--spice-rgb-player, var(--spice-rgb-card)), 0.5)"}}},settingAccessPosition:"context-menu"},we=e(r()),Ee=()=>we.default.createElement("svg",{role:"img","aria-label":"dismiss",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},we.default.createElement("path",{d:"m4.21 4.387.083-.094a1 1 0 0 1 1.32-.083l.094.083L12 10.585l6.293-6.292a1 1 0 1 1 1.414 1.414L13.415 12l6.292 6.293a1 1 0 0 1 .083 1.32l-.083.094a1 1 0 0 1-1.32.083l-.094-.083L12 13.415l-6.293 6.292a1 1 0 0 1-1.414-1.414L10.585 12 4.293 5.707a1 1 0 0 1-.083-1.32l.083-.094-.083.094Z",fill:"#ffffff"})),ke=e(r()),s=e=>{var{variant:t="primary",size:a="medium",icon:r,children:n}=e,e=W(e,["variant","size","icon","children"]);return ke.default.createElement("button",o({className:`button button-${t} button-`+a},e),r&&ke.default.createElement("span",{className:"button-icon"},r),n)},c=e(r()),Re=0,{ToastContainer:xe,addToast:u}=(()=>{let a;return{ToastContainer:()=>{let[e,n]=(0,c.useState)([]);var t=(0,c.useCallback)((t,a=!1)=>{let r=Re++,e=(n(e=>[...e,{id:r,message:t,isError:a,exiting:!1}]),setTimeout(()=>{i(r)},3e3));return()=>clearTimeout(e)},[]);a=t;let i=t=>{n(e=>e.map(e=>e.id===t?l(o({},e),{exiting:!0}):e)),setTimeout(()=>{n(e=>e.filter(e=>e.id!==t))},500)};return c.default.createElement("div",{className:"toast-container"},e.map(e=>c.default.createElement("div",{key:e.id,className:"toast-element "+(e.exiting?"toast-exit":""),style:{backgroundColor:e.isError?"rgba(200,20,20,0.5)":"rgba(20,20,20,0.5)"}},e.message,c.default.createElement(s,{icon:c.default.createElement(Ee,null),onClick:()=>i(e.id)}))))},addToast:(e,t)=>a(e,t)}})(),O=n(t((n,t)=>l(o({},Se),{exportSettings:()=>{var e=t();return JSON.stringify(e)},importSettings:t=>{try{var e=JSON.parse(t);if("object"==typeof(a=e)&&null!==a&&"backgroundSettings"in a&&"interfaceSettings"in a&&"playbarSettings"in a&&"colorSettings"in a&&"object"==typeof a.backgroundSettings&&"mode"in a.backgroundSettings&&"styles"in a.backgroundSettings&&"object"==typeof a.interfaceSettings&&"borderSettings"in a.interfaceSettings&&"fontSettings"in a.interfaceSettings&&"object"==typeof a.playbarSettings&&"mode"in a.playbarSettings&&"object"==typeof a.colorSettings&&"isDynamicColor"in a.colorSettings)return n(e),u("Settings imported successfully!"),!0;throw new Error("Invalid settings structure")}catch(e){t=e instanceof SyntaxError?"Failed to parse JSON: Please ensure your input is valid JSON.":e instanceof Error?e.message:"An unknown error occurred.";return u(t,!0),!1}var a},setBackgroundSettings:t=>n(e=>({backgroundSettings:o(o({},e.backgroundSettings),t)})),setSettingAccessPosition:e=>n(()=>({settingAccessPosition:e})),setControlHeight:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{controlSettings:{height:t}})})),setCustomBackgroundOverride:t=>n(e=>({backgroundSettings:l(o({},e.backgroundSettings),{customBackgroundOverride:l(o({},e.backgroundSettings.customBackgroundOverride),{url:t})})})),setBorderColor:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:l(o({},e.interfaceSettings.borderSettings),{color:t})})})),setBorderStyle:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:l(o({},e.interfaceSettings.borderSettings),{style:t})})})),setRoundedBorderRadius:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:l(o({},e.interfaceSettings.borderSettings),{roundedRadius:t})})})),setBorderThickness:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:l(o({},e.interfaceSettings.borderSettings),{thickness:t})})})),setBackgroundStyles:(t,a)=>n(e=>({backgroundSettings:l(o({},e.backgroundSettings),{styles:l(o({},e.backgroundSettings.styles),{[a]:o(o({},e.backgroundSettings.styles[a]),t)})})})),setColorSettings:t=>n(e=>({colorSettings:o(o({},e.colorSettings),t)})),setBorderSettings:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:o(o({},e.interfaceSettings.borderSettings),t)})})),setPlaybarSettings:t=>n(e=>({playbarSettings:o(o({},e.playbarSettings),t)})),setInterfaceSettings:t=>n(e=>({interfaceSettings:o(o({},e.interfaceSettings),t)})),setBackgroundMode:t=>n(e=>({backgroundSettings:l(o({},e.backgroundSettings),{mode:t})})),updateBackgroundStyle:(t,a,r)=>n(e=>({backgroundSettings:l(o({},e.backgroundSettings),{styles:l(o({},e.backgroundSettings.styles),{[t]:l(o({},e.backgroundSettings.styles[t]),{[a]:r})})})})),setFont:(t,a)=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{fontSettings:l(o({},e.interfaceSettings.fontSettings),{[t]:o({},a)})})})),setGrainEffect:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{grainSettings:l(o({},e.interfaceSettings.grainSettings),{grainEffect:t})})})),setIsScrollMode:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{pagesSettings:l(o({},e.interfaceSettings.pagesSettings),{isScrollMode:t})})})),setPagesBackgroundImageMode:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{pagesSettings:l(o({},e.interfaceSettings.pagesSettings),{backgroundImageMode:t})})})),setPlaylistViewMode:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{pagesSettings:l(o({},e.interfaceSettings.pagesSettings),{playlistViewMode:t})})})),setIsDynamicColor:t=>n(e=>({colorSettings:l(o({},e.colorSettings),{isDynamicColor:t})})),updatePlaybarStyle:(t,a,r)=>n(e=>({playbarSettings:l(o({},e.playbarSettings),{styles:l(o({},e.playbarSettings.styles),{[t]:l(o({},e.playbarSettings.styles[t]),{[a]:r})})})})),setPlaybarMode:t=>n(e=>({playbarSettings:l(o({},e.playbarSettings),{mode:t})})),resetAllSettings:()=>{n(Se)}}),{name:"lucid-settings"})),_e=e=>{try{return new URL(e),!0}catch(e){return!1}},Ce=e=>decodeURIComponent((null==(e=null==(e=e.match(/family=([^&:]+)/))?void 0:e[1])?void 0:e.replace(/\+/g," "))||"")||"",Pe=(e,a,r)=>Object.entries(e[a]).map(([t,e])=>({id:"style-"+a,sectionName:"Styles",conditionalRender:!0,cardProps:{title:"Set "+t,type:"input",settings:o({label:"",defaultValue:e},"number"==typeof e?{type:"number",onChange:e=>{r(a,t,Number(e))},settings:{max:256,min:0,step:1}}:{type:"text",onChange:e=>{r(a,t,e)}})}})),Le=console.log,Oe=console.debug,Ie=console.error,Me=console.warn,Ne={prefix:"font-weight: bold; color: #4DB6AC; font-size: 0.85rem;",error:"color: #dc3545;",warn:"color: #ffc107;",debug:"color: #17a2b8;",info:""},Ae=(e,t,...a)=>{var r={info:Le,debug:Oe,error:Ie,warn:Me}[e],e=Ne[e];r("%c[Lucid] %c"+t,Ne.prefix,e,...a)},d=(e,...t)=>Ae("info",e,...t),f=(e,...t)=>Ae("debug",e,...t),w=(e,...t)=>Ae("error",e,...t),Be=(e,...t)=>Ae("warn",e,...t),g=e(r()),Ue=({children:e})=>g.default.createElement("div",{className:"tooltip-container"},g.default.createElement("div",{className:"tooltip"},g.default.createElement("span",{className:"tooltip-icon"},g.default.createElement("svg",{role:"img","aria-label":"Tooltip icon",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},g.default.createElement("path",{d:"M12 2c5.523 0 10 4.478 10 10s-4.477 10-10 10S2 17.522 2 12 6.477 2 12 2Zm0 1.667c-4.595 0-8.333 3.738-8.333 8.333 0 4.595 3.738 8.333 8.333 8.333 4.595 0 8.333-3.738 8.333-8.333 0-4.595-3.738-8.333-8.333-8.333ZM12 15.5a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm0-8.75a2.75 2.75 0 0 1 2.75 2.75c0 1.01-.297 1.574-1.051 2.359l-.169.171c-.622.622-.78.886-.78 1.47a.75.75 0 0 1-1.5 0c0-1.01.297-1.574 1.051-2.359l.169-.171c.622-.622.78-.886.78-1.47a1.25 1.25 0 0 0-2.493-.128l-.007.128a.75.75 0 0 1-1.5 0A2.75 2.75 0 0 1 12 6.75Z",fill:"currentColor"}))),g.default.createElement("span",{className:"tooltip-content"},e))),m=e(r()),Te=({title:e,tooltip:t,selectedValue:a})=>m.default.createElement("div",{className:"title-container"},m.default.createElement("div",{className:"title-wrapper"},e&&m.default.createElement("h5",{className:"encore-text encore-text-body-medium-bold"},e),t&&m.default.createElement(Ue,null,t)),a&&m.default.createElement("p",{className:"selected-value"},"Selected: ",a)),De=e(r()),$e=()=>De.default.createElement("svg",{role:"img","aria-label":"Arrow Down",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},De.default.createElement("path",{d:"M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z",fill:"#ffffff"})),p=e(r()),je=({options:e,selectedValue:a,onChange:t,placeholder:r,disabled:n})=>{let i=(0,p.useRef)(null),[l,o]=(0,p.useState)(!1);let s=e=>{o(!1),t(e)};return(0,p.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),p.default.createElement(p.default.Fragment,null,p.default.createElement("div",{className:"dropdown-container",ref:i},p.default.createElement("button",{className:"dropdown-button "+(l?"open":""),onClick:()=>{o(e=>!e)},"aria-label":"Toggle dropdown menu",type:"button"},p.default.createElement("p",{className:"encore-text"},r||a||"Dropdown"),p.default.createElement("span",{className:"dropdown-arrow"},p.default.createElement($e,null))),p.default.createElement("div",{className:"dropdown-menu "+(l?"open":"")},l?null==e?void 0:e.map(t=>p.default.createElement("li",{key:t.value,className:"dropdown-item "+(a===t.value?"selected":""),onClick:()=>!t.disabled&&s(t.value),onKeyDown:e=>!t.disabled&&"Enter"===e.key&&s(t.value),style:{opacity:""+(n?.75:1)}},p.default.createElement("p",{className:"encore-text"},t.label))):null)))},y=e(r()),ze=(0,y.forwardRef)(({label:e,defaultValue:t,onChange:a,type:r,placeholder:n,settings:i},l)=>{let[o,s]=(0,y.useState)(t||null),c=(0,y.useMemo)(()=>((t,a)=>{let r=null;return(...e)=>{r&&clearTimeout(r),r=setTimeout(()=>{t(...e)},a)}})(e=>{"file"!==r&&null!=a&&a(e)},1e3),[a]);t=(0,y.useCallback)(e=>{var t;"file"===r?(t=e.target.files,null!=a&&a(t)):(t=e.target.value,s(t),c(t))},[c]);return y.default.createElement("div",{className:"input-container"},y.default.createElement("label",{"aria-label":e,className:"file"===r?"input":"label"},y.default.createElement("input",{"aria-label":e,type:r,accept:"file"===r?i?i.accept:"image/*":void 0,multiple:"file"===r?!!i&&i.multiple:void 0,className:"input encore-text",value:null!=o?o:"",onChange:t,placeholder:n,step:"number"===r?null!=i&&i.step?i.step:1:void 0,min:"number"===r?null!=i&&i.min?i.min:0:void 0,max:"number"===r?null!=i&&i.max?i.max:100:void 0,ref:l,style:"file"===r?{display:"none"}:{}}),"file"===r?"Upload Image":null))}),Ve=e(r()),Fe=({onChange:e,checked:t,label:a})=>Ve.default.createElement("div",{className:"slider-wrapper"},Ve.default.createElement("label",{className:"switch","aria-label":a},Ve.default.createElement("input",{"aria-label":"toggleSwtich",type:"checkbox",checked:t,onChange:()=>{e(!t)}}),Ve.default.createElement("span",{className:"slider round"}))),v=e(r()),He=({title:e,tooltip:t,selectedValue:a,type:r,settings:n,children:i,style:l})=>v.default.createElement("div",{className:"card"},v.default.createElement(Te,{title:e,tooltip:t,selectedValue:a}),v.default.createElement("div",{className:"children-wrapper",style:l||{}},"dropdown"===r&&v.default.createElement(je,o({},n)),"input"===r&&v.default.createElement(ze,o({},n)),"toggle"===r&&v.default.createElement(Fe,o({},n)),"button"===r&&v.default.createElement(s,o({},n)),i)),qe=e(r()),Ge=e=>{var{children:t,className:a}=e,e=W(e,["children","className"]);return qe.default.createElement("div",l(o({},e),{className:"cards-wrapper "+(a||"")}),t)},We=e(r()),Ze=e=>{var t,a,r=new Map;for(a of e)r.has(a.id)||r.set(a.id,[]),null!=(t=r.get(a.id))&&t.push(a);return Array.from(r.entries()).map(([e,t])=>{var a;return t[0].conditionalRender?We.default.createElement(Ge,{key:e,id:e,className:e+" combine"},null!=(a=t[0])&&a.sectionName?We.default.createElement("label",{"aria-label":null==(a=t[0])?void 0:a.sectionName,htmlFor:e},null==(a=t[0])?void 0:a.sectionName):null,t.map(e=>e.conditionalRender?We.default.createElement(He,o({key:e.id},e.cardProps)):null)):null})},h=e(r()),Je=()=>{let{backgroundSettings:{mode:e,styles:t,customBackgroundOverride:a},colorSettings:{isDynamicColor:r},updateBackgroundStyle:n,setIsDynamicColor:i,setCustomBackgroundOverride:l}=O(),{isUseLocalImage:o,setUseLocalImage:s,clearSelectedLocalImage:c,selectedLocalImage:u,setSelectedLocalImage:d}=he(),[g,m]=(0,h.useState)(e);var p=[{id:"backgroundOption",conditionalRender:!0,cardProps:{title:"Background Option",type:"dropdown",tooltip:"Select the background mode to customize your background.",settings:{placeholder:g,selectedValue:g,options:ee,onChange:e=>{m(e),c()}}}},...Pe(t,e,n),{id:"backgroundCustomImage",sectionName:"Custom Background",conditionalRender:"static"===e,cardProps:{title:"Background image",type:"input",tooltip:h.default.createElement(h.default.Fragment,null,h.default.createElement("span",null,"Use a custom URL for the background image."),h.default.createElement("span",null,"Ensure the URL is a valid image link (e.g., .jpg, .png)."),h.default.createElement("span",null,'Use "now-playing" for the now playing art image.'),h.default.createElement("span",null,'Use "current-page" for the current page art image.')),settings:{type:"text",defaultValue:(null==a?void 0:a.url)||"",label:"Url",validation:e=>_e(e),onChange:e=>{l(e)}}}},{id:"backgroundCustomImage",conditionalRender:"static"===e,cardProps:{title:"Use Local Image",type:"toggle",tooltip:"Import an image from your device to use as the background.",settings:{checked:o,label:"Enable Local Image",onChange:e=>{s(e),!1===e&&d(null)}}}},{id:"backgroundCustomImageInput",conditionalRender:"static"===e&&o,cardProps:{title:"Select Background Image",type:"input",tooltip:"Choose an image file from your device.",settings:{type:"file",label:"Choose File",onChange:e=>{let t=null==e?void 0:e[0];t&&((e=new FileReader).readAsDataURL(t),e.onload=e=>{e=(null==(e=e.target)?void 0:e.result)||"";f("Local Image Data URL:",e),d({dataURL:e,fileName:t.name||"",dateAdded:Date.now()})})}}}},{id:"dynamicColorToggle",conditionalRender:!0,cardProps:{title:"Dynamic Color",type:"toggle",tooltip:"Enable dynamic color to adjust colors based on current playing album art.",settings:{checked:r,label:"Dynamic Color Toggle",onChange:e=>{i(e)}}}}];return(0,h.useEffect)(()=>{console.log(u)},[u]),h.default.createElement(L,{title:"Background Settings",description:"Set your Spotify interface settings."},Ze(p))},S=e(r()),Ke=()=>{let{exportSettings:t,importSettings:a}=O(),[e,r]=(0,S.useState)(!1),n=(0,S.useRef)(null);let i=()=>{var e=(null==(e=n.current)?void 0:e.value.trim())||"{}";"{}"===e?u("Please enter valid JSON settings.",!0):a(e)};return S.default.createElement(L,{title:"Settings Import/Export",description:"Manage your settings easily."},S.default.createElement(Ge,null,S.default.createElement(He,{title:"Import and Export Settings",type:"normal",tooltip:"Use these buttons to import settings from a JSON file or export your current theme settings to your clipboard.",style:{display:"flex",gap:"0.5rem"}},S.default.createElement(s,{onClick:()=>{var e=t();navigator.clipboard.writeText(e).then(()=>{u("Settings exported to clipboard!")}).catch(e=>{w("Failed to copy: ",e),u("Failed to copy settings to clipboard.",!0)})}},"Export"),S.default.createElement(s,{onClick:()=>{r(e=>!e),e&&n.current&&(n.current.value="")},variant:e?"danger":"primary"},e?"Cancel Import":"Import")),e&&S.default.createElement(He,{title:"Import Settings JSON",type:"normal",tooltip:"Paste your JSON settings here to import them. Ensure the JSON is correctly formatted.",style:{display:"flex",gap:"0.5rem"}},S.default.createElement(s,{onClick:async()=>{try{var e=await navigator.clipboard.readText();n.current&&(n.current.value=e,i()),u("Clipboard content pasted successfully!")}catch(e){w("Failed to read clipboard: ",e),u("Failed to read clipboard content.",!0)}}},"Paste And Import"),S.default.createElement(ze,{ref:n,type:"text",label:"Paste JSON here",placeholder:"Paste JSON here"}),S.default.createElement(s,{onClick:i},"Import"))))},Xe="1.2.46"<=Spicetify.Platform.version,Qe="light"===(null==Spicetify?void 0:Spicetify.Config.color_scheme)||!1,Ye=!(!Spicetify.Platform||"Windows"!==Spicetify.Platform.operatingSystem)||!(null==(t=null==(t=Spicetify.Platform)?void 0:t.PlatformData)||!t.os_name)&&Spicetify.Platform.PlatformData.os_name.toLowerCase().includes("win"),et=!(!document.querySelector(".globalNav")&&!document.querySelector(".Root__globalNav")),tt=!!document.getElementById("customControls")&&(null!=(t=document.querySelector(".lucid-transperent-window-controls"))&&t.remove(),!0),I=e(r()),at=()=>{let{interfaceSettings:{controlSettings:{height:e},fontSettings:{body:{fontFamily:t}},grainSettings:{grainEffect:a},pagesSettings:{isScrollMode:r,backgroundImageMode:n,playlistViewMode:i},borderSettings:{color:l,style:o,thickness:s,roundedRadius:c}},setFont:u,setGrainEffect:d,setControlHeight:g,setPagesBackgroundImageMode:m,setPlaylistViewMode:p,setIsScrollMode:f,setBorderColor:b,setBorderStyle:y,setBorderThickness:v,settingAccessPosition:h,setRoundedBorderRadius:S,setSettingAccessPosition:w}=O(),[E,k]=(0,I.useState)(a),[R,x]=(0,I.useState)(n),[_,C]=(0,I.useState)(i);var P=[{id:"controlSettings",conditionalRender:Ye,cardProps:{title:"Set Control Height",tooltip:"Set the height of your window controls in pixels.",type:"input",settings:{type:"number",label:"Enter Control Height",defaultValue:e,onChange:e=>{g(Number(e))}}}},{id:"themeSettings",conditionalRender:!0,cardProps:{title:"Settings Access Position",tooltip:"Choose how to access settings: via the context menu button or a navigation button.",type:"dropdown",settings:{options:le,placeholder:h,selectedValue:h,onChange:e=>{w(e)}}}},{id:"font",conditionalRender:!0,cardProps:{title:"Font",type:"input",tooltip:I.default.createElement(I.default.Fragment,null,"Supports both Google Fonts via URL and local fonts.",I.default.createElement("span",null,"For Google Fonts, use the full URL (e.g., https://fonts.googleapis.com/css2?family=Roboto). "),I.default.createElement("span",null,"For local fonts, type the font family name (e.g., 'Arial').")),settings:{type:"text",label:"Font Family or URL",defaultValue:t,onChange:e=>{u("body",(e=>{let t="",a="";return t=_e(e)?(a=e,Ce(e)):a=e,{url:a,fontFamily:t}})(e.toString()))}}}},{id:"grains",conditionalRender:!0,cardProps:{type:"dropdown",title:"Grains",tooltip:"Choose a grain texture mode.",settings:{options:ae,placeholder:E,selectedValue:E,onChange:e=>{k(e),d(e)}}}},{id:"pageSettings",sectionName:"Pages Setting",conditionalRender:!0,cardProps:{type:"dropdown",title:"Pages Background Image",tooltip:"Choose a background image mode for playlist pages.",settings:{options:re,placeholder:R,selectedValue:R,onChange:e=>{x(e),m(e)}}}},{id:"pageSettings",conditionalRender:!0,cardProps:{type:"dropdown",tooltip:"Sets the view mode for playlists.",title:"Playlist View",settings:{options:ne,placeholder:_,selectedValue:_,onChange:e=>{C(e),p(e)}}}},{id:"pageSettings",conditionalRender:!0,cardProps:{title:"Toggle Playlist Scroll Mode",tooltip:"Enable or disable scrolling for the playlist art image.",type:"toggle",settings:{checked:r,label:"Scroll Mode Toggle",onChange:e=>{f(e)}}}},{id:"borderSettings",conditionalRender:!0,sectionName:"Border Settings",cardProps:{title:"Border Thickness",type:"input",settings:{type:"number",label:"Border Thickness",defaultValue:s,onChange:e=>{v(Number(e))},settings:{step:1,min:0,max:16}}}},{id:"borderSettings",conditionalRender:!0,sectionName:"Border Settings",cardProps:{title:"Rounded Border Radius",type:"input",settings:{type:"number",label:"Rounded Border Radius",defaultValue:c,onChange:e=>{S(Number(e))}}}},{id:"borderSettings",conditionalRender:!0,cardProps:{title:"Border Color",type:"input",settings:{type:"text",label:"Border Color",defaultValue:l,onChange:e=>{b(e)}}}},{id:"borderSettings",conditionalRender:!0,cardProps:{title:"Border Style",type:"dropdown",settings:{options:ie,selectedValue:o,onChange:e=>{y(e)}}}}];return I.default.createElement(L,{title:"Interface Settings",description:"Set your Spotify interface settings."},Ze(P))},rt=e(r()),nt=()=>{let{playbarSettings:{mode:e,styles:t},setPlaybarMode:a,updatePlaybarStyle:r}=O(),[n,i]=(0,rt.useState)(e);var l=[{id:"playbarOption",conditionalRender:!0,cardProps:{title:"Playbar Option",type:"dropdown",settings:{placeholder:n,selectedValue:n,options:te,onChange:e=>{i(e),a(e)}}}},...Pe(t,e,r)];return rt.default.createElement(L,{title:"Playbar Settings",description:"Set your Spotify Now Playing Bar settings."},Ze(l))},it=e(r()),lt=()=>{let e=O().resetAllSettings;return it.default.createElement(L,{title:"Reset Settings",description:"Reset your theme settings."},Ze([{id:"resetButtonCard",conditionalRender:!0,cardProps:{title:"Reset All Settings",type:"button",settings:{variant:"danger",size:"medium",children:"Reset",onClick:()=>{window.confirm("Are you sure you want to reset all settings to their default values? This action cannot be undone.")&&e()}}}}]))},E=e(r()),ot={settings:!1,changelog:!1},{ModalContextProvider:st,useModal:ct}=(()=>{let i=(0,E.createContext)(null);return{ModalContextProvider:({children:e})=>{let[a,r]=(0,E.useState)(ot),t=(0,E.useCallback)(t=>({isOpen:a[t],openModal:(0,E.useCallback)(()=>{r(e=>l(o({},e),{[t]:!0}))},[t]),closeModal:(0,E.useCallback)(()=>{r(e=>l(o({},e),{[t]:!1}))},[t])}),[a]);var n=(0,E.useMemo)(()=>t,[t]);return E.default.createElement(i.Provider,{value:n},e)},useModal:e=>{var t=(0,E.useContext)(i);if(t)return t(e);throw new Error("Wrap Element with ModalContextProvider")}}})(),k=e(r()),ut=(0,k.memo)(()=>{var{isOpen:e,closeModal:t}=ct("settings");return k.default.createElement(Q,{title:"Lucid Settings",onClose:t,isOpen:e},k.default.createElement("div",{className:"sections-container"},k.default.createElement(Je,null),k.default.createElement(at,null),k.default.createElement(nt,null),k.default.createElement(lt,null),k.default.createElement(Ke,null)))}),dt=e(r()),gt=()=>{f("hook running useSettingsAccess");let t=O().settingAccessPosition,a=ct("settings").openModal,r=(0,dt.useRef)(null);(0,dt.useEffect)(()=>{var e;return"context-menu"===t&&(r.current=new Spicetify.Menu.Item("Lucid Settings",!1,a,''),r.current.register()),"nav"!==t||document.querySelector(".main-actionButtons button[aria-label='Lucid Settings']")||r.current instanceof HTMLButtonElement||(e=new Spicetify.Topbar.Button("Lucid Settings",'',a,!1,!0),r.current=e),()=>{var e;r.current instanceof Spicetify.Menu.Item&&r.current.deregister(),r.current instanceof Spicetify.Topbar.Button&&r.current.element.remove(),null!=(e=document.querySelector(".Root__globalNav .main-actionButtons div:has(button[aria-label='Lucid Settings'])"))&&e.remove()}},[t,a])},mt=e(r()),pt=(0,mt.memo)(()=>{f("Render ");var e=ct("settings").isOpen;return gt(),mt.default.createElement(mt.default.Fragment,null,e&&mt.default.createElement(ut,null))}),ft=(e,t)=>[e,t].filter(Boolean).join(" ").trim(),bt=e=>{var t;return Object.keys(e).length?(t={},void 0!==e.blur&&(t.filter=ft(t.filter,`blur(${e.blur}px)`)),void 0!==e.backdropBlur&&(t.backdropFilter=`blur(${e.backdropBlur}px)`),void 0!==e.contrast&&(t.filter=ft(t.filter,`contrast(${e.contrast})`)),void 0!==e.brightness&&(t.filter=ft(t.filter,`brightness(${e.brightness})`)),void 0!==e.saturation&&(t.filter=ft(t.filter,`saturate(${e.saturation})`)),void 0!==e.width&&(t.width=e.width+"px"),void 0!==e.height&&(t.height=e.height+"px"),void 0===e.paddingX&&void 0===e.paddingY||(t.padding=`${e.paddingY||0}px ${e.paddingX||0}px`),void 0!==e.borderRadius&&(t.borderRadius=e.borderRadius+"px"),void 0!==e.backgroundColor&&(t.backgroundColor=""+e.backgroundColor),t):{}},yt=(e,t=!1)=>{var a;return Object.keys(e).length?(a={},void 0!==e.blur&&(a["--blur"]=e.blur+"px"),void 0!==e.backdropBlur&&(a["--backdrop-blur"]=e.backdropBlur+"px"),void 0!==e.contrast&&(a["--contrast"]=e.contrast),void 0!==e.brightness&&(a["--brightness"]=e.brightness),void 0!==e.saturation&&(a["--saturation"]=e.saturation),void 0!==e.width&&(a["--width"]=e.width+"px"),void 0!==e.height&&(a["--height"]=e.height+"px"),void 0!==e.paddingX&&(a["--padding-x"]=e.paddingX+"px"),void 0!==e.borderRadius&&(a["--border-radius"]=e.borderRadius+"px"),void 0!==e.backgroundColor&&(a["--background-color"]=e.backgroundColor),void 0!==e.time&&(a["--time"]=e.time+"s"),t?Object.entries(a).map(([e,t])=>e+`: ${t};`).join(" "):a):t?"":{}},R=e(r()),t=({style:e})=>R.default.createElement("div",{className:"animated-background-container",style:o({},yt(e))},R.default.createElement("div",{className:"back"}),R.default.createElement("div",{className:"backleft"}),R.default.createElement("div",{className:"backright"}),R.default.createElement("div",{className:"front"})),vt=e(r()),ht=({style:e})=>vt.default.createElement("div",{className:"solid-background",style:o({},bt(e))}),St={underMainBackgroundImage:"",pageCategory:"other",artworkData:{nowPlayingArtURL:"",currentPageURI:"",currentPageArtURL:""},windowZoom:1},x=n(e=>l(o({},St),{updateArtworkData:t=>e(e=>l(o({},e),{artworkData:o(o({},e.artworkData),t)})),setPageCategory:t=>e(e=>l(o({},e),{pageCategory:t})),setUnderMainViewBackgroundImage:t=>e(e=>l(o({},e),{underMainBackgroundImage:t})),setIsCustomControls:t=>e(e=>l(o({},e),{isCustomControls:t})),setWindowZoom:t=>e(e=>l(o({},e),{windowZoom:t}))})),wt=e(r()),n=({style:e})=>{let t=O().backgroundSettings.customBackgroundOverride,a=x().artworkData,r=he().selectedLocalImage;var n=null!=r&&r.dataURL?r.dataURL:"current-page"===(n=t.url)?(null==a?void 0:a.currentPageArtURL)||(null==a?void 0:a.nowPlayingArtURL)||"":n&&""!==n.trim()&&"now-playing"!==n?n||"":(null==a?void 0:a.nowPlayingArtURL)||"";return wt.default.createElement("div",{className:"static-background",style:o({backgroundImage:`url(${n})`},bt(e))})},Et=e(r()),kt={animated:t,static:n,solid:ht},Rt=()=>{f("Render ");var{mode:e,styles:t}=O().backgroundSettings,t=t[e],e=kt[e];return Et.default.createElement("div",{className:"background-wrapper"},e?Et.default.createElement(e,{style:t}):Et.default.createElement(ht,{style:{backgroundColor:"#202020"}}))},xt=()=>{var e=document.querySelector(".Root__right-sidebar .main-nowPlayingView-nowPlayingWidget .main-image-image");return(null==e?void 0:e.src)||""},_t=async e=>{let t=0;for(;t<=3;)try{var a=await Spicetify.GraphQL.Request({name:"queryArtistOverview",operation:"query",sha256Hash:"35648a112beb1794e39ab931365f6ae4a8d45e65396d641eeda94e4003d41497",value:null},{uri:e,includePrerelease:!0,locale:null});if(a)return a}catch(e){if(!(e instanceof Error&&e.message.includes("DUPLICATE_REQUEST_ERROR")&&t<3))throw w("Error fetching artist metadata:",e),e;t++,Be(`Duplicate request detected (getArtistMetaData). Retrying in 1 second... (Attempt ${t})`),await new Promise(e=>setTimeout(e,1e3))}},Ct=async e=>{let t=0;for(;t<=3;)try{var a=await Spicetify.GraphQL.Request({name:"getAlbum",operation:"query",sha256Hash:"469874edcad37b7a379d4f22f0083a49ea3d6ae097916120d9bbe3e36ca79e9d",value:null},{uri:e,locale:null,offset:0,limit:50});if(a)return a}catch(e){if(!(e instanceof Error&&e.message.includes("DUPLICATE_REQUEST_ERROR")&&t<3))throw w("Error fetching album metadata:",e),e;t++,Be(`Duplicate request detected (getAlbumMetaData). Retrying in 1 second... (Attempt ${t})`),await new Promise(e=>setTimeout(e,1e3))}},Pt=e(r()),Lt=()=>{f("Render ");let{pageCategory:e,artworkData:o,updateArtworkData:s}=x(),{pagesSettings:t}=O().interfaceSettings,a=(0,Pt.useCallback)(async()=>{var e,t,a,r,n,i=Spicetify.Platform.History.location.pathname,l=(i=i,l=Spicetify.URI.isPlaylistV1OrV2(i),e=Spicetify.URI.isArtist(i),t=Spicetify.URI.isAlbum(i),a=Spicetify.URI.isShow(i),r=Spicetify.URI.isProfile(i),l||e||t||r||a?(r=null==(r=i.match(/\/(?:playlist|artist|album|user|show)\/([^/]+)/))?void 0:r[1])?`spotify:${l?"playlist":e?"artist":t?"album":a?"show":"user"}:`+r:(Be("No ID found in pathname:",i),null):null);if(o.currentPageURI!==l){document.documentElement.style.setProperty("--artwork-opacity","0");try{l?(n=await(async e=>{var t,a,r,n,i,l,o,s,c,u,d,g,m,p,f,b,y=e.split(":")[1];try{switch(y){case"playlist":case"show":return(null==(t=(await Spicetify.Platform.PlaylistAPI.getMetadata(e)).images.find(e=>e.url))?void 0:t.url)||null;case"artist":var v=await _t(e);return(null==(i=null==(n=null==(r=null==(a=v.data)?void 0:a.artistUnion.visuals.headerImage)?void 0:r.sources)?void 0:n[0])?void 0:i.url)||(null==(c=null==(s=null==(o=null==(l=v.data)?void 0:l.artistUnion.visuals.avatarImage)?void 0:o.sources)?void 0:s[0])?void 0:c.url)||null;case"album":var h=await Ct(e);return(null==(g=null==(d=null==(u=h.data)?void 0:u.albumUnion.coverArt.sources)?void 0:d[2])?void 0:g.url)||(null==(f=null==(p=null==(m=h.data)?void 0:m.albumUnion.coverArt.sources)?void 0:p[0])?void 0:f.url)||null;case"user":var S=await Spicetify.Platform.RequestBuilder.build().withHost("https://spclient.wg.spotify.com/user-profile-view/v3").withPath("/profile/"+e.split(":")[2]).send();return(null==(b=null==S?void 0:S.body)?void 0:b.image_url)||null;default:return null}}catch(e){return w(`Error fetching artwork for ${y}:`,e),null}})(l)||"",s({currentPageArtURL:n,currentPageURI:l})):s({currentPageArtURL:"",currentPageURI:""})}catch(e){w("Error updating artwork:",e),s({currentPageArtURL:"",currentPageURI:""})}finally{setTimeout(()=>document.documentElement.style.setProperty("--artwork-opacity","1"),500)}}},[o.currentPageURI,s]);return(0,Pt.useEffect)(()=>{if(o.currentPageArtURL?(document.documentElement.style.setProperty("--playlist-art-image",`url(${o.currentPageArtURL})`),d("Updated Playlist Artwork URL to "+o.currentPageArtURL)):o.currentPageURI&&"other"!==e&&(w("No artwork URL found for URI: "+o.currentPageURI),document.documentElement.style.setProperty("--playlist-art-image","none")),"inherit"===t.backgroundImageMode){let e=Spicetify.Platform.History.listen(a);return a(),()=>{e()}}},[t.backgroundImageMode,o.currentPageArtURL,o.currentPageURI,e,a]),(0,Pt.useEffect)(()=>{o.nowPlayingArtURL&&(document.documentElement.style.setProperty("--now-playing-art-image",`url("${o.nowPlayingArtURL}")`),d("Updated Now Playing Art View: "+o.nowPlayingArtURL))},[o.nowPlayingArtURL]),(0,Pt.useEffect)(()=>{let e=async()=>{await(async()=>{for(var e;null==(e=null==Spicetify?void 0:Spicetify.Player)||!e.data;)await new Promise(e=>setTimeout(e,100))})();var e=await((e=Spicetify.Player.data.item)&&e.metadata?[e.metadata.image_xlarge_url,e.metadata.image_large_url,e.metadata.image_url,e.metadata.image_small_url].find(e=>e)||xt()||"":(w("No item or metadata found in Spicetify Player data."),""));s({nowPlayingArtURL:e})};return e(),Spicetify.Player.addEventListener("songchange",e),()=>{Spicetify.Player.removeEventListener("songchange",e)}},[s]),null},Ot=e(r()),It=()=>{let{borderSettings:t}=O().interfaceSettings;return(0,Ot.useEffect)(()=>{e=t;var e=Object.keys(e).length?Object.entries(e).map(([e,t])=>`--border-${e}: ${"thickness"===e||"roundedRadius"===e?t+"px":t};`).join(" "):"";document.documentElement.style.cssText+=e},[t]),null},Mt=(e,t,a)=>"#"+(e<<16|t<<8|a).toString(16).padStart(6,"0"),Nt=(e,t,a)=>{var[e,t,a]=[e/255,t/255,a/255],[e,t,a]=[e<=.03928?e/12.92:((e+.055)/1.055)**2.4,t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a<=.03928?a/12.92:((a+.055)/1.055)**2.4];return.2126*e+.7152*t+.0722*a},At=(e,t)=>l(o({},e),{r:Math.max(0,Math.round(e.r*t)),g:Math.max(0,Math.round(e.g*t)),b:Math.max(0,Math.round(e.b*t)),hex:Mt(Math.max(0,Math.round(e.r*t)),Math.max(0,Math.round(e.g*t)),Math.max(0,Math.round(e.b*t)))}),_=(e,t)=>l(o({},e),{r:Math.min(255,Math.round(e.r+(255-e.r)*t)),g:Math.min(255,Math.round(e.g+(255-e.g)*t)),b:Math.min(255,Math.round(e.b+(255-e.b)*t)),hex:Mt(Math.min(255,Math.round(e.r+(255-e.r)*t)),Math.min(255,Math.round(e.g+(255-e.g)*t)),Math.min(255,Math.round(e.b+(255-e.b)*t)))}),Bt=(e,t)=>{e=Nt(e.r,e.g,e.b),t=Nt(t.r,t.g,t.b);return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)},Ut=e(a()),Tt=null;async function Dt(s,e,c){return e&&c?new Promise(o=>{Tt&&clearTimeout(Tt),Tt=setTimeout(async()=>{try{var e,t,a,r=await(async n=>{try{var i=await(0,Ut.loadImage)(n),l=Math.max(i.width/10,10),o=Math.max(i.height/10,10),s=(0,Ut.createCanvas)(l,o).getContext("2d"),c=(s.drawImage(i,0,0,l,o),s.getImageData(0,0,l,o)),u=c.data,d={};let t={};var g=Math.floor(.2*u.length);for(let e=0;et[1]-e[1]).map(([e])=>t[e]),v=y[0];let e=y[1],a=y[2],r=2;for(;!e||Bt(v,e)<2.5;){if(r>=y.length){e=_(v,.2);break}e=y[r],r++}for(;!a||Bt(v,a)<2.5||Bt(e,a)<2.5;){if(r>=y.length){a=_(e,.2);break}a=y[r],r++}return{baseColor:v,secondaryColor:e,tertiaryColor:a}}catch(e){return w("Error extracting colors: ",e),e}})(c);r instanceof Error?(w("Error extracting colors: "+r.message),o(null)):(e=({baseColor:n,secondaryColor:i,tertiaryColor:l}=[r][0],{main:At(i,.4),sidebar:At(i,.5),card:At(l,.5),player:At(i,.6),"progress-bar":_(i,.6),accent:_(n,.4),highlight:_(i,.2),button:_(l,.4),"button-active":_(l,.4),text:_(n,.9),subtext:_(i,.9),primary:n,secondary:i,tertiary:l}),t=s,a=e,a=`:root {${Object.entries(a).map(([e,t])=>` +(async()=>{for(;!Spicetify.React||!Spicetify.ReactDOM;)await new Promise(e=>setTimeout(e,10));var U=Object.create,T=Object.defineProperty,D=Object.defineProperties,$=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,F=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,G=(e,t,a)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,o=(e,t)=>{for(var a in t=t||{})H.call(t,a)&&G(e,a,t[a]);if(V)for(var a of V(t))q.call(t,a)&&G(e,a,t[a]);return e},l=(e,t)=>D(e,j(t)),W=(e,t)=>{var a={};for(r in e)H.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(null!=e&&V)for(var r of V(e))t.indexOf(r)<0&&q.call(e,r)&&(a[r]=e[r]);return a},e=(e,t,a)=>(a=null!=e?U(F(e)):{},((t,a,r,n)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let e of z(a))H.call(t,e)||e===r||T(t,e,{get:()=>a[e],enumerable:!(n=$(a,e))||n.enumerable});return t})(!t&&e&&e.__esModule?a:T(a,"default",{value:e,enumerable:!0}),e)),r=(a=(e,t)=>function(){return t||(0,e[z(e)[0]])((t={exports:{}}).exports,t),t.exports})({"external-global-plugin:react"(e,t){t.exports=Spicetify.React}}),Z=a({"node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(e){function o(e){for(var t=arguments.length,a=new Array(1{if(c[e])return c[e];var t=s.exec(e);if(t){var a,r={weight:"normal",style:"normal",stretch:"normal",variant:"normal",size:parseFloat(t[1]),unit:t[2],family:t[3].replace(/["']/g,"").replace(/ *, */g,",")},t=e.substring(0,t.index);switch((a=n.exec(t))&&(r.weight=a[1]),(a=i.exec(t))&&(r.style=a[1]),(a=l.exec(t))&&(r.variant=a[1]),(a=o.exec(t))&&(r.stretch=a[1]),r.unit){case"pt":r.size/=.75;break;case"pc":r.size*=16;break;case"in":r.size*=96;break;case"cm":r.size*=96/2.54;break;case"mm":r.size*=96/25.4;break;case"%":break;case"em":case"rem":r.size*=16/.75;break;case"q":r.size*=96/25.4/4}return c[e]=r}}}}),a=a({"node_modules/canvas/browser.js"(e){var t=X();e.parseFont=t,e.createCanvas=function(e,t){return Object.assign(document.createElement("canvas"),{width:e,height:t})},e.createImageData=function(e,t,a){switch(arguments.length){case 0:return new ImageData;case 1:return new ImageData(e);case 2:return new ImageData(e,t);default:return new ImageData(e,t,a)}},e.loadImage=function(n,i){return new Promise(function(e,t){let a=Object.assign(document.createElement("img"),i);function r(){a.onload=null,a.onerror=null}a.onload=function(){r(),e(a)},a.onerror=function(){r(),t(new Error('Failed to load the image "'+n+'"'))},a.src=n})}}}),i=e(r()),Q=(0,i.memo)(({title:e,children:t,headingChild:a,onClose:r,isOpen:n=!1})=>n?i.default.createElement("div",{className:"modal-container"},i.default.createElement("div",{className:"modal-overlay "+(n&&"open"),style:{zIndex:20},onClick:r}),i.default.createElement("dialog",{open:n,className:"modal-section "+(n&&"open"),"aria-label":e,"aria-modal":"true"},i.default.createElement("div",{className:"main-embedWidgetGenerator-container"},i.default.createElement("div",{className:"main-trackCreditsModal-header"},i.default.createElement("h1",{className:"encore-text encore-title-body-medium"},e),a&&i.default.createElement("div",null,a),i.default.createElement("button",{type:"button","aria-label":"Close",className:"main-trackCreditsModal-closeBtn",onClick:()=>r()},i.default.createElement("svg",{width:"18",height:"18",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg"},i.default.createElement("title",null,"Close"),i.default.createElement("path",{d:"M31.098 29.794L16.955 15.65 31.097 1.51 29.683.093 15.54 14.237 1.4.094-.016 1.508 14.126 15.65-.016 29.795l1.414 1.414L15.54 17.065l14.144 14.143",fill:"currentColor","fill-rule":"evenodd"})))),i.default.createElement("div",{className:"modal-contents"},i.default.createElement("main",{className:"modal-wrapper"},t))))):null),Y=e(r()),L=({title:e,description:t,children:a})=>Y.default.createElement("div",{className:"setting-section"},Y.default.createElement("div",{className:"heading-wrapper"},Y.default.createElement("h3",{className:"title encore-text encore-text-title-small"},e),t&&Y.default.createElement("p",{className:"desc encore-text encore-text-body-small"},t)),a),ee=[{label:"Animated",value:"animated"},{label:"Static",value:"static"},{label:"Solid",value:"solid"}],te=[{label:"Compact",value:"compact"},{label:"Default",value:"default"},{label:"Rounded",value:"rounded"}],ae=[{label:"Starry",value:"starry"},{label:"Default",value:"default"},{label:"none",value:"none"}],re=[{label:"Now Playing",value:"now-playing"},{label:"Playlist Cover",value:"inherit"},{label:"none",value:"none"}],ne=[{label:"Card",value:"card"},{label:"Compact Card",value:"compact-card"},{label:"Compact",value:"compact"},{label:"Default",value:"default"}],ie=[{label:"None",value:"none"},{label:"Hidden",value:"hidden"},{label:"Dotted",value:"dotted"},{label:"Dashed",value:"dashed"},{label:"Solid",value:"solid"},{label:"Double",value:"double"},{label:"Groove",value:"groove"},{label:"Ridge",value:"ridge"},{label:"Inset",value:"inset"},{label:"Outset",value:"outset"}],le=[{label:"Profile Context Menu",value:"context-menu"},{label:"Global Nav",value:"nav"}],oe={},se=e=>{let r,n=new Set;var t=(e,a)=>{e="function"==typeof e?e(r):e;if(!Object.is(e,r)){let t=r;r=(null!=a?a:"object"!=typeof e||null===e)?e:Object.assign({},r,e),n.forEach(e=>e(r,t))}},a=()=>r,i={setState:t,getState:a,getInitialState:()=>l,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{"production"!==(oe.env?oe.env.MODE:void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};let l=r=e(t,a,i);return i},ce=e=>e?se(e):se,n=e(r(),1),t=e(t(),1),ue={},de=n.default.useDebugValue,ge=t.default.useSyncExternalStoreWithSelector,me=!1,pe=e=>e,fe=e=>{"production"!==(ue.env?ue.env.MODE:void 0)&&"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let r="function"==typeof e?ce(e):e;e=(e,t)=>{return[e,t=pe,a]=[r,e,t],"production"!==(ue.env?ue.env.MODE:void 0)&&a&&!me&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),me=!0),e=ge(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,a),de(e),e;var a};return Object.assign(e,r),e},be={},b=a=>e=>{try{let t=a(e);return t instanceof Promise?t:{then(e){return b(e)(t)},catch(e){return this}}}catch(t){return{then(e){return this},catch(e){return b(e)(t)}}}},ye=(m,p)=>(a,r,e)=>{let n={storage:((e,a)=>{let r;try{r=e()}catch(e){return}return{getItem:e=>{var t=e=>null===e?null:JSON.parse(e,null==a?void 0:a.reviver),e=null!=(e=r.getItem(e))?e:null;return e instanceof Promise?e.then(t):t(e)},setItem:(e,t)=>r.setItem(e,JSON.stringify(t,null==a?void 0:a.replacer)),removeItem:e=>r.removeItem(e)}})(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...p},i=!1,l=new Set,o=new Set,s=n.storage;if(!s)return m((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${n.name}', the given storage is currently unavailable.`),a(...e)},r,e);let c=()=>{var e=n.partialize({...r()});return s.setItem(n.name,{state:e,version:n.version})},u=e.setState,d=(e.setState=(e,t)=>{u(e,t),c()},m((...e)=>{a(...e),c()},r,e));e.getInitialState=()=>d;let g,t=()=>{var e;if(s){i=!1,l.forEach(e=>e(null!=(e=r())?e:d));let t=(null==(e=n.onRehydrateStorage)?void 0:e.call(n,null!=(e=r())?e:d))||void 0;return b(s.getItem.bind(s))(n.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===n.version)return[!1,e.state];if(n.migrate)return[!0,n.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var[e,t]=e;if(g=n.merge(t,null!=(t=r())?t:d),a(g,!0),e)return c()}).then(()=>{null!=t&&t(g,void 0),g=r(),i=!0,o.forEach(e=>e(g))}).catch(e=>{null!=t&&t(void 0,e)})}};return e.persist={setOptions:e=>{n={...n,...e},e.storage&&(s=e.storage)},clearStorage:()=>{null!=s&&s.removeItem(n.name)},getOptions:()=>n,rehydrate:()=>t(),hasHydrated:()=>i,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(o.add(e),()=>{o.delete(e)})},n.skipHydration||t(),g||d},ve={isUseLocalImage:!1,selectedLocalImage:null},he=(n=e=>e?fe(e):fe)((t=(e,t)=>{var p,f;return"getStorage"in t||"serialize"in t||"deserialize"in t?("production"!==(be.env?be.env.MODE:void 0)&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),p=e,f=t,(a,r,e)=>{let n={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...f},i=!1,l=new Set,o=new Set,s;try{s=n.getStorage()}catch(e){}if(!s)return p((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${n.name}', the given storage is currently unavailable.`),a(...e)},r,e);let c=b(n.serialize),u=()=>{var e=n.partialize({...r()});let t;e=c({state:e,version:n.version}).then(e=>s.setItem(n.name,e)).catch(e=>{t=e});if(t)throw t;return e},d=e.setState,g=(e.setState=(e,t)=>{d(e,t),u()},p((...e)=>{a(...e),u()},r,e)),m,t=()=>{var e;if(s){i=!1,l.forEach(e=>e(r()));let t=(null==(e=n.onRehydrateStorage)?void 0:e.call(n,r()))||void 0;return b(s.getItem.bind(s))(n.name).then(e=>{if(e)return n.deserialize(e)}).then(e=>{if(e)return"number"!=typeof e.version||e.version===n.version?e.state:n.migrate?n.migrate(e.state,e.version):void console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}).then(e=>(m=n.merge(e,null!=(e=r())?e:g),a(m,!0),u())).then(()=>{null!=t&&t(m,void 0),i=!0,o.forEach(e=>e(m))}).catch(e=>{null!=t&&t(void 0,e)})}};return e.persist={setOptions:e=>{n={...n,...e},e.getStorage&&(s=e.getStorage())},clearStorage:()=>{null!=s&&s.removeItem(n.name)},getOptions:()=>n,rehydrate:()=>t(),hasHydrated:()=>i,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(o.add(e),()=>{o.delete(e)})},t(),m||g}):ye(e,t)})(t=>l(o({},ve),{setUseLocalImage:e=>t(()=>({isUseLocalImage:e})),setSelectedLocalImage:e=>t(()=>({selectedLocalImage:e})),clearSelectedLocalImage:()=>t(()=>o({},ve))}),{name:"lucid-bg-image"})),Se={backgroundSettings:{mode:"static",styles:{solid:{opacity:1,backgroundColor:"var(--spice-main)"},static:{blur:32,opacity:1,saturation:1.1,contrast:1.2,brightness:.5},animated:{blur:32,time:45,opacity:1,saturation:1.1,contrast:1.2,brightness:.475}},customBackgroundOverride:{url:null}},interfaceSettings:{controlSettings:{height:64},fontSettings:{body:{url:"https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap",fontFamily:"Poppins"}},grainSettings:{grainEffect:"default"},pagesSettings:{isScrollMode:!1,backgroundImageMode:"inherit",playlistViewMode:"card"},borderSettings:{color:"rgba(var(--spice-rgb-selected-row, var(--spice-rgb-text)), 0.125)",style:"inset",thickness:1,roundedRadius:12}},colorSettings:{isDynamicColor:!1},playbarSettings:{mode:"default",styles:{compact:{height:64,opacity:1,saturation:1.1,contrast:1.2,brightness:.8,borderRadius:8,backdropBlur:32,paddingX:6,backgroundColor:"rgba(var(--spice-rgb-player, var(--spice-rgb-card)), 0.5)"},default:{height:80,opacity:1,paddingX:6,saturation:1.1,contrast:1.2,borderRadius:8,brightness:.8,backdropBlur:32,backgroundColor:"rgba(var(--spice-rgb-player, var(--spice-rgb-card)), 0.5)"},rounded:{height:80,opacity:1,paddingX:20,saturation:1.1,contrast:1.2,borderRadius:999,brightness:.8,backdropBlur:32,backgroundColor:"rgba(var(--spice-rgb-player, var(--spice-rgb-card)), 0.5)"}}},settingAccessPosition:"context-menu"},we=e(r()),Ee=()=>we.default.createElement("svg",{role:"img","aria-label":"dismiss",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},we.default.createElement("path",{d:"m4.21 4.387.083-.094a1 1 0 0 1 1.32-.083l.094.083L12 10.585l6.293-6.292a1 1 0 1 1 1.414 1.414L13.415 12l6.292 6.293a1 1 0 0 1 .083 1.32l-.083.094a1 1 0 0 1-1.32.083l-.094-.083L12 13.415l-6.293 6.292a1 1 0 0 1-1.414-1.414L10.585 12 4.293 5.707a1 1 0 0 1-.083-1.32l.083-.094-.083.094Z",fill:"#ffffff"})),ke=e(r()),s=e=>{var{variant:t="primary",size:a="medium",icon:r,children:n}=e,e=W(e,["variant","size","icon","children"]);return ke.default.createElement("button",o({className:`button button-${t} button-`+a},e),r&&ke.default.createElement("span",{className:"button-icon"},r),n)},c=e(r()),Re=0,{ToastContainer:xe,addToast:u}=(()=>{let a;return{ToastContainer:()=>{let[e,n]=(0,c.useState)([]);var t=(0,c.useCallback)((t,a=!1)=>{let r=Re++,e=(n(e=>[...e,{id:r,message:t,isError:a,exiting:!1}]),setTimeout(()=>{i(r)},3e3));return()=>clearTimeout(e)},[]);a=t;let i=t=>{n(e=>e.map(e=>e.id===t?l(o({},e),{exiting:!0}):e)),setTimeout(()=>{n(e=>e.filter(e=>e.id!==t))},500)};return c.default.createElement("div",{className:"toast-container"},e.map(e=>c.default.createElement("div",{key:e.id,className:"toast-element "+(e.exiting?"toast-exit":""),style:{backgroundColor:e.isError?"rgba(200,20,20,0.5)":"rgba(20,20,20,0.5)"}},e.message,c.default.createElement(s,{icon:c.default.createElement(Ee,null),onClick:()=>i(e.id)}))))},addToast:(e,t)=>a(e,t)}})(),O=n(t((n,t)=>l(o({},Se),{exportSettings:()=>{var e=t();return JSON.stringify(e)},importSettings:t=>{try{var e=JSON.parse(t);if("object"==typeof(a=e)&&null!==a&&"backgroundSettings"in a&&"interfaceSettings"in a&&"playbarSettings"in a&&"colorSettings"in a&&"object"==typeof a.backgroundSettings&&"mode"in a.backgroundSettings&&"styles"in a.backgroundSettings&&"object"==typeof a.interfaceSettings&&"borderSettings"in a.interfaceSettings&&"fontSettings"in a.interfaceSettings&&"object"==typeof a.playbarSettings&&"mode"in a.playbarSettings&&"object"==typeof a.colorSettings&&"isDynamicColor"in a.colorSettings)return n(e),u("Settings imported successfully!"),!0;throw new Error("Invalid settings structure")}catch(e){t=e instanceof SyntaxError?"Failed to parse JSON: Please ensure your input is valid JSON.":e instanceof Error?e.message:"An unknown error occurred.";return u(t,!0),!1}var a},setBackgroundSettings:t=>n(e=>({backgroundSettings:o(o({},e.backgroundSettings),t)})),setSettingAccessPosition:e=>n(()=>({settingAccessPosition:e})),setControlHeight:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{controlSettings:{height:t}})})),setCustomBackgroundOverride:t=>n(e=>({backgroundSettings:l(o({},e.backgroundSettings),{customBackgroundOverride:l(o({},e.backgroundSettings.customBackgroundOverride),{url:t})})})),setBorderColor:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:l(o({},e.interfaceSettings.borderSettings),{color:t})})})),setBorderStyle:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:l(o({},e.interfaceSettings.borderSettings),{style:t})})})),setRoundedBorderRadius:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:l(o({},e.interfaceSettings.borderSettings),{roundedRadius:t})})})),setBorderThickness:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:l(o({},e.interfaceSettings.borderSettings),{thickness:t})})})),setBackgroundStyles:(t,a)=>n(e=>({backgroundSettings:l(o({},e.backgroundSettings),{styles:l(o({},e.backgroundSettings.styles),{[a]:o(o({},e.backgroundSettings.styles[a]),t)})})})),setColorSettings:t=>n(e=>({colorSettings:o(o({},e.colorSettings),t)})),setBorderSettings:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{borderSettings:o(o({},e.interfaceSettings.borderSettings),t)})})),setPlaybarSettings:t=>n(e=>({playbarSettings:o(o({},e.playbarSettings),t)})),setInterfaceSettings:t=>n(e=>({interfaceSettings:o(o({},e.interfaceSettings),t)})),setBackgroundMode:t=>n(e=>({backgroundSettings:l(o({},e.backgroundSettings),{mode:t})})),updateBackgroundStyle:(t,a,r)=>n(e=>({backgroundSettings:l(o({},e.backgroundSettings),{styles:l(o({},e.backgroundSettings.styles),{[t]:l(o({},e.backgroundSettings.styles[t]),{[a]:r})})})})),setFont:(t,a)=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{fontSettings:l(o({},e.interfaceSettings.fontSettings),{[t]:o({},a)})})})),setGrainEffect:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{grainSettings:l(o({},e.interfaceSettings.grainSettings),{grainEffect:t})})})),setIsScrollMode:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{pagesSettings:l(o({},e.interfaceSettings.pagesSettings),{isScrollMode:t})})})),setPagesBackgroundImageMode:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{pagesSettings:l(o({},e.interfaceSettings.pagesSettings),{backgroundImageMode:t})})})),setPlaylistViewMode:t=>n(e=>({interfaceSettings:l(o({},e.interfaceSettings),{pagesSettings:l(o({},e.interfaceSettings.pagesSettings),{playlistViewMode:t})})})),setIsDynamicColor:t=>n(e=>({colorSettings:l(o({},e.colorSettings),{isDynamicColor:t})})),updatePlaybarStyle:(t,a,r)=>n(e=>({playbarSettings:l(o({},e.playbarSettings),{styles:l(o({},e.playbarSettings.styles),{[t]:l(o({},e.playbarSettings.styles[t]),{[a]:r})})})})),setPlaybarMode:t=>n(e=>({playbarSettings:l(o({},e.playbarSettings),{mode:t})})),resetAllSettings:()=>{n(Se)}}),{name:"lucid-settings"})),_e=e=>{try{return new URL(e),!0}catch(e){return!1}},Ce=e=>decodeURIComponent((null==(e=null==(e=e.match(/family=([^&:]+)/))?void 0:e[1])?void 0:e.replace(/\+/g," "))||"")||"",Pe=(e,a,r)=>Object.entries(e[a]).map(([t,e])=>({id:"style-"+a,sectionName:"Styles",conditionalRender:!0,cardProps:{title:"Set "+t,type:"input",settings:o({label:"",defaultValue:e},"number"==typeof e?{type:"number",onChange:e=>{r(a,t,Number(e))},settings:{max:256,min:0,step:1}}:{type:"text",onChange:e=>{r(a,t,e)}})}})),Le=console.log,Oe=console.debug,Ie=console.error,Me=console.warn,Ne={prefix:"font-weight: bold; color: #4DB6AC; font-size: 0.85rem;",error:"color: #dc3545;",warn:"color: #ffc107;",debug:"color: #17a2b8;",info:""},Ae=(e,t,...a)=>{var r={info:Le,debug:Oe,error:Ie,warn:Me}[e],e=Ne[e];r("%c[Lucid] %c"+t,Ne.prefix,e,...a)},d=(e,...t)=>Ae("info",e,...t),f=(e,...t)=>Ae("debug",e,...t),w=(e,...t)=>Ae("error",e,...t),Be=(e,...t)=>Ae("warn",e,...t),g=e(r()),Ue=({children:e})=>g.default.createElement("div",{className:"tooltip-container"},g.default.createElement("div",{className:"tooltip"},g.default.createElement("span",{className:"tooltip-icon"},g.default.createElement("svg",{role:"img","aria-label":"Tooltip icon",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},g.default.createElement("path",{d:"M12 2c5.523 0 10 4.478 10 10s-4.477 10-10 10S2 17.522 2 12 6.477 2 12 2Zm0 1.667c-4.595 0-8.333 3.738-8.333 8.333 0 4.595 3.738 8.333 8.333 8.333 4.595 0 8.333-3.738 8.333-8.333 0-4.595-3.738-8.333-8.333-8.333ZM12 15.5a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm0-8.75a2.75 2.75 0 0 1 2.75 2.75c0 1.01-.297 1.574-1.051 2.359l-.169.171c-.622.622-.78.886-.78 1.47a.75.75 0 0 1-1.5 0c0-1.01.297-1.574 1.051-2.359l.169-.171c.622-.622.78-.886.78-1.47a1.25 1.25 0 0 0-2.493-.128l-.007.128a.75.75 0 0 1-1.5 0A2.75 2.75 0 0 1 12 6.75Z",fill:"currentColor"}))),g.default.createElement("span",{className:"tooltip-content"},e))),m=e(r()),Te=({title:e,tooltip:t,selectedValue:a})=>m.default.createElement("div",{className:"title-container"},m.default.createElement("div",{className:"title-wrapper"},e&&m.default.createElement("h5",{className:"encore-text encore-text-body-medium-bold"},e),t&&m.default.createElement(Ue,null,t)),a&&m.default.createElement("p",{className:"selected-value"},"Selected: ",a)),De=e(r()),$e=()=>De.default.createElement("svg",{role:"img","aria-label":"Arrow Down",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},De.default.createElement("path",{d:"M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z",fill:"#ffffff"})),p=e(r()),je=({options:e,selectedValue:a,onChange:t,placeholder:r,disabled:n})=>{let i=(0,p.useRef)(null),[l,o]=(0,p.useState)(!1);let s=e=>{o(!1),t(e)};return(0,p.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),p.default.createElement(p.default.Fragment,null,p.default.createElement("div",{className:"dropdown-container",ref:i},p.default.createElement("button",{className:"dropdown-button "+(l?"open":""),onClick:()=>{o(e=>!e)},"aria-label":"Toggle dropdown menu",type:"button"},p.default.createElement("p",{className:"encore-text"},r||a||"Dropdown"),p.default.createElement("span",{className:"dropdown-arrow"},p.default.createElement($e,null))),p.default.createElement("div",{className:"dropdown-menu "+(l?"open":"")},l?null==e?void 0:e.map(t=>p.default.createElement("li",{key:t.value,className:"dropdown-item "+(a===t.value?"selected":""),onClick:()=>!t.disabled&&s(t.value),onKeyDown:e=>!t.disabled&&"Enter"===e.key&&s(t.value),style:{opacity:""+(n?.75:1)}},p.default.createElement("p",{className:"encore-text"},t.label))):null)))},y=e(r()),ze=(0,y.forwardRef)(({label:e,defaultValue:t,onChange:a,type:r,placeholder:n,settings:i},l)=>{let[o,s]=(0,y.useState)(t||null),c=(0,y.useMemo)(()=>((t,a)=>{let r=null;return(...e)=>{r&&clearTimeout(r),r=setTimeout(()=>{t(...e)},a)}})(e=>{"file"!==r&&null!=a&&a(e)},1e3),[a]);t=(0,y.useCallback)(e=>{var t;"file"===r?(t=e.target.files,null!=a&&a(t)):(t=e.target.value,s(t),c(t))},[c]);return y.default.createElement("div",{className:"input-container"},y.default.createElement("label",{"aria-label":e,className:"file"===r?"input":"label"},y.default.createElement("input",{"aria-label":e,type:r,accept:"file"===r?i?i.accept:"image/*":void 0,multiple:"file"===r?!!i&&i.multiple:void 0,className:"input encore-text",value:null!=o?o:"",onChange:t,placeholder:n,step:"number"===r?null!=i&&i.step?i.step:1:void 0,min:"number"===r?null!=i&&i.min?i.min:0:void 0,max:"number"===r?null!=i&&i.max?i.max:100:void 0,ref:l,style:"file"===r?{display:"none"}:{}}),"file"===r?"Upload Image":null))}),Ve=e(r()),Fe=({onChange:e,checked:t,label:a})=>Ve.default.createElement("div",{className:"slider-wrapper"},Ve.default.createElement("label",{className:"switch","aria-label":a},Ve.default.createElement("input",{"aria-label":"toggleSwtich",type:"checkbox",checked:t,onChange:()=>{e(!t)}}),Ve.default.createElement("span",{className:"slider round"}))),v=e(r()),He=({title:e,tooltip:t,selectedValue:a,type:r,settings:n,children:i,style:l})=>v.default.createElement("div",{className:"card"},v.default.createElement(Te,{title:e,tooltip:t,selectedValue:a}),v.default.createElement("div",{className:"children-wrapper",style:l||{}},"dropdown"===r&&v.default.createElement(je,o({},n)),"input"===r&&v.default.createElement(ze,o({},n)),"toggle"===r&&v.default.createElement(Fe,o({},n)),"button"===r&&v.default.createElement(s,o({},n)),i)),qe=e(r()),Ge=e=>{var{children:t,className:a}=e,e=W(e,["children","className"]);return qe.default.createElement("div",l(o({},e),{className:"cards-wrapper "+(a||"")}),t)},We=e(r()),Ze=e=>{var t,a,r=new Map;for(a of e)r.has(a.id)||r.set(a.id,[]),null!=(t=r.get(a.id))&&t.push(a);return Array.from(r.entries()).map(([e,t])=>{var a;return t[0].conditionalRender?We.default.createElement(Ge,{key:e,id:e,className:e+" combine"},null!=(a=t[0])&&a.sectionName?We.default.createElement("label",{"aria-label":null==(a=t[0])?void 0:a.sectionName,htmlFor:e},null==(a=t[0])?void 0:a.sectionName):null,t.map(e=>e.conditionalRender?We.default.createElement(He,o({key:e.id},e.cardProps)):null)):null})},h=e(r()),Je=()=>{let{backgroundSettings:{mode:e,styles:t,customBackgroundOverride:a},colorSettings:{isDynamicColor:r},setBackgroundMode:n,updateBackgroundStyle:i,setIsDynamicColor:l,setCustomBackgroundOverride:o}=O(),{isUseLocalImage:s,setUseLocalImage:c,selectedLocalImage:u,setSelectedLocalImage:d}=he(),[g,m]=(0,h.useState)(e);var p=[{id:"backgroundOption",conditionalRender:!0,cardProps:{title:"Background Option",type:"dropdown",tooltip:"Select the background mode to customize your background.",settings:{placeholder:g,selectedValue:g,options:ee,onChange:e=>{m(e),n(e)}}}},...Pe(t,e,i),{id:"backgroundCustomImage",sectionName:"Custom Background",conditionalRender:"static"===e,cardProps:{title:"Background image",type:"input",tooltip:h.default.createElement(h.default.Fragment,null,h.default.createElement("span",null,"Use a custom URL for the background image."),h.default.createElement("span",null,"Ensure the URL is a valid image link (e.g., .jpg, .png)."),h.default.createElement("span",null,'Use "now-playing" for the now playing art image.'),h.default.createElement("span",null,'Use "current-page" for the current page art image.')),settings:{type:"text",defaultValue:(null==a?void 0:a.url)||"",label:"Url",validation:e=>_e(e),onChange:e=>{o(e)}}}},{id:"backgroundCustomImage",conditionalRender:"static"===e,cardProps:{title:"Use Local Image",type:"toggle",tooltip:h.default.createElement(h.default.Fragment,null,h.default.createElement("p",null,"Import an image from your device to use as the background."),null!=u&&u.dataURL?h.default.createElement("div",null,h.default.createElement("img",{width:"20rem",src:u.dataURL,alt:`${null==u?void 0:u.fileName} image`,style:{display:"block",width:"20rem",borderRadius:"0.5rem",border:"var(--border-thickness) var(--border-style, solid) var(--border-color, rgba(var(--spice-rgb-text), 0.125))"}}),null!=u&&u.fileName?h.default.createElement("p",null,"File name: ",h.default.createElement("span",null,u.fileName)):null,null!=u&&u.dateAdded?h.default.createElement("p",null,"Date Added: ",h.default.createElement("span",null,u.dateAdded)):null):null),settings:{checked:s,label:"Enable Local Image",onChange:e=>{c(e),!1===e&&d(null)}}}},{id:"backgroundCustomImageInput",conditionalRender:"static"===e&&s,cardProps:{title:"Select Background Image",type:"input",tooltip:"Choose an image file from your device.",settings:{type:"file",label:"Choose File",onChange:e=>{let t=null==e?void 0:e[0];t&&((e=new FileReader).readAsDataURL(t),e.onload=e=>{e=(null==(e=e.target)?void 0:e.result)||"";f("Local Image Data URL:",e),d({dataURL:e,fileName:t.name||"",dateAdded:(new Date).toLocaleString()})})}}}},{id:"dynamicColorToggle",conditionalRender:!0,cardProps:{title:"Dynamic Color",type:"toggle",tooltip:"Enable dynamic color to adjust colors based on current playing album art.",settings:{checked:r,label:"Dynamic Color Toggle",onChange:e=>{l(e)}}}}];return h.default.createElement(L,{title:"Background Settings",description:"Set your Spotify interface settings."},Ze(p))},S=e(r()),Ke=()=>{let{exportSettings:t,importSettings:a}=O(),[e,r]=(0,S.useState)(!1),n=(0,S.useRef)(null);let i=()=>{var e=(null==(e=n.current)?void 0:e.value.trim())||"{}";"{}"===e?u("Please enter valid JSON settings.",!0):a(e)};return S.default.createElement(L,{title:"Settings Import/Export",description:"Manage your settings easily."},S.default.createElement(Ge,null,S.default.createElement(He,{title:"Import and Export Settings",type:"normal",tooltip:"Use these buttons to import settings from a JSON file or export your current theme settings to your clipboard.",style:{display:"flex",gap:"0.5rem"}},S.default.createElement(s,{onClick:()=>{var e=t();navigator.clipboard.writeText(e).then(()=>{u("Settings exported to clipboard!")}).catch(e=>{w("Failed to copy: ",e),u("Failed to copy settings to clipboard.",!0)})}},"Export"),S.default.createElement(s,{onClick:()=>{r(e=>!e),e&&n.current&&(n.current.value="")},variant:e?"danger":"primary"},e?"Cancel Import":"Import")),e&&S.default.createElement(He,{title:"Import Settings JSON",type:"normal",tooltip:"Paste your JSON settings here to import them. Ensure the JSON is correctly formatted.",style:{display:"flex",gap:"0.5rem"}},S.default.createElement(s,{onClick:async()=>{try{var e=await navigator.clipboard.readText();n.current&&(n.current.value=e,i()),u("Clipboard content pasted successfully!")}catch(e){w("Failed to read clipboard: ",e),u("Failed to read clipboard content.",!0)}}},"Paste And Import"),S.default.createElement(ze,{ref:n,type:"text",label:"Paste JSON here",placeholder:"Paste JSON here"}),S.default.createElement(s,{onClick:i},"Import"))))},Xe="1.2.46"<=Spicetify.Platform.version,Qe="light"===(null==Spicetify?void 0:Spicetify.Config.color_scheme)||!1,Ye=!(!Spicetify.Platform||"Windows"!==Spicetify.Platform.operatingSystem)||!(null==(t=null==(t=Spicetify.Platform)?void 0:t.PlatformData)||!t.os_name)&&Spicetify.Platform.PlatformData.os_name.toLowerCase().includes("win"),et=!(!document.querySelector(".globalNav")&&!document.querySelector(".Root__globalNav")),tt=!!document.getElementById("customControls")&&(null!=(t=document.querySelector(".lucid-transperent-window-controls"))&&t.remove(),!0),I=e(r()),at=()=>{let{interfaceSettings:{controlSettings:{height:e},fontSettings:{body:{fontFamily:t}},grainSettings:{grainEffect:a},pagesSettings:{isScrollMode:r,backgroundImageMode:n,playlistViewMode:i},borderSettings:{color:l,style:o,thickness:s,roundedRadius:c}},setFont:u,setGrainEffect:d,setControlHeight:g,setPagesBackgroundImageMode:m,setPlaylistViewMode:p,setIsScrollMode:f,setBorderColor:b,setBorderStyle:y,setBorderThickness:v,settingAccessPosition:h,setRoundedBorderRadius:S,setSettingAccessPosition:w}=O(),[E,k]=(0,I.useState)(a),[R,x]=(0,I.useState)(n),[_,C]=(0,I.useState)(i);var P=[{id:"controlSettings",conditionalRender:Ye,cardProps:{title:"Set Control Height",tooltip:"Set the height of your window controls in pixels.",type:"input",settings:{type:"number",label:"Enter Control Height",defaultValue:e,onChange:e=>{g(Number(e))}}}},{id:"themeSettings",conditionalRender:!0,cardProps:{title:"Settings Access Position",tooltip:"Choose how to access settings: via the context menu button or a navigation button.",type:"dropdown",settings:{options:le,placeholder:h,selectedValue:h,onChange:e=>{w(e)}}}},{id:"font",conditionalRender:!0,cardProps:{title:"Font",type:"input",tooltip:I.default.createElement(I.default.Fragment,null,"Supports both Google Fonts via URL and local fonts.",I.default.createElement("span",null,"For Google Fonts, use the full URL (e.g., https://fonts.googleapis.com/css2?family=Roboto). "),I.default.createElement("span",null,"For local fonts, type the font family name (e.g., 'Arial').")),settings:{type:"text",label:"Font Family or URL",defaultValue:t,onChange:e=>{u("body",(e=>{let t="",a="";return t=_e(e)?(a=e,Ce(e)):a=e,{url:a,fontFamily:t}})(e.toString()))}}}},{id:"grains",conditionalRender:!0,cardProps:{type:"dropdown",title:"Grains",tooltip:"Choose a grain texture mode.",settings:{options:ae,placeholder:E,selectedValue:E,onChange:e=>{k(e),d(e)}}}},{id:"pageSettings",sectionName:"Pages Setting",conditionalRender:!0,cardProps:{type:"dropdown",title:"Pages Background Image",tooltip:"Choose a background image mode for playlist pages.",settings:{options:re,placeholder:R,selectedValue:R,onChange:e=>{x(e),m(e)}}}},{id:"pageSettings",conditionalRender:!0,cardProps:{type:"dropdown",tooltip:"Sets the view mode for playlists.",title:"Playlist View",settings:{options:ne,placeholder:_,selectedValue:_,onChange:e=>{C(e),p(e)}}}},{id:"pageSettings",conditionalRender:!0,cardProps:{title:"Toggle Playlist Scroll Mode",tooltip:"Enable or disable scrolling for the playlist art image.",type:"toggle",settings:{checked:r,label:"Scroll Mode Toggle",onChange:e=>{f(e)}}}},{id:"borderSettings",conditionalRender:!0,sectionName:"Border Settings",cardProps:{title:"Border Thickness",type:"input",settings:{type:"number",label:"Border Thickness",defaultValue:s,onChange:e=>{v(Number(e))},settings:{step:1,min:0,max:16}}}},{id:"borderSettings",conditionalRender:!0,sectionName:"Border Settings",cardProps:{title:"Rounded Border Radius",type:"input",settings:{type:"number",label:"Rounded Border Radius",defaultValue:c,onChange:e=>{S(Number(e))}}}},{id:"borderSettings",conditionalRender:!0,cardProps:{title:"Border Color",type:"input",settings:{type:"text",label:"Border Color",defaultValue:l,onChange:e=>{b(e)}}}},{id:"borderSettings",conditionalRender:!0,cardProps:{title:"Border Style",type:"dropdown",settings:{options:ie,selectedValue:o,onChange:e=>{y(e)}}}}];return I.default.createElement(L,{title:"Interface Settings",description:"Set your Spotify interface settings."},Ze(P))},rt=e(r()),nt=()=>{let{playbarSettings:{mode:e,styles:t},setPlaybarMode:a,updatePlaybarStyle:r}=O(),[n,i]=(0,rt.useState)(e);var l=[{id:"playbarOption",conditionalRender:!0,cardProps:{title:"Playbar Option",type:"dropdown",settings:{placeholder:n,selectedValue:n,options:te,onChange:e=>{i(e),a(e)}}}},...Pe(t,e,r)];return rt.default.createElement(L,{title:"Playbar Settings",description:"Set your Spotify Now Playing Bar settings."},Ze(l))},it=e(r()),lt=()=>{let e=O().resetAllSettings;return it.default.createElement(L,{title:"Reset Settings",description:"Reset your theme settings."},Ze([{id:"resetButtonCard",conditionalRender:!0,cardProps:{title:"Reset All Settings",type:"button",settings:{variant:"danger",size:"medium",children:"Reset",onClick:()=>{window.confirm("Are you sure you want to reset all settings to their default values? This action cannot be undone.")&&e()}}}}]))},E=e(r()),ot={settings:!1,changelog:!1},{ModalContextProvider:st,useModal:ct}=(()=>{let i=(0,E.createContext)(null);return{ModalContextProvider:({children:e})=>{let[a,r]=(0,E.useState)(ot),t=(0,E.useCallback)(t=>({isOpen:a[t],openModal:(0,E.useCallback)(()=>{r(e=>l(o({},e),{[t]:!0}))},[t]),closeModal:(0,E.useCallback)(()=>{r(e=>l(o({},e),{[t]:!1}))},[t])}),[a]);var n=(0,E.useMemo)(()=>t,[t]);return E.default.createElement(i.Provider,{value:n},e)},useModal:e=>{var t=(0,E.useContext)(i);if(t)return t(e);throw new Error("Wrap Element with ModalContextProvider")}}})(),k=e(r()),ut=(0,k.memo)(()=>{var{isOpen:e,closeModal:t}=ct("settings");return k.default.createElement(Q,{title:"Lucid Settings",onClose:t,isOpen:e},k.default.createElement("div",{className:"sections-container"},k.default.createElement(Je,null),k.default.createElement(at,null),k.default.createElement(nt,null),k.default.createElement(lt,null),k.default.createElement(Ke,null)))}),dt=e(r()),gt=()=>{f("hook running useSettingsAccess");let t=O().settingAccessPosition,a=ct("settings").openModal,r=(0,dt.useRef)(null);(0,dt.useEffect)(()=>{var e;return"context-menu"===t&&(r.current=new Spicetify.Menu.Item("Lucid Settings",!1,a,''),r.current.register()),"nav"!==t||document.querySelector(".main-actionButtons button[aria-label='Lucid Settings']")||r.current instanceof HTMLButtonElement||(e=new Spicetify.Topbar.Button("Lucid Settings",'',a,!1,!0),r.current=e),()=>{var e;r.current instanceof Spicetify.Menu.Item&&r.current.deregister(),r.current instanceof Spicetify.Topbar.Button&&r.current.element.remove(),null!=(e=document.querySelector(".Root__globalNav .main-actionButtons div:has(button[aria-label='Lucid Settings'])"))&&e.remove()}},[t,a])},mt=e(r()),pt=(0,mt.memo)(()=>{f("Render ");var e=ct("settings").isOpen;return gt(),mt.default.createElement(mt.default.Fragment,null,e&&mt.default.createElement(ut,null))}),ft=(e,t)=>[e,t].filter(Boolean).join(" ").trim(),bt=e=>{var t;return Object.keys(e).length?(t={},void 0!==e.blur&&(t.filter=ft(t.filter,`blur(${e.blur}px)`)),void 0!==e.backdropBlur&&(t.backdropFilter=`blur(${e.backdropBlur}px)`),void 0!==e.contrast&&(t.filter=ft(t.filter,`contrast(${e.contrast})`)),void 0!==e.brightness&&(t.filter=ft(t.filter,`brightness(${e.brightness})`)),void 0!==e.saturation&&(t.filter=ft(t.filter,`saturate(${e.saturation})`)),void 0!==e.width&&(t.width=e.width+"px"),void 0!==e.height&&(t.height=e.height+"px"),void 0===e.paddingX&&void 0===e.paddingY||(t.padding=`${e.paddingY||0}px ${e.paddingX||0}px`),void 0!==e.borderRadius&&(t.borderRadius=e.borderRadius+"px"),void 0!==e.backgroundColor&&(t.backgroundColor=""+e.backgroundColor),t):{}},yt=(e,t=!1)=>{var a;return Object.keys(e).length?(a={},void 0!==e.blur&&(a["--blur"]=e.blur+"px"),void 0!==e.backdropBlur&&(a["--backdrop-blur"]=e.backdropBlur+"px"),void 0!==e.contrast&&(a["--contrast"]=e.contrast),void 0!==e.brightness&&(a["--brightness"]=e.brightness),void 0!==e.saturation&&(a["--saturation"]=e.saturation),void 0!==e.width&&(a["--width"]=e.width+"px"),void 0!==e.height&&(a["--height"]=e.height+"px"),void 0!==e.paddingX&&(a["--padding-x"]=e.paddingX+"px"),void 0!==e.borderRadius&&(a["--border-radius"]=e.borderRadius+"px"),void 0!==e.backgroundColor&&(a["--background-color"]=e.backgroundColor),void 0!==e.time&&(a["--time"]=e.time+"s"),t?Object.entries(a).map(([e,t])=>e+`: ${t};`).join(" "):a):t?"":{}},R=e(r()),t=({style:e})=>R.default.createElement("div",{className:"animated-background-container",style:o({},yt(e))},R.default.createElement("div",{className:"back"}),R.default.createElement("div",{className:"backleft"}),R.default.createElement("div",{className:"backright"}),R.default.createElement("div",{className:"front"})),vt=e(r()),ht=({style:e})=>vt.default.createElement("div",{className:"solid-background",style:o({},bt(e))}),St={underMainBackgroundImage:"",pageCategory:"other",artworkData:{nowPlayingArtURL:"",currentPageURI:"",currentPageArtURL:""},windowZoom:1},x=n(e=>l(o({},St),{updateArtworkData:t=>e(e=>l(o({},e),{artworkData:o(o({},e.artworkData),t)})),setPageCategory:t=>e(e=>l(o({},e),{pageCategory:t})),setUnderMainViewBackgroundImage:t=>e(e=>l(o({},e),{underMainBackgroundImage:t})),setIsCustomControls:t=>e(e=>l(o({},e),{isCustomControls:t})),setWindowZoom:t=>e(e=>l(o({},e),{windowZoom:t}))})),wt=e(r()),n=({style:e})=>{let t=O().backgroundSettings.customBackgroundOverride,a=x().artworkData,{isUseLocalImage:r,selectedLocalImage:n}=he();var i=r&&null!=n&&n.dataURL?n.dataURL:"current-page"===(i=t.url)?(null==a?void 0:a.currentPageArtURL)||(null==a?void 0:a.nowPlayingArtURL)||"":i&&""!==i.trim()&&"now-playing"!==i?i||"":(null==a?void 0:a.nowPlayingArtURL)||"";return wt.default.createElement("div",{className:"static-background",style:o({backgroundImage:`url(${i})`},bt(e))})},Et=e(r()),kt={animated:t,static:n,solid:ht},Rt=()=>{f("Render ");var{mode:e,styles:t}=O().backgroundSettings,t=t[e],e=kt[e];return Et.default.createElement("div",{className:"background-wrapper"},e?Et.default.createElement(e,{style:t}):Et.default.createElement(ht,{style:{backgroundColor:"#202020"}}))},xt=()=>{var e=document.querySelector(".Root__right-sidebar .main-nowPlayingView-nowPlayingWidget .main-image-image");return(null==e?void 0:e.src)||""},_t=async e=>{let t=0;for(;t<=3;)try{var a=await Spicetify.GraphQL.Request({name:"queryArtistOverview",operation:"query",sha256Hash:"35648a112beb1794e39ab931365f6ae4a8d45e65396d641eeda94e4003d41497",value:null},{uri:e,includePrerelease:!0,locale:null});if(a)return a}catch(e){if(!(e instanceof Error&&e.message.includes("DUPLICATE_REQUEST_ERROR")&&t<3))throw w("Error fetching artist metadata:",e),e;t++,Be(`Duplicate request detected (getArtistMetaData). Retrying in 1 second... (Attempt ${t})`),await new Promise(e=>setTimeout(e,1e3))}},Ct=async e=>{let t=0;for(;t<=3;)try{var a=await Spicetify.GraphQL.Request({name:"getAlbum",operation:"query",sha256Hash:"469874edcad37b7a379d4f22f0083a49ea3d6ae097916120d9bbe3e36ca79e9d",value:null},{uri:e,locale:null,offset:0,limit:50});if(a)return a}catch(e){if(!(e instanceof Error&&e.message.includes("DUPLICATE_REQUEST_ERROR")&&t<3))throw w("Error fetching album metadata:",e),e;t++,Be(`Duplicate request detected (getAlbumMetaData). Retrying in 1 second... (Attempt ${t})`),await new Promise(e=>setTimeout(e,1e3))}},Pt=e(r()),Lt=()=>{f("Render ");let{pageCategory:e,artworkData:o,updateArtworkData:s}=x(),{pagesSettings:t}=O().interfaceSettings,a=(0,Pt.useCallback)(async()=>{var e,t,a,r,n,i=Spicetify.Platform.History.location.pathname,l=(i=i,l=Spicetify.URI.isPlaylistV1OrV2(i),e=Spicetify.URI.isArtist(i),t=Spicetify.URI.isAlbum(i),a=Spicetify.URI.isShow(i),r=Spicetify.URI.isProfile(i),l||e||t||r||a?(r=null==(r=i.match(/\/(?:playlist|artist|album|user|show)\/([^/]+)/))?void 0:r[1])?`spotify:${l?"playlist":e?"artist":t?"album":a?"show":"user"}:`+r:(Be("No ID found in pathname:",i),null):null);if(o.currentPageURI!==l){document.documentElement.style.setProperty("--artwork-opacity","0");try{l?(n=await(async e=>{var t,a,r,n,i,l,o,s,c,u,d,g,m,p,f,b,y=e.split(":")[1];try{switch(y){case"playlist":case"show":return(null==(t=(await Spicetify.Platform.PlaylistAPI.getMetadata(e)).images.find(e=>e.url))?void 0:t.url)||null;case"artist":var v=await _t(e);return(null==(i=null==(n=null==(r=null==(a=v.data)?void 0:a.artistUnion.visuals.headerImage)?void 0:r.sources)?void 0:n[0])?void 0:i.url)||(null==(c=null==(s=null==(o=null==(l=v.data)?void 0:l.artistUnion.visuals.avatarImage)?void 0:o.sources)?void 0:s[0])?void 0:c.url)||null;case"album":var h=await Ct(e);return(null==(g=null==(d=null==(u=h.data)?void 0:u.albumUnion.coverArt.sources)?void 0:d[2])?void 0:g.url)||(null==(f=null==(p=null==(m=h.data)?void 0:m.albumUnion.coverArt.sources)?void 0:p[0])?void 0:f.url)||null;case"user":var S=await Spicetify.Platform.RequestBuilder.build().withHost("https://spclient.wg.spotify.com/user-profile-view/v3").withPath("/profile/"+e.split(":")[2]).send();return(null==(b=null==S?void 0:S.body)?void 0:b.image_url)||null;default:return null}}catch(e){return w(`Error fetching artwork for ${y}:`,e),null}})(l)||"",s({currentPageArtURL:n,currentPageURI:l})):s({currentPageArtURL:"",currentPageURI:""})}catch(e){w("Error updating artwork:",e),s({currentPageArtURL:"",currentPageURI:""})}finally{setTimeout(()=>document.documentElement.style.setProperty("--artwork-opacity","1"),500)}}},[o.currentPageURI,s]);return(0,Pt.useEffect)(()=>{if(o.currentPageArtURL?(document.documentElement.style.setProperty("--playlist-art-image",`url(${o.currentPageArtURL})`),d("Updated Playlist Artwork URL to "+o.currentPageArtURL)):o.currentPageURI&&"other"!==e&&(w("No artwork URL found for URI: "+o.currentPageURI),document.documentElement.style.setProperty("--playlist-art-image","none")),"inherit"===t.backgroundImageMode){let e=Spicetify.Platform.History.listen(a);return a(),()=>{e()}}},[t.backgroundImageMode,o.currentPageArtURL,o.currentPageURI,e,a]),(0,Pt.useEffect)(()=>{o.nowPlayingArtURL&&(document.documentElement.style.setProperty("--now-playing-art-image",`url("${o.nowPlayingArtURL}")`),d("Updated Now Playing Art View: "+o.nowPlayingArtURL))},[o.nowPlayingArtURL]),(0,Pt.useEffect)(()=>{let e=async()=>{await(async()=>{for(var e;null==(e=null==Spicetify?void 0:Spicetify.Player)||!e.data;)await new Promise(e=>setTimeout(e,100))})();var e=await((e=Spicetify.Player.data.item)&&e.metadata?[e.metadata.image_xlarge_url,e.metadata.image_large_url,e.metadata.image_url,e.metadata.image_small_url].find(e=>e)||xt()||"":(w("No item or metadata found in Spicetify Player data."),""));s({nowPlayingArtURL:e})};return e(),Spicetify.Player.addEventListener("songchange",e),()=>{Spicetify.Player.removeEventListener("songchange",e)}},[s]),null},Ot=e(r()),It=()=>{let{borderSettings:t}=O().interfaceSettings;return(0,Ot.useEffect)(()=>{e=t;var e=Object.keys(e).length?Object.entries(e).map(([e,t])=>`--border-${e}: ${"thickness"===e||"roundedRadius"===e?t+"px":t};`).join(" "):"";document.documentElement.style.cssText+=e},[t]),null},Mt=(e,t,a)=>"#"+(e<<16|t<<8|a).toString(16).padStart(6,"0"),Nt=(e,t,a)=>{var[e,t,a]=[e/255,t/255,a/255],[e,t,a]=[e<=.03928?e/12.92:((e+.055)/1.055)**2.4,t<=.03928?t/12.92:((t+.055)/1.055)**2.4,a<=.03928?a/12.92:((a+.055)/1.055)**2.4];return.2126*e+.7152*t+.0722*a},At=(e,t)=>l(o({},e),{r:Math.max(0,Math.round(e.r*t)),g:Math.max(0,Math.round(e.g*t)),b:Math.max(0,Math.round(e.b*t)),hex:Mt(Math.max(0,Math.round(e.r*t)),Math.max(0,Math.round(e.g*t)),Math.max(0,Math.round(e.b*t)))}),_=(e,t)=>l(o({},e),{r:Math.min(255,Math.round(e.r+(255-e.r)*t)),g:Math.min(255,Math.round(e.g+(255-e.g)*t)),b:Math.min(255,Math.round(e.b+(255-e.b)*t)),hex:Mt(Math.min(255,Math.round(e.r+(255-e.r)*t)),Math.min(255,Math.round(e.g+(255-e.g)*t)),Math.min(255,Math.round(e.b+(255-e.b)*t)))}),Bt=(e,t)=>{e=Nt(e.r,e.g,e.b),t=Nt(t.r,t.g,t.b);return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)},Ut=e(a()),Tt=null;async function Dt(s,e,c){return e&&c?new Promise(o=>{Tt&&clearTimeout(Tt),Tt=setTimeout(async()=>{try{var e,t,a,r=await(async n=>{try{var i=await(0,Ut.loadImage)(n),l=Math.max(i.width/10,10),o=Math.max(i.height/10,10),s=(0,Ut.createCanvas)(l,o).getContext("2d"),c=(s.drawImage(i,0,0,l,o),s.getImageData(0,0,l,o)),u=c.data,d={};let t={};var g=Math.floor(.2*u.length);for(let e=0;et[1]-e[1]).map(([e])=>t[e]),v=y[0];let e=y[1],a=y[2],r=2;for(;!e||Bt(v,e)<2.5;){if(r>=y.length){e=_(v,.2);break}e=y[r],r++}for(;!a||Bt(v,a)<2.5||Bt(e,a)<2.5;){if(r>=y.length){a=_(e,.2);break}a=y[r],r++}return{baseColor:v,secondaryColor:e,tertiaryColor:a}}catch(e){return w("Error extracting colors: ",e),e}})(c);r instanceof Error?(w("Error extracting colors: "+r.message),o(null)):(e=({baseColor:n,secondaryColor:i,tertiaryColor:l}=[r][0],{main:At(i,.4),sidebar:At(i,.5),card:At(l,.5),player:At(i,.6),"progress-bar":_(i,.6),accent:_(n,.4),highlight:_(i,.2),button:_(l,.4),"button-active":_(l,.4),text:_(n,.9),subtext:_(i,.9),primary:n,secondary:i,tertiary:l}),t=s,a=e,a=`:root {${Object.entries(a).map(([e,t])=>` --spice-${e}: ${t.hex} !important; --spice-rgb-${e}: ${t.r}, ${t.g}, ${t.b} !important;`).join("")} -}`,a+=":root{\nwill-change: --spice-main,--spice-rgb-main,--spice-sidebar,--spice-rgb-sidebar,--spice-card,--spice-rgb-card,--spice-player,--spice-rgb-player,--spice-accent,--spice-rgb-accent,--spice-highlight,--spice-rgb-highlight,--spice-button,--spice-rgb-button,--spice-button-active,--spice-rgb-button-active,--spice-text,--spice-rgb-text,--spice-progress-bar,--spice-rgb-progress-bar,--spice-subtext,--spice-rgb-subtext,--spice-primary,--spice-rgb-primary,--spice-secondary,--spice-rgb-secondary,--spice-tertiary,--spice-rgb-tertiary;\ntransition: all 0.3s ease-in-out;\n}",t.textContent=a,o(r))}catch(e){w("Error saving colors to style: ",e instanceof Error?e.message:e),o(null)}var n,i,l},200)}):null}var $t=e(r()),jt=()=>{f("Render ");let{isDynamicColor:e}=O().colorSettings,t=x().artworkData,a=(0,$t.useRef)(null),r=(0,$t.useRef)(null);return(0,$t.useEffect)(()=>(a.current=document.createElement("style"),a.current.id="lucid_dynamic_colors",document.head.appendChild(a.current),()=>{a.current&&document.head.removeChild(a.current)}),[]),(0,$t.useEffect)(()=>{e?e&&t.nowPlayingArtURL!==r.current&&(null!=a&&a.current&&e&&t.nowPlayingArtURL&&Dt(a.current,e,t.nowPlayingArtURL).then(()=>{d("Dynamic colors updated!")}).catch(e=>{w("Error updating colors:",e)}),r.current=t.nowPlayingArtURL):(r.current&&(r.current=null),a.current&&(async e=>{e.textContent=":root{\nwill-change: --spice-main,--spice-rgb-main,--spice-sidebar,--spice-rgb-sidebar,--spice-card,--spice-rgb-card,--spice-player,--spice-rgb-player,--spice-accent,--spice-rgb-accent,--spice-highlight,--spice-rgb-highlight,--spice-button,--spice-rgb-button,--spice-button-active,--spice-rgb-button-active,--spice-text,--spice-rgb-text,--spice-progress-bar,--spice-rgb-progress-bar,--spice-subtext,--spice-rgb-subtext,--spice-primary,--spice-rgb-primary,--spice-secondary,--spice-rgb-secondary,--spice-tertiary,--spice-rgb-tertiary;\ntransition: all 0.3s ease-in-out;\n}"})(a.current))},[e,t.nowPlayingArtURL]),null},zt=e(r()),Vt=()=>{f("Render ");let{fontSettings:e}=O().interfaceSettings,n=(0,zt.useCallback)((e,t)=>{document.documentElement.style.setProperty(`--${e}-font-to-use`,t)},[]),t=(0,zt.useCallback)(async t=>{var{fontFamily:a,url:r}=e[t];try{await((e,t)=>{let a=document.getElementById(t);a||((a=document.createElement("link")).rel="stylesheet",a.id=t,document.head.appendChild(a)),a.href=e})(r,t+"-font"),n(t,a)}catch(e){w("Failed to load font from "+r,e),n(t,a)}},[e,n]);return(0,zt.useEffect)(()=>{f("useFontManager effect ran."),Object.keys(e).map(e=>t(e))},[e,t]),null},Ft=e(r()),C=e=>{(0,Ft.useEffect)(()=>{if(e)return document.body.classList.add(e),()=>{document.body.classList.remove(e)}},[e])},Ht=()=>(f("Render "),C(et?"global-nav":"control-nav"),null),qt=e(r()),Gt=()=>{f("Render ");var{grainSettings:{grainEffect:e}}=O().interfaceSettings;return C("grain-"+e),qt.default.createElement("div",{id:"grainEffect","data-grainEffect":e})},Wt=e(r()),Zt=()=>{let{pageCategory:e,setPageCategory:a}=x();return C(e),(0,Wt.useEffect)(()=>{let e=()=>{var e=Spicetify.Platform.History.location.pathname;a((e=e,Spicetify.URI.isPlaylistV1OrV2(e)?"playlist":Spicetify.URI.isArtist(e)?"artist":Spicetify.URI.isAlbum(e)?"album":Spicetify.URI.isGenre(e)?"genre":Spicetify.URI.isShow(e)?"show":Spicetify.URI.isSearch(e)?"search":Spicetify.URI.isProfile(e)?"profile":Spicetify.URI.isConcert(e)||Spicetify.URI.isArtistConcerts(e)?"concert":"other"))},t=(e(),Spicetify.Platform.History.listen(()=>{e()}));return()=>{t()}},[a]),null},Jt=e(r()),Kt=".Root__now-playing-bar",Xt=()=>{let n=O().playbarSettings,i=(0,Jt.useRef)(document.querySelector(Kt));return C("playbar-"+n.mode),(0,Jt.useEffect)(()=>{var e,t,a,r;i.current?({mode:t,styles:r}=n,a=yt(r[t],!0),r="compact"===t?r[t].height:(null==(e=i.current)?void 0:e.clientHeight)||(null==(e=r[t])?void 0:e.height),document.documentElement.style.setProperty("--playbar-height",r+"px"),i.current.style.cssText=a.toString()):w(`Playbar element with class '${Kt}' not found!`)},[n]),null},Qt=e(r()),Yt=()=>{let{underMainBackgroundImage:a,setUnderMainViewBackgroundImage:r}=x(),n=(0,Qt.useCallback)(e=>{e=e.reduce((e,t)=>{if(e)return e;if("childList"===t.type&&0{let e=new MutationObserver(n);var t=document.querySelector(".under-main-view");return t&&e.observe(t,{childList:!0}),()=>e.disconnect()},[n]),(0,Qt.useEffect)(()=>(document.documentElement.style.setProperty("--under-main-view-art-image",a?`url(${a})`:null),()=>{document.documentElement.style.removeProperty("--under-main-view-art-image")}),[a])},P=e(r()),ea=()=>{f("Render ");let{pagesSettings:{playlistViewMode:e,isScrollMode:a,backgroundImageMode:t}}=O().interfaceSettings,{pageCategory:r,underMainBackgroundImage:n,artworkData:i}=x(),l=(0,P.useRef)(null),o=(0,P.useRef)(null),s=(C("playlist-view-"+e),C("playlist-art-image-"+t),C(n?"under-main-view-present":""),(0,P.useCallback)(e=>{var t=l.current;t&&(e=Math.min(e.scrollTop,window.innerHeight),t.style.transform=`translate3d(0, ${a?-e:0}px, 0)`,t.style.setProperty("--scroll",""+e/1e3))},[a])),c=(0,P.useMemo)(()=>"artist"===r||n?0:4,[r,n]);(0,P.useEffect)(()=>{var e=o.current;e&&e.style.setProperty("--blur",c+"px")},[c]),(0,P.useEffect)(()=>{let t=document.querySelector(".Root__main-view .os-viewport, .Root__main-view .main-view-container > .main-view-container__scroll-node:not([data-overlayscrollbars-initialize]), .Root__main-view .main-view-container__scroll-node > [data-overlayscrollbars-viewport]");if(t){let e=()=>s(t);return e(),t.addEventListener("scroll",e,{passive:!0}),()=>{t.removeEventListener("scroll",e)}}},[s]),f("underMainBackgroundImage",n);var u="other"!==r&&"none"!==t?n||("inherit"===t?i.currentPageArtURL||"":i.nowPlayingArtURL||""):"none";return P.default.createElement("span",{id:"playlistArtContainer",className:`playlist-art-container ${e} `+t,"data-playlist-view-mode":e,ref:l},P.default.createElement("div",{className:"background",ref:o,style:{backgroundImage:`url(${u})`}}),P.default.createElement("div",{className:"overlay",style:{height:"100%",width:"100%",position:"absolute",inset:0}}))},ta=e(r()),aa=()=>(f("Render "),(()=>{let a=(0,ta.useRef)(null);(0,ta.useEffect)(()=>{let e=()=>{var e,t;document.getElementById("lucid-under-main-view")||((e=document.createElement("div")).id="lucid-under-main-view",e.className="lucid-under-main-view",(t=document.querySelector(".main-view-container"))&&t.prepend(e),a.current=e,a.current&&Spicetify.ReactDOM.createRoot(a.current).render(ta.default.createElement(ea,null)))},t=(e(),Spicetify.Platform.History.listen(()=>{e()}));return()=>{t()}},[])})(),Yt(),null),ra=e(r()),na=()=>{var e=(0,ra.useRef)(null);let[t,r]=(0,ra.useState)({}),n=x().windowZoom,{controlSettings:{height:i}}=O().interfaceSettings;return(0,ra.useEffect)(()=>{let e=()=>{var e;Ye&&((async t=>{var e;try{null!=(e=null==Spicetify?void 0:Spicetify.CosmosAsync)&&e.post&&await Spicetify.CosmosAsync.post("sp://messages/v1/container/control",{type:"update_titlebar",height:t}),d(`Control height set to ${t}px`)}catch(e){w("Error setting control height: "+t)}})(i),tt||Qe?r({}):(e=(Xe?32:64)/n,e={position:"fixed",right:0,top:(i/n-Math.min(32/n,i/n))/2+"px",height:e+"px",width:135/n+"px",WebkitBackdropFilter:"brightness(2.12)",backdropFilter:"brightness(2.12)",zIndex:"var(--above-main-and-now-playing-view-grid-area, 6)"},r(e)))},t=(e(),()=>{e()}),a=setTimeout(e,1e3);return window.addEventListener("resize",t),()=>{clearTimeout(a),window.removeEventListener("resize",t)}},[n,i]),ra.default.createElement("div",{ref:e,style:t})},M=e(r()),ia=(0,M.memo)(()=>M.default.createElement(M.default.Fragment,null,Ye?M.default.createElement("div",{id:"transperent-controls-container",className:"transperent-controls-container",style:{containerType:"normal"}},!tt&&Ye?M.default.createElement(na,null):null):null)),N=e(r()),A=e(r()),la=()=>{(0,A.useRef)({outerWidth:window.outerWidth,innerWidth:window.innerWidth,ratio:window.devicePixelRatio});let n=x().setWindowZoom,i=(0,A.useRef)(window.outerWidth),l=(0,A.useRef)(window.innerWidth),o=(0,A.useRef)(window.devicePixelRatio),s=(0,A.useRef)(!0),c=(0,A.useRef)(document.querySelector(".Root__main-view"));return(0,A.useEffect)(()=>{let e=()=>{document.documentElement.style.setProperty("--main-view-height",`${null==(t=c.current)?void 0:t.clientHeight}px`);var e,t=window.outerWidth,a=window.innerWidth,r=window.devicePixelRatio;(s.current||(i.current<=160||o.current!==r)&&(i.current!==t||l.current!==a))&&(e=t/a||1,n(e),document.documentElement.style.setProperty("--zoom",""+e),f(`Zoom Updated: ${t} / ${a} = `+e),i.current=t,l.current=a,o.current=r)},t=()=>{e()};return e(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[n]),null},oa=()=>(f("Render "),N.default.createElement(N.default.Fragment,null,N.default.createElement(Zt,null),N.default.createElement(Gt,null),N.default.createElement(jt,null),N.default.createElement(la,null),N.default.createElement(Xt,null),N.default.createElement(Lt,null),N.default.createElement(It,null),N.default.createElement(Ht,null),N.default.createElement(Vt,null),N.default.createElement(aa,null),N.default.createElement(ia,null)));function sa(e,t){e.innerHTML=` +}`,a+=":root{\nwill-change: --spice-main,--spice-rgb-main,--spice-sidebar,--spice-rgb-sidebar,--spice-card,--spice-rgb-card,--spice-player,--spice-rgb-player,--spice-accent,--spice-rgb-accent,--spice-highlight,--spice-rgb-highlight,--spice-button,--spice-rgb-button,--spice-button-active,--spice-rgb-button-active,--spice-text,--spice-rgb-text,--spice-progress-bar,--spice-rgb-progress-bar,--spice-subtext,--spice-rgb-subtext,--spice-primary,--spice-rgb-primary,--spice-secondary,--spice-rgb-secondary,--spice-tertiary,--spice-rgb-tertiary;\ntransition: all 0.3s ease-in-out;\n}",t.textContent=a,o(r))}catch(e){w("Error saving colors to style: ",e instanceof Error?e.message:e),o(null)}var n,i,l},200)}):null}var $t=e(r()),jt=()=>{f("Render ");let{isDynamicColor:e}=O().colorSettings,t=x().artworkData,a=(0,$t.useRef)(null),r=(0,$t.useRef)(null);return(0,$t.useEffect)(()=>(a.current=document.createElement("style"),a.current.id="lucid_dynamic_colors",document.head.appendChild(a.current),()=>{a.current&&document.head.removeChild(a.current)}),[]),(0,$t.useEffect)(()=>{e?e&&t.nowPlayingArtURL!==r.current&&(null!=a&&a.current&&e&&t.nowPlayingArtURL&&Dt(a.current,e,t.nowPlayingArtURL).then(()=>{d("Dynamic colors updated!")}).catch(e=>{w("Error updating colors:",e)}),r.current=t.nowPlayingArtURL):(r.current&&(r.current=null),a.current&&(async e=>{e.textContent=":root{\nwill-change: --spice-main,--spice-rgb-main,--spice-sidebar,--spice-rgb-sidebar,--spice-card,--spice-rgb-card,--spice-player,--spice-rgb-player,--spice-accent,--spice-rgb-accent,--spice-highlight,--spice-rgb-highlight,--spice-button,--spice-rgb-button,--spice-button-active,--spice-rgb-button-active,--spice-text,--spice-rgb-text,--spice-progress-bar,--spice-rgb-progress-bar,--spice-subtext,--spice-rgb-subtext,--spice-primary,--spice-rgb-primary,--spice-secondary,--spice-rgb-secondary,--spice-tertiary,--spice-rgb-tertiary;\ntransition: all 0.3s ease-in-out;\n}"})(a.current))},[e,t.nowPlayingArtURL]),null},zt=e(r()),Vt=()=>{f("Render ");let{fontSettings:e}=O().interfaceSettings,n=(0,zt.useCallback)((e,t)=>{document.documentElement.style.setProperty(`--${e}-font-to-use`,t)},[]),t=(0,zt.useCallback)(async t=>{var{fontFamily:a,url:r}=e[t];try{await((e,t)=>{let a=document.getElementById(t);a||((a=document.createElement("link")).rel="stylesheet",a.id=t,document.head.appendChild(a)),a.href=e})(r,t+"-font"),n(t,a)}catch(e){w("Failed to load font from "+r,e),n(t,a)}},[e,n]);return(0,zt.useEffect)(()=>{f("useFontManager effect ran."),Object.keys(e).map(e=>t(e))},[e,t]),null},Ft=e(r()),C=e=>{(0,Ft.useEffect)(()=>{if(e)return document.body.classList.add(e),()=>{document.body.classList.remove(e)}},[e])},Ht=()=>(f("Render "),C(et?"global-nav":"control-nav"),null),qt=e(r()),Gt=()=>{f("Render ");var{grainSettings:{grainEffect:e}}=O().interfaceSettings;return C("grain-"+e),qt.default.createElement("div",{id:"grainEffect","data-grainEffect":e})},Wt=e(r()),Zt=()=>{let{pageCategory:e,setPageCategory:a}=x();return C(e),(0,Wt.useEffect)(()=>{let e=()=>{var e=Spicetify.Platform.History.location.pathname;a((e=e,Spicetify.URI.isPlaylistV1OrV2(e)?"playlist":Spicetify.URI.isArtist(e)?"artist":Spicetify.URI.isAlbum(e)?"album":Spicetify.URI.isGenre(e)?"genre":Spicetify.URI.isShow(e)?"show":Spicetify.URI.isSearch(e)?"search":Spicetify.URI.isProfile(e)?"profile":Spicetify.URI.isConcert(e)||Spicetify.URI.isArtistConcerts(e)?"concert":"other"))},t=(e(),Spicetify.Platform.History.listen(()=>{e()}));return()=>{t()}},[a]),null},Jt=e(r()),Kt=".Root__now-playing-bar",Xt=()=>{let n=O().playbarSettings,i=(0,Jt.useRef)(document.querySelector(Kt));return C("playbar-"+n.mode),(0,Jt.useEffect)(()=>{var e,t,a,r;i.current?({mode:t,styles:r}=n,a=yt(r[t],!0),r="compact"===t?r[t].height:(null==(e=i.current)?void 0:e.clientHeight)||(null==(e=r[t])?void 0:e.height),document.documentElement.style.setProperty("--playbar-height",r+"px"),i.current.style.cssText=a.toString()):w(`Playbar element with class '${Kt}' not found!`)},[n]),null},Qt=e(r()),Yt=()=>{let{underMainBackgroundImage:a,setUnderMainViewBackgroundImage:r}=x(),n=(0,Qt.useCallback)(e=>{e=e.reduce((e,t)=>{if(e)return e;if("childList"===t.type&&0{let e=new MutationObserver(n);var t=document.querySelector(".under-main-view");return t&&e.observe(t,{childList:!0}),()=>e.disconnect()},[n]),(0,Qt.useEffect)(()=>(document.documentElement.style.setProperty("--under-main-view-art-image",a?`url(${a})`:null),()=>{document.documentElement.style.removeProperty("--under-main-view-art-image")}),[a])},P=e(r()),ea=()=>{f("Render ");let{pagesSettings:{playlistViewMode:e,isScrollMode:a,backgroundImageMode:t}}=O().interfaceSettings,{pageCategory:r,underMainBackgroundImage:n,artworkData:i}=x(),l=(0,P.useRef)(null),o=(0,P.useRef)(null),s=(C("playlist-view-"+e),C("playlist-art-image-"+t),C(n?"under-main-view-present":""),(0,P.useCallback)(e=>{var t=l.current;t&&(e=Math.min(e.scrollTop,window.innerHeight),t.style.transform=`translate3d(0, ${a?-e:0}px, 0)`,t.style.setProperty("--scroll",""+e/1e3))},[a])),c=(0,P.useMemo)(()=>"artist"===r||n?0:4,[r,n]);(0,P.useEffect)(()=>{var e=o.current;e&&e.style.setProperty("--blur",c+"px")},[c]),(0,P.useEffect)(()=>{let t=document.querySelector(".Root__main-view .os-viewport, .Root__main-view .main-view-container > .main-view-container__scroll-node:not([data-overlayscrollbars-initialize]), .Root__main-view .main-view-container__scroll-node > [data-overlayscrollbars-viewport]");if(t){let e=()=>s(t);return e(),t.addEventListener("scroll",e,{passive:!0}),()=>{t.removeEventListener("scroll",e)}}},[s]),f("underMainBackgroundImage",n);var u="other"!==r&&"none"!==t?n||("inherit"===t?i.currentPageArtURL||"":i.nowPlayingArtURL||""):"none";return P.default.createElement("span",{id:"playlistArtContainer",className:`playlist-art-container ${e} `+t,"data-playlist-view-mode":e,ref:l},P.default.createElement("div",{className:"background",ref:o,style:{backgroundImage:`url(${u})`}}),P.default.createElement("div",{className:"overlay",style:{height:"100%",width:"100%",position:"absolute",inset:0}}))},ta=e(r()),aa=()=>(f("Render "),(()=>{let a=(0,ta.useRef)(null);(0,ta.useEffect)(()=>{let e=()=>{var e,t;document.getElementById("lucid-under-main-view")||((e=document.createElement("div")).id="lucid-under-main-view",e.className="lucid-under-main-view",(t=document.querySelector(".main-view-container"))&&t.prepend(e),a.current=e,a.current&&Spicetify.ReactDOM.createRoot(a.current).render(ta.default.createElement(ea,null)))},t=(e(),Spicetify.Platform.History.listen(()=>{e()}));return()=>{t()}},[])})(),Yt(),null),ra=e(r()),na=()=>{var e=(0,ra.useRef)(null);let[t,r]=(0,ra.useState)({}),n=x().windowZoom,{controlSettings:{height:i}}=O().interfaceSettings;return(0,ra.useEffect)(()=>{let e=()=>{var e;Ye&&((async t=>{var e;try{null!=(e=null==Spicetify?void 0:Spicetify.CosmosAsync)&&e.post&&await Spicetify.CosmosAsync.post("sp://messages/v1/container/control",{type:"update_titlebar",height:t}),d(`Control height set to ${t}px`)}catch(e){w("Error setting control height: "+t)}})(i),tt||Qe?r({}):(e=(Xe?32:64)/n,e={position:"fixed",right:0,top:(Xe?(i/n-Math.min(32/n,i/n))/2:0)+"px",height:e+"px",width:135/n+"px",WebkitBackdropFilter:"brightness(2.12)",backdropFilter:"brightness(2.12)",zIndex:"var(--above-main-and-now-playing-view-grid-area, 6)"},r(e)))},t=(e(),()=>{e()}),a=setTimeout(e,1e3);return window.addEventListener("resize",t),()=>{clearTimeout(a),window.removeEventListener("resize",t)}},[n,i]),ra.default.createElement("div",{ref:e,style:t})},M=e(r()),ia=(0,M.memo)(()=>M.default.createElement(M.default.Fragment,null,Ye?M.default.createElement("div",{id:"transperent-controls-container",className:"transperent-controls-container",style:{containerType:"normal"}},!tt&&Ye?M.default.createElement(na,null):null):null)),N=e(r()),A=e(r()),la=()=>{(0,A.useRef)({outerWidth:window.outerWidth,innerWidth:window.innerWidth,ratio:window.devicePixelRatio});let n=x().setWindowZoom,i=(0,A.useRef)(window.outerWidth),l=(0,A.useRef)(window.innerWidth),o=(0,A.useRef)(window.devicePixelRatio),s=(0,A.useRef)(!0),c=(0,A.useRef)(document.querySelector(".Root__main-view"));return(0,A.useEffect)(()=>{let e=()=>{document.documentElement.style.setProperty("--main-view-height",`${null==(t=c.current)?void 0:t.clientHeight}px`);var e,t=window.outerWidth,a=window.innerWidth,r=window.devicePixelRatio;(s.current||(i.current<=160||o.current!==r)&&(i.current!==t||l.current!==a))&&(e=t/a||1,n(e),document.documentElement.style.setProperty("--zoom",""+e),f(`Zoom Updated: ${t} / ${a} = `+e),i.current=t,l.current=a,o.current=r)},t=()=>{e()};return e(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[n]),null},oa=()=>(f("Render "),N.default.createElement(N.default.Fragment,null,N.default.createElement(Zt,null),N.default.createElement(Gt,null),N.default.createElement(jt,null),N.default.createElement(la,null),N.default.createElement(Xt,null),N.default.createElement(Lt,null),N.default.createElement(It,null),N.default.createElement(Ht,null),N.default.createElement(Vt,null),N.default.createElement(aa,null),N.default.createElement(ia,null)));function sa(e,t){e.innerHTML=` #lucid-main .background-container .background-wrapper div { z-index: ${t} !important; } `}function ca(e){e.innerHTML=` #lucid-main .background-container .background-wrapper div { z-index: -1 !important; }