define([],function(){"use strict";function addUniquePlaylistItemId(item){item.PlaylistItemId||(item.PlaylistItemId="playlistItem"+currentId,currentId++)}function findPlaylistIndex(playlistItemId,list){for(var i=0,length=list.length;i=playlist.length)throw new Error("newIndex out of bounds");return moveInArray(playlist,oldIndex,newIndex),this._playlist=playlist,{result:"moved",playlistItemId:playlistItemId,newIndex:newIndex}},PlayQueueManager.prototype.reset=function(){this._playlist=[],this._currentPlaylistItemId=null,this._repeatMode="RepeatNone"},PlayQueueManager.prototype.setRepeatMode=function(value){this._repeatMode=value},PlayQueueManager.prototype.getRepeatMode=function(){return this._repeatMode},PlayQueueManager.prototype.getNextItemInfo=function(){var newIndex,playlist=this.getPlaylist(),playlistLength=playlist.length;switch(this.getRepeatMode()){case"RepeatOne":newIndex=this.getCurrentPlaylistIndex();break;case"RepeatAll":newIndex=this.getCurrentPlaylistIndex()+1,newIndex>=playlistLength&&(newIndex=0);break;default:newIndex=this.getCurrentPlaylistIndex()+1}if(newIndex<0||newIndex>=playlistLength)return null;var item=playlist[newIndex];return item?{item:item,index:newIndex}:null},PlayQueueManager});