@kkbox/kkbox-js-sdk
Version:
KKBOX Open API developer SDK for JavaScript. Use it to easily access KKBOX open API to get various metadata about KKBOX's tracks, albums, artists, playlists and stations.
7 lines • 46.7 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.KKBOX=e():t.KKBOX=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=51)}([function(t,e,r){"use strict";var n="https://api.kkbox.com/v1.1/";t.exports={SEARCH:n+"search",TRACKS:n+"tracks",ARTISTS:n+"artists",ALBUMS:n+"albums",SHARED_PLAYLISTS:n+"shared-playlists",MOOD_STATIONS:n+"mood-stations",FEATURED_PLAYLISTS:n+"featured-playlists",FEATURED_PLAYLISTS_CATEGORIES:n+"featured-playlist-categories",NEW_RELEASE_CATEGORIES:n+"new-release-categories",NEW_HITS_PLAYLISTS:n+"new-hits-playlists",GENRE_STATIONS:n+"genre-stations",CHARTS:n+"charts",Token:"https://account.kkbox.com/oauth2/token/",Authorization:"https://account.kkbox.com/oauth2/authorize/"}},function(t,e,r){"use strict";function n(t){return"[object Array]"===E.call(t)}function o(t){return"[object ArrayBuffer]"===E.call(t)}function i(t){return"undefined"!=typeof FormData&&t instanceof FormData}function u(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function a(t){return"string"==typeof t}function s(t){return"number"==typeof t}function c(t){return void 0===t}function f(t){return null!==t&&"object"==typeof t}function l(t){return"[object Date]"===E.call(t)}function p(t){return"[object File]"===E.call(t)}function h(t){return"[object Blob]"===E.call(t)}function d(t){return"[object Function]"===E.call(t)}function y(t){return f(t)&&d(t.pipe)}function v(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams}function b(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function g(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function m(t,e){if(null!==t&&void 0!==t)if("object"!=typeof t&&(t=[t]),n(t))for(var r=0,o=t.length;r<o;r++)e.call(null,t[r],r,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function w(){function t(t,r){"object"==typeof e[r]&&"object"==typeof t?e[r]=w(e[r],t):e[r]=t}for(var e={},r=0,n=arguments.length;r<n;r++)m(arguments[r],t);return e}function _(t,e,r){return m(e,function(e,n){t[n]=r&&"function"==typeof e?O(e,r):e}),t}var O=r(9),T=r(46),E=Object.prototype.toString;t.exports={isArray:n,isArrayBuffer:o,isBuffer:T,isFormData:i,isArrayBufferView:u,isString:a,isNumber:s,isObject:f,isUndefined:c,isDate:l,isFile:p,isBlob:h,isFunction:d,isStream:y,isURLSearchParams:v,isStandardBrowserEnv:g,forEach:m,merge:w,extend:_,trim:b}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,t),this.http=e,this.territory=r}return o(t,[{key:"setTerritory",value:function(t){return this.territory=t,this}},{key:"getPropertyByPath",value:function(t,e){e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,"");for(var r=e.split("."),n=0,o=r.length;n<o;++n){var i=r[n];if(!(i in t))return;t=t[i]}return t}},{key:"fetchNextPage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data.paging.next",r=this.getPropertyByPath(t,e);return null!=r&&void 0!==r?this.http.get(r):new Promise(function(t,e){e(new Error("Cannot fetch next page"))})}},{key:"hasNextPage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data.paging.next",r=this.getPropertyByPath(t,e);return null!=r&&void 0!==r}}]),t}();e.default=i},function(t,e,r){"use strict";(function(e){function n(t,e){!o.isUndefined(t)&&o.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var o=r(1),i=r(26),u={"Content-Type":"application/x-www-form-urlencoded"},a={adapter:function(){var t;return"undefined"!=typeof XMLHttpRequest?t=r(5):void 0!==e&&(t=r(5)),t}(),transformRequest:[function(t,e){return i(e,"Content-Type"),o.isFormData(t)||o.isArrayBuffer(t)||o.isBuffer(t)||o.isStream(t)||o.isFile(t)||o.isBlob(t)?t:o.isArrayBufferView(t)?t.buffer:o.isURLSearchParams(t)?(n(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):o.isObject(t)?(n(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};a.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],function(t){a.headers[t]={}}),o.forEach(["post","put","patch"],function(t){a.headers[t]=o.merge(u)}),t.exports=a}).call(e,r(47))},function(t,e,r){t.exports=r(12)},function(t,e,r){"use strict";var n=r(1),o=r(18),i=r(21),u=r(27),a=r(25),s=r(8),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||r(20);t.exports=function(t){return new Promise(function(e,f){var l=t.data,p=t.headers;n.isFormData(l)&&delete p["Content-Type"];var h=new XMLHttpRequest,d="onreadystatechange",y=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in h||a(t.url)||(h=new window.XDomainRequest,d="onload",y=!0,h.onprogress=function(){},h.ontimeout=function(){}),t.auth){var v=t.auth.username||"",b=t.auth.password||"";p.Authorization="Basic "+c(v+":"+b)}if(h.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,h[d]=function(){if(h&&(4===h.readyState||y)&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in h?u(h.getAllResponseHeaders()):null,n=t.responseType&&"text"!==t.responseType?h.response:h.responseText,i={data:n,status:1223===h.status?204:h.status,statusText:1223===h.status?"No Content":h.statusText,headers:r,config:t,request:h};o(e,f,i),h=null}},h.onerror=function(){f(s("Network Error",t,null,h)),h=null},h.ontimeout=function(){f(s("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",h)),h=null},n.isStandardBrowserEnv()){var g=r(23),m=(t.withCredentials||a(t.url))&&t.xsrfCookieName?g.read(t.xsrfCookieName):void 0;m&&(p[t.xsrfHeaderName]=m)}if("setRequestHeader"in h&&n.forEach(p,function(t,e){void 0===l&&"content-type"===e.toLowerCase()?delete p[e]:h.setRequestHeader(e,t)}),t.withCredentials&&(h.withCredentials=!0),t.responseType)try{h.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){h&&(h.abort(),f(t),h=null)}),void 0===l&&(l=null),h.send(l)})}},function(t,e,r){"use strict";function n(t){this.message=t}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,t.exports=n},function(t,e,r){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,r){"use strict";var n=r(17);t.exports=function(t,e,r,o,i){var u=new Error(t);return n(u,e,r,o,i)}},function(t,e,r){"use strict";t.exports=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.apiError=function(t){throw t.response?new Error(t.response.data.error.message):new Error(t.message)},e.authError=function(t){throw new Error(t.response.data.error)}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(43);Object.defineProperty(e,"Auth",{enumerable:!0,get:function(){return n(o).default}});var i=r(30);Object.defineProperty(e,"Api",{enumerable:!0,get:function(){return n(i).default}})},function(t,e,r){"use strict";function n(t){var e=new u(t),r=i(u.prototype.request,e);return o.extend(r,u.prototype,e),o.extend(r,e),r}var o=r(1),i=r(9),u=r(14),a=r(3),s=n(a);s.Axios=u,s.create=function(t){return n(o.merge(a,t))},s.Cancel=r(6),s.CancelToken=r(13),s.isCancel=r(7),s.all=function(t){return Promise.all(t)},s.spread=r(28),t.exports=s,t.exports.default=s},function(t,e,r){"use strict";function n(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(t){e=t});var r=this;t(function(t){r.reason||(r.reason=new o(t),e(r.reason))})}var o=r(6);n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.source=function(){var t;return{token:new n(function(e){t=e}),cancel:t}},t.exports=n},function(t,e,r){"use strict";function n(t){this.defaults=t,this.interceptors={request:new u,response:new u}}var o=r(3),i=r(1),u=r(15),a=r(16);n.prototype.request=function(t){"string"==typeof t&&(t=i.merge({url:arguments[0]},arguments[1])),t=i.merge(o,{method:"get"},this.defaults,t),t.method=t.method.toLowerCase();var e=[a,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)r=r.then(e.shift(),e.shift());return r},i.forEach(["delete","get","head","options"],function(t){n.prototype[t]=function(e,r){return this.request(i.merge(r||{},{method:t,url:e}))}}),i.forEach(["post","put","patch"],function(t){n.prototype[t]=function(e,r,n){return this.request(i.merge(n||{},{method:t,url:e,data:r}))}}),t.exports=n},function(t,e,r){"use strict";function n(){this.handlers=[]}var o=r(1);n.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},n.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},n.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=n},function(t,e,r){"use strict";function n(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var o=r(1),i=r(19),u=r(7),a=r(3),s=r(24),c=r(22);t.exports=function(t){return n(t),t.baseURL&&!s(t.url)&&(t.url=c(t.baseURL,t.url)),t.headers=t.headers||{},t.data=i(t.data,t.headers,t.transformRequest),t.headers=o.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||a.adapter)(t).then(function(e){return n(t),e.data=i(e.data,e.headers,t.transformResponse),e},function(e){return u(e)||(n(t),e&&e.response&&(e.response.data=i(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}},function(t,e,r){"use strict";t.exports=function(t,e,r,n,o){return t.config=e,r&&(t.code=r),t.request=n,t.response=o,t}},function(t,e,r){"use strict";var n=r(8);t.exports=function(t,e,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?e(n("Request failed with status code "+r.status,r.config,null,r.request,r)):t(r)}},function(t,e,r){"use strict";var n=r(1);t.exports=function(t,e,r){return n.forEach(r,function(r){t=r(t,e)}),t}},function(t,e,r){"use strict";function n(){this.message="String contains an invalid character"}function o(t){for(var e,r,o=String(t),u="",a=0,s=i;o.charAt(0|a)||(s="=",a%1);u+=s.charAt(63&e>>8-a%1*8)){if((r=o.charCodeAt(a+=.75))>255)throw new n;e=e<<8|r}return u}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.code=5,n.prototype.name="InvalidCharacterError",t.exports=o},function(t,e,r){"use strict";function n(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=r(1);t.exports=function(t,e,r){if(!e)return t;var i;if(r)i=r(e);else if(o.isURLSearchParams(e))i=e.toString();else{var u=[];o.forEach(e,function(t,e){null!==t&&void 0!==t&&(o.isArray(t)?e+="[]":t=[t],o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),u.push(n(e)+"="+n(t))}))}),i=u.join("&")}return i&&(t+=(-1===t.indexOf("?")?"?":"&")+i),t}},function(t,e,r){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,r){"use strict";var n=r(1);t.exports=n.isStandardBrowserEnv()?function(){return{write:function(t,e,r,o,i,u){var a=[];a.push(t+"="+encodeURIComponent(e)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(i)&&a.push("domain="+i),!0===u&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(t,e,r){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,r){"use strict";var n=r(1);t.exports=n.isStandardBrowserEnv()?function(){function t(t){var e=t;return r&&(o.setAttribute("href",e),e=o.href),o.setAttribute("href",e),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var e,r=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return e=t(window.location.href),function(r){var o=n.isString(r)?t(r):r;return o.protocol===e.protocol&&o.host===e.host}}():function(){return function(){return!0}}()},function(t,e,r){"use strict";var n=r(1);t.exports=function(t,e){n.forEach(t,function(r,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[n])})}},function(t,e,r){"use strict";var n=r(1),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,r,i,u={};return t?(n.forEach(t.split("\n"),function(t){if(i=t.indexOf(":"),e=n.trim(t.substr(0,i)).toLowerCase(),r=n.trim(t.substr(i+1)),e){if(u[e]&&o.indexOf(e)>=0)return;u[e]="set-cookie"===e?(u[e]?u[e]:[]).concat([r]):u[e]?u[e]+", "+r:r}}),u):u}},function(t,e,r){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.albumID=void 0,i}return i(e,t),u(e,[{key:"setAlbumID",value:function(t){return this.albumID=t,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.ALBUMS+"/"+this.albumID,{territory:this.territory})}},{key:"getWidgetUri",value:function(){return"https://widget.kkbox.com/v1/?id="+this.albumID+"&type=album"}},{key:"fetchTracks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.ALBUMS+"/"+this.albumID+"/tracks",{territory:this.territory,limit:t,offset:e})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),u=r(36),a=n(u),s=r(40),c=n(s),f=r(42),l=n(f),p=r(29),h=n(p),d=r(31),y=n(d),v=r(34),b=n(v),g=r(33),m=n(g),w=r(39),_=n(w),O=r(38),T=n(O),E=r(35),j=n(E),S=r(37),k=n(S),P=r(32),C=n(P),A=r(41),I=n(A),x=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";o(this,t),this.territory=r,this.httpClient=void 0,this.setToken(e)}return i(t,[{key:"setToken",value:function(t){this.httpClient=new a.default(t),this.searchFetcher=new c.default(this.httpClient,this.territory),this.trackFetcher=new l.default(this.httpClient,this.territory),this.albumFetcher=new h.default(this.httpClient,this.territory),this.artistFetcher=new y.default(this.httpClient,this.territory),this.featuredPlaylistFetcher=new b.default(this.httpClient,this.territory),this.featuredPlaylistCategoryFetcher=new m.default(this.httpClient,this.territory),this.newReleaseCategoryFetcher=new _.default(this.httpClient,this.territory),this.newHitsPlaylistFetcher=new T.default(this.httpClient,this.territory),this.genreStationFetcher=new j.default(this.httpClient,this.territory),this.moodStationFetcher=new k.default(this.httpClient,this.territory),this.chartFetcher=new C.default(this.httpClient,this.territory),this.sharedPlaylistFetcher=new I.default(this.httpClient,this.territory)}}]),t}();e.default=x},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.artistID=void 0,i}return i(e,t),u(e,[{key:"setArtistID",value:function(t){return this.artistID=t,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.ARTISTS+"/"+this.artistID,{territory:this.territory})}},{key:"fetchAlbums",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.ARTISTS+"/"+this.artistID+"/albums",{territory:this.territory,limit:t,offset:e})}},{key:"fetchTopTracks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.ARTISTS+"/"+this.artistID+"/top-tracks",{territory:this.territory,limit:t,offset:e})}},{key:"fetchRelatedArtists",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.ARTISTS+"/"+this.artistID+"/related-artists",{territory:this.territory,limit:t,offset:e})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.playlistID=void 0,i}return i(e,t),u(e,[{key:"fetchCharts",value:function(){return this.http.get(a.CHARTS,{territory:this.territory})}},{key:"setPlaylistID",value:function(t){return this.playlistID=t,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.CHARTS+"/"+this.playlistID,{territory:this.territory})}},{key:"fetchTracks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.CHARTS+"/"+this.playlistID+"/tracks",{territory:this.territory,limit:t,offset:e})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.categoryID=void 0,i}return i(e,t),u(e,[{key:"fetchAllFeaturedPlaylistCategories",value:function(){return this.http.get(a.FEATURED_PLAYLISTS_CATEGORIES,{territory:this.territory})}},{key:"setCategoryID",value:function(t){return this.categoryID=t,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.FEATURED_PLAYLISTS_CATEGORIES+"/"+this.categoryID,{territory:this.territory})}},{key:"fetchPlaylists",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.FEATURED_PLAYLISTS_CATEGORIES+"/"+this.categoryID+"/playlists",{territory:this.territory,limit:t,offset:e})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";return n(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r))}return i(e,t),u(e,[{key:"fetchAllFeaturedPlaylists",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.FEATURED_PLAYLISTS,{limit:t,offset:e,territory:this.territory})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.genreStationID=void 0,i}return i(e,t),u(e,[{key:"fetchAllGenreStations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.GENRE_STATIONS,{territory:this.territory,limit:t,offset:e})}},{key:"setGenreStationID",value:function(t){return this.genreStationID=t,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.GENRE_STATIONS+"/"+this.genreStationID,{territory:this.territory})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(4),u=function(t){return t&&t.__esModule?t:{default:t}}(i),a=r(10),s=function(){function t(e){n(this,t),this.token="Bearer "+e}return o(t,[{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.default.get(t,{params:e,headers:{Authorization:this.token}}).catch(a.apiError)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return u.default.post(t,e,{headers:{Authorization:this.token}}).catch(a.apiError)}}]),t}();e.default=s},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.moodStationID=void 0,i}return i(e,t),u(e,[{key:"fetchAllMoodStations",value:function(){return this.http.get(a.MOOD_STATIONS,{territory:this.territory})}},{key:"setMoodStationID",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";return this.moodStationID=t,this.territory=e,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.MOOD_STATIONS+"/"+this.moodStationID,{territory:this.territory})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.playlistID=void 0,i}return i(e,t),u(e,[{key:"fetchAllNewHitsPlaylists",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.http.get(a.NEW_HITS_PLAYLISTS,{territory:this.territory})}},{key:"setPlaylistID",value:function(t){return this.playlistID=t,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.NEW_HITS_PLAYLISTS+"/"+this.playlistID,{territory:this.territory})}},{key:"fetchTracks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.NEW_HITS_PLAYLISTS+"/"+this.playlistID+"/tracks",{territory:this.territory,limit:t,offset:e})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.categoryID=void 0,i}return i(e,t),u(e,[{key:"fetchAllNewReleaseCategories",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.NEW_RELEASE_CATEGORIES,{limit:t,offset:e,territory:this.territory})}},{key:"setCategoryID",value:function(t){return this.categoryID=t,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.NEW_RELEASE_CATEGORIES+"/"+this.categoryID,{territory:this.territory})}},{key:"fetchAlbums",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.NEW_RELEASE_CATEGORIES+"/"+this.categoryID+"/albums",{territory:this.territory,limit:t,offset:e})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){var e=this;if(void 0!==this.filterConditions){var r=Object.keys(t.data).map(function(r){switch(r){case"tracks":return o({},r,Object.assign(t.data[r],{data:t.data[r].data.filter(function(t){return!(void 0!==e.filterConditions.availableTerritory&&!t.available_territories.includes(e.filterConditions.availableTerritory))&&(!(void 0!==e.filterConditions.track&&!new RegExp(".*"+e.filterConditions.track+".*").test(t.name))&&(!(void 0!==e.filterConditions.album&&!new RegExp(".*"+e.filterConditions.album+".*").test(t.album.name))&&!(void 0!==e.filterConditions.artist&&!new RegExp(".*"+e.filterConditions.artist+".*").test(t.album.artist.name))))})}));case"albums":return o({},r,Object.assign(t.data[r],{data:t.data[r].data.filter(function(t){return!(void 0!==e.filterConditions.availableTerritory&&!t.available_territories.includes(e.filterConditions.availableTerritory))&&(!(void 0!==e.filterConditions.album&&!new RegExp(".*"+e.filterConditions.album+".*").test(t.name))&&!(void 0!==e.filterConditions.artist&&!new RegExp(".*"+e.filterConditions.artist+".*").test(t.artist.name)))})}));case"artists":return o({},r,Object.assign(t.data[r],{data:t.data[r].data.filter(function(t){return void 0===e.filterConditions.artist||new RegExp(".*"+e.filterConditions.artist+".*").test(t.name)})}));case"playlists":return o({},r,Object.assign(t.data[r],{data:t.data[r].data.filter(function(t){return void 0===e.filterConditions.playlist||new RegExp(".*"+e.filterConditions.playlist+".*").test(t.title)})}));default:return o({},r,t.data[r])}});return Object.assign(t,{data:Object.assign.apply(Object,n(r))})}return t}Object.defineProperty(e,"__esModule",{value:!0});var c=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),f=r(0),l=r(2),p=function(t){return t&&t.__esModule?t:{default:t}}(l),h=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";i(this,e);var n=u(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return n.filterConditions=void 0,n.q=void 0,n.type=void 0,n}return a(e,t),c(e,[{key:"filter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.filterConditions=t,this}},{key:"setSearchCriteria",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.q=t,this.type=e,this}},{key:"fetchSearchResult",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(f.SEARCH,{q:this.q,type:this.type,territory:this.territory,limit:t,offset:e}).then(s.bind(this))}}]),e}(p.default);e.default=h},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.playlistID=void 0,i}return i(e,t),u(e,[{key:"setPlaylistID",value:function(t){return this.playlistID=t,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.SHARED_PLAYLISTS+"/"+this.playlistID,{territory:this.territory})}},{key:"getWidgetUri",value:function(){return"https://widget.kkbox.com/v1/?id="+this.playlistID+"&type=playlist"}},{key:"fetchTracks",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return this.http.get(a.SHARED_PLAYLISTS+"/"+this.playlistID+"/tracks",{territory:this.territory,limit:t,offset:e})}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0),s=r(2),c=function(t){return t&&t.__esModule?t:{default:t}}(s),f=function(t){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TW";n(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return i.trackID=void 0,i}return i(e,t),u(e,[{key:"setTrackID",value:function(t){return this.trackID=t,this}},{key:"fetchMetadata",value:function(){return this.http.get(a.TRACKS+"/"+this.trackID,{territory:this.territory})}},{key:"getWidgetUri",value:function(){return"https://widget.kkbox.com/v1/?id="+this.trackID+"&type=song"}}]),e}(c.default);e.default=f},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=r(44),u=n(i),a=r(45),s=n(a),c=function t(e,r){o(this,t),this.tokenFetcher=new s.default(e,r),this.clientCredentialsFlow=new u.default(this.tokenFetcher)};e.default=c},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=function(){function t(e){n(this,t),this.token=e}return o(t,[{key:"fetchAccessToken",value:function(){return this.token.fetchAccessToken({grant_type:"client_credentials"})}}]),t}();e.default=i},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),u=r(4),a=n(u),s=r(10),c=r(50),f=n(c),l=r(0),p=function(){function t(e,r){o(this,t),this.clientID=e,this.clientSecret=r}return i(t,[{key:"fetchAccessToken",value:function(t){return a.default.post(l.Token,f.default.stringify(t),{auth:{username:this.clientID,password:this.clientSecret},headers:{}}).catch(s.authError)}}]),t}();e.default=p},function(t,e){function r(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function n(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
t.exports=function(t){return null!=t&&(r(t)||n(t)||!!t._isBuffer)}},function(t,e){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(l===clearTimeout)return clearTimeout(t);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function u(){y&&h&&(y=!1,h.length?d=h.concat(d):v=-1,d.length&&a())}function a(){if(!y){var t=o(u);y=!0;for(var e=d.length;e;){for(h=d,d=[];++v<e;)h&&h[v].run();v=-1,e=d.length}h=null,y=!1,i(t)}}function s(t,e){this.fun=t,this.array=e}function c(){}var f,l,p=t.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:r}catch(t){f=r}try{l="function"==typeof clearTimeout?clearTimeout:n}catch(t){l=n}}();var h,d=[],y=!1,v=-1;p.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];d.push(new s(t,e)),1!==d.length||y||o(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(t){return[]},p.binding=function(t){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(t){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,i){e=e||"&",r=r||"=";var u={};if("string"!=typeof t||0===t.length)return u;var a=/\+/g;t=t.split(e);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var c=t.length;s>0&&c>s&&(c=s);for(var f=0;f<c;++f){var l,p,h,d,y=t[f].replace(a,"%20"),v=y.indexOf(r);v>=0?(l=y.substr(0,v),p=y.substr(v+1)):(l=y,p=""),h=decodeURIComponent(l),d=decodeURIComponent(p),n(u,h)?o(u[h])?u[h].push(d):u[h]=[u[h],d]:u[h]=d}return u};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var o=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,a){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?n(u(t),function(u){var a=encodeURIComponent(o(u))+r;return i(t[u])?n(t[u],function(t){return a+encodeURIComponent(o(t))}).join(e):a+encodeURIComponent(o(t[u]))}).join(e):a?encodeURIComponent(o(a))+r+encodeURIComponent(o(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},u=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";e.decode=e.parse=r(48),e.encode=e.stringify=r(49)},function(t,e,r){t.exports=r(11)}])});