!async function(){for(;!Spicetify.React||!Spicetify.ReactDOM;)await new Promise(e=>setTimeout(e,10));(()=>{function _(e,t,r){var a=3"string"==typeof e,F=()=>{let r,a;var e=new Promise((e,t)=>{r=e,a=t});return e.resolve=r,e.reject=a,e},T=e=>null==e?"":""+e,V=(e,t,r)=>{e.forEach(e=>{t[e]&&(r[e]=t[e])})},B=/###/g,D=e=>e&&-1!e||P(e),q=(e,t,r)=>{var a=P(t)?t.split("."):t;let s=0;for(;s{var{obj:e,k:t}=q(a,s,Object);if(void 0!==e||1===s.length)e[t]=n;else{let e=s[s.length-1],t=s.slice(0,s.length-1),r=q(a,t,Object);for(;void 0===r.obj&&t.length;)e=t[t.length-1]+"."+e,t=t.slice(0,t.length-1),(r=q(a,t,Object))?.obj&&void 0!==r.obj[r.k+"."+e]&&(r.obj=void 0);r.obj[r.k+"."+e]=n}},W=(e,t,r,a)=>{var{obj:e,k:t}=q(e,t,Object);e[t]=e[t]||[],e[t].push(r)},H=(e,t)=>{var{obj:e,k:t}=q(e,t);if(e&&Object.prototype.hasOwnProperty.call(e,t))return e[t]},Y=(e,t,r)=>{e=H(e,r);return void 0!==e?e:H(t,r)},G=(e,t,r)=>{for(const a in t)"__proto__"!==a&&"constructor"!==a&&(a in e?P(e[a])||e[a]instanceof String||P(t[a])||t[a]instanceof String?r&&(e[a]=t[a]):G(e[a],t[a],r):e[a]=t[a]);return e},b=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),J={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},X=e=>P(e)?e.replace(/[&<>"'\/]/g,e=>J[e]):e,Z=[" ",",","?","!",";"],Q=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){var t=this.regExpMap.get(e);return void 0!==t||(t=new RegExp(e),this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,t),this.regExpQueue.push(e)),t}}(20),ee=(e,t,r)=>{t=t||"",r=r||"";var a=Z.filter(e=>t.indexOf(e)<0&&r.indexOf(e)<0);if(0===a.length)return!0;var s,a=Q.getRegExp(`(${a.map(e=>"?"===e?"\\?":e).join("|")})`);let n=!a.test(e);return n||0<(s=e.indexOf(r))&&!a.test(e.substring(0,s))&&(n=!0),n},te=function(e,t){var n=2e?.replace("_","-"),ae={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}},se=class{constructor(e){this.init(e,1{this.observers[e]||(this.observers[e]=new Map);var t=this.observers[e].get(r)||0;this.observers[e].set(r,t+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(a){for(var e=arguments.length,s=new Array(1{var[t,r]=e;for(let e=0;e{var[t,r]=e;for(let e=0;et[e]&&0{t=this.processors[e]?.process(t,r,a,s)??t}),t}},ie={},le=e=>!P(e)&&"boolean"!=typeof e&&"number"!=typeof e,ce=class extends e{constructor(e){var t=1{r=m&&r!==h?r:R;this.options.missingKeyHandler?this.options.missingKeyHandler(e,i,t,r,N,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,i,t,r,N,a),this.emit("missingKey",e,i,t,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&g?t.forEach(t=>{var e=this.pluralResolver.getSuffixes(t,a);y&&a[`defaultValue${this.options.pluralSeparator}zero`]&&e.indexOf(this.options.pluralSeparator+"zero")<0&&e.push(this.options.pluralSeparator+"zero"),e.forEach(e=>{C([t],o+e,a["defaultValue"+e]||w)})}):C(t,o,w))}h=this.extendTranslation(h,r,a,c,s),t&&h===o&&this.options.appendNamespaceToMissingKey&&(h=i+":"+o),(t||e)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?i+":"+o:o,e?h:void 0))}else{if(!a.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!"),v=this.options.returnedObjectHandler?this.options.returnedObjectHandler(u,k,{...a,ns:t}):`key '${o} (${this.language})' returned an object instead of string.`,e?(c.res=v,c.usedParams=this.getUsedParamsDetails(a),c):v;if(n){var S,p=Array.isArray(k),L=p?[]:{},O=p?f:u;for(const j in k)Object.prototype.hasOwnProperty.call(k,j)&&(S=""+O+n+j,m&&!h?L[j]=this.translate(S,{...a,defaultValue:le(w)?w[j]:void 0,joinArrays:!1,ns:t}):L[j]=this.translate(S,{...a,joinArrays:!1,ns:t}),L[j]===S)&&(L[j]=k[j]);h=L}}return e?(c.res=h,c.usedParams=this.getUsedParamsDetails(a),c):h}extendTranslation(r,a,s,n,o){var i=this;if(this.i18nFormat?.parse)r=this.i18nFormat.parse(r,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});var l=P(r)&&(void 0!==s?.interpolation?.skipOnVariables?s:this.options).interpolation.skipOnVariables;let e,t=(l&&(c=r.match(this.interpolator.nestingRegexp),e=c&&c.length),s.replace&&!P(s.replace)?s.replace:s);this.options.interpolation.defaultVariables&&(t={...this.options.interpolation.defaultVariables,...t}),r=this.interpolator.interpolate(r,t,s.lng||this.language||n.usedLng,s),l&&(l=(c=r.match(this.interpolator.nestingRegexp))&&c.length,e{if(!this.isValidLookup(f)){t=this.extractFromKey(t,u);const i=t.key;a=i;let e=t.namespaces;this.options.fallbackNS&&(e=e.concat(this.options.fallbackNS));const l=void 0!==u.count&&!P(u.count),c=l&&!u.ordinal&&0===u.count,h=void 0!==u.context&&(P(u.context)||"number"==typeof u.context)&&""!==u.context,r=u.lngs||this.languageUtils.toResolveHierarchy(u.lng||this.language,u.fallbackLng);e.forEach(o=>{this.isValidLookup(f)||(s=o,ie[r[0]+"-"+o]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(s)||(ie[r[0]+"-"+o]=!0,this.logger.warn(`key "${a}" for languages "${r.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),r.forEach(t=>{if(!this.isValidLookup(f)){p=t;var e,r=[i];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(r,i,t,o,u);else{let e;l&&(e=this.pluralResolver.getSuffix(t,u.count,u));var a,s=this.options.pluralSeparator+"zero",n=this.options.pluralSeparator+"ordinal"+this.options.pluralSeparator;l&&(r.push(i+e),u.ordinal&&0===e.indexOf(n)&&r.push(i+e.replace(n,this.options.pluralSeparator)),c)&&r.push(i+s),h&&(a=""+i+this.options.contextSeparator+u.context,r.push(a),l)&&(r.push(a+e),u.ordinal&&0===e.indexOf(n)&&r.push(a+e.replace(n,this.options.pluralSeparator)),c)&&r.push(a+s)}for(;e=r.pop();)this.isValidLookup(f)||(d=e,f=this.getResource(t,o,e,u))}}))})}}),{res:f,usedKey:a,exactUsedKey:d,usedLng:p,usedNS:s}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,r){var a=3{r||(e=this.formatLanguageCode(e),this.options.supportedLngs&&!this.isSupportedCode(e))||(r=e)}),!r&&this.options.supportedLngs&&e.forEach(e=>{if(!r){const t=this.getLanguagePartFromCode(e);if(this.isSupportedCode(t))return r=t;r=this.options.supportedLngs.find(e=>e===t||!(e.indexOf("-")<0&&t.indexOf("-")<0)&&(0{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn("rejecting language code not found in supportedLngs: "+e))};return P(e)&&(-1{r.indexOf(e)<0&&a(this.formatLanguageCode(e))}),r}},ue={zero:0,one:1,two:2,few:3,many:4,other:5},fe={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},de=class{constructor(e){var t=1""+t+e)}getSuffixes(e){let t=1ue[e]-ue[t]).map(e=>""+this.options.prepend+(t.ordinal?"ordinal"+this.options.prepend:"")+e):[]}getSuffix(e,t){var r=2e.replace(/\$/g,"$$$$"),ge=class{constructor(){var e=0e),this.init(e)}init(){var e=0e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,this.prefix+"(.+?)"+this.suffix),this.regexpUnescape=e(this.regexpUnescape,""+this.prefix+this.unescapePrefix+"(.+?)"+this.unescapeSuffix+this.suffix),this.nestingRegexp=e(this.nestingRegexp,this.nestingPrefix+"(.+?)"+this.nestingSuffix)}interpolate(a,r,s,n){let o,i,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},h=e=>{var t;return e.indexOf(this.formatSeparator)<0?(t=_(r,c,e,this.options.keySeparator,this.options.ignoreJSONStructure),this.alwaysFormat?this.format(t,void 0,s,{...n,...r,interpolationkey:e}):t):(e=(t=e.split(this.formatSeparator)).shift().trim(),t=t.join(this.formatSeparator).trim(),this.format(_(r,c,e,this.options.keySeparator,this.options.ignoreJSONStructure),t,s,{...n,...r,interpolationkey:e}))},u=(this.resetRegExp(),n?.missingInterpolationHandler||this.options.missingInterpolationHandler),f=(void 0!==n?.interpolation?.skipOnVariables?n:this.options).interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>pe(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?pe(this.escape(e)):pe(e)}].forEach(e=>{for(l=0;o=e.regex.exec(a);){var t=o[1].trim();if(void 0===(i=h(t)))if("function"==typeof u){var r=u(a,o,n);i=P(r)?r:""}else{if(!n||!Object.prototype.hasOwnProperty.call(n,t)){if(f){i=o[0];continue}this.logger.warn(`missed to pass in variable ${t} for interpolating `+a)}i=""}else P(i)||this.useRawValueToEscape||(i=T(i));r=e.safeValue(i);if(a=a.replace(o[0],r),f?(e.regex.lastIndex+=i.length,e.regex.lastIndex-=o[0].length):e.regex.lastIndex=0,++l>=this.maxReplaces)break}}),a}nest(r,a){let s=2{var a=this.nestingOptionsSeparator;if(!(r.indexOf(a)<0)){var s=r.split(new RegExp(a+"[ ]*{"));let t="{"+s[1];r=s[0];var s=(t=this.interpolate(t,i)).match(/'/g),n=t.match(/"/g);((s?.length??0)%2!=0||n)&&n.length%2==0||(t=t.replace(/'/g,'"'));try{i=JSON.parse(t),e&&(i={...e,...i})}catch(e){return this.logger.warn("failed parsing options string in nesting for key "+r,e),""+r+a+t}i.defaultValue&&-1e.trim()),n[1]=l.shift(),e=l,t=!0),(o=a(c.call(this,n[1].trim(),i),i))&&n[0]===r&&!P(o))return o;(o=P(o)?o:T(o))||(this.logger.warn(`missed to resolve ${n[1]} for nesting `+r),o=""),t&&(o=e.reduce((e,t)=>this.format(e,t,s.lng,{...s,interpolationkey:n[1].trim()}),o.trim())),r=r.replace(n[0],o),this.regexp.lastIndex=0}return r}},me=e=>{let t=e.toLowerCase().trim();const r={};return-1{var t;e&&([e,...t]=e.split(":"),t=t.join(":").trim().replace(/^'+|'+$/g,""),e=e.trim(),r[e]||(r[e]=t),"false"===t&&(r[e]=!1),"true"===t&&(r[e]=!0),isNaN(t)||(r[e]=parseInt(t,10)))})),{formatName:t,formatOptions:r}},r=o=>{const i={};return(e,t,r)=>{let a=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(a={...a,[r.interpolationkey]:void 0});var s=t+JSON.stringify(a);let n=i[s];return n||(n=o(re(t),r),i[s]=n),n(e)}},be=class{constructor(){var e=0{const r=new Intl.NumberFormat(e,{...t});return e=>r.format(e)}),currency:r((e,t)=>{const r=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>r.format(e)}),datetime:r((e,t)=>{const r=new Intl.DateTimeFormat(e,{...t});return e=>r.format(e)}),relativetime:r((e,t)=>{const r=new Intl.RelativeTimeFormat(e,{...t});return e=>r.format(e,t.range||"day")}),list:r((e,t)=>{const r=new Intl.ListFormat(e,{...t});return e=>r.format(e)})},this.init(e)}init(e){this.formatSeparator=(1-1-1{var{formatName:r,formatOptions:a}=me(r);if(this.formats[r]){let e=t;try{var s=i?.formatParams?.[i.interpolationkey]||{},n=s.locale||s.lng||i.locale||i.lng||o;e=this.formats[r](t,n,{...a,...i,...s})}catch(e){this.logger.warn(e)}return e}return this.logger.warn("there was no format function for "+r),t},e));return r}},ve=(e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)},ye=class extends e{constructor(e,t,r){var a=3{let a=!0;t.forEach(e=>{var t=r+"|"+e;!s.reload&&this.store.hasResourceBundle(r,e)?this.state[t]=2:this.state[t]<0||(1===this.state[t]?void 0===o[t]&&(o[t]=!0):(this.state[t]=1,a=!1,void 0===o[t]&&(o[t]=!0),void 0===n[t]&&(n[t]=!0),void 0===l[e]&&(l[e]=!0)))}),a||(i[r]=!0)}),(Object.keys(n).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(n),pending:Object.keys(o),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(l)}}loaded(e,t,r){var a=e.split("|");const s=a[0],n=a[1],o=(t&&this.emit("failedLoading",s,n,t),!t&&r&&this.store.addResourceBundle(s,n,r,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&r&&(this.state[e]=0),{});this.queue.forEach(r=>{W(r.loaded,[s],n),ve(r,e),t&&r.errors.push(t),0!==r.pendingCount||r.done||(Object.keys(r.loaded).forEach(t=>{o[t]||(o[t]={});var e=r.loaded[t];e.length&&e.forEach(e=>{void 0===o[t][e]&&(o[t][e]=!0)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(e=>!e.done)}read(a,s,n){let o=3=this.maxParallelReads)this.waitingReads.push({lng:a,ns:s,fcName:n,tried:o,wait:i,callback:l});else{this.readingCalls++;const r=(e,t)=>{var r;this.readingCalls--,0{this.read.call(this,a,s,n,o+1,2*i,l)},i):l(e,t)};var e=this.backend[n].bind(this.backend);if(2!==e.length)return e(a,s,r);try{var t=e(a,s);t&&"function"==typeof t.then?t.then(e=>r(null,e)).catch(r):r(null,t)}catch(e){r(e)}}}prepareLoading(e,t){var r=2{this.loadOne(e)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(r){let a=1{e&&this.logger.warn(`${a}loading namespace ${n} for language ${s} failed`,e),!e&&t&&this.logger.log(`${a}loaded namespace ${n} for language `+s,t),this.loaded(r,e,t)})}saveMissing(t,r,a,s,n){var o=5{};if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r))this.logger.warn(`did not save key "${a}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=a&&""!==a){if(this.backend?.create){o={...o,isUpdate:n},n=this.backend.create.bind(this.backend);if(n.length<6)try{let e;(e=5===n.length?n(t,r,a,s,o):n(t,r,a,s))&&"function"==typeof e.then?e.then(e=>i(null,e)).catch(i):i(null,e)}catch(e){i(e)}else n(t,r,a,s,i,o)}t&&t[0]&&this.store.addResource(t[0],r,a,s)}}},we=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),P(e[1])&&(t.defaultValue=e[1]),P(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const r=e[3]||e[2];Object.keys(r).forEach(e=>{t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),ke=e=>(P(e.ns)&&(e.ns=[e.ns]),P(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),P(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),xe=()=>{},Se=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(e=>{"function"==typeof t[e]&&(t[e]=t[e].bind(t))})},Le=class extends e{constructor(){let e=0{this.init(e,t)},0)}}init(){var s=this;let e=0e?"function"==typeof e?new e:e:null);if(!this.options.isClone){this.modules.logger?l.init(a(this.modules.logger),this.options):l.init(null,this.options);let e;e=this.modules.formatter||be;var n=new he(this.options),o=(this.store=new ne(this.options.resources,this.options),this.services);o.logger=l,o.resourceStore=this.store,o.languageUtils=n,o.pluralResolver=new de(n,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!e||this.options.interpolation.format&&this.options.interpolation.format!==t.interpolation.format||(o.formatter=a(e),o.formatter.init(o,this.options),this.options.interpolation.format=o.formatter.format.bind(o.formatter)),o.interpolator=new ge(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new ye(a(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",function(e){for(var t=arguments.length,r=new Array(1{e.init&&e.init(this)})}this.format=this.options.interpolation.format,r=r||xe,!this.options.fallbackLng||this.services.languageDetector||this.options.lng||0<(n=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng)).length&&"dev"!==n[0]&&(this.options.lng=n[0]),this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=function(){return s.store[e](...arguments)}});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=function(){return s.store[e](...arguments),s}});const i=F();t=()=>{var e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(t),r(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?t():setTimeout(t,0),i}loadResources(e){let t=1{e&&"cimode"!==e&&this.services.languageUtils.toResolveHierarchy(e).forEach(e=>{"cimode"!==e&&a.indexOf(e)<0&&a.push(e)})};r?s(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>s(e)),this.options.preload?.forEach?.(e=>s(e)),this.services.backendConnector.load(a,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)})}else t(null)}reloadResources(e,t,r){const a=F();return"function"==typeof e&&(r=e,e=void 0),"function"==typeof t&&(r=t,t=void 0),e=e||this.languages,t=t||this.options.ns,r=r||xe,this.services.backendConnector.reload(e,t,e=>{a.resolve(),r(e)}),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(e.type)return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&oe.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this;throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()")}setResolvedLanguage(e){if(e&&this.languages&&!(-1<["cimode","dev"].indexOf(e)))for(let e=0;e{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)}),i=(e,t)=>{t?(o(t),this.translator.changeLanguage(t),this.isLanguageChangingTo=void 0,this.emit("languageChanged",t),this.logger.log("languageChanged",t)):this.isLanguageChangingTo=void 0,n.resolve(function(){return s.t(...arguments)}),a&&a(e,function(){return s.t(...arguments)})};var e=e=>{r||e||!this.services.languageDetector||(e=[]);const t=P(e)?e:this.services.languageUtils.getBestMatchFromCodes(e);t&&(this.language||o(t),this.translator.language||this.translator.changeLanguage(t),this.services.languageDetector?.cacheUserLanguage?.(t)),this.loadResources(t,e=>{i(e,t)})};return r||!this.services.languageDetector||this.services.languageDetector.async?!r&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(e):this.services.languageDetector.detect(e):e(r):e(this.services.languageDetector.detect()),n}getFixedT(e,t,l){var c=this;function h(e,t){let r;if("object"!=typeof t){for(var a=arguments.length,s=new Array(2""+r.keyPrefix+o+e):r.keyPrefix?""+r.keyPrefix+o+e:e,c.t(i,r)}return P(e)?h.lng=e:h.lngs=e,h.ns=t,h.keyPrefix=l,h}t(){for(var e=arguments.length,t=new Array(e),r=0;r{e=this.services.backendConnector.state[e+"|"+t];return-1===e||0===e||2===e};if(t.precheck){t=t.precheck(this,n);if(void 0!==t)return t}return!!this.hasResourceBundle(r,e)||!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!n(r,e)||a&&!n(s,e)))}loadNamespaces(e,t){const r=F();return this.options.ns?((e=P(e)?[e]:e).forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=F(),a=(P(e)&&(e=[e]),this.options.preload||[]);e=e.filter(e=>a.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return e.length?(this.options.preload=a.concat(e),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}dir(e){var t;return!(e=e||this.resolvedLanguage||(0{s[e]=this[e]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(e=Object.keys(this.store.data).reduce((r,a)=>(r[a]={...this.store.data[a]},Object.keys(r[a]).reduce((e,t)=>(e[t]={...r[a][t]},e),{})),{}),s.store=new ne(e,a),s.services.resourceStore=s.store),s.translator=new ce(s.services,a),s.translator.on("*",function(e){for(var t=arguments.length,r=new Array(1Ne(Ce(t,e),r),je=t=>{t._clipped=!1,t._unclipped=t.slice(0);for(let e=0;e<=3;e++)e<3?((t[e]<0||2553<=t.length?Array.prototype.slice.call(t):"object"==O(t[0])&&e?e.split("").filter(e=>void 0!==t[0][e]).map(e=>t[0][e]):t[0].slice(0),c=e=>{var t;return!(e.length<2)&&"string"==O(e[t=e.length-1])?e[t].toLowerCase():null},{PI:e,min:Me,max:Ee}=Math,a=e=>Math.round(100*e)/100,$e=e=>Math.round(100*e)/100,u=2*e,Ae=e/3,Ie=e/180,_e=180/e,o={format:{},autodetect:[]},m=class{constructor(...e){if("object"===O(e[0])&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let t=c(e),r=!1;if(!t){r=!0,o.sorted||(o.autodetect=o.autodetect.sort((e,t)=>t.p-e.p),o.sorted=!0);for(var a of o.autodetect)if(t=a.test(...e))break}if(!o.format[t])throw new Error("unknown format: "+e);var s=o.format[t].apply(null,r?e:e.slice(0,-1));this._rgb=je(s),3===this._rgb.length&&this._rgb.push(1)}toString(){return"function"==O(this.hex)?this.hex():`[${this._rgb.join(",")}]`}},e=(...e)=>new m(...e),R=(e.version="3.1.1",e),s={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},Ue=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Fe=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Te=e=>{var t;if(e.match(Ue))return 3===(e=4!==e.length&&7!==e.length?e:e.substr(1)).length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[(t=parseInt(e,16))>>16,t>>8&255,255&t,1];if(e.match(Fe))return 4===(e=5!==e.length&&9!==e.length?e:e.substr(1)).length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),[(t=parseInt(e,16))>>24&255,t>>16&255,t>>8&255,Math.round((255&t)/255*100)/100];throw new Error("unknown hex color: "+e)},Ve=Math["round"],Be=(...e)=>{let[t,r,a,s]=p(e,"rgba"),n=c(e)||"auto";void 0===s&&(s=1),"auto"===n&&(n=s<1?"rgba":"rgb");let o="000000"+(Ve(t)<<16|Ve(r)<<8|Ve(a)).toString(16),i=(o=o.substr(o.length-6),"0"+Ve(255*s).toString(16));switch(i=i.substr(i.length-2),n.toLowerCase()){case"rgba":return"#"+o+i;case"argb":return"#"+i+o;default:return"#"+o}},De=(m.prototype.name=function(){var e,t=Be(this._rgb,"rgb");for(e of Object.keys(s))if(s[e]===t)return e.toLowerCase();return t},o.format.named=e=>{if(e=e.toLowerCase(),s[e])return Te(s[e]);throw new Error("unknown color name: "+e)},o.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&"string"===O(e)&&s[e.toLowerCase()])return"named"}}),m.prototype.alpha=function(e,t=!1){return void 0!==e&&"number"===O(e)?t?(this._rgb[3]=e,this):new m([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]},m.prototype.clipped=function(){return this._rgb._clipped||!1},{Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}}),w=De,Ke=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function i(e){var t=Ke.get(String(e).toLowerCase());if(!t)throw new Error("unknown Lab illuminant "+e);De.labWhitePoint=e,De.Xn=t[0],De.Zn=t[1]}function qe(){return De.labWhitePoint}var ze=e=>{var t=Math.sign(e);return((e=Math.abs(e))<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)*t},We=(e,t,r)=>{var{MtxAdaptMa:a,MtxAdaptMaI:s,MtxXYZ2RGB:n,RefWhiteRGB:o,Xn:i,Yn:l,Zn:c}=w,h=i*a.m00+l*a.m10+c*a.m20,u=i*a.m01+l*a.m11+c*a.m21,i=i*a.m02+l*a.m12+c*a.m22,l=o.X*a.m00+o.Y*a.m10+o.Z*a.m20,c=o.X*a.m01+o.Y*a.m11+o.Z*a.m21,o=o.X*a.m02+o.Y*a.m12+o.Z*a.m22,l=(e*a.m00+t*a.m10+r*a.m20)*(l/h),h=(e*a.m01+t*a.m11+r*a.m21)*(c/u),c=(e*a.m02+t*a.m12+r*a.m22)*(o/i),u=l*s.m00+h*s.m10+c*s.m20,e=l*s.m01+h*s.m11+c*s.m21,t=l*s.m02+h*s.m12+c*s.m22;return[255*ze(u*n.m00+e*n.m10+t*n.m20),255*ze(u*n.m01+e*n.m11+t*n.m21),255*ze(u*n.m02+e*n.m12+t*n.m22)]},He=(...e)=>{var[t,r,a]=e=p(e,"lab"),[t,r,a]=((e,t,r)=>{const{kE:a,kK:s,kKE:n,Xn:o,Yn:i,Zn:l}=w,c=(e+16)/116,h=.002*t+c,u=c-.005*r,f=h*h*h,d=u*u*u,p=f>a?f:(116*h-16)/s,g=e>n?Math.pow((e+16)/116,3):e/s,m=d>a?d:(116*u-16)/s,b=p*o,v=g*i,y=m*l;return[b,v,y]})(t,r,a),[t,r,a]=We(t,r,a);return[t,r,a,3{e=Ye(e/255),t=Ye(t/255),r=Ye(r/255);var{MtxRGB2XYZ:a,MtxAdaptMa:s,MtxAdaptMaI:n,Xn:o,Yn:i,Zn:l,As:c,Bs:h,Cs:u}=w,f=e*a.m00+t*a.m10+r*a.m20,d=e*a.m01+t*a.m11+r*a.m21,e=e*a.m02+t*a.m12+r*a.m22,t=o*s.m00+i*s.m10+l*s.m20,r=o*s.m01+i*s.m11+l*s.m21,a=o*s.m02+i*s.m12+l*s.m22,o=f*s.m00+d*s.m10+e*s.m20,i=f*s.m01+d*s.m11+e*s.m21,l=f*s.m02+d*s.m12+e*s.m22;return[(o*=t/c)*n.m00+(i*=r/h)*n.m10+(l*=a/u)*n.m20,o*n.m01+i*n.m11+l*n.m21,o*n.m02+i*n.m12+l*n.m22]},Je=(...e)=>{var[e,t,r,...a]=p(e,"rgb"),[e,t,r]=Ge(e,t,r),[e,t,r]=function(e,t,r){var{Xn:a,Yn:s,Zn:n,kE:o,kK:i}=w,e=e/a,a=t/s,t=r/n,s=onew m(...e,"lab"),getLabWhitePoint:qe,setLabWhitePoint:i}),o.format.lab=He,o.autodetect.push({p:2,test:(...e)=>{if("array"===O(e=p(e,"lab"))&&3===e.length)return"lab"}}),m.prototype.darken=function(e=1){var t=this.lab();return t[0]-=w.Kn*e,new m(t,"lab").alpha(this.alpha(),!0)},m.prototype.brighten=function(e=1){return this.darken(-e)},m.prototype.darker=m.prototype.darken,m.prototype.brighter=m.prototype.brighten,m.prototype.get=function(e){var[e,t]=e.split("."),r=this[e]();if(t){var a=e.indexOf(t)-("ok"===e.substr(0,2)?2:0);if(-1{var r=e.interpolate(t,.5,o),a=r.luminance();return Math.abs(n-a)<1e-7||!s--?r:n.2126*(e=Qe(e))+.7152*(t=Qe(t))+.0722*(r=Qe(r))),Qe=e=>(e/=255)<=.03928?e/12.92:Xe((e+.055)/1.055,2.4),n={},h=(e,t,r=.5,...a)=>{let s=a[0]||"lrgb";if(n[s]||a.length||(s=Object.keys(n)[0]),n[s])return"object"!==O(e)&&(e=new m(e)),"object"!==O(t)&&(t=new m(t)),n[s](e,t,r).alpha(e.alpha()+r*(t.alpha()-e.alpha()));throw new Error(`interpolation mode ${s} is not defined`)},{sin:et,cos:tt}=(m.prototype.mix=m.prototype.interpolate=function(e,t=.5,...r){return h(this,e,t,...r)},m.prototype.premultiply=function(e=!1){var t=this._rgb,r=t[3];return e?(this._rgb=[t[0]*r,t[1]*r,t[2]*r,r],this):new m([t[0]*r,t[1]*r,t[2]*r,r],"rgb")},Math),rt=(...e)=>{let[t,r,a]=p(e,"lch");return isNaN(a)&&(a=0),a*=Ie,[t,tt(a)*r,et(a)*r]},at=(...e)=>{var[t,r,a]=e=p(e,"lch"),[t,r,a]=rt(t,r,a),[t,r,a]=He(t,r,a);return[t,r,a,3{e=p(e,"hcl").reverse();return at(...e)},{sqrt:st,atan2:nt,round:ot}=Math,it=(...e)=>{var[e,t,r]=p(e,"lab"),a=st(t*t+r*r);let s=(nt(r,t)*_e+360)%360;return[e,a,s=0===ot(1e4*a)?Number.NaN:s]},lt=(...e)=>{var[e,t,r,...a]=p(e,"rgb"),[e,t,r]=Je(e,t,r),[e,t,r]=it(e,t,r);return[e,t,r,...0new m(...e,"lch"),hcl:(...e)=>new m(...e,"hcl")}),o.format.lch=at,o.format.hcl=e,["lch","hcl"].forEach(t=>o.autodetect.push({p:2,test:(...e)=>{if("array"===O(e=p(e,t))&&3===e.length)return t}})),m.prototype.saturate=function(e=1){var t=this.lch();return t[1]+=w.Kn*e,t[1]<0&&(t[1]=0),new m(t,"lch").alpha(this.alpha(),!0)},m.prototype.desaturate=function(e=1){return this.saturate(-e)},m.prototype.set=function(e,t,r=!1){var[e,a]=e.split("."),s=this[e]();if(a){var n=e.indexOf(a)-("ok"===e.substr(0,2)?2:0);if(-1{e=e._rgb,t=t._rgb;return new m(e[0]+r*(t[0]-e[0]),e[1]+r*(t[1]-e[1]),e[2]+r*(t[2]-e[2]),"rgb")},Math),d=(n.lrgb=(e,t,r)=>{var[e,a,s]=e._rgb,[t,n,o]=t._rgb;return new m(ct(f(e,2)*(1-r)+f(t,2)*r),ct(f(a,2)*(1-r)+f(n,2)*r),ct(f(s,2)*(1-r)+f(o,2)*r),"rgb")},n.lab=(e,t,r)=>{e=e.lab(),t=t.lab();return new m(e[0]+r*(t[0]-e[0]),e[1]+r*(t[1]-e[1]),e[2]+r*(t[2]-e[2]),"lab")},(e,t,r,a)=>{let s,n;"hsl"===a?(s=e.hsl(),n=t.hsl()):"hsv"===a?(s=e.hsv(),n=t.hsv()):"hcg"===a?(s=e.hcg(),n=t.hcg()):"hsi"===a?(s=e.hsi(),n=t.hsi()):"lch"===a||"hcl"===a?(a="hcl",s=e.hcl(),n=t.hcl()):"oklch"===a&&(s=e.oklch().reverse(),n=t.oklch().reverse());let o,i,l,c,h,u;"h"!==a.substr(0,1)&&"oklch"!==a||([o,l,h]=s,[i,c,u]=n);let f,d,p,g;return isNaN(o)||isNaN(i)?isNaN(o)?isNaN(i)?d=Number.NaN:(d=i,1!=h&&0!=h||"hsv"==a||(f=c)):(d=o,1!=u&&0!=u||"hsv"==a||(f=l)):(g=i>o&&180d(e,t,r,"lch"),e=(n.lch=e,n.hcl=e,e=>{if("number"==O(e)&&0<=e&&e<=16777215)return[e>>16,e>>8&255,255&e,1];throw new Error("unknown num color: "+e)}),ht=(...e)=>{var[e,t,r]=p(e,"rgb");return(e<<16)+(t<<8)+r},ut=(m.prototype.num=function(){return ht(this._rgb)},Object.assign(R,{num:(...e)=>new m(...e,"num")}),o.format.num=e,o.autodetect.push({p:5,test:(...e)=>{if(1===e.length&&"number"===O(e[0])&&0<=e[0]&&e[0]<=16777215)return"num"}}),(n.num=(e,t,r)=>{e=e.num(),t=t.num();return new m(e+r*(t-e),"num")},Math)["floor"]),e=(...e)=>{let[t,r,a]=e=p(e,"hcg"),s,n,o;a*=255;var i=255*r;if(0===r)s=n=o=a;else{360<(t=360===t?0:t)&&(t-=360),t<0&&(t+=360),t/=60;var l=ut(t),c=t-l,h=a*(1-r),u=h+i*(1-c),f=h+i*c,d=h+i;switch(l){case 0:[s,n,o]=[d,f,h];break;case 1:[s,n,o]=[u,d,h];break;case 2:[s,n,o]=[h,d,f];break;case 3:[s,n,o]=[h,u,d];break;case 4:[s,n,o]=[f,h,d];break;case 5:[s,n,o]=[d,h,u]}}return[s,n,o,3{var[e,t,r]=p(e,"rgb"),a=Me(e,t,r),s=Ee(e,t,r),n=s-a;let o;return 0==n?o=Number.NaN:(e===s&&(o=(t-r)/n),t===s&&(o=2+(r-e)/n),r===s&&(o=4+(e-t)/n),(o*=60)<0&&(o+=360)),[o,100*n/255,a/(255-n)*100]},v=(m.prototype.hcg=function(){return ft(this._rgb)},R.hcg=(...e)=>new m(...e,"hcg"),o.format.hcg=e,o.autodetect.push({p:1,test:(...e)=>{if("array"===O(e=p(e,"hcg"))&&3===e.length)return"hcg"}}),(n.hcg=(e,t,r)=>d(e,t,r,"hcg"),Math)["cos"]),e=(...e)=>{let[t,r,a]=e=p(e,"hsi"),s,n,o;return isNaN(t)&&(t=0),isNaN(r)&&(r=0),360{var[e,t,r]=p(e,"rgb");let a;var s=dt(e/=255,t/=255,r/=255),n=(e+t+r)/3,s=0new m(...e,"hsi"),o.format.hsi=e,o.autodetect.push({p:2,test:(...e)=>{if("array"===O(e=p(e,"hsi"))&&3===e.length)return"hsi"}}),n.hsi=(e,t,r)=>d(e,t,r,"hsi"),(...e)=>{var[t,r,a]=e=p(e,"hsl");let s,n,o;if(0===r)s=n=o=255*a;else{var i=[0,0,0],l=[0,0,0],c=a<.5?a*(1+r):a+r-a*r,h=2*a-c,r=t/360;i[0]=r+1/3,i[1]=r,i[2]=r-1/3;for(let e=0;e<3;e++)i[e]<0&&(i[e]+=1),1{var[t,r,a]=e=p(e,"rgba"),s=Me(t/=255,r/=255,a/=255),n=Ee(t,r,a),o=(n+s)/2;let i,l;return n===s?(i=0,l=Number.NaN):i=o<.5?(n-s)/(n+s):(n-s)/(2-n-s),t==n?l=(r-a)/(n-s):r==n?l=2+(a-t)/(n-s):a==n&&(l=4+(t-r)/(n-s)),(l*=60)<0&&(l+=360),3new m(...e,"hsl"),o.format.hsl=bt,o.autodetect.push({p:2,test:(...e)=>{if("array"===O(e=p(e,"hsl"))&&3===e.length)return"hsl"}}),(n.hsl=(e,t,r)=>d(e,t,r,"hsl"),Math)["floor"]),e=(...e)=>{let[t,r,a]=e=p(e,"hsv"),s,n,o;if(a*=255,0===r)s=n=o=a;else{360<(t=360===t?0:t)&&(t-=360),t<0&&(t+=360),t/=60;var i=yt(t),l=t-i,c=a*(1-r),h=a*(1-r*l),u=a*(1-r*(1-l));switch(i){case 0:[s,n,o]=[a,u,c];break;case 1:[s,n,o]=[h,a,c];break;case 2:[s,n,o]=[c,a,u];break;case 3:[s,n,o]=[c,h,a];break;case 4:[s,n,o]=[u,c,a];break;case 5:[s,n,o]=[a,c,h]}}return[s,n,o,3{var[e,t,r]=e=p(e,"rgb"),a=wt(e,t,r),s=kt(e,t,r),a=s-a;let n,o;return 0===s?(n=Number.NaN,o=0):(o=a/s,e===s&&(n=(t-r)/a),t===s&&(n=2+(r-e)/a),r===s&&(n=4+(e-t)/a),(n*=60)<0&&(n+=360)),[n,o,s/255]};m.prototype.hsv=function(){return xt(this._rgb)},R.hsv=(...e)=>new m(...e,"hsv"),o.format.hsv=e,o.autodetect.push({p:2,test:(...e)=>{if("array"===O(e=p(e,"hsv"))&&3===e.length)return"hsv"}});function St(e,r){var t=e.length,a=(Array.isArray(e[0])||(e=[e]),(r=Array.isArray(r[0])?r:r.map(e=>[e]))[0].length);let s=r[0].map((e,t)=>r.map(e=>e[t])),n=e.map(r=>s.map(a=>Array.isArray(r)?r.reduce((e,t,r)=>e+t*(a[r]||0),0):a.reduce((e,t)=>e+t*r,0)));return 1===t&&(n=n[0]),1===a?n.map(e=>e[0]):n}n.hsv=(e,t,r)=>d(e,t,r,"hsv");var Lt=(...e)=>{var[e,t,r,...a]=e=p(e,"lab"),[e,t,r]=function(e){e=St([[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],e);return St([[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],e.map(e=>e**3))}([e,t,r]),[e,t,r]=We(e,t,r);return[e,t,r,...0{var[e,t,r,...a]=p(e,"rgb");return[...function(e){e=St([[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],e);return St([[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],e.map(e=>Math.cbrt(e)))}(Ge(e,t,r)),...0new m(...e,"oklab")}),o.format.oklab=Lt,o.autodetect.push({p:2,test:(...e)=>{if("array"===O(e=p(e,"oklab"))&&3===e.length)return"oklab"}}),n.oklab=(e,t,r)=>{e=e.oklab(),t=t.oklab();return new m(e[0]+r*(t[0]-e[0]),e[1]+r*(t[1]-e[1]),e[2]+r*(t[2]-e[2]),"oklab")},n.oklch=(e,t,r)=>d(e,t,r,"oklch"),Math),Et=Math["pow"];function $t(n){let o="rgb",i=R("#ccc"),t=0,l=[0,1],c=[],h=[0,0],u=!1,f=[],r=!1,d=0,p=1,a,g={},m=!0,b=1;function s(t){if((t=t||["#fff","#000"])&&"string"===O(t)&&R.brewer&&R.brewer[t.toLowerCase()]&&(t=R.brewer[t.toLowerCase()]),"array"===O(t)){t=(t=1===t.length?[t[0],t[0]]:t).slice(0);for(let e=0;e=u[e];)e++;return e-1}};let y=e=>e,w=e=>e;function k(e,t){let r,a;if(null==t&&(t=!1),isNaN(e)||null===e)return i;if(a=t?e:u&&2=s&&e===c.length-1){r=f[e];break}if(a>s&&ag={};s(n);function S(e){return e=R(k(e)),r&&e[r]?e[r]():e}return S.classes=function(e){var t;return null!=e?("array"===O(e)?(u=e,l=[e[0],e[e.length-1]]):(t=R.analyze(l),u=0===e?[t.min,t.max]:R.limits(t,"e",e)),S):u},S.domain=function(r){if(!arguments.length)return l;d=r[0],p=r[r.length-1],c=[];var t=f.length;if(r.length===t&&d!==p)for(var e of Array.from(r))c.push((e-d)/(p-d));else{for(let e=0;et/(r.length-1)),s=r.map(e=>(e-d)/(p-d));s.every((e,t)=>a[t]===e)||(w=e=>{if(e<=0||1<=e)return e;let t=0;for(;e>=s[t+1];)t++;var r=(e-s[t])/(s[t+1]-s[t]);return a[t]+r*(a[t+1]-a[t])})}}return l=[d,p],S},S.mode=function(e){return arguments.length?(o=e,x(),S):o},S.range=function(e,t){return s(e),S},S.out=function(e){return r=e,S},S.spread=function(e){return arguments.length?(t=e,S):t},S.correctLightness=function(e){return null==e&&(e=!0),a=e,x(),y=a?function(e){var t=k(0,!0).lab()[0],r=k(1,!0).lab()[0];const a=re,S},S.padding=function(e){return null!=e?("number"===O(e)&&(e=[e,e]),h=e,S):h},S.colors=function(t,r){arguments.length<2&&(r="hex");let e=[];if(0===arguments.length)e=f.slice(0);else if(1===t)e=[S(.5)];else if(1n;s?e++:e--)a.push(e);return a}(0,t,!1).map(e=>S(a+e/(t-1)*s))}else{n=[];let a=[];if(u&&2t;r?e++:e--)a.push(.5*(u[e-1]+u[e]));else a=l;e=a.map(e=>S(e))}return e=R[r]?e.map(e=>e[r]()):e},S.cache=function(e){return null!=e?(m=e,S):m},S.gamma=function(e){return null!=e?(b=e,S):b},S.nodata=function(e){return null!=e?(i=R(e),S):i},S}var At=function(t){let r=[1,1];for(let e=1;e!(t<3)||!1===r?e:It(e))},Object.assign(R,{rgb:(...e)=>new m(...e,"rgb")}),o.format.rgb=(...e)=>{e=p(e,"rgba");return void 0===e[3]&&(e[3]=1),e},o.autodetect.push({p:3,test:(...e)=>{if("array"===O(e=p(e,"rgba"))&&(3===e.length||4===e.length&&"number"==O(e[3])&&0<=e[3]&&e[3]<=1))return"rgb"}}),(e,t,r)=>{if(y[r])return y[r](e,t);throw new Error("unknown blend mode "+r)}),e=r=>(e,t)=>{t=R(t).rgb(),e=R(e).rgb();return R.rgb(r(t,e))},t=a=>(e,t)=>{var r=[];return r[0]=a(e[0],t[0]),r[1]=a(e[1],t[1]),r[2]=a(e[2],t[2]),r},e=(y.normal=e(t(e=>e)),y.multiply=e(t((e,t)=>e*t/255)),y.screen=e(t((e,t)=>255*(1-(1-e/255)*(1-t/255)))),y.overlay=e(t((e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)))),y.darken=e(t((e,t)=>tt255===e||255<(e=t/255*255/(1-e/255))?255:e)),y.burn=e(t((e,t)=>255*(1-(1-t/255)/(e/255)))),y),{pow:_t,sin:Ut,cos:Ft}=Math;var{floor:Tt,random:Vt}=Math,{log:Bt,pow:Dt,floor:Kt,abs:qt}=Math;function zt(e,t=null){const r={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return(e="object"===O(e)?Object.values(e):e).forEach(e=>{null==(e=t&&"object"===O(e)?e[t]:e)||isNaN(e)||(r.values.push(e),r.sum+=e,er.max&&(r.max=e),r.count+=1)}),r.domain=[r.min,r.max],r.limits=(e,t)=>Wt(r,e,t),r}function Wt(e,t="equal",n=7){var{min:o,max:i}=e="array"==O(e)?zt(e):e,l=e.values.sort((e,t)=>e-t);if(1===n)return[o,i];var c=[];if("c"===t.substr(0,1)&&(c.push(o),c.push(i)),"e"===t.substr(0,1)){c.push(o);for(let e=1;e 0");var r=Math.LOG10E*Bt(o),a=Math.LOG10E*Bt(i);c.push(o);for(let e=1;ee-t),c.push(a[0]);for(let e=1;e[e.toLowerCase(),e])),rr="function"==typeof Proxy?new Proxy(rr,{get(e,t){t=t.toLowerCase();if(sr.has(t))return e[sr.get(t)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(ar)}}):rr,S=(...e)=>{var[t,r,a,s]=e=p(e,"cmyk"),e=4{var[e,t,r]=p(e,"rgb"),a=1-nr(e/=255,nr(t/=255,r/=255)),s=a<1?1/(1-a):0;return[(1-e-a)*s,(1-t-a)*s,(1-r-a)*s,a]},ir=(m.prototype.cmyk=function(){return or(this._rgb)},Object.assign(R,{cmyk:(...e)=>new m(...e,"cmyk")}),o.format.cmyk=S,o.autodetect.push({p:2,test:(...e)=>{if("array"===O(e=p(e,"cmyk"))&&4===e.length)return"cmyk"}}),(...e)=>{var t=p(e,"hsla");let r=c(e)||"lsa";return t[0]=a(t[0]||0)+"deg",t[1]=a(100*t[1])+"%",t[2]=a(100*t[2])+"%","hsla"===r||3{var t=p(e,"lab"),e=c(e)||"lab";return t[0]=a(t[0])+"%",t[1]=a(t[1]),t[2]=a(t[2]),"laba"===e||3{var t=p(e,"lch"),e=c(e)||"lab";return t[0]=a(t[0])+"%",t[1]=a(t[1]),t[2]=isNaN(t[2])?"none":a(t[2])+"deg","lcha"===e||3{e=p(e,"lab");return e[0]=a(100*e[0])+"%",e[1]=$e(e[1]),e[2]=$e(e[2]),3{var[e,t,r,...a]=p(e,"rgb"),[e,t,r]=Ot(e,t,r),[e,t,r]=it(e,t,r);return[e,t,r,...0{e=p(e,"lch");return e[0]=a(100*e[0])+"%",e[1]=$e(e[1]),e[2]=isNaN(e[2])?"none":a(e[2])+"deg",3{var t,r=p(e,"rgba");let a=c(e)||"rgb";return"hsl"===a.substr(0,3)?ir(vt(r),a):"lab"===a.substr(0,3)?(e=qe(),i("d50"),t=lr(Je(r),a),i(e),t):"lch"===a.substr(0,3)?(e=qe(),i("d50"),t=cr(lt(r),a),i(e),t):"oklab"===a.substr(0,5)?hr(Ot(r)):"oklch"===a.substr(0,5)?fr(ur(r)):(r[0]=dr(r[0]),r[1]=dr(r[1]),r[2]=dr(r[2]),("rgba"===a||3{var[e,t,r,...a]=e=p(e,"lch"),[e,t,r]=rt(e,t,r),[e,t,r]=Lt(e,t,r);return[e,t,r,...0e.map((e,t)=>t<=2?L(Cr(e),0,255):e),$=(e,t=0,r=100,a=!1)=>("string"==typeof e&&e.endsWith("%")&&(e=parseFloat(e.substring(0,e.length-1))/100,e=a?t+.5*(e+1)*(r-t):t+e*(r-t)),+e),A=(e,t)=>"none"===e?t:e,S=e=>{if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];let r;if(o.format.named)try{return o.format.named(e)}catch(e){}if(r=(r=e.match(vr))||e.match(yr)){let t=r.slice(1,4);for(let e=0;e<3;e++)t[e]=+$(A(t[e],0),0,255);t=jr(t);var a=void 0!==r[4]?+$(r[4],0,1):1;return t[3]=a,t}if(r=e.match(wr)){var t=r.slice(1,5);for(let e=0;e<4;e++)t[e]=+$(t[e],0,255);return t}if(r=(r=e.match(kr))||e.match(xr))return(a=r.slice(1,4))[0]=+A(a[0].replace("deg",""),0),a[1]=.01*+$(A(a[1],0),0,100),a[2]=.01*+$(A(a[2],0),0,100),a=jr(bt(a)),s=void 0!==r[4]?+$(r[4],0,1):1,a[3]=s,a;if(r=e.match(Sr)){var s=r.slice(1,4),n=(s[1]*=.01,s[2]*=.01,bt(s));for(let e=0;e<3;e++)n[e]=Cr(n[e]);return n[3]=+r[4],n}return(r=e.match(Lr))?((a=r.slice(1,4))[0]=$(A(a[0],0),0,100),a[1]=$(A(a[1],0),-125,125,!0),a[2]=$(A(a[2],0),-125,125,!0),s=qe(),i("d50"),a=jr(He(a)),i(s),s=void 0!==r[4]?+$(r[4],0,1):1,a[3]=s,a):(r=e.match(Or))?((s=r.slice(1,4))[0]=$(s[0],0,100),s[1]=$(A(s[1],0),0,150,!1),s[2]=+A(s[2].replace("deg",""),0),a=qe(),i("d50"),s=jr(at(s)),i(a),a=void 0!==r[4]?+$(r[4],0,1):1,s[3]=a,s):(r=e.match(Rr))?((a=r.slice(1,4))[0]=$(A(a[0],0),0,1),a[1]=$(A(a[1],0),-.4,.4,!0),a[2]=$(A(a[2],0),-.4,.4,!0),s=jr(Lt(a)),a=void 0!==r[4]?+$(r[4],0,1):1,s[3]=a,s):(r=e.match(Nr))?((a=r.slice(1,4))[0]=$(A(a[0],0),0,1),a[1]=$(A(a[1],0),0,.4,!1),a[2]=+A(a[2].replace("deg",""),0),s=jr(gr(a)),e=void 0!==r[4]?+$(r[4],0,1):1,s[3]=e,s):void 0},Pr=(S.test=e=>vr.test(e)||kr.test(e)||Lr.test(e)||Or.test(e)||Rr.test(e)||Nr.test(e)||yr.test(e)||wr.test(e)||xr.test(e)||Sr.test(e)||"transparent"===e,S),Mr=(m.prototype.css=function(e){return pr(this._rgb,e)},R.css=(...e)=>new m(...e,"css"),o.format.css=Pr,o.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&"string"===O(e)&&Pr.test(e))return"css"}}),o.format.gl=(...e)=>{e=p(e,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e},R.gl=(...e)=>new m(...e,"gl"),m.prototype.gl=function(){var e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]},m.prototype.hex=function(e){return Be(this._rgb,e)},(R.hex=(...e)=>new m(...e,"hex"),o.format.hex=Te,o.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&"string"===O(e)&&0<=[3,4,5,6,7,8,9].indexOf(e.length))return"hex"}}),Math)["log"]),Er=e=>{e/=100;let t,r,a;return a=e<66?(t=255,r=e<6?0:-155.25485562709179-.44596950469579133*(r=e-2)+104.49216199393888*Mr(r),e<20?0:.8274096064007395*(a=e-10)-254.76935184120902+115.67994401066147*Mr(a)):(t=351.97690566805693+.114206453784165*(t=e-55)-40.25366309332127*Mr(t),r=325.4494125711974+.07943456536662342*(r=e-50)-28.0852963507957*Mr(r),255),[t,r,a,1]},$r=Math["round"],Ar=(...e)=>{var e=p(e,"rgb"),t=e[0],r=e[2];let a=1e3,s=4e4;let n;for(;.4=r/t?s=n:a=n}return $r(n)},C=(m.prototype.temp=m.prototype.kelvin=m.prototype.temperature=function(){return Ar(this._rgb)},(...e)=>new m(...e,"temp")),Ir=(Object.assign(R,{temp:C,kelvin:C,temperature:C}),o.format.temp=o.format.kelvin=o.format.temperature=Er,m.prototype.oklch=function(){return ur(this._rgb)},Object.assign(R,{oklch:(...e)=>new m(...e,"oklch")}),o.format.oklch=gr,o.autodetect.push({p:2,test:(...e)=>{if("array"===O(e=p(e,"oklch"))&&3===e.length)return"oklch"}}),Object.assign(R,{analyze:zt,average:(e,i="lrgb",l=null)=>{var t=e.length;const r=t/(l=l||Array.from(new Array(t)).map(()=>1)).reduce(function(e,t){return e+t});if(l.forEach((e,t)=>{l[t]*=r}),e=e.map(e=>new m(e)),"lrgb"===i){var a=e,s=l,n=a.length,o=[0,0,0,0];for(let e=0;e{var r,a=e.get(i);o+=e.alpha()*l[t+1];for(let e=0;e{const t=function(e){let a,s,n,o;if(2===(e=e.map(e=>new m(e))).length)[s,n]=e.map(e=>e.lab()),a=function(t){var e=[0,1,2].map(e=>s[e]+t*(n[e]-s[e]));return new m(e,"lab")};else if(3===e.length)[s,n,o]=e.map(e=>e.lab()),a=function(t){var e=[0,1,2].map(e=>(1-t)*(1-t)*s[e]+2*(1-t)*t*n[e]+t*t*o[e]);return new m(e,"lab")};else if(4===e.length){let r;[s,n,o,r]=e.map(e=>e.lab()),a=function(t){var e=[0,1,2].map(e=>(1-t)*(1-t)*(1-t)*s[e]+3*(1-t)*(1-t)*t*n[e]+3*(1-t)*t*t*o[e]+t*t*t*r[e]);return new m(e,"lab")}}else{if(!(5<=e.length))throw new RangeError("No point in running bezier with only one color.");{let t,o,i;t=e.map(e=>e.lab()),i=e.length-1,o=At(i),a=function(s){const n=1-s;var e=[0,1,2].map(a=>t.reduce((e,t,r)=>e+o[r]*n**(i-r)*s**r*t[a],0));return new m(e,"lab")}}}return a}(e);return t.scale=()=>$t(t),t},blend:e,brewer:rr,Color:m,colors:s,contrast:(e,t)=>{e=new m(e),t=new m(t);e=e.luminance(),t=t.luminance();return t{e=new m(e),t=new m(t);var e=Ht(...(e=e.alpha()<1?h(t,e,e.alpha(),"rgb"):e).rgb()),t=Ht(...t.rgb()),e=.022<=e?e:e+Math.pow(.022-e,1.414),t=.022<=t?t:t+Math.pow(.022-t,1.414),r=Math.pow(t,.56)-Math.pow(e,.57),a=Math.pow(t,.65)-Math.pow(e,.62),e=Math.abs(t-e)<5e-4?0:eR.scale(t),t.hue(o),t},deltaE:function(e,t,r=1,a=1,s=1){function n(e){return 360*e/(2*tr)}function o(e){return 2*tr*e/360}e=new m(e),t=new m(t);var[e,i,l]=Array.from(e.lab()),[t,c,h]=Array.from(t.lab()),u=(e+t)/2,f=(k(x(i,2)+x(l,2))+k(x(c,2)+x(h,2)))/2,f=.5*(1-k(x(f,7)/(x(f,7)+x(25,7)))),c=c*(1+f),f=k(x(i=i*(1+f),2)+x(l,2)),d=k(x(c,2)+x(h,2)),p=(f+d)/2,l=n(Jt(l,i)),i=n(Jt(h,c)),l=180{let t="#";for(let e=0;e<6;e++)t+="0123456789abcdef".charAt(Tt(16*Vt()));return new m(t,"hex")},scale:$t,scales:t,valid:(...e)=>{try{return new m(...e),!0}catch(e){return!1}}}),R),I=(t,e)=>{t=localStorage.getItem(t);if(!t)return e;try{return JSON.parse(t)}catch(e){return t}},_r=e=>{e=3===e.length?e.split("").map(e=>e+e).join(""):e;if(6!==e.length)throw"Only 3- or 6-digit hex colours are allowed.";if(e.match(/[^0-9a-f]/i))throw"Only hex colours are allowed.";e=e.match(/.{1,2}/g);if(e&&3===e.length)return[Number.parseInt(e[0],16),Number.parseInt(e[1],16),Number.parseInt(e[2],16)];throw"Could not parse hex colour."},Ur=(e,t)=>{let r=[];return e&&0({name:e.name,url:Hr(e.url)})):r.push({name:t,url:"https://github.com/"+t}),r},Fr=(...e)=>{console.debug("Resetting Marketplace");var t=[];if(0===e.length)for(const r in localStorage)r.startsWith("marketplace:")&&t.push(r);for(const a of e)switch(a){case"extensions":t.push(...I(g.installedExtensions,[])),t.push(g.installedExtensions);break;case"snippets":t.push(...I(g.installedSnippets,[])),t.push(g.installedSnippets);break;case"theme":t.push(...I(g.installedThemes,[])),t.push(g.installedThemes),t.push(g.themeInstalled);break;default:console.error("Unknown category: "+a)}for(const s of t)localStorage.removeItem(s),console.debug("Removed "+s);console.debug("Marketplace has been reset"),location.reload()},Tr=()=>{var e={};for(const t in localStorage)t.startsWith("marketplace:")&&(e[t]=localStorage.getItem(t));return e},Vr=t=>{var r=document.querySelector("style.marketplaceCSS.marketplaceScheme");if(r&&r.remove(),t){r=document.createElement("style");r.classList.add("marketplaceCSS"),r.classList.add("marketplaceScheme");let e=":root {";for(const a of Object.keys(t))e=(e+=`--spice-${a}: #${t[a]};`)+`--spice-rgb-${a}: ${_r(t[a])};`;e+="}",r.innerHTML=e,document.body.appendChild(r)}},Br=async e=>{let t=I(g.albumArtBasedColorVibrancy);return t=t.replace(/([A-Z])/g,"_$1").toUpperCase(),(await Spicetify.colorExtractor(e))[t].substring(1)},Dr=async(e,t)=>{var r=I(g.albumArtBasedColorMode).replace(/([A-Z])/g,"-$1").toLowerCase();return(await fetch(`https://www.thecolorapi.com/scheme?hex=${e}&mode=${r}&count=`+t).then(e=>e.json())).colors.map(e=>e.hex.value.substring(1))};var Kr=f=>{Spicetify.Player.addEventListener("songchange",async()=>{var t;t=1e3,await new Promise(e=>setTimeout(e,t));let r=Spicetify.Player.data?.item?.metadata?.image_xlarge_url;if(r=null==r?await new Promise(t=>{setInterval(()=>{var e=Spicetify.Player.data?.item?.metadata?.image_xlarge_url;e&&t(e)},50)}):r){var a,s,n=new Set(Object.values(f)).size,o=await Br(r),i=await Dr(o,n);let e=new Map;for([a,s]of Object.entries(f))e.has(s)?e.get(s).push(a):e.set(s,[a]);var l,o=new Map([...e.entries()].sort((e,t)=>{e=Ir(e[0]),t=Ir(t[0]);return e.get("lab.l")-t.get("lab.l")})),c={};for([,l]of(e=o).entries()){var h=i.shift();if(h)for(const u of l)c[u]=h}Vr(c)}})},qr=e=>{e=new URL(e);return e.host,"raw.githubusercontent.com"===e.host},zr=e=>{e=e.match(/https:\/\/raw\.githubusercontent\.com\/(?[^/]+)\/(?[^/]+)\/(?[^/]+)\/(?.+$)/);return{user:e?e.groups?.user:null,repo:e?e.groups?.repo:null,branch:e?e.groups?.branch:null,filePath:e?e.groups?.filePath:null}};function Wr(e,t){if(e)for(const s of e){var r=t||s.user+"-"+s.repo,a=window.sessionStorage.getItem(r),a=a?JSON.parse(a):[];a.push(s),window.sessionStorage.setItem(r,JSON.stringify(a))}}var Hr=e=>{var t=decodeURI(e).trim().toLowerCase();return t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:")?"about:blank":e},Yr=e=>{e&&(e=e.split("/").pop())&&-1===Spicetify.Config.extensions.indexOf(e)&&Spicetify.Config.extensions.push(e)};async function Gr(){for(const e of["net","xyz"])try{if("opaqueredirect"===(await fetch("https://cdn.jsdelivr."+e,{redirect:"manual",cache:"no-cache"})).type)return e}catch(e){console.error(e)}}var mr=new Blob([` self.addEventListener('message', async (event) => { const url = event.data; const response = await fetch(url); const data = await response.json().catch(() => null); self.postMessage(data); }); `],{type:"application/javascript"}),Jr=URL.createObjectURL(mr);async function Xr(e,t,r){var a=e+"-"+t,s=window.sessionStorage.getItem(a),n=JSON.parse(window.sessionStorage.getItem("noManifests")||"[]");if(s)return JSON.parse(s);s=`https://raw.githubusercontent.com/${e}/${t}/${r}/manifest.json`;if(n.includes(s))return null;let o=await async function(e){const a=new Worker(Jr);return new Promise(t=>{const r=e=>{a.terminate(),t(e)};a.postMessage(e),a.addEventListener("message",e=>r(e.data),{once:!0}),a.addEventListener("error",()=>r(null),{once:!0})})}(s);return o?(Wr(o=Array.isArray(o)?o:[o],a),o):Wr([s],"noManifests")}async function Zr(e,t){var r=await async function(e,t=1){const r=window.sessionStorage.getItem("marketplace:blacklist");let a=`https://api.github.com/search/repositories?per_page=${Re}&q=`+encodeURIComponent(`topic:spicetify-${e}s`);t&&(a+="&page="+t);var s=JSON.parse(window.sessionStorage.getItem(`spicetify-${e}s-page-`+t)||"null")||await fetch(a).then(e=>e.json()).catch(()=>null);return s?.items?(window.sessionStorage.setItem(`spicetify-${e}s-page-`+t,JSON.stringify(s)),{...s,page_count:s.items.length,items:s.items.filter(e=>!r?.includes(e.html_url))}):(Spicetify.showNotification(Oe("notifications.tooManyRequests"),!0,5e3),{items:[]})}(e,t),a=(!async function(e,t){for(const r of e.items)"theme"===t?await async function(e,a,s){try{var t=e.match(/https:\/\/api\.github\.com\/repos\/(?.+)\/(?.+)\/contents/);if(!t||!t.groups)return;const{user:n,repo:o}=t.groups;return(await Xr(n,o,a)).reduce((e,t)=>{var r;return t?.name&&t?.usercss&&t?.description&&(r=t.branch||a,r={manifest:t,title:t.name,subtitle:t.description,authors:Ur(t.authors,n),user:n,repo:o,branch:r,imageURL:t.preview?.startsWith("http")?t.preview:`https://raw.githubusercontent.com/${n}/${o}/${r}/`+t.preview,readmeURL:t.readme?.startsWith("http")?t.readme:`https://raw.githubusercontent.com/${n}/${o}/${r}/`+t.readme,stars:s,tags:t.tags,cssURL:t.usercss.startsWith("http")?t.usercss:`https://raw.githubusercontent.com/${n}/${o}/${r}/`+t.usercss,schemesURL:t.schemes?t.schemes.startsWith("http")?t.schemes:`https://raw.githubusercontent.com/${n}/${o}/${r}/`+t.schemes:null,include:t.include},e.push(r)),e},[])}catch{return}}(r.contents_url,r.default_branch,r.stargazers_count):"extension"===t?await async function(e,a,s,n=!1){try{var t=e.match(/https:\/\/api\.github\.com\/repos\/(?.+)\/(?.+)\/contents/);if(!t||!t.groups)return;const{user:o,repo:i}=t.groups;return(await Xr(o,i,a)).reduce((e,t)=>{var r;return t?.name&&t.description&&t.main&&(r=t.branch||a,r={manifest:t,title:t.name,subtitle:t.description,authors:Ur(t.authors,o),user:o,repo:i,branch:r,imageURL:t.preview?.startsWith("http")?t.preview:`https://raw.githubusercontent.com/${o}/${i}/${r}/`+t.preview,extensionURL:t.main.startsWith("http")?t.main:`https://raw.githubusercontent.com/${o}/${i}/${r}/`+t.main,readmeURL:t.readme?.startsWith("http")?t.readme:`https://raw.githubusercontent.com/${o}/${i}/${r}/`+t.readme,stars:s,tags:t.tags},n&&localStorage.getItem(`marketplace:installed:${o}/${i}/`+t.main)||e.push(r)),e},[])}catch{return}}(r.contents_url,r.default_branch,r.stargazers_count):"app"===t&&await async function(e,a,s){try{var t=e.match(/https:\/\/api\.github\.com\/repos\/(?.+)\/(?.+)\/contents/);if(!t||!t.groups)return;const{user:n,repo:o}=t.groups;return(await Xr(n,o,a)).reduce((e,t)=>{var r;return t?.name&&t.description&&!t.main&&!t.usercss&&(r=t.branch||a,r={manifest:t,title:t.name,subtitle:t.description,authors:Ur(t.authors,n),user:n,repo:o,branch:r,imageURL:t.preview?.startsWith("http")?t.preview:`https://raw.githubusercontent.com/${n}/${o}/${r}/`+t.preview,readmeURL:t.readme?.startsWith("http")?t.readme:`https://raw.githubusercontent.com/${n}/${o}/${r}/`+t.readme,stars:s,tags:t.tags},e.push(r)),e},[])}catch{return}}(r.contents_url,r.default_branch,r.stargazers_count)}(r,e),Re*t+r.page_count),s=(console.debug({pageOfRepos:r}),r.total_count-a);if(console.debug(`Parsed ${a}/${r.total_count} ${e}s`),0{t=I(t);if(t){if(console.debug("Initializing theme: ",t),t.schemes){var e=t.schemes[t.activeScheme];if(Vr(e),Spicetify.Config.color_scheme=t.activeScheme,"true"===localStorage.getItem(g.albumArtBasedColor))Kr(e);else if("true"===localStorage.getItem(g.colorShift)){var r=t.schemes;let e=0;const f=Object.keys(r).length;setInterval(()=>{e%=f,Vr(Object.values(r)[e]),e++},6e4)}}else console.warn("No schemes found for theme");e=document.querySelector("link.marketplaceCSS"),e=(e&&e.remove(),await(async(e,t)=>{if(!e.cssURL)throw new Error("No CSS URL provided");var t=t||await Gr(),t=qr(e.cssURL)?`https://cdn.jsdelivr.${t}/gh/${e.user}/${e.repo}@${e.branch}/`+e.manifest.usercss:e.cssURL,r=t.replace("/user.css","/assets/");console.debug("Parsing CSS: ",t);let a=await fetch(t+"?time="+Date.now()).then(e=>e.text());for(const o of a.matchAll(/url\(['|"](?.+?)['|"]\)/gm)||[]){var s,n=o?.groups?.path;!n||n.startsWith("http")||n.startsWith("data")||(s=r+n.replace(/\.\//g,""),a=a.replace(n,s))}return a})(t,p));try{var a,s,n=document.querySelector("link[href='user.css']"),o=(n&&n.remove(),document.querySelector("style.marketplaceCSS.marketplaceUserCSS"));o&&o.remove(),e?((a=document.createElement("style")).classList.add("marketplaceCSS"),a.classList.add("marketplaceUserCSS"),a.innerHTML=e,document.body.appendChild(a)):((s=document.createElement("link")).setAttribute("rel","stylesheet"),s.setAttribute("href","user.css"),s.classList.add("userCSS"),document.body.appendChild(s))}catch(e){console.warn(e)}if(Spicetify.Config.current_theme=t.manifest?.name,t.include?.length)for(const d of t.include){var i=document.createElement("script");let e=d;if(qr(d)){var{user:l,repo:c,branch:h,filePath:u}=zr(d);if(!(l&&c&&h&&u))return;e=`https://cdn.jsdelivr.${p}/gh/${l}/${c}@${h}/`+u,u.endsWith(".mjs")&&(i.type="module")}i.src=e+"?time="+Date.now(),i.classList.add("marketplaceScript"),document.body.appendChild(i),Yr(d)}}else console.debug("No theme manifest found")};console.log("Loaded Marketplace extension");var r=I(g.installedSnippets,[]).map(e=>I(e));if(r=r,(a=document.querySelector("style.marketplaceSnippets"))&&a.remove(),a=document.createElement("style"),r=r.reduce((e,t)=>`${e}/* ${t.title} - ${t.description} */ ${t.code} `,""),a.innerHTML=r,a.classList.add("marketplaceSnippets"),document.body.appendChild(a),p){window.sessionStorage.setItem("marketplace-request-tld",p);for(const s of I(g.installedExtensions,[]))(e=>{e=I(e);if(e&&e.extensionURL){console.debug("Initializing extension: ",e);var t=document.createElement("script");if(t.defer=!0,t.src=e.extensionURL,qr(t.src)){var{user:r,repo:a,branch:s,filePath:n}=zr(e.extensionURL);if(!(r&&a&&s&&n))return;t.src=`https://cdn.jsdelivr.${p}/gh/${r}/${a}@${s}/`+n,n.endsWith(".mjs")&&(t.type="module")}t.src=t.src+"?time="+Date.now(),document.body.appendChild(t),Yr(e.manifest?.main)}})(s);var r=Spicetify.Config["current_theme"],a=(localStorage.setItem(g.localTheme,r),localStorage.getItem(g.themeInstalled));a&&("marketplace"!==r.toLocaleLowerCase()?Spicetify.showNotification(Oe("notifications.wrongLocalTheme"),!0,5e3):t(a))}else window.navigator.onLine?(console.error(new Error("Unable to connect to the CDN, please check your Internet configuration.")),Spicetify.showNotification(Oe("notifications.noCdnConnection"),!0,5e3)):window.addEventListener("online",e,{once:!0})}else setTimeout(e,100)}(),async function(){console.debug("Preloading extensions and themes..."),window.sessionStorage.clear();var e=await(await fetch("https://raw.githubusercontent.com/spicetify/marketplace/main/resources/blacklist.json").then(e=>e.json()).catch(()=>({}))).repos;window.sessionStorage.setItem("marketplace:blacklist",JSON.stringify(e)),await Promise.all([Zr("extension",0),Zr("theme",0),Zr("app",0)])}()})()}();