1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 08:10:18 +00:00
musix-oss/node_modules/simple-youtube-api/dist/sya.min.js
MatteZ02 5eb0264906 fix
2019-05-30 12:06:47 +03:00

1 line
22 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SimpleYoutubeAPI=e():t.SimpleYoutubeAPI=e()}(window,function(){return function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=4)}([function(t,e){e.PARTS={Search:"snippet",Videos:"snippet,contentDetails",Playlists:"snippet",PlaylistItems:"snippet,status",Channels:"snippet"},e.KINDS={Video:"youtube#video",PlaylistItem:"youtube#playlistItem",Playlist:"youtube#playlist",SearchResult:"youtube#searchResult",Channel:"youtube#channel"},e.ENDPOINTS={PlaylistItems:"playlistItems",Channels:"channels",Videos:"videos",Playlists:"playlists",Search:"search"}},function(t,e,s){const{parse:n}=s(8);e.parseURL=(t=>{const e=n(t,!0);switch(e.hostname){case"www.youtube.com":case"youtube.com":case"m.youtube.com":{const t=/^[a-zA-Z0-9-_]+$/;if("/watch"===e.pathname){if(!t.test(e.query.v))return{};const s={video:e.query.v};return e.query.list&&(s.playlist=e.query.list),s}if("/playlist"===e.pathname)return t.test(e.query.list)?{playlist:e.query.list}:{};if(e.pathname.startsWith("/channel/")){const s=e.pathname.replace("/channel/","");return t.test(s)?{channel:s}:{}}return{}}case"youtu.be":return{video:/^\/[a-zA-Z0-9-_]+$/.test(e.pathname)?e.pathname.slice(1):null};default:return{}}})},function(t,e,s){const{parseURL:n}=s(1),i=s(0);t.exports=class{constructor(t,e){this.youtube=t,Object.defineProperty(this,"youtube",{enumerable:!1}),this.type="channel",this._patch(e)}_patch(t){if(t){switch(this.raw=t,this.full=t.kind===i.KINDS.Channel,this.kind=t.kind,t.kind){case i.KINDS.Playlist:case i.KINDS.PlaylistItem:case i.KINDS.Video:if(t.snippet){this.id=t.snippet.channelId,this.title=t.snippet.channelTitle;break}throw new Error("Attempted to make a channel out of a resource with no channel data.");case i.KINDS.SearchResult:if(t.id.kind===i.KINDS.Channel){this.id=t.id.channelId;break}if(t.snippet){this.id=t.snippet.channelId,this.title=t.snippet.channelTitle;break}throw new Error("Attempted to make a channel out of a search result with no channel data.");case i.KINDS.Channel:this.id=t.id,t.snippet&&(this.title=t.snippet.title,this.description=t.snippet.description,this.customURL=t.snippet.customUrl,this.publishedAt=new Date(t.snippet.publishedAt),this.thumbnails=t.snippet.thumbnails,this.defaultLanguage=t.snippet.defaultLanguage,this.localized=t.snippet.localized,this.country=t.snippet.country),t.contentDetails&&(this.relatedPlaylists=t.contentDetails.relatedPlaylists),t.statistics&&(this.viewCount=t.statistics.viewCount,this.commentCount=t.statistics.commentCount,this.subscriberCount=t.statistics.subscriberCount,this.hiddenSubscriberCount=t.statistics.hiddenSubscriberCount,this.videoCount=t.statistics.videoCount);break;default:throw new Error(`Unknown channel kind: ${t.kind}.`)}return this}}fetch(t){return this.youtube.request.getChannel(this.id,t).then(this._patch.bind(this))}get url(){return`https://www.youtube.com/channel/${this.id}`}static extractID(t){return n(t).channel}}},function(t,e,s){const n=s(7),{parseURL:i}=s(1),r=s(0),o=s(2);t.exports=class{constructor(t,e){this.youtube=t,Object.defineProperty(this,"youtube",{enumerable:!1}),this.type="video",this._patch(e)}_patch(t){if(t){switch(this.raw=t,this.full=t.kind===r.KINDS.Video,this.kind=t.kind,t.kind){case r.KINDS.PlaylistItem:if(t.snippet){if(t.snippet.resourceId.kind!==r.KINDS.Video)throw new Error("Attempted to make a video out of a non-video playlist item.");this.id=t.snippet.resourceId.videoId;break}throw new Error("Attempted to make a video out of a playlist item with no video data.");case r.KINDS.Video:this.id=t.id;break;case r.KINDS.SearchResult:if(t.id.kind!==r.KINDS.Video)throw new Error("Attempted to make a video out of a non-video search result.");this.id=t.id.videoId;break;default:throw new Error(`Unknown video kind: ${t.kind}.`)}return t.snippet&&(this.title=t.snippet.title,this.description=t.snippet.description,this.thumbnails=t.snippet.thumbnails,this.publishedAt=new Date(t.snippet.publishedAt),this.channel=new o(this.youtube,t)),t.contentDetails&&(this.duration=t.contentDetails.duration?n.parse(t.contentDetails.duration):null),this}}get maxRes(){const t=this.thumbnails;return t.maxres||t.standard||t.high||t.medium||t.default}get url(){return`https://www.youtube.com/watch?v=${this.id}`}get shortURL(){return`https://youtu.be/${this.id}`}get durationSeconds(){return this.duration?n.toSeconds(this.duration):-1}fetch(t){return this.youtube.request.getVideo(this.id,t).then(this._patch.bind(this))}static extractID(t){return i(t).video}}},function(t,e,s){const n=s(5),i=s(3),r=s(16),o=s(2),a=s(1),h=s(0);class u{constructor(t){if("string"!=typeof t)throw new Error("The YouTube API key you provided was not a string.");this.key=t,Object.defineProperty(this,"key",{enumerable:!1}),this.request=new n(this)}getVideo(t,e={}){const s=i.extractID(t);return s?this.getVideoByID(s,e):Promise.reject(new Error(`No video ID found in URL: ${t}`))}getVideoByID(t,e={}){return this.request.getVideo(t,e).then(t=>t?new i(this,t):null)}getPlaylist(t,e={}){const s=r.extractID(t);return s?this.getPlaylistByID(s,e):Promise.reject(new Error(`No playlist ID found in URL: ${t}`))}getPlaylistByID(t,e={}){return this.request.getPlaylist(t,e).then(t=>t?new r(this,t):null)}getChannel(t,e={}){const s=o.extractID(t);return s?this.getChannelByID(s,e):Promise.reject(new Error(`No channel ID found in URL: ${t}`))}getChannelByID(t,e={}){return this.request.getChannel(t,e).then(t=>t?new o(this,t):null)}search(t,e=5,s={}){return this.request.getPaginated(h.ENDPOINTS.Search,e,Object.assign(s,{q:t,part:h.PARTS.Search})).then(t=>t.map(t=>t.id.kind===h.KINDS.Video?new i(this,t):t.id.kind===h.KINDS.Playlist?new r(this,t):t.id.kind===h.KINDS.Channel?new o(this,t):null))}searchVideos(t,e=5,s={}){return this.search(t,e,Object.assign(s,{type:"video"}))}searchPlaylists(t,e=5,s={}){return this.search(t,e,Object.assign(s,{type:"playlist"}))}searchChannels(t,e=5,s={}){return this.search(t,e,Object.assign(s,{type:"channel"}))}}u.Video=i,u.Playlist=r,u.Channel=o,u.util=a,t.exports=u},function(t,e,s){const n=s(6),i=s(0);t.exports=class{constructor(t){this.youtube=t}make(t,e={}){e=Object.assign({key:this.youtube.key},e);const s=Object.keys(e).filter(t=>e[t]).map(t=>`${t}=${e[t]}`);return n(encodeURI(`https://www.googleapis.com/youtube/v3/${t}${s.length?`?${s.join("&")}`:""}`)).then(t=>t.json()).then(t=>t.error?Promise.reject(t.error):t)}getResource(t,e={}){return e=Object.assign({part:i.PARTS[t]},e),this.make(i.ENDPOINTS[t],e).then(t=>t.items.length?t.items[0]:Promise.reject(new Error(`resource ${t.kind} not found`)))}getResourceByID(t,e,s={}){return this.getResource(t,Object.assign(s,{id:e}))}getVideo(t,e){return this.getResourceByID("Videos",t,e)}getPlaylist(t,e){return this.getResourceByID("Playlists",t,e)}getChannel(t,e){return this.getResourceByID("Channels",t,e)}getPaginated(t,e=1/0,s={},n=[],i=null){if(e<1)return Promise.reject("Cannot fetch less than 1.");const r=e>50?50:e;return this.make(t,Object.assign(s,{pageToken:i,maxResults:r})).then(i=>{const o=n.concat(i.items);return i.nextPageToken&&r!==e?this.getPaginated(t,e-r,s,o,i.nextPageToken):o})}}},function(t,e,s){"use strict";t.exports=e=self.fetch,e.default=self.fetch.bind(self),e.Headers=self.Headers,e.Request=self.Request,e.Response=self.Response},function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=["weeks","years","months","days","hours","minutes","seconds"],i=e.pattern=new RegExp("P(?:(\\d+(?:[\\.,]\\d{0,3})?W)|(\\d+(?:[\\.,]\\d{0,3})?Y)?(\\d+(?:[\\.,]\\d{0,3})?M)?(\\d+(?:[\\.,]\\d{0,3})?D)?(?:T(\\d+(?:[\\.,]\\d{0,3})?H)?(\\d+(?:[\\.,]\\d{0,3})?M)?(\\d+(?:[\\.,]\\d{0,3})?S)?)?)"),r=e.parse=function(t){return t.match(i).slice(1).reduce(function(t,e,s){return t[n[s]]=parseFloat(e)||0,t},{})},o=e.end=function(t,e){var s=e?e.getTime():Date.now(),n=new Date(s);return n.setFullYear(n.getFullYear()+t.years),n.setMonth(n.getMonth()+t.months),n.setDate(n.getDate()+t.days),n.setHours(n.getHours()+t.hours),n.setMinutes(n.getMinutes()+t.minutes),n.setMilliseconds(n.getMilliseconds()+1e3*t.seconds),n.setDate(n.getDate()+7*t.weeks),n},a=e.toSeconds=function(t,e){var s=e?e.getTime():Date.now(),n=new Date(s);return(o(t,e).getTime()-n.getTime())/1e3};e.default={end:o,toSeconds:a,pattern:i,parse:r}},function(t,e,s){"use strict";var n=s(9),i=s(12);function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=v,e.resolve=function(t,e){return v(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?v(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=v(t));return t instanceof r?t.format():r.prototype.format.call(t)},e.Url=r;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(u),c=["%","/","?",";","#"].concat(l),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=s(13);function v(t,e,s){if(t&&i.isObject(t)&&t instanceof r)return t;var n=new r;return n.parse(t,e,s),n}r.prototype.parse=function(t,e,s){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),a=-1!==r&&r<t.indexOf("#")?"?":"#",u=t.split(a);u[0]=u[0].replace(/\\/g,"/");var v=t=u.join(a);if(v=v.trim(),!s&&1===t.split("#").length){var w=h.exec(v);if(w)return this.path=v,this.href=v,this.pathname=w[1],w[2]?(this.search=w[2],this.query=e?g.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var I=o.exec(v);if(I){var j=(I=I[0]).toLowerCase();this.protocol=j,v=v.substr(I.length)}if(s||I||v.match(/^\/\/[^@\/]+@[^@\/]+/)){var P="//"===v.substr(0,2);!P||I&&y[I]||(v=v.substr(2),this.slashes=!0)}if(!y[I]&&(P||I&&!b[I])){for(var k,D,O=-1,S=0;S<p.length;S++){-1!==(x=v.indexOf(p[S]))&&(-1===O||x<O)&&(O=x)}-1!==(D=-1===O?v.lastIndexOf("@"):v.lastIndexOf("@",O))&&(k=v.slice(0,D),v=v.slice(D+1),this.auth=decodeURIComponent(k)),O=-1;for(S=0;S<c.length;S++){var x;-1!==(x=v.indexOf(c[S]))&&(-1===O||x<O)&&(O=x)}-1===O&&(O=v.length),this.host=v.slice(0,O),v=v.slice(O),this.parseHost(),this.hostname=this.hostname||"";var C="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!C)for(var A=this.hostname.split(/\./),R=(S=0,A.length);S<R;S++){var N=A[S];if(N&&!N.match(f)){for(var q="",U=0,T=N.length;U<T;U++)N.charCodeAt(U)>127?q+="x":q+=N[U];if(!q.match(f)){var E=A.slice(0,S),K=A.slice(S+1),$=N.match(d);$&&(E.push($[1]),K.unshift($[2])),K.length&&(v="/"+K.join(".")+v),this.hostname=E.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=n.toASCII(this.hostname));var _=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+_,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!m[j])for(S=0,R=l.length;S<R;S++){var L=l[S];if(-1!==v.indexOf(L)){var M=encodeURIComponent(L);M===L&&(M=escape(L)),v=v.split(L).join(M)}}var B=v.indexOf("#");-1!==B&&(this.hash=v.substr(B),v=v.slice(0,B));var z=v.indexOf("?");if(-1!==z?(this.search=v.substr(z),this.query=v.substr(z+1),e&&(this.query=g.parse(this.query)),v=v.slice(0,z)):e&&(this.search="",this.query={}),v&&(this.pathname=v),b[j]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){_=this.pathname||"";var F=this.search||"";this.path=_+F}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",s=this.pathname||"",n=this.hash||"",r=!1,o="";this.host?r=t+this.host:this.hostname&&(r=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(o=g.stringify(this.query));var a=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||b[e])&&!1!==r?(r="//"+(r||""),s&&"/"!==s.charAt(0)&&(s="/"+s)):r||(r=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),e+r+(s=s.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(a=a.replace("#","%23"))+n},r.prototype.resolve=function(t){return this.resolveObject(v(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if(i.isString(t)){var e=new r;e.parse(t,!1,!0),t=e}for(var s=new r,n=Object.keys(this),o=0;o<n.length;o++){var a=n[o];s[a]=this[a]}if(s.hash=t.hash,""===t.href)return s.href=s.format(),s;if(t.slashes&&!t.protocol){for(var h=Object.keys(t),u=0;u<h.length;u++){var l=h[u];"protocol"!==l&&(s[l]=t[l])}return b[s.protocol]&&s.hostname&&!s.pathname&&(s.path=s.pathname="/"),s.href=s.format(),s}if(t.protocol&&t.protocol!==s.protocol){if(!b[t.protocol]){for(var c=Object.keys(t),p=0;p<c.length;p++){var f=c[p];s[f]=t[f]}return s.href=s.format(),s}if(s.protocol=t.protocol,t.host||y[t.protocol])s.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),s.pathname=d.join("/")}if(s.search=t.search,s.query=t.query,s.host=t.host||"",s.auth=t.auth,s.hostname=t.hostname||t.host,s.port=t.port,s.pathname||s.search){var m=s.pathname||"",g=s.search||"";s.path=m+g}return s.slashes=s.slashes||t.slashes,s.href=s.format(),s}var v=s.pathname&&"/"===s.pathname.charAt(0),w=t.host||t.pathname&&"/"===t.pathname.charAt(0),I=w||v||s.host&&t.pathname,j=I,P=s.pathname&&s.pathname.split("/")||[],k=(d=t.pathname&&t.pathname.split("/")||[],s.protocol&&!b[s.protocol]);if(k&&(s.hostname="",s.port=null,s.host&&(""===P[0]?P[0]=s.host:P.unshift(s.host)),s.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),I=I&&(""===d[0]||""===P[0])),w)s.host=t.host||""===t.host?t.host:s.host,s.hostname=t.hostname||""===t.hostname?t.hostname:s.hostname,s.search=t.search,s.query=t.query,P=d;else if(d.length)P||(P=[]),P.pop(),P=P.concat(d),s.search=t.search,s.query=t.query;else if(!i.isNullOrUndefined(t.search)){if(k)s.hostname=s.host=P.shift(),(C=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=C.shift(),s.host=s.hostname=C.shift());return s.search=t.search,s.query=t.query,i.isNull(s.pathname)&&i.isNull(s.search)||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.href=s.format(),s}if(!P.length)return s.pathname=null,s.search?s.path="/"+s.search:s.path=null,s.href=s.format(),s;for(var D=P.slice(-1)[0],O=(s.host||t.host||P.length>1)&&("."===D||".."===D)||""===D,S=0,x=P.length;x>=0;x--)"."===(D=P[x])?P.splice(x,1):".."===D?(P.splice(x,1),S++):S&&(P.splice(x,1),S--);if(!I&&!j)for(;S--;S)P.unshift("..");!I||""===P[0]||P[0]&&"/"===P[0].charAt(0)||P.unshift(""),O&&"/"!==P.join("/").substr(-1)&&P.push("");var C,A=""===P[0]||P[0]&&"/"===P[0].charAt(0);k&&(s.hostname=s.host=A?"":P.length?P.shift():"",(C=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=C.shift(),s.host=s.hostname=C.shift()));return(I=I||s.host&&P.length)&&!A&&P.unshift(""),P.length?s.pathname=P.join("/"):(s.pathname=null,s.path=null),i.isNull(s.pathname)&&i.isNull(s.search)||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.auth=t.auth||s.auth,s.slashes=s.slashes||t.slashes,s.href=s.format(),s},r.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,s){(function(t,n){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(r){e&&e.nodeType,t&&t.nodeType;var o="object"==typeof n&&n;o.global!==o&&o.window!==o&&o.self;var a,h=2147483647,u=36,l=1,c=26,p=38,f=700,d=72,m=128,y="-",b=/^xn--/,g=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=u-l,j=Math.floor,P=String.fromCharCode;function k(t){throw new RangeError(w[t])}function D(t,e){for(var s=t.length,n=[];s--;)n[s]=e(t[s]);return n}function O(t,e){var s=t.split("@"),n="";return s.length>1&&(n=s[0]+"@",t=s[1]),n+D((t=t.replace(v,".")).split("."),e).join(".")}function S(t){for(var e,s,n=[],i=0,r=t.length;i<r;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<r?56320==(64512&(s=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&s)+65536):(n.push(e),i--):n.push(e);return n}function x(t){return D(t,function(t){var e="";return t>65535&&(e+=P((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=P(t)}).join("")}function C(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:u}function A(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function R(t,e,s){var n=0;for(t=s?j(t/f):t>>1,t+=j(t/e);t>I*c>>1;n+=u)t=j(t/I);return j(n+(I+1)*t/(t+p))}function N(t){var e,s,n,i,r,o,a,p,f,b,g=[],v=t.length,w=0,I=m,P=d;for((s=t.lastIndexOf(y))<0&&(s=0),n=0;n<s;++n)t.charCodeAt(n)>=128&&k("not-basic"),g.push(t.charCodeAt(n));for(i=s>0?s+1:0;i<v;){for(r=w,o=1,a=u;i>=v&&k("invalid-input"),((p=C(t.charCodeAt(i++)))>=u||p>j((h-w)/o))&&k("overflow"),w+=p*o,!(p<(f=a<=P?l:a>=P+c?c:a-P));a+=u)o>j(h/(b=u-f))&&k("overflow"),o*=b;P=R(w-r,e=g.length+1,0==r),j(w/e)>h-I&&k("overflow"),I+=j(w/e),w%=e,g.splice(w++,0,I)}return x(g)}function q(t){var e,s,n,i,r,o,a,p,f,b,g,v,w,I,D,O=[];for(v=(t=S(t)).length,e=m,s=0,r=d,o=0;o<v;++o)(g=t[o])<128&&O.push(P(g));for(n=i=O.length,i&&O.push(y);n<v;){for(a=h,o=0;o<v;++o)(g=t[o])>=e&&g<a&&(a=g);for(a-e>j((h-s)/(w=n+1))&&k("overflow"),s+=(a-e)*w,e=a,o=0;o<v;++o)if((g=t[o])<e&&++s>h&&k("overflow"),g==e){for(p=s,f=u;!(p<(b=f<=r?l:f>=r+c?c:f-r));f+=u)D=p-b,I=u-b,O.push(P(A(b+D%I,0))),p=j(D/I);O.push(P(A(p,0))),r=R(s,w,n==i),s=0,++n}++s,++e}return O.join("")}a={version:"1.4.1",ucs2:{decode:S,encode:x},decode:N,encode:q,toASCII:function(t){return O(t,function(t){return g.test(t)?"xn--"+q(t):t})},toUnicode:function(t){return O(t,function(t){return b.test(t)?N(t.slice(4).toLowerCase()):t})}},void 0===(i=function(){return a}.call(e,s,e,t))||(t.exports=i)}()}).call(this,s(10)(t),s(11))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){var s;s=function(){return this}();try{s=s||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(s=window)}t.exports=s},function(t,e,s){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,s){"use strict";e.decode=e.parse=s(14),e.encode=e.stringify=s(15)},function(t,e,s){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,s,r){e=e||"&",s=s||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(e);var h=1e3;r&&"number"==typeof r.maxKeys&&(h=r.maxKeys);var u=t.length;h>0&&u>h&&(u=h);for(var l=0;l<u;++l){var c,p,f,d,m=t[l].replace(a,"%20"),y=m.indexOf(s);y>=0?(c=m.substr(0,y),p=m.substr(y+1)):(c=m,p=""),f=decodeURIComponent(c),d=decodeURIComponent(p),n(o,f)?i(o[f])?o[f].push(d):o[f]=[o[f],d]:o[f]=d}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,s){"use strict";var n=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,s,a){return e=e||"&",s=s||"=",null===t&&(t=void 0),"object"==typeof t?r(o(t),function(o){var a=encodeURIComponent(n(o))+s;return i(t[o])?r(t[o],function(t){return a+encodeURIComponent(n(t))}).join(e):a+encodeURIComponent(n(t[o]))}).join(e):a?encodeURIComponent(n(a))+s+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function r(t,e){if(t.map)return t.map(e);for(var s=[],n=0;n<t.length;n++)s.push(e(t[n],n));return s}var o=Object.keys||function(t){var e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s);return e}},function(t,e,s){const{parseURL:n}=s(1),i=s(0),r=s(3),o=s(2);t.exports=class{constructor(t,e){this.youtube=t,Object.defineProperty(this,"youtube",{enumerable:!1}),this.type="playlist",this.videos=[],this._patch(e)}_patch(t){if(t){switch(this.raw=t,this.channel=new o(this.youtube,t),t.kind){case i.KINDS.SearchResult:if(t.id.kind!==i.KINDS.Playlist)throw new Error("Attempted to make a playlist out of a non-playlist search result.");this.id=t.id.playlistId;break;case i.KINDS.Playlist:this.id=t.id;break;case i.KINDS.PlaylistItem:if(!t.snippet)throw new Error("Attempted to make a playlist out of a resource with no playlist data.");return this.id=t.snippet.playlistId,this;default:throw new Error(`Unknown playlist kind: ${t.kind}.`)}return t.snippet&&(this.title=t.snippet.title,this.description=t.snippet.description,this.publishedAt=new Date(t.snippet.publishedAt),this.thumbnails=t.snippet.thumbnails,this.channelTitle=t.snippet.channelTitle,this.defaultLanguage=t.snippet.defaultLanguage,this.localized=t.snippet.localized),t.status&&(this.privacy=t.status.privacyStatus),t.contentDetails&&(this.length=t.contentDetails.itemCount),t.player&&(this.embedHTML=t.player.embedHtml),this}}get url(){return`https://www.youtube.com/playlist?list=${this.id}`}fetch(t){return this.youtube.request.getPlaylist(this.id,t).then(this._patch.bind(this))}getVideos(t,e){return this.youtube.request.getPaginated(i.ENDPOINTS.PlaylistItems,t,Object.assign({playlistId:this.id,part:i.PARTS.PlaylistItems},e)).then(t=>this.videos=t.map(t=>new r(this.youtube,t)))}static extractID(t){return n(t).playlist}}}])});