!async function(){for(;!Spicetify.React||!Spicetify.ReactDOM;)await new Promise(t=>setTimeout(t,10));var d,t;d=new Map,t=async function(){for(var t;null==(t=null==Spicetify?void 0:Spicetify.Platform)||!t.RootlistAPI;)await new Promise(t=>setTimeout(t,100));i(await Spicetify.Platform.RootlistAPI.getContents().then(t=>t.items.filter(t=>"playlist"===t.type)))},(async()=>{await t()})();function r(t,i=document.body,e={childList:!0,subtree:!0}){const a=new MutationObserver(async()=>{a.disconnect(),await t(),a.observe(i,e)});a.observe(i,e),a}function c(t,...i){var e=document.createElement("div");e.classList.add(...i),e.appendChild(((i=document.createElement("template")).innerHTML='',i.content.firstChild)),t.prepend(e)}function i(o){const s=t=>{Array.from(t).filter(t=>!t.classList.contains("add-to-playlist-item")&&!t.querySelector("input")).forEach(i=>{var t,e,a,l=!!i.querySelector("button span svg");const n=i.querySelector("button span");l?(c(i,"add-to-playlist-item__folder"),i.classList.add("add-to-playlist-item"),r(()=>{var t=i.querySelector('ul[tabindex="-1"] > div');t&&s(t.children)},i)):(l=o.find(t=>t.name===(null==n?void 0:n.innerText)))&&(e=null!=(t=d.get(l.uri))?t:(t=(null==(t=null==(t=null==l?void 0:l.images)?void 0:t[0])?void 0:t.url)||"",e="add-to-playlist-item__img",(a=document.createElement(t?"img":"div")).classList.add(e),t?a.setAttribute("src",t):a.classList.add("no-icon"),a),i.prepend(e),i.classList.add("add-to-playlist-item"),d.has(l.uri)||d.set(l.uri,e))})};r(()=>{var t=document.querySelector('#context-menu ul[tabindex="-1"] > div');t&&s(t.children)})}(async()=>{var t;document.getElementById("playlistDicons")||((t=document.createElement("style")).id="playlistDicons",t.textContent=String.raw` :root{---playlist-img-spacing:6px}.playlist-item{padding-top:0;padding-bottom:0;align-items:center}.playlist-item__img{width:1.5em;height:1.5em;border-radius:2px;margin-right:12px;filter:brightness(85%)}.playlist-item__img.folder{background-color:var(--spice-tab-active);display:flex;align-items:center;justify-content:center}.playlist-item__img.folder svg{width:1.1em;height:1.1em}.playlist-item__img.no-icon{background-color:var(--spice-tab-active);height:1.5em}.playlist-item:hover .playlist-item__img{transition:.2s ease-out;filter:brightness(100%)}.add-to-playlist-item{display:flex;align-items:center}.add-to-playlist-item:hover{background-color:rgba(var(--spice-rgb-selected-row),.1)}.add-to-playlist-item__folder,.add-to-playlist-item__img{width:2.25rem;padding-left:12px}.add-to-playlist-item>button:hover{background-color:unset}.add-to-playlist-item>button[aria-expanded=true]{background-color:unset}.big-icons .playlist-item{padding-top:var(---playlist-img-spacing);padding-bottom:var(---playlist-img-spacing)}.big-icons .playlist-item__img{border-radius:4px;width:2em;height:2em}.big-icons .playlist-item__img.folder{padding:4px}.big-icons .playlist-item__img.folder svg{width:1.5em;height:1.5em}.big-icons>div{contain:unset} `.trim(),document.head.appendChild(t))})()}();