UNPKG

@tbogard/itunes-search

Version:

An iTunes Search library that uses Apple Web Search API. It performes blazing fast searches on iTunes Web API to fetch anything you want to search related to music tracks, music videos, artists, albums, movies, apps in the appStore, books, audiobooks and

3 lines (2 loc) 24.2 kB
var iTunesSearch=(()=>{var Ar=Object.create;var C=Object.defineProperty,gr=Object.defineProperties,Or=Object.getOwnPropertyDescriptor,Rr=Object.getOwnPropertyDescriptors,xr=Object.getOwnPropertyNames,le=Object.getOwnPropertySymbols,qr=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty,Cr=Object.prototype.propertyIsEnumerable;var fe=(t,e,r)=>e in t?C(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y=(t,e)=>{for(var r in e||(e={}))he.call(e,r)&&fe(t,r,e[r]);if(le)for(var r of le(e))Cr.call(e,r)&&fe(t,r,e[r]);return t},T=(t,e)=>gr(t,Rr(e));var l=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)C(t,r,{get:e[r],enumerable:!0})},de=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!he.call(t,n)&&n!==r&&C(t,n,{get:()=>e[n],enumerable:!(i=Or(e,n))||i.enumerable});return t};var Nr=(t,e,r)=>(r=t!=null?Ar(qr(t)):{},de(e||!t||!t.__esModule?C(r,"default",{value:t,enumerable:!0}):r,t)),Ir=t=>de(C({},"__esModule",{value:!0}),t);var S=(t,e,r)=>new Promise((i,n)=>{var s=c=>{try{o(r.next(c))}catch(h){n(h)}},u=c=>{try{o(r.throw(c))}catch(h){n(h)}},o=c=>c.done?i(c.value):Promise.resolve(c.value).then(s,u);o((r=r.apply(t,e)).next())});var G=l((jt,pe)=>{"use strict";pe.exports=function(e,r){return function(){for(var n=new Array(arguments.length),s=0;s<n.length;s++)n[s]=arguments[s];return e.apply(r,n)}}});var p=l((Ft,Se)=>{"use strict";var Mr=G(),A=Object.prototype.toString;function V(t){return Array.isArray(t)}function _(t){return typeof t>"u"}function Br(t){return t!==null&&!_(t)&&t.constructor!==null&&!_(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function me(t){return A.call(t)==="[object ArrayBuffer]"}function kr(t){return A.call(t)==="[object FormData]"}function Lr(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&me(t.buffer),e}function Ur(t){return typeof t=="string"}function Dr(t){return typeof t=="number"}function ye(t){return t!==null&&typeof t=="object"}function M(t){if(A.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function jr(t){return A.call(t)==="[object Date]"}function Fr(t){return A.call(t)==="[object File]"}function Hr(t){return A.call(t)==="[object Blob]"}function ve(t){return A.call(t)==="[object Function]"}function Gr(t){return ye(t)&&ve(t.pipe)}function _r(t){return A.call(t)==="[object URLSearchParams]"}function Jr(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Vr(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function K(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),V(t))for(var r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}function J(){var t={};function e(n,s){M(t[s])&&M(n)?t[s]=J(t[s],n):M(n)?t[s]=J({},n):V(n)?t[s]=n.slice():t[s]=n}for(var r=0,i=arguments.length;r<i;r++)K(arguments[r],e);return t}function Kr(t,e,r){return K(e,function(n,s){r&&typeof n=="function"?t[s]=Mr(n,r):t[s]=n}),t}function Wr(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}Se.exports={isArray:V,isArrayBuffer:me,isBuffer:Br,isFormData:kr,isArrayBufferView:Lr,isString:Ur,isNumber:Dr,isObject:ye,isPlainObject:M,isUndefined:_,isDate:jr,isFile:Fr,isBlob:Hr,isFunction:ve,isStream:Gr,isURLSearchParams:_r,isStandardBrowserEnv:Vr,forEach:K,merge:J,extend:Kr,trim:Jr,stripBOM:Wr}});var W=l((Ht,be)=>{"use strict";var R=p();function we(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}be.exports=function(e,r,i){if(!r)return e;var n;if(i)n=i(r);else if(R.isURLSearchParams(r))n=r.toString();else{var s=[];R.forEach(r,function(c,h){c===null||typeof c>"u"||(R.isArray(c)?h=h+"[]":c=[c],R.forEach(c,function(f){R.isDate(f)?f=f.toISOString():R.isObject(f)&&(f=JSON.stringify(f)),s.push(we(h)+"="+we(f))}))}),n=s.join("&")}if(n){var u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+n}return e}});var Ee=l((Gt,Te)=>{"use strict";var $r=p();function B(){this.handlers=[]}B.prototype.use=function(e,r,i){return this.handlers.push({fulfilled:e,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1};B.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};B.prototype.forEach=function(e){$r.forEach(this.handlers,function(i){i!==null&&e(i)})};Te.exports=B});var ge=l((_t,Ae)=>{"use strict";var zr=p();Ae.exports=function(e,r){zr.forEach(e,function(n,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=n,delete e[s])})}});var $=l((Jt,Oe)=>{"use strict";Oe.exports=function(e,r,i,n,s){return e.config=r,i&&(e.code=i),e.request=n,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var z=l((Vt,Re)=>{"use strict";var Yr=$();Re.exports=function(e,r,i,n,s){var u=new Error(e);return Yr(u,r,i,n,s)}});var qe=l((Kt,xe)=>{"use strict";var Zr=z();xe.exports=function(e,r,i){var n=i.config.validateStatus;!i.status||!n||n(i.status)?e(i):r(Zr("Request failed with status code "+i.status,i.config,null,i.request,i))}});var Pe=l((Wt,Ce)=>{"use strict";var k=p();Ce.exports=k.isStandardBrowserEnv()?function(){return{write:function(r,i,n,s,u,o){var c=[];c.push(r+"="+encodeURIComponent(i)),k.isNumber(n)&&c.push("expires="+new Date(n).toGMTString()),k.isString(s)&&c.push("path="+s),k.isString(u)&&c.push("domain="+u),o===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var i=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Ie=l(($t,Ne)=>{"use strict";Ne.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var Be=l((zt,Me)=>{"use strict";Me.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var Le=l((Yt,ke)=>{"use strict";var Xr=Ie(),Qr=Be();ke.exports=function(e,r){return e&&!Xr(r)?Qr(e,r):r}});var De=l((Zt,Ue)=>{"use strict";var Y=p(),et=["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"];Ue.exports=function(e){var r={},i,n,s;return e&&Y.forEach(e.split(` `),function(o){if(s=o.indexOf(":"),i=Y.trim(o.substr(0,s)).toLowerCase(),n=Y.trim(o.substr(s+1)),i){if(r[i]&&et.indexOf(i)>=0)return;i==="set-cookie"?r[i]=(r[i]?r[i]:[]).concat([n]):r[i]=r[i]?r[i]+", "+n:n}}),r}});var He=l((Xt,Fe)=>{"use strict";var je=p();Fe.exports=je.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),i;function n(s){var u=s;return e&&(r.setAttribute("href",u),u=r.href),r.setAttribute("href",u),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return i=n(window.location.href),function(u){var o=je.isString(u)?n(u):u;return o.protocol===i.protocol&&o.host===i.host}}():function(){return function(){return!0}}()});var P=l((Qt,Ge)=>{"use strict";function Z(t){this.message=t}Z.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Z.prototype.__CANCEL__=!0;Ge.exports=Z});var Q=l((en,_e)=>{"use strict";var L=p(),rt=qe(),tt=Pe(),nt=W(),it=Le(),st=De(),at=He(),X=z(),ot=N(),ut=P();_e.exports=function(e){return new Promise(function(i,n){var s=e.data,u=e.headers,o=e.responseType,c;function h(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}L.isFormData(s)&&delete u["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",b=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";u.Authorization="Basic "+btoa(f+":"+b)}var m=it(e.baseURL,e.url);a.open(e.method.toUpperCase(),nt(m,e.params,e.paramsSerializer),!0),a.timeout=e.timeout;function ue(){if(!!a){var w="getAllResponseHeaders"in a?st(a.getAllResponseHeaders()):null,O=!o||o==="text"||o==="json"?a.responseText:a.response,g={data:O,status:a.status,statusText:a.statusText,headers:w,config:e,request:a};rt(function(H){i(H),h()},function(H){n(H),h()},g),a=null}}if("onloadend"in a?a.onloadend=ue:a.onreadystatechange=function(){!a||a.readyState!==4||a.status===0&&!(a.responseURL&&a.responseURL.indexOf("file:")===0)||setTimeout(ue)},a.onabort=function(){!a||(n(X("Request aborted",e,"ECONNABORTED",a)),a=null)},a.onerror=function(){n(X("Network Error",e,null,a)),a=null},a.ontimeout=function(){var O=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||ot.transitional;e.timeoutErrorMessage&&(O=e.timeoutErrorMessage),n(X(O,e,g.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",a)),a=null},L.isStandardBrowserEnv()){var ce=(e.withCredentials||at(m))&&e.xsrfCookieName?tt.read(e.xsrfCookieName):void 0;ce&&(u[e.xsrfHeaderName]=ce)}"setRequestHeader"in a&&L.forEach(u,function(O,g){typeof s>"u"&&g.toLowerCase()==="content-type"?delete u[g]:a.setRequestHeader(g,O)}),L.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),o&&o!=="json"&&(a.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&a.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function(w){!a||(n(!w||w&&w.type?new ut("canceled"):w),a.abort(),a=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),s||(s=null),a.send(s)})}});var N=l((rn,Ke)=>{"use strict";var d=p(),Je=ge(),ct=$(),lt={"Content-Type":"application/x-www-form-urlencoded"};function Ve(t,e){!d.isUndefined(t)&&d.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function ft(){var t;return typeof XMLHttpRequest<"u"?t=Q():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(t=Q()),t}function ht(t,e,r){if(d.isString(t))try{return(e||JSON.parse)(t),d.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(t)}var U={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:ft(),transformRequest:[function(e,r){return Je(r,"Accept"),Je(r,"Content-Type"),d.isFormData(e)||d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)?e:d.isArrayBufferView(e)?e.buffer:d.isURLSearchParams(e)?(Ve(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):d.isObject(e)||r&&r["Content-Type"]==="application/json"?(Ve(r,"application/json"),ht(e)):e}],transformResponse:[function(e){var r=this.transitional||U.transitional,i=r&&r.silentJSONParsing,n=r&&r.forcedJSONParsing,s=!i&&this.responseType==="json";if(s||n&&d.isString(e)&&e.length)try{return JSON.parse(e)}catch(u){if(s)throw u.name==="SyntaxError"?ct(u,this,"E_JSON_PARSE"):u}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};d.forEach(["delete","get","head"],function(e){U.headers[e]={}});d.forEach(["post","put","patch"],function(e){U.headers[e]=d.merge(lt)});Ke.exports=U});var $e=l((tn,We)=>{"use strict";var dt=p(),pt=N();We.exports=function(e,r,i){var n=this||pt;return dt.forEach(i,function(u){e=u.call(n,e,r)}),e}});var ee=l((nn,ze)=>{"use strict";ze.exports=function(e){return!!(e&&e.__CANCEL__)}});var Xe=l((sn,Ze)=>{"use strict";var Ye=p(),re=$e(),mt=ee(),yt=N(),vt=P();function te(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new vt("canceled")}Ze.exports=function(e){te(e),e.headers=e.headers||{},e.data=re.call(e,e.data,e.headers,e.transformRequest),e.headers=Ye.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Ye.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var r=e.adapter||yt.adapter;return r(e).then(function(n){return te(e),n.data=re.call(e,n.data,n.headers,e.transformResponse),n},function(n){return mt(n)||(te(e),n&&n.response&&(n.response.data=re.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})}});var ne=l((an,Qe)=>{"use strict";var v=p();Qe.exports=function(e,r){r=r||{};var i={};function n(a,f){return v.isPlainObject(a)&&v.isPlainObject(f)?v.merge(a,f):v.isPlainObject(f)?v.merge({},f):v.isArray(f)?f.slice():f}function s(a){if(v.isUndefined(r[a])){if(!v.isUndefined(e[a]))return n(void 0,e[a])}else return n(e[a],r[a])}function u(a){if(!v.isUndefined(r[a]))return n(void 0,r[a])}function o(a){if(v.isUndefined(r[a])){if(!v.isUndefined(e[a]))return n(void 0,e[a])}else return n(void 0,r[a])}function c(a){if(a in r)return n(e[a],r[a]);if(a in e)return n(void 0,e[a])}var h={url:u,method:u,data:u,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c};return v.forEach(Object.keys(e).concat(Object.keys(r)),function(f){var b=h[f]||s,m=b(f);v.isUndefined(m)&&b!==c||(i[f]=m)}),i}});var ie=l((on,er)=>{er.exports={version:"0.25.0"}});var nr=l((un,tr)=>{"use strict";var St=ie().version,se={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){se[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});var rr={};se.transitional=function(e,r,i){function n(s,u){return"[Axios v"+St+"] Transitional option '"+s+"'"+u+(i?". "+i:"")}return function(s,u,o){if(e===!1)throw new Error(n(u," has been removed"+(r?" in "+r:"")));return r&&!rr[u]&&(rr[u]=!0,console.warn(n(u," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,u,o):!0}};function wt(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var i=Object.keys(t),n=i.length;n-- >0;){var s=i[n],u=e[s];if(u){var o=t[s],c=o===void 0||u(o,s,t);if(c!==!0)throw new TypeError("option "+s+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+s)}}tr.exports={assertOptions:wt,validators:se}});var cr=l((cn,ur)=>{"use strict";var ar=p(),bt=W(),ir=Ee(),sr=Xe(),D=ne(),or=nr(),x=or.validators;function I(t){this.defaults=t,this.interceptors={request:new ir,response:new ir}}I.prototype.request=function(e,r){if(typeof e=="string"?(r=r||{},r.url=e):r=e||{},!r.url)throw new Error("Provided config url is not valid");r=D(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var i=r.transitional;i!==void 0&&or.assertOptions(i,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean)},!1);var n=[],s=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(s=s&&m.synchronous,n.unshift(m.fulfilled,m.rejected))});var u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});var o;if(!s){var c=[sr,void 0];for(Array.prototype.unshift.apply(c,n),c=c.concat(u),o=Promise.resolve(r);c.length;)o=o.then(c.shift(),c.shift());return o}for(var h=r;n.length;){var a=n.shift(),f=n.shift();try{h=a(h)}catch(b){f(b);break}}try{o=sr(h)}catch(b){return Promise.reject(b)}for(;u.length;)o=o.then(u.shift(),u.shift());return o};I.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=D(this.defaults,e),bt(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};ar.forEach(["delete","get","head","options"],function(e){I.prototype[e]=function(r,i){return this.request(D(i||{},{method:e,url:r,data:(i||{}).data}))}});ar.forEach(["post","put","patch"],function(e){I.prototype[e]=function(r,i,n){return this.request(D(n||{},{method:e,url:r,data:i}))}});ur.exports=I});var fr=l((ln,lr)=>{"use strict";var Tt=P();function q(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(n){e=n});var r=this;this.promise.then(function(i){if(!!r._listeners){var n,s=r._listeners.length;for(n=0;n<s;n++)r._listeners[n](i);r._listeners=null}}),this.promise.then=function(i){var n,s=new Promise(function(u){r.subscribe(u),n=u}).then(i);return s.cancel=function(){r.unsubscribe(n)},s},t(function(n){r.reason||(r.reason=new Tt(n),e(r.reason))})}q.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};q.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};q.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};q.source=function(){var e,r=new q(function(n){e=n});return{token:r,cancel:e}};lr.exports=q});var dr=l((fn,hr)=>{"use strict";hr.exports=function(e){return function(i){return e.apply(null,i)}}});var mr=l((hn,pr)=>{"use strict";var Et=p();pr.exports=function(e){return Et.isObject(e)&&e.isAxiosError===!0}});var Sr=l((dn,ae)=>{"use strict";var yr=p(),At=G(),j=cr(),gt=ne(),Ot=N();function vr(t){var e=new j(t),r=At(j.prototype.request,e);return yr.extend(r,j.prototype,e),yr.extend(r,e),r.create=function(n){return vr(gt(t,n))},r}var E=vr(Ot);E.Axios=j;E.Cancel=P();E.CancelToken=fr();E.isCancel=ee();E.VERSION=ie().version;E.all=function(e){return Promise.all(e)};E.spread=dr();E.isAxiosError=mr();ae.exports=E;ae.exports.default=E});var br=l((pn,wr)=>{wr.exports=Sr()});var Ut={};Pr(Ut,{default:()=>Lt,searchAlbum:()=>Rt,searchAll:()=>qt,searchApp:()=>Ct,searchArtist:()=>xt,searchAudiobook:()=>Pt,searchBook:()=>Nt,searchMovie:()=>It,searchMusicVideo:()=>Mt,searchPodcast:()=>Bt,searchSong:()=>kt});var oe=Nr(br()),F=class{constructor(){this.options={};this.defaultOptions={limit:1,country:"US",language:"en",attribute:null,entity:null,timeout:2e3};this.searchAlbum=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,T(y({},r),{entity:"album"}),"searchAlbum")});this.searchSong=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,T(y({},r),{media:"music"}),"searchSong")});this.searchArtist=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,T(y({},r),{entity:"allArtist",attribute:"allArtistTerm"}),"searchArtist")});this.searchApp=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,T(y({},r),{entity:"software"}),"searchApp")});this.searchMovie=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,T(y({},r),{entity:"movie"}),"searchMovie")});this.searchMusicVideo=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,T(y({},r),{media:"musicVideo"}),"searchMusicVideo")});this.searchBook=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,T(y({},r),{entity:"ebook"}),"searchBook")});this.searchAudiobook=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,T(y({},r),{entity:"audiobook"}),"searchAudiobook")});this.searchPodcast=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,T(y({},r),{entity:"podcast"}),"searchPodcast")});this.searchAll=(e,r)=>S(this,null,function*(){return yield this.performSearch(e,y({},r),"searchAll")});this.performSearch=(e,r,i)=>S(this,null,function*(){let n=this.validate(e,r,i);try{let s=oe.default.create({baseURL:"https://itunes.apple.com",timeout:n.timeout});n.timeout&&delete n.timeout;let u=new URLSearchParams(n),o=`/search?term=${encodeURI(e)}&${u.toString()}`,{data:c}=yield s.get(o);return c}catch(s){if(oe.default.isAxiosError(s))throw s.code?new Error(`Error: ${s.code}. Reference: https://www.ibm.com/docs/en/zos/2.2.0?topic=codes-sockets-return-errnos`):new Error("Network Disconnected")}})}validate(e,r,i){let n=Object.fromEntries(Object.entries(y(y({},this.defaultOptions),r)).filter(([h,a])=>a!==null)),s=new RegExp(/^(AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|YE|YT|ZA|ZM|ZW)$/,"g"),u=new RegExp(/^(ab|aa|af|ak|sq|am|ar|an|hy|as|av|ae|ay|az|bm|ba|eu|be|bn|bi|bs|br|bg|my|ca|ch|ce|ny|zh|cv|kw|co|cr|hr|cs|da|dv|nl|dz|en|eo|et|ee|fo|fj|fi|fr|ff|gl|ka|de|el|gn|gu|ht|ha|he|hz|hi|ho|hu|ia|id|ie|ga|ig|ik|io|is|it|iu|ja|jv|kl|kn|kr|ks|kk|km|ki|rw|ky|kv|kg|ko|ku|kj|la|lb|lg|li|ln|lo|lt|lu|lv|gv|mk|mg|ms|ml|mt|mi|mr|mh|mn|na|nv|nd|ne|ng|nb|nn|no|ii|nr|oc|oj|cu|om|or|os|pa|pi|fa|pl|ps|pt|qu|rm|rn|ro|ru|sa|sc|sd|se|sm|sg|sr|gd|sn|si|sk|sl|so|st|es|su|sw|ss|sv|ta|te|tg|th|ti|bo|tk|tl|tn|to|tr|ts|tt|tw|ty|ug|uk|ur|uz|ve|vi|vo|wa|cy|wo|fy|xh|yi|yo|za|zu)$/,"g"),o=["album","allArtist","allTrack","audiobook","audiobookAuthor","ebook","iPadSoftware","macSoftware","mix","movie","movieArtist","musicArtist","musicTrack","musicVideo","podcast","podcastAuthor","shortFilm","shortFilmArtist","software","song","tvEpisode","tvSeason"],c=["actorTerm","albumTerm","allArtistTerm","allTrackTerm","artistTerm","authorTerm","composerTerm","descriptionTerm","directorTerm","featureFilmTerm","genreIndex","keywordsTerm","languageTerm","mixTerm","movieArtistTerm","movieTerm","producerTerm","ratingIndex","ratingTerm","releaseYearTerm","shortFilmTerm","showTerm","softwareDeveloper","songTerm","titleTerm","tvEpisodeTerm","tvSeasonTerm"];if(i==="searchAll"){if(n.entity&&!o.includes(n.entity))throw new TypeError(`The entity with value ${JSON.stringify(n.entity)} is not valid. Expected one of the following list ${JSON.stringify(o)}`);if(n.attribute&&!c.includes(n.attribute))throw new TypeError(`The attribute with value ${JSON.stringify(n.attribute)} is not valid. Expected one of the following list ${JSON.stringify(c)}`);if(!n.entity||!n.attribute)throw new TypeError('searchAll expects to have both "entity" and "attribute" values in the options object')}if(typeof e!="string"||!e.trim().length)throw new TypeError('A "term" is a string required on any search. "term" cannot have empty spaces as well.');if(!Number.isInteger(n.limit))throw new TypeError(`Optional argument "limit" must be a number. Passed ${typeof n.limit}(${n.limit})`);if(!s.test(n.country))throw new TypeError(`Optional argument "country" must be a string and should be a valid ISO 3166-1 Alpha 2 country code (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Passed ${typeof n.country}( ${JSON.stringify(n.country)} )`);if(!u.test(n.language))throw new TypeError(`Optional argument "language" must be a string and should be a valid ISO 639-1 language code (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). Passed ${typeof n.language}( ${JSON.stringify(n.language)} )`);return n}};var Tr=new F,{searchAlbum:Rt,searchArtist:xt,searchAll:qt,searchApp:Ct,searchAudiobook:Pt,searchBook:Nt,searchMovie:It,searchMusicVideo:Mt,searchPodcast:Bt,searchSong:kt}=Tr,Lt=Tr;return Ir(Ut);})();