define("jquery",[],function(){return window.jQuery});define("lodash",[],function(){return window._});define("backbone",[],function(){return window.Backbone});
define("images",[],function(){return{spinnerGray:"../img/spinners/55977-spinner-grey-opt.svg",spinningOrangeRing:"../img/spinners/aaba9-spinning-orange-ring-2.gif",spinningOrangeRingMobile:"../img/spinners/23290-spinning-orange-ring-mobile.gif",primeSash:"../img/music/08b4c-prime-sash.png",oobeSprite:"../img/sprites/7895e-sprite-oobe.png",weatherSprite:"../img/sprites/0b956-sprite-weather.png",logoSprite:"../img/sprites/9e179-logo-sprite.svg",weatherSunny:"../img/weather/large/975cb-01.png",weatherPartlyCloudy:"../img/weather/large/b9c1e-02.png",
weatherCloudy:"../img/weather/large/8b2e2-03.png",weatherRainy:"../img/weather/large/a28e8-04.png",weatherCloudyRainy:"../img/weather/large/55122-05.png",weatherSnowy:"../img/weather/large/1c58e-06.png",weatherStormy:"../img/weather/large/32441-07.png",weatherNight:"../img/weather/large/2bd69-10.png",weatherPartlyCloudyNight:"../img/weather/large/ae98a-11.png",weatherCloudyNight:"../img/weather/large/034ea-12.png",weatherRainyNight:"../img/weather/large/e1687-13.png",weatherCloudyRainyNight:"../img/weather/large/6f380-14.png",
weatherSnowyNight:"../img/weather/large/41ea6-15.png",weatherStormyNight:"../img/weather/large/cf6c3-16.png",weatherWindy:"../img/weather/large/a9f4d-17.png",apLogo:"../img/music/AP_logo_180px.png",apLogoMedium:"../img/music/AP_logo_270px.png",cloudPlayer:"../img/placeholder/Music__CloudPlayer_180px.png",cloudPlayerMedium:"../img/placeholder/Music__CloudPlayer_270px.png",ihr:"../img/placeholder/Music__ihr_180px.png",ihrMedium:"../img/placeholder/Music__ihr_270px.png",tuneIn:"../img/placeholder/Music__Tunein_180px.png",
tuneInMedium:"../img/placeholder/Music__Tunein_270px.png",noArtworkSmall:"../img/placeholder/Music__No_Album_48px.png"}});
define("utils/log",["lodash"],function(f){var g=function(a,c){this.currentLevel<=c&&(a==="debug"&&(a="log"),window.console&&typeof console[a]==="function"&&console[a].apply(console,f.rest(arguments,2)))},b={LEVELS:["debug","info","warn","error","none"],currentLevel:0,setLevel:function(a){a=this.LEVELS.indexOf(a);a>=0?this.currentLevel=a:this.error("Log usage error: tried to set invalid log level. Valid levels: ",this.LEVELS.join(", "))},getLevel:function(){return this.LEVELS[this.currentLevel]}};
f.each(b.LEVELS,function(a,c){this[a]=f.bind(g,this,a,c)},b);return b});
define("utils/fetchable",["lodash","utils/log"],function(f,g){return{extendFrom:function(b){return b.extend({expires:-1,constructor:function(){b.apply(this,arguments);this._isExpired=this.hasSynced=!1;this.listenTo(this,"sync",this._onSync)},fetch:function(a){a||(a={});var c=this;a.force||a.reset||!this._isFetching&&this._isDataExpired(a.maxAge)?(this._isFetching=!0,this._fetchPromise=b.prototype.fetch.apply(this,arguments),this._fetchPromise.done(function(){c._isExpired=!1}),this._fetchPromise.always(function(){c._isFetching=
!1})):this._fetchPromise?this._attachCallbacks(a):g.error("Attempted fetch when no previous fetch promise exists, but data is not expired. Consider using the force.");return this._fetchPromise},expire:function(){this._isExpired=!0},_attachCallbacks:function(a){a||(a={});var c=this;a.success&&this._fetchPromise.done(function(b){a.success(c,b,a)});a.error&&this._fetchPromise.fail(function(b,e,h){a.error(c,h,a)})},_isDataExpired:function(a){var c;if(this._isExpired)return!0;a||(a=this.expires);c=!0;
this.hasSynced&&(c=a!==-1&&Date.now()-this._lastSynced>a);return c},_onSync:function(){if(this._fetchPromise)this.hasSynced=!0,this._lastSynced=Date.now()},fetchAllDependencies:function(){var a=new $.Deferred,c=[];arguments.length>0?(f.each(arguments,function(a){c.push(a.fetch())}),$.when.apply(null,c).done(a.resolve).fail(a.reject)):a.resolve();return a.promise()}})}}});define("models/base-model",["backbone","utils/fetchable"],function(f,g){return g.extendFrom(f.Model).extend({},{NAME:"BaseModel"})});
define("utils/scope",["lodash"],function(f){return{_singletons:[],singleton:function(g){g=f.memoize(g);this._singletons.push(g);return g},resetSingletonCache:function(){f.each(this._singletons,function(g){f.each(g.cache,function(b){f.isFunction(b.stopListening)&&b.stopListening()});g.cache={}})}}});
define("models/stage-model",["models/base-model","utils/scope","utils/log"],function(f,g,b){var a=f.extend({defaults:{stage:null,local:!1,alpha:!1,beta:!1,gamma:!1,prod:!1},initialize:function(){var c=this._getDomain(),d=a.PROD;!c||c.indexOf("localhost")!==-1?d=a.LOCAL:c.indexOf("projectdee-ui.integ")!==-1||c.indexOf("projectdee-ui.aka")!==-1?d=a.BETA:c.indexOf("pre-prod")!==-1?d=a.PREPROD:c.indexOf("gamma")!==-1||c.indexOf("projectdee-ui-compat")!==-1?d=a.GAMMA:c.indexOf("guiana.amazon.com")!==-1||
c.indexOf("echo.amazon.com")!==-1||c.indexOf("pitangui.amazon.com")!==-1?d=a.PROD:c.indexOf("dev")!==-1||c.indexOf("desktop")!==-1||c.indexOf("integ")!==-1||c.indexOf("aka")!==-1?d=a.ALPHA:b.warn("unknown domain, defaulting to prod: "+c);this.set(d,!0);this.set("stage",d);(d===a.GAMMA||d===a.PREPROD)&&this.set(a.PROD,!0)},is:function(a){return!!this.get(a)},getApiUrl:function(){var c=this._getHostName();a.CDN_API_URL_MAP[c]?c=a.CDN_API_URL_MAP[c]:a.DEVELOPER_AKA_REGEX.test(c)&&(c=c.replace(a.DEVELOPER_AKA_REGEX,
"$1.integ.amazon.com"));return"https://"+c},getRegistrationUrl:function(){var c=a.REGISTRATION_URL_MAP[this.get("stage")];return c?"https://"+c:this.getApiUrl()},_getDomain:function(){return document.domain},_getHostName:function(){return window.location.host}},{NAME:"StageModel",LOCAL:"local",ALPHA:"alpha",BETA:"beta",GAMMA:"gamma",PREPROD:"pre-prod",PROD:"prod",DEVELOPER_AKA_REGEX:/([a-z0-9\-]*).aka.amazon.com/,CDN_API_URL_MAP:{"guiana.amazon.com":"pitangui.amazon.com","echo.amazon.com":"pitangui.amazon.com"},
REGISTRATION_URL_MAP:{alpha:"projectdee-ui-dev-registration.aka.amazon.com",beta:"projectdee-ui-registration.aka.amazon.com",gamma:"projectdee-ui-gamma-registration.aka.amazon.com","pre-prod":"projectdee-ui-pre-prod-registration.aka.amazon.com",prod:"guipitan.amazon.com"},getInstance:g.singleton(function(){return new a})});return a});
define("utils/user-agent",["lodash"],function(f){var g,b,a={IE:"IE",INTERNETEXPLORER:"IE",FIREFOX:"FIREFOX",IOS:"IOS",ANDROID:"ANDROID",GINGERBREAD:"ANDROID 2.3",ICS:"ANDROID 4.0",ICECREAMSANDWICH:"ANDROID 4.0",JELLYBEAN:"ANDROID 4.1",KITKAT:"ANDROID 4.4",SAFARI:"SAFARI",CHROME:"CHROME"},c="KFSAWA,KFSAWI,KFASWI,KFARWI,KFAPWA,KFAPWI,KFTHWA,KFTHWI".split(","),d={_clear:function(){b=g=null},_getUserAgent:function(){return navigator.userAgent},_getBrowser:function(a){if(a.match(/Trident/))return"IE";
else if(a.match(/Firefox/))return"FIREFOX";else if(a.match(/Android/)||a.match(/Silk/))return"ANDROID";else if(a.match(/iP(hone|od|ad)/))return"IOS";else if(a.match(/Chrome/))return"CHROME";else if(a.match(/Safari/)&&!a.match(/Mobile/))return"SAFARI"},_getVersion:function(a,c){var b;switch(c){case "ANDROID":b=a.match(/Android (\d+)\.(\d+)/);break;case "IOS":b=a.match(/OS (\d+)_(\d+)_?(\d+)?/);break;case "IE":b=a.match(/Trident\/(\d+)\.(\d+)/);b[1]=parseInt(b[1],10)+4;break;case "FIREFOX":b=a.match(/Firefox\/(\d+)\.(\d+)/);
break;case "CHROME":b=a.match(/Chrome\/(\d+)\.(\d+)/);break;case "SAFARI":b=a.match(/Version\/(\d+)\.(\d+)/)}return b?parseFloat(b[1]+"."+b[2]):0},_populateVariants:function(a){b={IPOD:/iPod/.test(a),IPHONE:/iPhone/.test(a),IPAD:/iPad/.test(a),KINDLE:/Amazon|Kindle|Silk/i.test(a),MOBILE:/Mobile/i.test(a),FIREPHONE:/\[MODEL=SD4930UR\]/.test(a),AMAZON:/\[MANUFACTURER=Amazon\]/.test(a)};b.ANDROID=b.KINDLE||f.has(g,"ANDROID")},_populateVersionMap:function(){if(!g){var a=d._getUserAgent(),c=d._getBrowser(a),
b=d._getVersion(a,c);d._populateVariants(a);g={};g[c]=b}},_sanitizeBrowser:function(c){c=c.toUpperCase().replace(/[^A-Z]/g,"");return a[c]},is:function(a){a||(a="");var c=f.last(a.split(" "))||"0",l=d._sanitizeBrowser(a),i;d._populateVersionMap();i=c[c.length-1];c=parseFloat(c);return(l=g[l])?i==="+"?l>=c:i==="-"?l<=c:c?l===c:!0:!!b[a.toUpperCase()]},any:function(){return f.some(arguments,d.is,d)},isFirstParty:function(){return this.is("Amazon")},isAutocastable:function(){var a,b;if(!this.isFirstParty())return!1;
(a=/\[MODEL=([a-zA-Z0-9 ]+)\]/.exec(this._getUserAgent()))&&(b=a[1]);return!(!b||!f.contains(c,b))},IE:a.IE,IOS:a.IOS,ANDROID:a.ANDROID,FIREFOX:a.FIREFOX,SAFARI:a.SAFARI,CHROME:a.CHROME};return d});
define("constants",["images","models/stage-model","utils/user-agent"],function(f,g,b){g=g.getInstance().getApiUrl();return{URL:g,URL_DEVICE:"http://192.168.11.1",URL_DEVICE_API:"http://192.168.11.1:8080/OOBE",URL_DEFAULT_ALBUM_ART:f.noArtwork,API_PREFIX:"/api",ID_RECENTLY_ADDED:"RECENTLY-ADDED-V0-OBJECTID",ID_PURCHASED:"PURCHASES-V0-OBJECTID",ID_IMPORTED:"IMPORTED-V0-OBJECTID",URL_UTTERANCE_BASE:g+"/api/utterance/audio/data",URL_UTTERANCE_SUFFIX:b.is("IE")?"&flv=true":"",UTTERANCE_CONTENT_TYPE:b.is("IE")?
"video/x-flv":"audio/wav",URL_TTS_BASE:g+"/api/tts/audio/data",KEY_FRAGMENT:"hash",KEY_SELECTED_DEVICE:"selectedDevice",KEY_DISTANCE_BETWEEN_DEVICE_AND_WALL:"distanceBetweenDeviceAndWall",KEY_IS_DEVICE_IN_CORNER:"isDeviceInCorner",TXT_DEVICE_NAME:"Echo",TXT_DEVICE_NAME_TITLE:"Echo",TXT_APP_NAME:"Echo app",TXT_APP_NAME_TITLE:"Echo App",TXT_SWITCH_ACTIVE_USER:"Switch Active User",TXT_LOG_IN:"Log In",TXT_LOG_OUT:"Log Out",TXT_ALL_SONGS:"All Songs",TXT_INVITE_INDEPENDENT:"Send E-mail Invitation",TXT_REGISTER_NEW_DEVICE:"Setup New",
TXT_REGISTER_DEVICE:"Next",TXT_INVITATION_PLEASE_WAIT:"Please Wait...",TXT_INVITATION_SENT_ACKNOWLEDGE:"OK",TXT_SEND_BETA_FEEDBACK:"Submit Feedback",TXT_NO_DEVICE_SELECTED:"No device is selected. Please select a device.",TXT_AUDIO_PLAYBACK_FAILED:"Unable to play content.",TXT_UPGRADED_AUDIO:"Upgraded Audio",TXT_CONNECT_DEVICE:"Please make sure this device is connected to Wi-Fi.",TXT_SAVE_FAILED:"Unable to save your to-do.",TXT_DELETE_FAILED:"Unable to delete your to-do.",TXT_UNDO_DELETE_FAILED:"Unable to undo deletion.",
TXT_ACTIVE_USER:"(Active User)",TXT_FORCE_WIFI_CONNECTION_ERROR:'Please make sure that this device is connected to the Doppler\'s Wi-Fi network starting with "DIRECT-dp-" and try again. Note that connecting to the Doppler\u2019s Wi-Fi network could take up to a minute on some devices.',TXT_NO_DEVICE_SETUP:"No device is set up.",TXT_NO_DEVICE_SETUP_LINK:"Click here to set up a device.",TXT_TODO_WHAT_DEVICE_HEARD:"Echo heard: ",MUSIC_HEADER_SIZE:257,MUSIC_GROW_PX:3E3,MUSIC_PRUNE_PX:7E3,
TXT_LAUNCH_SHOPPING_APP_FAILED:"Unable to launch the Amazon Shopping app.",TXT_DISAMBIGUATE_SHOPPING:"Did you mean to shop for something else?",TXT_DISAMBIGUATE_TODO:"Did you mean to create a different to-do?",TXT_INVALID_TODO:"To-do items cannot be empty.",TXT_INVALID_SHOPPING:"Shopping items cannot be empty.",TXT_PLAYER_TITLE:"Now Playing",TXT_QUEUE_TITLE:"Queue",TXT_HISTORICAL_QUEUE_TITLE:"Recently Played",URL_RETAIL_SEARCH:"http://www.amazon.com/s/?field-keywords=",URL_MANAGE_YOUR_DEVICES:"https://www.amazon.com/gp/digital/fiona/manage#manageDevices",
URL_DESKTOP_MP3_SEARCH:"http://www.amazon.com/s/?url=search-alias%3Ddigital-music&field-keywords=",URL_DESKTOP_MP3_DETAIL:"http://www.amazon.com/dp/",URL_DESKTOP_PRIME_SEARCH:"http://www.amazon.com/s/ref=DAT?rh=n%3A163856011%2Cp_27%3A{searchString}%2Cp_85%3A8755839011&bbn=163856011",URL_GREENPOINT_MP3_SEARCH:"https://www.amazon.com/gp/dmusic/device/mp3/store/search/",URL_GREENPOINT_MP3_DETAIL_TRACK:"https://www.amazon.com/gp/dmusic/device/mp3/store/track/",URL_GREENPOINT_MP3_DETAIL_ALBUM:"https://www.amazon.com/gp/dmusic/device/mp3/store/album/",
URL_GREENPOINT_MP3_DETAIL_ARTIST:"https://www.amazon.com/gp/dmusic/device/mp3/store/artist/",URL_PARAM_ROBIN_ONLY:"+robinOnly:1",URL_PARAM_ANDROID_BROWSER:"android_browser_alpha",URL_BING_SEARCH:"http://www.bing.com/search?pc=AMAZ&form=AMAZWB&q=",URL_PARAM_TODO_AUDIO_LINK_PREFIX:"/api/utterance/audio/data?id=",URL_ONE_CLICK_SETTINGS_PROD:"https://www.amazon.com/mn/dcw/myx/settings.html?route=updatePaymentSettings&ref_=kinw_drop_coun&ie=UTF8&client=deeca",URL_ONE_CLICK_SETTINGS_DEV:"https://development.amazon.com/mn/dcw/myx/settings.html?route=updatePaymentSettings&ref_=kinw_drop_coun&ie=UTF8&client=deeca",
URL_MANAGE_YOUR_HOUSEHOLD_PROD:"https://www.amazon.com/gp/dop/myh/manage.html",URL_MANAGE_YOUR_HOUSEHOLD_BETA:"https://development.amazon.com/gp/dop/myh/manage.html",URL_ADD_USER_TO_HOUSEHOLD_PROD:"https://www.amazon.com/gp/dop/myh/preinviteChecklist.html",URL_ADD_USER_TO_HOUSEHOLD_BETA:"https://development.amazon.com/gp/dop/myh/preinviteChecklist.html",URL_CS_LINK:"#help/node/201602230",REGEX_URL_ONE_CLICK_SETTINGS:"^https?://(www|development).amazon.com(/mn/dcw/myx|/gp/digital/fiona).*",REGEX_URL_MYH_HOUSEHOLDS:"^https?://(www|development).amazon.com/(myh|gp/dop/myh|alexasupport|gp/help).*",
REGEX_URL_TERMS_AND_CONDITIONS:"http://www.amazon.com/gp/help/customer/display.html.*",SP_CLOUD_PLAYER:"CLOUD_PLAYER",SP_AMAZON_MUSIC:"AMAZON_MUSIC",SP_IHEART:"I_HEART_RADIO",SP_TUNE_IN:"TUNE_IN",DOPPLER_DEVICE_TYPE_GROUP:"device",ALEXA_DEVICE_TYPE_GROUP:"app"}});
define("models/platform-model",["jquery","lodash","models/base-model","utils/scope","utils/user-agent"],function(f,g,b,a,c){var d=b.extend({defaults:{cssTransitions:!1,html5Audio:!1,nativeAudio:!1,touch:!1,timeInput:!1,purchasing:!1,largeDOM:!1,screenHeight:0,screenWidth:0,nativeFeatures:!1,overflowScrolling:!1},initialize:function(){var a=this;this.set("cssTransitions",!c.is("Android 2.3-"));this.set("html5Audio",!c.is("Android"));this.set("nativeAudio",c.is("Android"));this.set("touch","ontouchstart"in
window);this.set("timeInput",f('').prop("type")==="time"&&!c.is("Android"));this.set("largeDOM",!c.any("iOS","Android"));this.set("screenHeight",function(){return screen.availHeight});this.set("screenWidth",function(){return screen.availWidth});this.set("nativeFeatures",function(){return/PitanguiBridge/.test(a._getUserAgent())});this.set("hardwareBack",this.supports("nativeFeatures")&&c.is("Android"));this.set("purchasing",function(){return!(c.is("iOS")&&a.get("nativeFeatures"))});
this.set("firstPartySso",c.is("AMAZON"));this.set("browserBack",!this.supports("nativeFeatures")&&!c.is("iOS 7+")&&!c.is("Safari 6+"));this.set("overflowScrolling",c.any("Chrome","Safari","Firefox","IE"));var b=!1;this._getWebSocket()&&this._getArrayBuffer()&&(b=!0,c.is("iOS")&&!c.is("iOS 6+")?b=!1:c.is("Android")&&!c.isFirstParty()&&c.is("Android 4.3-")?b=!1:/PhantomJS/.test(this._getUserAgent())&&(b=!1));this.set("html5WebSockets",b)},get:function(){var a=b.prototype.get.apply(this,arguments);return g.isFunction(a)?
a():a},supports:function(a){return!!this.get(a)},_getWebSocket:function(){return"WebSocket"in window},_getArrayBuffer:function(){return"ArrayBuffer"in window},_getUserAgent:function(){return navigator.userAgent}},{NAME:"PlatformModel",getInstance:a.singleton(function(){return new d})});return d});
define("utils/music-provider",["lodash"],function(f){var g=function(b,a,c){this.serviceName=b;this.displayText=a;this.affiliateTag=c;this.favoritesSupport={}};f.extend(g.prototype,{withFavoritesSupport:function(b){this.favoritesSupport=b;return this},equals:function(b){if(b)if(f.isString(b))return this.serviceName===b;else if(b.serviceName)return this.serviceName===b.serviceName;return!1}});f.extend(g,{DIGITAL_MUSIC_STORE:new g("DIGITAL_MUSIC_STORE","Digital Music Store","CLOUD_PLAYER_WEB"),CLOUD_PLAYER:new g("CLOUD_PLAYER",
"Amazon Music","CLOUD_PLAYER_WEB"),ROBIN:new g("ROBIN","Prime Music","CLOUD_PLAYER_WEB"),I_HEART_RADIO_LIVE:(new g("I_HEART_RADIO_LIVE","iHeartRadio","ihear0d7-20")).withFavoritesSupport({radioStation:!0}),I_HEART_RADIO_TALK:(new g("I_HEART_RADIO_TALK","iHeartRadio Talk Show","ihear0d7-20")).withFavoritesSupport({program:!0}),I_HEART_RADIO:(new g("I_HEART_RADIO","iHeartRadio","ihear0d7-20")).withFavoritesSupport({radioStation:!0}),TUNE_IN:(new g("TUNE_IN","TuneIn","radi0d-20")).withFavoritesSupport({radioStation:!0,
program:!0})});f.extend(g,{getProviderForService:function(b){return b&&g[b]||{}},canShopFor:function(b,a){return a!=="PODCASTS"&&b!==g.TUNE_IN.service}});return g});
define("utils/local-storage",["utils/log"],function(f){var g={},b={setItem:function(a,b){g[a]=b},getItem:function(a){return g[a]},removeItem:function(a){delete g[a]},clear:function(){g={}}},a={_mockLocalStorage:function(){this._localStorageImpl=b},setItem:function(a,b){try{this._localStorageImpl.setItem(a,JSON.stringify(b))}catch(e){f.error("could not save "+a+": "+b+" to local storage"),this._mockLocalStorage(),this.setItem(a,b)}},getItem:function(a){var b=this._localStorageImpl.getItem(a);try{if(b)return JSON.parse(b)}catch(e){return f.error("could not get "+
a+" from local storage"),this._mockLocalStorage(),this.getItem(a)}},removeItem:function(a){this._localStorageImpl.removeItem(a)},clear:function(){this._localStorageImpl.clear()}};a._localStorageImpl=window.localStorage;return a});
define("utils/metrics",["jquery","lodash","utils/log","constants","utils/local-storage"],function(f,g,b,a,c){var d=function(){g.bindAll(this,"_sendMetricsSuccess","_sendMetricsError");this.metricsMap={};this.metrics=c.getItem("metrics")||[];this.listeners=[]};g.extend(d.prototype,{clearMetrics:function(){this.metrics=[]},start:function(a){var c=Date.now()+""+Math.random();a.name?(a.start=Date.now(),this.metricsMap[c]=a):b.error("metric name must be provided");return c},stop:function(a){var c=this.metricsMap[a];
c?(delete this.metricsMap[a],this.batchMetric({operation:c.name,type:"TIME",value:Date.now()-c.start})):b.error('could not find metric with UID: "'+a+'"')},logMetric:function(a,c,b){!f.isNumeric(b)&&a==="COUNT"&&(b=1);this.batchMetric({operation:c,type:a,value:b})},isInBatch:function(a,c){return!!g.findWhere(this.metrics,{operation:c,type:a})},batchMetric:function(a){this.metrics.push(a);c.setItem("metrics",this.metrics);if(this.metrics.length>=50){if(this.sendMetricsTimerId)clearTimeout(this.sendMetricsTimerId),
this.sendMetricsTimerId=null;this.sendMetrics()}else if(!this.sendMetricsTimerId)this.sendMetricsTimerId=setTimeout(g.bind(function(){this.sendMetrics();this.sendMetricsTimerId=null},this),6E4)},sendMetrics:function(){var c={};if(this.metrics.length&&!this.isSendingMetrics)this.isSendingMetrics=!0,this.metricsLength=this.metrics.length,c={items:g.map(this.metrics,function(a){return{operation:a.operation,value:a.value?a.value.toString():null,type:a.type}})},f.ajax(a.URL+a.API_PREFIX+"/metrics-batch",
{type:"POST",contentType:"application/json; charset=utf-8",dataType:"text",data:JSON.stringify(c)}).done(this._sendMetricsSuccess).fail(this._sendMetricsError)},registerListener:function(a){this.listeners.push(a)},deregisterListener:function(a){this.listeners=g.without(this.listeners,a)},_sendMetricsSuccess:function(){this.metrics=this.metrics.slice(this.metricsLength);c.setItem("metrics",this.metrics);this.isSendingMetrics=!1;g.invoke(this.listeners,"onMetricsSent")},_sendMetricsError:function(){b.error("could not send metrics");
if(this.metrics.length>=100)b.error("metrics reached threshold, deleting all metrics"),this.metrics.length=0,c.setItem("metrics",this.metrics);this.isSendingMetrics=!1}});return new d});
define("utils/js-bridge","backbone,lodash,jquery,constants,utils/log,utils/user-agent,models/platform-model,utils/music-provider,utils/metrics".split(","),function(f,g,b,a,c,d,e,h,l){window.bridgeInitialized=new b.Deferred;window.nativeTargets||(window.nativeTargets={});var i={},j={},k=function(a){c.error(JSON.stringify(a))},n=function(){e.getInstance().supports("nativeFeatures")?(d.is("iOS")?window.cordova:window.NativeHost)?window.bridgeInitialized.resolve():setTimeout(n,200):window.bridgeInitialized.resolve()},
m=function(a){p.onRequestComplete(a)},o=null,q=function(){var a,c=0;for(a=NativeHost.pollJavaScriptResponse();a;)a=JSON.parse(a),setTimeout(m,0,a),c++,a=NativeHost.pollJavaScriptResponse();o=g.keys(i).length>c?setTimeout(q,500):null},p={nativeCall:function(a,c,b){if(d.is("iOS"))window.cordova.exec(a,c,b);else if(d.is("Android"))b=JSON.stringify(b),window[a][c](b),o||(o=setTimeout(q,0));else throw Error("native bridge call made on unsupported platform");},onRequestComplete:function(a){var b,d;if(a)(b=
a.requestId)?(d=i[b])?(delete i[b],a.error===!0?d.reject(a.errorReason):d.resolve(a.response)):c.error("no deferred registered with requestId "+b):c.error("no requestId in response")},onWebAppReady:function(){c.debug("onWebAppReady");if(typeof NativeHost!=="undefined")NativeHost.onWebAppReady();else l.logMetric("TIME","ApplicationLoadTime",Date.now()-window.applicationStartTime)},registerWebTarget:function(a){j[a]={}},registerWebTargetMethod:function(a,c){var b;for(b=0;b=0?(i[o]=p,q.nativeCall(l,m,f)):n&&n[m]?(n[m](f),p.resolve()):(c.error('message to method "'+m+'" on target "'+l+'" could not be sent'),p.reject())});return p.promise()}};n();return p});
define("models/app-diagnostics-model",["models/base-model","utils/scope"],function(f,g){var b=f.extend({defaults:{maxRetention:12,ignorePaths:/^\/api\/metrics/},initialize:function(){this.set("entries",[])},addEntry:function(a){var c=this.get("entries"),a=a||{};this.get("ignorePaths").test(a.url)||(c.unshift(a),c.length>this.get("maxRetention")&&c.pop(),this.trigger("change:entries"))}},{NAME:"AppDiagnosticsModel",getInstance:g.singleton(function(){return new b})});return b});define("thrift",[],function(){return window.Thrift});
define("oobe-types",[],function(){return window.OOBE});
define("utils/retry-helper",["lodash","utils/log"],function(f,g){return{callWithRetries:function(b,a){return!b?$.Deferred().reject().promise():this.wrapWithRetries(b)(a)},wrapWithRetries:f.partialRight(f.wrap,function(b){function a(){h++;h>j||o?e.reject.apply(l,arguments):q=b.apply(l,d).done(function(){!f.isFunction(n)||n.apply(l,arguments)?(g.info("Successful response on try "+h),e.resolve.apply(l,arguments)):(g.error("Failed to get successful response on try "+h),!f.isFunction(k)||k.apply(l,arguments)?
c.apply(l,arguments):e.reject.apply(l,arguments))}).fail(function(){g.error("Failed to get successful response on try "+h);c.apply(l,arguments)})}function c(){var c;m&&h>=1?(c=Array.prototype.slice.call(arguments),p=setTimeout(function(){a.apply(l,c)},m)):a.apply(l,arguments)}var d=Array.prototype.slice.call(arguments,1),e=new $.Deferred,h=0,l=this,i=d.pop(),j=i.maxRetries||1,k=i.successIsRetriable,n=i.isSuccessful,m=i.delay,o=!1,q,p;e.promise().abort=function(){o=!0;f.result(q,"abort");clearTimeout(p);
e.reject()};c();return e.promise()})}});
define("doppler-oobe-client","constants,thrift,oobe-types,lodash,utils/log,utils/retry-helper".split(","),function(f,g,b,a,c,d){var f=new g.Transport(f.URL_DEVICE_API),g=new g.Protocol(f),e=new b.DopplerOOBEClient(g);a(e).functions().filter(function(a){return a.indexOf("recv_")!==0&&a.indexOf("send_")!==0}).each(function(b){e[b]=a.wrap(e[b],function(d){var f=Array.prototype.slice.call(arguments,1),j=d.length;if(f.length").parent(),b.highlightClass=e.highlightClass,b.key=e.key,a.data("deeErrorHighlight",b),a.on("deeError.deeErrorHighlight",{key:e.key},function(){c.refresh.call(f(this))})})},destroy:function(){return this.unwrap().off("deeError.deeErrorHighlight")},
refresh:function(){return this.each(function(){var a=f(this).data("deeErrorHighlight");a&&(b.get(a.key).length?a.wrapper.addClass(a.highlightClass):a.wrapper.removeClass(a.highlightClass))})}};f.fn.deeErrorHighlight=function(a){if(c[a])return c[a].apply(this,Array.prototype.slice.call(arguments,1));else if(typeof a==="object"||!a)return c.init.apply(this,arguments);else g.error("Method "+a+" does not exist on jQuery.deeErrorHighlight")}});
define("views/plugins/dee-error-special-event",["jquery","utils/error","utils/log"],function(f,g,b){var a={};g.on("all",function(c,b){var e=a[c];e&&e.trigger("deeError",b)});f.event.special.deeError={add:function(c){(c=c.data.key)?a[c]=f(this).add(a[c]):b.error("Key is required to bind to ","deeError")},remove:function(c){if(c=c.data.key)a[c]=f(a[c]).not(this),a[c].length===0&&delete a[c]}}});
define("views/plugins/true-slide",["jquery","utils/log"],function(f,g){f.fn.trueSlideDown=function(b){b=b||{};return this.each(function(){var a=f(this),c=f(this).outerHeight(),d=b.top||a.css("top");c?(a.css("top",-c+"px"),a.show(),a.animate({top:d},b)):g.warn("tried to slide an element with no height (is element in the DOM?)")})};f.fn.trueSlideUp=function(b){b=b||{};return this.each(function(){var a=f(this),c=f(this).outerHeight(),d=b.top||a.css("top"),e=b.complete||function(){};b.complete=function(){a.hide();
a.css("top",d);e()};a.animate({top:-c+"px"},b)})}});
define("views/plugins/translate",["jquery"],function(f){var g=function(b,a){return b.css({transform:a,"-o-transform":a,"-moz-transform":a,"-webkit-transform":a})};f.fn.translate3d=function(b,a,c){return g(this,"translate3d("+b+"px, "+a+"px, "+c+"px)")};f.fn.translate=function(b,a){return g(this,"translate("+b+"px, "+a+"px)")};f.fn.translateX=function(b){return g(this,"translateX("+b+"px)")};f.fn.translateY=function(b){return g(this,"translateY("+b+"px)")}});
define("views/plugins/infinite",["jquery"],function(f){var g=function(b,a){this.$el=b;this.options=a||{}};g.prototype={_initialize:function(b){var a=f(document).height(),c=b.overflow,d=b.growPx||a*4,e=b.headGrowPx||d,d=b.tailGrowPx||d,h=b.prunePx||a*7,l=b.headPrunePx||h,h=b.tailPrunePx||h;(!b.getSegment||!b.purgeSegment)&&f.error("jQuery.infiniteScroller requires both getSegment and purgeSegment");this.getSegment=b.getSegment;this.purgeSegment=b.purgeSegment;this.scrollBy=b.scrollBy;this.prune=b.prune;
this.maxErrorRetries=b.maxErrorRetries||5;this.currentErrorRetries=0;this.isScrolling=this.isRequestingSegments=!1;this.previousHeadDistance=0;this._addSegmentToDOM=c?this._addSegmentToDOMOverflow:this._addSegmentToDOMiScroll;this.head={isHead:!0,$spinner:null,$filler:null,$point:null,distance:0,growPx:c?e:b.headDOMOffset>=1?b.headDOMOffset:1,prunePx:l,needsMoreSegments:b.reversePagination!==!1,domOffset:b.headDOMOffset||0};this.tail={isHead:!1,$spinner:null,$filler:null,$point:null,distance:0,growPx:d,
prunePx:h,needsMoreSegments:b.forwardPagination!==!1,domOffset:-1*a+(b.tailDOMOffset||0)};this.$header=f("").addClass("inf-header");this.head.$filler=f("").addClass("inf-filler-head");this.head.$spinner=f("").addClass("inf-spinner-head").hide();this.head.$point=f("").addClass("inf-point-head");this.$container=f("").addClass("inf-container");this.tail.$point=f("").addClass("inf-point-tail");this.tail.$spinner=f("").addClass("inf-spinner-tail").hide();
this.tail.$filler=f("").addClass("inf-filler-tail");this.$footer=f("").addClass("inf-footer");this.$el.append(this.$header,this.head.$filler,this.head.$spinner,this.head.$point,this.$container,this.tail.$point,this.tail.$spinner,this.tail.$filler,this.$footer)},scroll:function(){this._scrollHandler();return this.$el},getContainer:function(){return this.$container},dispose:function(){this.$el.off();return this.$el.empty().removeData("infiniteScroller")},reset:function(){this.$el.empty();
this._initialize(this.options);return this.$el},computeDOMOffsetParameters:function(){this.head.domOffset=this.head.$point.offset().top;this.tail.domOffset=this.tail.$point.offset().top},append:function(b){this._manualAdd(this.tail,b);return this.$el},prepend:function(b){this._manualAdd(this.head,b);return this.$el},resetErrorCount:function(){this.currentErrorRetries=0},_scrollHandler:function(){var b,a;this.head.distance=b=this._computeDistance(this.head);this.tail.distance=this._computeDistance(this.tail);
b<=this.previousHeadDistance&&(this.prune&&(a=this._prune(this.tail)),a||(a=this._grow(this.head)));b>=this.previousHeadDistance&&(this.prune&&(a=this._prune(this.head)),a||this._grow(this.tail));this.previousHeadDistance=b},_manualAdd:function(b,a){this._addSegmentToDOM(b,a,{manual:!0})},_computeDistance:function(b){return(b.isHead?-1:1)*b.$point.offset().top+b.domOffset},_prune:function(b){if(b.distance<=b.prunePx||!this.$container[0].children.length)return!1;for(var a=b.isHead?"first":"last",c=
!0;b.distance>b.prunePx&&c;)c=this._remove(b,this.$container.children()[a]());return b.needsMoreSegments=!0},_remove:function(b,a){if(!a||!a.length)return!1;var c=a.height(),d=b.$filler.height();this.purgeSegment(a.detach(),b.isHead);d+=c;b.$filler.height(d);b.distance-=c;b.isHead?(this.previousHeadDistance-=c,this.$el.trigger("setScrollerParam",{param:"minScrollY",value:-d})):this.$el.trigger("setScrollerParam",{param:"maxScrollY",value:-d});return!0},_grow:function(b){if(b.distance>=b.growPx||!b.needsMoreSegments||
this.isRequestingSegments||this.currentErrorRetries>this.maxErrorRetries)return!1;var a=b.isHead,c=this;b.$spinner.removeClass("hidden").show();this.isRequestingSegments=!0;this.getSegment(a).done(function(a){a?(c.currentErrorRetries=0,c._addSegmentToDOM(b,a),c.$el.trigger("gotNewSegment")):(b.needsMoreSegments=!1,b.$spinner.hide(),c.$el.trigger("noMoreSegment"))}).fail(function(){c.currentErrorRetries++}).always(function(){c.isRequestingSegments=!1});return!0},_addSegmentToDOMiScroll:function(b,
a){var c=b.isHead,d=c?"prepend":"append",e=this.prune,h=0,l,f;e&&(h=b.$filler.height());l=this.$container.height();this.$container[d](a);d=this.$container.height()-l;b.$spinner.addClass("hidden");c&&!h&&this.scrollBy(-d);e&&(f=Math.max(h-d,0),b.$filler.height(f),b.distance+=d);c?(this.previousHeadDistance+=d,this.$el.trigger("setScrollerParam",{param:"minScrollY",value:-f})):this.$el.trigger("setScrollerParam",{param:"maxScrollY",value:-f})},_addSegmentToDOMOverflow:function(b,a,c){c||(c={});var d=
b.isHead,e=d?"prepend":"append",h,l=this.prune,f=0,g;l&&(f=b.$filler.height());d&&(c.manual&&this._computeDistance(b)>50?h=!0:c.manual||(h=!0));b.$spinner.addClass("hidden");h&&(g=this.$container.height());this.$container[e](a);if(l||h)a=this.$container.height()-g,l?(h=Math.max(f-a,0),b.$filler.height(h),b.distance+=a,f').prop("type")==="time"&&!g.is("Android"));f.set("ubidCookieName",c.getInstance().is("prod")?"ubid-main":"ubid-tacbus");f.set("identityCookieName",c.getInstance().is("prod")?"x-main":"x-tacbus");!c.getInstance().is("local")&&d.getInstance().supports("html5WebSockets")?f.set("tcomm",!0):e._canUse()?(a.debug("Attempting to use JSBridge to native code to emulate WebSocket API"),e._installBridgeCallbacks(),window.WebSocket=e,f.set("tcomm",!0)):f.set("tcomm",!1);f.set("mouseEvents",
function(){var a=d.getInstance().supports("touch");return{vmousedown:a?"touchstart":"mousedown",vmousemove:a?"touchmove":"mousemove",vmouseup:a?"touchend":"mouseup",vmouseout:a?"touchcancel":"mouseout"}}());f.set("mutationObserver",function(){var a;return{constructor:window.MutationObserver||window.WebKitMutationObserver||function(){this.observe=this.disconnect=function(){}}}}());f.set("applicationCache",function(){var a=function(){};return"applicationCache"in window?applicationCache:{reload:a,update:a,
swapCache:a,addEventListener:a}}());return f});
define("utils/native-local-storage",["utils/js-bridge","utils/log"],function(f,g){return{setItem:function(b,a){f.postMessage({target:"NativeLocalStorage",method:"setItem",parameters:{key:b,value:JSON.stringify(a)}},function(){},function(){g.error("Unable to store data for key "+b+" into the native local data store.")})},getItem:function(b){var a=new $.Deferred;f.postMessage({target:"NativeLocalStorage",method:"getItem",parameters:{key:b}},function(c){c||(c={});a.resolve(c.value)});return a.promise()},
clear:function(){var b=new $.Deferred;f.postMessage({target:"NativeLocalStorage",method:"clear"},function(){b.resolve()});return b.promise()}}});
define("models/authentication-model","jquery,lodash,backbone,constants,app-oracle,models/base-model,models/companion-app-online-model,utils/js-bridge,utils/log,utils/native-local-storage,utils/scope,utils/retry-helper".split(","),function(f,g,b,a,c,d,e,h,l,i,j,k){var n=d.extend({defaults:{authenticated:!1,customerId:null,customerName:null,customerEmail:null,canAccessPrimeMusicContent:!1},deviceType:function(a){return a.manufacturer==="Amazon"?"AMAZON":a.manufacturer==="Apple"?a.model:"ANDROID"},url:a.URL+
"/api/authentication",initialize:function(){var c,d,l;d=function(c){var b=this;c&&!c.registered&&k.callWithRetries(function(){return f.ajax(a.URL+"/api/devices/"+a.ALEXA_DEVICE_TYPE_GROUP,{type:"POST",dataType:"json",contentType:"application/json; charset=UTF-8",data:JSON.stringify({registrationId:c.serial,deviceType:b.deviceType(c)})}).done(function(){h.postMessage({target:"AppInfo",method:"setDeviceRegistered",parameters:{registered:!0}})})},{maxRetries:3,delay:n.RETRY_INTERVAL})};c=10;l=g.bind(function(){c<
1||(c-=1,h.postMessage({target:"AppInfo",method:"getDeviceInfo"},g.bind(d,this),function(){g.delay(g.bind(l,this),1E3)}))},this);this.on("change:authenticated",function(a,c){c?l():localStorage.clear()});this.listenTo(b.history,"route",this.onRoute);f(window).focus(g.bind(this.onRoute,this));this.listenTo(e.getInstance(),"change:connectedToCloud",this.revalidateCurrentIdentity)},onRoute:function(){var a,b=document.cookie.match(RegExp(c.get("identityCookieName")+"=([^;]+)"));b&&(a=b[1]);this.previousIdentityCookie&&
this.previousIdentityCookie!==a&&this.revalidateCurrentIdentity();if(a)this.previousIdentityCookie=a},revalidateCurrentIdentity:function(){var c=this.get("customerId"),b=this;e.getInstance().get("connectedToCloud")&&this.fetch({force:!0}).done(function(d){var e=!!c,d=d.customerId!==c;(!b.startedInOOBE||e)&&d&&window.location.replace(a.URL+"/login")})},getText:function(){return this.get("authenticated")?a.TXT_SIGN_OUT:a.TXT_SIGN_IN},signOut:function(){b.trigger("showWaitView",{displayText:"Logging out..."});
var c=this,d=function(){h.postMessage({target:"AccountManager",method:"signOut"},function(){c.set("authenticated",!1)},function(a){l.error(a);b.trigger("dismissWaitView")})};i.clear().done(function(){h.postMessage({target:"AppInfo",method:"getDeviceInfo"},function(b){b?(b=a.URL+"/api/devices/"+a.ALEXA_DEVICE_TYPE_GROUP+"/"+b.serial+"?deviceType="+c.deviceType(b),f.ajax(b,{type:"DELETE",dataType:"json",contentType:"application/json; charset=UTF-8",timeout:1E3}).always(d)):d()},d)})}},{NAME:"AuthenticationModel",
RETRY_INTERVAL:1E3,getInstance:j.singleton(function(){return new n})});return n});
define("jquery-overrides","lodash,jquery,backbone,models/app-diagnostics-model,models/companion-app-online-model,models/authentication-model,utils/log,utils/user-agent,app-oracle,constants".split(","),function(f,g,b,a,c,d,e,h,l,i){var j={_beforeSend:function(a,c){if((!c||!(c.url&&c.url.indexOf(i.URL_DEVICE_API)===0))&&c.type!=="GET"){var b=j._getCookies().match(/csrf=([\-0-9]+)/);b&&a.setRequestHeader("csrf",b[1])}},_isInOOBE:function(){if(b.History.started)return b.history.fragment.indexOf("oobe")===
0},_ajaxError:function(a,b,d,e){if(b.status===0&&(a=c.getInstance(),a.is("connectedToCloud")&&!(e==="abort"||j._isInOOBE())))d||(d={}),d.url||(d.url=""),d.url.indexOf(i.URL_DEVICE)===-1&&a.pingCloudUntilSuccess({interval:1E4})},_getCookies:function(){return document.cookie},_getLocation:function(){return window.location},_getEndpointUrl:function(){return i.URL},_onAuthenticationFailed:function(a){a=a.getResponseHeader("loginUrl");e.debug("401 response received. Login url from header: "+a);j._getLocation().replace(a||
j._getEndpointUrl()+"/login")},_existentialCrisisHandler:function(){d.getInstance().revalidateCurrentIdentity()},overrideAll:function(){var c=a.getInstance(),b=f.once(j._onAuthenticationFailed),d;g.ajaxPrefilter(function(a){a||(a={});if(a.url.lastIndexOf(i.URL_DEVICE,0)===0)if(a.timeout||(a.timeout=4E4),a.data==='[1,"ping",1,0,{}]')a.timeout=12E3;else{if(a.data==='[1,"setupComplete",1,0,{}]')a.timeout=2E3}else a.xhrFields={withCredentials:!0}});d={cache:!1,statusCode:{401:b,403:j._existentialCrisisHandler,
406:function(a){if(a.getResponseHeader("x-amzn-dat-gui-client-upgrade")&&(a=l.get("applicationCache")))try{window.forceUpgrade=!0,a.update()}catch(c){e.debug("Client is out of date, but no application cache to update. Should reload.")}}},beforeSend:j._beforeSend};h.is("IE 10")&&(d.statusCode[400]=function(a){a.getResponseHeader("loginUrl")&&b(a)});g.ajaxSetup(d);g(document).ajaxComplete(function(a,b){c.addEntry({url:this.url,"x-amzn-RequestId":b.getResponseHeader("x-amzn-RequestId"),Date:b.getResponseHeader("Date")})});
g(document).ajaxError(j._ajaxError);g(document).on("dragstart",function(){return!1})}};return j});
define("utils/browser-utils",["utils/user-agent"],function(f){var g={openWindowMobileSafari:function(b){var a=document.createElement("a"),c=document.createEvent("HTMLEvents");a.setAttribute("href",b);a.setAttribute("target","_blank");c.initEvent("click",!0,!0);a.dispatchEvent(c)},openWindowDefault:function(){window.open.apply(window,arguments)},redirectWindow:function(b){window.location.href=b},currentHref:function(){return window.location.href},currentUrl:function(){return this.currentHref().split("#")[0]}};
g.openWindow=f.is("iOS")&&window.navigator.standalone?g.openWindowMobileSafari:g.openWindowDefault;return g});
define("bridge-web-overrides","jquery,utils/js-bridge,constants,utils/browser-utils,utils/user-agent,models/authentication-model".split(","),function(f,g,b,a,c,d){return{registerAll:function(){var e=this;this.authenticationModel=d.getInstance();g.registerWebTarget("AccountManager");g.registerWebTargetMethod("AccountManager",[{name:"signOut",call:function(){a.redirectWindow(b.URL+"/logout")}},{name:"getAuthenticated",call:function(){e.authenticationModel.get("authenticated")}}]);g.registerWebTarget("AppInfo");
g.registerWebTargetMethod("AppInfo",[{name:"getDeviceInfo",call:f.noop}]);g.registerWebTarget("WifiBridge");g.registerWebTargetMethod("WifiBridge",[{name:"disconnectFromDoppler",call:f.noop},{name:"getCurrentNetwork",call:f.noop},{name:"checkAutoNetworkSwitch",call:function(){return{isAutoNetworkSwitchEnabled:!1,autoNetworkSwitchSettingLabelName:null}}}]);g.registerWebTarget("ExternalUILauncherBridge");g.registerWebTargetMethod("ExternalUILauncherBridge",[{name:"launchExternalURL",call:function(c){a.openWindow(c.launchURL)}}]);
g.registerWebTarget("AppLauncherBridge");g.registerWebTargetMethod("AppLauncherBridge",[{name:"launchShoppingApp",call:function(c){a.openWindow(b.URL_RETAIL_SEARCH+encodeURIComponent(c.searchString))}},{name:"launchMp3StoreApp",call:function(d){var e,f=d.greenPointUrl;c.is("iOS")||c.is("Android")?d.affiliateId&&(e=f):(e=d.asinAvailable?b.URL_DESKTOP_MP3_DETAIL:b.URL_DESKTOP_MP3_SEARCH,d.searchString&&(e+=encodeURIComponent(d.searchString)),d.affiliateId&&(e+=e.indexOf(b.URL_DESKTOP_MP3_DETAIL)>=0?
"?":"&",e+="tag="+encodeURIComponent(d.affiliateId)));a.openWindow(e)}},{name:"launchRobinMP3StoreApp",call:function(d){var e=encodeURIComponent(d.searchString),f=encodeURIComponent(d.affiliateId);c.is("Android")?(d=b.URL_GREENPOINT_MP3_SEARCH,d+=e+b.URL_PARAM_ROBIN_ONLY,d+="?tag="+f+"&device="+b.URL_PARAM_ANDROID_BROWSER):(e=e.replace("%2C","%5Cc"),d=b.URL_DESKTOP_PRIME_SEARCH.replace("{searchString}",e));a.openWindow(d)}}]);g.registerWebTarget("NativeLocalStorage");g.registerWebTargetMethod("NativeLocalStorage",
[{name:"getItem",call:f.noop},{name:"setItem",call:f.noop},{name:"clear",call:f.noop}]);g.registerWebTarget("AppReload");g.registerWebTargetMethod("AppReload",[{name:"reload",call:function(){window.location.reload()}}])}}});
define("models/form-factor-model",["lodash","jquery","models/base-model","utils/scope","utils/user-agent"],function(f,g,b,a,c){var d=b.extend({defaults:{formFactor:"small",contentSize:"small",formFactorName:null},initialize:function(){var a=this;this.set("formFactorName",this._computeFormFactorName());this._onResize();this.listenTo(this,"resize",this._onResize);g(window).on("resize",f.debounce(function(){a.trigger("resize")},25))},_computeFormFactorName:function(){return c.is("FirePhone")?"Fire Phone":
c.is("Kindle")?"Kindle Fire":c.is("iPhone")?"iPhone":c.is("iPad")?"iPad":c.is("iPod")?"iPod":c.is("ANDROID")?c.is("Mobile")&&this.isPhoneSized()?"phone":"tablet":"computer"},isPhoneSized:function(){return this._getSmallestDimension()<600},_getSmallestDimension:function(){return Math.min(window.innerWidth,window.innerHeight)},_computeFormFactor:function(){var a=this._getInnerWidth();if(a<640)return"small";else if(a<875)return a===this._getSmallestDimension()?"small":"medium";return"desktop"},_computeContentSize:function(){return this._getInnerWidth()<
640?"small":"large"},getFooterHeight:function(){return this._computeContentSize()==="small"?56:66},isSidebarCollapsible:function(){var a=this.get("formFactor");return a==="small"||a==="medium"},_getInnerWidth:function(){return window.innerWidth},_onResize:function(){this.set({formFactor:this._computeFormFactor(),contentSize:this._computeContentSize()})}},{NAME:"FormFactorModel",getInstance:a.singleton(function(){return new d})});return d});
define("router-manager","lodash,backbone,constants,models/companion-app-online-model,models/form-factor-model,utils/scope".split(","),function(f,g,b,a,c,d){var e="The "+b.TXT_APP_NAME+" is offline. Some functionality is disabled. Please check your Wi-Fi connection.",h=function(){this.currentRouter=null;this._messageId=f.uniqueId();f.bindAll(this,"updateRouter","upOneLevel","atTop","forceReEnter");this.companionApp=a.getInstance();this.listenTo(g.history,"preRoute",this.updateRouter);this.listenTo(c.getInstance(),
"change:formFactor",this.forceReEnter);this.listenTo(this.companionApp,"change:connectedToCloud",this._onConnectedToCloudChange)},b={getInstance:d.singleton(function(){return new h})};f.extend(h.prototype,{updateRouter:function(a){if(this.currentRouter!==a)this.currentRouter&&this.currentRouter.trigger("exit"),(this.currentRouter=a)&&this.currentRouter.trigger("enter"),this.companionApp.is("connectedToCloud")||this._showOfflineMessage()},forceReEnter:function(){this.currentRouter&&this.currentRouter.trigger("reEnter");
g.trigger("navigate.reload")},upOneLevel:function(){if(this.currentRouter&&f.isFunction(this.currentRouter.upOneLevel))return this.currentRouter.upOneLevel()},atTop:function(){return this.currentRouter&&f.isFunction(this.currentRouter.atTop)?this.currentRouter.atTop():!0},getCurrentFullRoute:function(){return this.currentRouter&&f.isFunction(this.currentRouter.getCurrentFullRoute)?this.currentRouter.getCurrentFullRoute():null},_showOfflineMessage:function(){var a=this.currentRouter||{};!this._messageDismissed&&
!a.hideAppOfflineMessage&&g.trigger("showMessage","",e,{id:this._messageId,disableAutoHide:!0,onDismissCallback:f.bind(function(){this._messageDismissed=!0},this)})},_onConnectedToCloudChange:function(a,c){var b=this.currentRouter||{};c?g.trigger("dismissMessage",this._messageId):(this._messageDismissed=!1,this._showOfflineMessage());b.hideAppOfflineMessage||this.forceReEnter()}});f.extend(h.prototype,g.Events);return b});
define("utils/local-storage-model-mixin",["jquery","lodash","backbone","models/platform-model"],function(f,g,b,a){return{sync:function(c,d,e){var h=this,l=new f.Deferred;b.sync(c,this,g.omit(e,"success","error")).done(function(a){d.unset("isUnsaved");e.success&&e.success(a);(c==="update"||c==="create"||c==="delete")&&g.result(h.collection,"saveToLocalStorage");l.resolve(a)}).fail(function(c){a.getInstance().supports("nativeFeatures")?(h._objectFailedToSave(),l.resolve(),e.success&&e.success()):(l.reject(c),
e.error&&e.error(c))}).always(function(){e.complete&&e.complete()});return l.promise()},_objectFailedToSave:function(){this.set("isUnsaved",!0);g.result(this.collection,"saveToLocalStorage")}}});
define("models/to-do-model",["models/base-model","constants","models/platform-model","utils/local-storage-model-mixin"],function(f,g,b,a){var c=f.extend(a).extend({idAttribute:"itemId",expires:0,urlRoot:g.URL+g.API_PREFIX+"/todos",defaults:{itemId:null,text:null,lastLocalUpdatedDate:null,lastUpdatedDate:null,createdDate:null,utteranceId:null,nbestItems:null,type:null,complete:!1,version:null,deleted:!1},initialize:function(){this.get("type")||this.set({type:c.TODO_TYPE_TASK});this.get("createdDate")||
this.set("createdDate",Date.now());this.listenTo(this,"change",this.toDoHasChanged)},isShopping:function(){return this.get("type")===c.TODO_TYPE_SHOPPING},checkValid:function(){var a=this.get("text");return!(!a||!(a.length>0&&a.length<=c.TODO_LENGTH_LIMIT))},toDoHasChanged:function(a){a.changed.lastLocalUpdatedDate||this.set("lastLocalUpdatedDate",Date.now())},getToDoId:function(){return(this.id||"").split(c.KEY_SEPARATOR)[1]},isNewlyCreated:function(){var a=this.isNew();b.getInstance().supports("nativeFeatures")&&
(a=a&&!this.get("isUnsaved"));return a}},{NAME:"ToDoModel",TODO_TYPE_TASK:"TASK",TODO_TYPE_SHOPPING:"SHOPPING_ITEM",TODO_LENGTH_LIMIT:255,CREATE_TODO_INTENT:"CreateToDoIntent",FIND_ITEM_INTENT:"FindItemIntent",KEY_SEPARATOR:"#",isToDoIntent:function(a){return a===c.CREATE_TODO_INTENT||a===c.FIND_ITEM_INTENT}});return c});define("collections/base-collection",["backbone","utils/fetchable"],function(f,g){return g.extendFrom(f.Collection).extend({},{NAME:"BaseCollection"})});
define("utils/local-storage-collection-mixin","jquery,lodash,backbone,models/platform-model,models/companion-app-online-model,utils/native-local-storage,utils/log".split(","),function(f,g,b,a,c,d,e){return{initializeLocalStorage:function(a){this.localStorageKey=this.constructor.NAME;a&&(this.localStorageKey+="."+a);this.retrievalPromise=null;this.retrieveFromLocalStorage();this.refresh();this.listenTo(b,"onMobileAppResume",this.refresh);this.listenTo(c.getInstance(),"change:connectedToCloud",this.refresh)},
refresh:function(){var a=this;this.reconcileUnsavedObjects().done(function(){a.fetch({force:!0,reset:!0,disableLocalStorage:!0})})},retrieveFromLocalStorage:function(){var a=this;if(!this.localStorageKey)throw Error("Please make sure initializeLocalStorage() was called and the collection NAME is set.");this.retrievalPromise=d.getItem(this.localStorageKey).done(function(c){if(c)try{a.reset(JSON.parse(c))}catch(b){e.error("Could not parse Collection data from local storage.")}})},reconcileUnsavedObjects:function(){var a=
this;if(!this.retrievalPromise)throw Error("reconcileUnsavedObjects was called without calling initialize() first.");if(this.isReconciling)return e.warn("Attempting to re-enter reconcilation multiple times at once. This may cause objects to get duplicated on the server."),(new f.Deferred).resolve();this.isReconciling=!0;return f.when(this.retrievalPromise).then(function(){var c=a.filter(function(a){return a.get("isUnsaved")}),b=[];g.each(c,function(a){b.push(a.save())});return f.when.apply(f,b)}).always(function(){a.isReconciling=
!1})},saveToLocalStorage:function(){d.setItem(this.localStorageKey,this.toJSON())},sync:function(c,d,e){var j=this,k=new f.Deferred;b.sync(c,d,g.omit(e,"success","error")).done(function(a){k.resolve(a);e.success&&e.success(a)}).fail(function(){a.getInstance().supports("nativeFeatures")&&!e.disableLocalStorage?(k.resolve(),e.success&&e.success()):(k.reject(),e.error&&e.error())}).always(function(){e.complete&&e.complete();j.saveToLocalStorage()});return k.promise()}}});
define("collections/to-do-collection","lodash,constants,collections/base-collection,utils/local-storage-collection-mixin,models/to-do-model,utils/scope".split(","),function(f,g,b,a,c,d){var e=b.extend(a).extend({model:c,initialize:function(a,c){c||(c={});this.type=c.type;this.initializeLocalStorage(this.type)},comparator:function(a,c){var b=a.get("complete"),d=c.get("complete");return b!==d?b?1:-1:a.get("createdDate")=100&&(a="99+");return a},url:g.URL+g.API_PREFIX+"/todos"},{NAME:"ToDoCollection",
MAXIMUM_TODOS:100,getInstance:d.singleton(function(a){return new e([],{type:a})})});return e});define("tcomm",[],function(){return window.tcomm});
define("utils/ping",["jquery","lodash"],function(f,g){var b;b=function(a){this.url=a};g.extend(b.prototype,{ping:function(a){a=a||{};a.global=!1;return this.jqXHR=f.ajax(this.url,a)},pingUntilSuccess:function(a){var a=g.clone(a||{}),c=a.error,b=a.success;a.timeout=a.timeout||3E3;a.error=g.bind(this._pingError,this,a,b,c);a.success=function(c,h,l){!a.expectedResponse||l.responseText===a.expectedResponse?b(c,h,l):a.error(l,"unexpected response")};this.ping(a)},stopPinging:function(){if(this.autoRetryTimerId)clearTimeout(this.autoRetryTimerId),
this.autoRetryTimerId=null;this.jqXHR&&this.jqXHR.abort()},_pingError:function(a,c,b,e,h,l){navigator.onLine&&h!=="timeout"&&!a.expectedResponse?g.isFunction(c)&&c(h,h,e):(g.isFunction(b)&&b(e,h,l),this.stopPinging(),this.autoRetryTimerId=setTimeout(g.bind(function(){this.ping(a)},this),a.autoRetry||5E3))}});return b});
define("dee-website-messaging","lodash,backbone,tcomm,app-oracle,utils/log,utils/ping,utils/scope,constants,models/stage-model".split(","),function(f,g,b,a,c,d,e,h,l){var i=function(a){this.deviceType="ALEGCNGL9K0HM";this.connectionProperties=f.extend({secure:!0,direct:!1,reconnect:!0},a);this.reconnectDelay=1E3;this.ping=new d(h.URL+"/ping");f.bindAll(this,"onMessage","connectionOpened","connectionClosed","sendRegisterConnection","getNewConnection","reconnect")};i.prototype={generateUniqueSerial:function(){this.deviceSerial=
((document.cookie.match(RegExp(a.get("ubidCookieName")+"=([-0-9]+)"))||[])[1]||"Gxx-xxxxxxx-xxxxxxx".replace(/x/g,function(){return""+Math.floor(Math.random()*10)}))+"-"+Date.now()},initialize:function(){var a=b.IdentityFactory.getDeviceIdentity(this.deviceType,this.deviceSerial),a=new b.QueryParamDeviceIdRequestSigner(a),d=l.getInstance(),d=d.is("gamma")?"master":d.is("prod")?"prod":"test";try{b.CommunicationManager.initializeWithConfig({requestSigner:a,domain:d,realm:"USAmazon",shouldEnableGateway:!0})}catch(e){c.error("Caught error while initializing tcomm",
e)}finally{b.CommunicationManager.registerMessageHandler(b.Channels.DEE_WEBSITE_MESSAGING,this.onMessage)}this.listenTo(g,"onMobileAppResume",this.reconnect)},onMessage:function(a,b){var d,e,h;try{d=JSON.parse(b.getPayloadAsString()),e=d.command,h=JSON.parse(d.payload)}catch(l){c.error("Caught error while processing message",b,l)}try{this.trigger("message:"+e,h,e)}catch(f){c.error("Caught error while triggering message event "+e,f)}},getDestinationIdentity:function(){return b.IdentityFactory.getServiceIdentityFromName("DeeWebsiteMessagingService")},
getConnection:function(){return this.connection&&this.connection.getState()===b.Socket.States.OPEN?this.connection:null},reconnect:function(){var a=this;!this.connection&&this.connectionProperties.reconnect&&this.ping.ping({success:function(){c.debug("Network detected, attempting to connect DWMS");a.getNewConnection()},error:function(){c.debug("No network access detected! Skipping connection attempt for DWMS")},complete:function(){a.connection||a.requestReconnect()}})},closeConnection:function(){this.connectionProperties.reconnect=
!1;this.connection&&this.connection.release()},requestReconnect:function(){clearTimeout(this.nextReconnect);this.nextReconnect=f.delay(this.reconnect,this.reconnectDelay);this.updateDelay()},updateDelay:function(a){a?this.reconnectDelay=1E3:(a=(Math.random()-0.5)*1E3,a=this.reconnectDelay*2+a,this.reconnectDelay=Math.min(a,2E4))},getNewConnection:function(){var a,c,d=this;a=this.getDestinationIdentity();c=b.CommunicationManager.acquireConnection(a,d.connectionProperties.secure,d.connectionProperties.direct);
c.addOpenListener(function(){d.connectionOpened(c)});c.addCloseListener(function(){d.connectionClosed(c)})},connectionOpened:function(a){a!==this.connection&&this.connection&&this.connection.release();this.connection=a;try{this.sendRegisterConnection(),this.updateDelay(!0)}catch(c){this.connection&&this.connection.release();return}this.trigger("connection:ready",this.connection)},connectionClosed:function(a){if(a===this.connection)this.connection=null;this.trigger("connection:lost");this.requestReconnect()},
sendRegisterConnection:function(){var a,c;if(c=this.getConnection())a={command:"REGISTER_CONNECTION"},c.sendMessage(JSON.stringify(a),b.Channels.DEE_WEBSITE_MESSAGING);else throw Error("DeeWebsiteMessaging.sendRegisterConnection: no valid connection to send registration on");}};i.getInstance=e.singleton(function(){var c=new i;a.get("tcomm")&&(c.generateUniqueSerial(),c.initialize(),c.reconnect());return c});f.extend(i.prototype,g.Events);return i});
define("utils/poll-mixin",["lodash","app-oracle","dee-website-messaging"],function(f,g,b){var a={DEFAULT_INTERVAL:1E4,isPolling:function(){return!(!this.pollingRequestors||!this.pollingRequestors.length||this.usePush())},usePush:function(){return!(!this.pushOptions||!this.pushOptions.usePush||!this.getPushEventNames().length||!g.get("tcomm"))},getPushEventNames:function(){if(!this._pushEventNames)this._pushEventNames=f.map(this.pushOptions&&this.pushOptions.messageNames,function(a){return"message:"+
a});return this._pushEventNames},startPolling:function(a){var d,e;this.pollingRequestors=f.union(this.pollingRequestors||[],[a]);this.usePush()?(d=b.getInstance(),(e=d.getConnection())?(this.stopPolling(a),this.onConnectionReady(a,e)):this.listenToOnce(d,"connection:ready",f.partial(this.onConnectionReady,a,!0))):this._startPolling()},onConnectionReady:function(a,d,e){var h=b.getInstance();if(e||!this._hasDoneOneCatchUpFetch)this.fetch({force:!0,poll:!0}),this._hasDoneOneCatchUpFetch=!0;this.listenToOnce(h,
"connection:lost",f.partial(this.onConnectionLost,a));f.each(this.getPushEventNames(),function(a){this.stopListening(h,a,this.onPushMessage);this.listenTo(h,a,this.onPushMessage)},this)},onConnectionLost:function(a){f.each(this.getPushEventNames(),function(a){this.stopListening(b.getInstance(),a)},this);this.startPolling(a)},onPushMessage:function(a,b){this.trigger("pushMessage",a,b)},setPollingInterval:function(a){this.pollingInterval=a;this.isPolling()&&this._startPolling()},restartPolling:function(a){this.startPolling(a)},
_startPolling:function(){if(!this.pollingInterval&&this.pollingInterval!==0)this.pollingInterval=a.DEFAULT_INTERVAL;this._stopPolling();this.fetch({force:!0,poll:!0}).always(f.bind(this._pollComplete,this))},_pollComplete:function(){clearTimeout(this.pollingTimeoutId);if(this.isPolling())this.pollingTimeoutId=f.delay(f.bind(this._startPolling,this),this.pollingInterval)},_stopPolling:function(){this.pollingTimeoutId&&(clearTimeout(this.pollingTimeoutId),delete this.pollingTimeoutId)},stopPolling:function(a){this.pollingRequestors=
f.without(this.pollingRequestors||[],a);!this.pollingRequestors.length&&!this.usePush()&&this._stopPolling()}};return a});
define("utils/to-do-multiplexer","lodash,backbone,collections/to-do-collection,utils/poll-mixin,models/to-do-model,utils/log,utils/scope".split(","),function(f,g,b,a,c,d,e){var h=function(){this.pushOptions={usePush:!0,messageNames:["PUSH_TODO_CHANGE"]};this.taskCollection=b.getInstance(c.TODO_TYPE_TASK);this.shoppingCollection=b.getInstance(c.TODO_TYPE_SHOPPING);f.bindAll(this,"onPushTodo","onCollectionChange","getCount");this.listenTo(this,"pushMessage",this.onPushTodo);this.listenTo(this.taskCollection,
"all",this.onCollectionChange);this.listenTo(this.shoppingCollection,"all",this.onCollectionChange)};h.getInstance=e.singleton(function(){return new h});h.NAME="ToDoMultiplexer";h.prototype={onCollectionChange:function(){this.trigger.apply(this,arguments)},onPushTodo:function(a){var b=a.destinationUserId+"#"+a.toDoId,e=this.getByKey(a.destinationUserId,a.toDoId)||new c({itemId:b}),h=this;e.fetch({success:function(){var a=e.previousAttributes();a&&a.type!==e.get("type")&&h.remove(e);h.add(e)},error:function(a,
c){c.status===404?h.remove(a):d.error("todo-multiplexer: there was an error fetching a todo in response to a PUSH_TODO_CHANGE message with ID: "+b)}})},fetch:function(a){return $.when(this.taskCollection.fetch(a),this.shoppingCollection.fetch(a))},add:function(a){this.getCollectionForType(a.get("type")).add(a)},remove:function(a){this.taskCollection.remove(a);this.shoppingCollection.remove(a)},getCount:function(a){return this.getCollectionForType(a).getCount()},moveToOtherList:function(a){var b=a.isShopping()?
c.TODO_TYPE_TASK:c.TODO_TYPE_SHOPPING;a.set({type:b});a.collection.remove(a);this.add(a);return a.save()},getByKey:function(a,c){return this.taskCollection.getByKey(a,c)||this.shoppingCollection.getByKey(a,c)},getCollectionForType:function(a){switch(a){case c.TODO_TYPE_TASK:return this.taskCollection;case c.TODO_TYPE_SHOPPING:return this.shoppingCollection}}};f.extend(h.prototype,a,g.Events);return h});
define("utils/gesture-event-handler",["backbone","lodash","utils/log"],function(f,g,b){var a=function(){var a=this;if(window.GestureBridge)window.GestureBridge.fireGestureEvent=function(b,e){a.trigger("motiongesture"+b,{direction:e})},b.info("Found window.GestureBridge. Installing gesture event handler.")};a.getInstance=g.once(function(){return new a});a.prototype={onGestureEvent:function(a,d){b.debug("handling gesture event: "+a+" direction: "+d);this.trigger("motiongesture"+a,{direction:d})}};
g.extend(a.prototype,f.Events);return a});
define("models/sidebar-menu-model","lodash,backbone,models/base-model,models/to-do-model,router-manager,utils/to-do-multiplexer,utils/gesture-event-handler,utils/scope".split(","),function(f,g,b,a,c,d,e,h){var l=b.extend({defaults:{isOpen:!1,openOffset:0,title:"Alexa",selected:null,menuGroups:[{menuItems:[{id:"iHome",text:"Home",action:"navigate",route:"cards"}]},{headerText:"Reminders",menuItems:[{id:"iTodos",text:"To-do List",action:"navigate",route:"todos",count:function(){return d.getInstance().getCount(a.TODO_TYPE_TASK)}},
{id:"iShopping",text:"Shopping List",action:"navigate",route:"todos/shopping",count:function(){return d.getInstance().getCount(a.TODO_TYPE_SHOPPING)}},{id:"iTimers",text:"Timer",action:"navigate",route:"timers"},{id:"iAlarms",text:"Alarm",action:"navigate",route:"alarms"}]},{headerText:"Music",menuItems:[{id:"iPlayer",text:"Now Playing",action:"navigate",route:"player"},{id:"iAmazonCloudPlayer",text:"Amazon Music",action:"navigate",route:"music/AMAZON_MUSIC"},{id:"iHeartRadio",text:"iHeartRadio",
action:"navigate",route:"music/I_HEART_RADIO"},{id:"iTuneInRadio",text:"TuneIn",action:"navigate",route:"music/TUNE_IN"}]},{headerText:"Help & Feedback",menuItems:[{id:"iSettings",text:"Settings",action:"navigate",route:"settings"},{id:"iThingsToTry",text:"Things to Try",action:"navigate",route:"help/thingstotry"},{id:"iHelp",text:"Help",action:"navigate",route:"help"},{id:"iBeta-feedback",text:"General Feedback",action:"navigate",route:"beta-feedback"},{id:"iVoiceTraining",text:"Voice Training",
action:"navigate",route:"voicetraining"}]}]},initialize:function(){this.gestureEventHandler=e.getInstance();f.bindAll(this,"_onGesture");this.listenTo(g.history,"route",this.updateSelected);this.listenTo(this.gestureEventHandler,"motiongesturetilt",this._onGesture)},updateSelected:function(){var a=c.getInstance().getCurrentFullRoute(),b,d=0;a?(f.each(this.get("menuGroups"),function(c){f.each(c.menuItems,function(c){if(c.action==="navigate"&&c.route&&a.indexOf(c.route)===0&&d0},atTop:function(){return!a.getInstance().supports("browserBack")&&this.hasStack()?!1:b.getInstance().atTop()},registerCallback:function(a){this.navigationCallbacks.push(a)},onNavigate:function(a,c){c=f.extend({trigger:!0},
c);this.sidebarMenuModel.set("isOpen",!1);if(this.runNavigationCallbacks())c.clearStack?this.navigationStack.length=0:c.noStackPush||this.navigationStack.push(g.history.getFragment()),g.history.navigate(a,{trigger:c.trigger})},updateNativeAtTopValue:function(){d.postMessage({target:"NavigationBridge",method:"setAtTop",parameters:{isAtTop:this.atTop()}})},onNavigateReload:function(){g.history.loadUrl()},onNavigateRedirect:function(a,c){c=f.extend({trigger:!0,replace:!0},c);if(c.clearStack)this.navigationStack.length=
0;g.history.navigate(a,c)},runNavigationCallbacks:function(){var a=!0;f.each(this.navigationCallbacks,function(b){try{a=b()&&a}catch(d){c.error("NavigationHandler: navigationCallback failed with an error, skipping.",d)}});if(a)this.navigationCallbacks.length=0;return a}};return h});
define("backbone-overrides",["lodash","backbone","utils/user-agent","handlers/navigation-handler"],function(f,g,b,a){return{overrideAll:function(){if(b.is("Android 2.3-"))g.emulateHTTP=!0;this.overrideCheckUrl()},overrideCheckUrl:function(){var c=g.history.checkUrl;g.history.checkUrl=f.bind(function(b){var e=this.getFragment(),h=this.fragment;e===h&&this.iframe&&(e=this.getFragment(this.getHash(this.iframe)));if(e!==h)a.getInstance().runNavigationCallbacks()?c.apply(this,arguments):(this.fragment=
e,this.navigate(h,{trigger:!1}))},g.history)}}});define("fastclick",[],function(){return window.FastClick});define("models/customer-status-model",["models/base-model","constants","utils/scope"],function(f,g,b){var a=f.extend({url:g.URL+"/api/customer-status/",defaults:{eulaAcceptance:!1,hasActiveDopplers:!1},isFirstTime:function(){return!this.get("hasActiveDopplers")}},{NAME:"CustomerStatusModel",getInstance:b.singleton(function(){return new a})});return a});
define("utils/performance-metrics",["jquery","lodash","backbone","utils/log"],function(f,g,b,a){var c=function(){this.listenTo(b,"start:capturePerformanceMetrics",this.onStartCapture);this.listenTo(b,"stop:capturePerformanceMetrics",this.onStopCapture);this.viewRenderStartTimes={};this.viewNameRenderTotalTime={};this.viewNameRenderCount={};this.isMarkerMetricsOn=!1;this.endToEndViews=[]};c.getInstance=g.once(function(){return new c});c.prototype={onStartCapture:function(){this.startCaptureTransitionMetrics();
this.startCaptureRenderMetrics();this.startCaptureEndToEndMetrics();this.isMarkerMetricsOn=!0},onStopCapture:function(){this.stopCaptureRenderMetrics();this.stopCaptureTransitionMetrics();this.stopCaptureEndToEndMetrics();this.isMarkerMetricsOn=!1},startCaptureTransitionMetrics:function(){this.stopCaptureTransitionMetrics();this.listenTo(b.history,"preRoute",this.onPreRoute);this.listenTo(b.history,"route",this.onRoute)},stopCaptureTransitionMetrics:function(){this.stopListening(b.history,"preRoute",
this.onPreRoute);this.stopListening(b.history,"route",this.onRoute)},onPreRoute:function(){this.routeStartTime=Date.now()},onRoute:function(a,c){var b=this;g.defer(function(){b.reflow();b.emitTime("TRANSITION",c,Date.now()-b.routeStartTime)})},markEvent:function(a,c){var b=this;this.isMarkerMetricsOn&&g.defer(function(){b.reflow();b.emitMarker("MARKER",a,c)})},startCaptureRenderMetrics:function(){this.stopCaptureRenderMetrics();this.listenTo(this,"viewRenderStart",this.onViewRenderStart);this.listenTo(this,
"viewRenderEnd",this.onViewRenderEnd)},stopCaptureRenderMetrics:function(){this.stopListening(this,"viewRenderStart",this.onViewRenderStart);this.stopListening(this,"viewRenderEnd",this.onViewRenderEnd)},onViewRenderStart:function(c,b){!c||!b?a.error('view did not define class property "NAME" or does not have an ID, cannot record view render metric'):this.endToEndInProgress&&(this.endToEndViewsInProgress.push(b),this.viewRenderStartTimes[b]=Date.now())},onViewRenderEnd:function(a,c){var b=this,l=
this.viewRenderStartTimes[c];a&&c&&l&&(delete this.viewRenderStartTimes[c],g.defer(function(){var f=b.viewNameRenderTotalTime[a]||0,g=b.viewNameRenderCount[a]||0;b.reflow();b.viewNameRenderTotalTime[a]=f+(Date.now()-l);b.viewNameRenderCount[a]=g+1;b.endToEndInProgress&&(f=b.endToEndViewsInProgress.indexOf(c),f>=0&&b.endToEndViewsInProgress.splice(f,1))}))},startCaptureEndToEndMetrics:function(){this.listenTo(this,"viewFetchStart",this.onViewFetchStart);this.listenTo(this,"viewFetchEnd",this.onViewFetchEnd);
this.listenTo(b.history,"preRoute",this.startEndToEnd);this.listenTo(b.history,"route",this.checkAtRoute);this.listenTo(this,"viewRenderEnd",this.endEndToEnd)},stopCaptureEndToEndMetrics:function(){this.stopListening(this,"viewFetchStart",this.onViewFetchStart);this.stopListening(this,"viewFetchEnd",this.onViewFetchEnd);this.stopListening(b.history,"route",this.checkAtRoute);this.stopListening(b.history,"preRoute",this.startEndToEnd);this.stopListening(this,"viewRenderEnd",this.endEndToEnd)},startEndToEnd:function(){this.endToEndInProgress=
!0;this.endToEndViewRenderCount=0;this.endToEndStartTime=Date.now();this.endToEndViewsInProgress=[]},endEndToEnd:function(){var a=this;this.endToEndInProgress&&this.routeName&&g.defer(function(){if(a.endToEndInProgress&&g.isEmpty(a.endToEndViewsInProgress))a.reflow(),a.emitTime("E2E",a.routeName,Date.now()-a.endToEndStartTime),a.endToEndInProgress=!1,delete a.routeName,g.each(a.viewNameRenderCount,function(c,b){var l;c>0&&(l=a.viewNameRenderTotalTime[b],a.emitTime("RENDER",b,l+"/"+c),delete a.viewNameRenderTotalTime[b],
delete a.viewNameRenderCount[b])})})},checkAtRoute:function(a,c){this.routeName=c;this.endEndToEnd()},onViewFetchStart:function(a){a&&this.endToEndViewsInProgress&&this.endToEndViewsInProgress.push(a)},onViewFetchEnd:function(a){var c;a&&(this.endToEndViewsInProgress&&(c=this.endToEndViewsInProgress.indexOf(a)),c>=0&&this.endToEndViewsInProgress.splice(c,1))},reflow:function(){f(document).height()},emitTime:function(c,b,h){a.debug(c+"_METRIC:"+b+","+h)},emitMarker:function(c,b,h){a.debug(c+"_METRIC:"+
b);h&&(c=g.isString(h)?h:JSON.stringify(h),a.debug(c))}};g.extend(c.prototype,b.Events);return c});define("models/cardstream/card-model",["constants","models/base-model"],function(f,g){return g.extend({urlRoot:f.URL+f.API_PREFIX+"/cards",expires:0,defaults:{id:null,creationTimestamp:0,cardType:null,sourceDevice:null,registeredCustomerId:null}},{NAME:"CardModel"})});
define("collections/cardstream/card-collection","lodash,utils/log,collections/base-collection,models/cardstream/card-model,utils/poll-mixin,constants,utils/scope".split(","),function(f,g,b,a,c,d,e){var h=b.extend(c).extend({model:a,initialize:function(){this.inFlight={};this.pushOptions={usePush:!0,messageNames:["PUSH_ACTIVITY"]};this.listenTo(this,"pushMessage",this.onPushActivity)},comparator:function(a){return-(a.get("creationTimestamp")||0)},url:d.URL+d.API_PREFIX+"/cards",parse:function(a){return a.cards},
fetchMoreOldCards:function(a,c){return this.fetch({force:!0,success:a,error:c,data:{beforeCreationTime:this.last().get("creationTimestamp")}})},fetch:function(a){a=f.extend({remove:!1},a);a.data=f.extend({limit:50},a.data);return b.prototype.fetch.call(this,a)},onPushActivity:function(c){var b=c.key.registeredUserId+"#"+c.key.entryId,c=this.inFlight[b],d=new a({id:b}),e=this;c&&c.abort();this.inFlight[b]=d.fetch().done(function(){e.add(d,{merge:!0})}).fail(function(a){a.status===404?e.remove(d):g.error("card-collection: there was an error fetching a card in response to a PUSH_ACTIVITY message ID: "+
b)}).always(function(){delete e.inFlight[b]})}},{NAME:"CardCollection",getInstance:e.singleton(function(){return new h})});return h});define("models/customer-model",["models/base-model","constants"],function(f,g){return f.extend({url:function(){return g.URL+g.API_PREFIX+"/household/"+this.collection.id+"/account/"+this.id},defaults:{id:null,email:null,firstName:null,eulaAcceptance:null,role:null,pendingUserPin:null}},{NAME:"CustomerModel"})});
define("collections/household-collection",["constants","models/customer-model","collections/base-collection","utils/scope"],function(f,g,b,a){var c=b.extend({expires:6E4,model:g,comparator:"firstName",url:f.URL+f.API_PREFIX+"/household",parse:function(a){var c=this.id;this.id=a.id;this.id!==c&&this.trigger("change:id");return a.accounts}},{NAME:"HouseholdCollection",getInstance:a.singleton(function(){return new c})});return c});
define("models/device-model",["lodash","models/base-model","utils/error","constants"],function(f,g,b,a){return g.extend({idAttribute:"serialNumber",defaults:{serialNumber:null,deviceType:null,accountName:null,registrationId:null,softwareVersion:null,deviceAccountId:null},checkValid:function(){var a=!0;b.clearValidationErrors(this);this.get("registrationId")||(a=!1,b.publishValidationError(this,"registrationId","Please provide a registration ID"));return a},matches:function(a){return a&&this.get("deviceType")===
a.deviceType&&this.get("serialNumber")===a.deviceSerialNumber?!0:!1},parse:function(a){f.isNull(a.online)&&delete a.online;return a},destroy:function(){this.collection&&this.collection.invalidateCache();return g.prototype.destroy.apply(this,arguments)},save:function(){this.collection&&this.collection.invalidateCache();return g.prototype.save.apply(this,arguments)},enableOOBETutorialMode:function(c){return $.ajax(a.URL+a.API_PREFIX+"/wake-word/enable-oobe-tutorial-mode",{type:"POST",dataType:"json",
contentType:"application/json; charset=UTF-8",data:JSON.stringify({deviceType:this.get("deviceType"),deviceSerialNumber:this.get("serialNumber"),timeout:c})})},disableOOBETutorialMode:function(){return $.ajax(a.URL+a.API_PREFIX+"/wake-word/disable-oobe-tutorial-mode",{type:"POST",dataType:"json",contentType:"application/json; charset=UTF-8",data:JSON.stringify({deviceType:this.get("deviceType"),deviceSerialNumber:this.get("serialNumber")})})}},{NAME:"DeviceModel"})});
define("collections/device-collection","lodash,constants,collections/base-collection,collections/household-collection,models/device-model,utils/local-storage,utils/scope,utils/log,utils/poll-mixin".split(","),function(f,g,b,a,c,d,e,h,l){function i(a){return function(){var c=this.getCurrentlySelectedDevice(),b;a.apply(this,arguments);b=this.getCurrentlySelectedDevice();(c&&c.id)!==(b&&b.id)&&this.trigger("change:selectedDevice",b)}}var j="/api/devices/"+g.DOPPLER_DEVICE_TYPE_GROUP,k=b.extend(l).extend({model:c,
expires:6E4,url:g.URL+j,initialize:function(){this.pushOptions={usePush:!0,messageNames:["PUSH_DOPPLER_CONNECTION_CHANGE"]};this.listenTo(this,"pushMessage",this.onPushDopplerConnectionChange);this.listenTo(a.getInstance(),"add remove reset",function(){this.fetch({reset:!0})});this.useCache=!0},parse:function(a){if(a)return a.devices},fetch:function(a){a||(a={});a.data||(a.data={});f.extend(a.data,{cached:this.useCache});return b.prototype.fetch.call(this,a)},remove:i(b.prototype.remove),add:i(b.prototype.add),
onPushDopplerConnectionChange:function(a){var c=this.get(a.dopplerId.deviceSerialNumber);c?a&&a.dopplerId?c.set("online","ONLINE"===a.dopplerConnectionState):h.error("Empty tcomm push message event sent to "+this.constructor.NAME):this.fetch({force:!0})},getCurrentlySelectedDevice:function(a){a||(a={});var c=d.getItem("selectedDevice"),b=this.get(c)||this.at(0),e;if(b){e=b.id;if(a.online&&!b.get("online")&&(b=this.findWhere({online:!0})))e=b.id;e!==c&&this.setCurrentlySelectedDevice(e)}return b},
setCurrentlySelectedDevice:function(a){d.getItem("selectedDevice")!==a&&(d.setItem("selectedDevice",a),this.trigger("change:selectedDevice",this.get(a)))},currentDeviceIsOnline:function(){var a=this.getCurrentlySelectedDevice();return a&&a.get("online")},invalidateCache:function(){var a=this;a.timeoutId&&(clearTimeout(a.timeoutId),delete a.timeoutId);a.useCache=!1;a.timeoutId=f.delay(function(){a.useCache=!0;delete a.timeoutId},k.CACHE_INVALIDATION_TIME)},create:function(){this.invalidateCache();
return b.prototype.create.apply(this,arguments)}},{NAME:"DeviceCollection",POLL_INTERVAL:3E4,CACHE_INVALIDATION_TIME:35E3,API_PATH:j,getInstance:e.singleton(function(){return new k})});return k});define("collections/infinite-collection",["collections/base-collection"],function(f){return f.extend({maxLength:1E3,trim:function(){this.remove(this.tail(this.maxLength))}},{NAME:"InfiniteCollection"})});
define("models/provider-capabilities-model",["constants","models/base-model","utils/scope"],function(f,g,b){var a=g.extend({defaults:{providerCapabilities:void 0},url:f.URL+f.API_PREFIX+"/media/provider-capabilities",expires:-1,getCapabilities:function(a){return(this.get("providerCapabilities")||{})[a]||{}}},{NAME:"ProviderCapabilitiesModel",getInstance:b.singleton(function(){return new a})});return a});
define("utils/music-metadata-parser",["lodash","utils/music-provider"],function(f,g){var b={serviceName:function(a){return g.getProviderForService(a.service).displayText},customStationName:function(a){var c=a.radioStationName,b=a.title||a.artist||a.album||a.genre;if(c)return c+" Station";else if(b)return a.service==="I_HEART_RADIO"?b+" Station":a.service==="DIGITAL_MUSIC_STORE"?"Samples of "+b:b}},b={transformers:b,mappers:{QUEUE_HEADER:{DEFAULT:[b.customStationName]},QUEUE_ITEM:{DEFAULT:["title",
"artist"],LIVE_STATION:["title","radioStationName"],PODCAST:["title"]},NOW_PLAYING_ACTIVE:{DEFAULT:["title","artist","album"],LIVE_STATION:["title","radioStationName","radioStationSlogan"],PODCAST:["title","programName"],CUSTOM_STATION:["title","artist",b.customStationName]},NOW_PLAYING_INACTIVE:{DEFAULT:["title","artist"],LIVE_STATION:["title"],PODCAST:["title"],CUSTOM_STATION:["title"]}},contentTypes:{DEFAULT:"DEFAULT",ARTIST:"ARTIST",ALBUM:"ALBUM",GENRE:"GENRE",LIVE_STATION:"LIVE_STATION",PODCAST:"PODCAST",
CUSTOM_STATION:"CUSTOM_STATION"},determineContentType:function(a){switch(a.service){case g.CLOUD_PLAYER.serviceName:case g.DIGITAL_MUSIC_STORE.serviceName:case g.ROBIN.serviceName:return a.radioStationName?this.contentTypes.CUSTOM_STATION:a.genre?this.contentTypes.GENRE:a.artist?a.album?this.contentTypes.ALBUM:this.contentTypes.ARTIST:this.contentTypes.DEFAULT;case g.I_HEART_RADIO_LIVE.serviceName:return this.contentTypes.LIVE_STATION;case g.I_HEART_RADIO.serviceName:return this.contentTypes.CUSTOM_STATION;
case g.I_HEART_RADIO_TALK.serviceName:return this.contentTypes.PODCAST;case g.TUNE_IN.serviceName:return a.programName?this.contentTypes.PODCAST:a.trackSource&&a.trackSource!=="STATION"?this.contentTypes.PODCAST:this.contentTypes.LIVE_STATION;default:return this.contentTypes.DEFAULT}},removeAdjacentDuplicateLines:function(a){a=f.compact(a);a.length&&(a=f.uniq(a,!0,function(a){return a.trim().toLowerCase()}));return a},parse:function(a,c){var b=this.transformers.serviceName,e=this.determineContentType(a),
h={},e=f.map(this.mappers[c][e]||this.mappers[c].DEFAULT,function(c){return f.isFunction(c)?c(a):a[c]},this);e.push(b(a));e=this.removeAdjacentDuplicateLines(e);h.mainText=e[0]||null;h.subText1=e[1]||null;h.subText2=e[2]||null;return h}};b.parseNowPlayingActive=f.partialRight(b.parse,"NOW_PLAYING_ACTIVE");b.parseNowPlayingInactive=f.partialRight(b.parse,"NOW_PLAYING_INACTIVE");b.parseQueueHeader=f.partialRight(b.parse,"QUEUE_HEADER");b.parseQueueItem=f.partialRight(b.parse,"QUEUE_ITEM");return b});
define("models/music/music-owner-model",["models/base-model"],function(f){return f.extend({idAttribute:"service",defaults:{service:null,associated:!1,customerId:null,email:null,firstName:null}},{NAME:"MusicOwnerModel"})});
define("models/third-party-account-model",["models/base-model","constants"],function(f,g){return f.extend({urlRoot:g.URL+g.API_PREFIX+"/third-party",idAttribute:"serviceName",defaults:{username:null,serviceName:null,associationState:null}},{NAME:"ThirdPartyAccountModel",ASSOCIATED:"ASSOCIATED",UNASSOCIATED:"UNASSOCIATED",CLOUD_PLAYER:g.SP_CLOUD_PLAYER,IHEART:g.SP_IHEART,TUNE_IN:g.SP_TUNE_IN})});
define("collections/third-party-account-collection",["collections/base-collection","models/third-party-account-model","constants","utils/scope"],function(f,g,b,a){var c=f.extend({model:g,url:b.URL+b.API_PREFIX+"/third-party",expires:0,hasAccountAssociation:function(a){return this.get(a).get("associationState")===g.ASSOCIATED},parse:function(a){return a.services}},{NAME:"ThirdPartyAccountCollection",getInstance:a.singleton(function(){return new c})});return c});
define("models/music/music-account-model",["models/base-model"],function(f){return f.extend({idAttribute:"customerId",defaults:{customerId:null,email:null,firstName:null,associated:!1,eulaAcceptance:null,service:null,primeStatus:null}},{NAME:"MusicAccountModel"})});define("collections/music/music-account-collection",["collections/base-collection","models/music/music-account-model"],function(f,g){return f.extend({model:g},{NAME:"MusicAccounCollection"})});
define("models/music/music-service-model",["models/base-model","collections/music/music-account-collection"],function(f,g){return f.extend({idAttribute:"service",defaults:{service:null,accounts:null},parse:function(b){b.accounts=new g(b.accounts);return b}},{NAME:"MusicServiceModel"})});
define("collections/music/music-service-collection","lodash,constants,utils/scope,collections/base-collection,models/authentication-model,collections/third-party-account-collection,models/music/music-service-model".split(","),function(f,g,b,a,c,d,e){var h=a.extend({initialize:function(){f.bindAll(this,"_updateLoggedInUserAssociation");this.listenTo(d.getInstance(),"change",this._updateLoggedInUserAssociation)},model:e,url:g.URL+g.API_PREFIX+"/music-account-details",parse:function(a){return a.accountDetails},
fetch:function(b){return this.fetchAllDependencies(c.getInstance()).then(f.bind(function(){return a.prototype.fetch.call(this,b)},this))},_updateLoggedInUserAssociation:function(){var a=this;this.hasSynced&&d.getInstance().each(function(c){a._updateLoggedInUserAssociationForService(c)})},_updateLoggedInUserAssociationForService:function(a){var b=c.getInstance().get("customerId"),d,e;a&&a.id&&this.get(a.id)&&(e=this.get(a.id),d=e.get("accounts").get(b),a=a.get("associationState")==="ASSOCIATED",a!==
d.get("associated")&&(e.get("accounts").remove(b),d.set("associated",a),e.get("accounts").add(d),this.trigger("change",d)))}},{NAME:"MusicServiceCollection",getInstance:b.singleton(function(){return new h})});return h});
define("collections/music/media-owner-collection","lodash,utils/scope,collections/base-collection,models/music/music-owner-model,models/authentication-model,collections/music/music-service-collection".split(","),function(f,g,b,a,c,d){var e=b.extend({model:a,defaults:{},initialize:function(){f.bindAll(this,"_updateCurrentUserAssociation");this.listenTo(d.getInstance(),"change",this._updateCurrentUserAssociation)},fetch:function(){return this.fetchAllDependencies(d.getInstance()).then(f.bind(function(){this.isEmpty()&&
this._populateServices();this.hasSynced=!0},this))},_populateServices:function(){var a=this;d.getInstance().each(function(c){a._updateServiceOwner(c.id)})},_updateCurrentUserAssociation:function(a){var c=this.get(a.get("service"));a.get("associated");c.get("customerId")===a.get("customerId")&&(this.remove(a.get("service")),this._updateServiceOwner(a.get("service")),this.trigger("ownerUpdate",this.get(a.get("service"))))},_updateServiceOwner:function(a){var c=d.getInstance().get(a).get("accounts"),
a=this._getDefaultCustomer(a),b;c.length>1?(b=c.where({associated:!0}),b.length>1?this.add(c.get(a).toJSON()):b.length===1?this.add(b[0].toJSON()):this.add(c.get(a).toJSON())):this.add(c.get(a).toJSON())},_getDefaultCustomer:function(a){return this.defaults[a]?this.defaults[a]:c.getInstance().get("customerId")},setOwner:function(a,c){var b;d.getInstance().hasSynced?(b=d.getInstance().get(a).get("accounts").get(c),this.remove(a),this.add(b.toJSON())):this.defaults[a]=c},getId:function(a){return this.get(a)?
this.get(a).get("customerId"):this.defaults[a]},hasAccountAssociation:function(a){return this.get(a).get("associated")}},{NAME:"MediaOwnerCollection",getInstance:g.singleton(function(){return new e})});return e});
define("utils/music-helper",["lodash","backbone","constants","collections/device-collection"],function(f,g,b,a){var c={getDeviceInfoToPlayMusic:function(c){var e,h=a.getInstance().getCurrentlySelectedDevice(),l=a.getInstance().currentDeviceIsOnline(),c=c||{};h?l?e={deviceSerialNumber:h.get("serialNumber"),deviceType:h.get("deviceType")}:!c.silent&&g.trigger("showMessage",b.TXT_DEVICE_NAME+' is not connected to the cloud. Go to Wi-Fi setup.',"",{isHtml:!0}):!c.silent&&
g.trigger("showMessage","Cannot play your music.","Please select an "+b.TXT_DEVICE_NAME+" to start playing music.");return e},populateIHRImageTiny:function(a){var b,h=/\{img_url_[0-9]+\}/i,l,f;if(a.logo)b=a.logo,a.logo.search(h)!==-1&&(b=a.logo.replace(h,c.URL_IHR_IMG_PREFIX));else if(a.imagePath)b=a.imagePath;if(b)a.image=c.URL_IHR_IMG_SCALER_SMALL+b;else{if(a.artistSeed)l=a.artistSeed;else if(a.artistId)l=a.artistId;if(l)a.image=c.URL_IHR_ARTIST_IMG_PREFIX+l;else{if(a.featuredStationId)f=a.featuredStationId;
else if(a.stationType==="MOOD"&&a.stationId)f=a.stationId;if(f)a.image=c.URL_IHR_IMG_SCALER_SMALL+c.URL_IHR_FEATURED_STATION+f}}},getTrackIndexFromObjectId:function(a,b){var h,l,g=b.slice(0,h);h=f.indexOf(b,f.findWhere(b,{metadata:{objectId:a}}));l=f.where(g,{metadata:c.NOT_PRIME_SONGS}).length;l+=f.where(g,{metadata:{corrupted:!0}}).length;return h+1-l},getTrackIndex:function(a,b){var h=b.indexOf(a),l,g=b.slice(0,h);l=f.where(g,{attributes:c.NOT_PRIME_SONGS}).length;l+=f.where(g,{attributes:{corrupted:!0}}).length;
return h+1-l},URL_IHR_IMG_PREFIX:"http://img.ccrd.clearchannel.com/media/mlib",URL_IHR_IMG_SCALER_SMALL:"http://img.iheart.com/sca/imscale?w=48&img=",URL_IHR_FEATURED_STATION:"http://imgproxy.iheart.com/catalog/s",URL_IHR_ARTIST_IMG_PREFIX:"http://img.iheart.com/sca/imscale?w=48&type=artist&id=",NOT_PRIME_SONGS:{primeStatus:"NOT_PRIME"}};return c});
define("utils/error-code",["lodash","constants"],function(f,g){return{errorMessages:{DEVICE_NOT_CONNECTED:"Your "+g.TXT_DEVICE_NAME+" is currently offline. Please plug in "+g.TXT_DEVICE_NAME+" and ensure it is properly connected to Wi-Fi.",NO_DEVICES:"There is no "+g.TXT_DEVICE_NAME+" device registered.",AUTOCAST_ENABLE_FAILED:"Unable to turn on Automatic Voicecast.",AUTOCAST_DISABLE_FAILED:"Unable to turn off Automatic Voicecast.",INCORRECT_CREDENTIALS:"Incorrect login credentials provided. Please provide valid credentials and try again.",
INVALID_INPUT:"Invalid input",COMMAND_SERVICE_ERROR:"Unable to play your voice request.",CUST_PREF_ERROR:"Unable to get your custom preferences. Please try again.",CLOUD_PLAYER_AUTH_ERROR:"Your Amazon Music account is not authorized for this operation.",CLOUD_PLAYER_NO_TRACK_FOUND:"The selected track was not found in your Amazon Music account.",MAX_RESULTS_CANNOT_BE_NEGATIVE:"We were unable to find the requested Amazon Music tracks.",ASINS_INELIGIBLE_FOR_PRIME:"This selection is not eligible for Prime.",
CLOUD_PLAYER_TERMS_NOT_ACCEPTED:"You must accept the most recent Amazon Music terms of use.",CLOUD_PLAYER_ACCOUNT_NOT_VERIFIED:"You must verify your Amazon Music account.",NO_PRIME_BENEFITS:"You are not an Amazon Prime subscriber.",NO_3P_ACCOUNT_ASSOCIATION:"Your music account is not linked to "+g.TXT_DEVICE_NAME+". Go to Settings to link your account.",NO_PLAYLIST_FOUND:"The selected playlist was not found in your Amazon Music account.",NO_STATION_FOUND:"The selected station was not found. Was it deleted?",
IHEARTRADIO_CONTENT_BLOCKED:"Unable to play because custom stations are disabled for iHeartRadio.",TRACK_NOT_IN_PRIME:"The selected track is no longer available in Prime.",ENROLLMENT_OPEN_MICROPHONE_TIMEOUT_ERROR:"Voice training is currently unavailable. Please make sure that the microphone is turned on and that it is not playing Bluetooth audio. If the problem persists, we may be encountering a system error. Please return at a later time.",OFFLINE_REQUEST:"The request could not be completed. Please make sure you are connected to the internet."},
errorActions:{IHEARTRADIO_CONTENT_BLOCKED:"To enable custom stations, go to Music Settings.",AUTOCAST_ENABLE_FAILED:"You can turn it on any time from Settings.",AUTOCAST_DISABLE_FAILED:"You can turn it off any time from Settings."},getErrorMessage:function(b){if(!b)return"Unknown error";if(f.isString(b))return this.errorMessages[b];else if(b.getResponseHeader&&b.getResponseHeader("x-amzn-error"))return this.errorMessages[b.getResponseHeader("x-amzn-error")];else if(b.status===0)return this.errorMessages.OFFLINE_REQUEST;
return""},getErrorAction:function(b){if(!b)return"";if(f.isString(b))return this.errorActions[b];else if(b.getResponseHeader&&b.getResponseHeader("x-amzn-error"))return this.errorActions[b.getResponseHeader("x-amzn-error")];return""}}});
define("models/media-model","jquery,lodash,constants,models/base-model,models/provider-capabilities-model,models/platform-model,utils/music-metadata-parser,collections/music/media-owner-collection,utils/music-helper,utils/music-provider,utils/error-code,utils/log".split(","),function(f,g,b,a,c,d,e,h,l,i,j,k){return a.extend({defaults:{type:"Media",historicalId:null,referenceId:null,title:null,artist:null,album:null,imageURL:null,cardImageURL:null,isLiked:null,isDisliked:null,radioStationName:null,
radioStationCallSign:null,radioStationSlogan:null,index:0,asin:null,contentId:null,service:null,providerId:null,contentType:null,startTime:null,durationSeconds:null,canJump:!1,disableThumbsUp:!1,disableScanningStation:!1,disableTuningStation:!1,mainText:null,subText:null,canShopForMusic:!1,canTuneStation:!1,canScanStation:!1,canCreateStation:!1,canAddToLibrary:!1,hasAnyAuxilaryActions:!1},parse:function(a){var c=e.parseQueueItem(a);a.mainText=c.mainText;a.subText=c.subText1;a.id="i"+(a.historicalId||
a.index);a.canJump=this._canJump(a);return a=this.setAuxiliaryActions(a)},addToCloudPlayer:function(){var a=f.Deferred(),c;c=this.get("asin");var d={artistName:this.get("artist"),albumName:this.get("album"),trackTitle:this.get("title"),trackId:this.get("referenceId"),asin:this.get("asin"),cardImageURL:this.get("cardImageURL")},e=l.getDeviceInfoToPlayMusic();if(!c)return k.error("ASIN not found"),a.reject().promise();if(!e)return k.error("Device details not found"),a.reject().promise();g.extend(e,
{mediaOwnerCustomerId:h.getInstance().getId(b.SP_CLOUD_PLAYER)});c=b.URL+b.API_PREFIX+"/cloudplayer/add-tracks-by-media?"+f.param(e);f.ajax(c,{dataType:"json",type:"POST",data:JSON.stringify(d)}).fail(function(c){a.reject(j.getErrorMessage(c))}).done(a.resolve);return a.promise()},getProviderCapabilities:function(){return this._getProviderCapabilitiesByService(this.get("service"))},_getProviderCapabilitiesByService:function(a){return c.getInstance().getCapabilities(a)},setAuxiliaryActions:function(a){var c=
{canShopForMusic:this._canShopForMusic(a),canTuneStation:this._canTuneStation(a),canScanStation:this._canScanStation(a),canCreateStation:this._canCreateStation(a),canAddToLibrary:this._canAddToLibrary(a),canThumbsUp:this._canThumbsUp(a)};c.hasAnyAuxilaryActions=g.any(c);return g.extend(a,c)},_canTuneStation:function(a){return a.service===i.I_HEART_RADIO.serviceName&&!a.disableTuningStation},_canScanStation:function(a){return a.service===i.I_HEART_RADIO_LIVE.serviceName&&!a.disableScanningStation},
_canCreateStation:function(a){return a.service===i.I_HEART_RADIO.serviceName&&this._getProviderCapabilitiesByService(a.service).canCreateStation},_canAddToLibrary:function(a){return a.service===i.ROBIN.serviceName&&!!a.asin},_canShopForMusic:function(a){return i.canShopFor(a.service,a.contentType)&&d.getInstance().supports("purchasing")&&this._hasAnySongInfo(a)},_canThumbsUp:function(a){return this._getProviderCapabilitiesByService(a.service).canThumbsUp&&!a.disableThumbsUp},_canJump:function(a){return this._getProviderCapabilitiesByService(a.service).canJump},
_hasAnySongInfo:function(a){return g.any(g.pick(a,["artist","album","asin","title"]))}},{NAME:"MediaModel",DEFAULT_POLLING_DELAY:1E4})});
define("collections/media-collection","lodash,jquery,collections/infinite-collection,models/media-model,models/provider-capabilities-model,collections/device-collection,constants,utils/scope".split(","),function(f,g,b,a,c,d,e,h){var l=b.extend({model:a,url:e.URL+e.API_PREFIX+"/media/queue",comparator:"index",initialize:function(){this.deviceCollection=d.getInstance();this.providerCapabilities=c.getInstance()},fetch:function(a){return this.fetchAllDependencies(this.deviceCollection,this.providerCapabilities).then(f.bind(function(){a||
(a={});var c=this.deviceCollection.getCurrentlySelectedDevice(),d;if(c&&this.length){d=this._getPlayerModel();a.data=f.extend({deviceSerialNumber:c.get("serialNumber"),deviceType:c.get("deviceType"),applicationId:d.get("service")},a.data);a.fromHead?(c=this.first().get("index")-25-1,d=25,c<0&&(d+=c,c=0)):(c=this.last().get("index"),d=d.get("queueSize"),d=Math.min(25,d-c));a.data.offset=c;a.data.size=d;return d<=0?(a.success&&a.success(this,[]),a.complete&&a.complete(),(new g.Deferred).resolve().promise()):
b.prototype.fetch.call(this,a)}else return a.error&&f.defer(a.error,this,{textStatus:"preconditionfailed"},a),(new g.Deferred).reject().promise()},this))},parse:function(a){return a&&a.queue?(c.getInstance(),f.each(a.queue,function(a){if(a)a.type="Media"}),a.queue):[]},_getPlayerModel:function(){if(!this.playerModel)this.playerModel=require("models/player-model").getInstance();return this.playerModel}},{NAME:"MediaCollection",getInstance:h.singleton(function(){return new l})});return l});
define("models/progress-model",["lodash","backbone"],function(f,g){var b=function(a){this.initialize(a)};b.prototype={initialize:function(a){this.playerModel=a;this.progressTimer=null;this.percentCompleted=0;this.listenTo(this.playerModel,"sync",this._onProgressSecondsChange);this.listenTo(this.playerModel,"change:progressSeconds",this._onProgressSecondsChange);this.listenTo(this.playerModel,"change:currentState",this.onPlayerStateChange)},percentCompleteAtLastFetch:function(){var a=this.playerModel.getCurrentlyPlayingMedia(),
a=a&&a.get("durationSeconds"),c=this.playerModel.get("progressSeconds");return!a?0:Math.min(1,c/a)*100},_onProgressSecondsChange:function(){this.setPercentCompleted(this.percentCompleteAtLastFetch());this.onPlayerStateChange()},onPlayerStateChange:function(){this.playerModel.isPlaying()?this.resumeProgress():this.pauseProgress()},resumeProgress:function(){var a=this.playerModel.getCurrentlyPlayingMedia(),a=a&&a.get("durationSeconds"),c,d,e;this.pauseProgress();if(a)c=a*1E3,d=Date.now(),e=this.percentCompleted,
this.progressTimer=setInterval(f.bind(function(){var a=(Date.now()-d)/c*100;this.setPercentCompleted(Math.min(100,e+a))},this),b.PROGRESS_UPDATE_INTERVAL)},pauseProgress:function(){if(this.progressTimer)clearInterval(this.progressTimer),this.progressTimer=null},setPercentCompleted:function(a){this.percentCompleted=a;this.trigger("change:percentCompleted",this.percentCompleted)}};f.extend(b.prototype,g.Events);b.PROGRESS_UPDATE_INTERVAL=500;return b});
define("models/player-model","lodash,backbone,constants,utils/poll-mixin,collections/device-collection,models/base-model,dee-website-messaging,collections/media-collection,utils/scope,models/platform-model,models/progress-model,models/provider-capabilities-model".split(","),function(f,g,b,a,c,d,e,h,l,i,j,k){var n=d.extend({defaults:{referenceId:null,imageURL:null,isFavorited:!1,providerCapabilities:null,currentState:null,progressSeconds:0,volume:0,muted:!1,looping:!1,shuffling:!1,service:null,queueId:null,
radioStationId:null,queueSize:null,radioVariety:null,timeLastShuffled:null,mediaOwnerCustomerId:null},initialize:function(){var a=e.getInstance();this.deviceCollection=c.getInstance();this.providerCapabilities=k.getInstance();this.mediaCollection=h.getInstance();this.platform=i.getInstance();this.progressModel=new j(this);f.bindAll(this,"onFetchError","resetFetchPending");this.listenTo(this.deviceCollection,"change:selectedDevice change:online",function(){this.deviceChangeFetchPending=!0;this._clearAllMedia();
this.fetch({force:!0});this.mediaCollection.fetch({force:!0})});this.pushOptions={usePush:!0,messageNames:["PUSH_AUDIO_PLAYER_STATE"]};this.listenTo(this,"pushMessage",this.onPushAudioPlayerState);this.listenTo(a,"message:PUSH_VOLUME_CHANGE",this.onPushVolumeChange);this.listenTo(a,"message:PUSH_MEDIA_QUEUE_CHANGE",this.onPushMediaQueueChange);this.listenTo(a,"message:PUSH_MEDIA_CHANGE",this.onPushMediaChange)},url:b.URL+b.API_PREFIX+"/media/state",getProgressModel:function(){return this.progressModel},
onPushAudioPlayerState:function(a){var c=this.deviceCollection.getCurrentlySelectedDevice();c&&a&&c.matches(a.dopplerId)&&c.get("online")&&(this.fetch({force:!0}),this.set({currentState:a.audioPlayerState}),a.error&&g.trigger("showMessage","Error",a.errorMessage))},onPushMediaQueueChange:function(a){var c=this.deviceCollection.getCurrentlySelectedDevice(),b=this.get("shuffling");c&&a&&c.matches(a.dopplerId)&&c.get("online")&&(a.playBackOrder&&(b=a.playBackOrder===n.SHUFFLE_ALL,this.set("shuffling",
b)),a.loopMode&&this.set("looping",a.loopMode===n.LOOP_QUEUE),(a.changeType===n.NEW_QUEUE_CHANGE_TYPE||a.changeType===n.TRACKS_MODIFIED_CHANGE_TYPE||this._shuffledTurnedOnOrOff(this.currentCloudShuffling,b))&&this.fetch({force:!0}),a.trackOrderChanged&&(this.mediaCollection.reset({},{silent:!0}),this.fetch({force:!0,trackOrderChanged:!0})))},onPushMediaChange:function(a){var c=this.deviceCollection.getCurrentlySelectedDevice();c&&a&&c.matches(a.dopplerId)&&this.fetch({force:!0})},fetch:function(a){return this.fetchAllDependencies(this.deviceCollection,
this.providerCapabilities).then(f.bind(function(){a||(a={});var c=this.deviceCollection.getCurrentlySelectedDevice(),b=this.mediaCollection.first(),e=this.mediaCollection.last();if(c&&c.get("online"))return a.data=f.extend({deviceSerialNumber:c&&c.get("serialNumber"),deviceType:c&&c.get("deviceType"),queueId:this.get("queueId"),shuffling:this.currentCloudShuffling,firstIndex:b&&b.get("index"),lastIndex:e&&e.get("index"),screenWidth:this.platform.get("screenWidth")},a.data),d.prototype.fetch.call(this,
a).always(this.resetFetchPending).fail(this.onFetchError);else this.resetFetchPending()},this))},onFetchError:function(a){a&&a.status===403&&this._clearAllMedia()},resetFetchPending:function(){this.deviceChangeFetchPending&&this.trigger("deviceChangeFetchComplete");this.deviceChangeFetchPending=!1},_clearAllMedia:function(){this.clear();this.mediaCollection.reset()},parse:function(a,c){a||(a={});var b,d;b=c&&c.trackOrderChanged;var e=a.service;a.providerId==="TUNE_IN"&&a.contentType==="PODCASTS"&&
(e="TUNE_IN_PODCAST");a.providerCapabilities=this.providerCapabilities.getCapabilities(e);(d=a.providerCapabilities.queueModifiedInPlace)||b||this.get("queueId")!==a.queueId||this._shuffledTurnedOnOrOff(this.currentCloudShuffling,a.shuffling)||this.currentTimeLastShuffled!==a.timeLastShuffled?(this.mediaCollection.reset(a,{silent:!0,parse:!0}),f.defer(f.bind(function(){this.mediaCollection.trigger("reset");d&&this.trigger("change:referenceId")},this))):this.mediaCollection.add(a,{parse:!0});this.currentCloudShuffling=
a.shuffling;this.currentTimeLastShuffled=a.timeLastShuffled;if(b=this.mediaCollection.findWhere({referenceId:a.referenceId}))b.set("isLiked",a.isLiked),b.set("isDisliked",a.isDisliked);delete a.queue;delete a.isLiked;delete a.isDisliked;return a},onPushVolumeChange:function(a){var c=this.deviceCollection.getCurrentlySelectedDevice();c&&a&&c.matches(a.dopplerId)&&(this.set("muted",a.isMuted),!a.isMuted&&f.isNumber(a.volumeSetting)&&a.volumeSetting>=0&&this.set("volume",a.volumeSetting))},shouldStopOnNext:function(){var a=
this.getCurrentlyPlayingMedia(),a=a?a.get("index"):0;return!(this.get("looping")||this.get("queueSize")>a||this.get("providerCapabilities").canNextAtEndOfQueue)},isActive:function(){return!!this.get("referenceId")},isPlaying:function(){return this.get("currentState")===n.PLAYING},getCurrentlyPlayingMedia:function(){return this.mediaCollection.findWhere({referenceId:this.get("referenceId")})},waitForMusicChange:function(){var a=$.Deferred(),c=n.getInstance(),b,d=function(){clearTimeout(b);a.resolve()};
c.once("change:referenceId",d);b=setTimeout(function(){a.reject();c.off("change:referenceId",d)},n.TIMEOUT);c.startPolling(n.POLL_ID);a.always(function(){c.stopPolling(n.POLL_ID)});return a.promise()},_shuffledTurnedOnOrOff:function(a,c){return a!==c}},{NAME:"PlayerModel",PLAYING:"PLAYING",INTERRUPTED:"INTERRUPTED",FINISHED:"FINISHED",NEW_QUEUE_CHANGE_TYPE:"NEW_QUEUE",TRACKS_MODIFIED_CHANGE_TYPE:"TRACKS_MODIFIED",LOOP_QUEUE:"LOOP_QUEUE",SHUFFLE_ALL:"SHUFFLE_ALL",TIMEOUT:1E4,POLL_ID:"PlayerListener",
getInstance:l.singleton(function(){return new n})}).extend(a);return n});
define("utils/music-initiator","lodash,jquery,collections/device-collection,utils/log,collections/music/media-owner-collection,models/third-party-account-model,constants,utils/error-code".split(","),function(f,g,b,a,c,d,e,h){var l=function(){var a=b.getInstance().getCurrentlySelectedDevice({online:!0});return a?g.Deferred().resolve({deviceSerialNumber:a.get("serialNumber"),deviceType:a.get("deviceType")}).promise():g.Deferred().reject(h.errorMessages.NO_DEVICES).promise()},i={playCloudPlayer:function(a){a||
(a={});var b=e.URL+e.API_PREFIX+"/cloudplayer/queue-and-play?";return l().then(function(d){var d=f.extend({shuffle:!!a.shuffle},d),h=f.extend({isoTimestamp:(new Date).toISOString()},a.filter);d.mediaOwnerCustomerId=a.mediaOwnerCustomerId?a.mediaOwnerCustomerId:c.getInstance().getId(e.SP_CLOUD_PLAYER);return g.ajax(b+g.param(d),{type:"POST",processData:!1,contentType:"application/json",data:JSON.stringify(h)})})},playiHeartRadio:function(a){a||(a={});var b=a.stationId,d,h;switch(a.stationType){case "LIVE":d=
"live";break;case "MOOD":h="STATION";d="seeded";break;case "ARTIST":case "TRACK":h=a.stationType;d="seeded";break;default:d="custom"}return l().then(function(l){var f=e.URL+e.API_PREFIX+"/iheartradio/queue-and-play-"+d+"-station?",i={};if(h)l.seedType=h;if(b)l.stationId=b;l.mediaOwnerCustomerId=a.mediaOwnerCustomerId?a.mediaOwnerCustomerId:c.getInstance().getId(e.SP_IHEART);if(a.name)i.name=a.name;return g.ajax(f+g.param(l),{type:"POST",processData:!1,contentType:"application/json",data:JSON.stringify(i)})})},
playTuneIn:function(a){a||(a={});var b=e.URL+e.API_PREFIX+"/tunein/queue-and-play?";return l().then(function(d){d=f.extend({contentType:a.contentType,callSign:a.callSign,guideId:a.guideId},d);d.mediaOwnerCustomerId=a.mediaOwnerCustomerId?a.mediaOwnerCustomerId:c.getInstance().getId(e.SP_TUNE_IN);return g.ajax(b+g.param(d),{type:"POST",processData:!1,contentType:"application/json"})})},playItAgain:function(a){var c=e.URL+e.API_PREFIX+"/media/play-it-again";return l().then(function(b){b=f.extend({},
b,a);return g.ajax(c,{type:"POST",processData:!1,contentType:"application/json",data:JSON.stringify(b)})})},playSamplesFromStore:function(a){var c=e.URL+e.API_PREFIX+"/store/play-samples";return l().then(function(b){b=f.extend({},b,a);return g.ajax(c,{type:"POST",processData:!1,contentType:"application/json",data:JSON.stringify(b)})})},playMusic:function(c){c||(c={});switch(c.provider){case d.CLOUD_PLAYER:return i.playCloudPlayer(c);case d.IHEART:case d.IHEART_LIVE:return i.playiHeartRadio(c);case d.TUNE_IN:return i.playTuneIn(c);
default:return a.error("attempted to play music from unknown provider "+c.provider),g.Deferred().reject().promise()}}};return i});define("soundmanager",[],function(){return window.SoundManager});
define("utils/audio","lodash,backbone,utils/user-agent,utils/js-bridge,utils/log,soundmanager,models/platform-model".split(","),function(f,g,b,a,c,d,e){var h,l,i;h={url:"../lib/soundmanager/swf/",debugMode:!1,useHTML5Audio:!0,preferFlash:!e.getInstance().supports("html5Audio")};b.is("IE")&&f.extend(h,{useHTML5Audio:!1,preferFlash:!0,flashVersion:9,flash9Options:{isMovieStar:!0}});i=new d;window.soundManager=i;i.setup(h);i.beginDelayedInit();l=function(c){a.postMessage({target:"AudioBridge",method:"playAudio",
parameters:{url:c.url}},c.success,c.error,c.complete)};return f.extend({play:function(a){a||(a={});var d=a.complete,h;a.complete=f.bind(function(){this._changePlayingAudioId(null);d&&d()},this);this._changePlayingAudioId(a.id);e.getInstance().supports("nativeAudio")?l(a):(f.each(i.soundIDs,function(a){i.destroySound(a)}),(h=i.createSound(a))?h.play({onfinish:function(){a.complete&&a.complete();a.success&&a.success()},onstop:b.is("iOS")&&a.type==="audio/mp3"?a.complete:void 0,onload:function(){this.readyState===
2&&(a.complete&&a.complete(),a.error&&a.error("Media could not be loaded."));this.readyState===3&&b.is("iOS")&&a.complete&&a.complete()}}):c.error("Could not play audio: "+JSON.stringify(a)))},_changePlayingAudioId:function(a){this.currentlyPlayingId=a;this.trigger("change change:currentlyPlayingId",{currentlyPlayingId:a})}},g.Events)});
define("handlers/card-action-handler","lodash,jquery,backbone,constants,collections/cardstream/card-collection,models/player-model,utils/browser-utils,utils/error-code,utils/js-bridge,utils/music-initiator,collections/music/media-owner-collection,utils/audio,utils/scope,utils/log".split(","),function(f,g,b,a,c,d,e,h,l,i,j,k,n,m){var o=function(){},q=function(a){a!==h.errorMessages.NO_DEVICES&&b.trigger("showMessage",h.getErrorMessage(a)||"Unable to play content.")},p=function(){b.trigger("scrollCardStream",
0)},s=function(a){a=a&&a.status===404?"Unable to find samples from the Digital Music Store.":h.getErrorMessage(a)||"Unable to play samples from the Digital Music Store.";b.trigger("showMessage",a,"")};o.getInstance=n.singleton(function(){return new o});o.prototype={start:function(){b.on("CardAction",this.onCardAction,this)},onCardAction:function(a,c){a&&a.actionType&&f.isFunction(this["on"+a.actionType])&&this["on"+a.actionType].call(this,a,c)},onPlayItAgainAction:function(a){var c=d.getInstance();
a.queueId?c.fetch().done(function(){var d;c.get("queueId")===a.queueId?b.trigger("navigate","player"):(d={queueId:a.queueId,mediaOwnerCustomerId:a.queueCustomerId},i.playItAgain(d).done(p).fail(q))}):m.error("Attempted PlayItAgainAction without queueId!")},onOpenUrlAction:function(a){a.url&&e.openWindow(a.url)},onNavigateAction:function(c){c.serviceName&&c.serviceName===a.SP_CLOUD_PLAYER&&c.musicCustomerId&&j.getInstance().setOwner(c.serviceName,c.musicCustomerId);b.trigger("navigate",encodeURI(c.route))},
onSearchMP3StoreAction:function(a){l.searchOnAmazonMP3(a.asin||a.searchString||"",a.affiliateTag,!!a.asin,a.greenPointType)},onSearchRobinAction:function(a){l.searchRobin(a.searchString)},onPlayCloudPlayerAction:function(a){i.playCloudPlayer({shuffle:a.shuffle,filter:{playlistId:a.playlistId,playlistTitle:a.playlistTitle,artistName:a.artistName,albumArtistName:a.albumArtistName,albumName:a.albumName,initialTrackIndex:a.initialTrackIndex,trackId:a.trackId,trackTitle:a.trackTitle,genre:a.genre},mediaOwnerCustomerId:a.musicCustomerId}).done(p).fail(q)},
onPlayTuneInAction:function(a){var c={guideId:a.guideId,contentType:a.contentType,mediaOwnerCustomerId:a.musicCustomerId};if(a.contentType==="station")c.callSign=a.contentName;i.playTuneIn(c).then(p,q)},onPlayIHeartRadioAction:function(a){i.playiHeartRadio({stationType:a.stationType,stationId:a.stationId,name:a.stationName,mediaOwnerCustomerId:a.musicCustomerId}).then(p,q)},onFindSamplesFromStoreAction:function(a){i.playSamplesFromStore({artistName:a.artistName,artistAsin:a.artistAsin,artistId:a.artistId,
songName:a.songName,albumName:a.albumName}).fail(s)},onPlayAudioAction:function(c){k.play({id:c.url,url:a.URL+"/"+c.url+a.URL_UTTERANCE_SUFFIX,type:a.UTTERANCE_CONTENT_TYPE,error:function(){b.trigger("showMessage","Unable to play content.")}})},onThumbsUpDownActivityAction:function(c,b){g.ajax(a.URL+a.API_PREFIX+"/activities/thumbs-down/"+encodeURIComponent(c.activityId),{type:"POST",data:JSON.stringify({correctFeedback:b.correctFeedback}),dataType:"json",contentType:"application/json; charset=UTF-8"})},
onDeleteCardAction:function(d){var d=d.cardId,e=c.getInstance(),l=e.get(d);e.remove(l);g.ajax(a.URL+a.API_PREFIX+"/remove-card/"+encodeURIComponent(d),{type:"delete"}).fail(function(a){a&&a.status===404||e.add(l);a=a&&a.status===404?"Could not find the card":h.getErrorMessage(a)||"Could not delete the card";b.trigger("showMessage",a,"")})}};return o});
define("models/activity-dialog-item-model",["lodash","models/base-model","constants","utils/log"],function(f,g,b,a){var c=g.extend({COMPLEX_ATTRIBUTES:["feedbackAttributes","sourceDevice","activityItemData"],urlRoot:b.URL+b.API_PREFIX+"/activity-dialog-item",defaults:{timestamp:null,version:null,itemType:null,activeUserId:null,description:null,feedbackAttributes:null,sourceDevice:null,utteranceId:null},parse:function(c){var b;c&&(b=c.activityDialogItem?c.activityDialogItem:c,f.each(this.COMPLEX_ATTRIBUTES,
function(c){try{b[c]=b[c]?JSON.parse(b[c]):void 0}catch(d){a.error('Error parsing attribute "'+c+'" "'+b[c]+'"',d)}}));return b},toJSON:function(c){var c=c||{},b=f.clone(this.attributes);c.ignoreComplexAttributes||f.each(this.COMPLEX_ATTRIBUTES,function(c){try{b[c]=JSON.stringify(b[c])}catch(d){a.error('Error parsing attribute "'+c+'" "'+b[c]+'"',d)}});return b},hasDialogData:function(){var a=this.get("activityItemData"),b=this.get("itemType");if(a&&b===c.ITEM_TYPE_ASR&&a.asrText)return!0;else if(a&&
b===c.ITEM_TYPE_TTS&&a.ttsText)return!0;return!1},hasSound:function(){var a=this.get("itemType");return a===c.ITEM_TYPE_TTS?!0:a!==c.ITEM_TYPE_ASR?!1:this.get("utteranceId").substr(0,11)!=="TextClient:"},audioPlaybackRequestParameters:function(){var a=this.get("itemType"),e=this.get("activityItemData"),h=this.get("utteranceId");return a===c.ITEM_TYPE_ASR&&h?{id:h,url:b.URL_UTTERANCE_BASE+"?id="+h+b.URL_UTTERANCE_SUFFIX,type:b.UTTERANCE_CONTENT_TYPE}:a===c.ITEM_TYPE_TTS&&e?(a=e.voiceName||"en_us_nina",
h=e.ttsText||e.ttsSsmlText,{id:e.ttsRequestId,url:b.URL_TTS_BASE+"?voiceName="+a+"&ssmlText="+encodeURIComponent(h),type:"audio/mp3"}):null},isUtterance:function(){return this.get("itemType")===c.ITEM_TYPE_ASR},isTtsResponse:function(){return this.get("itemType")===c.ITEM_TYPE_TTS}},{NAME:"ActivityDialogItemModel",ITEM_TYPE_ASR:"ASR",ITEM_TYPE_TTS:"TTS",ITEM_TYPE_NLU:"NLU"});return c});
define("collections/activity-dialog-item-collection",["lodash","collections/base-collection","models/activity-dialog-item-model","constants","utils/scope"],function(f,g,b,a,c){var d=g.extend({model:b,url:a.URL+a.API_PREFIX+"/activity-dialog-items",comparator:"timestamp",initialize:function(a,c){c=c||{};this.activityKey=c.activity?c.activity.id():c.activityId},parse:function(a){var c;if(a)c=a.activityDialogItems;return c},fetch:function(a){a=a||{};a.data=f.extend({},a.data,{activityKey:this.activityKey});
return g.prototype.fetch.call(this,a)}},{NAME:"ActivityDialogItemCollection",getInstance:c.singleton(function(){return new d})});return d});define("moment",[],function(){window.moment.calendar={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"dddd [at] LT",sameElse:"L"};return window.moment});
define("models/activity-model","lodash,jquery,constants,models/base-model,collections/activity-dialog-item-collection,collections/device-collection,utils/log,moment".split(","),function(f,g,b,a,c,d,e,h){var l=["feedbackAttributes","description","domainAttributes","sourceActiveUsers"],i=a.extend({urlRoot:b.URL+b.API_PREFIX+"/activities",expires:0,initialize:function(){this.devices=d.getInstance();this.listenTo(this.devices,"change:accountName",this._onDeviceNameChange)},defaults:{creationTimestamp:null,
version:null,intentType:null,activityStatus:null,description:null,feedbackAttributes:null,domainAttributes:null,domainType:null,sourceDeviceIds:null,sourceActiveUsers:null,summary:null,canPlay:!1,time:null,sourceDevice:null,_disambiguationId:null,utteranceId:null},fetch:function(c){var b=this,d=g.Deferred();this.devices.fetch().then(function(){a.prototype.fetch.call(b,c).done(d.resolve).fail(d.reject)}).fail(d.reject);return d.promise()},parse:function(a){a||(a={});var c;c=a.activity?a.activity:a;
f.each(l,function(a){try{c[a]=c[a]?JSON.parse(c[a]):void 0}catch(b){e.error('Error parsing attribute "'+a+'" "'+c[a]+'"',b)}});if(f.isArray(c.domainAttributes))c.domainAttributes={nBestList:c.domainAttributes};c.summary=c.description&&c.description.summary?c.description.summary:"Unknown";if(c.utteranceId)c.canPlay=c.utteranceId.indexOf("TextClient")===-1;if(c.sourceDeviceIds&&c.sourceDeviceIds[0])c.sourceDevice=this._getDeviceName(c.sourceDeviceIds[0].serialNumber);if(c.creationTimestamp)c.time=h(c.creationTimestamp).calendar();
return c},_getDeviceName:function(a){return(a=d.getInstance().findWhere({serialNumber:a}))&&a.get("accountName")},_onDeviceNameChange:function(){var a=this.devices.findWhere({serialNumber:((this.get("sourceDeviceIds")||[])[0]||{}).serialNumber});a&&this.set("sourceDevice",a.get("accountName"))},setDisambiguationId:function(a){this.set("_disambiguationId",a)},toJSON:function(a){var c=f.clone(this.attributes);(!a||!a.ignoreComplexAttributes)&&f.each(l,function(a){try{f.isNull(c[a])||(c[a]=JSON.stringify(c[a]))}catch(b){e.error('Error parsing attribute "'+
a+'" "'+c[a]+'"',b)}});return c},activityDialogItemDidSync:function(a){var c=this.get("feedbackAttributes")||{};if(!c.hasFeedback&&(a=a.get("feedbackAttributes")))c.hasFeedback=!0,this.save({feedbackAttributes:c})},getActivityDialogItems:function(a){if(!this._activityDialogItems)this._activityDialogItems=new c([],{activityId:this.id}),a||this._activityDialogItems.fetch(),this.listenTo(this._activityDialogItems,"sync",this.activityDialogItemDidSync);return this._activityDialogItems},isDiscarded:function(){return this.get("activityStatus")===
i.ACTIVITY_STATUS_DISCARDED}},{NAME:"ActivityModel",ACTIVITY_STATUS_SUCCESS:"SUCCESS",ACTIVITY_STATUS_FAILURE:"FAILURE",ACTIVITY_STATUS_IN_PROGRESS:"IN_PROGRESS",ACTIVITY_STATUS_DISCARDED:"DISCARDED_NON_DEVICE_DIRECTED_INTENT"});return i});
define("collections/activity-collection","lodash,jquery,collections/infinite-collection,collections/device-collection,models/activity-model,utils/poll-mixin,constants,utils/log,utils/scope".split(","),function(f,g,b,a,c,d,e,h,l){var i=b.extend(d).extend({model:c,initialize:function(){this.devices=a.getInstance();this.pushOptions={usePush:!0,messageNames:["PUSH_ACTIVITY"]};this.listenTo(this,"pushMessage",this.onPushActivity)},comparator:function(a){return-(a.get("creationTimestamp")||0)},url:e.URL+
e.API_PREFIX+"/activities",fetch:function(a){var c=this,d=g.Deferred();this.devices.fetch().then(function(){a=f.extend({remove:!1,merge:!0},a);a.data=f.extend({startTime:c.startTime?c.startTime-1E3:null,endTime:c.endTime,size:50},a.data);a.data.offset=a.poll?1:a.fromHead?1:-1;b.prototype.fetch.call(c,a).done(d.resolve).fail(d.reject)}).fail(d.reject);return d.promise()},onPushActivity:function(a){var b=a.key.registeredUserId+"#"+a.key.entryId,d,e=this;if(!f.contains(this.inFlight||(this.inFlight=
[]),b))d=new c({id:b}),this.inFlight.push(b),d.fetch({success:function(){e.inFlight=f.without(e.inFlight,b);e.add(d,{merge:!0})},error:function(a,c){e.inFlight=f.without(e.inFlight,b);c.status!==400&&h.error("activity-collection: there was an error fetching an activity in response to a PUSH_ACTIVITY message ID: "+b)}})},parse:function(a){a.activities=f.filter(a.activities,function(a){return!!a.utteranceId});if(!this.startTime||a.startDate&&this.startTime>a.startDate)this.startTime=a.startDate;if(!this.endTime||
a.endDate&&this.endTimeh)l=!1;else if(a.customerId!==b)l=!1;else if(a.serialNumber!==d||a.deviceType!==e)l=!1;return l}},isValidMessage:function(a){return!a||!a.targetCustomerId||
!a.dopplerId||!a.dopplerId.deviceSerialNumber||!a.dopplerId.deviceType||!a.deleteBeforeTimeInclusive||!f.isNumber(a.deleteBeforeTimeInclusive)||a.deleteBeforeTimeInclusive<0?(b.error("Received invalid PUSH_DELETE_DOPPLER_ACTIVITIES message",a),!1):!0}};f.extend(h.prototype,g.Events);h.getInstance=d.singleton(function(){return new h});return h});
define("utils/viewport",["jquery","utils/user-agent"],function(f,g){return{adjust:function(){var b;g.is("iOS")&&(b=f("meta[name=viewport]"),b.attr("content","width=device-width, height="+window.innerHeight+", initial-scale=1.0, maximum-scale=1.0, user-scalable=0"),window.innerHeight!==window.outerHeight?f("#d-main").css("height",window.innerHeight):f("#d-main").css("height",""))}}});
define("handlebars",[],function(){var f=window.Handlebars,g=(window.baseUrl||"")+"../templates/";f.getTemplate=function(b){(!f.templates||!f.templates[b])&&$.ajax({url:g+b+".handlebars",dataType:"html",async:!1,success:function(a){if(!f.templates)f.templates={};f.templates[b]=f.compile(a)},error:function(){console.error("Failed to load: "+b)}});return f.templates[b]};return f});
define("utils/time-utils",["moment"],function(f){return{TWENTYFOURHOURS:864E5,parseTime:function(f){var b,a={};if(typeof f!=="string")return null;f=f.replace(/\s/g,"").match(RegExp("^(\\d{1,2})(pm|p.m.|am|a.m.|$)$|^(\\d{1,2}):(\\d{2})(pm|p.m.|am|a.m.|$)$|^(\\d{1,2}):(\\d{2}):(\\d{2})(pm|p.m.|am|a.m.|$)$","i"));if(!f)return null;if(f[1])a.hour=parseInt(f[1],10),a.minute=0,a.second=0,b=f[2];else if(f[3])a.hour=parseInt(f[3],10),a.minute=parseInt(f[4],10),a.second=0,b=f[5];else if(f[6])a.hour=parseInt(f[6],
10),a.minute=parseInt(f[7],10),a.second=parseFloat(f[8]),b=f[9];b=(b||"").replace(/\./g,"").toUpperCase();b==="PM"&&a.hour!==12&&(a.hour+=12);if(b==="AM"&&a.hour===12)a.hour=0;return a.hour>=24||a.hour>=12&&b==="AM"?null:a.minute>=60||a.second>=60?null:a},withinLastTwentyFourHours:function(f){return f>Date.now()-this.TWENTYFOURHOURS},formatLongDateTime:function(g){var b;b=isNaN(g)?f(g,"YYYY-MM-DD[T]HH:mm:ss Z"):f(g);if(!b.isValid())throw Error('"'+g+'" is not a valid date/time.');g=b.format("dddd, MMMM Do [at] h:mm a");
return g.slice(0,-2)+(g.slice(-2)==="am"?"a.m.":"p.m.")}}});
define("handlebars-helpers","lodash,constants,handlebars,images,utils/time-utils,utils/log".split(","),function(f,g,b,a,c,d){var e={appNameTitle:g.TXT_APP_NAME_TITLE,deviceNameTitle:g.TXT_DEVICE_NAME_TITLE,appName:g.TXT_APP_NAME,deviceName:g.TXT_DEVICE_NAME};return{registerAll:function(){b.registerHelper("escape",function(a){return escape(a)});b.registerHelper("noHTMLString",function(a){return new b.SafeString(a.replace(/<\/?[^>]+(>|$)/g,""))});b.registerHelper("or",function(){var a=f.last(arguments),
c=f.initial(arguments);return f.some(c)?a.fn(this):a.inverse(this)});b.registerHelper("nor",function(){var a=f.last(arguments),c=f.initial(arguments);return f.some(c)?a.inverse(this):a.fn(this)});b.registerHelper("pluralize",function(a,c,b){return a===1?c:b});b.registerHelper("and",function(){var a=f.last(arguments),c=f.initial(arguments);return f.every(c)?a.fn(this):a.inverse(this)});b.registerHelper("nand",function(){var a=f.last(arguments),c=f.initial(arguments);return f.every(c)?a.inverse(this):
a.fn(this)});b.registerHelper("if_eq",function(a,c,b){return a===c?b.fn(this):b.inverse(this)});b.registerHelper("if_ne",function(a,c,b){return a===c?b.inverse(this):b.fn(this)});b.registerHelper("if_num",function(a,c){return f.isNumber(a)?c.fn(this):c.inverse(this)});b.registerHelper("getImage",function(c){return a[c]});b.registerHelper("imgWithErrorHandler",function(a,c){f.isObject(c)||(a+=c);a=b.Utils.escapeExpression(a);return new b.SafeString('')});
b.registerHelper("formatLongDateTime",c.formatLongDateTime);b.registerHelper("constant",function(a){var c=e[a];c||(d.error("Reference to invalid string constant key in handlebars template: "+a),c="***INVALID CONSTANT KEY***");return c});b.registerHelper("icon",function(a,c){var d=$("").addClass("svg-icon svg-"+a).addClass(c).append($("").attr("xlink:href","#icon-"+a));return new b.SafeString(d.prop("outerHTML"))});b.registerHelper("check-box",function(a){var c=$("").addClass("svg-icon svg-checkbox"),
a=$("").addClass("squircle").append($("").attr("xlink:href","#icon-squircle-"+a)),d=$("").addClass("check").append($("").attr("xlink:href","#icon-squircle-check"));c.append(a).append(d);return new b.SafeString(c.prop("outerHTML"))});b.registerHelper("radio-button",function(){var a=$("").addClass("svg-icon svg-radio"),c=$("").addClass("svg-radio-outer").append($("").attr("xlink:href","#icon-radio-outer")),d=$("").addClass("svg-radio-inner").append($("").attr("xlink:href",
"#icon-radio-inner"));a.append(c).append(d);return new b.SafeString(a.prop("outerHTML"))})}}});
define("models/loading-model",["lodash","backbone","utils/scope"],function(f,g,b){var a=function(){this.wipeScreen=this.spinnerVisible=!1;this.pendingLoad={}};a.prototype={begin:function(a){this.pendingLoad[a]=!0;if(!this.spinnerVisible)this.spinnerVisible=!0,this.trigger("change:spinnerVisible")},end:function(a){delete this.pendingLoad[a];if(f.isEmpty(this.pendingLoad)){if(this.wipeScreen)this.wipeScreen=!1,this.trigger("change:wipeScreen");if(this.spinnerVisible)this.spinnerVisible=!1,this.trigger("change:spinnerVisible")}},
requestWipeScreen:function(){if(!this.wipeScreen)this.wipeScreen=!0,this.trigger("change:wipeScreen")}};a.getInstance=b.singleton(function(){return new a});f.extend(a.prototype,g.Events);return a});
define("utils/string-utils",[],function(){var f={ucFirst:function(f){f=f||"";return f.charAt(0).toUpperCase()+f.substring(1).toLowerCase()},ucFirstByWord:function(g){var b="",a="",g=(g||"").split(" "),c;for(c=0;c=a&&e<=c},_remapEvents:function(){var a=c.get("mouseEvents"),b=f.clone(this.events),d,e;for(d in b)d.substring(0,6)==="vmouse"&&(e=d.replace("vmousedown",a.vmousedown).replace("vmouseup",a.vmouseup).replace("vmouseout",a.vmouseout).replace("vmousemove",a.vmousemove),this.events[e]=
this.events[d],delete this.events[d])},_fetchAllFetchables:function(){var a=this.getFetchables(),c=[],b,d=this;f.result(this,"loadingSpinnerWipesScreen")&&this.loadingModel.requestWipeScreen();a?(i.trigger("viewFetchStart",this.cid),f.each(a,function(a){var b=new g.Deferred;c.push(b);a.fetch().always(b.resolve)}),f.result(this,"showLoadingSpinner")&&this.loadingModel.begin(this.cid),b=!0,g.when.apply(null,c).always(function(){i.trigger("viewFetchEnd",d.cid);d.hasFetched=!0;d.trigger("fetchablesDidFetch",
b);d.loadingModel.end(d.cid)}),b=!1):(this.hasFetched=!0,this._startListening())},_listenToLifecycleEvents:function(){this.disposeOnEvict&&this.listenTo(this,"evict",this.dispose)},_startListening:function(){if(!this._isListening)this.startListening(),this._isListening=!0},_onFetchablesComplete:function(a){a||this.render();this._startListening()},_stopListening:function(){this.stopListening();this._isListening=!1;this._listenToLifecycleEvents()}},{sanitizeId:function(a){a||(a="");a=l.safeB64Encode(a.toString())||
f.uniqueId();/^[^A-Za-z]/.test(a)&&(a="i"+a);return a}})});
define("views/wait-view-displayer",["jquery","handlebars","views/base-view"],function(f,g,b){var a=b.extend({template:g.getTemplate("dee-wait"),id:"dee-wait-background",className:"d-modal-overlay dee-wait-outer",initialize:function(a){a=a||{};this.displayText=a.displayText||"Please wait..."},render:function(){this.$el.html(this.template({displayText:this.displayText}));return this}},{NAME:"WaitView"}),c={show:function(b){c.waitView&&c.hide();c.waitView=new a(b);f("body").append(c.waitView.render().el)},
hide:function(){if(c.waitView)c.waitView.dispose(),c.waitView=null}};return c});define("models/app-layout-options-model",["models/base-model","utils/scope"],function(f,g){var b=f.extend({defaults:{allowSidebarExpansion:!0,hideNavigation:!1,hideSideBar:!1,hostPlayerBar:!0,isFullScreen:!1,showDevicePicker:!1},restoreDefaults:function(){this.set(this.defaults);return this}},{NAME:"AppLayoutOptionsModel",getInstance:g.singleton(function(){return new b})});return b});
define("views/sidebar-menu-view","lodash,backbone,handlebars,models/sidebar-menu-model,views/base-view,utils/to-do-multiplexer,app-oracle".split(","),function(f,g,b,a,c,d,e){var h=c.extend({showLoadingSpinner:!1,template:b.getTemplate("d-sidebar-menu"),tagName:"nav",className:"d-menu",focusOnKeyDown:!1,events:{"click dd":"_onMenuItemClick"},initialize:function(){f.bindAll(this,"render");this.todoMultiplexer=d.getInstance();this.model=a.getInstance()},startListening:function(){this.listenTo(this.model,
"change:menuItems",this.render);this.listenTo(this.model,"change:selected",this._onChangeSelected);this.listenTo(this.todoMultiplexer,"add remove reset change",this.render);e.get("tcomm")&&this.todoMultiplexer.startPolling(h.NAME)},getFetchables:function(){return[this.todoMultiplexer]},render:function(){this.$el.html(this.template({menu:this.model.get("menuGroups")}));this._onChangeSelected();return this},dispose:function(){this.todoMultiplexer.stopPolling(h.NAME);c.prototype.dispose.call(this)},
_onChangeSelected:function(){this.$(".d-menu-selected").removeClass("d-menu-selected");this.$("#"+this.model.get("selected")).addClass("d-menu-selected")},_onMenuItemClick:function(a){var c=this.$(a.currentTarget),a=c.data("action"),c=c.data("route");g.trigger(a,c,{clearStack:!0})}},{NAME:"SidebarMenuView"});return h});
define("views/layouts/base-layout",["lodash","views/base-view","utils/log"],function(f,g,b){var a={silent:!0,skipRender:!0},c=function(c){return function(){var e,h=f.clone(this._hostedViews),l=this.evict,g=this.host;f.each(h,function(c,b){c&&this.evict(b,a)},this);this.evict=function(){b.warn("Evict called from within render by a layout! This is an unsupported behaviour.");return l.apply(this,arguments)};this.host=function(){b.warn("Host called from within render by a layout! This is an unsupported behaviour.");
return g.apply(this,arguments)};e=c.apply(this,arguments);this.host=g;this.evict=l;f.each(h,function(c,b){c&&this.host(b,c,a)},this);return e}};return g.extend({regions:{},constructor:function(a){this._hostedViews={};this.render=c(this.render);g.apply(this,arguments);f.bindAll(this,"host","evict")},dispose:function(){f.each(this._hostedViews,function(a,c){a&&this.evict(c)},this);g.prototype.dispose.apply(this,arguments)},isHosted:function(a,c){return this._hostedViews[a]===c},host:function(a,c,b){b||
(b={});var l=this._hostedViews[a],g=b.skipRender||!(this.isTopLevel||this.isOnScreen);if(!f.isString(a))throw Error("Missing region name argument to host method");if(l===c)return this;else l&&this.evict(a,b);if(!c)return this;this.$(this.regions[a]).html(c.el);this._hostedViews[a]=c;b.silent||(g||c.onScreen(),c.trigger("host"));return this},evict:function(a,c){c||(c={});var b=this._hostedViews[a],l=c.silent;if(!b)return this;l||b.trigger("pre-evict");delete this._hostedViews[a];b.$el.detach();l||
(this.isTopLevel&&b.offScreen(),b.trigger("evict"));return this},onScreen:function(){g.prototype.onScreen.apply(this,arguments);f.invoke(this._hostedViews,"onScreen")},offScreen:function(){g.prototype.offScreen.apply(this,arguments);f.invoke(this._hostedViews,"offScreen")}})});
define("views/scroll/base-scroll-layout",["jquery","views/layouts/base-layout"],function(f,g){return g.extend({className:"d-scroll-window",regions:{scrollContent:".d-scroll-content"},hostContent:function(b){this.content&&this.stopListening(this.content);this.content=b;this.listenTo(this.content,"scrollTo",this.scrollTo);this.listenTo(this.content,"scrollBy",this.scrollBy);this.listenTo(this.content,"scrollToElement",this.scrollToElement);this.listenTo(this.content,"setScrollerParam",this.setScrollerParam);
this.host("scrollContent",this.content)},getContent:function(){return this.content},render:function(){this.$el.html(f(''));return this},scrollTo:f.noop,scrollBy:f.noop,scrollToElement:f.noop,setScrollerParam:f.noop},{NAME:"BaseScrollLayout"})});define("iscroll",[],function(){return window.IScroll});
define("views/scroll/iscroll-layout","lodash,jquery,backbone,views/scroll/base-scroll-layout,iscroll,app-oracle,models/platform-model,utils/user-agent,utils/scope,models/form-factor-model".split(","),function(f,g,b,a,c,d,e,h,l,i){return a.extend({initialize:function(a){this.options=a||{};h.is(h.ANDROID)&&this._bindFocusScrollHandler();f.bindAll(this,"_initializeScroller","_onScroll");this.platform=e.getInstance();this.scrollPosition=this.options.scrollPosition||0;this.scrollerInitialized=g.Deferred();
this.minScrollY=this.maxScrollY=0},startListening:function(){this.listenTo(this,"evict",function(){this._destroyScroller()})},offScreen:function(){this._destroyScroller();a.prototype.offScreen.apply(this,arguments)},dispose:function(){this._destroyScroller();a.prototype.dispose.apply(this,arguments)},render:function(){this.scrollerInitialized=g.Deferred();f.defer(this._initializeScroller);return a.prototype.render.apply(this,arguments)},scrollTo:function(a){var c=this;this.scrollerInitialized.done(function(){c.scroller&&
(c.scroller.refresh(),c.scroller.scrollTo(0,a))})},scrollBy:function(a){var c=this;this.scrollerInitialized.done(function(){c.scroller.refresh();c.scroller.scrollBy(0,a)})},scrollToElement:function(a,c,b){var d=this;this.scrollerInitialized.done(function(){d.scroller.refresh();d.scroller.scrollToElement(a,c,0,b)})},setScrollerParam:function(a,c){this[a]=c},_bindFocusScrollHandler:function(){var a=i.getInstance(),c=this;this.$el.on("focusin.focusScrollHandler","input:text,input:password,textarea",
function(){var b=g(this);c.listenTo(a,"resize",f.debounce(function(){c.scrollToElement(b[0],0,-50);c.stopListening(a,"resize")}),250)})},_destroyScroller:function(){clearInterval(this._scrollEventInterval);if(this.scroller)this.scrollPosition=this.scroller.y,this.scroller.destroy(),this.scroller=null;if(this.observer)this.observer.disconnect(),this.observer=null;this.$el.off("mousewheel")},_initializeScroller:function(){this._destroyScroller();this.scroller=new c(this.el,this._getScrollOptions());
this.platform.supports("touch")||(this._attachKeyEvents(),this._attachMouseWheelEvents());this._attachScrollEvents();this._patchIScrollTranslate();this._attachDOMModifiedEvents();this.scrollerInitialized.resolve()},_getScrollOptions:function(){var a=this.platform.supports("touch")?{}:{mouseWheel:!0,disableMouse:!0,scrollbars:this.options.hideScrollbar?!1:"custom",interactiveScrollbars:!this.options.hideScrollbar,keyBindings:!this.options.disableKeyboardScrolling};a.preventDefault=!1;a.startY=this.scrollPosition;
return a},_attachMouseWheelEvents:function(){var a=this,c=f.debounce(function(){a.mouseIsWheeling=!1},100);this.$el.on("mousewheel",function(){if(!a.mouseIsWheeling&&a.scroller)a.mouseIsWheeling=!0,a.scroller._execEvent("scrollStart");c()})},_attachKeyEvents:function(){var a=this.options.emitScrollStart,c=this.options.emitScroll,b=this.options.emitScrollEnd,d,e=this;if((a||c||b)&&!this.options.disableKeyboardScrolling)d=this.scroller._key,this.scroller._key=function(h){d.apply(this,arguments);f.contains(this.options.keyBindings,
h.keyCode)&&(a&&e.content.trigger("scrollStart"),c&&e.content.trigger("scroll"),b&&e.content.trigger("scrollEnd"))}},_attachDOMModifiedEvents:function(){var a,c,e=this;c=f.debounce(function(){e.scroller&&e.scroller.refresh()},100);if(!this.platform.supports("touch"))a=d.get("mutationObserver").constructor,this.observer=new a(c),this.observer.observe(this.el,{childList:!0,subtree:!0});this.listenTo(b,"DOMModified",c)},_attachScrollEvents:function(){var a=this;this.scroller.on("scrollStart",f.bind(this._onScrollStart,
this,this.options.emitScrollStart,this.options.emitScroll));this.scroller.on("scrollEnd",f.bind(this._onScrollEnd,this,this.options.emitScrollEnd));g(this.scroller.wrapper).scroll(function(){var c=g(this),b=c.scrollTop();b>0&&(c.scrollTop(0),a.scroller.scrollTo(0,a.scroller.y-b))})},_patchIScrollTranslate:function(){var a=this.scroller._translate,c=this.scroller,b=this;c._translate=function(d,e){var h=c.maxScrollY-b.maxScrollY,l=b.minScrollY;e>l?e=l:eb.clientHeight)?(d=(d=c&&c.touches&&c.touches[0])&&d.pageY,d=a>d,h=b.scrollTop+b.clientHeight>=b.scrollHeight,e=!d,b=b.scrollTop===0,d&&h?c.preventDefault():e&&b&&c.preventDefault()):c.preventDefault():c.preventDefault()};document.addEventListener("touchstart",c);document.addEventListener("touchmove",b,!1);return{stopListening:function(){document.removeEventListener(c);document.removeEventListener(b)},onTouchStart:c,onTouchMove:b}})})});
define("utils/key-codes",{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,NAV:[33,34,35,36,37,38,39,40]});
define("views/scroll/overflow-scroll-layout",["lodash","backbone","views/scroll/base-scroll-layout","utils/user-agent","utils/key-codes"],function(f,g,b,a,c){return b.extend({className:"d-scroll-window overflow",initialize:function(){var c,b=this;this.scrollPosition=this.options.scrollPosition;c=f.debounce(function(){g.trigger("loadImagesInViewport")},500);this.$el.on("scroll",f.throttle(function(){b._onScroll();c()},50));a.is("iOS")&&this.$el.addClass("ios")},onScreen:function(){this._registerKeyScroll(this.content);
b.prototype.onScreen.apply(this,arguments);this.el.scrollTop=this.scrollPosition},_registerKeyScroll:function(a){a&&a.focusOnKeyDown!==!1&&($(document).off("keydown.focus"),$(document).one("keydown.focus",function(b){f.contains(c.NAV,b.keyCode)&&a.$el.attr("tabIndex",0).focus()}))},scrollTo:function(a){this.el.scrollTop=a},scrollBy:function(a){this.el.scrollTop+=a},scrollToElement:function(a,c,b){c=this.$el.offset()||{};this.el.scrollTop+=(($(a).offset()||{}).top||0)-(c.top||0)+b},_onScroll:function(){this.scrollPosition=
this.el.scrollTop;this.content.trigger("scroll")}},{NAME:"OverflowScrollLayout"})});define("views/layouts/scroll-layout",["models/platform-model","views/scroll/iscroll-layout","views/scroll/overflow-scroll-layout"],function(f,g,b){return f.getInstance().supports("overflowScrolling")?b:(g.setUpEventForwarding(),g)});
define("utils/sidebar-touch-gesture-tracker",["lodash","backbone","models/sidebar-menu-model","models/app-layout-options-model","models/form-factor-model"],function(f,g,b,a,c){var d={startX:20,captureX:20,cancelY:40,flingSpeed:0.3},e=function(a){this.initialize(a)};f.extend(e.prototype,{initialize:function(e){e=f.extend({thresholds:d},e);this.menuWidth=e.menuWidth;this.thresholds=e.thresholds;this.menuModel=b.getInstance();this.formFactorModel=c.getInstance();this.appLayoutOptionsModel=a.getInstance();
f.bindAll(this,"onTouchStart","onTouchMove","onTouchEnd");this.captured=this.started=!1;this.startOffset={x:0,y:0};this.captureOffset={};this.startTime=0},startListening:function(){window.addEventListener("touchstart",this.onTouchStart);window.addEventListener("touchmove",this.onTouchMove);window.addEventListener("touchend",this.onTouchEnd);this.listenTo(g,"onMobileAppResume",this.onTouchEnd)},stopListening:function(){g.prototype.stopListening.apply(this,arguments);window.removeEventListener("touchend",
this.onTouchEnd);window.removeEventListener("touchmove",this.onTouchMove);window.removeEventListener("touchstart",this.onTouchStart)},onTouchStart:function(a){var a=this.getTouchOffset(a),c=this.menuModel.get("isOpen"),b=f.result(this,"menuWidth"),d;if(a&&this.formFactorModel.isSidebarCollapsible()&&this.appLayoutOptionsModel.get("allowSidebarExpansion")&&(d=!c&&a.x0,d||c))this.startOffset=a,this.startTime=new Date,this.started=!0},onTouchMove:function(a){var c,
b;b=this.getTouchOffset(a);var d;if(b)if(this.captured)this.captureOffset={x:Math.max(Math.min(b.x,f.result(this,"menuWidth")),0),y:0},this.menuModel.set("openOffset",this.captureOffset.x),a.preventDefault();else if(this.started)if(d=this.menuModel.get("isOpen"),c=b.x-this.startOffset.x,b=b.y-this.startOffset.y,b>this.thresholds.cancelY||b<-this.thresholds.cancelY)this.started=!1;else{b=!d&&c>this.thresholds.captureX;c=d&&cthis.thresholds.flingSpeed?this.menuModel.set("isOpen",a>0):this.menuModel.set("isOpen",this.captureOffset.x>f.result(this,"menuWidth")/2),event.preventDefault());this.captured=this.started=!1},getTouchOffset:function(a){if(a&&a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}}});f.extend(e.prototype,
g.Events);return e});
define("views/sidebar-view","lodash,jquery,handlebars,models/form-factor-model,models/sidebar-menu-model,views/sidebar-menu-view,views/layouts/base-layout,views/layouts/scroll-layout,models/platform-model,models/app-layout-options-model,utils/sidebar-touch-gesture-tracker".split(","),function(f,g,b,a,c,d,e,h,l,i,j){return e.extend({template:b.getTemplate("d-sidebar"),regions:{menu:".d-sidebar-menu-window"},className:"d-sidebar-layout",initialize:function(){f.bindAll(this,"_setClosed","_insertPageClickInterceptor",
"_removePageClickInterceptor");this.model=c.getInstance();this.formFactorModel=a.getInstance();this.sidebarMenuView=new h({disposeOnEvict:!1,disableKeyboardScrolling:!0});this.sidebarMenuView.hostContent(new d);this.platform=l.getInstance();this.appLayoutOptionsModel=i.getInstance();this.touchGestureTracker=new j({menuWidth:f.bind(this._getMenuWidth,this)});this.host("menu",this.sidebarMenuView)},dispose:function(){this.touchGestureTracker.stopListening();e.prototype.dispose.apply(this,arguments)},
startListening:function(){this.listenTo(this.model,"change:isOpen",this._onIsOpenChange);this.listenTo(this.model,"change:openOffset",this._onOffsetChange);this.listenTo(this.formFactorModel,"change:formFactor",this._setClosed);this.touchGestureTracker.startListening()},render:function(){this.$el.html(this.template());return this},_onIsOpenChange:function(a,c){c?this._doOpen():this._doClose()},_onOffsetChange:function(a,c){this._getPageElements().addClass("no-animation").css("transform","translate3d("+
c+"px, 0, 0)")},_doOpen:function(){this.appLayoutOptionsModel.get("allowSidebarExpansion")&&(this._getPageElements().removeClass("no-animation").css("transform","translate3d("+this._getMenuWidth()+"px, 0, 0)"),f.delay(this._insertPageClickInterceptor,250))},_doClose:function(){this._getPageElements().removeClass("no-animation").css("transform","translate3d(0, 0, 0)");f.delay(this._removePageClickInterceptor,250)},_insertPageClickInterceptor:function(){this._removePageClickInterceptor();this.$pageClickInterceptor=
g("
").addClass("d-sidebar-page-click-interceptor").css("left",this._getMenuWidth()).click(this._setClosed).insertBefore(this._getPageElements().first())},_removePageClickInterceptor:function(){if(this.$pageClickInterceptor)this.$pageClickInterceptor.remove(),this.$pageClickInterceptor=null},_setClosed:function(){this.model.set({isOpen:!1})},_getPageElements:function(){if(!this.$pageElements||!this.$pageElements.length)this.$pageElements=g.merge(g("#d-app"),g("#d-player-bar-container"));return this.$pageElements},
_getMenuWidth:function(){if(!this.menuWidth)this.menuWidth=this.$(this.regions.menu).outerWidth();return this.menuWidth}},{NAME:"SidebarView"})});
define("models/bluetooth-state-model",["constants","models/base-model","utils/poll-mixin"],function(f,g,b){var a=g.extend({urlRoot:function(){return this.collection.url+"/"+this.get("deviceType")+"/"+this.get("softwareVersion")},idAttribute:"deviceSerialNumber",defaults:{deviceType:null,deviceSerialNumber:null,softwareVersion:null,streamingState:null,online:!1,sconePaired:!1,sconeBattery:null},onFetchError:function(){this.set("streamingState",null);this.set("online",!1)},fetch:function(a){var b=this;
return g.prototype.fetch.call(this,a).fail(function(){b.onFetchError()})},isSconeBatteryLow:function(){var c=this.get("sconeBattery");return c!==null&&c").attr("id",c).addClass("d-button d-control-button");g.each(a,function(a){a=f("").addClass("svg-icon music-control no-events").addClass("svg-"+a).append(f("").attr("xlink:href","#icon-"+a));b.append(a.prop("outerHTML"))});return b},l=a.extend({showLoadingSpinner:!1,
className:"d-controls-container",events:{"click #d-next":"_onNextClick","click #d-repeat":"_onRepeatClick","click #d-shuffle":"_onShuffleClick","click #d-previous":"_onPreviousClick","click #d-play-pause":"_onPlayPauseClick","vmousedown .d-control-button":"_onPress","vmouseup .d-control-button":"_onRelease","vmouseout .d-control-button":"_onRelease"},initialize:function(){this.model=c.getInstance();this.deviceCollection=d.getInstance();this.repeatButton=h("d-repeat","repeat");this.previousButton=
h("d-previous","previous");this.playPauseButton=h("d-play-pause","play","pause");this.nextButton=h("d-next","next");this.shuffleButton=h("d-shuffle","shuffle");this.$el.append(this.shuffleButton,this.previousButton,this.playPauseButton,this.nextButton,this.repeatButton);this.$el.children().after(" ");this.onProviderCapabilitiesChange();this.onPlayingStateChange()},getFetchables:function(){return[this.model,this.deviceCollection]},startListening:function(){this.listenTo(this.model,"change:currentState",
this.onPlayingStateChange);this.listenTo(this.model,"change:shuffling",this.onShufflingChange);this.listenTo(this.model,"change:looping",this.onLoopingChange);this.listenTo(this.model,"change:providerCapabilities",this.onProviderCapabilitiesChange)},render:function(){this.hasFetched&&(this.onPlayingStateChange(),this.onShufflingChange(null,this.model.get("shuffling")),this.onLoopingChange(null,this.model.get("looping")),this.onProviderCapabilitiesChange());return this},onPlayingStateChange:function(){this.playPauseButton.toggleClass("pause",
this.model.isPlaying())},onProviderCapabilitiesChange:function(){var a=this.model.get("providerCapabilities")||{};a.canRepeatAll?this.repeatButton.removeClass("off d-hidden"):(this.repeatButton.addClass("off"),this.model.get("referenceId")&&this.repeatButton.addClass("d-hidden"));a.canPrevious?this.previousButton.removeClass("off"):this.previousButton.addClass("off");a.canPlay?this.playPauseButton.removeClass("off"):this.playPauseButton.addClass("off");a.canNext?this.nextButton.removeClass("off"):
this.nextButton.addClass("off");a.canShuffle?this.shuffleButton.removeClass("off d-hidden"):(this.shuffleButton.addClass("off"),this.model.get("referenceId")&&this.shuffleButton.addClass("d-hidden"))},onShufflingChange:function(a,c){c?this.shuffleButton.addClass("on"):this.shuffleButton.removeClass("on")},onLoopingChange:function(a,c){c?this.repeatButton.addClass("on"):this.repeatButton.removeClass("on")},_onPress:function(a){f(a.currentTarget).addClass("press")},_onRelease:function(a){f(a.currentTarget).removeClass("press")},
_onNextClick:function(a){l.next(f(a.currentTarget));return!1},_onRepeatClick:function(a){l.repeat(f(a.currentTarget));return!1},_onShuffleClick:function(a){l.shuffle(f(a.currentTarget));return!1},_onPreviousClick:function(a){l.previous(f(a.currentTarget));return!1},_onPlayPauseClick:function(a){l.playPause(f(a.currentTarget),this.model.get("referenceId"));return!1}},{NAME:"ControlsView",inFlightRequest:!1,playPause:function(a,d){if(a.hasClass("off")||l.inFlightRequest)return!1;var h=c.getInstance(),
f=h.get("referenceId"),g,o;d===f?g=a.hasClass("pause")?"stop":"play":(g="jump",o={referenceId:d});a.addClass("waiting");l.inFlightRequest=!0;return e[g](o).done(function(){g==="stop"?h.set("currentState",c.INTERRUPTED):h.set("currentState",c.PLAYING)}).fail(function(){a.removeClass("loading");b.trigger("showMessage","Unable to "+g,"Please try again")}).always(function(){a.removeClass("waiting");l.inFlightRequest=!1})},next:function(a){if(a.hasClass("off")||l.inFlightRequest)return!1;var d,h,f=c.getInstance();
a.addClass("waiting");d=function(a){a&&a.errorMessage?b.trigger("showMessage",a.errorMessage):b.trigger("showMessage","Unable to go to next track","Please try again")};h=function(){a.removeClass("waiting");l.inFlightRequest=!1};l.inFlightRequest=!0;f.shouldStopOnNext()?e.stop().fail(d).always(h):e.next().fail(d).always(h);return!1},previous:function(a){if(a.hasClass("off")||l.inFlightRequest)return!1;a.addClass("waiting");l.inFlightRequest=!0;e.previous().fail(function(){b.trigger("showMessage","Unable to go to previous track",
"Please try again")}).always(function(){a.removeClass("waiting");l.inFlightRequest=!1});return!1},shuffle:function(a){if(a.hasClass("off")||l.inFlightRequest)return!1;var d=c.getInstance(),h=d.get("shuffling"),f=h?"resetShufflingMode":"shuffle";d.set("shuffling",!h);l.inFlightRequest=!0;e[f]().fail(function(){d.set("shuffling",h);b.trigger("showMessage","Unable to "+f,"Please try again")}).always(function(){l.inFlightRequest=!1});return!1},repeat:function(a){if(a.hasClass("off")||l.inFlightRequest)return!1;
var d=c.getInstance(),h=d.get("looping"),f=h?"resetLoopingMode":"repeatAll";d.set("looping",!h);l.inFlightRequest=!0;e[f]().fail(function(){d.set("looping",h);b.trigger("showMessage","Unable to "+f,"Please try again")}).always(function(){l.inFlightRequest=!1});return!1}});return l});
define("views/slider-view","lodash,jquery,handlebars,views/base-view,app-oracle,utils/user-agent,models/platform-model,models/form-factor-model".split(","),function(f,g,b,a,c,d,e,h){var l={sizeProperty:"height",updateSizes:function(){this.sliderTrackHeight=this.$(".d-slider-track").height();this.sliderBar=this.$(".d-slider-bar");this.platform.supports("cssTransitions")||this.sliderBar.addClass("d-slider-grabber-no-transition")},_computeSliderValue:function(a){return(this.sliderTrackHeight-this.sliderGrabberInitialPosition.top+
(this.sliderGrabberInitialPosition.y-(a.originalEvent.touches?a.originalEvent.touches[0].pageY:a.originalEvent.pageY)))/this.sliderTrackHeight*this.maxValue},getInitialPosition:function(a){return{y:a.originalEvent.touches?a.originalEvent.touches[0].pageY:a.originalEvent.pageY,top:this.$(a.currentTarget).parent().position().top}},onSliderTrackClick:function(a){var c=this,b=f.isUndefined(a.offsetY)?this._calculateOffsetFromPageCoordinate(a):a.offsetY;a.stopPropagation();a=a.target===this.sliderBar[0]?
this.sliderBar.height()-b+this.$(".d-slider-grabber").height():this.sliderTrackHeight-b;a=a/this.sliderTrackHeight*this.maxValue;this.setSliderValue(a);this.notifySliderValueChange();f.delay(function(){c.trigger("sliderReleased")},350)},_calculateOffsetFromPageCoordinate:function(a){return a.pageY-g(a.target).offset().top}},i={sizeProperty:"width",updateSizes:function(){this.halfGrabberWidth=this.$(".d-slider-grabber").width()/2;this.sliderBarWidth=this.$(".d-slider-track").width();this.sliderBar=
this.$(".d-slider-bar");this.platform.supports("cssTransitions")||this.sliderBar.addClass("d-slider-grabber-no-transition")},_computeSliderValue:function(a){return(this.sliderGrabberInitialPosition.left+((a.originalEvent.touches?a.originalEvent.touches[0].pageX:a.originalEvent.pageX)-this.sliderGrabberInitialPosition.x)+this.halfGrabberWidth)/this.sliderBarWidth*this.maxValue},getInitialPosition:function(a){return{x:a.originalEvent.touches?a.originalEvent.touches[0].pageX:a.originalEvent.pageX,left:this.$(a.currentTarget).position().left}}};
return a.extend({template:b.getTemplate("d-slider"),className:"d-slider-container",events:{"vmousedown .d-slider-grabber":"onSliderPress","click .d-slider-track":"onSliderTrackClick"},initialize:function(a){var a=a||{},b=c.get("mouseEvents");this.theme=a.theme;this.maxValue=a.maxValue||100;this.mouseUpEvent=b.vmouseup;this.mouseMoveEvent=b.vmousemove;this.notifySliderValueChangeThrottled=f.throttle(this.notifySliderValueChange,250);this.orientation=a.orientation||"horizontal";f.extend(this,this.orientation===
"horizontal"?i:l);this.onSliderMove=f.throttle(this._onSliderMove,this._uiThrottleValue());this.grabberEngaged=!1;this.platform=e.getInstance();f.bindAll(this,"onSliderMove","onSliderRelease","updateSizes","disengageGrabber")},engageGrabber:function(){this.grabberEngaged=!0;this.$(".d-slider-bar").addClass("d-slider-grabber-engaged");clearTimeout(this.grabberDisengageDelay);this.trigger("sliderEngaged")},disengageGrabber:function(){this.$(".d-slider-bar").removeClass("d-slider-grabber-engaged");this.grabberEngaged=
!1},startListening:function(){this.listenTo(h.getInstance(),"resize",this.updateSizes)},stopListening:function(){a.prototype.stopListening.apply(this,arguments);this.unbindMouseEvents()},render:function(){this.$el.html(this.template());this.$el.addClass(this.orientation);f.defer(this.updateSizes);return this},onSliderPress:function(a){a.stopPropagation();d.is("Android")&&a.preventDefault();this.sliderGrabberInitialPosition=this.getInitialPosition(a);this.bindMouseEvents();this.engageGrabber()},bindMouseEvents:function(){g(document).on(this.mouseMoveEvent,
this.onSliderMove);g(document).on(this.mouseUpEvent,this.onSliderRelease)},unbindMouseEvents:function(){g(document).off(this.mouseMoveEvent,this.onSliderMove);g(document).off(this.mouseUpEvent,this.onSliderRelease)},_onSliderMove:function(a){this._setSliderValue(this._computeSliderValue(a));this.notifySliderValueChangeThrottled()},onSliderRelease:function(){this.unbindMouseEvents();this.notifySliderValueChange();this.grabberDisengageDelay=f.delay(this.disengageGrabber,1E3);this.trigger("sliderReleased")},
setSliderValue:function(a){this.grabberEngaged||(this.updateSizes(),this._setSliderValue(a))},_setSliderValue:function(a){this.value=Math.round(Math.max(0,Math.min(this.maxValue,a)));this.sliderBar&&this.sliderBar.css(this.sizeProperty,this.value/this.maxValue*100+"%")},getSliderValue:function(){return this.value},showHideSlider:function(a){this.$(".d-slider-bar").toggle(a);a&&f.defer(this.updateSizes)},onSliderTrackClick:function(){},notifySliderValueChange:function(){this.trigger("sliderChange",
this.value)},_uiThrottleValue:function(){return 15}},{NAME:"SliderView"})});
define("views/nowplaying/volume-view","lodash,jquery,backbone,handlebars,models/player-model,collections/device-collection,views/layouts/base-layout,views/slider-view,utils/user-agent,music-player".split(","),function(f,g,b,a,c,d,e,h,l,i){return e.extend({showLoadingSpinner:!1,id:"d-volume-container",template:a.getTemplate("nowplaying/d-volume"),regions:{slider:".d-volume-slider",showHideButton:".d-show-volume-button"},events:{"click .d-show-volume-button":"onShowButtonPress","click .d-volume-overlay":"hideVolumeSlider"},
initialize:function(a){a=a||{};this.playerModel=c.getInstance();this.deviceCollection=d.getInstance();this.theme=a.theme;this.sliderView=new h({orientation:"vertical"});this.host("slider",this.sliderView);this.enabled=!1;f.bindAll(this,"hideVolumeSlider")},render:function(){if(this.hasFetched){var a=this;f.defer(function(){a.sliderView&&(a.playerModel.get("muted")?a.sliderView.setSliderValue(0):a.sliderView.setSliderValue(a.playerModel.get("volume")),a.updateVolumeCallout())});this.$el.html(this.template({transformFix:l.is("Android 4.3-")})).addClass(this.theme);
this.hideVolumeSlider()}return this},getFetchables:function(){return[this.playerModel,this.deviceCollection]},startListening:function(){this.listenTo(this.playerModel,"change:volume",this.onVolumeChange);this.listenTo(this.playerModel,"change:muted",this.onMuteChange);this.listenTo(this.playerModel,"change:referenceId",this.onReferenceIdChange);this.listenTo(this.sliderView,"sliderChange",this.onSliderChange);this.listenTo(this.sliderView,"sliderEngaged",this.onSliderEngaged);this.listenTo(this.sliderView,
"sliderReleased",this.hideVolumeSlider);this.listenTo(this.deviceCollection,"change:selectedDevice",this.hideVolumeSlider);this.listenTo(this.deviceCollection,"change:online",f.bind(function(a){a.get("serialNumber")===this.deviceCollection.getCurrentlySelectedDevice().get("serialNumber")&&this.hideVolumeSlider()},this))},onVolumeChange:function(){this.sliderView.value!==this.playerModel.get("volume")&&this.sliderView.setSliderValue(this.playerModel.get("volume"));this.updateVolumeCallout()},onMuteChange:function(){this.playerModel.get("muted")?
this.sliderView.setSliderValue(0):this.sliderView.setSliderValue(this.playerModel.get("volume"));this.updateVolumeCallout()},onSliderChange:function(a){var c=this.playerModel.deviceCollection.getCurrentlySelectedDevice();c?c.get("online")?(!this.playerModel.get("muted")&&this.playerModel.set("volume",a),a!==0&&this.playerModel.get("muted")&&this.playerModel.set("muted",!1),i.volume({deviceSerialNumber:c.get("serialNumber"),deviceType:c.get("deviceType"),newVolumeLevel:a}).fail(this.volumeError),this.updateVolumeCallout()):
b.trigger("showMessage","Unable to set volume.","Device is not online."):b.trigger("showMessage","Unable to set volume.","No device is selected.")},onReferenceIdChange:function(){this.playerModel.get("referenceId")||this.hideVolumeSlider()},updatePageClickInterceptor:function(){var a,c;this.$pageClickInterceptor&&this.$pageClickInterceptor.remove();this.$pageClickInterceptor=null;if(this.enabled)a=g("").addClass("d-volume-overlay"),a.prependTo(g("#d-page")),c=g("#d-player-bar-container"),c.find(".d-player-bar").length&&
a.clone().prependTo(c),this.$pageClickInterceptor=g(".d-volume-overlay"),this.$pageClickInterceptor.on("click",this.hideVolumeSlider)},hideVolumeSlider:function(){this.enabled=!1;this.sliderView.$el.hide();this.$(".d-volume-callout").hide();this.$(".d-volume-overlay").hide();this.updatePageClickInterceptor()},onShowButtonPress:function(){var a=this.playerModel.deviceCollection.getCurrentlySelectedDevice();a&&a.get("online")&&this.playerModel.get("referenceId")&&this.togglePopup()},togglePopup:function(){this.enabled=
!this.enabled;this.sliderView.$el.toggle(this.enabled);this.$(".d-volume-overlay").toggle(this.enabled);this.$(".d-volume-callout").hide();this.updatePageClickInterceptor()},onSliderEngaged:function(){this.updateVolumeCallout();this.$(".d-volume-callout").show()},updateVolumeCallout:function(){this.$(".d-volume-callout").text(this.calculateVolumeCalloutValue(this.sliderView.getSliderValue()))},calculateVolumeCalloutValue:function(a){return Math.ceil(a/11)},dispose:function(){this.enabled=!1;this.updatePageClickInterceptor();
e.prototype.dispose.apply(this,arguments)},volumeError:f.debounce(function(){b.trigger("showMessage","Unable to set your volume.")},250,!0)},{NAME:"VolumeView"})});
define("views/image-view",["lodash","jquery","backbone","views/base-view"],function(f,g,b,a){return a.extend({initialize:function(a){a||(a={});f.bindAll(this,"_onLoad","_onError","_loadImageIfInViewport");this.noCache=a.noCache;this.fade=!f.isUndefined(a.fade)?a.fade:!0;this.fadeTime=a.fadeTime||250;this.forceLoad=a.forceLoad;this.defaultSrc=a.defaultSrc||"";this.src=a.src;this.$el.css({"background-image":'url("'+this.defaultSrc+'")',"background-repeat":"no-repeat",height:a.height,width:a.width});
this.$img=g("").height("100%").width("100%").attr("alt",a.alt)},render:function(){f.defer(this._loadImageIfInViewport);return this},setSource:function(a){var b=function(){e.fade&&e.$img.animate({opacity:0},e.fadeTime);e.$el.css({"background-image":'url("'+e.defaultSrc+'")'})},e=this;if(a){if(a!==this.src)b(),this.src=a,this._loadImageIfInViewport()}else b(),this.clearSource();return this},getSource:function(){return this.src},clearSource:function(){this.src=null;this.stopListening();this.$img.attr("src",
this.src).css("visibility","hidden")},_loadImageIfInViewport:function(){var a;this.src&&(!this.forceLoad&&!this.isInViewport()?this._listenToLoadImagesInViewport():(this.stopListening(),a=this.noCache?"?_="+Date.now():"",this.$img.on("load",this._onLoad).on("error",this._onError).attr("src",this.src+a).css("visibility","visible")))},_listenToLoadImagesInViewport:function(){if(!this.isListening)this.listenTo(b,"loadImagesInViewport",this._loadImageIfInViewport),this.isListening=!0},_onLoad:function(){this.fade&&
this.$img.css({opacity:0});this.$el.html(this.$img);this.fade&&this.$img.animate({opacity:1},this.fadeTime);this.$img.off("load error");this.$el.css("background-image","")},_onError:function(){this.$img.off("load error")}},{NAME:"ImageView"})});
define("views/nowplaying/info-view","lodash,handlebars,utils/music-provider,models/player-model,views/base-view,views/image-view,utils/music-metadata-parser".split(","),function(f,g,b,a,c,d,e){return c.extend({showLoadingSpinner:!1,template:g.getTemplate("nowplaying/d-info"),initialize:function(c){var b;this.model=a.getInstance();b=this.model.getCurrentlyPlayingMedia();this.alwaysShowProvider=c&&c.alwaysShowProvider;this.albumArtView=new d({src:b?b.get("imageURL"):"",forceLoad:!0})},getFetchables:function(){return[this.model]},
startListening:function(){this.listenTo(this.model,"change:referenceId",this.render)},render:function(){if(!this.hasFetched||!this.model.get("referenceId"))return this.$el.empty(),this;var a=this.model.getCurrentlyPlayingMedia(),c=this._shouldShowProvider(a),b;a&&(b=e.parseNowPlayingActive(a.toJSON()));this.$el.html(this.template({showProvider:c,providerClass:this._getProviderClass(a),metadata:b}));c||(a=a&&a.get("imageURL"),this.albumArtView.setSource(a),this.$(".d-album-art-wrapper").html(this.albumArtView.render().el));
return this},_getProviderClass:function(a){var c;if(a){switch(a.get("service")){case b.DIGITAL_MUSIC_STORE.serviceName:case b.CLOUD_PLAYER.serviceName:case b.ROBIN.serviceName:c="amazon-music";break;case b.I_HEART_RADIO_LIVE.serviceName:case b.I_HEART_RADIO_TALK.serviceName:case b.I_HEART_RADIO.serviceName:c="iheart";break;case b.TUNE_IN.serviceName:c="tunein"}return c}},_shouldShowProvider:function(a){if(this.alwaysShowProvider)return!0;a=a&&a.get("service");return f.contains([b.I_HEART_RADIO_LIVE.serviceName,
b.I_HEART_RADIO_TALK.serviceName,b.I_HEART_RADIO.serviceName,b.TUNE_IN.serviceName],a)}},{NAME:"InfoView"})});
define("views/nowplaying/bluetooth-info-view",["views/base-view","handlebars","collections/bluetooth-state-collection","models/bluetooth-state-model"],function(f,g,b,a){return f.extend({className:"bluetooth-info-view",template:g.getTemplate("nowplaying/d-bluetooth-info"),initialize:function(){this.bluetoothStateCollection=b.getInstance();return this},getFetchables:function(){return[this.bluetoothStateCollection]},startListening:function(){this.listenTo(this.bluetoothStateCollection,"change:streamingState",
this.render)},render:function(){this.$el.html(this.template({isStreamingMusic:this.bluetoothStateCollection.currentDeviceStreamingState()===a.BLUETOOTH_STREAMING_STATE_MUSIC}));return this}},{NAME:"BluetoothInfoView"})});
define("views/player-bar-view","lodash,backbone,handlebars,models/form-factor-model,models/player-model,collections/bluetooth-state-collection,views/nowplaying/controls-view,views/nowplaying/volume-view,views/nowplaying/info-view,views/nowplaying/bluetooth-info-view,views/layouts/base-layout".split(","),function(f,g,b,a,c,d,e,h,l,i,j){var k=j.extend({showLoadingSpinner:!1,template:b.getTemplate("d-player-bar"),className:"d-player-bar",regions:{infoView:".d-meta-container",controls:".d-controls-region",
volumeSlider:".d-volume"},views:{controlsView:e,infoView:l,bluetoothInfoView:i,volumeView:h},events:{click:"onClick","click .d-volume-region":"onSuppressClick"},initialize:function(b){f.bindAll(this,"onResize","onTrackChange");this.playerModel=c.getInstance();this.bluetoothStateCollection=d.getInstance();this.updateParams(b);this.formFactorModel=a.getInstance();this._updatePlayerBarContent()},updateParams:function(){this.getView("infoView").render();this.onTrackChange()},getFetchables:function(){return[this.playerModel,
this.bluetoothStateCollection]},startListening:function(){this.listenTo(this.playerModel,"change:referenceId",this.onTrackChange);this.listenTo(this,"stateChanged:playerbar",this.onResize);this.listenTo(this.formFactorModel,"resize",this.onResize);this.playerModel.startPolling(k.POLLING_REQUESTOR_ID);this.listenTo(this.bluetoothStateCollection,"change change:streamingState",this._updatePlayerBarContent);this._updatePlayerBarContent();this.onResize()},stopListening:function(){this.playerModel.stopPolling(k.POLLING_REQUESTOR_ID);
j.prototype.stopListening.apply(this,arguments)},render:function(){this.$el.html(this.template({barSizeClass:this.formFactorModel.get("formFactor")==="small"?"small":"large",visible:this.hasFetched}));this.onTrackChange();this.trigger("stateChanged:playerbar");return this},onClick:function(){g.trigger("navigate","player")},onTrackChange:function(){this.playerModel.getCurrentlyPlayingMedia()?(this.bluetoothStateCollection.currentDeviceStreamingState()&&this.bluetoothStateCollection.fetch({force:!0}),
this.$el.show()):this.$el.hide();this.trigger("stateChanged:playerbar")},onResize:function(){var a=this.$("button.d-control-button:visible").first().position();a&&this.$(".d-meta-container").css("max-width",a.left)},onSuppressClick:function(a){a.stopPropagation()},_updatePlayerBarContent:function(){this.bluetoothStateCollection.currentDeviceStreamingState()?this.evict("controls").evict("volumeSlider").host("infoView",this.getView("bluetoothInfoView")):this.host("controls",this.getView("controlsView")).host("volumeSlider",
this.getView("volumeView")).host("infoView",this.getView("infoView"))},isVisible:function(){return this.$el.is(":visible")}},{NAME:"PlayerBarView",POLLING_REQUESTOR_ID:"PlayerBarView"});return k});define("views/icon-definitions-view",["views/base-view","handlebars"],function(f,g){return f.extend({template:g.getTemplate("d-icon-definitions"),render:function(){this.$el.html(this.template());return this},NAME:"IconDefinitionsView"})});
define("views/layouts/app-layout","lodash,jquery,backbone,models/form-factor-model,models/app-layout-options-model,collections/device-collection,handlebars,views/sidebar-menu-view,views/sidebar-view,views/layouts/base-layout,views/player-bar-view,views/icon-definitions-view".split(","),function(f,g,b,a,c,d,e,h,l,i,j,k){var n=i.extend({regions:{sidebar:"#d-navigate",player:"#d-player-bar-container",icons:"#d-icon-definitions",main:"#d-app"},views:{smallSidebarView:l,desktopSidebarView:{constructor:h,
scrollOptions:{disableKeyboardScrolling:!0}},iconsView:k},isTopLevel:!0,template:e.getTemplate("layouts/d-app-layout"),initialize:function(){f.bindAll(this,"hostSidebar","hostPlayerbar","onResize");this.deviceCollection=d.getInstance();this.deviceCollection.setPollingInterval(d.POLL_INTERVAL);this.deviceCollection.startPolling(n.NAME);this.formFactorModel=a.getInstance();this.appLayoutOptionsModel=c.getInstance();this.listenTo(b.history,"route",this.onRoute);this.listenTo(this.formFactorModel,"change",
this.onResize);this.listenTo(this.appLayoutOptionsModel,"change",this.onResize);this.listenTo(this.appLayoutOptionsModel,"change:hostPlayerBar",this.hostPlayerbar)},dispose:function(){this.deviceCollection&&this.deviceCollection.stopPolling(n.NAME);i.prototype.dispose.apply(this,arguments)},render:function(){this.$el.html(this.template());this._setFormFactorDisplay();return this},onRoute:function(){this._setFormFactorDisplay();this.hostPlayerbar();this.hostIcons();f.defer(this.hostSidebar)},_setFormFactorDisplay:function(){this.$(this.regions.main).toggleClass("fullscreen",
this.isFullScreenLayoutPath());this.$el.toggleClass("desktop",this.shouldPreExpandSidebar())},hostIcons:function(){this.iconView=this.getView("iconsView");this.host("icons",this.iconView)},hostSidebar:function(){this.sidebarMenuView=this.shouldPreExpandSidebar()?this.getView("desktopSidebarView"):this.getView("smallSidebarView");this.host("sidebar",this.sidebarMenuView);this.onResize()},hostPlayerbar:function(){var a={};this.isFullScreenLayoutPath()||!this.appLayoutOptionsModel.get("hostPlayerBar")?
(this.playerbar&&this.playerbar.dispose(),delete this.playerbar):this.playerbar?this.playerbar.updateParams(a):(this.playerbar=new j(a),this.host("player",this.playerbar),this.listenTo(this.playerbar,"stateChanged:playerbar",this.onResize));this.onResize()},onResize:function(){var a;a=this.isFullScreenLayoutPath()||!this.playerbar||!this.playerbar.isVisible()?0:this.formFactorModel.getFooterHeight();g("#d-content").css("bottom",a+(g("#d-footer").height()||0));return this},isFullScreenLayoutPath:function(){return this.appLayoutOptionsModel.get("isFullScreen")},
shouldPreExpandSidebar:function(){return!this.formFactorModel.isSidebarCollapsible()&&!this.appLayoutOptionsModel.get("hideSideBar")}},{NAME:"AppLayout"});return n});
define("routers/base-router",["lodash","backbone"],function(f,g){var b={trigger:!0,replace:!0},a=g.Router.prototype.route;return g.Router.extend({constructor:function(a){var b={};this.prefix=a.prefix;this.hideAppOfflineMessage=a.hideAppOfflineMessage;this.availableOffline=a.availableOffline;this.routeGraph={};this.lastRouteName=null;this.lastRouteArgs={};f.each(a.routes,function(a){var c=a.route,l=a.upRoute,g=a.aliasTo;b[a.url]=c;this.routeGraph[c]=l;f.isUndefined(g)||this.alias(c,g)},this);a.routes=
b;g.Router.call(this,a)},alias:function(a,d){this.listenTo(this,"route:"+a,f.partial(this.navigate,d,b))},route:function(c,b,e){var h=this.prefix||null;h&&f.isRegExp(c)?c=c.source.slice(0,1)==="^"?RegExp("^"+h+"/"+c.source.slice(1)):RegExp(h+"/"+c.source):h&&c?c=[h,c].join("/"):h&&(c=h);e||(e=this[b]);h=f.bind(function(){this.updateLastRoute(b,arguments);g.history.trigger("preRoute",this,b,arguments);e&&e.apply(this,arguments)},this);a.call(this,c,b,h)},updateLastRoute:function(a,b){this.lastRouteName=
a;this.lastRouteArgs[a]=b},atTop:function(){return!this.routeGraph[this.lastRouteName]},getCurrentFullRoute:function(){var a=f.invert(this.routes)[this.lastRouteName];return this.prefix&&a?this.prefix+"/"+a:this.prefix&&a===""?this.prefix:a},routeArgumentRegex:/\((.*?)\)|:\w+|\*\w+/g,_getFullRouteForRouteName:function(a){var b,e,h=0;a&&(b=f.invert(this.routes)[a],e=this.lastRouteArgs[a],b&&e&&(b=b.replace(this.routeArgumentRegex,function(){return e[h++]||""})));return b},_navigateWithPrefix:function(a){var b=
this.prefix||"";a&&(b+="/"+a);g.trigger("navigate",b,{noStackPush:!0})},upOneLevel:function(){var a=this._getFullRouteForRouteName(this.routeGraph[this.lastRouteName]);f.isString(a)&&this._navigateWithPrefix(a)}})});
define("views/message-view",["lodash","backbone","handlebars","views/base-view","models/companion-app-online-model"],function(f,g,b,a,c){var d=a.extend({template:b.getTemplate("d-message"),className:"d-message-view",events:{"click #d-message-dismiss":"_hide"},initialize:function(){f.bindAll(this,"show","_hide","hideById","_nextMessage");this.isShowingMessage=!1;this.messageQueue=[]},startListening:function(){this.listenTo(g,"showMessage",this.show);this.listenTo(g,"dismissMessage",this.hideById);
this.listenTo(c.getInstance(),"change:connectedToCloud",this._onConnectedToCloudChange)},dispose:function(){this.timeoutId&&clearTimeout(this.timeoutId);this.remove()},show:function(a,c,b){this.messageQueue.push(arguments);f.defer(this._nextMessage)},_hide:function(){this.timeoutId&&clearTimeout(this.timeoutId);f.result(this,"onDismissCallback");this.$el.trueSlideUp({top:0,duration:d.DURATION,complete:f.bind(function(){delete this.timeoutId;this.isShowingMessage=!1;this._nextMessage()},this)})},hideById:function(a){this.id===
a&&this._hide()},_nextMessage:function(){this.messageQueue.length&&!this.isShowingMessage&&this._doShow.apply(this,this.messageQueue.shift())},_doShow:function(a,c,b){b||(b={});var i,j=b.messageDuration||d.AUTO_HIDE;this.$el.html(this.template({title:a,messages:f.isString(c)?[c]:c,isHtml:b.isHtml}));this.id=b.id||f.uniqueId();this.onDismissCallback=b.onDismissCallback;b.dismissOnNavigate&&this.listenToOnce(g.history,"route",this._hide);b.disableAutoHide||(i=f.bind(function(){this.timeoutId=f.delay(this._hide,
j)},this));this.isShowingMessage=!0;this.$el.trueSlideDown({top:0,duration:d.DURATION,complete:i})},_onConnectedToCloudChange:function(a,c){if(c)this.messageQueue=[]}},{NAME:"MessageView",AUTO_HIDE:4E3,DURATION:300});return d});
define("views/header-view","lodash,backbone,handlebars,models/sidebar-menu-model,views/layouts/base-layout,handlers/navigation-handler,models/app-layout-options-model,models/platform-model,models/form-factor-model,collections/device-collection".split(","),function(f,g,b,a,c,d,e,h,l,i){return c.extend({showLoadingSpinner:!1,template:b.getTemplate("d-header"),regions:{actionButton:".action"},events:{"click .menu":"_onMenuClick","click .back":"_onBackClick","click .back-title":"_onBackClick","change .d-doppler-select":"_selectDevice"},
initialize:function(c){c||(c={});this.title=c.title;this.formFactorModel=l.getInstance();this.sidebarMenuModel=a.getInstance();this.navigationHandler=d.getInstance();this.appLayoutOptionsModel=e.getInstance();this.devices=i.getInstance()},getFetchables:function(){return[this.devices]},startListening:function(){this.listenTo(g.history,"route",this.render);this.listenTo(this.formFactorModel,"change:formFactor",this.render);this.listenTo(this.devices,"change change:selectedDevice add remove reset",this._onDevicesChange)},
_showBackButton:function(){var a=this.appLayoutOptionsModel.get("hideNavigation"),c=h.getInstance().supports("browserBack");return a||c?!1:!this.navigationHandler.atTop()},_showMenuButton:function(a){var c=this.appLayoutOptionsModel.get("hideNavigation"),b=!this.appLayoutOptionsModel.get("allowSidebarExpansion");return c||b||a?!1:this.formFactorModel.isSidebarCollapsible()?!0:this.appLayoutOptionsModel.get("hideSideBar")},render:function(){var a=this._showBackButton(),c=this._showMenuButton(a),a=
{title:this.title,showBack:a,showMenu:c};if(this._showDevicePicker())c=this.devices.getCurrentlySelectedDevice(),a.devices=this.devices.toJSON(),a.selectedDevice=c.toJSON(),f.defer(function(){$("#d-header").addClass("d-device-picker")});this.$el.html(this.template(a));return this},setTitle:function(a){var c;if(this.title!==a)c=this.$(".maintext"),a?c.text(a):c.empty(),this.title=a;return this},_onDevicesChange:function(){this._showDevicePicker()&&this.render()},_showDevicePicker:function(){return!!(this.appLayoutOptionsModel.get("showDevicePicker")&&
this.devices.length>1)},_onMenuClick:function(a){this.sidebarMenuModel.set("isOpen",!this.sidebarMenuModel.get("isOpen"));a.stopPropagation()},_onBackClick:function(){g.trigger("navigate.upOneLevel")},_selectDevice:function(a){this.devices.setCurrentlySelectedDevice(a.currentTarget.children[a.currentTarget.selectedIndex].getAttribute("data-dsn"))}},{NAME:"HeaderView"})});
define("views/companion-app-offline-view",["handlebars","views/base-view"],function(f,g){return g.extend({template:f.getTemplate("d-companion-app-offline"),render:function(){this.$el.html(this.template());return this}},{NAME:"CompanionAppOfflineView"})});
define("views/loading-view",["lodash","handlebars","views/base-view"],function(f,g,b){var a=b.extend({className:"d-loading-view",template:g.getTemplate("d-loading-fullscreen"),initialize:function(c){c=f.extend({visibilityDelay:a.VISIBILITY_DELAY,fadeDelay:a.FADE_DELAY},c);this.pendingLoadTimeout=null;this.visibilityDelay=c.visibilityDelay;this.fadeDelay=c.fadeDelay},startListening:function(){this.listenTo(this.loadingModel,"change:spinnerVisible change:wipeScreen",this.updateVisibility)},render:function(){this.$el.html(this.template());
this.updateVisibility();return this},updateVisibility:function(){var a=this,b=this.$(".d-spinner-container"),e=this.loadingModel.wipeScreen;if(this.loadingModel.spinnerVisible){if(this.$el.show(),e&&this.$el.addClass("wipe-screen"),!this.pendingLoadTimeout)this.pendingLoadTimeout=f.delay(function(){b.fadeIn(a.fadeDelay);a.pendingLoadTimeout=null},this.visibilityDelay)}else{if(this.pendingLoadTimeout)window.clearTimeout(this.pendingLoadTimeout),this.pendingLoadTimeout=null;this.$el.toggleClass("wipe-screen",
e);b.fadeOut(this.fadeDelay);this.$el.fadeOut(this.fadeDelay)}}},{NAME:"LoadingView",VISIBILITY_DELAY:500,FADE_DELAY:200});return a});
define("views/layouts/header-component-base-layout","router-manager,models/companion-app-online-model,views/header-view,views/layouts/base-layout,views/companion-app-offline-view,collections/household-collection,views/loading-view".split(","),function(f,g,b,a,c,d,e){return a.extend({isTopLevel:!0,regions:{page:"#d-page",header:"#d-header",message:"#d-message",loading:"#d-loading",pageContent:"#d-content"},initialize:function(a){a=a||{};this.householdCollection=d.getInstance();this.companionAppOnlineModel=
g.getInstance();this.routerManager=f.getInstance();this.headerView=a.headerView||new b;this.host("header",this.headerView);this.loadingView=new e;this.host("loading",this.loadingView)},setTitle:function(a){this.headerView.setTitle(a);return this},hostHeader:function(a){this.headerView=a;this.host("header",this.headerView);return this},hostContent:function(a,c){this.pageContent=a;this.setTitle(c);this.host("pageContent",a);return this},hostHeaderContent:function(a,c,d){this.hostHeader((new b).host("actionButton",
a));this.hostContent(c,d);return this},host:function(c,b,d){var e;return c==="pageContent"?(e=this._getPageContentView(b),a.prototype.host.call(this,c,e,d)):a.prototype.host.apply(this,arguments)},_getPageContentView:function(a){return this._shouldLoadPage()?a:this._getAppOfflineView()},_getAppOfflineView:function(){return new c},_shouldLoadPage:function(){return this.companionAppOnlineModel.get("connectedToCloud")||this.routerManager.currentRouter.availableOffline}},{NAME:"HeaderComponentBaseLayout"})});
define("views/themeable",["lodash"],function(f){return{themes:{DARK:"dark",LIGHT:"light",WHITE:"white"},defaultTheme:"WHITE",setSelector:function(f){this.selector=f;return this},setTheme:function(f){var f=this.themes[f]||this.themes[this.defaultTheme],b=this.selector?this.$(this.selector):this.$el;this.clearTheme();b.addClass(f);return this},clearTheme:function(){var g=f.values(this.themes).join(" ");(this.selector?this.$(this.selector):this.$el).removeClass(g);return this}}});
define("views/layouts/header-player-layout",["lodash","handlebars","views/layouts/header-component-base-layout","views/themeable"],function(f,g,b,a){return b.extend({regions:f.extend(b.prototype.regions,{player:"#d-player-bar-container"}),template:g.getTemplate("layouts/d-header-player-layout"),render:function(){this.$el.html(this.template());return this}},{NAME:"HeaderPlayerLayout"}).extend(a)});
define("views/layouts/sequence-layout",["lodash","backbone","views/base-view"],function(f,g,b){return b.extend({constructor:function(){this._hostedViews=[];b.apply(this,arguments)},pushView:function(a,c){return this.insertView(a,this._hostedViews.length,c)},insertView:function(a,c,b){b||(b={});var e=a.render().$el;c>=this._hostedViews.length?e.appendTo(this.$el):e.insertBefore(this._hostedViews[c].$el);b.silent||(a.trigger("host"),a.onScreen());this._hostedViews.splice(c,0,a);return this},getView:function(a){return this._hostedViews[a]},
indexOf:function(a){return this._hostedViews.indexOf(a)},size:function(){return this._hostedViews.length},popView:function(a){return this.removeView(this._hostedViews.length-1,a)},removeView:function(a,c){c||(c={});var b,e;a instanceof g.View?(b=a,e=this.indexOf(b)):f.isNumber(a)?(e=a,b=this.getView(e)):f.isString(a)&&(b=this.findBySelector(a),e=this.indexOf(b));b&&0<=e&&e").text(this.caption).appendTo(this.$el),this.$el.addClass("caption"))},_onImageLoadFailure:function(){this.reference&&d[this.reference.fallbackIcon]?this.$el.html('').removeClass("no-image"):this.$el.html(this.imageErrorTemplate())}},{NAME:"CardImageView"})});
define("views/cardstream/cards/components/card-actions-view","lodash,jquery,backbone,handlebars,models/platform-model,models/stage-model,views/base-view".split(","),function(f,g,b,a,c,d,e){var h=e.extend({tagName:"ul",template:a.getTemplate("cardstream/cards/components/d-action-list"),events:{click:"_onClick"},initialize:function(a){a||(a={});this.actions=a.actions||[];if(!c.getInstance().supports("purchasing"))this.actions=f.reject(this.actions,function(a){return a.actionType===h.SEARCH_MP3_ACTION});
if(d.getInstance().is("prod"))this.actions=f.reject(this.actions,function(a){return a.actionType===h.SEARCH_CLOUD_PLAYER_ACTION});this.onClick=a.onClick},render:function(){this.$el.html(this.template({actions:this.actions}));return this},_onClick:function(a){a=g(a.target);a.hasClass("disabled")||(a.data("action")==="navigate"?b.trigger("navigate",a.data("route")):(a=a.data("action-index"),a=this.actions[a],b.trigger("CardAction",a)))}},{NAME:"CardActionsView",SEARCH_MP3_ACTION:"SearchMP3StoreAction",
SEARCH_CLOUD_PLAYER_ACTION:"SearchCloudPlayerAction",OPEN_URL_ACTION:"OpenUrlAction"});return h});
define("views/cardstream/cards/components/card-text-view",["lodash","handlebars","views/base-view","utils/server-template"],function(f,g,b,a){return b.extend({className:"d-card-text",template:g.getTemplate("cardstream/cards/components/d-card-text"),initialize:function(a){a||(a={});this.cardText=a.cardText||[]},render:function(){this.$el.html(this.template(f.map(this.cardText,a.process)));return this}},{NAME:"CardTextView"})});
define("views/dialog-yes-no-view","jquery,lodash,backbone,constants,handlebars,views/base-view".split(","),function(f,g,b,a,c,d){return d.extend({template:c.getTemplate("d-dialog-yes-no"),events:{"click .action-give-detailed-feedback":"_clickGiveDetailedFeedback","click .d-feedback-yes-no .action-give-feedback":"_clickYesNo"},initialize:function(c){c||(c={});this.showYesNo=c.showYesNo;this.giveFeedbackRoute=c.giveFeedbackRoute||"beta-feedback";c.activityId&&(this.giveFeedbackRoute+="/"+c.activityId);
this.staticText={thumbsDownText:c.thumbsDownText||"Did "+a.TXT_DEVICE_NAME+" hear you correctly?",giveFeedbackHeading:c.giveFeedbackHeading||"Thank you! Your feedback helps "+a.TXT_DEVICE_NAME+" understand you better.",giveFeedbackLinkText:c.giveFeedbackLinkText||"Send more detailed feedback."}},render:function(){this.$el.html(this.template(g.extend({showYesNo:this.showYesNo},this.staticText)));return this},_clickGiveDetailedFeedback:function(){b.trigger("navigate",this.giveFeedbackRoute)},_clickYesNo:function(a){this.trigger("feedbackGiven",
!f(a.currentTarget).hasClass("d-feedback-no"));this.showYesNo=!1;this.render()}},{NAME:"DialogFeedbackView"})});
define("views/audio-playback-action-view","jquery,lodash,backbone,handlebars,views/base-view,utils/audio".split(","),function(f,g,b,a,c,d){return c.extend({template:a.getTemplate("d-audio-playback-action"),events:{"click .action-playback-audio":"_clickPlaybackAudio"},initialize:function(a){this.playbackAudioAction=a&&a.playbackAudioAction},startListening:function(){this.playbackAudioAction&&this.listenTo(d,"change:currentlyPlayingId",this.updatePlayingState)},render:function(){this.$el.html(this.template(this._getTemplateData()));
return this},_getTemplateData:function(){return g.extend({visible:!!this.playbackAudioAction,enabled:this.playbackAudioAction&&this.playbackAudioAction.url!==d.currentlyPlayingId},this.playbackAudioAction||{})},_clickPlaybackAudio:function(a){f(a.currentTarget).hasClass("disabled")||b.trigger("CardAction",this.playbackAudioAction)},updatePlayingState:function(){var a=d.currentlyPlayingId===g.result(this.playbackAudioAction,"url");this.$(".action-playback-audio").toggleClass("disabled",a)}},{NAME:"AudioPlaybackActionView"})});
define("views/cardstream/cards/components/card-feedback-actions-view","lodash,jquery,backbone,handlebars,views/layouts/base-layout,views/dialog-yes-no-view,views/audio-playback-action-view,models/form-factor-model".split(","),function(f,g,b,a,c,d,e,h){return c.extend({tagName:"ul",className:"d-actions feedback",template:a.getTemplate("cardstream/cards/components/d-feedback-actions"),events:{"click .n-best-action":"_clickNBestAction","click .n-best-item":"_clickNBestItem"},regions:{dialogYesNo:".dialog-yes-no",
audioPlaybackAction:".audio-playback-actions-region"},initialize:function(a){a||(a={});var c=a.cardData||{};this.nBestActions=a.nBestActions||[];this.nBestItems=a.nBestItems||[];if(this.nBestActions.length>0&&this.nBestItems.length>0)throw Error("Specify one of nBestActions or nBestItems, not both.");this.playbackAudioAction=c.playbackAudioAction;this.giveFeedbackAction=c.giveFeedbackAction;this.thumbsUpDownActivityAction=c.thumbsUpDownActivityAction;this.hideNBest=!!a.hideNBest;this.formFactor=h.getInstance();
this.listenTo(this.formFactor,"change:contentSize",this._updateFormFactor);this._updateFormFactor();this.audioPlaybackActionView=new e({playbackAudioAction:this.playbackAudioAction});this.host("audioPlaybackAction",this.audioPlaybackActionView);this.yesNoView=new d({showYesNo:!!this.thumbsUpDownActivityAction,thumbsDownText:this.thumbsDownActivityAction&&this.thumbsDownActivityAction.mainText,giveFeedbackHeading:this.giveFeedbackAction&&this.giveFeedbackAction.mainText,giveFeedbackLinkText:this.giveFeedbackAction&&
this.giveFeedbackAction.subText,giveFeedbackRoute:this.giveFeedbackAction&&this.giveFeedbackAction.route,activityId:c.id});this.host("dialogYesNo",this.yesNoView);this.listenTo(this.yesNoView,"feedbackGiven",function(a){b.trigger("CardAction",this.thumbsUpDownActivityAction,{correctFeedback:a})})},render:function(){this.$el.html(this.template(this.getTemplateData()));return this},setNBestItems:function(a){this.nBestActions=[];this.nBestItems=a||[];this.render()},isVisible:function(){return this.getVisibilityState().any},
getVisibilityState:function(){var a=!!this.thumbsUpDownActivityAction,c=!!this.giveFeedbackAction,b=!this.hideNBest&&(this.nBestActions.length>0||this.nBestItems.length>0);return{thumbsUpDown:a,giveFeedback:c,nBest:b,any:a||c||b}},getTemplateData:function(){var a=this.getVisibilityState(),c={visible:a.any};if(a.any)c.thumbsUpDown={visible:a.thumbsUpDown},c.giveFeedback=f.extend({visible:a.giveFeedback},this.giveFeedbackAction||{}),c.nBest={visible:a.nBest,asActions:this.nBestActions.length>0,actions:this.nBestActions,
items:this.nBestItems},c.thumbsUpDownActivity=this.thumbsUpDownActivityAction;return c},_clickNBestAction:function(a){a=g(a.target);a.hasClass("disabled")||(a=a.data("action-index"),b.trigger("CardAction",this.nBestActions[a]))},_clickNBestItem:function(a){a=g(a.target);a.hasClass("disabled")||(a=a.data("action-index"),this.trigger("nbest",{index:a,value:this.nBestItems[a]}))},_updateFormFactor:function(){this.$el.toggleClass("large",this.formFactor.get("contentSize")==="large")}},{NAME:"CardFeedbackActionsView"})});
define("views/cardstream/cards/components/more-less-menu-view",["backbone","handlebars","views/base-view"],function(f,g,b){return b.extend({template:g.getTemplate("cardstream/cards/components/d-more-less-menu"),events:{click:"_onClick"},initialize:function(a){this.menuModel=a.menuModel;this.listenTo(this.menuModel,"change:isOpen",this.render)},render:function(){this.$el.html(this.template({isOpen:this.menuModel.get("isOpen")}));return this},_onClick:function(){this.menuModel.set("isOpen",!this.menuModel.get("isOpen"));
this.menuModel.set("wasToggledByUser",!0);f.trigger("DOMModified")}},{NAME:"MoreLessMenuView"})});define("models/cardstream/card-menu-model",["models/base-model"],function(f){return f.extend({defaults:{isOpen:!1,wasToggledByUser:!1}},{NAME:"CardMenuModel"})});
define("views/cardstream/cards/components/card-footer-view","handlebars,views/layouts/base-layout,views/cardstream/cards/components/card-actions-view,views/cardstream/cards/components/card-feedback-actions-view,views/cardstream/cards/components/more-less-menu-view,models/cardstream/card-menu-model".split(","),function(f,g,b,a,c,d){return g.extend({tagName:"section",className:"d-card-footer",template:f.getTemplate("cardstream/cards/components/d-card-footer"),regions:{feedbackActions:".d-feedback-actions-region",
deleteAction:".d-delete-action-region",secondaryActions:".d-secondary-actions-region",moreLessMenu:".d-more-less-menu-region"},initialize:function(a,c){c=c||{};this.feedbackDisabled=c.feedbackDisabled||!1;this.menuModel=new d;this._hostSubViews(a);this._startMenuToggleListeners()},render:function(){var a=this.menuModel.get("isOpen");this.$el.html(this.template());this.$(".collapsible-section").toggle(a);return this},_hostSubViews:function(d){var h=d.secondaryActions||[],f=d.deleteCardAction,g=d.nBestOptions||
[],j=!1;h.length&&this.host("secondaryActions",new b({className:"d-actions secondary",actions:h}));f&&this.host("deleteAction",new b({className:"d-actions delete-action",actions:[f]}));this.feedbackDisabled||(d=new a({cardData:d,nBestActions:g,collapsed:!!h.length}),(j=d.isVisible())&&this.host("feedbackActions",d));(h.length||f||j)&&this.host("moreLessMenu",new c({menuModel:this.menuModel}))},_startMenuToggleListeners:function(){this.listenTo(this.menuModel,"change:isOpen",this._onMenuOpenChange)},
_onMenuOpenChange:function(a,c){this.$(".collapsible-section").toggle(c)},showExtraActions:function(){this.menuModel.set("isOpen",!0)},hideExtraActions:function(){this.menuModel.get("wasToggledByUser")||this.menuModel.set("isOpen",!1)}},{NAME:"CardFooterView"})});
define("views/cardstream/cards/standard-card-view","handlebars,views/cardstream/cards/base-card-view,views/cardstream/cards/components/card-title-view,views/cardstream/cards/components/card-image-view,views/cardstream/cards/components/card-actions-view,views/cardstream/cards/components/card-text-view,views/cardstream/cards/components/card-footer-view,models/form-factor-model".split(","),function(f,g,b,a,c,d,e,h){return g.extend({template:f.getTemplate("cardstream/cards/d-standard-card"),regions:{title:".d-card-title-region",
image:".d-card-image-region","primary-actions":".d-primary-actions-region","card-text":".d-card-text-region","footer-region":".d-card-footer-region"},hostImageView:function(c,b){this.host("image",new a({reference:c,action:b.imageAction,caption:b.imageCaption}))},initialize:function(a){a||(a={});g.prototype.initialize.call(this,a);var f=a.imageReference,j=a.primaryActions||[],k=a.descriptiveText||[];this.host("title",new b({title:a.title,subtitle:a.subtitle,wrapTitle:a.wrapTitle||!1}));f&&this.hostImageView(f,
a);if(j.length){if(j.length>3)j.length=3;this.host("primary-actions",new c({className:"d-actions primary",actions:j}))}k.length&&this.host("card-text",new d({cardText:k}));this.footerView=new e(a);this.host("footer-region",this.footerView);this.formFactor=h.getInstance();this.listenTo(this.formFactor,"change:contentSize",this.render);this.listenTo(this,"show:extra-actions",this._onShowExtraActions);this.listenTo(this,"hide:extra-actions",this._onHideExtraActions);this.cardData=a},render:function(){this.$el.html(this.template({isLarge:this.formFactor.get("contentSize")===
"large"}));return g.prototype.render.call(this)},_onShowExtraActions:function(){this.footerView.showExtraActions()},_onHideExtraActions:function(){this.footerView.hideExtraActions()}},{NAME:"StandardCardView"})});
define("views/cardstream/cards/cloud-player-card-view",["views/cardstream/cards/standard-card-view","views/cardstream/cards/components/card-image-view"],function(f,g){return f.extend({hostImageView:function(b,a){this.host("image",new g({reference:b,action:a.imageAction,isQueuePrime:a.queuePrime}))}},{NAME:"CloudPlayerCardView"})});
define("views/cardstream/cards/components/weather-card-icon-view",["handlebars","views/base-view"],function(f,g){return g.extend({template:f.getTemplate("cardstream/cards/components/d-weather-icon"),imageErrorTemplate:f.getTemplate("cardstream/cards/components/d-image-error"),initialize:function(b){b=b||{};this.icon=b.icon;this.temperature=b.temperature;this.size=b.size||"medium"},render:function(){this.icon?this.$el.html(this.template({imageIcon:this.icon,size:this.size,temperature:this.temperature})):
this.$el.html(this.imageErrorTemplate());return this}},{NAME:"WeatherCardIconView"})});
define("views/cardstream/cards/forecast-card-view",["handlebars","views/cardstream/cards/base-card-view","views/cardstream/cards/components/weather-card-icon-view","views/cardstream/cards/components/card-text-view"],function(f,g,b,a){return g.extend({className:"d-forecast-card",template:f.getTemplate("cardstream/cards/d-forecast-card"),regions:{image:".d-forecast-card-image","card-text":".d-forecast-card-text"},initialize:function(c){c=c||{};c.imageReference&&this.host("image",new b({icon:c.imageReference.icon}));
c.descriptiveText&&this.host("card-text",new a({cardText:c.descriptiveText}));this.highTemperature=c.highTemperature;this.lowTemperature=c.lowTemperature;this.selected=c.selected},render:function(){this.$el.html(this.template({highTemperature:this.highTemperature,lowTemperature:this.lowTemperature,selected:this.selected}));return g.prototype.render.call(this)}},{NAME:"ForecastCardView"})});
define("views/cardstream/cards/weather-card-view","lodash,handlebars,views/cardstream/cards/components/card-title-view,views/cardstream/cards/forecast-card-view,views/cardstream/cards/base-card-view,views/cardstream/cards/components/weather-card-icon-view,views/cardstream/cards/components/card-text-view,views/cardstream/cards/components/card-footer-view,models/form-factor-model".split(","),function(f,g,b,a,c,d,e,h,l){return c.extend({template:g.getTemplate("cardstream/cards/d-weather-card"),regions:{stats:".d-weather-stats",
title:".d-card-title-region",image:".d-card-image-region",alerts:".d-card-alerts-region","card-text":".d-card-text-region","footer-region":".d-card-footer-region"},initialize:function(g){g||(g={});c.prototype.initialize.call(this,g);var j,k=g.forecastList,n=g.current,m,o,q=this;g.title&&this.host("title",new b({title:g.title,subtitle:g.subtitle}));n?(j=n.weatherStatList||[],j.length&&this.host("stats",new e({cardText:j})),j=n.areaAlertList||[],j.length&&this.host("alerts",new e({cardText:j})),this.host("card-text",
new e({cardText:n.descriptiveText})),this.host("image",new d({icon:n.imageReference.icon,size:"large",temperature:n.currentTemperature}))):this.$el.addClass("no-image");if(k&&k.length){if(k.length>7)k.length=7;f(k).each(function(c,b){m="forecast-"+b;o=".d-forecast-"+b;q.regions[m]=o;q.host(m,new a(c))})}this.footerView=new h(g);this.host("footer-region",this.footerView);this.formFactor=l.getInstance();this.listenTo(this.formFactor,"change:contentSize",this.render);this.listenTo(this,"show:extra-actions",
this._onShowExtraActions);this.listenTo(this,"hide:extra-actions",this._onHideExtraActions);this.cardData=g},render:function(){this.$el.html(this.template({hasNBest:this.hasNBest,size:this.formFactor.get("contentSize")==="large"?"large":"",forecasts:this.cardData.forecastList}));return c.prototype.render.call(this)},_onShowExtraActions:function(){this.footerView.showExtraActions()},_onHideExtraActions:function(){this.footerView.hideExtraActions()}},{NAME:"WeatherCardView"})});
define("views/cardstream/cards/text-card-view","handlebars,views/cardstream/cards/base-card-view,views/cardstream/cards/components/card-title-view,views/cardstream/cards/components/card-actions-view,views/cardstream/cards/components/card-text-view,views/cardstream/cards/components/card-footer-view".split(","),function(f,g,b,a,c,d){var e=g.extend({template:f.getTemplate("cardstream/cards/d-text-card"),regions:{title:".d-card-title-region","primary-actions":".d-primary-actions-region","card-text":".d-card-text-region",
"footer-region":".d-card-footer-region"},initialize:function(h){h||(h={});g.prototype.initialize.call(this,h);var f=h.primaryActions||[],i=h.descriptiveText||[];this.host("title",new b({className:"d-card-title padded",title:h.title,subtitle:h.subtitle,wrapTitle:h.wrapTitle||!1}));if(f.length){if(f.length>3)f.length=3;this.host("primary-actions",new a({className:"d-actions primary",actions:f}))}i.length&&this.host("card-text",new c({className:"d-card-text padded "+(e.TEXT_CARD_TYPE_TO_CLASS_NAME_MAP[h.textCardType]||
""),cardText:i}));this.footerView=new d(h);this.host("footer-region",this.footerView);this.listenTo(this,"show:extra-actions",this._onShowExtraActions);this.listenTo(this,"hide:extra-actions",this._onHideExtraActions);this.cardData=h},render:function(){this.$el.html(this.template());return g.prototype.render.call(this)},_onShowExtraActions:function(){this.footerView.showExtraActions()},_onHideExtraActions:function(){this.footerView.hideExtraActions()}},{NAME:"TextCardView",TEXT_CARD_TYPE_TO_CLASS_NAME_MAP:{BANNER:"banner"}});
return e});
define("utils/edit-model-factory",["lodash","jquery"],function(f,g){var b=function(a){this.sourceModel.set(this.toJSON());a=this.sourceModel.save(null,a);this._changedAttributes=[];return a||g.Deferred().reject().promise()},a=function(){this.set(this.sourceModel.toJSON());this._changedAttributes=[]};return function(c){var d;if(c)d=c.clone(),d.sourceModel=c,d._changedAttributes=[],d.hasChanged=function(a){return a?f.contains(this._changedAttributes,a):!!this._changedAttributes.length},d.on("change",function(a){d._changedAttributes=
f.union(d._changedAttributes,f.keys(a.changed))}),d.save=b,d.clearChanges=a;return d}});
define("views/todos/to-do-base-view","lodash,backbone,handlebars,constants,models/form-factor-model,views/layouts/base-layout,utils/browser-utils,utils/edit-model-factory,utils/to-do-multiplexer,utils/js-bridge,utils/key-codes".split(","),function(f,g,b,a,c,d,e,h,l,i,j){return d.extend({template:b.getTemplate("todos/d-to-do-item"),events:{"click span.title":"clickTitle","blur textarea.title":"blurEdit","keydown textarea.title":"keyDownEdit","keyup textarea.title":"keyUpEdit","click .d-card-menu":"toggleActions",
"click .d-to-do-check":"updateComplete","click .action-delete":"deleteItem","click .action-move-to-other":"moveToOtherList","click .action-search-on-amazon":"searchOnAmazon","click .action-search-on-bing":"searchOnBing","click .action-view-list":"viewList","click .action-give-feedback":"giveFeedback","click .action-disambiguate":"disambiguateNBest","click .action-toggle-to-do-feedback":"toggleFeedback"},initialize:function(a){a=a||{};this._model=a.model||null;this._didFocus=this._isSaving=this._isEditing=
!1;this._pendingToggleSaves=0;this._editModel=null;this.multiplexer=l.getInstance();this.formFactorModel=c.getInstance();this.showFeedback=this.showActions=!1;f.bindAll(this,"render")},startListening:function(){var a=this.getModel();a&&this.listenTo(a,"change destroy",this.render)},render:function(){var a=this.getModel();if(this._pendingToggleSaves>0)return this;if(this._isEditing&&!this._isSaving)return this;this.hasFetched&&a&&!a.get("deleted")?(this.$el.html(this.template(this.getTemplateData())),
this.$el.show(),this.$("textarea.title").hide()):(this.$el.hide(),this.$el.empty());return this},getTemplateData:function(){var a=this.getModel(),c=a&&a.get("nbestItems"),c=c&&c.length;return{toDo:a.toJSON(),hasNBest:c,isShopping:a.isShopping(),showActions:this.showActions,showFeedback:this.showFeedback,utteranceId:a.get("utteranceId")}},getModel:function(){return this._model},clickTitle:function(){!this.getModel().get("complete")&&!this._isEditing&&(this.showActions?this.editItem():(this.toggleActions(!0),
this.formFactorModel.get("formFactor")!=="small"&&this.editItem()))},editItem:function(){var a=this.getModel();this._isEditing=!0;this._editModel=h(this.getModel());this.trigger("beginEditing",a.cid);this.$("span.title").hide();this.$("textarea.title").show();this.$("textarea.title").height(this.$("textarea.title")[0].scrollHeight);if(!this._didFocus)this._didFocus=!0,this.$("textarea.title").focus().select()},blurEdit:function(){var a=this._editModel;if(document.activeElement===this.el)return!1;
a&&a.set("text",this.$("textarea.title").val());a&&a.hasChanged("text")?this.saveEdit():this.dismissEdit()},keyDownEdit:function(a){var c=this._editModel;if(c)if(a.keyCode===j.ENTER)return c.set("text",this.$("textarea.title").val()),c.hasChanged("text")?(this.saveEdit(),this.toggleActions(!1)):this.dismissEdit(),this.toggleActions(!1),!1;else a.keyCode===j.ESCAPE&&(this.dismissEdit(),this.toggleActions(!1))},keyUpEdit:function(){var a=this._editModel;a&&(this.$("textarea.title").val()!==a.get("text")?
this.$(".d-actions").addClass("disabled"):this.$(".d-actions").removeClass("disabled"),this.$("textarea.title").height(this.$("textarea.title")[0].scrollHeight))},saveEdit:function(){var c=this._editModel;if(c&&!this._isSaving)c.set("text",c.get("text").trim()),c.checkValid()?(this._isSaving=!0,c.save().done(f.bind(this.dismissEdit,this)).fail(this.saveFailed).always(f.bind(function(){this._isSaving=!1},this))):(this.saveFailed(this.getModel().isShopping()?a.TXT_INVALID_SHOPPING:a.TXT_INVALID_TODO),
this.dismissEdit())},saveFailed:function(c){if(!f.isString(c))c=a.TXT_SAVE_FAILED;g.trigger("showMessage","Error",c)},dismissEdit:function(){var a=this.getModel();if(this._isEditing){this._isEditing=!1;if(this._editModel)this._editModel.clearChanges(),this._editModel=null;this.$("textarea.title").hide();this.$("span.title").text(a.get("text"));this.$("span.title").show()}this._didFocus=!1;this.trigger("endEditing",a.cid)},disambiguateNBest:function(a){this.editItem();this._editModel.set("text",$(a.target).text());
this.saveEdit();this.toggleActions(!1);this.render()},deleteItem:function(){this.getModel().save({deleted:!0}).fail(f.partial(this.saveFailed,a.TXT_DELETE_FAILED))},updateComplete:function(a){this._toggleToDoCompleteState();a.preventDefault();this.showActions=!1;this._pendingToggleSaves++;a=this.getModel();a.save({complete:a.get("complete")}).fail(f.bind(function(){this._toggleToDoCompleteState();this.saveFailed()},this)).always(f.bind(function(){(this._pendingToggleSaves=Math.max(0,this._pendingToggleSaves-
1))||this.render()},this))},_toggleToDoCompleteState:function(){var a=this.getModel();a.set("complete",!a.get("complete"));this.$(".d-to-do-item").toggleClass("d-task-completed",a.get("complete"));this.$(".check-input").attr("checked",a.get("complete"));!this.showActions&&this.$(".d-card-menu").toggle(!a.get("complete"))},viewList:function(){g.trigger("navigate",this.getModel().isShopping()?"todos/shopping":"todos")},moveToOtherList:function(){this.multiplexer.moveToOtherList(this.getModel()).fail(this.saveFailed)},
searchOnAmazon:function(){var c=this.getModel().get("text");i.postMessage({target:"AppLauncherBridge",method:"launchShoppingApp",parameters:{searchString:c}},function(){},function(){g.trigger("showMessage","Error",a.TXT_LAUNCH_SHOPPING_APP_FAILED)},function(){})},searchOnBing:function(){e.openWindow(a.URL_BING_SEARCH+encodeURIComponent(this.getModel().get("text")))},toggleActions:function(a){var c=this.showActions,b=this.getModel();typeof a==="boolean"?this.showActions=a:(this.actionsToggledByUser=
!0,this.showActions=!this.showActions);c===this.showActions||this.render();b&&this.trigger("toggleActions",b.cid,this.showActions);g.trigger("DOMModified")},toggleFeedback:function(){this.showFeedback=!this.showFeedback;this.render()}},{NAME:"ToDoBaseView"})});
define("views/cardstream/cards/to-do-card-view","lodash,views/todos/to-do-base-view,views/cardstream/cards/components/card-feedback-actions-view,views/cardstream/cards/components/card-actions-view,utils/to-do-multiplexer,utils/performance-metrics".split(","),function(f,g,b,a,c,d){return g.extend({showLoadingSpinner:!1,className:"d-card",regions:{"feedback-actions":".d-feedback-actions-region","delete-action":".d-delete-action-region"},initialize:function(d){g.prototype.initialize.apply(this,[]);this.cardData=
d;this.multiplexer=c.getInstance();this.feedbackActionsView=new b({cardData:this.cardData,collapsed:!0,hideNBest:!0});if(this.cardData.deleteCardAction)this.deleteActionView=new a({className:"d-actions delete-action",actions:[this.cardData.deleteCardAction]}),this.host("delete-action",this.deleteActionView);this.host("feedback-actions",this.feedbackActionsView);this.listenTo(this,"show:extra-actions",this._onShowExtraActions);this.listenTo(this,"hide:extra-actions",this._onHideExtraActions)},getFetchables:function(){return[this.multiplexer]},
startListening:function(){g.prototype.startListening.apply(this,arguments);this.listenTo(this.multiplexer,"change",this.renderOnMatch);this.getModel()||this.listenTo(this.multiplexer,"add",this.renderOnAdd)},renderOnMatch:function(a){var c=this.getModel();c&&c.id===a.id&&this.render()},renderOnAdd:function(){this.getModel()&&(this.stopListening(),this.startListening(),this.render())},render:function(){g.prototype.render.call(this);d.getInstance().markEvent("ViewRendered.ToDoCard",this.cardData);return this},
getTemplateData:function(){var a=g.prototype.getTemplateData.apply(this,arguments),c=this.multiplexer.getCount(this.getModel().get("type"));return f.extend({isCardView:!0,listCount:c+" item"+(c!==1?"s":"")},a)},getModel:function(){if(!this._model)this._model=this.multiplexer.getByKey(this.cardData.customerId,this.cardData.toDoId);return this._model},_onShowExtraActions:function(){this.toggleActions(!0)},_onHideExtraActions:function(){this.actionsToggledByUser||this.toggleActions(!1)}},{NAME:"ToDoCardView"})});
define("views/cardstream/cards/components/news-card-image-view",["views/cardstream/cards/components/card-image-view"],function(f){return f.extend({_onImageLoadFailure:function(){this.$el.html('').removeClass("no-image")}})});
define("views/cardstream/cards/components/news-category-view",["handlebars","views/layouts/base-layout","views/cardstream/cards/components/card-actions-view","models/form-factor-model"],function(f,g,b,a){return g.extend({template:f.getTemplate("cardstream/cards/components/d-news-category"),regions:{"news-items":".d-news-list"},initialize:function(c){c=c||{};this.category=c.category;this.newsItems=c.newsItems;this.formFactor=a.getInstance();this.host("news-items",new b({className:"d-actions d-news-list",
actions:this.newsItems}));this.listenTo(this.formFactor,"change:contentSize",this.render)},render:function(){this.$el.html(this.template({category:this.category,isLarge:this.formFactor.get("contentSize")==="large"}));return this}},{NAME:"NewsCategoryView"})});
define("views/cardstream/cards/news-summary-card-view","lodash,handlebars,views/cardstream/cards/base-card-view,views/cardstream/cards/components/news-card-image-view,views/cardstream/cards/components/card-title-view,views/cardstream/cards/components/card-actions-view,views/cardstream/cards/components/card-feedback-actions-view,views/cardstream/cards/components/more-less-menu-view,views/cardstream/cards/components/news-category-view,views/layouts/sequence-layout,models/cardstream/card-menu-model,models/form-factor-model,utils/time-utils".split(","),function(f,
g,b,a,c,d,e,h,l,i,j,k,n){return b.extend({template:g.getTemplate("cardstream/cards/d-news-summary-card"),regions:{image:".d-card-image-region",title:".d-card-title-region","category-list":".d-card-headlines-region","feedback-actions":".d-feedback-actions-region","secondary-actions":".d-secondary-actions-region","more-less-menu":".d-more-less-menu-region","delete-action":".d-delete-action-region"},initialize:function(l){l||(l={});b.prototype.initialize.call(this,l);var g=l.secondaryActions||[],n=l.deleteCardAction,
p=l.imageReference||{};this.newsCategories=l.newsCategories||[];f.each(this.newsCategories,function(a){a.newsItems||(a.newsItems=[])});this.formFactor=k.getInstance();this.menuModel=new j;this.creationTimestamp=l.creationTimestamp||(new Date).getTime();p.fallbackIcon||(p.fallbackIcon="AP_NEWS");this.host("title",new c({title:l.title,subtitle:this._getCardSubtitle(l.subtitle,this.creationTimestamp)}));this.host("image",new a({reference:p,caption:l.imageCaption||"News provided by ap.org"}));this.categoryListLayout=
new i;this.host("category-list",this.categoryListLayout);this.feedbackActionsView=new e({cardData:l,collapsed:!!g.length});this.feedbackActionsView.isVisible()&&this.host("feedback-actions",this.feedbackActionsView);n&&this.host("delete-action",new d({className:"d-actions delete-action",actions:[n]}));if(g.length||this.newsCategories.length>1||n||this.feedbackActionsView.isVisible())g.length&&this.host("secondary-actions",new d({className:"d-actions secondary",actions:g})),this.host("more-less-menu",
new h({menuModel:this.menuModel})),this.listenTo(this.menuModel,"change:isOpen",this._onMenuOpenChange),this.listenTo(this,"show:extra-actions",this._onShowExtraActions),this.listenTo(this,"hide:extra-actions",this._onHideExtraActions);this.listenTo(this.formFactor,"change:contentSize",this.render)},render:function(){var a=this.formFactor.get("contentSize"),c=this.menuModel.get("isOpen");this.$el.html(this.template({caption:this.imageCaption,isLarge:a==="large"}));this._populateCategoryListLayout(c);
this.$(".collapsible-section").toggle(c);return b.prototype.render.call(this)},_getCardSubtitle:function(a,c){return a+n.formatLongDateTime(c)},_onMenuOpenChange:function(a,c){this._populateCategoryListLayout(c);this.$(".collapsible-section").toggle(c)},_onShowExtraActions:function(){this.menuModel.set("isOpen",!0)},_onHideExtraActions:function(){this.menuModel.get("wasToggledByUser")||this.menuModel.set("isOpen",!1)},_pushCategoryView:function(a){this.categoryListLayout.pushView(new l({category:a.category,
newsItems:a.newsItems}))},_populateCategoryListLayout:function(a){var c=this;this.categoryListLayout.removeAll();a?f(this.newsCategories).each(function(a){c._pushCategoryView(a)}):this._pushCategoryView(this.newsCategories[0])}},{NAME:"NewsSummaryCardView"})});
define("views/cardstream/cards/components/card-action-link",["backbone","views/base-view"],function(f,g){return g.extend({tagName:"a",className:"d-card-action-link",events:{click:"_onClick"},initialize:function(b){b||(b={});this.action=b.action},render:function(){this.action&&this.$el.html(this.action.mainText);return this},_onClick:function(){this.action&&f.trigger("CardAction",this.action)}},{NAME:"CardActionLink"})});
define("views/cardstream/cards/error-card-view","handlebars,models/platform-model,views/cardstream/cards/base-card-view,views/cardstream/cards/components/card-action-link,views/cardstream/cards/components/card-actions-view,views/cardstream/cards/components/card-footer-view".split(","),function(f,g,b,a,c,d){return b.extend({template:f.getTemplate("cardstream/cards/d-error-card"),regions:{action:".d-error-card-action","footer-region":".d-card-footer-region"},initialize:function(c){c||(c={});b.prototype.initialize.call(this,
c);this._canHostAction(c.action)&&this.host("action",new a({action:c.action}));this.cardData=c;this.footerView=new d(c,{feedbackDisabled:!0});this.host("footer-region",this.footerView);this.listenTo(this,"show:extra-actions",this._onShowExtraActions);this.listenTo(this,"hide:extra-actions",this._onHideExtraActions)},render:function(){this.$el.html(this.template({title:this.cardData.title,descriptiveText:this.cardData.descriptiveText}));return b.prototype.render.call(this)},_canHostAction:function(a){if(!a)return!1;
var b,d;a.url||(a.url="");d=g.getInstance().supports("purchasing");b=a.actionType===c.OPEN_URL_ACTION&&a.url.indexOf("amazon.com")!==-1;a=a.actionType===c.SEARCH_MP3_ACTION;return d||!d&&!b&&!a},_onShowExtraActions:function(){this.footerView.showExtraActions()},_onHideExtraActions:function(){this.footerView.hideExtraActions()}},{NAME:"ErrorCardView"})});
define("views/cardstream/card-factory","views/cardstream/cards/base-card-view,views/cardstream/cards/standard-card-view,views/cardstream/cards/cloud-player-card-view,views/cardstream/cards/weather-card-view,views/cardstream/cards/text-card-view,views/cardstream/cards/to-do-card-view,views/cardstream/cards/news-summary-card-view,views/cardstream/cards/error-card-view".split(","),function(f,g,b,a,c,d,e,h){var l={ErrorCard:h,ToDoCard:d,NewsSummaryCard:e,StandardCard:g,CloudPlayerCard:b,WeatherCard:a,
TextCard:c,Card:f};return{getCardTypeView:function(a){return l[a]}}});
define("views/button-view",["jquery","lodash","views/base-view"],function(f,g,b){return b.extend({className:"d-button-view",enabled:!0,events:{click:"callButtonAction"},initialize:function(a){a||(a={});g.bindAll(this,"enable","disable");this.label=a.label;this.callback=a.callback;this.icon=a.icon;this.automationId=a.automationId;this.render()},render:function(){this.$el.empty();this.label&&this.$el.text(this.label);this.icon&&this.$el.append(f("",{"class":this.icon}));this.automationId&&this.$el.attr("data-automation-id",
this.automationId);this.$el.toggleClass("d-disabled",!this.enabled);return this},callButtonAction:function(){g.isFunction(this.callback)&&this.enabled&&this.callback()},setEnabled:function(a){this.enabled=a;return this},enable:function(){return this.setEnabled(!0).render()},disable:function(){return this.setEnabled(!1).render()},setLabel:function(a){this.label=a;return this},setCallback:function(a){this.callback=a;return this}},{NAME:"ButtonView"})});
define("views/cardstream/card-list-view","lodash,jquery,backbone,views/layouts/sequence-layout,collections/cardstream/card-collection,utils/to-do-multiplexer,views/cardstream/card-factory,views/button-view,utils/log".split(","),function(f,g,b,a,c,d,e,h,l){var i=a.extend({loadingSpinnerWipesScreen:!0,className:"d-cardstream-list-view",events:{"click #d-cardstream-get-more":"showMoreOldCards"},initialize:function(a){a||(a={});this.renderSegmentSize=a.renderSegmentSize||10;this.renderSegmentDelay=a.renderSegmentDelay||
25;this.collection=c.getInstance();this.todoMultiplexer=d.getInstance();this.resetPendingQueue();f.bindAll(this,"renderOneSegment")},getFetchables:function(){return[this.todoMultiplexer,this.collection]},startListening:function(){this.listenTo(this.collection,"add",this.onCardAdd);this.listenTo(this.collection,"remove",this.onCardRemove);this.listenTo(this.collection,"reset",this.render);this.listenTo(this.collection,"change",this.onCardChange);this.listenTo(this.collection,"error",this.hideLoadingMoreOldCards);
this.collection.restartPolling(i.NAME);this.todoMultiplexer.startPolling(i.NAME)},dispose:function(){this.todoMultiplexer.stopPolling(i.NAME);this.collection.stopPolling(i.NAME);this.resetPendingQueue();a.prototype.dispose.apply(this,arguments)},render:function(){this.hasFetched?(this.resetPendingQueue(),this.removeAll(),this.$el.empty(),this.addToPendingQueue(this.collection.models)):this.$el.html(this.loadingTemplate());return this},resetPendingQueue:function(){this._pendingQueue=[]},addToPendingQueue:function(a){f.isArray(a)||
(a=[a]);var c=this._pendingQueue.length===0;Array.prototype.push.apply(this._pendingQueue,a);c&&f.defer(this.renderOneSegment)},removeFromPendingQueue:function(a){var c=!1;if(this._pendingQueue&&this._pendingQueue.length&&(a=f.findWhere(this._pendingQueue,{id:a.id})))this._pendingQueue=f.without(this._pendingQueue,a),c=!0;return c},renderOneSegment:function(){var a,c,b;this.removeMoreButton();for(b=0;b").addClass("d-large-spinner")).addClass("loading")},
hideLoadingMoreOldCards:function(){this._moreButton&&this._moreButton.$el.removeClass("loading").empty().html("More").prop("disabled",!1)},onCardAdd:function(a){this.addToPendingQueue(a)},onCardRemove:function(a){this.removeFromPendingQueue(a)||(this.removeView("#"+a.id.replace("#","\\#")),b.trigger("DOMModified"))},onCardChange:function(a){var c,b=this;f(a.changedAttributes()).omit("giveFeedbackAction","thumbsUpDownActivityAction").isEmpty()||(c="#"+a.id.replace("#","\\#"),this.$(c).slideUp(function(){b.onCardRemove(a);
b.insertCard(a,b.collection.indexOf(a));b.$(c).hide().slideDown()}))},insertCard:function(a,c){var b=a.get("cardType"),d=e.getCardTypeView(b),h=f.cloneDeep(a.attributes);if(d){b=new d(h);if(!c)this.topCard&&this.topCard.trigger("hide:extra-actions"),this.topCard=b,this.topCard.trigger("show:extra-actions");this.insertView(b,c)}else l.warn("Could not obtain card view for type: "+b)}},{NAME:"CardListView"});return i});
define("compositors/small/card-compositor","lodash,backbone,models/app-layout-options-model,views/message-view,views/layouts/header-player-layout,views/base-view,views/cardstream/card-list-view".split(","),function(f,g,b,a,c,d,e){var h=d.extend({views:{cardListView:{constructor:e,scrollable:!0}},initialize:function(d){d||(d={});b.getInstance().restoreDefaults();this.router=d.router;this.listenTo(this.router,"route:cards",this.cardStream);this.layout=new c({el:this.el});this.messageView=new a;this.layout.render().host("message",
this.messageView).setSelector("#d-page");this.listenTo(g,"scrollCardStream",this._scrollCardStream)},cardStream:function(){this.layout.hostContent(this.getView("cardListView"),h.HOME_STREAM_TITLE).setTheme("LIGHT");this._scrollCardStream(0);f.defer(function(){g.trigger("loadImagesInViewport")})},_scrollCardStream:function(a){this.getView("cardListView").scrollTo(a)}},{NAME:"CardSmallCompositor",HOME_STREAM_TITLE:"Home"});return h});
define("utils/media-owner-sensitive",["lodash","collections/music/media-owner-collection"],function(f,g){return{extendFrom:function(b){var a=function(a){return function(b){var b=f.extend({},b),e;g.getInstance().get(this.SERVICE_PROVIDER)&&(e=g.getInstance().getId(this.SERVICE_PROVIDER));e=this._hasChangedCustomerId(e);b.reset||(b.reset=e);return a.call(this,b)}};return b.extend({constructor:function(){b.apply(this,arguments);this.fetch=a(this.fetch)},_updateLastCustomerId:function(a){this._lastCustomerId=
a},_hasChangedCustomerId:function(a){return!a||this._lastCustomerId!==a},fetch:function(a){var b=this,e=a&&a.error?a.error:null,h,f,a=a||{};a.error=function(){b.trigger.apply(b,["musicFetchError"].concat(arguments));e&&e.apply(b,arguments)};f=g.getInstance().fetch().then(function(){var e=g.getInstance().getId(this.SERVICE_PROVIDER);b._hasChangedCustomerId(e);return h=b.baseClassFetch.call(b,a)}).fail(function(){b.trigger.apply(b,["musicFetchError"].concat(arguments))});f.abort=function(){h&&h.abort()};
return f},baseClassFetch:function(a){var d=g.getInstance().get(this.SERVICE_PROVIDER).get("customerId"),e={mediaOwnerCustomerId:d},h=this._hasChangedCustomerId(d),a=f.extend({},a);a.data=f.extend({},a.data,e);a.reset||(a.reset=h);h&&f.bind(this._updateLastCustomerId,this,d)();return!this.accountAssociationRequired||g.getInstance().hasAccountAssociation(this.SERVICE_PROVIDER)?b.prototype.fetch.call(this,a):$.Deferred().resolve().promise()}})}}});
define("models/music/music-base-model",["models/base-model","utils/media-owner-sensitive"],function(f,g){return g.extendFrom(f).extend({},{NAME:"MusicBaseModel"})});define("utils/custom-xhr-exception",[],function(){return{create:function(f){return{responseText:JSON.stringify({message:f})}}}});
define("models/music/cloudplayer/cloud-player-base-model","jquery,constants,lodash,collections/device-collection,models/music/music-base-model,utils/custom-xhr-exception".split(","),function(f,g,b,a,c,d){return c.extend({fetch:function(e){var h=a.getInstance(),l=this,i,j,k=function(){l.trigger.apply(l,["musicFetchError"].concat(arguments));e.error&&e.error.apply(l,arguments)},e=e||{};j=h.fetch().then(function(){var a=h.getCurrentlySelectedDevice();return a?(e.data=b.extend({},e.data,{deviceSerialNumber:a.get("serialNumber"),
deviceType:a.get("deviceType")}),e.error=k,i=c.prototype.fetch.call(l,e)):(k(l,d.create(g.TXT_NO_DEVICE_SELECTED),e),f.Deferred().reject().promise())});j.abort=function(){i&&i.abort()};return j},SERVICE_PROVIDER:g.SP_CLOUD_PLAYER},{NAME:"CloudPlayerBaseModel"})});
define("models/music/cloudplayer/cloud-player-album-model",["lodash","constants","models/music/cloudplayer/cloud-player-base-model"],function(f,g,b){return b.extend({defaults:{fetched:!1,albumName:null,artistName:null},initialize:function(){this.listenTo(this,"change",function(){this.set("fetched",!0)})},url:function(){return g.URL+g.API_PREFIX+"/cloudplayer/tracks"},fetch:function(a){a=a||{};a.data=f.extend({},a.data);a.data.size=a.data.size||50;a.data.albumName=this.get("albumName");a.data.albumArtistName=
this.get("albumArtistName");return b.prototype.fetch.call(this,a)},parse:function(a){var c=f.first(a.selectItemList).metadata;a.albumCoverImageTiny=c.albumCoverImageTiny;a.albumName=c.albumName;a.albumArtistName=c.albumArtistName;a.isoTimestamp=(new Date).toISOString();f.each(a.selectItemList,function(a){a.metadata.primeStatusAttribute="";if(a.metadata.primeStatus)a.metadata.primeStatusAttribute=a.metadata.primeStatus==="PRIME"?"prime":"prime disabled"});return a}},{NAME:"CloudPlayerAlbumModel"})});
define("models/music/ihr/ihr-base-model",["constants","models/music/music-base-model","utils/music-helper"],function(f,g,b){return g.extend({parse:function(a){b.populateIHRImageTiny(a);return a},SERVICE_PROVIDER:f.SP_IHEART},{NAME:"IHRBaseModel"})});
define("models/music/ihr/ihr-livestations-model",["models/music/ihr/ihr-base-model","constants","utils/scope"],function(f,g,b){var a=f.extend({idAttribute:"genreId",defaults:{genreId:null,genreName:null,streams:null},parse:function(a){a.musicGenres.map(function(b,e){b.genreId<1&&a.musicGenres.splice(e,1)});a.talkGenres.map(function(b,e){b.genreId<1&&a.talkGenres.splice(e,1)});return a},url:g.URL+g.API_PREFIX+"/iheartradio/live-radio-genres"},{NAME:"IHRLiveStationsModel",getInstance:b.singleton(function(){return new a})});
return a});
define("models/music/ihr/ihr-perfectfor-model","moment,lodash,constants,utils/scope,utils/music-helper,models/music/ihr/ihr-base-model".split(","),function(f,g,b,a,c,d){var e=d.extend({expires:6E5,defaults:{dayPart:null,weekdayName:null,activities:null},url:b.URL+b.API_PREFIX+"/iheartradio/perfect-for-activities",getPerfectForActivities:function(){return this.get("activities")},fetch:function(a){var a=a||{},c=f().format("YYYY-MM-DD HH:mm:ss");a.data=g.extend({},a.data,{localTime:c});return d.prototype.fetch.call(this,a)},
parse:function(a){g.isEmpty(a.activities)||g(a.activities).each(function(a){c.populateIHRImageTiny(a);g.isEmpty(a.categories)||g(a.categories).each(function(a){g.isEmpty(a.stations)||g(a.stations).each(function(a){c.populateIHRImageTiny(a)})})});return a}},{NAME:"IHRPerfectForModel",getInstance:a.singleton(function(){return new e})});return e});
define("models/client-device-model",["models/base-model","utils/scope","utils/js-bridge","utils/user-agent"],function(f,g,b,a){var c;return c=f.extend({fetch:function(){var a=this;return b.postMessage({target:"AppInfo",method:"getDeviceInfo"}).done(function(c){c&&a.set(c);a.hasSynced=!0})},supportsAutocast:function(){var c,b,h,f=!1;if(c=/(\d+)\.(\d+)(\.\d+)?/.exec(this.get("fireos")))b=parseInt(c[1]||0,10),h=parseInt(c[2]||0,10),c=c[3]?parseInt(c[3].substring(1),10):0,b>4?f=!0:b===4&&(h>5?f=!0:h===
5&&(f=c>=1));return f&&a.isAutocastable()}},{NAME:"ClientDeviceModel",getInstance:g.singleton(function(){return new c})})});
define("models/device-preferences-model",["lodash","models/base-model","constants","models/client-device-model","utils/error"],function(f,g,b,a,c){var d=g.extend({url:function(){var c=a.getInstance(),d=b.URL+b.API_PREFIX+"/device-preferences/"+this.get("deviceSerialNumber"),f=c.get("dsn"),g=c.get("deviceType");c.supportsAutocast()&&f&&g&&(d+="?clientDeviceSerialNumber="+f+"&clientDeviceType="+g);return d},idAttribute:"deviceSerialNumber",defaults:{searchCustomerId:null,deviceType:null,deviceSerialNumber:null,
deviceAccountId:null,postalCode:null,temperatureScale:"FAHRENHEIT",voiceCastEnabled:null,autocastToThisClient:!1},checkPostalCodeValid:function(a){return/^[0-9]{5}$/.test(a||this.get("postalCode"))},checkTemperatureScaleValid:function(){var a=this.get("temperatureScale");return!!f.find(d.TEMPERATURE_SCALES,function(c){return c.value===a})},checkValid:function(){var a=!0;c.clearValidationErrors(this);this.hasChanged("postalCode")&&!this.checkPostalCodeValid()&&(a=!1,c.publishValidationError(this,"postalCode",
"Please provide a valid 5 digit zip code."));this.hasChanged("temperatureScale")&&!this.checkTemperatureScaleValid()&&(a=!1,c.publishValidationError(this,"temperatureScale","Please select a temperature scale."));return a}},{NAME:"DevicePreferencesModel",TEMPERATURE_SCALE_IMPERIAL:"FAHRENHEIT",TEMPERATURE_SCALE_METRIC:"CELSIUS",TEMPERATURE_SCALES:[{value:"FAHRENHEIT",text:"U.S."},{value:"CELSIUS",text:"Metric"}]});return d});
define("collections/device-preferences-collection","lodash,constants,collections/base-collection,collections/device-collection,models/device-preferences-model,utils/scope,models/client-device-model".split(","),function(f,g,b,a,c,d,e){var h=b.extend({initialize:function(){this.clientDevice=e.getInstance()},expires:6E4,model:c,url:g.URL+g.API_PREFIX+"/device-preferences",parse:function(a){return a.devicePreferences},fetch:function(c){var d=this;c||(c={});return this.clientDevice.fetch().then(function(){var e=
{cached:a.getInstance().useCache};if(d.clientDevice.supportsAutocast())e.clientDeviceSerialNumber=d.clientDevice.get("dsn"),e.clientDeviceType=d.clientDevice.get("deviceType");c.data=f.extend(e,c.data);return b.prototype.fetch.call(d,c)})}},{NAME:"DevicePreferencesCollection",getInstance:d.singleton(function(){return new h})});return h});
define("models/music/ihr/ihr-market-model",["models/music/ihr/ihr-base-model"],function(f){return f.extend({idAttribute:"marketId",defaults:{marketId:null,marketName:null,marketState:null,marketStateAbbreviation:null,marketStateId:null,streams:null}},{NAME:"IHRMarketModel"})});
define("models/music/ihr/ihr-local-market-model","jquery,constants,collections/device-collection,collections/device-preferences-collection,models/music/ihr/ihr-market-model,utils/scope".split(","),function(f,g,b,a,c,d){var e=c.extend({idAttribute:"cityId",url:g.URL+g.API_PREFIX+"/iheartradio/market",parse:function(a){a.marketId=a.cityId;a.marketName=a.cityName;delete a.cityName;a.marketStateAbbreviation=a.stateName;delete a.stateName;return a},fetch:function(d){var e,g,j=this,k=b.getInstance(),n=
a.getInstance(),d=d||{};g=f.when(k.fetch(),n.fetch()).done(function(){var a=k.getCurrentlySelectedDevice();if(a)a=n.get(a.get("serialNumber")),d.zipCode=a.get("postalCode")||null;if(j.previousZipCode!==d.zipCode)d.reset=!0;j.previousZipCode=d.zipCode;return e=c.prototype.fetch.call(j,d)});g.abort=function(){e&&e.abort()};return g}},{NAME:"IHRLocalMarketModel",getInstance:d.singleton(function(){return new e})});return e});
define("models/music/cloudplayer/cloud-player-playlist-track-item-model",["constants","collections/music/media-owner-collection","models/music/cloudplayer/cloud-player-base-model"],function(f,g,b){return b.extend({defaults:{metadata:null,trackId:null,entryId:null,isoTimestamp:null},parse:function(a){var c,b;if(a){c=a.metadata;b=c.title;a.id=a.entryId?a.entryId:c.asin;a.mainText=b;a.subText=c.artistName;a.imageIcon=c.albumCoverImageTiny;a.dataId=a.id;a.primeStatus=c.primeStatus;a.asin=c.asin;a.marketplaceId=
c.marketplaceId;if(this.collection.isThisSmartPlaylist())a.corrupted=!c.assetType||c.assetType!=="AUDIO";a.primeStatusAttribute="";if(c.primeStatus)a.primeStatusAttribute=c.primeStatus==="PRIME"&&g.getInstance().get(f.SP_CLOUD_PLAYER).get("primeStatus")?"prime":"prime disabled";a.data=[];a.data.push({key:"data-title",value:b});a.data.push({key:"data-artistname",value:c.artistName})}return a}},{NAME:"CloudPlayerPlaylistTrackItemModel"})});
define("collections/music/music-base-collection",["collections/base-collection","utils/media-owner-sensitive"],function(f,g){return g.extendFrom(f).extend({},{NAME:"MusicBaseCollection"})});define("collections/music/music-infinite-collection",["collections/music/music-base-collection"],function(f){return f.extend({maxLength:1E3,trim:function(){this.remove(this.tail(this.maxLength))}},{NAME:"MusicInfiniteCollection"})});
define("collections/music/cloudplayer/cloud-player-base-collection",["jquery","lodash","constants","collections/device-collection","collections/music/music-infinite-collection"],function(f,g,b,a,c){return c.extend({expires:-1,firstFetch:!0,setOffsets:function(a,c){this.headOffset=a;this.tailOffset=c},calculateOffsets:function(a){a=g.clone(a)||{};a.data=g.clone(a.data)||{};var c=a.success,b=a.reset;a.data.size||(a.data.size=50);if(b||this.firstFetch)this.firstFetch=!0,this.previousLength=0,this.setOffsets(0,
0);a.data.offset=a.fromHead?this.headOffset-a.data.size:this.tailOffset;a.success=function(a,b,d){var h=a.length-(a.firstFetch?0:a.previousLength);a.firstFetch=!1;a.previousLength=a.length;d.fromHead?a.headOffset-=h:a.tailOffset+=h;c&&c.apply(this,arguments)};return a},fetch:function(b){b||(b={});var e=a.getInstance(),h=this,l,i;i=e.fetch().then(function(){var a=e.getCurrentlySelectedDevice(),k=b.error;b.error=function(){h.trigger.apply(h,["musicFetchError"].concat(arguments));k&&k.apply(h,arguments)};
return a?(b.data=g.extend({deviceSerialNumber:a.get("serialNumber"),deviceType:a.get("deviceType")},b.data),b=h.calculateOffsets(b),l=c.prototype.fetch.call(h,b)):f.Deferred().reject().promise()}).fail(function(){h.trigger.apply(h,["deviceFetchError"].concat(arguments))});i.abort=function(){l&&l.abort()};return i},SERVICE_PROVIDER:b.SP_CLOUD_PLAYER})});
define("collections/music/cloudplayer/cloud-player-playlist-track-collection",["constants","lodash","models/music/cloudplayer/cloud-player-playlist-track-item-model","collections/music/cloudplayer/cloud-player-base-collection","utils/music-helper"],function(f,g,b,a,c){var d={},e=[f.ID_IMPORTED,f.ID_PURCHASED,f.ID_RECENTLY_ADDED],h=a.extend({initialize:function(a,c){c=c||{};this.playlistId=c.playlistId;this.totalResultCount=this.title=null},model:b,nextToken:void 0,url:function(){return f.URL+f.API_PREFIX+
"/cloudplayer/playlists/"+this.playlistId},parse:function(a){a=a||{};a.playlist=a.playlist||{};if(!this.title&&a.playlist.title)this.title=a.playlist.title;if(this.totalResultCount===null)this.totalResultCount=a.playlist.trackCount;this.isoTimestamp=(new Date).toISOString();a.playlist.entryList=a.playlist.entryList||[];g.each(a.playlist.entryList,function(a){a.isoTimestamp=this.isoTimestamp},this);return a.playlist.entryList},getTrackIndex:function(a){return!this.isSmartPlaylist(this.playlistId)?
this.indexOf(a)+1:c.getTrackIndex(a,this)},calculateOffsets:function(a){a.data.size=this.isSmartPlaylist(this.playlistId)?50:500;a.data.offset=this.nextToken?this.nextToken:"";return a},fetch:function(c){c=g.clone(c)||{};c.data=g.clone(c.data)||{};var b=this;return c.fromHead||this.nextToken===null?(c.success&&c.success.call(this,this,[]),$.Deferred().resolve().promise()):a.prototype.fetch.call(this,c).done(function(a){b._onSuccess(b,a,c)})},_onSuccess:function(a,c){a.nextToken=c.nextResultsToken},
isThisSmartPlaylist:function(){return this.isSmartPlaylist(this.playlistId)},isSmartPlaylist:function(a){return g.contains(e,a)}},{NAME:"CloudPlayerPlaylistTrackCollection",clearStoredPlaylists:function(){d={}},prefetchPlaylists:function(){g.each([f.ID_IMPORTED,f.ID_PURCHASED,f.ID_RECENTLY_ADDED],function(a){d[a]||(d[a]=new h([],{playlistId:a}));d[a].fetch()})},getTracksForPlaylist:function(a){if(d[a])this.tracksForLastPlaylist=d[a];else if(!this.tracksForLastPlaylist||this.tracksForLastPlaylist.playlistId!==
a)this.tracksForLastPlaylist=new h([],{playlistId:a});return this.tracksForLastPlaylist}});return h});define("models/music/cloudplayer/cloud-player-playlist-model",["models/music/cloudplayer/cloud-player-base-model"],function(f){return f.extend({idAttribute:"playlistId",defaults:{playlistId:null,title:null,trackCount:0,fetched:!1},initialize:function(){this.listenTo(this,"change",function(){this.set("fetched",!0)})}},{NAME:"CloudPlayerPlaylistModel"})});
define("collections/music/cloudplayer/cloud-player-playlist-collection",["collections/music/cloudplayer/cloud-player-base-collection","models/music/cloudplayer/cloud-player-playlist-model","lodash"],function(f,g,b){var a=f.extend({expires:6E5,nextToken:void 0,initialize:function(){this.fetched=!1;this.listenTo(this,"reset",function(){this.fetched=!0})},model:g,parse:function(a){return b.flatten(b.values(a.playlists),!0)},preview:function(){return(new a).set(this.first(a.PREVIEW_COUNT))},calculateOffsets:function(a){var b=
a.success;a.success=function(a,c,f){a.nextToken=c.nextResultsToken;b&&b.apply(this,arguments)};return a},fetch:function(a){a=b.clone(a)||{};a.data=b.clone(a.data)||{};return a.data.fromHead?(a.success&&a.success.call(this,this,[]),$.Deferred().resolve().promise()):f.prototype.fetch.apply(this,arguments)}},{NAME:"CloudPlayerPlaylistCollection",PREVIEW_COUNT:5});return a});
define("collections/music/cloudplayer/cloud-player-my-playlist-collection",["collections/music/cloudplayer/cloud-player-playlist-collection","utils/scope","constants"],function(f,g,b){var a=f.extend({url:b.URL+b.API_PREFIX+"/cloudplayer/playlists",parse:function(a){a.playlists[b.TXT_UPGRADED_AUDIO]&&delete a.playlists[b.TXT_UPGRADED_AUDIO];return f.prototype.parse.apply(this,arguments)}},{NAME:"CloudPlayerMyPlaylistCollection",getInstance:g.singleton(function(){return new a})});return a});
define("collections/music/cloudplayer/cloud-player-smart-playlist-collection",["collections/music/cloudplayer/cloud-player-playlist-collection","utils/scope","constants"],function(f,g,b){var a=f.extend({url:b.URL+b.API_PREFIX+"/cloudplayer/smart-playlists"},{NAME:"CloudPlayerSmartPlaylistCollection",getInstance:g.singleton(function(){return new a})});return a});
define("collections/music/cloudplayer/cloud-player-prime-playlist-collection",["collections/music/cloudplayer/cloud-player-playlist-collection","utils/scope","constants"],function(f,g,b){var a=f.extend({url:b.URL+b.API_PREFIX+"/cloudplayer/prime-playlists"},{NAME:"CloudPlayerPrimePlaylistCollection",getInstance:g.singleton(function(){return new a})});return a});
define("models/music/cloudplayer/cloud-player-artist-item-model",["models/music/cloudplayer/cloud-player-base-model","views/base-view"],function(f,g){return f.extend({defaults:{mainText:null,artistName:null,metadata:null,numTracks:0},parse:function(b){var a;if(b){a=b.metadata.artistName;b.id=g.sanitizeId(a);b.mainText=a;if(b.metadata&&b.metadata.albumCoverImageTiny)b.imageIcon=b.metadata.albumCoverImageTiny;b.dataId=a;b.data=[];b.data.push({key:"data-artistname",value:a});b.data.push({key:"data-numtracks",
value:b.numTracks})}return b}},{NAME:"CloudPlayerArtistItemModel"})});
define("collections/music/cloudplayer/cloud-player-base-collection-cirrus-v3",["jquery","lodash","constants","collections/device-collection","collections/music/music-infinite-collection"],function(f,g,b,a,c){return c.extend({expires:-1,firstFetchCount:void 0,_headReached:!0,_previousHeadReached:!0,_tailReached:!1,fetch:function(b){var e=a.getInstance(),h=this,l,i,b=g.clone(b)||{};b.data=g.clone(b.data)||{};b.reset&&this._resetState();if(b.data.alphaNum)b.data.bufferSize=b.data.bufferSize||50;else{if(h._headReached&&
b.fromHead||h._tailReached&&!b.fromHead)return b.success&&b.success.call(h,h,[]),f.Deferred().resolve().promise();b.data.nextToken=b.fromHead?h._headToken:h._tailToken;if(h._alphaNum)b.data.alphaNum=h._alphaNum,b.scrollingRequest=!0}if(b.fromHead)b.data.reverseDirection=1,b.at=0;i=e.fetch().then(function(){var a=e.getCurrentlySelectedDevice();b.data.size=b.data.size||50;return a?(b.data=g.extend({deviceSerialNumber:a.get("serialNumber"),deviceType:a.get("deviceType")},b.data),l=c.prototype.fetch.call(h,
b).done(function(a){h._onSuccess(h,a,b)}).fail(function(){h.trigger.apply(h,["musicFetchError"].concat(arguments))})):h._onFail(b,h)},function(){return h._onFail(b,h)});i.abort=function(){l&&l.abort()};return i},hasHeadReached:function(){return this._headReached},_onSuccess:function(a,c,b){if(b.fromHead)a._headToken=c.nextToken,a._headReached=!a._headToken;else{a._alphaNum=b.data.alphaNum;if(a._alphaNum&&!b.scrollingRequest)a._headReached=!c.bufferNextToken,a._headToken=c.bufferNextToken;a._tailToken=
c.nextToken;a._tailReached=!a._tailToken}b.firstAlphaNumSelected&&(a._headReached=!0);if(g.isUndefined(a.firstFetchCount))a.firstFetchCount=c.resultCount,!a._tailReached&&(a.firstFetchCount+="+"),a.trigger("collection:change:firstFetchCount");if(a._previousHeadReached!==a._headReached)a.trigger("collection:change:headReached"),a._previousHeadReached=a._headReached},_onFail:function(a,c){a.error&&a.error(c,{textStatus:b.TXT_NO_DEVICE_SELECTED},a);return f.Deferred().reject().promise()},_resetState:function(){this._alphaNum=
this._tailToken=this._headToken="";this._previousHeadReached=this._headReached=!0;this._tailReached=!1;this.firstFetchCount=void 0},SERVICE_PROVIDER:b.SP_CLOUD_PLAYER})});
define("collections/music/cloudplayer/cloud-player-artist-collection",["lodash","constants","models/music/cloudplayer/cloud-player-artist-item-model","collections/music/cloudplayer/cloud-player-base-collection-cirrus-v3","utils/scope"],function(f,g,b,a,c){var d=a.extend({initialize:function(){this.totalResultCount=null},model:b,url:g.URL+g.API_PREFIX+"/cloudplayer/artists",parse:function(a){if(this.totalResultCount===null||this.query)this.totalResultCount=a.resultCount;f.each(a.selectItemList,function(a){a.artistName=
a.metadata.artistName});return a.selectItemList}},{NAME:"CloudPlayerArtistCollection",getInstance:c.singleton(function(){return new d})});return d});
define("models/music/cloudplayer/cloud-player-genre-item-model",["models/music/cloudplayer/cloud-player-base-model","views/base-view"],function(f,g){return f.extend({defaults:{metadata:null,primaryGenre:null,numTracks:0},parse:function(b){var a;if(b)a=b.metadata.primaryGenre,b.id=g.sanitizeId(b.metadata.id),b.mainText=a,b.imageIcon=b.metadata.albumCoverImageTiny,b.dataId=a,b.data=[],b.data.push({key:"data-genre",value:a}),b.data.push({key:"data-numtracks",value:b.numTracks});return b}},{NAME:"CloudPlayerGenreItemModel"})});
define("collections/music/cloudplayer/cloud-player-genre-collection",["lodash","constants","models/music/cloudplayer/cloud-player-genre-item-model","collections/music/cloudplayer/cloud-player-base-collection-cirrus-v3","utils/scope"],function(f,g,b,a,c){var d=a.extend({model:b,initialize:function(){this.totalResultCount=null},url:g.URL+g.API_PREFIX+"/cloudplayer/genres",parse:function(a){var c=f.isNull(a.selectItemList)||f.isUndefined(a.selectItemList)?0:a.selectItemList.length;if(this.totalResultCount===
null||this.query)this.totalResultCount=a.resultCount;a.length=a.length||c;return a.selectItemList}},{NAME:"CloudPlayerGenreCollection",getInstance:c.singleton(function(){return new d})});return d});
define("models/music/cloudplayer/cloud-player-album-item-model",["models/music/cloudplayer/cloud-player-base-model","views/base-view"],function(f,g){return f.extend({defaults:{mainText:null,subText:null,albumName:null,metadata:null,numTracks:0},parse:function(b){var a,c=b.metadata;if(b)a=c.albumName,b.id=g.sanitizeId(c.objectId),b.mainText=a,b.subText=c.albumArtistName,b.numTracks=parseInt(b.numTracks,10),b.imageIcon=c.albumCoverImageTiny,b.dataId=c.objectId,b.data=[],b.data.push({key:"data-albumname",
value:a}),b.data.push({key:"data-albumartistname",value:b.subText}),b.data.push({key:"data-albumtrackcount",value:b.numTracks}),b.data.push({key:"data-albumid",value:b.id});return b}},{NAME:"CloudPlayerAlbumItemModel"})});
define("collections/music/cloudplayer/cloud-player-album-collection",["lodash","constants","models/music/cloudplayer/cloud-player-album-item-model","collections/music/cloudplayer/cloud-player-base-collection-cirrus-v3","utils/scope"],function(f,g,b,a,c){var d=a.extend({initialize:function(a,c){c=c||{};this.totalResultCount=null;this.artistName=c.artistName;this.genre=c.genre;this.hideAlbumArtistName=c.hideAlbumArtistName||!1},model:b,url:g.URL+g.API_PREFIX+"/cloudplayer/albums",fetch:function(c){if(this.artistName)c=
c||{},c.data=f.extend({},c.data,{artistName:this.artistName});else if(this.genre)c=c||{},c.data=f.extend({},c.data,{genre:this.genre});return a.prototype.fetch.call(this,c)},parse:function(a){var c=f.isNull(a.selectItemList)||f.isUndefined(a.selectItemList)?0:a.selectItemList.length;if(this.totalResultCount===null||this.query)this.totalResultCount=a.resultCount;a.length=a.length||c;return a.selectItemList}},{NAME:"CloudPlayerAlbumCollection",getInstance:c.singleton(function(){return new d})});return d});
define("models/music/cloudplayer/cloud-player-track-item-model",["constants","collections/music/media-owner-collection","models/music/cloudplayer/cloud-player-base-model","views/base-view"],function(f,g,b,a){return b.extend({defaults:{mainText:null,trackNum:null,title:null,albumName:null,objectId:null,albumCoverImageTiny:null,albumArtistName:null,artistName:null,trackIndex:null,isoTimestamp:null},parse:function(c){var b=c.metadata;if(c){c.id=a.sanitizeId(b.objectId);c.dataId=c.id;c.mainText=b.title;
c.subText=b.artistName;c.imageIcon=b.albumCoverImageTiny;c.objectId=b.objectId;c.primeStatus=b.primeStatus;c.corrupted=!b.assetType||b.assetType!=="AUDIO";c.primeStatusAttribute="";if(b.primeStatus)c.primeStatusAttribute=b.primeStatus==="PRIME"&&g.getInstance().get(f.SP_CLOUD_PLAYER).get("primeStatus")?"prime":"prime disabled";c.data=[];c.data.push({key:"data-title",value:b.title});c.data.push({key:"data-artistname",value:b.artistName})}delete c.metadata;return c}},{NAME:"CloudPlayerTrackItemModel"})});
define("collections/music/cloudplayer/cloud-player-track-collection",["lodash","constants","models/music/cloudplayer/cloud-player-track-item-model","collections/music/cloudplayer/cloud-player-base-collection-cirrus-v3","utils/scope"],function(f,g,b,a,c){var d=a.extend({initialize:function(a,c){c=c||{};this.artistName=c.artistName;this.genre=c.genre;this.totalResultCount=null;this._fetchOffset=0},model:b,url:g.URL+g.API_PREFIX+"/cloudplayer/tracks",fetch:function(c){c=c||{};if(this.artistName)c.data=
f.extend({},c.data,{artistName:this.artistName});if(this.genre)c.data=f.extend({},c.data,{genre:this.genre});if(this.albumName)c.data=f.extend({},c.data,{albumName:this.albumName});return a.prototype.fetch.call(this,c)},parse:function(a){var c=f.isNull(a.selectItemList)||f.isUndefined(a.selectItemList)?0:a.selectItemList.length;if(this.totalResultCount===null||this.query)this.totalResultCount=a.resultCount;a.length=a.length||c;this.isoTimestamp=(new Date).toISOString();return f.map(a.selectItemList,
function(a){a.isoTimestamp=this.isoTimestamp;return a},this)}},{NAME:"CloudPlayerTrackCollection",getInstance:c.singleton(function(){return new d})});return d});
define("collections/music/cloudplayer/cloud-player-search-collection","lodash,constants,models/music/cloudplayer/cloud-player-track-item-model,models/music/cloudplayer/cloud-player-album-item-model,models/music/cloudplayer/cloud-player-artist-item-model,collections/music/cloudplayer/cloud-player-base-collection".split(","),function(f,g,b,a,c,d){var e=d.extend({initialize:function(a,c){c=c||{};this.searchCategory=c.searchCategory;this.query=c.query},model:function(d,f){if(!f.collection.searchCategory)return new b(d,
f);switch(f.collection.searchCategory.toLowerCase()){case e.SearchCategory.ARTISTS:return new c(d,f);case e.SearchCategory.ALBUMS:return new a(d,f);case e.SearchCategory.TRACKS:return new b(d,f)}},url:g.URL+g.API_PREFIX+"/cloudplayer/search",search:function(a,c,b){this.totalResultCount=void 0;this.query=a||"";return this.fetch(c,b)},fetch:function(a,c){var b=f.toArray(arguments),a=f.extend({},a);a.data=f.extend({},a.data);if(!f.isUndefined(a.data.offset)&&a.data.offset>=0)this._fetchOffset=a.data.offset;
a.data.category=this.searchCategory;a.data.query=this.query;b[0]=a;return d.prototype.fetch.apply(this,b)},parse:function(a){var c=f.isNull(a.selectItemList)||f.isUndefined(a.selectItemList)?0:a.selectItemList.length;if(f.isUndefined(this.totalResultCount))this.totalResultCount=a.resultCount;a.length=a.length||c;this.trigger("collection:change:firstFetchCount");this.isoTimestamp=(new Date).toISOString();return f.map(a.selectItemList,function(a,c){a.trackIndex=this._fetchOffset+c;a.isoTimestamp=this.isoTimestamp;
return a},this)}},{NAME:"CloudPlayerSearchCollection",SearchCategory:{ARTISTS:"artists",ALBUMS:"albums",TRACKS:"tracks"}});return e});define("models/music/ihr/ihr-station-model",["jquery","models/music/ihr/ihr-base-model"],function(f,g){return g.extend({defaults:{id:null,artistRadio:null,lastPlayedDate:null,artistName:null,featuredStationId:null,name:null,stationType:null,image:null,description:null},fetch:f.noop},{NAME:"IHRStationModel"})});
define("models/music/ihr/ihr-favorite-model",["models/music/ihr/ihr-station-model"],function(f){return f.extend({defaults:{id:null,artistRadio:null,lastPlayedDate:null,artistName:null,featuredStationId:null,name:null,stationType:null,image:null,description:null,unplayable:!1,favorite:!1,favoriteType:null},parse:function(g){f.prototype.parse.apply(this,arguments);switch(g.favoriteType){case "CR":g.stationType="CUSTOM";break;case "LR":g.stationType="LIVE";break;case "CT":g.stationType="TALK",g.description=
"Talk stations are not currently supported",g.unplayable=!0}return g}},{NAME:"IHRFavoriteModel"})});define("collections/music/ihr/ihr-base-collection",["constants","collections/music/music-base-collection"],function(f,g){return g.extend({SERVICE_PROVIDER:f.SP_IHEART},{NAME:"IHRBaseCollection"})});
define("collections/music/ihr/ihr-favorite-collection","models/music/ihr/ihr-favorite-model,collections/music/ihr/ihr-base-collection,constants,utils/scope,models/player-model,collections/music/media-owner-collection".split(","),function(f,g,b,a,c,d){var e=g.extend({expires:6E5,limit:100,model:f,accountAssociationRequired:!0,initialize:function(){this.listenTo(c.getInstance(),"change:isFavorited",this._onFavoritedChange);this.listenTo(d.getInstance(),"ownerUpdate",function(){this.expire()})},_onFavoritedChange:function(){var a=
c.getInstance().get("service");a&&a.indexOf("I_HEART_RADIO")>-1&&this.expire()},url:function(){return b.URL+b.API_PREFIX+"/iheartradio/favorites"},parse:function(a){return a.favorites},fetch:function(a){a=a||{};a.data=a.data||{};a.data.limit=this.limit;return g.prototype.fetch.call(this,a)}},{NAME:"IHRFavoriteCollection",getInstance:a.singleton(function(){return new e})});return e});
define("collections/music/ihr/ihr-mystation-collection",["lodash","models/music/ihr/ihr-station-model","collections/music/ihr/ihr-base-collection","constants"],function(f,g,b,a){return b.extend({expires:6E5,model:g,accountAssociationRequired:!0,initialize:function(a){a=a||{};this.url=this.urlRoot+(a.name||"custom-stations")},urlRoot:a.URL+a.API_PREFIX+"/iheartradio/",parse:function(a){a=a.radioStationList;f.each(a,function(a){if(f.indexOf(["MOOD","ARTIST","TRACK"],a.stationType)>=0)a.stationType=
"MYSTATION_"+a.stationType});return a}},{NAME:"IHRMyStationCollection"})});define("collections/music/ihr/ihr-market-collection",["collections/music/ihr/ihr-base-collection","models/music/ihr/ihr-market-model"],function(f,g){return f.extend({model:g},{NAME:"IHRMarketCollection"})});
define("models/music/ihr/ihr-liveradio-state-city-model",["lodash","models/music/ihr/ihr-base-model","collections/music/ihr/ihr-market-collection"],function(f,g,b){return g.extend({idAttribute:"stateId",defaults:{stateId:null,stateName:!0,stateAbbreviation:null,cities:null},parse:function(a){var c=new b;f.each(a.cities,function(a){c.add({marketId:a.cityId,marketName:a.cityName,marketState:a.cityState,marketStateAbbreviation:a.cityStateAbbreviation,marketStateId:a.cityStateId,streams:a.streams})});
a.cities=c;return a}},{NAME:"IHRLiveRadioStateCityModel"})});define("collections/music/ihr/ihr-liveradio-state-city-collection",["collections/music/ihr/ihr-base-collection","models/music/ihr/ihr-liveradio-state-city-model","constants","utils/scope"],function(f,g,b,a){var c=f.extend({model:g,url:b.URL+b.API_PREFIX+"/iheartradio/live-radio-states-cities",parse:function(a){return a.liveRadioStateList}},{NAME:"IHRLiveRadioStateCityCollection",getInstance:a.singleton(function(){return new c})});return c});
define("collections/music/ihr/ihr-live-stream-collection",["lodash","models/music/ihr/ihr-station-model","collections/base-collection","constants","utils/scope"],function(f,g,b,a,c){var d=b.extend({model:g,url:a.URL+a.API_PREFIX+"/iheartradio/live-streams",parse:function(a){a=a.liveRadioStreamList;f.each(a,function(a){a.stationType="LIVE"});return a},getStreamInfo:function(a){a=f.map(a,function(a){if(a=this.get(a))return a.toJSON()},this);return f.compact(a)}},{NAME:"IHRLiveStreamCollection",getInstance:c.singleton(function(){return new d})});
return d});define("models/music/ihr/ihr-original-station-model",["models/music/ihr/ihr-station-model"],function(f){return f.extend({idAttribute:"stationId",defaults:{stationId:null,name:null,stationType:null,image:null,description:null,published:!1,slug:null},parse:function(g){f.prototype.parse.apply(this,arguments);var b=g.stationId;g.id=b;g.featuredStationId=b;return g}},{NAME:"IHROriginalStationModel"})});
define("collections/music/ihr/ihr-original-station-collection",["models/music/ihr/ihr-original-station-model","collections/music/ihr/ihr-base-collection","constants","utils/scope"],function(f,g,b,a){var c=g.extend({model:f,url:b.URL+b.API_PREFIX+"/iheartradio/original-stations",accountAssociationRequired:!0,parse:function(a){return a.featuredStationList}},{NAME:"IHROriginalStationCollection",getInstance:a.singleton(function(){return new c})});return c});
define("models/music/ihr/ihr-talk-show-model",["models/music/ihr/ihr-base-model"],function(f){return f.extend({idAttribute:"id",defaults:{id:null,title:null,description:null,imagePath:null,episodes:null}},{NAME:"IHRTalkShowModel"})});
define("collections/music/ihr/ihr-talk-shows-collection",["collections/music/ihr/ihr-base-collection","models/music/ihr/ihr-talk-show-model","constants"],function(f,g,b){return f.extend({model:g,initialize:function(a,c){this.categoryId=c.categoryId},category:null,fetch:function(a){a=a||{};if(this.categoryId)a.data={categoryId:this.categoryId};return f.prototype.fetch.call(this,a)},parse:function(a){this.category=a.name;return a.shows},url:b.URL+b.API_PREFIX+"/iheartradio/talk-category"},{NAME:"IHRTalkShowsCollection"})});
define("models/music/ihr/ihr-talk-show-episode-model",["models/music/ihr/ihr-base-model"],function(f){return f.extend({defaults:{showId:null,episodeId:null,title:null,subtitle:null,description:null,duration:null,imagePath:null,showName:null,startDate:null}},{NAME:"IHRTalkShowEpisodeModel"})});
define("collections/music/ihr/ihr-talk-show-episodes-collection",["lodash","collections/music/music-infinite-collection","models/music/ihr/ihr-talk-show-episode-model","constants"],function(f,g,b,a){return g.extend({initialize:function(a,b){this.showId=b.showId},model:b,show:null,offset:0,SERVICE_PROVIDER:a.SP_IHEART,calculateOffsets:function(a){a=f.clone(a)||{};a.data=f.clone(a.data)||{};var b=a.success;a.data.size=50;a.data.offset=this.offset;a.success=function(a,c,f){a.offset=a.length;if(!c.episodes||
c.episodes.length<50)a.tailReached=!0;b&&b.apply(this,arguments)};return a},fetch:function(a){a=a||{};if(this.showId)a.data={showId:this.showId};a=this.calculateOffsets(a);return this.tailReached?(a.success&&a.success.call(this,this,[]),$.Deferred().resolve().promise()):g.prototype.fetch.call(this,a)},parse:function(a){this.show=a.title;return a.episodes},url:a.URL+a.API_PREFIX+"/iheartradio/talk-show"},{NAME:"IHRTalkShowEpisodesCollection"})});
define("views/music/account-picker-view","handlebars,constants,backbone,views/base-view,models/authentication-model,collections/music/media-owner-collection,collections/music/music-service-collection,router-manager".split(","),function(f,g,b,a,c,d,e,h){return a.extend({events:{"change .dee-select-current-user":"onAccountChange"},template:f.getTemplate("music/d-account-picker"),initialize:function(a){a=a||{};this.mediaOwnerCollection=d.getInstance();this.navURL="music/";this.serviceName=a.serviceName||
g.SP_AMAZON_MUSIC;this.navURL+=this.serviceName===g.SP_CLOUD_PLAYER?g.SP_AMAZON_MUSIC:this.serviceName;this.listenTo(e.getInstance(),"add remove change",function(){})},onAccountChange:function(a){this.updateDropdown(a.currentTarget);this.mediaOwnerCollection.setOwner(this.serviceName,$(a.currentTarget).val());h.getInstance().getCurrentFullRoute()===this.navURL?b.trigger("navigate.reload"):b.trigger("navigate",this.navURL,{clearStack:!0})},getFetchables:function(){return[c.getInstance(),this.mediaOwnerCollection]},
updateDropdown:function(a){var a=$(a),c=a.find("option:selected").html();a.siblings(".d-select").find(".d-select-text").html(c)},render:function(){var a,c,b,d,f;this.hasFetched&&this.mediaOwnerCollection.hasSynced&&(a=this.mediaOwnerCollection.get(this.serviceName).get("customerId"),c=this.mediaOwnerCollection.get(this.serviceName).get("firstName"),b=e.getInstance().get(this.serviceName).get("accounts"),f=b.where({associated:!0}).length>1,d=b.where({eulaAcceptance:!0}).length>1,d=b.length>1&&d,this.$el.html(this.template({isHousehold:d,
showDropdown:f,accounts:b.toJSON(),customerId:a,firstName:c})),d?(this.$(".dee-select-current-user").val(a),this.updateDropdown(this.$(".dee-select-current-user")[0]),this._getContentElement().addClass("d-account-picker-layout")):this._getContentElement().removeClass("d-account-picker-layout"))},_getContentElement:function(){return $("#d-content")}},{NAME:"AccountPickerView"})});
define("views/layouts/header-player-account-picker-layout",["lodash","handlebars","views/layouts/header-player-layout","views/themeable"],function(f,g,b,a){return b.extend({template:g.getTemplate("layouts/d-header-player-account-picker-layout"),regions:f.extend(b.prototype.regions,{picker:"#d-account-picker"}),render:function(){this.$el.html(this.template());return this},hostAccountPicker:function(a){this.accountPicker=a;this.accountPicker.delegateEvents();this.startListening();this.host("picker",
a);return this},hostContent:function(a,d){this.pageContent=a;b.prototype.hostContent.apply(this,arguments);this.headerView.render();return this}},{NAME:"HeaderPlayerAccountPickerLayout"}).extend(a)});
define("views/layouts/anchor-layout",["lodash","handlebars","views/layouts/base-layout","views/layouts/scroll-layout"],function(f,g,b,a){return b.extend({initialize:function(c){c=f.clone(c,!0)||{};c.hideScrollbar=!0;this.scrollLayout=new a(c)},regions:{anchorContent:"#d-anchor-content",anchorControl:"#d-anchor-control"},template:g.getTemplate("d-anchor-layout"),render:function(){this.$el.html(this.template());return this},hostContent:function(a){this.contentView=a;this.scrollLayout.hostContent(this.contentView);
this.host("anchorContent",this.scrollLayout)},onScreen:function(){this.controlView&&this.contentView.setAnchorControl&&this.contentView.setAnchorControl(this.controlView);b.prototype.onScreen.apply(this,arguments)},hostControl:function(a){this.host("anchorControl",a);this.controlView=a}},{NAME:"AnchorLayout"})});
define("views/anchor-control-view",["lodash","handlebars","views/base-view","app-oracle","jquery"],function(f,g,b,a,c){return b.extend({template:g.getTemplate("d-anchor-control"),events:{"vmousedown #anchor-control-menu":"onMousePress","vmousedown #alphaNumPickerItem":"onPressAlphaNumPicker","MSHoldVisual #alphaNumPickerItem":"preventEvent","contextmenu #alphaNumPickerItem":"preventEvent"},controls:{selectedText:".anchor-selected-text",controlMenu:"#anchor-control-menu",spinner:".anchor-spinner-con",
thumb:".anchor-thumb",textField:".overlay-text-value",alphaNumPicker:"#alphaNumPicker",alphaNumOverlayText:".alphanum-overlay-text",alphaNumOverlayTextValue:".anchor-selected-text",listItem:".dee-music-image-text-item-list"},initialize:function(c){f.bindAll(this,"onMouseMove","onMouseRelease","onMoveAlphaNumPicker","onReleaseAlphaNumPicker","getOffsets","getCoordinates","registerAlphaNum");var c=c||{},b=a.get("mouseEvents"),h=this;this.mouseUpEvent=b.vmouseup;this.mouseMoveEvent=b.vmousemove;this._clearExistingQuery();
this.initialPosition=0;this.isFetching=!1;this.totalSize=0;this.bottom=!1;this.previousItemIndex=1;this.useAlphaNumPicker=!c.useAlphaNumPicker?!1:c.useAlphaNumPicker;this.bounds=[];this.alphaNumList=[];h.alphaNumList.push({alphaNumValue:" ",alphaNumText:"#"});f.each("ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),function(a){h.alphaNumList.push({alphaNumValue:a,alphaNumText:a})});h.alphaNumList.push({alphaNumValue:"{",alphaNumText:"\u00c6"})},getOffsets:function(a){a=a||0;this.controlSize=c(this.controls.controlMenu).height();
this.itemIndex=a;this.updateControlPosition()},doneFetching:function(a,b){var f;this.useAlphaNumPicker?b>0?this.showElement(this.controls.alphaNumPicker):this.hideElement(this.controls.alphaNumPicker):(this.totalSize=a,f=c(this.controls.controlMenu),this.totalSize&&f.is(":hidden")&&this.showElement(this.controls.controlMenu));this._onFetchSuccessOrFail()},_onFetchSuccessOrFail:function(){this.hideElement(this.controls.spinner);this.isFetching=!1},failedFetching:function(){this._onFetchSuccessOrFail()},
render:function(){this.$el.html(this.template({alphaNumList:this.alphaNumList}));return this},dispose:function(){b.prototype.dispose.apply(this,arguments);c(document).off(this.mouseMoveEvent,this.onMouseMove);c(document).off(this.mouseUpEvent,this.onMouseRelease)},preventEvent:function(a){a.preventDefault()},onMousePress:function(a){var b=c(this.controls.controlMenu),f=b.offset(),g=c(this.controls.thumb),i=this.getElementHeight(this.controls.thumb),g=g.offset(),j=this.getCoordinates(a).X,a=this.getCoordinates(a).Y,
k=!1;if(f&&!(j=g.top+i)&&this.updateTextAndControl(a),this.showElement(this.controls.selectedText)},getCoordinates:function(a){return{X:a.originalEvent.touches?a.originalEvent.touches[0].pageX:a.originalEvent.pageX,Y:a.originalEvent.touches?a.originalEvent.touches[0].pageY:
a.originalEvent.pageY}},updateTextAndControl:function(a){this.isFetching||(this.calculateItemIndex(a),this.updateControlPosition())},updateControlPosition:function(){var a,b=c(this.controls.thumb).height(),f=(c(this.controls.selectedText).height()-b)/2;this.itemIndex=this.itemIndex||0;c(this.controls.textField).html(this.itemIndex+1+" / "+this.totalSize);a=Math.floor(this.itemIndex/this.totalSize*this.controlSize);this.bottom&&(a-=b);c(this.controls.selectedText).css("top",a+f+"px");c(this.controls.thumb).css("top",
a+"px")},onMouseMove:f.throttle(function(a){this.updateTextAndControl(this.getCoordinates(a).Y)},5),onMouseRelease:function(){c(document).off(this.mouseMoveEvent,this.onMouseMove);c(document).off(this.mouseUpEvent,this.onMouseRelease);this.hideElement(this.controls.selectedText);if(!this.isFetching&&(!this.previousItemIndex||this.itemIndex!==this.previousItemIndex))this.showElement(this.controls.spinner),this.trigger("scrollToWithOffset",this.itemIndex),this.isFetching=!0;this.previousItemIndex=this.itemIndex},
calculateItemIndex:function(a){var c=this.initialPosition-this.getElementHeight(this.controls.thumb);if(a>=this.initialPosition&&a-c=this.controlSize)this.bottom=!0,this.itemIndex=this.totalSize-Math.floor(this.getElementHeight(this.controls.controlMenu)/this.getElementHeight(this.controls.listItem))+1},getElementHeight:function(a){return c(a).height()},hideElement:function(a){this.$el.find(a).hide()},
showElement:function(a){this.$el.find(a).show()},onPressAlphaNumPicker:function(a){var b=c(a.currentTarget).text(),f=c(a.currentTarget).data("alphanum"),g=c(this.controls.alphaNumPicker);this.showSelectedAlphaNum(this.existingQueryText,b,f);a.stopPropagation();g.on(this.mouseMoveEvent,this.onMoveAlphaNumPicker);g.on(this.mouseUpEvent,this.onReleaseAlphaNumPicker);c("body").on(this.mouseUpEvent,this.onReleaseAlphaNumPicker);c("body").addClass("disable-select");this.calculateAlphaNumElementBounds();
this.lastMoveY=this.lastMoveX=0;this.startSecondPickerTimer(a,b,f)},startSecondPickerTimer:function(a,c,b){this.clearSecondPicker();if(this.existingQueryValue.length<1&&this.isNormalAlphabet(b))this.secondPickerTimeout=f.delay(this.registerAlphaNum,1E3,a,c,b)},registerAlphaNum:function(a,c,b){this.existingQueryText+=c;this.existingQueryValue+=b;this.visualNotification()},visualNotification:function(){c(".alphanum-notify").hide().css("opacity","0.8").show().animate({opacity:0},500)},clearSecondPicker:function(){this.secondPickerTimeout&&
clearTimeout(this.secondPickerTimeout)},onMoveAlphaNumPicker:f.throttle(function(a){var b=this.getCoordinates(a).X,f=this.getCoordinates(a).Y,g=f-c(a.currentTarget).offset().top,i=this.getSelectedAlphaNum(g).alphaNumText,g=this.getSelectedAlphaNum(g).alphaNumValue;a.stopPropagation();a.preventDefault();if(!(this.lastMoveX===b&&this.lastMoveY===f))this.lastMoveX=b,this.lastMoveY=f,this.startSecondPickerTimer(a,i,g),this.showSelectedAlphaNum(this.existingQueryText,i,this.existingQueryValue+g)},5),showSelectedAlphaNum:function(a,
b,f){this.isFetching||(a+=b,a=a[0]+a.slice(1).toLowerCase(),c(this.controls.alphaNumOverlayTextValue).text(a),c(this.controls.alphaNumOverlayTextValue).data("alphanum",f),this.showElement(this.controls.alphaNumOverlayText))},onReleaseAlphaNumPicker:function(){var a=c(this.controls.alphaNumPicker),b=Math.floor(a.height()/c(this.controls.listItem).height());this.clearSecondPicker();a.off(this.mouseMoveEvent,this.onMoveAlphaNumPicker);a.off(this.mouseUpEvent,this.onReleaseAlphaNumPicker);c("body").off(this.mouseUpEvent,
this.onReleaseAlphaNumPicker);c("body").removeClass("disable-select");this.hideElement(this.controls.alphaNumOverlayText);if(!this.isFetching)this.showElement(this.controls.spinner),this.trigger("alphaNum:selected",{alphaNum:c(this.controls.alphaNumOverlayTextValue).data("alphanum"),elements:b}),this.isFetching=!0;this._clearExistingQuery()},calculateAlphaNumElementBounds:function(){var a=this;this.bounds=[];c.each(c(this.controls.alphaNumPicker).find("td"),function(b,f){f=c(f);a.bounds.push({alphaNumText:f.text(),
alphaNumValue:f.data("alphanum"),position:f.position().top,height:f.outerHeight()})})},getSelectedAlphaNum:function(a){var c=null,b=this.alphaNumList.length;f.each(this.bounds,function(b){a>=b.position&&a<=b.position+b.height&&(c=b)});c===null&&(c=a>=this.getElementHeight(this.controls.alphaNumPicker)?this.alphaNumList[b-1]:this.alphaNumList[0]);return c},isNormalAlphabet:function(a){return a.match(/[A-Z*]$/)},_clearExistingQuery:function(){this.existingQueryValue=this.existingQueryText=""}},{NAME:"AnchorControlView"})});
define("views/music/music-base-view","lodash,constants,views/layouts/base-layout,handlebars,collections/device-collection,utils/log".split(","),function(f,g,b,a,c,d){return b.extend({errorsList:[],errorOrSpinnerStatus:!0,errorTemplate:a.getTemplate("d-music-error-message"),initialize:function(a){f.bindAll(this,"onAccountChange");this.errorsList=[];b.prototype.initialize.call(this,a)},onAccountChange:function(a){this.errorsList=[];this.refetchDependencies(a)},refetchDependencies:function(a){f.each(this.getFetchables(),
function(c){c.fetch(a)})},baseErrorCallback:function(a,c){this.reportError(this.parseException(c[1],a))},dispose:function(){this.errorsList=[];b.prototype.dispose.apply(this,arguments)},reportError:function(a){f.isString(a)&&(this.errorsList.indexOf(a)===-1&&this.errorsList.push(a),this.render())},setErrorDisplay:function(a){this.DISPLAY_TEXT_ON_ERROR=a},parseException:function(a,c){var b;try{b=JSON.parse(a.responseText).message}catch(f){a&&a.status&&d.error(a.status+":"+a.statusText+","+c),b=c}return b},
offScreen:function(){this.errorsList=[];b.prototype.offScreen.apply(this,arguments)},showErrorOrSpinner:function(a){var b=!1,d=this.DISPLAY_TEXT_ON_ERROR||"There were problems when loading this page",a=a||{};this.errorsList.length!==0?(this.$el.html(this.errorTemplate({errors:this.errorsList,displayTextOnError:a.displayTextOnError||d,showFooter:!0})),b=!0):this.hasFetched?c.getInstance().getCurrentlySelectedDevice()||(this.$el.html(this.errorMessageTemplate({mainText:g.TXT_NO_DEVICE_SETUP,subText:g.TXT_NO_DEVICE_SETUP_LINK,
isHtml:!0})),b=!0):b=!0;return this.errorOrSpinnerStatus=b}},{NAME:"MusicBaseView"})});
define("views/music/cloudplayer/cloud-player-base-layout",["lodash","views/music/music-base-view"],function(f,g){return g.extend({render:function(){this.showErrorOrSpinner()||(this.informAnchorControl(),this.cloudPlayerListView.$el.detach(),this.$el.html(this.pageTemplate({emptyItems:!this.collection.length,hasSynced:this.collection.hasSynced})).append(this.cloudPlayerListView.render().el));return this},onScrollWithOffset:function(b){this.cloudPlayerListView.scrollToElementWithOffset(b)},onScrollWithAlphaNum:function(b){this.cloudPlayerListView.scrollToElementWithAlphaNum(b)},
setAnchorControl:function(b){this.anchorControl&&this.stopListening(this.anchorControl);this.anchorControl=b;this.listenTo(this.anchorControl,"scrollToWithOffset",this.onScrollWithOffset);this.listenTo(this.anchorControl,"alphaNum:selected",this.onScrollWithAlphaNum);this.cloudPlayerListView&&this.listenTo(this.cloudPlayerListView,"change:offsets",this.anchorControl.getOffsets)},informAnchorControl:function(){if(this.anchorControl&&this.collection.totalResultCount){var b=this.collection.totalResultCount;
f.isUndefined(b)&&(b=0);this.anchorControl.doneFetching(b,this.collection.length)}},startListening:function(){this.listenTo(this,"scroll",this.onScroll);this.collection&&(this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"sync",this.informAnchorControl));this.cloudPlayerListView&&this.listenTo(this.cloudPlayerListView,"scrollTo",function(b){this.trigger("scrollTo",b)})},offScreen:function(){this.cloudPlayerListView&&this.cloudPlayerListView.scrollToElementWithOffset(0);
g.prototype.offScreen.apply(this,arguments)},onScroll:function(){this.cloudPlayerListView&&this.cloudPlayerListView.scroll()}},{NAME:"CloudPlayerBaseLayout"})});
define("views/music/cloudplayer/cloud-player-home-menu-view",["handlebars","views/music/cloudplayer/cloud-player-base-layout","backbone"],function(f,g,b){return g.extend({isTopLevel:!0,events:{"click .dee-menu-list .dee-music-text-item-list":"gotoCategory"},template:f.getTemplate("music/cloudplayer/dee-cloud-player-menu"),regions:{content:"#dee-cloud-player-menu-content"},initialize:function(){g.prototype.initialize.call(this,arguments)},getFetchables:function(){var a=[];this.previousTabContent&&
(a=this.previousTabContent.getFetchables(),!a&&this.previousTabContent.getContent&&(a=this.previousTabContent.getContent().getFetchables()));return a},render:function(){this.$el.html(this.template());this.previousTabId&&this.$el.find(this.previousTabId).addClass("selected");return this},gotoCategory:function(a){a=$(a.currentTarget).closest(".dee-music-text-item-list").attr("data-id");b.trigger("navigate","music/AMAZON_MUSIC/"+a,{clearStack:!0})},setTabContent:function(a,c){var b;if(c)b=["#dee-music-",
c,"-tab"].join(""),this.previousTabId&&this.$el.find(this.previousTabId).removeClass("selected"),this.$el.find(b).addClass("selected"),this.previousTabId=b,this.previousTab=c,this.previousTabContent=a;this.host("content",a)},getTab:function(){return this.previousTab},DISPLAY_TEXT_ON_ERROR:"Error getting your Amazon Music account summary"},{NAME:"CloudPlayerHomeMenuView",TAB_PLAYLISTS:"playlists",TAB_ARTISTS:"artists",TAB_ALBUMS:"albums",TAB_SONGS:"tracks",TAB_GENRES:"genres"})});
define("views/music/music-search-view",["backbone","views/music/music-base-view"],function(f,g){return g.extend({onSearchError:function(){this.isSearching=0;this.trigger("search:off");f.trigger("showMessage","Error while fetching search.","Please try again later.")}})});
define("views/scroll/list-view",["lodash","jquery","backbone","views/base-view","models/platform-model"],function(f,g,b,a,c){return a.extend({tagName:"ul",className:"d-infinite-list dee-list",initialize:function(){var a=this.getScrollOptions()||{},b=c.getInstance();f.bindAll(this,"_scrollBy","_getSegment","_purgeSegment","_setScrollerParam","_fillMoreItemsIfNeeded","_scrollToFillHeight");this.reversePagination=a.reversePagination!==!1;this.forwardPagination=a.forwardPagination!==!1;this.segmentSize=
a.segmentSize||25;this.startReverse=a.startReverse;this.scrollableHeaderElement=a.scrollableHeaderElement;this.scrollableFooterElement=a.scrollableFooterElement;this.enabled=!0;this._resetState();a.prune=!b.supports("largeDOM");a.overflow=b.supports("overflowScrolling");this.$el.infiniteScroller(f.extend({scrollBy:this._scrollBy,getSegment:this._getSegment,purgeSegment:this._purgeSegment},a))},onScreen:function(){a.prototype.onScreen.apply(this,arguments);this.listenTo(this,"scroll",this.scroll);
this.$el.on("setScrollerParam",this._setScrollerParam)},render:function(){var a=this.getCollection();this.hasFetched&&(this.startReverse&&a.length?this._render({id:a.last().id}):this._render());f.defer(this._fillMoreItemsIfNeeded);return this},_fillMoreItemsIfNeeded:function(){var a=this._getElementHeight(".d-scroll-content"),c=this._getElementHeight(".inf-container"),b=Math.ceil(a/(c||1))||1;a>c&&(this.segmentSize*=b>10?10:b,this.$el.one("noMoreSegment",f.bind(function(){this.noMoreSegmentAvailable=
!0},this)),this._scrollToFillHeight())},_getElementHeight:function(a){return g(a).height()},_scrollToFillHeight:function(){var a=this._getElementHeight(".d-scroll-content"),c=this._getElementHeight(".inf-container"),b=this;a>c&&!this.noMoreSegmentAvailable&&f.defer(function(){b.$el.one("gotNewSegment",function(){f.defer(b._scrollToFillHeight)});b.scroll()})},_render:function(a){a||(a={});var c=this.getCollection(),a=c.get(a.id),a=c.indexOf(a)+1,b=c.toJSON();this.$el.infiniteScroller("reset");this.$(".inf-spinner-head, .inf-spinner-tail").empty().append(g("").addClass("d-small-spinner"));
this.scrollableHeaderElement&&!this.reversePagination&&this.$(".inf-header").html(this.scrollableHeaderElement);this.scrollableFooterElement&&!this.forwardPagination&&this.$(".inf-footer").html(this.scrollableFooterElement);this._resetState();c=b.slice(0,a);a=b.slice(a);this._addModels(c,!0);this._addModels(a,!1);this.$el.infiniteScroller("computeDOMOffsetParameters")},dispose:function(){var c=this.getCollection();c&&c.trim&&c.trim();this.$el.infiniteScroller("dispose");a.prototype.dispose.apply(this,
arguments)},getTemplateData:function(){},getCollection:function(){return this.collection},prependModels:function(a){this._addModels(a,!0)},appendModels:function(a){this._addModels(a,!1)},getElement:function(a){var c=this.$(a);c.length||(c=f.find(this.headCache,function(c){return c.find(a).length})||g());c.length||(c=f.find(this.tailCache,function(c){return c.find(a).length})||g());return c},getScrollOptions:function(){},scroll:function(){this.enabled&&this.$el.infiniteScroller("scroll")},centerAroundElement:function(a){a||
(a={});var c=a.id,b=this.getCollection(),l=!!this.$("#"+c).length,i=a.itemsAbove||0,j=a.itemsBelow||0,c=b.get(c),c=b.indexOf(c),k=a.fetchData,n=!f.isEmpty(k),m=g.Deferred(),o=this;i<=c&&j<=b.length-c-1?(i=b.at(c-i),b=b.at(c+j),b=i&&this.$("#"+i.id).length&&b&&this.$("#"+b.id).length,(!l||!b)&&this._render(a),this._scrollToElement(a),m.resolve()):n?b.fetch({reset:!0,silent:!0,data:k}).done(function(c){o._render(a);o._scrollToElement(a);m.resolve(c)}).fail(m.reject):m.reject();return m.promise()},_setScrollerParam:function(a,
c){this.trigger("setScrollerParam",c.param,c.value)},_resetState:function(){this.headCache=[];this.tailCache=[];this.primeRequests={head:{},tail:{}};this.cacheTimer&&clearTimeout(this.cacheTimer);this.primeTimer&&clearTimeout(this.primeTimer);this.segmentTimer&&clearTimeout(this.segmentTimer)},_scrollBy:function(a){this.trigger("scrollBy",a)},_scrollToElement:function(a){var c=a.animationDuration||0;this.enabled=!1;this.trigger("scrollToElement","#"+a.id,c,a.scrollOffset||0);f.delay(f.bind(function(){this.enabled=
!0},this),c)},_makeAndCacheSegments:function(a,c){if(a.length){var b=c.fromHead,l=this.getTemplateData()||{},i=this.template;l.models=a[b?"pop":"shift"]();b=g(i(l));this.cacheTimer=f.delay(f.bind(this._makeAndCacheSegments,this,a,c),15);c.doCache&&(l.models.length===1?this._addListItemToCache(b,c):this._addSegmentToCache(b,c));c.doCache=!0;return b}},_groupBy:function(a,c,b){var f=a.length,g=[],j=0;b&&(j=f%c,j>0&&g.push(a.slice(0,j)));for(;j=3)return g.Deferred().reject().promise();else if(this.primeRequests[c].isPriming)return this.primeRequests[c].promise;this.primeRequests[c].isPriming=!0;b=g.Deferred();this.primeRequests[c].promise=b.promise();b.done(function(){l.$el.infiniteScroller("resetErrorCount")});i=this._getFetchOptions(a);i.success=function(c,e){var g=c.parse(e,{reparse:!0})||[];g.length?
(g=l._groupBy(g,l.segmentSize,a),l._makeAndCacheSegments(g,{fromHead:a,doCache:!0}),l.segmentTimer=f.delay(b.resolve,15)):b.resolve()};!a&&this.forwardPagination||a&&this.reversePagination?this.getCollection().fetch(i).fail(b.reject).always(function(){l.primeRequests[c].isPriming=!1}):b.resolve();return b.promise()},_addSegmentToCache:function(a,c){var b=c.fromHead;(b?this.headCache:this.tailCache)[c.purge?b?"push":"unshift":b?"unshift":"push"](a)},_addListItemToCache:function(a,c){var b=c.fromHead,
f=b?this.headCache:this.tailCache,g=this;this._addListItem(a,f[b?0:f.length-1]||[],b?"prepend":"append",function(){g._addSegmentToCache(a,c)})},_addListItem:function(a,c,b,f){if(c.length&&c.children().length")}}});define("models/scroll-position-cache",{});
define("utils/scroll-position-mixin",["lodash","jquery","models/scroll-position-cache","utils/log"],function(f,g,b,a){return{extendFrom:function(c){return c.extend({onScreen:function(){var a=b[this.constructor.NAME];c.prototype.onScreen.apply(this,arguments);f(function(){var c=this;a&&(c.$el.css("visibility","hidden"),f.result(c,"showLoadingSpinner")&&c.loadingModel.begin(c.cid),this.$el.infiniteScroller("reset"),this.centerAroundElement(a).always(function(){c.$el.css("visibility","");c.loadingModel.end(c.cid)}))}).bind(this).defer()},
getScrollOptions:function(){var b=c.prototype.getScrollOptions.apply(this,arguments);(!b||b.reversePagination===!1)&&a.warn("Extending scroll-position-mixin without reversePagination scroll option. This could lead to a bug during scroll up");return b},findFirstInViewport:function(){var a=this,c=this.$el.closest(".d-scroll-window"),b=c.offset(),l,i,j;if(b&&(l=b.top,i=c.height(),c=f.find(this.$el.infiniteScroller("getContainer").find("li"),function(c){return!a.isInViewport(l,i,c)?!1:!!a.getCollection().get(c.id)}),
b=g(c).offset(),c&&b))return j=a.getCollection().get(c.id),{id:c.id,scrollOffset:l-b.top,fetchData:this.getFetchData&&this.getFetchData(j)}},_saveScrollPosition:f.debounce(function(){var a=this.findFirstInViewport();a&&(b[this.constructor.NAME]=a)},250,{leading:!0,trailing:!0}),scroll:function(){c.prototype.scroll.apply(this,arguments);this._saveScrollPosition()}})}}});
define("views/music/music-list-view","jquery,lodash,constants,backbone,handlebars,views/scroll/list-view,views/music/music-shuffle-view,views/scroll/image-loader-mixin,collections/device-collection,collections/music/media-owner-collection,utils/scroll-position-mixin".split(","),function(f,g,b,a,c,d,e,h,l,i,j){return j.extendFrom(d.extend(h).extend({template:c.getTemplate("music/d-music-segment"),_shuffleView:null,events:{"click li.dee-music-image-text-item-list:not([disabled]):not([corrupted])":"onClick",
"click li.dee-music-image-text-item-list[disabled]":"onPrimeDisabledClick","click li.dee-music-image-text-item-list[corrupted]":"onCorruptedClick"},initialize:function(a){d.prototype.initialize.apply(this,arguments);g.bindAll(this,"loadImagesInViewport");a=a||{};this.collection=a.collection||this.Collection.getInstance();if(a.canShuffle)this._shuffleView=new (e.extend({shuffleAndQueue:g.bind(this.shuffleAndQueue,this)}));c.registerPartial("item",c.getTemplate("music/d-music-item-segment"))},delegateEvents:function(){this._shuffleView&&
this._shuffleView.delegateEvents();d.prototype.delegateEvents.apply(this,arguments)},getFetchables:function(){return[this.collection]},startListening:function(){this.listenTo(a,"loadImagesInViewport",this.loadImagesInViewport);this.listenTo(this,"host",this._onHost);this.listenTo(this.collection,"collection:change:headReached",this.hideShowShuffle)},getImageURL:function(a){var a=this.collection.get(a),c;if(a&&!a.get("imageLoaded"))return c=a.get("imageIcon"),a.set("imageLoaded",!0),c},getImageWrapper:function(a){return f(a.find(".dee-music-image > div")[0])},
showErrorOrSpinner:function(){var a=this.DISPLAY_TEXT_ON_ERROR||"There were problems when loading this page";if(this.hasFetched)if(l.getInstance().getCurrentlySelectedDevice())if(this.collection.hasSynced){if(!this.collection.length)return this.noSongsTemplate?this.$el.html(this.noSongsTemplate()):this.$el.html(this.errorMessageTemplate({mainText:"",subText:"There are no items to display"})),!0}else return this.$el.html(this.errorMessageTemplate({mainText:a})),!0;else return this.$el.html(this.errorMessageTemplate({mainText:b.TXT_NO_DEVICE_SETUP,
subText:b.TXT_NO_DEVICE_SETUP_LINK,isHtml:!0})),!0;else return!0;return!1},hideShowShuffle:function(){var a=!0;this.collection.hasHeadReached&&(a=this.collection.hasHeadReached());a&&this._shuffleView?this._prependShuffle():f(".dee-music-shuffle").length&&f(".dee-music-shuffle").remove()},render:function(){this.showErrorOrSpinner()||this.innerRender();return this},innerRender:function(){var a=!0;this.collection.hasHeadReached&&(a=this.collection.hasHeadReached());this._shuffleView&&a&&this._prependShuffle();
d.prototype.render.apply(this,arguments);g.defer(this.loadImagesInViewport)},_prependShuffle:function(){var a=!0;this.collection.hasHeadReached&&(a=this.collection.hasHeadReached());f(".dee-music-shuffle").length<1&&a&&this.$el.before(this._shuffleView.render())},_onHost:function(){!this.showErrorOrSpinner()&&this._shuffleView&&this._prependShuffle()},onClick:function(){},shuffleAndQueue:f.noop,getFetchData:function(a){return{alphaNum:a.get("mainText")}},onPrimeDisabledClick:function(){var c;c=i.getInstance().get(b.SP_CLOUD_PLAYER).get("primeStatus")?
"We're sorry, but this song is no longer available with Prime Music.":"We're sorry, but this song is accessible to Prime members only";a.trigger("showMessage","Song Not Available",c)},onCorruptedClick:function(){a.trigger("showMessage","Unable to play your request")}},{NAME:"MusicListView"}))});
define("views/music/cloudplayer/search/cloud-player-search-preview-view",["lodash","views/music/music-list-view"],function(f,g){return g.extend({startListening:function(){this.listenTo(this.collection,"reset",this.render);g.prototype.startListening.apply(this,arguments)},getFetchables:function(){return[]},render:function(){this.collection.isEmpty()?this.$el.empty():this.$el.html(this.template(this._getTemplateOptions(this.collection)));f.defer(this.loadImagesInViewport)},_getTemplateOptions:function(b){return{collection:b.toJSON(),
totalResultCount:b.totalResultCount,overflow:b.totalResultCount>5}}},{NAME:"CloudPlayerSearchPreviewView"})});define("views/music/cloudplayer/search/cloud-player-search-artists-preview-view",["handlebars","views/music/cloudplayer/search/cloud-player-search-preview-view"],function(f,g){return g.extend({template:f.getTemplate("music/cloudplayer/dee-cloud-player-search-artists")},{NAME:"CloudPlayerSearchArtistsPreviewView"})});
define("views/music/cloudplayer/search/cloud-player-search-albums-preview-view",["handlebars","views/music/cloudplayer/search/cloud-player-search-preview-view"],function(f,g){return g.extend({template:f.getTemplate("music/cloudplayer/dee-cloud-player-search-albums")},{NAME:"CloudPlayerSearchAlbumsPreviewView"})});
define("views/music/cloudplayer/search/cloud-player-search-tracks-preview-view",["handlebars","views/music/cloudplayer/search/cloud-player-search-preview-view"],function(f,g){return g.extend({template:f.getTemplate("music/cloudplayer/dee-cloud-player-search-tracks"),initialize:function(){f.registerPartial("item",f.getTemplate("music/d-music-item-segment"));g.prototype.initialize.apply(this,arguments)}},{NAME:"CloudPlayerSearchTracksPreviewView"})});
define("cloud-player-commander","jquery,lodash,constants,backbone,models/player-model,collections/music/media-owner-collection,utils/music-helper,utils/error-code".split(","),function(f,g,b,a,c,d,e,h){return{requestInFlight:null,$previousTargetElement:null,lastRequestParams:{},queueAndPlay:function(a,h,j){var k=new f.Deferred,n=e.getDeviceInfoToPlayMusic(),m=this,o={},h=h||{};if(!n)return k.reject().promise();g.extend(n,{shuffle:!!h.shuffle,mediaOwnerCustomerId:d.getInstance().getId(b.SP_CLOUD_PLAYER)});
h=b.URL+b.API_PREFIX+"/cloudplayer/queue-and-play?"+f.param(n);g.extend(o,n,a);if(this.requestInFlight&&g.isEqual(this.lastRequestParams,o))return k.resolve().promise();this.$previousTargetElement&&this.$previousTargetElement.removeClass("waiting");j&&j.addClass("waiting");this.$previousTargetElement=j;c.getInstance().waitForMusicChange().always(function(){j&&j.removeClass("waiting")});this.requestInFlight=f.ajax(h,{type:"POST",dataType:"json",contentType:"application/json; charset=UTF-8",data:JSON.stringify(a)}).fail(function(){m.failureCallback.apply(m,
arguments);j&&j.removeClass("waiting")}).done(k.resolve).always(function(){m.requestInFlight=null;m.lastRequestParams={}});this.lastRequestParams=o;return k.promise()},failureCallback:function(c){c=h.getErrorMessage(c)||"Unable to play Amazon Music content.";a.trigger("showMessage",c,"")}}});
define("cloud-player-media-control-mixin",["lodash","backbone","cloud-player-commander"],function(f,g,b){return{queueAndPlay:function(a,c,d){b.queueAndPlay(c,{shuffle:a},d).fail(f.partial(this.queueCommandError,"Unable to play the requested track."))},queueCommandError:function(a){g.trigger("showMessage",a)}}});
define("views/music/cloudplayer/search/cloud-player-search-view","lodash,handlebars,views/music/music-search-view,backbone,utils/string-utils,views/music/cloudplayer/search/cloud-player-search-artists-preview-view,views/music/cloudplayer/search/cloud-player-search-albums-preview-view,views/music/cloudplayer/search/cloud-player-search-tracks-preview-view,collections/music/cloudplayer/cloud-player-search-collection,cloud-player-media-control-mixin".split(","),function(f,g,b,a,c,d,e,h,l,i){return b.extend({events:{"click #dee-search-artist-results .dee-search-overflow":"gotoArtistSearch",
"click #dee-search-album-results .dee-search-overflow":"gotoAlbumSearch","click #dee-search-track-results .dee-search-overflow":"gotoTrackSearch","click #dee-search-artist-results .dee-music-image-text-item-list":"gotoArtist","click #dee-search-album-results .dee-music-image-text-item-list":"gotoAlbum","click #dee-search-track-results .dee-music-image-text-item-list":"queueAndPlayItem"},regions:{"artist-results":"#dee-search-artist-results","album-results":"#dee-search-album-results","track-results":"#dee-search-track-results"},
template:g.getTemplate("music/cloudplayer/dee-cloud-player-search"),initialize:function(){this.artistCollection=new l([],{searchCategory:l.SearchCategory.ARTISTS});this.albumCollection=new l([],{searchCategory:l.SearchCategory.ALBUMS});this.trackCollection=new l([],{searchCategory:l.SearchCategory.TRACKS});this.artistSubView=new d({collection:this.artistCollection});this.albumSubView=new e({collection:this.albumCollection});this.trackSubView=new h({collection:this.trackCollection});this.host("artist-results",
this.artistSubView);this.host("album-results",this.albumSubView);this.host("track-results",this.trackSubView)},startListening:function(){this.listenTo(this.artistCollection,"reset",this._onSearchDone);this.listenTo(this.albumCollection,"reset",this._onSearchDone);this.listenTo(this.trackCollection,"reset",this._onSearchDone);this.listenTo(this.artistCollection,"musicFetchError",this.onSearchError);this.listenTo(this.albumCollection,"musicFetchError",this.onSearchError);this.listenTo(this.trackCollection,
"musicFetchError",this.onSearchError)},render:function(){this.$el.html(this.template());return this},search:f.debounce(function(a){var c={reset:!0,data:{size:5}};!a||a.length===0?(this.trigger("search:off"),this.lastQuery=""):(this.isSearching=3,this.lastQuery=a,this.artistCollection.search(a,c),this.albumCollection.search(a,c),this.trackCollection.search(a,c),this.trigger("search:on"))},250),_onSearchDone:function(a){var c=this.$("#dee-search-no-results");this.$("#dee-search-bar");if(this.lastQuery===
a.query)return this.isSearching--,c.hasClass("dee-search-invisible")||c.addClass("dee-search-invisible"),this.isSearching||(this.trigger("search:off"),this.albumCollection.isEmpty()&&this.trackCollection.isEmpty()&&this.artistCollection.isEmpty()&&c.removeClass("dee-search-invisible")),this},gotoArtist:function(c){c=$(c.currentTarget).closest(".dee-music-image-text-item-list");a.trigger("navigate","music/AMAZON_MUSIC/artists/"+this._getEncodedDataFromElement(c,"artistname"))},gotoAlbum:function(c){var b;
b=$(c.currentTarget).closest(".dee-music-image-text-item-list");c=this._getEncodedDataFromElement(b,"albumname");b=this._getEncodedDataFromElement(b,"albumartist");a.trigger("navigate","music/AMAZON_MUSIC/albums/"+c+"/"+b)},gotoArtistSearch:function(){a.trigger("navigate","music/AMAZON_MUSIC/search/artists/"+c.encodeURIComponent(this.artistCollection.query))},gotoAlbumSearch:function(){a.trigger("navigate","music/AMAZON_MUSIC/search/albums/"+c.encodeURIComponent(this.albumCollection.query))},gotoTrackSearch:function(){a.trigger("navigate",
"music/AMAZON_MUSIC/search/tracks/"+c.encodeURIComponent(this.trackCollection.query))},queueAndPlayItem:function(a){a=this.trackCollection.get($(a.currentTarget).closest(".dee-music-image-text-item-list").attr("id"));i.queueAndPlay(!1,{trackId:a.get("objectId")})},_getEncodedDataFromElement:function(a,b){return c.encodeURIComponent($(a).data(b))}},{NAME:"CloudPlayerSearchView"})});
define("views/music/cloudplayer/cloud-player-home-view","lodash,backbone,handlebars,collections/device-collection,models/platform-model,views/music/cloudplayer/cloud-player-base-layout,views/music/cloudplayer/cloud-player-home-menu-view,views/music/cloudplayer/search/cloud-player-search-view".split(","),function(f,g,b,a,c,d,e,h){return d.extend({loadingSpinnerWipesScreen:!0,isTopLevel:!0,events:{"keyup #dee-search-bar":"search","click span.dee-clear-button":"clearSearchAndNavigateUp"},regions:{"dee-cloud-player-home-content":"#dee-cloud-player-home-content"},
views:{menuView:e,scrollableSearchView:{constructor:h,scrollOptions:{hideScrollbar:!1,disposeOnEvict:!1,emitScroll:!0}}},template:b.getTemplate("music/cloudplayer/dee-cloud-player-home"),initialize:function(){this.lastQuery="";this.host("dee-cloud-player-home-content",this.getView("menuView"));this.searchViewShown=!1;d.prototype.initialize.apply(this,arguments)},getFetchables:function(){var a=[];this.getView("menuView")&&(a=this.getView("menuView").getFetchables());return a},startListening:function(){this.listenTo(this.getView("scrollableSearchView").getContent(),
"search:on",f.partial(this.searchStatus,!0));this.listenTo(this.getView("scrollableSearchView").getContent(),"search:off",f.partial(this.searchStatus,!1))},render:function(){this.$el.html(this.template({query:this.lastQuery,canPurchase:c.getInstance().supports("purchasing")}));this.lastQuery.length!==0&&this.showClearButton(!0);return this},onAccountChange:function(){this.clearSearch();d.prototype.onAccountChange.apply(this,arguments)},search:function(){if(!a.getInstance().isEmpty()){var c=this.getSearchQuery()||
"";if(c.length===0)this.clearSearchAndNavigateUp();else{this.showClearButton(!0);if(c!==this.lastQuery)this.lastQuery=c,this.getView("scrollableSearchView").getContent().search(c);this.searchViewShown||g.trigger("navigate","music/AMAZON_MUSIC/search")}}},clearSearchAndNavigateUp:function(){this.clearSearch();g.trigger("navigate.upOneLevel")},clearSearch:function(){this.resetSearchElements();this.lastQuery="";this.searchStatus(!1)},searchStatus:function(a){a?this.$("span.dee-spinner-icon").removeClass("empty"):
(!a||!this.$("#dee-search-bar").val())&&this.$("span.dee-spinner-icon").addClass("empty");(!this.getSearchQuery()||this.getSearchQuery().length===0)&&this.host("dee-cloud-player-home-content",this.getView("menuView"))},resetSearchElements:function(){this.$("#dee-search-bar").val("");this.showClearButton(!1);this.$("span.dee-spinner-icon").addClass("empty")},setTabContent:function(a,c){this.resetSearchElements();this.host("dee-cloud-player-home-content",this.getView("menuView"));this.getView("menuView").setTabContent(a,
c);this.searchViewShown=!1},showSearch:function(){this.host("dee-cloud-player-home-content",this.getView("scrollableSearchView"));!this.getSearchQuery()&&this.lastQuery&&(this.showClearButton(!0),this.$("#dee-search-bar").val(this.lastQuery));this.searchViewShown=!0},getTab:function(){return this.getView("menuView").getTab()},isInSearchMode:function(){return!!this.getSearchQuery()||!!this.lastQuery},getSearchQuery:function(){return this.$("#dee-search-bar").val()?this.$("#dee-search-bar").val().trim():
null},showClearButton:function(a){a?(this.$("span.dee-clear-button").removeClass("empty"),this.$("span.d-search-button").addClass("empty")):(this.$("span.dee-clear-button").addClass("empty"),this.$("span.d-search-button").removeClass("empty"))}},{NAME:"CloudPlayerHomeView"})});
define("tunein-commander","jquery,lodash,constants,backbone,models/player-model,collections/music/media-owner-collection,utils/music-helper,utils/error-code".split(","),function(f,g,b,a,c,d,e,h){return{requestInFlight:null,lastRequestParams:{},$previousTargetElement:null,queueAndPlay:function(a,h){var j=new f.Deferred,k,n,m=this,o={},a=a||{};if(k=e.getDeviceInfoToPlayMusic())g.extend(k,{guideId:a.guideId,contentType:a.contentType,callSign:a.callSign,mediaOwnerCustomerId:d.getInstance().getId(b.SP_TUNE_IN)});
else return j.promise();n=b.URL+b.API_PREFIX+"/tunein/queue-and-play?"+f.param(k);g.extend(o,k);if(this.requestInFlight&&g.isEqual(this.lastRequestParams,o))return j.resolve().promise();this.$previousTargetElement&&this.$previousTargetElement.removeClass("waiting");h&&h.addClass("waiting");this.$previousTargetElement=h;c.getInstance().waitForMusicChange().always(function(){h&&h.removeClass("waiting")});this.requestInFlight=f.ajax(n,{type:"POST",dataType:"json",contentType:"application/json; charset=UTF-8"}).fail(this.failureCallback).done(j.resolve).always(function(){m.requestInFlight=
null;m.lastRequestParams={}});this.lastRequestParams=o;return j.promise()},failureCallback:function(c){var b=JSON.parse(c.responseText),c=h.getErrorMessage(c)||"Unable to play TuneIn content.";if(b.message!==null)c=b.message;a.trigger("showMessage",c,"");return(new f.Deferred).reject()}}});
define("views/music/tunein/tunein-control-mixin",["lodash","backbone","tunein-commander","utils/string-utils"],function(f,g,b,a){return{queueAndPlay:function(a,d){b.queueAndPlay(a,d).fail(f.partial(this.queueCommandError,"Unable to begin playback."))},queueAndPlayItem:function(a){var a=$(a.currentTarget).closest(".dee-music-image-text-item-list"),b=a.attr("data-guideid"),e=a.attr("data-contenttype");this.queueAndPlay({guideId:b,contentType:e},a)},browse:function(a){this.browseBody($(a.currentTarget).closest(".dee-music-text-item-list"))},
selectItemWithImage:function(a){var b=$(a.currentTarget).attr("data-contenttype");b==="show"||b==="link"?this.browseBody($(a.currentTarget).closest(".dee-music-image-text-item-list")):this.queueAndPlayItem(a,$(a.currentTarget))},browseBody:function(c){var b=c.attr("data-url"),c=c.attr("data-contenttype");b&&c&&g.trigger("navigate","music/TUNE_IN/"+c+"/"+a.encodeURIComponent(b))},queueCommandError:function(a){g.trigger("showMessage",a)}}});
define("models/music/tunein/browse-model",["require","lodash","constants","collections/music/media-owner-collection","models/base-model"],function(f,g,b,a,c){return c.extend({defaults:{id:null,name:null,contentType:null,image:null,description:null,url:null,browseList:null},fetch:function(d){d=d||{};d.data=g.extend({mediaOwnerCustomerId:a.getInstance().getId(b.SP_TUNE_IN)},d.data||{});return c.prototype.fetch.call(this,d)},parse:function(a){var c=new (f("collections/music/tunein/browse-collection"));
if(a.url)try{a.url=btoa(a.url)}catch(b){console.warn("Error while trying to encode tunein url: "+a.url)}g.each(a.browseList,function(a){c.add(a,{parse:!0})});if(c.length>0)a.browseList=c;return a}},{NAME:"BrowseModel"})});define("collections/music/tunein/tunein-base-collection",["constants","collections/music/music-base-collection"],function(f,g){return g.extend({accountAssociationAffected:!0,SERVICE_PROVIDER:f.SP_TUNE_IN},{NAME:"TIBaseCollection"})});
define("collections/music/tunein/tunein-search-collection",["constants","models/music/tunein/browse-model","collections/music/tunein/tunein-base-collection"],function(f,g,b){return b.extend({expires:0,defaults:{title:null,query:null},model:g,url:f.URL+f.API_PREFIX+"/tunein/search",parse:function(a){return a.title?(this.title=a.title,a.browseList):a},fetch:function(a){a=a||{};a.data=a.data||{};a.data.query=this.query;b.prototype.fetch.apply(this,arguments)}},{NAME:"SearchCollection"})});
define("views/music/tunein/tunein-search-view","lodash,backbone,handlebars,views/music/tunein/tunein-control-mixin,views/music/music-search-view,collections/music/tunein/tunein-search-collection".split(","),function(f,g,b,a,c,d){return c.extend(a).extend({events:{"keyup #dee-search-bar":"search","click .dee-music-image-text-item-list":"selectItemWithImage","click .dee-music-text-item-list":"browse","click span#dee-clear-button":"clearSearch"},template:b.getTemplate("music/tunein/dee-tunein-search"),
resultsTemplate:b.getTemplate("music/tunein/dee-tunein-search-results"),initialize:function(a){c.prototype.initialize.call(this,a);this.collection=new d},startListening:function(){this.listenTo(this.collection,"reset",this._onSearchDone);this.listenTo(this.collection,"musicFetchError",this.onSearchError);this.listenTo(this,"search:off",this.onSearchOff)},render:function(){this.$el.html(this.template());return this},search:f.debounce(function(a){var c=this.$("#dee-search-results"),b=this.$("#dee-search-bar"),
d=this.$("span.dee-spinner-icon"),f=this.$("#dee-clear-button"),k=this.$(".d-search-button"),b=b.val().trim();a&&a.showPreviousSearch?this.lastQuery?(this.$("#dee-search-bar").val(this.lastQuery),f.removeClass("empty"),this.showSearch()):this.navigateHome():this.lastQuery&&this.lastQuery===b?this.showSearch():(this.lastQuery=b,b.length===0?(f.addClass("empty"),d.addClass("empty"),k.removeClass("empty"),this.hideSearch(),g.trigger("navigate","music/TUNE_IN",{trigger:!1})):(f.removeClass("empty"),k.addClass("empty"),
this.isSearching||g.trigger("navigate","music/TUNE_IN/search",{trigger:!1}),this.isSearching=!0,this.trigger("searchActivated"),c.removeClass("dee-search-invisible"),this.collection.query=b,this.collection.fetch({reset:!0}),d.removeClass("empty")))},250),clearSearch:function(){this.$("#dee-search-bar").val("");this.search()},onSearchOff:function(){this.$("span.dee-spinner-icon").addClass("empty")},navigateHome:function(){g.trigger("navigate.redirect","music/TUNE_IN")},showSearch:function(){this.trigger("searchActivated");
this.$(".d-search-button").addClass("empty");this.$("#dee-search-results").removeClass("dee-search-invisible");this._onSearchDone()},hideSearch:function(){this.trigger("searchDeactivated");this.$("#dee-search-bar").val("");this.$("#dee-search-results").addClass("dee-search-invisible")},_onSearchDone:function(a){var c=this.$("span.dee-spinner-icon"),b=this.$("#dee-search-results"),d;if(!(a&&this.lastQuery!==a.query))return this.collection.length>1?d=JSON.parse(JSON.stringify(this.collection)):this.collection.models[0].get("contentType")!==
"unknown"&&(d=JSON.parse(JSON.stringify(this.collection))),b.html(this.resultsTemplate({stations:d})),this.isSearching=!1,c.addClass("empty"),this}},{NAME:"TISearchView"})});
define("collections/music/tunein/browse-collection",["constants","models/music/tunein/browse-model","collections/music/tunein/tunein-base-collection"],function(f,g,b){return b.extend({defaults:{title:null},initialize:function(a,c,d){this.urlSuffix="";if(d){if(d.url)this.urlSuffix="?url="+d.url;d.contentType&&(this.urlSuffix+=this.urlSuffix===""?"?":"&",this.urlSuffix+="contentType="+d.contentType)}b.prototype.initialize.call(this,arguments)},model:g,url:function(){return f.URL+f.API_PREFIX+"/tunein/browse"+
this.urlSuffix},parse:function(a){return a.hasOwnProperty("title")?(this.title=a.title,a.browseList):a}},{NAME:"BrowseCollection"})});
define("views/music/tunein/browse-view","handlebars,views/music/tunein/tunein-search-view,views/music/tunein/tunein-control-mixin,views/music/music-base-view,collections/music/tunein/browse-collection,lodash".split(","),function(f,g,b,a,c,d){return a.extend(b).extend({events:{"click .dee-music-image-text-item-list":"selectItemWithImage","click .dee-music-text-item-list":"browse"},regions:{"dee-tunein-search":"#dee-tunein-search"},template:f.getTemplate("music/tunein/dee-tunein-browse"),initialize:function(b){f.registerPartial("dee-tunein-browse-partial",
f.getTemplate("music/tunein/dee-tunein-browse-partial"));a.prototype.initialize.call(this,b);b=b||{};this.collection=new c([],{},{url:b.url,contentType:b.contentType,isSearch:b.isSearch});this.searchView=new g;this.host("dee-tunein-search",this.searchView);this.listenTo(this.collection,"musicFetchError",d.partial(this.baseErrorCallback,""));a.prototype.initialize.call(this,b)},getFetchables:function(){return[this.collection]},startListening:function(){this.listenTo(this.collection,"reset sync",this.render);
this.listenTo(this.searchView,"searchActivated",this.hideBrowse);this.listenTo(this.searchView,"searchDeactivated",this.unhideBrowse)},render:function(){this.showErrorOrSpinner()||this.$el.html(this.template({pageTitle:this.collection.title,stations:JSON.parse(JSON.stringify(this.collection)),hasStations:this.collection.length>0,errorMsg:this.ERROR_MSG_NO_CONTENT_TO_BROWSE}));return this},onAccountChange:function(){this.searchView.clearSearch();a.prototype.onAccountChange.apply(this,arguments)},hideBrowse:function(){this.$("#dee-tunein-browse").addClass("dee-search-invisible");
return this},unhideBrowse:function(){this.$("#dee-tunein-browse").removeClass("dee-search-invisible");this.trigger("scrollTo",0);return this},showSearch:function(){this.hideBrowse();this.searchView.search({showPreviousSearch:!0})},showContent:function(){this.searchView.hideSearch()},DISPLAY_TEXT_ON_ERROR:"Unable to load TuneIn page",ERROR_MSG_NO_CONTENT_TO_BROWSE:"Not available"},{NAME:"TIBrowseView"})});
define("views/music/tunein/tunein-home-view",["views/music/tunein/browse-view","collections/music/tunein/browse-collection","handlebars","lodash"],function(f,g,b,a){var c=f.extend({loadingSpinnerWipesScreen:!0,template:b.getTemplate("music/tunein/dee-tunein-home"),initialize:function(a){this.favorites=new g({},[],{contentType:"preset"});f.prototype.initialize.apply(this,arguments)},render:function(){this.showErrorOrSpinner()||this.$el.html(this.template({stations:this.filterStations(),favorites:this.favorites.toJSON(),
browseTitle:"Browse",favoriteTitle:"Favorites",hasLoaded:this.collection.length>0,hasFavorites:this.favorites.length>0}));return this},startListening:function(){this.listenTo(this.favorites,"reset",this.render);this.listenTo(this.searchView,"searchActivated",this.hideBrowse);this.listenTo(this.searchView,"searchDeactivated",this.unhideBrowse)},getFetchables:function(){return[this.collection,this.favorites]},filterStations:function(){return a.filter(this.collection.toJSON(),function(b){return!a.contains(c.FILTER_LIST,
b.name)})}},{NAME:"TuneInHomeView",FILTER_LIST:["My Favorites","Recents"]});return c});
define("ihr-commander","jquery,lodash,constants,backbone,collections/music/media-owner-collection,models/player-model,utils/music-helper,utils/error-code".split(","),function(f,g,b,a,c,d,e,h){return{requestInFlight:null,$previousTargetElement:null,lastRequestParams:{},updateVariety:function(a){a||(a={});var c=a.referenceId,h=a.variety,k=b.URL+b.API_PREFIX+"/iheartradio/update-radio-queue-variety";if(a=e.getDeviceInfoToPlayMusic())if(c){if(!h)return f.Deferred().reject("No variety provided").promise()}else return f.Deferred().reject("No referenceId provided").promise();else return f.Deferred().reject("No active device to play music").promise();
g.extend(a,{referenceId:c,variety:h,mediaOwnerCustomerId:d.getInstance().get("mediaOwnerCustomerId")});return f.ajax(k,{type:"POST",contentType:"application/json",processData:!1,data:JSON.stringify(a)})},queueAndPlay:function(a,h){var j=new f.Deferred,k,n,m=this,o={};k=e.getDeviceInfoToPlayMusic();if(!k)return j.resolve().promise();a=a||{};if(a.stationId)k.stationId=a.stationId;a.stationType||this.failureCallback();switch(a.stationType){case "LIVE":n="live-station";k.station=a.activityParams;break;
case "MOOD":a.stationType="STATION";case "ARTIST":case "TRACK":n="seeded-station";k.stationSeed=a.activityParams;k.seedType=a.stationType;break;case "EPISODE":a.activityParams.episodeId=parseInt(k.stationId,10);a.activityParams.episodeTitle=k.name;break;case "SHOW":a.activityParams.showId=parseInt(k.stationId,10);a.activityParams.showName=k.name;break;case "THEME":a.activityParams.themeId=parseInt(k.stationId,10);a.activityParams.themeName=k.name;break;default:n="custom-station",k.station=a.activityParams}if(["EPISODE",
"SHOW","THEME"].indexOf(a.stationType)>=0)n="talk",a.activityParams.imagePath=a.activityParams.logo,k.talkData=a.activityParams;k.mediaOwnerCustomerId=c.getInstance().getId(b.SP_IHEART);n=b.URL+b.API_PREFIX+"/iheartradio/queue-and-play-"+n;g.extend(o,k);if(this.requestInFlight&&g.isEqual(this.lastRequestParams,o))return j.resolve().promise();this.$previousTargetElement&&this.$previousTargetElement.removeClass("waiting");h&&h.addClass("waiting");this.$previousTargetElement=h;d.getInstance().waitForMusicChange().always(function(){h&&
h.removeClass("waiting")});this.requestInFlight=f.ajax(n,{type:"POST",data:JSON.stringify(k),dataType:"json",contentType:"application/json; charset=UTF-8"}).fail(function(){m.failureCallback.apply(m,arguments);h&&h.removeClass("waiting")}).done(j.resolve).always(function(){m.requestInFlight=null;m.lastRequestParams={}});this.lastRequestParams=o;return j.promise()},failureCallback:function(c){var b=h.getErrorMessage(c)||"Unable to play iHeartRadio content.",c=h.getErrorAction(c)||"";a.trigger("showMessage",
b,c)}}});
define("views/music/ihr/ihr-media-control-mixin",["lodash","backbone","ihr-commander"],function(f,g,b){return{queueAndPlay:function(a,c){b.queueAndPlay(a,c).fail(f.partial(this.queueCommandError,"Unable to start playing this station."))},updateVariety:function(a){b.updateVariety(a).fail(f.partial(this.queueCommandError,"Unable to tune this station."))},queueAndPlayLive:function(a,c){b.queueAndPlay(a,c).fail(f.partial(this.queueCommandError,"Unable to start playing this station."))},queueCommandError:function(a){g.trigger("showMessage",a)}}});
define("views/modal-manager","lodash,jquery,views/base-view,handlers/navigation-handler,utils/scope,utils/key-codes".split(","),function(f,g,b,a,c,d){var e=b.extend({className:"d-modal-overlay",initialize:function(a){a||(a={});this.$container=a.$container;f.bindAll(this,"_onBackdropClick","_onKeyUp")},dismiss:function(){if(this.currentModal&&!this.currentModalOptions.preventClose)this.stopListening(this.currentModal),this.currentModal.trigger("dismiss"),this.currentModal.dispose(),this.currentModal=
null,this.$el.off().detach(),g(document).off("keyup.modal")},show:function(c,b){var d;if(c&&!this.currentModal)this.currentModalOptions=b||{},this.currentModalOptions.backdrop===!1?this.$el.addClass("no-backdrop"):this.$el.removeClass("no-backdrop"),this.currentModal=c,this.$container.html(this.$el.html(this.currentModal.render().el)),this._attachEvents(),d=this.currentModalOptions.preventClose?function(){return!1}:f.bind(function(){this.dismiss();return!0},this),a.getInstance().registerCallback(d)},
_attachEvents:function(){this.$el.on("click",this._onBackdropClick);g(document).on("keyup.modal",this._onKeyUp);this.listenToOnce(this.currentModal,"dismiss",this.dismiss)},_onBackdropClick:function(a){this.currentModalOptions.blur!==!1&&a.target===this.el&&this.dismiss()},_onKeyUp:function(a){this.currentModalOptions.keyboard!==!1&&a.keyCode===d.ESCAPE&&this.dismiss()}},{NAME:"ModalManager",getInstance:c.singleton(function(){return new e({$container:g("#d-modal-wrapper")})})});return e});
define("views/modals/confirmation-modal-view",["handlebars","views/base-view"],function(f,g){return g.extend({className:"d-modal",template:f.getTemplate("d-modal-layout"),actionsTemplate:f.getTemplate("d-confirmation-modal-footer"),events:{"click .accept":"_onAcceptClick","click .reject":"_onRejectClick"},initialize:function(b){b||(b={});this.title=b.title;this.content=b.message;this.actions=this.actionsTemplate({accept:b.affirm||"Ok",reject:b.reject||"Cancel"})},render:function(){this.$el.html(this.template({title:this.title,
content:this.content,actions:this.actions}));return this},_onAcceptClick:function(){this.trigger("accept dismiss")},_onRejectClick:function(){this.trigger("reject dismiss")}},{NAME:"ConfirmationModalView"})});
define("views/settings/music-settings-account-view","lodash,backbone,utils/key-codes,utils/browser-utils,utils/error-code,views/base-view,handlebars,views/modal-manager,models/third-party-account-model,views/modals/confirmation-modal-view,constants".split(","),function(f,g,b,a,c,d,e,h,l,i,j){var k=d.extend({template:void 0,service:void 0,sharedTemplate:e.getTemplate("settings/d-music-settings-account"),events:{"click .dee-unlink-btn":"removeAssociation","click .dee-link-btn":"addAssociation","click .dee-create-account-btn":"confirmCreateAccount",
"click .dee-manage-settings":"manageSettings","keyup input":"onInputKeyUp"},initialize:function(a){this.model=a.model;f.bindAll(this,"onSaveError")},render:function(){if(this.hasFetched){var a=this.getTemplateData(),c="";this.template&&(c=this.template(a));a.extraContent=c;if(this.associationTemplate)a.associationTemplate=this.associationTemplate(a);this.$el.html(this.sharedTemplate(a))}return this},startListening:function(){this.listenTo(this.model,"change",this.render)},getTemplateData:function(){return{account:this.model.toJSON(),
service:this.service,associated:this.model.get("associationState")===l.ASSOCIATED}},removeAssociation:function(){this.model.save({associationState:l.UNASSOCIATED},{wait:!0,error:this.onSaveError});return!1},confirmCreateAccount:function(a){var c=new i({message:k.CONFIRM_CREATE_ACCOUNT_MESSAGE,title:k.CONFIRMATION_MODAL_TITLE});this.listenToOnce(c,"accept",f.partial(this.openThirdPartySignupPage,a));h.getInstance().show(c)},openThirdPartySignupPage:function(){var c=this.service.url;c&&a.openWindow(c)},
manageSettings:function(){var c=this.service.manageSettingsUrl;c&&a.openWindow(c);return!1},onSaveError:function(a,b){var d=c.getErrorMessage(b)||"Server error",e;e=a.get("associationState")===l.UNASSOCIATED?this.LINK_DEVICE_ERROR_MSG:this.UNLINK_DEVICE_ERROR_MSG;g.trigger("showMessage",e,d,{isHtml:!0});this.collection.fetch()},onInputKeyUp:function(a){a.keyCode===b.ENTER&&!$(a.currentTarget).is("[readonly]")&&this.addAssociation(a)}},{NAME:"MusicSettingsAccountView",CONFIRM_CREATE_ACCOUNT_MESSAGE:"Creating a new account will take you to this service's web page, where you will be guided through the steps to create an account. You must return to the "+
j.TXT_APP_NAME+" to use this service.",CONFIRMATION_MODAL_TITLE:"Create New Account"});return k});define("models/settings/ihr-preferences-model",["constants","models/base-model","utils/scope"],function(f,g,b){var a=g.extend({idAttribute:"stationId",url:f.URL+"/api/iheartradio/preferences",defaults:{customRadioEnabled:!0,facebookPublishingEnabled:!1,email:null}},{NAME:"IHRPreferencesModel",getInstance:b.singleton(function(){return new a})});return a});
define("models/settings/ihr-registration-code-model",["constants","models/base-model","utils/poll-mixin","utils/scope"],function(f,g,b,a){var c=g.extend({url:f.URL+"/api/iheartradio/registration-code",expires:0,pollingInterval:9E5,defaults:{registrationCode:-1}},{NAME:"IHRRegistrationCodeModel",getInstance:a.singleton(function(){return new c})}).extend(b);return c});
define("views/settings/music-settings-account-ihr-view","lodash,jquery,backbone,handlebars,views/settings/music-settings-account-view,models/third-party-account-model,models/settings/ihr-preferences-model,models/settings/ihr-registration-code-model,constants,utils/log".split(","),function(f,g,b,a,c,d,e,h,l,i){var j=c.extend({template:a.getTemplate("settings/d-music-settings-account-ihr"),associationTemplate:a.getTemplate("settings/d-link-account-login"),events:f.extend({"click #iheart-allow-explicit-content":"updateAllowExplicitContent",
"click #iheart-share-on-facebook":"updateShareOnFacebook"},c.prototype.events),service:{name:"iHeartRadio",url:"http://www.iheart.com/",manageSettingsUrl:"http://www.iheart.com/my/settings/",icon:"d-iheart-icon",supportsAssociation:!0},LINK_DEVICE_ERROR_MSG:'Unable to link your iHeartRadio account. Visit Help for troubleshooting tips.',UNLINK_DEVICE_ERROR_MSG:'Unable to unlink your iHeartRadio account. Visit Help for troubleshooting tips.',
initialize:function(){var a=this;c.prototype.initialize.apply(this,arguments);this.registrationCodeModel=h.getInstance();this.preferencesModel=e.getInstance();this.preferencesModel.listenTo(this.model,"change:associationState",function(c,b){b===d.ASSOCIATED?a.preferencesModel.fetch({force:!0}):a.preferencesModel.clear()})},getTemplateData:function(){var a=f.extend({account:{},ihrPreferences:this.preferencesModel.toJSON()},c.prototype.getTemplateData.apply(this,arguments));if(!a.account.username)a.account.username=
this.preferencesModel.get("email");return a},getFetchables:function(){return this.isAssociated()?[this.preferencesModel]:[]},render:function(){c.prototype.render.apply(this);this.updateActivationUrl()},startListening:function(){c.prototype.startListening.apply(this);this.listenTo(this.registrationCodeModel,"change",this.updateActivationUrl);this.isAssociated()||this.registrationCodeModel.startPolling(j.NAME)},updateActivationUrl:function(){var a=this.registrationCodeModel.get("registrationCode");
this.isAssociated()?this.stopPollingForRegistrationCode():a&&a!==-1?this.getAddAssociationButton().attr("href","http://www.iheart.com/simple/activate?autoactivate=true&code="+a):f.isNull(a)&&(this.stopPollingForRegistrationCode(),this.handleAssociation())},updateAllowExplicitContent:function(){this.preferencesModel.set("customRadioEnabled",this.$("#iheart-allow-explicit-content").prop("checked"));this.savePreferences()},updateShareOnFacebook:function(){this.preferencesModel.set("facebookPublishingEnabled",
this.$("#iheart-share-on-facebook").prop("checked"));this.savePreferences()},savePreferences:function(){this.preferencesModel.save({},{wait:!0,error:f.bind(this.onSavePreferencesError,this)})},onSavePreferencesError:function(a,c){var d=JSON.parse(c.responseText||"{}").message||"Server error";b.trigger("showMessage","Unable to save your preferences.",d);c.status&&c.status===400&&this.collection.fetch()},getAddAssociationButton:function(){return this.$(".dee-link-btn")},handleAssociation:function(){this.model.set("associationState",
d.ASSOCIATED)},addAssociation:function(){var a=this.registrationCodeModel.get("registrationCode");a&&a!==-1?f.delay(f.bind(this.pollForAssociationState,this),2E3,a):f.isNull(a)&&this.handleAssociation();g.post(l.URL+l.API_PREFIX+"/iheartradio/notify-sync-service")},pollForAssociationState:function(a){var c=this,b=l.URL+l.API_PREFIX+"/iheartradio/code-status?code="+a;c.associationStatePollingId&&clearTimeout(c.associationStatePollingId);g.ajax(b).done(function(b){c.associationStatePollingId&&clearTimeout(c.associationStatePollingId);
b&&b.codeEntered?(c.handleAssociation(),c.stopPollingForRegistrationCode()):c.associationStatePollingId=setTimeout(f.bind(c.pollForAssociationState,c,a),2E3)}).fail(function(){i.error("Ajax call failed for '"+b+"': unable to check IHR device association state")})},isAssociated:function(){return this.model.get("associationState")===d.ASSOCIATED},stopPollingForRegistrationCode:function(){this.registrationCodeModel&&this.registrationCodeModel.stopPolling(j.NAME)},dispose:function(){this.stopPollingForRegistrationCode();
this.associationStatePollingId&&clearTimeout(this.associationStatePollingId);c.prototype.dispose.apply(this,arguments)}},{NAME:"MusicSettingsAccountIHRView"});return j});
define("views/music/ihr/ihr-home-link-view","handlebars,backbone,collections/third-party-account-collection,collections/music/media-owner-collection,views/settings/music-settings-account-ihr-view,models/third-party-account-model,models/settings/ihr-registration-code-model,constants".split(","),function(f,g,b,a,c,d,e,h){var l=c.extend({template:f.getTemplate("music/ihr/d-ihr-home-link"),events:{"click .ihr-account-link":"addAssociation"},initialize:function(){this.collection=b.getInstance();this.registrationCodeModel=
e.getInstance();this.listenTo(a.getInstance(),"ownerUpdate",this.render)},isAssociated:function(){return a.getInstance().hasAccountAssociation("I_HEART_RADIO")},getFetchables:function(){return this.collection.hasSynced?[]:[this.collection]},getAddAssociationButton:function(){return this.$(".ihr-account-link")},handleAssociation:function(){this.model.set("associationState",d.ASSOCIATED);g.trigger("navigate.reload")},render:function(){if(this.collection.hasSynced||this.hasFetched)this.model=this.collection.get(h.SP_IHEART),
this.$el.html(this.template({accountLink:this.isAssociated()})),this.updateActivationUrl();return this},stopPollingForRegistrationCode:function(){this.registrationCodeModel&&this.registrationCodeModel.stopPolling(l.NAME)},dispose:function(a){a!=="music/I_HEART_RADIO"&&c.prototype.dispose.apply(this,arguments)},startListening:function(){this.listenTo(this.registrationCodeModel,"change",this.updateActivationUrl);this.listenTo(g,"navigate",this.dispose);this.isAssociated()||this.registrationCodeModel.startPolling(l.NAME)}},
{NAME:"IHRHomeLinkView"});return l});
define("views/music/ihr/ihr-mystations-view","lodash,backbone,handlebars,collections/music/media-owner-collection,views/music/music-base-view,views/music/ihr/ihr-media-control-mixin,collections/music/ihr/ihr-live-stream-collection,views/music/ihr/ihr-home-link-view".split(","),function(f,g,b,a,c,d,e,h){return c.extend(d).extend({events:{"click .dee-music-image-text-item-list:not([disabled])":"playStation"},errorEvents:{"click .account-settings-link":"toThirdPartySettings"},accountErrorTemplate:b.getTemplate("music/ihr/dee-ihr-account-error"),
template:b.getTemplate("music/ihr/dee-ihr-stations"),initialize:function(a){a=a||{};this.userLiveStationCollection=a.userLiveStationCollection;this.pageDescription=a.pageDescription;this.userLiveStationCollection&&this.listenTo(this.userLiveStationCollection,"musicFetchError",f.partial(this.baseErrorCallback,"Error fetching user live stations"));this.listenTo(this.collection,"musicFetchError",f.partial(this.baseErrorCallback,"Error fetching custom stations"));c.prototype.initialize.call(this,a)},
getFetchables:function(){var c=[this.collection,e.getInstance(),a.getInstance()];this.userLiveStationCollection&&c.push(this.userLiveStationCollection);return c},startListening:function(){this.listenTo(this.collection,"reset sync",this.render);this.userLiveStationCollection&&this.listenTo(this.userLiveStationCollection,"reset sync",this.render)},render:function(){if(!this.showErrorOrSpinner()){var c=this.extractValidModels(this.collection),b=this.getInfoForLiveStations(this.userLiveStationCollection),
c=c.concat(b);a.getInstance().hasAccountAssociation("I_HEART_RADIO")?this.$el.html(this.template({hasStations:c.length>0,stations:c,error_msg:this.DISPLAY_TEXT_NO_STATIONS})):(this.$el.html(this.template()),this.ihrHomeLinkView=new h({el:this.$("#ihr-account-link-region")}),this.ihrHomeLinkView.render())}return this},getInfoForLiveStations:function(a){if(!a)return[];a=f.pluck(a.models,"id");return e.getInstance().getStreamInfo(a)},extractValidModels:function(a){var c=[];f.isUndefined(a)||f.each(a.models,
function(a){!f.isNull(a.id)&&!f.isNull(a.get("name"))&&c.push(a.toJSON())});return c},toThirdPartySettings:function(){g.trigger("navigate","settings/music-settings")},playStation:function(a){var a=$(a.currentTarget).closest(".dee-music-image-text-item-list"),c=a.attr("data-stationid"),b=a.attr("data-stationtype"),d;d=this.userLiveStationCollection&&b==="LIVE"?this.userLiveStationCollection.get(c):this.collection.get(c);this.queueAndPlay({stationId:c,stationType:b,activityParams:d.toJSON()},a)},DISPLAY_TEXT_ON_ERROR:"Error getting iHeartRadio recent stations list.",
DISPLAY_TEXT_NO_STATIONS:"You don't have any stations in your history."},{NAME:"IHRMyStationsView"})});
define("views/music/ihr/ihr-livestations-view",["lodash","handlebars","backbone","views/music/music-base-view"],function(f,g,b,a){return a.extend({events:{"click .dee-music-text-item-list":"goTo"},template:g.getTemplate("music/ihr/dee-ihr-livestations"),initialize:function(c){this.listenTo(this.model,"musicFetchError",f.partial(this.baseErrorCallback,""));a.prototype.initialize.call(this,c)},getFetchables:function(){return[this.model]},startListening:function(){this.listenTo(this.model,"sync",this.render)},
render:function(){this.showErrorOrSpinner()||this.$el.html(this.template({liveStations:this.model.toJSON()}));return this},goTo:function(a){var a=$(a.currentTarget).closest(".dee-music-text-item-list"),d=a.attr("data-genreid"),e=a.attr("data-genreCategory");f.isUndefined(d)?(a=a.attr("data-categoryid"),f.isUndefined(a)||b.trigger("navigate","music/I_HEART_RADIO/livestations/"+a)):b.trigger("navigate","music/I_HEART_RADIO/genres/"+e+"/"+d)},DISPLAY_TEXT_ON_ERROR:"Error getting iHeartRadio live stations"},
{NAME:"IHRLiveStationsView"})});
define("views/music/ihr/ihr-perfectfor-view",["handlebars","views/music/music-base-view","backbone","lodash"],function(f,g,b,a){return g.extend({events:{"click .dee-music-image-text-item-list":"goToPerfectForActivity"},template:f.getTemplate("music/ihr/dee-ihr-perfectfor"),initialize:function(c){this.listenTo(this.model,"musicFetchError",a.partial(this.baseErrorCallback,""));g.prototype.initialize.call(this,c)},getFetchables:function(){return[this.model]},startListening:function(){this.listenTo(this.model,"reset remove change",
this.render)},render:function(){this.showErrorOrSpinner()||this.$el.html(this.template({perfectForActivities:this.model.getPerfectForActivities(),dayPart:this.model.get("dayPart"),weekdayName:this.model.get("weekdayName")}));return this},goToPerfectForActivity:function(a){a=$(a.currentTarget).closest(".dee-music-image-text-item-list").attr("data-activityindex");b.trigger("navigate","music/I_HEART_RADIO/perfect-for/"+a)},DISPLAY_TEXT_ON_ERROR:"Error getting iHeartRadio Perfect for mood stations"},
{NAME:"IHRPerfectForView"})});
define("views/music/ihr/ihr-perfectfor-activity-view",["handlebars","models/music/ihr/ihr-perfectfor-model","views/music/music-base-view","views/music/ihr/ihr-media-control-mixin"],function(f,g,b,a){return b.extend(a).extend({events:{"click .dee-music-image-text-item-list":"playStation"},template:f.getTemplate("music/ihr/dee-ihr-perfectfor-activity"),initialize:function(a){this.model=g.getInstance().getPerfectForActivities()[a.activityIndex];b.prototype.initialize.apply(this,arguments)},render:function(){this.showErrorOrSpinner()||
this.$el.html(this.template({categories:this.model.categories}));return this},playStation:function(a){var a=$(a.currentTarget).closest(".dee-music-image-text-item-list"),b=a.attr("data-stationid"),e=a.attr("data-stationtype"),f={};f.id=b;f.imagePath=a.attr("data-stationimagepath");f.name=a.attr("data-stationname");f.description=a.attr("data-stationdescription");this.queueAndPlay({stationId:b,stationType:e,activityParams:f},a)},DISPLAY_TEXT_ON_ERROR:"Error getting iHeartRadio Perfect for mood stations for activity"},
{NAME:"IHRPerfectForActivityView"})});
define("views/music/ihr/ihr-liveradio-cities-view",["handlebars","backbone","views/music/music-base-view","lodash"],function(f,g,b,a){return b.extend({events:{"click .dee-music-text-item-list":"goToCity"},template:f.getTemplate("music/ihr/dee-ihr-liveradio-cities"),initialize:function(c){this.listenTo(this.collection,"musicFetchError",a.partial(this.baseErrorCallback,""));b.prototype.initialize.call(this,c)},getFetchables:function(){return[this.collection]},startListening:function(){this.listenTo(this.collection,"sync",
this.render)},render:function(){this.showErrorOrSpinner()||this.$el.html(this.template({states:JSON.parse(JSON.stringify(this.collection))}));return this},goToCity:function(a){var b=$(a.currentTarget).closest(".dee-music-text-item-list"),a=b.attr("data-stateid"),b=b.attr("data-marketid");g.trigger("navigate","music/I_HEART_RADIO/livestations/cities/"+a+"/"+b)},DISPLAY_TEXT_ON_ERROR:"Unable to load iHeart live radio cities"},{NAME:"IHRLiveRadioCitiesView"})});
define("views/music/ihr/ihr-livestations-list-view",["handlebars","views/music/music-base-view","collections/music/ihr/ihr-live-stream-collection","views/music/ihr/ihr-media-control-mixin"],function(f,g,b,a){return g.extend(a).extend({events:{"click .dee-music-image-text-item-list":"playStation"},template:f.getTemplate("music/ihr/dee-ihr-stations"),initialize:function(a){a=a||{};this.error_msg=a.error_msg||"Unable to find any stations.";g.prototype.initialize.call(this,a)},startListening:function(){this.listenTo(b.getInstance(),
"reset sync",this.render)},render:function(){var a=b.getInstance();if(a.length>0&&!this.showErrorOrSpinner()){var a=a.getStreamInfo(this.model.get("streams")),d="";this.model.get("marketName")&&(d=this.model.get("marketName")+", "+this.model.get("marketStateAbbreviation"));this.$el.html(this.template({hasStations:a.length>0,stations:a,pageTitle:d,error_msg:this.error_msg}))}return this},playStation:function(a){var a=$(a.currentTarget).closest(".dee-music-image-text-item-list"),d=a.attr("data-stationid");
this.queueAndPlayLive({stationId:d,stationType:a.attr("data-stationtype"),activityParams:b.getInstance().get(d).toJSON()},a)},DISPLAY_TEXT_ON_ERROR:"Error getting iHeartRadio live stations list."},{NAME:"IHRLiveStationsListView"})});
define("views/music/ihr/ihr-live-market-view",["collections/music/ihr/ihr-liveradio-state-city-collection","views/music/ihr/ihr-livestations-list-view"],function(f,g){return g.extend({initialize:function(b){var a=f.getInstance(),b=b||{};this.stateId=b.stateId;this.marketId=b.marketId;this.error_msg="Unable to find any stations for the selected region";b.error_msg=this.error_msg;if(this.stateId&&this.marketId&&a.hasSynced)this.model=a.get(this.stateId).get("cities").get(this.marketId);g.prototype.initialize.call(this,
b)},getFetchables:function(){return[f.getInstance()]},startListening:function(){if(this.stateId&&this.marketId)this.model=f.getInstance().get(this.stateId).get("cities").get(this.marketId);g.prototype.startListening.call(this,arguments)}},{NAME:"IHRLiveMarketView"})});
define("views/music/ihr/ihr-local-live-market-view",["views/music/ihr/ihr-live-market-view","models/music/ihr/ihr-local-market-model","lodash"],function(f,g,b){return f.extend({model:g.getInstance(),initialize:function(){this.error_msg="Unable to find any stations for your Zip Code.";this.listenTo(this.model,"musicFetchError",b.partial(this.baseErrorCallback,""));this.errorsList=[];b.bindAll(this,"onAccountChange")},getFetchables:function(){var a=f.prototype.getFetchables.call(this,arguments);a.push(this.model);
return a},startListening:function(){this.listenTo(this.model,"sync",this.render);f.prototype.startListening.call(this,arguments)}},{NAME:"IHRLocalLiveMarketView"})});
define("views/music/ihr/ihr-genre-view",["views/music/ihr/ihr-livestations-list-view","collections/music/ihr/ihr-live-stream-collection","lodash"],function(f,g,b){return f.extend({initialize:function(a){this.genreId=a.genreId;this.genreCategory=a.genreCategory;this.liveStreamCollection=g.getInstance();this.listenTo(this.model,"musicFetchError",b.partial(this.baseErrorCallback,""));this.error_msg="Unable to find any stations for the selected genre.";this.errorsList=[];b.bindAll(this,"onAccountChange")},
getFetchables:function(){return[this.model]},startListening:function(){this.listenTo(this.model,"sync",this.render);this.listenTo(this.liveStreamCollection,"reset sync",this.render)},render:function(){var a,c;if(this.liveStreamCollection.length>0&&!this.showErrorOrSpinner()&&(a=this.getSelectedGenre(this.model.get(this.genreCategory),this.genreId)))c=this.liveStreamCollection.getStreamInfo(a.streams),this.$el.html(this.template({hasStations:c.length>0,stations:c,pageTitle:a.genreName}));return this},
getSelectedGenre:function(a,c){return b.findWhere(a,{genreId:c})||null}},{NAME:"IHRGenreView",DISPLAY_TEXT_ON_ERROR:"Unable to load iHeartRadio Genres page"})});define("models/music/ihr/ihr-talk-theme-model",["models/music/ihr/ihr-base-model"],function(f){return f.extend({idAttribute:"id",defaults:{id:null,title:null,description:null,imagePath:null}},{NAME:"IHRTalkThemeModel"})});
define("collections/music/ihr/ihr-talk-themes-collection",["collections/music/ihr/ihr-base-collection","models/music/ihr/ihr-talk-theme-model","constants","utils/scope"],function(f,g,b,a){var c=f.extend({model:g,parse:function(a){return a.talkThemes},url:b.URL+b.API_PREFIX+"/iheartradio/talk-themes"},{NAME:"IHRTalkThemesCollection",getInstance:a.singleton(function(){return new c})});return c});
define("views/music/ihr/ihr-talk-themes-view",["handlebars","views/music/music-base-view","views/music/ihr/ihr-media-control-mixin","collections/music/ihr/ihr-talk-themes-collection"],function(f,g,b,a){return g.extend(b).extend({events:{"click .dee-music-image-text-item-list":"_playTheme"},collection:a.getInstance(),template:f.getTemplate("music/ihr/dee-ihr-themes"),getFetchables:function(){return[this.collection]},startListening:function(){this.listenTo(this.collection,"reset",this.render)},render:function(){this.showErrorOrSpinner()||
this.$el.html(this.template({hasStations:this.collection.length>0,stations:this.collection.toJSON(),stationType:"THEME",error_msg:this.DISPLAY_TEXT_NO_SHOWS}));return this},_playTheme:function(a){var a=$(a.currentTarget).closest(".dee-music-image-text-item-list"),b=a.attr("data-stationid"),e={};e.id=b;e.imagePath=a.attr("data-stationimagepath");e.name=a.attr("data-stationname");e.description=a.attr("data-stationdescription");this.queueAndPlay({stationId:b,stationType:"THEME",activityParams:e},a)},
DISPLAY_TEXT_NO_SHOWS:"This category does not have any shows"},{NAME:"IHRTalkThemesView"})});define("models/music/ihr/ihr-talk-category-model",["models/music/ihr/ihr-base-model"],function(f){return f.extend({idAttribute:"id",defaults:{id:null,name:null,description:null,shows:null}},{NAME:"IHRTalkCategoryModel"})});
define("collections/music/ihr/ihr-talk-categories-collection",["collections/music/ihr/ihr-base-collection","models/music/ihr/ihr-talk-category-model","constants","utils/scope"],function(f,g,b,a){var c=f.extend({model:g,parse:function(a){return a.categoryList},url:b.URL+b.API_PREFIX+"/iheartradio/talk-categories"},{NAME:"IHRTalkCategoriesCollection",getInstance:a.singleton(function(){return new c})});return c});
define("views/music/ihr/ihr-talk-categories-view",["handlebars","backbone","views/music/music-base-view","collections/music/ihr/ihr-talk-categories-collection"],function(f,g,b,a){return b.extend({events:{"click .dee-music-text-item-list":"_goTo"},collection:a.getInstance(),template:f.getTemplate("music/ihr/dee-ihr-categories"),getFetchables:function(){return[this.collection]},startListening:function(){this.listenTo(this.collection,"reset",this.render)},render:function(){this.showErrorOrSpinner()||
this.$el.html(this.template({categories:this.collection.toJSON()}));return this},_goTo:function(a){a=$(a.currentTarget).closest(".dee-music-text-item-list").attr("data-showcategory-id");g.trigger("navigate","music/I_HEART_RADIO/talk/category/"+a)}},{NAME:"IHRTalkCategoriesView"})});
define("views/music/ihr/ihr-talk-shows-view",["handlebars","backbone","views/music/music-base-view"],function(f,g,b){return b.extend({events:{"click .dee-music-image-text-item-list":"_goTo"},template:f.getTemplate("music/ihr/dee-ihr-shows"),getFetchables:function(){return[this.collection]},startListening:function(){this.listenTo(this.collection,"reset",this.render)},render:function(){this.trigger("titleChange",this.collection.category);this.showErrorOrSpinner()||this.$el.html(this.template({hasShows:this.collection.length>
0,shows:this.collection.toJSON(),error_msg:this.DISPLAY_TEXT_NO_SHOWS}));return this},_goTo:function(a){a=$(a.currentTarget).closest(".dee-music-image-text-item-list").attr("data-showid");g.trigger("navigate","music/I_HEART_RADIO/talk/show/"+a)},DISPLAY_TEXT_NO_SHOWS:"This category does not have any shows"},{NAME:"IHRTalkShowsView"})});
define("utils/anchorable",["lodash","backbone","utils/error-code"],function(f,g,b){return{extendFrom:function(a){return a.extend({scrollToElementWithAlphaNum:function(a){var d=this,e,f,l,i,a=a||{};e=a.alphaNum||"#";a=e==="#";d.isAlphaNumFetching=!0;this._resetState();this.collection.fetch({reset:!0,data:{alphaNum:e},firstAlphaNumSelected:a}).done(function(a){d.trigger("scrollTo",0);if(a.bufferResultCount)f=a.bufferResultCount,l=a.resultCount-1,a.resultCount||(f--,l=0),d.centerAroundElement({id:a.selectItemList[f].id,
itemsAbove:f,itemsBelow:l})}).fail(function(a){i=b.getErrorMessage(a)||"Error while trying to get items starting with "+e;g.trigger("showMessage",i,"");d.anchorControl&&d.anchorControl.failedFetching()}).always(function(){d.isAlphaNumFetching=!1})},setAnchorControl:function(a){this.anchorControl&&this.stopListening(this.anchorControl);this.anchorControl=a;this.listenTo(this.anchorControl,"scrollToWithOffset",this.scrollToElementWithOffset);this.listenTo(this.anchorControl,"alphaNum:selected",this.scrollToElementWithAlphaNum)},
informAnchorControl:function(){if(this.anchorControl){var a=this.collection.totalResultCount;f.isUndefined(a)&&(a=0);this.anchorControl.doneFetching(a,this.collection.length)}},startListening:function(){a.prototype.startListening&&a.prototype.startListening.call(this,arguments);this.listenTo(this,"scroll",this.scroll);this.collection&&(this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"sync",this.informAnchorControl))}})}}});
define("views/music/anchorable-music-list-view",["utils/anchorable","views/music/music-list-view"],function(f,g){return f.extendFrom(g).extend({scroll:function(){this.isAlphaNumFetching||g.prototype.scroll.apply(this,arguments)},getScrollOptions:function(){return{reversePagination:!0}},render:function(){this.showErrorOrSpinner()||(this.informAnchorControl(),this.innerRender());return this}},{NAME:"AnchorableMusicListView"})});
define("views/music/ihr/ihr-talk-show-episodes-view",["lodash","handlebars","views/music/anchorable-music-list-view","views/music/ihr/ihr-media-control-mixin"],function(f,g,b,a){return b.extend(a).extend({parent:b.prototype,childEvents:{"click .dee-music-image-text-item-list":"_playEpisode"},template:g.getTemplate("music/ihr/dee-ihr-show-episode"),initialize:function(){this.parent.initialize.apply(this,arguments);this.events=f.extend(this.events,this.childEvents)},getScrollOptions:function(){return{reversePagination:!1}},
render:function(){this.trigger("titleChange",this.collection.show);this.parent.render.apply(this,arguments)},_playEpisode:function(a){var a=$(a.currentTarget).closest(".dee-music-image-text-item-list"),b=a.attr("data-episodeId"),e={};e.id=b;e.imagePath=a.attr("data-episodeimagepath");e.name=a.attr("data-episodename");e.description=a.attr("data-episodedescription");e.showId=a.data("showid");this.queueAndPlay({stationId:b,stationType:"EPISODE",activityParams:e},a)},DISPLAY_TEXT_ON_ERROR:"Error getting iHeartRadio episodes",
DISPLAY_TEXT_NO_EPISODES:"This show doesnot have any episodes"},{NAME:"IhrTalkShowEpisodesView"})});
define("views/layouts/search-layout",["handlebars","views/layouts/base-layout","lodash","collections/device-collection"],function(f,g,b,a){return g.extend({isTopLevel:!0,events:{"keyup #dee-search-bar":"search","click span.dee-clear-button":"clearSearch"},regions:{"dee-main-content":"#dee-main-content"},template:f.getTemplate("layouts/dee-search-layout"),initialize:function(){this.lastQuery="";this.listenTo(this.getView("searchView"),"search:on",b.partial(this.searchStatus,!0));this.listenTo(this.getView("searchView"),
"search:off",b.partial(this.searchStatus,!1));this.host("dee-main-content",this.getView("standardView"));g.prototype.initialize.apply(this,arguments)},getFetchables:function(){return[a.getInstance()]},render:function(){this.$el.html(this.template({query:this.lastQuery,searchBarPlaceholder:this.searchBarPlaceholder}));this.lastQuery.length!==0&&(this.$("span.dee-clear-button").removeClass("empty"),this.$("span.d-search-button").addClass("empty"));return this},search:function(a){var b=this.$("#dee-search-bar"),
e=this.$("span.dee-clear-button"),f=this.$("span.d-search-button"),g=this.getView("searchView");if(a&&a.showPreviousSearch)this.lastQuery?(b.val(this.lastQuery),this.showSearch()):this.navigateHome();else if(a&&a.query&&b.val(a.query),a=b.val().trim(),a!==this.lastQuery)this.lastQuery=a,b.val().length===0?(e.addClass("empty"),f.removeClass("empty"),this.searchStatus(!1)):(e.removeClass("empty"),f.addClass("empty"),this.showSearch()),g.search(a)},clearSearch:function(){this.$("#dee-search-bar").val("");
this.search()},searchStatus:function(a){var b=this.$("#dee-search-bar");a?this.$("span.dee-spinner-icon").removeClass("empty"):(this.$("span.dee-spinner-icon").addClass("empty"),b.val().length===0&&this.showContent())},showContent:function(){this.$("#dee-search-bar").val("");this.host("dee-main-content",this.getView("standardView"))},showSearch:function(){this.host("dee-main-content",this.getView("searchView"))}},{NAME:"SearchLayout"})});
define("views/music/ihr/ihr-favorites-view",["lodash","views/music/ihr/ihr-mystations-view","collections/music/ihr/ihr-live-stream-collection","collections/music/media-owner-collection"],function(f,g,b,a){return g.extend({getFetchables:function(){return[this.collection,b.getInstance()]},render:function(){if(!this.renderAccountError()&&!this.showErrorOrSpinner()){var a=this.populateLiveStationData().extractValidModels(this.collection);this.$el.html(this.template({hasStations:a.length>0,stations:a,
error_msg:this.DISPLAY_TEXT_NO_STATIONS}))}return this},populateLiveStationData:function(){var a=b.getInstance(),d;f.each(this.collection.models,function(b){b.get("stationType")==="LIVE"&&!f.isNull(b.id)&&(d=a.get(b.id))&&f.extend(b.attributes,d.attributes)});return this},renderAccountError:function(){return this.hasFetched&&!a.getInstance().hasAccountAssociation("I_HEART_RADIO")?(this.$el.html(this.accountErrorTemplate({page:this.pageDescription})),this.delegateEvents(this.errorEvents),!0):!1},DISPLAY_TEXT_ON_ERROR:"Error getting iHeartRadio favorite stations list.",
DISPLAY_TEXT_NO_STATIONS:"You don't have any favorites yet!"},{NAME:"IHRFavoritesView"})});
define("views/music/ihr/ihr-home-view","handlebars,backbone,views/music/music-base-view,collections/music/ihr/ihr-favorite-collection,collections/music/media-owner-collection,views/music/ihr/ihr-favorites-view,views/music/ihr/ihr-home-link-view".split(","),function(f,g,b,a,c,d,e){return b.extend({loadingSpinnerWipesScreen:!0,events:{"click .dee-music-text-item-list":"gotoCategory"},regions:{"ihr-favorites":"#ihr-favorites-region","ihr-link":"#ihr-account-link-region"},supportedViews:function(){return[{name:"livestations",
title:"Live Radio"},{name:"perfect-for",title:"Perfect For"},{name:"originals",title:"iHeartRadio Originals"},{name:"talk/categories",title:"Shows"}]},template:f.getTemplate("music/ihr/dee-ihr-home"),initialize:function(c){this.ihrFavoritesView=new d({collection:a.getInstance(),pageDescription:"iHeartRadio Favorites"});this.ihrFavoritesView.setErrorDisplay("Couldn't list your favorites");this.host("ihr-favorites",this.ihrFavoritesView);a.getInstance().fetch();b.prototype.initialize.apply(this,arguments);
this.render()},getFetchables:function(){return[c.getInstance()]},gotoCategory:function(a){a=$(a.currentTarget).closest(".dee-music-text-item-list").attr("data-id");g.trigger("navigate","music/I_HEART_RADIO/"+a)},render:function(){if(this.hasFetched&&(this.$el.html(this.template({views:this.supportedViews()})),!c.getInstance().hasAccountAssociation("I_HEART_RADIO")))this.ihrHomeLinkView&&this.ihrHomeLinkView.dispose(),this.ihrHomeLinkView=new e({el:this.$("#ihr-account-link-region")}),this.ihrHomeLinkView.render();
return this}},{NAME:"IHRHomeView"})});
define("views/music/ihr/ihr-search-view",["lodash","backbone","handlebars","views/music/music-search-view","views/music/ihr/ihr-media-control-mixin"],function(f,g,b,a,c){return a.extend({events:{"click .dee-music-image-text-item-list":"createAndPlayStation"},template:b.getTemplate("music/ihr/dee-ihr-search"),initialize:function(){b.registerPartial("dee-music-list-item",b.getTemplate("music/dee-music-list-item"));b.registerPartial("dee-ihr-search-list-item",b.getTemplate("music/ihr/dee-ihr-search-list-item"));a.prototype.initialize.apply(this,
arguments)},onImgError:function(a){$(a.target).css("opacity",0)},startListening:function(){this.listenTo(this.model,"sync",this._onSearchDone);this.listenTo(this.model,"musicFetchError",this.onSearchError)},render:function(){var a=this.model.truncate(10).toJSON();f("artists,tracks,stations,featuredStations,shows,themes".split(",")).forEach(function(c){if(a[c])a["displayed"+c.charAt(0).toUpperCase()+c.slice(1)]=a[c].length});this.$el.html(this.template(a));this.$("img").on("error",this.onImgError);
return this},search:f.debounce(function(a){!a||a.length===0?(this.trigger("search:off"),this.lastQuery="",g.trigger("navigate","music/I_HEART_RADIO",{trigger:!1})):(this.isSearching||g.trigger("navigate","music/I_HEART_RADIO/search",{trigger:!1}),this.isSearching=1,this.lastQuery=a,this.searchJqxhr=this.model.search(a,{force:!0}),this.trigger("search:on"))},250),_onSearchDone:function(a){if(this.lastQuery===a.query)return this.isSearching--,this.isSearching||(this.trigger("search:off"),this.render(),
f.isEmpty(this.model.get("artists"))&&f.isEmpty(this.model.get("tracks"))&&f.isEmpty(this.model.get("stations"))&&f.isEmpty(this.model.get("featuredStations"))&&f.isEmpty(this.model.get("shows"))&&f.isEmpty(this.model.get("themes"))&&this.$("#dee-search-no-results").removeClass("dee-search-invisible")),this},createAndPlayStation:function(a){var a=$(a.currentTarget).closest(".dee-music-image-text-item-list"),b=a.attr("data-stationtype"),f=a.attr("data-id"),g=a.attr("data-artistname"),i;i={stationType:b,
stationId:f,name:a.attr("data-name"),logo:a.find("img")[0].src};g&&(i.artistName=g);c.queueAndPlay({stationType:b,stationId:f,activityParams:i},a)}},{NAME:"IHeartRadioSearchView"})});
define("models/music/ihr/ihr-search-result-model",["constants","models/music/ihr/ihr-base-model","utils/music-helper","lodash"],function(f,g,b,a){var c=g.extend({defaults:{tracks:null,artists:null,stations:null,shows:null,themes:null,featuredStations:null,totalTracks:0,totalArtists:0,totalStations:0,totalFeaturedStations:0,totalShows:0,totalThemes:0},url:f.URL+f.API_PREFIX+"/iheartradio/search",search:function(a,c,b){this.query=a||"";return this.fetch(c,b)},fetch:function(c,b){c=c||{};if(a.isUndefined(c.data))c.data=
{};c.data.query=this.query;return g.prototype.fetch.apply(this,arguments)},parse:function(c){var e=c.artists,f=c.tracks,g=c.stations,i=c.featuredStations,j=c.shows,k=c.themes;a.isEmpty(g)||a.each(g,function(a){a.mainText=a.name;a.subText=a.description;a.stationType="LIVE";a.id=a.id;b.populateIHRImageTiny(a)});a.isEmpty(e)||a.each(e,function(a){a.mainText=a.artistName;a.stationType="ARTIST";a.id=a.artistId;b.populateIHRImageTiny(a)});a.isEmpty(f)||a.each(f,function(a){a.mainText=a.title;a.subText=
a.artistName;a.stationType="TRACK";a.id=a.trackId;b.populateIHRImageTiny(a)});a.isEmpty(i)||a.each(i,function(a){a.mainText=a.name;a.subText=a.description;a.stationType="MOOD";a.id=a.stationId;b.populateIHRImageTiny(a)});a.isEmpty(j)||a.each(j,function(a){a.mainText=a.title;a.subText=a.description;a.stationType="SHOW";b.populateIHRImageTiny(a)});a.isEmpty(k)||a.each(k,function(a){a.mainText=a.name;a.subText=a.description;a.stationType="THEME";b.populateIHRImageTiny(a)});return c},truncate:function(b){var e=
this.clone();if(!a.isNumber(b))b=c.DEFAULT_MAX_LENGTH;a("artists,tracks,stations,featuredStations,shows,themes".split(",")).forEach(function(c){a.isArray(e.get(c))&&e.set(c,a.first(e.get(c),b))});return e},expires:0},{DEFAULT_MAX_LENGTH:5,NAME:"IHRSearchResultModel"});return c});
define("views/music/ihr/ihr-search-layout","lodash,backbone,views/layouts/search-layout,views/music/ihr/ihr-home-view,views/music/ihr/ihr-search-view,models/music/ihr/ihr-search-result-model".split(","),function(f,g,b,a,c,d){return b.extend({views:{standardView:a,searchView:{constructor:c,options:{model:new d}}},initialize:function(){f.bindAll(this,"onAccountChange");b.prototype.initialize.apply(this,arguments)},onAccountChange:function(a){this.clearSearch();this.getView("standardView").onAccountChange(a)},
navigateHome:function(){g.trigger("navigate.redirect","music/I_HEART_RADIO")},searchBarPlaceholder:"for artist or station"},{NAME:"IHeartRadioSearchLayout"})});
define("views/music/cloudplayer/cloud-player-playlists-preview-view",["backbone","handlebars","views/music/music-base-view"],function(f,g,b){return b.extend({template:g.getTemplate("music/cloudplayer/dee-cloud-player-playlists-preview"),events:{"click .dee-music-text-item-list":"_gotoPlaylist","click .dee-more-playlists":"_showMorePlaylists"},initialize:function(a){this.title=a.title;this.url=a.url},startListening:function(){this.listenTo(this.collection,"sync reset",this.render)},render:function(){this.showErrorOrSpinner()||
(this.collection.isEmpty()?this.$el.empty():this.$el.html(this.template(this._getTemplateOptions(this.collection))));return this},_getTemplateOptions:function(a){return{title:this.title,playlistUrl:this.url,collection:a.preview().toJSON(),totalResultCount:a.length,overflow:a.length>5&&this.url}},_showMorePlaylists:function(a){a=$(a.currentTarget);f.trigger("navigate","music/AMAZON_MUSIC/"+$(a).data("url"))},_gotoPlaylist:function(a){a=$(a.currentTarget).closest(".dee-music-text-item-list").attr("data-playlistid");
f.trigger("navigate","music/AMAZON_MUSIC/playlists/"+a)}},{NAME:"CloudPlayerPlaylistPreviewView"})});
define("views/music/cloudplayer/cloud-player-playlists-home-view","lodash,handlebars,views/music/cloudplayer/cloud-player-base-layout,collections/music/cloudplayer/cloud-player-my-playlist-collection,collections/music/cloudplayer/cloud-player-smart-playlist-collection,collections/music/cloudplayer/cloud-player-prime-playlist-collection,views/music/cloudplayer/cloud-player-playlists-preview-view".split(","),function(f,g,b,a,c,d,e){return b.extend({regions:{"smart-playlists":"#dee-smart-playlist-results",
"my-playlists":"#dee-my-playlist-results","prime-playlists":"#dee-prime-playlist-results"},getFetchables:function(){return[this.myPlaylistCollection,this.primePlaylistCollection]},template:g.getTemplate("music/cloudplayer/dee-cloud-player-playlists-home"),initialize:function(){this.myPlaylistCollection=a.getInstance();this.smartPlaylistCollection=c.getInstance();this.primePlaylistCollection=d.getInstance();this.myPlaylistPreview=new e({title:"Your Playlists",url:"myplaylists",collection:this.myPlaylistCollection,
disposeOnEvict:!1});this.smartPlaylistPreview=new e({title:"Auto Playlists",collection:this.smartPlaylistCollection,disposeOnEvict:!1});this.primePlaylistPreview=new e({title:"Prime Playlists",url:"primeplaylists",collection:this.primePlaylistCollection,disposeOnEvict:!1});this.host("smart-playlists",this.smartPlaylistPreview);this.host("my-playlists",this.myPlaylistPreview);this.host("prime-playlists",this.primePlaylistPreview);this.listenTo(this.myPlaylistCollection,"musicFetchError",f.partial(this.baseErrorCallback,
""));this.listenTo(this.primePlaylistCollection,"musicFetchError",f.partial(this.baseErrorCallback,""));this.listenTo(this.smartPlaylistCollection,"musicFetchError",f.partial(this.baseErrorCallback,""));this.listenTo(this.myPlaylistCollection,"deviceFetchError",this.showErrorOrSpinner);this.listenTo(this.primePlaylistCollection,"deviceFetchError",this.showErrorOrSpinner);this.listenTo(this.smartPlaylistCollection,"deviceFetchError",this.showErrorOrSpinner)},showErrorOrSpinner:function(a){var c=b.prototype.showErrorOrSpinner.apply(this,
arguments);if(!c)if(this.hasFetched){if(!this.myPlaylistCollection.hasSynced||!this.primePlaylistCollection.hasSynced)return this.$el.html(this.errorMessageTemplate({mainText:this.DISPLAY_TEXT_ON_ERROR})),!0}else return!0;return c},render:function(){this.showErrorOrSpinner()||this.$el.html(this.template());return this},DISPLAY_TEXT_ON_ERROR:"Error getting Amazon Music playlists"},{NAME:"CloudPlayerPlaylistsHomeView",DELAY_CLOUD_PLAYER_SEARCH:50})});
define("views/music/cloudplayer/cloud-player-playlists-view",["handlebars","lodash","views/music/cloudplayer/cloud-player-base-layout","backbone","collections/music/cloudplayer/cloud-player-my-playlist-collection"],function(f,g,b,a,c){return b.extend({collection:c.getInstance(),events:{"click .dee-music-text-item-list":"gotoPlaylist"},pageTemplate:f.getTemplate("music/cloudplayer/dee-cloud-player-playlists"),initialize:function(a){this.listenTo(this.collection,"musicFetchError",g.partial(this.baseErrorCallback,
""));this.listenTo(this.collection,"deviceFetchError",this.showErrorOrSpinner);b.prototype.initialize.call(this,a)},showErrorOrSpinner:function(){var a=b.prototype.showErrorOrSpinner.call(this,arguments);!a&&!this.collection.hasSynced&&(this.errorTemplate({displayTextOnError:this.DISPLAY_TEXT_ON_ERROR,showFooter:!0}),a=!0);return a},render:function(){this.showErrorOrSpinner()||this.$el.html(this.pageTemplate({hasPlaylists:this.collection.length>0,playlists:this.collection.toJSON()}));return this},
getFetchables:function(){return[this.collection]},startListening:function(){this.listenTo(this.collection,"sync",this.render)},gotoPlaylist:function(c){c=$(c.currentTarget).closest(".dee-music-text-item-list").attr("data-playlistid");a.trigger("navigate","music/AMAZON_MUSIC/playlists/"+c)},DISPLAY_TEXT_ON_ERROR:"Error getting Amazon Music playlists"},{NAME:"CloudPlayerPlaylistsView"})});
define("views/music/cloudplayer/cloud-player-my-playlists-view",["collections/music/cloudplayer/cloud-player-my-playlist-collection","views/music/cloudplayer/cloud-player-playlists-view"],function(f,g){return g.extend({collection:f.getInstance()},{NAME:"CloudPlayerMyPlaylistsView"})});
define("views/music/cloudplayer/cloud-player-prime-playlists-view",["collections/music/cloudplayer/cloud-player-prime-playlist-collection","views/music/cloudplayer/cloud-player-playlists-view"],function(f,g){return g.extend({collection:f.getInstance()},{NAME:"CloudPlayerPrimePlaylistsView"})});
define("views/music/cloudplayer/cloud-player-playlist-view",["lodash","handlebars","views/music/music-list-view","cloud-player-media-control-mixin","collections/music/cloudplayer/cloud-player-playlist-track-collection"],function(f,g,b,a,c){return b.extend({parent:b.prototype,shuffleTemplate:g.getTemplate("music/d-music-shuffle"),childEvents:{"click .dee-music-shuffle":"shuffleAndQueue"},pageTemplate:g.getTemplate("music/cloudplayer/dee-cloud-player-playlist"),noSongsTemplate:g.getTemplate("music/cloudplayer/dee-cloud-player-no-songs-message"),
Collection:c,initialize:function(a){a=a||{};a.canShuffle=!0;this.parent.initialize.call(this,a);this.events=f.extend(this.events,this.childEvents)},render:function(){this.parent.render.apply(this,arguments)},shuffleAndQueue:function(a){this.queueAndPlay(!0,{playlistId:this.collection.playlistId,playlistTitle:this.collection.title,isoTimestamp:this.collection.isoTimestamp},$(a.currentTarget))},onClick:function(a){var a=$(a.currentTarget),c=this.collection.get(a.data("id"));this.queueAndPlay(!1,{playlistId:this.collection.playlistId,
playlistTitle:this.collection.title,initialTrackIndex:this.collection.getTrackIndex(c),trackId:c.get("trackId"),asin:c.get("asin"),marketplaceId:c.get("marketplaceId"),isoTimestamp:c.get("isoTimestamp")},a)},DISPLAY_TEXT_ON_ERROR:"Error getting Amazon Music playlist information"},{NAME:"CloudPlayerPlaylistView"}).extend(a)});
define("views/music/cloudplayer/cloud-player-albums-view",["backbone","views/music/anchorable-music-list-view","collections/music/cloudplayer/cloud-player-album-collection","handlebars","utils/string-utils"],function(f,g,b,a,c){return g.extend({Collection:b,noSongsTemplate:a.getTemplate("music/cloudplayer/dee-cloud-player-no-songs-message"),onClick:function(a){var b=$(a.currentTarget).data("albumname"),a=$(a.currentTarget).data("albumartistname");f.trigger("navigate","music/AMAZON_MUSIC/albums/"+
c.encodeURIComponent(b)+"/"+c.encodeURIComponent(a))},DISPLAY_TEXT_ON_ERROR:"Error getting Amazon Music albums"},{NAME:"CloudPlayerAlbumsView"})});
define("views/music/cloudplayer/cloud-player-album-view","backbone,jquery,lodash,constants,handlebars,views/music/music-base-view,collections/music/media-owner-collection,cloud-player-media-control-mixin,utils/music-helper".split(","),function(f,g,b,a,c,d,e,h,l){return d.extend({events:{"click .dee-music-shuffle":"shuffleAndQueue","click .dee-music-text-item-list:not([disabled])":"queueFromSelection","click .dee-music-text-item-list[disabled]":"onPrimeDisabledClick"},pageTemplate:c.getTemplate("music/cloudplayer/dee-cloud-player-album"),
initialize:function(a){this.listenTo(this.model,"musicFetchError",b.partial(this.baseErrorCallback,""));d.prototype.initialize.call(this,a)},render:function(){this.showErrorOrSpinner()||this.$el.html(this.pageTemplate({album:this.model.toJSON()}));return this},getFetchables:function(){return[this.model]},startListening:function(){this.listenTo(this.model,"reset change",this.render)},shuffleAndQueue:function(a){this.queueAndPlay(!0,{albumName:this.model.get("albumName"),albumArtistName:this.model.get("albumArtistName"),
isoTimestamp:this.model.get("isoTimestamp")},g(a.currentTarget))},queueFromSelection:function(a){var a=g(a.currentTarget),c=this.$(".dee-music-text-item-list").index(a),c=this.model.get("selectItemList")[c].metadata.objectId;this.queueAndPlay(!1,{albumName:this.model.get("albumName"),albumArtistName:this.model.get("albumArtistName"),initialTrackIndex:l.getTrackIndexFromObjectId(c,this.model.get("selectItemList")),trackId:c,isoTimestamp:this.model.get("isoTimestamp")},a)},onPrimeDisabledClick:function(){var c;
c=e.getInstance().get(a.SP_CLOUD_PLAYER).get("primeStatus")?"We're sorry, but this song is no longer available with Prime Music.":"We're sorry, but this song is accessible to Prime members only";f.trigger("showMessage","Song Not Available",c)},DISPLAY_TEXT_ON_ERROR:"Error getting Amazon Music album information"},{NAME:"CloudPlayerAlbumView"}).extend(h)});
define("views/music/cloudplayer/cloud-player-tracks-view","lodash,views/music/anchorable-music-list-view,collections/music/cloudplayer/cloud-player-track-collection,cloud-player-media-control-mixin,utils/music-helper,handlebars".split(","),function(f,g,b,a,c,d){return g.extend(a).extend({parent:g.prototype,Collection:b,noSongsTemplate:d.getTemplate("music/cloudplayer/dee-cloud-player-no-songs-message"),initialize:function(a){a=a||{};if(f.isUndefined(a.canShuffle))a.canShuffle=!0;this.parent.initialize.apply(this,
arguments);this.isSubView=a.isSubView;this.artistName=a.artistName;this.genre=a.genre},shuffleAndQueue:function(a){var c={isoTimestamp:this.collection.isoTimestamp};this.isSubView&&(this.artistName?f.extend(c,{artistName:this.artistName}):this.genre&&f.extend(c,{genre:this.genre}));this.queueAndPlay(!0,c,$(a.currentTarget))},onClick:function(a){var a=$(a.currentTarget),b=this.collection.get(a.data("id")),d={trackId:b.get("objectId"),isoTimestamp:b.get("isoTimestamp")},b=c.getTrackIndex(b,this.collection);
this.isSubView&&(this.artistName?f.extend(d,{initialTrackIndex:b,artistName:this.artistName}):this.genre&&f.extend(d,{initialTrackIndex:b,genre:this.genre}));this.queueAndPlay(!1,d,a)},DISPLAY_TEXT_ON_ERROR:"Error getting Amazon Music songs"},{NAME:"CloudPlayerTracksView"}).extend(a)});
define("views/music/cloudplayer/cloud-player-artists-view",["backbone","utils/string-utils","views/music/anchorable-music-list-view","collections/music/cloudplayer/cloud-player-artist-collection","handlebars"],function(f,g,b,a,c){return b.extend({Collection:a,noSongsTemplate:c.getTemplate("music/cloudplayer/dee-cloud-player-no-songs-message"),onClick:function(a){a=$(a.currentTarget).data("id");a=g.encodeURIComponent(a);f.trigger("navigate","music/AMAZON_MUSIC/artists/"+a)},DISPLAY_TEXT_ON_ERROR:"Error getting Amazon Music artists"},
{NAME:"CloudPlayerArtistListView"})});
define("views/music/cloudplayer/cloud-player-tab-view",["jquery","views/music/cloudplayer/cloud-player-base-layout","views/music/cloudplayer/cloud-player-albums-view","views/music/cloudplayer/cloud-player-tracks-view"],function(f,g,b,a){return g.extend({initialize:function(a){a=a||{};this.albumCollection=a.albumCollection;this.trackCollection=a.trackCollection;this.views=this.generateViews(a);this.changeTabView("albums");g.prototype.initialize.apply(this,arguments)},generateViews:function(c){return{albumsSubView:{constructor:b,
options:{disposeOnEvict:!1,isSubView:!0,collection:c.albumCollection}},tracksSubView:{constructor:a,options:{disposeOnEvict:!1,isSubView:!0,collection:c.trackCollection,artistName:c.artistName,genre:c.genre}}}},events:{"click .dee-music-tab":"onTabSelect"},render:function(){this.$el.html(this.pageTemplate());this.renderAlbumCount();this.renderTrackCount();return this},startListening:function(){this.albumCollection&&this.listenTo(this.albumCollection,"collection:change:firstFetchCount",this.renderAlbumCount);
this.trackCollection&&this.listenTo(this.trackCollection,"collection:change:firstFetchCount",this.renderTrackCount);this.listenTo(this,"scroll",this.onScroll)},onScroll:function(){this.subViewSelected&&this.subViewSelected.scroll()},renderAlbumCount:function(){this.albumCollection.firstFetchCount&&this.$('li[data="albums"]').html("Albums ("+this.albumCollection.firstFetchCount+")")},renderTrackCount:function(){this.trackCollection.firstFetchCount&&this.$('li[data="songs"]').html("Songs ("+this.trackCollection.firstFetchCount+
")")},onTabSelect:function(a){a=f(a.currentTarget);this.$("li.dee-selected-tab").removeClass("dee-selected-tab");a.addClass("dee-selected-tab");this.changeTabView(a.attr("data"))},changeTabView:function(a){var b;a==="songs"?(b=this.getView("tracksSubView"),b.delegateEvents()):a==="albums"&&(b=this.getView("albumsSubView"));this.host("tab-content",b);this.subViewSelected=b}})});
define("views/music/cloudplayer/cloud-player-artist-view",["handlebars","views/music/cloudplayer/cloud-player-tab-view"],function(f,g){return g.extend({regions:{"tab-content":".dee-music-artist-tabdata"},pageTemplate:f.getTemplate("music/cloudplayer/dee-cloud-player-artist"),initialize:function(b){this.artistName=b.artistName;g.prototype.initialize.apply(this,arguments)}},{NAME:"CloudPlayerArtistView"})});
define("views/music/cloudplayer/cloud-player-genres-view",["utils/string-utils","collections/music/cloudplayer/cloud-player-genre-collection","views/music/anchorable-music-list-view","backbone","handlebars"],function(f,g,b,a,c){return b.extend({Collection:g,noSongsTemplate:c.getTemplate("music/cloudplayer/dee-cloud-player-no-songs-message"),onClick:function(c){c=$(c.currentTarget).closest(".dee-music-image-text-item-list").attr("data-id");c=f.encodeURIComponent(c);a.trigger("navigate","music/AMAZON_MUSIC/genres/"+
c)},DISPLAY_TEXT_ON_ERROR:"Error getting Amazon Music genres"},{NAME:"CloudPlayerGenresView"})});define("views/music/cloudplayer/cloud-player-genre-view",["handlebars","views/music/cloudplayer/cloud-player-tab-view"],function(f,g){return g.extend({regions:{"tab-content":".dee-music-genre-tabdata"},pageTemplate:f.getTemplate("music/cloudplayer/dee-cloud-player-genre"),initialize:function(b){this.genre=b.genre;g.prototype.initialize.apply(this,arguments)}},{NAME:"CloudPlayerGenreView"})});
define("compositors/small/music-compositor","lodash,constants,models/app-layout-options-model,models/music/cloudplayer/cloud-player-album-model,models/music/ihr/ihr-livestations-model,models/music/ihr/ihr-perfectfor-model,models/music/ihr/ihr-local-market-model,collections/music/cloudplayer/cloud-player-playlist-track-collection,collections/music/cloudplayer/cloud-player-my-playlist-collection,collections/music/cloudplayer/cloud-player-smart-playlist-collection,collections/music/cloudplayer/cloud-player-prime-playlist-collection,collections/music/cloudplayer/cloud-player-artist-collection,collections/music/cloudplayer/cloud-player-genre-collection,collections/music/cloudplayer/cloud-player-album-collection,collections/music/cloudplayer/cloud-player-track-collection,collections/music/cloudplayer/cloud-player-search-collection,collections/music/ihr/ihr-favorite-collection,collections/music/ihr/ihr-mystation-collection,collections/music/ihr/ihr-liveradio-state-city-collection,collections/music/ihr/ihr-live-stream-collection,collections/music/ihr/ihr-original-station-collection,collections/music/ihr/ihr-talk-shows-collection,collections/music/ihr/ihr-talk-show-episodes-collection,views/base-view,views/music/account-picker-view,views/layouts/header-player-account-picker-layout,views/layouts/scroll-layout,views/layouts/anchor-layout,views/anchor-control-view,views/music/cloudplayer/cloud-player-home-view,views/music/cloudplayer/cloud-player-home-menu-view,views/music/tunein/tunein-home-view,views/music/ihr/ihr-mystations-view,views/music/ihr/ihr-livestations-view,views/music/ihr/ihr-perfectfor-view,views/music/ihr/ihr-perfectfor-activity-view,views/music/ihr/ihr-liveradio-cities-view,views/music/ihr/ihr-live-market-view,views/music/ihr/ihr-local-live-market-view,views/music/ihr/ihr-genre-view,views/music/ihr/ihr-talk-themes-view,views/music/ihr/ihr-talk-categories-view,views/music/ihr/ihr-talk-shows-view,views/music/ihr/ihr-talk-show-episodes-view,views/music/ihr/ihr-search-layout,views/music/cloudplayer/cloud-player-playlists-home-view,views/music/cloudplayer/cloud-player-my-playlists-view,views/music/cloudplayer/cloud-player-prime-playlists-view,views/music/cloudplayer/cloud-player-playlist-view,views/music/cloudplayer/cloud-player-albums-view,views/music/cloudplayer/cloud-player-album-view,views/music/cloudplayer/cloud-player-tracks-view,views/music/cloudplayer/cloud-player-artists-view,views/music/cloudplayer/cloud-player-artist-view,views/music/cloudplayer/cloud-player-genres-view,views/music/cloudplayer/cloud-player-genre-view,views/music/tunein/browse-view,views/message-view,backbone,utils/string-utils".split(","),
function(f,g,b,a,c,d,e,h,l,i,j,k,n,m,o,q,p,s,r,t,C,E,v,y,u,A,H,I,J,G,z,B,D,w,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,aa,ba,K,ca,L,M,da,ea,fa,ga,ha,ia,ja){var F={hideScrollbar:!1,disposeOnEvict:!1,emitScroll:!0},x=y.extend({views:{cloudPlayerGenresView:ea,cloudPlayerAlbumsView:K,cloudPlayerArtistsView:M,cloudPlayerTracksView:L,scrollableCPPlaylistsHomeView:{constructor:Y,scrollOptions:F},scrollableCPMyPlaylistsView:{constructor:Z,scrollOptions:F},scrollableCPPrimePlaylistsView:{constructor:aa,scrollOptions:F},cloudPlayerHomeView:G,
ihrSearchLayout:{constructor:X,scrollOptions:F},tuneInHome:{constructor:B,scrollOptions:F}},initialize:function(a){var c=this;this.scrollOptions={hideScrollbar:!1,emitScroll:!0};b.getInstance().restoreDefaults().set("showDevicePicker",!0);this.router=a.router;this.messageView=new ha;this.layout=new A({el:this.el});this.ihrLiveStreamCollection=t.getInstance();this.ihrLiveStreamCollection.fetch();this.refetchCloudPlayerData();this.accountPicker={};f.each([g.SP_CLOUD_PLAYER,g.SP_IHEART,g.SP_TUNE_IN],
function(a){c._initAccountPickerInstance(a)});this.listenTo(this.router,"route:cloudPlayerHome",this.cloudPlayerPlaylists);this.listenTo(this.router,"route:cloudPlayerSearch",this.cloudPlayerSearch);this.listenTo(this.router,"route:cloudPlayerPlaylists",this.cloudPlayerPlaylists);this.listenTo(this.router,"route:cloudPlayerMyPlaylists",this.cloudPlayerMyPlaylists);this.listenTo(this.router,"route:cloudPlayerPrimePlaylists",this.cloudPlayerPrimePlaylists);this.listenTo(this.router,"route:cloudPlayerPlaylist",
this.cloudPlayerPlaylist);this.listenTo(this.router,"route:cloudPlayerAlbums",this.cloudPlayerAlbums);this.listenTo(this.router,"route:cloudPlayerAlbum",this.cloudPlayerAlbum);this.listenTo(this.router,"route:cloudPlayerTracks",this.cloudPlayerTracks);this.listenTo(this.router,"route:cloudPlayerArtists",this.cloudPlayerArtists);this.listenTo(this.router,"route:cloudPlayerArtist",this.cloudPlayerArtist);this.listenTo(this.router,"route:cloudPlayerGenres",this.cloudPlayerGenres);this.listenTo(this.router,
"route:cloudPlayerGenre",this.cloudPlayerGenre);this.listenTo(this.router,"route:cloudPlayerSearchArtists",this.cloudPlayerSearchArtists);this.listenTo(this.router,"route:cloudPlayerSearchAlbums",this.cloudPlayerSearchAlbums);this.listenTo(this.router,"route:cloudPlayerSearchTracks",this.cloudPlayerSearchTracks);this.listenTo(this.router,"route:ihrHome",this.ihrHome);this.listenTo(this.router,"route:ihrSearch",this.ihrSearch);this.listenTo(this.router,"route:ihrMyStations",this.ihrMyStations);this.listenTo(this.router,
"route:ihrLiveStations",this.ihrLiveStations);this.listenTo(this.router,"route:ihrLiveStationsCities",this.ihrLiveStationsCities);this.listenTo(this.router,"route:ihrTalkThemes",this.ihrTalkThemes);this.listenTo(this.router,"route:ihrTalkCategories",this.ihrTalkCategories);this.listenTo(this.router,"route:ihrTalkShows",this.ihrTalkShows);this.listenTo(this.router,"route:ihrTalkShowEpisodes",this.ihrTalkShowEpisodes);this.listenTo(this.router,"route:ihrPerfectFor",this.ihrPerfectFor);this.listenTo(this.router,
"route:ihrPerfectForActivity",this.ihrPerfectForActivity);this.listenTo(this.router,"route:ihrMarket",this.ihrMarket);this.listenTo(this.router,"route:ihrLocalMarket",this.ihrLocalMarket);this.listenTo(this.router,"route:ihrGenre",this.ihrGenre);this.listenTo(this.router,"route:ihrOriginals",this.ihrOriginals);this.listenTo(this.router,"route:tuneInHome",this.tuneInHome);this.listenTo(this.router,"route:tuneInSearch",this.tuneInSearch);this.listenTo(this.router,"route:tuneInBrowse",this.tuneInBrowse);
this.layout.render().host("message",this.messageView).setSelector("#d-page").setTheme("DARK")},ihrHome:function(){var a=this.getView("ihrSearchLayout");this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));p.getInstance().fetch();this.layout.hostContent(a,x.IHR_TITLE);a.getContent().showContent()},ihrSearch:function(a){var c=this.getView("ihrSearchLayout");this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(c,x.IHR_TITLE);a=a?{query:ja.safeB64Decode(a)}:
{showPreviousSearch:!0};c.getContent().search(a)},ihrMyStations:function(){new D({collection:new s({name:"custom-stations"}),userLiveStationCollection:new s({name:"user-live-stations"}),pageDescription:"your favorite stations"});var a=this.getView("ihrSearchLayout");this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(a,x.IHR_MYSTATIONS_TITLE)},ihrLiveStations:function(){var a=c.getInstance(),b=this._getScrollableView(new w({model:a}));this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));
a.fetch();this.layout.hostContent(b,x.IHR_LIVERADIO_TITLE)},ihrTalkThemes:function(){var a=this._getScrollableView(new T);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(a,x.IHR_THEMES_TITLE)},ihrTalkCategories:function(){var a=this._getScrollableView(new U);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(a,x.IHR_SHOWS_TITLE)},ihrTalkShows:function(a){var a=new E([],{categoryId:a}),a=new V({collection:a}),c=this._getScrollableView(a);
this.listenTo(a,"titleChange",this._changeTitle);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(c,x.IHR_SHOWS_TITLE)},ihrTalkShowEpisodes:function(a){var a=new v([],{showId:a}),a=new W({collection:a}),c=this._getScrollableView(a,this.scrollOptions);this.listenTo(a,"titleChange",this._changeTitle);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(c,x.IHR_SHOWS_TITLE)},ihrLiveStationsCities:function(){var a=r.getInstance(),
c=this._getScrollableView(new P({collection:a}));this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));a.fetch();this.layout.hostContent(c,x.IHR_LIVERADIO_TITLE)},ihrPerfectFor:function(){var a=d.getInstance(),c=this._getScrollableView(new N({model:a}));this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(c,x.IHR_PERFECTFOR_TITLE);a.fetch()},ihrPerfectForActivity:function(a){var c=this._getScrollableView(new O({activityIndex:a})),a=d.getInstance().getPerfectForActivities()[a].name;
this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(c,a)},ihrLocalMarket:function(){var a=this._getScrollableView(new R);e.getInstance().fetch();this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(a,x.IHR_LIVERADIO_TITLE)},ihrMarket:function(a,c){var b=this._getScrollableView(new Q({stateId:a,marketId:c}),this.scrollOptions);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));this.layout.hostContent(b,x.IHR_LIVERADIO_TITLE)},
ihrGenre:function(a,b){var d=c.getInstance(),e=this._getScrollableView(new S({model:d,genreId:b,genreCategory:a}),this.scrollOptions);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));d.fetch();this.layout.hostContent(e,x.IHR_LIVERADIO_TITLE)},ihrOriginals:function(){var a=C.getInstance(),c=new D({collection:a,pageDescription:"iHeartRadio Originals"}),b=this._getScrollableView(c,this.scrollOptions);c.setErrorDisplay("Couldn't list your Originals");this.layout.hostAccountPicker(this._getAccountPicker(g.SP_IHEART));
a.fetch();this.layout.hostContent(b,x.IHR_ORIGINALS)},cloudPlayerSearchArtists:function(a){this.layout.hostContent(this._getScrollableView(new M({collection:new q([],{searchCategory:"artists",query:a})}),F),x.CP_ARTISTS_TITLE+' Search: "'+a+'"')},cloudPlayerSearchAlbums:function(a){this.layout.hostContent(this._getScrollableView(new K({collection:new q([],{searchCategory:"albums",query:a})}),F),x.CP_ALBUMS_TITLE+' Search: "'+a+'"')},cloudPlayerSearchTracks:function(a){this.layout.hostContent(this._getScrollableView(new L({collection:new q([],
{searchCategory:"tracks",query:a}),isSubView:!0,canShuffle:!1}),F),x.CP_SONGS_TITLE+' Search: "'+a+'"')},cloudPlayerSearch:function(){this.getView("cloudPlayerHomeView").isInSearchMode()?(this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER)),this.layout.hostContent(this.getView("cloudPlayerHomeView"),x.CP_TITLE),this.getView("cloudPlayerHomeView").showSearch()):ia.trigger("navigate.redirect","music/AMAZON_MUSIC/"+z.TAB_PLAYLISTS,{clearStack:!0})},cloudPlayerPlaylists:function(){this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));
l.getInstance().fetch();i.getInstance().fetch();j.getInstance().fetch();this.layout.hostContent(this.getView("cloudPlayerHomeView"),x.CP_TITLE);this.getView("cloudPlayerHomeView").setTabContent(this.getView("scrollableCPPlaylistsHomeView"),z.TAB_PLAYLISTS)},cloudPlayerMyPlaylists:function(){this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));this._hostCloudPlayerView(!1,"scrollableCPMyPlaylistsView",l.getInstance(),z.TAB_PLAYLISTS)},cloudPlayerPrimePlaylists:function(){this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));
this._hostCloudPlayerView(!1,"scrollableCPPrimePlaylistsView",j.getInstance(),z.TAB_PLAYLISTS)},cloudPlayerPlaylist:function(a){var c=h.getTracksForPlaylist(a),a=this._getScrollableView(new ba({collection:c}),this.scrollOptions);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));c.fetch();f.isNull(c.title)?(this.layout.hostContent(a,x.CP_PLAYLISTS_TITLE),this.listenToOnce(c,"sync",function(){this.layout.setTitle(c.title)})):this.layout.hostContent(a,c.title)},getAnchorLayoutHostingView:function(a){var c=
new I(F);c.hostControl(new J(f.extend({useAlphaNumPicker:!0},this.scrollOptions)));c.hostContent(a);return c},cloudPlayerAlbums:function(){this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));this._hostCloudPlayerView(!0,"cloudPlayerAlbumsView",m.getInstance(),z.TAB_ALBUMS)},cloudPlayerAlbum:function(a,c){var b=this._getAlbumView(a,c),d=this._getScrollableView(b,F);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));b.model&&b.model.get("albumName")?this.layout.hostContent(d,
b.model.get("albumName")):(this.layout.hostContent(d,x.CP_ALBUMS_TITLE),this.listenToOnce(b.model,"sync",function(){this.layout.setTitle(b.model.get("albumName"))}))},cloudPlayerTracks:function(){this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));this._hostCloudPlayerView(!0,"cloudPlayerTracksView",o.getInstance(),z.TAB_SONGS)},cloudPlayerArtists:function(){this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));this._hostCloudPlayerView(!0,"cloudPlayerArtistsView",
k.getInstance(),z.TAB_ARTISTS)},cloudPlayerArtist:function(a){var c=this._getScrollableView(this._getArtistView(a),F);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));this.layout.hostContent(c,a||x.CP_ARTISTS_TITLE)},cloudPlayerGenres:function(){this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));this._hostCloudPlayerView(!0,"cloudPlayerGenresView",n.getInstance(),z.TAB_GENRES)},cloudPlayerGenre:function(a){var c=this._getScrollableView(this._getGenreView(a),
F);this.layout.hostAccountPicker(this._getAccountPicker(g.SP_CLOUD_PLAYER));this.layout.hostContent(c,a||x.CP_GENRES_TITLE)},tuneInHome:function(){var a=this.getView("tuneInHome");this.layout.hostAccountPicker(this._getAccountPicker(g.SP_TUNE_IN));this.layout.hostContent(a,x.TI_TITLE);a.getContent().showContent()},tuneInSearch:function(){var a=this.getView("tuneInHome");this.layout.hostAccountPicker(this._getAccountPicker(g.SP_TUNE_IN));this.layout.hostContent(a,x.TI_TITLE);a.getContent().showSearch()},
tuneInBrowse:function(a,c){var b=decodeURIComponent(c),b=this._getScrollableView(new ga({url:b,contentType:a}));this.layout.hostAccountPicker(this._getAccountPicker(g.SP_TUNE_IN));this.layout.hostContent(b,x.TI_TITLE)},_getAccountPicker:function(a){return this._initAccountPickerInstance(a)},_initAccountPickerInstance:function(a){var c=this.accountPicker[a];f.isUndefined(c)&&(c=new u({serviceName:a,disposeOnEvict:!1}),this.accountPicker[a]=c);return c},prefetchCloudPlayerViews:function(){this.getView("cloudPlayerGenresView");
this.getView("cloudPlayerPlaylistsView");this.getView("cloudPlayerAlbumsView");this.getView("cloudPlayerArtistsView");this.getView("cloudPlayerTracksView")},refetchCloudPlayerData:function(a){h.clearStoredPlaylists();l.getInstance().fetch(a);j.getInstance().fetch(a);k.getInstance().fetch(a);m.getInstance().fetch(a);n.getInstance().fetch(a);o.getInstance().fetch(a)},_getAlbumView:function(c,b){if(!this.cloudPlayerAlbumView||this.cloudPlayerAlbumView.model.get("albumName")!==c||this.cloudPlayerAlbumView.model.get("albumArtistName")!==
b)this.cloudPlayerAlbumView=new ca({model:new a({albumName:c,albumArtistName:b})});this.cloudPlayerAlbumView.model.fetch();return this.cloudPlayerAlbumView},_getGenreView:function(a){!this.cloudPlayerGenreView||this.cloudPlayerGenreView.genre!==a?this.cloudPlayerGenreView=new fa({genre:a,albumCollection:new m(null,{genre:a}),trackCollection:new o(null,{genre:a})}):this.cloudPlayerGenreView.changeTabView("albums");this.cloudPlayerGenreView.albumCollection.fetch();this.cloudPlayerGenreView.trackCollection.fetch();
return this.cloudPlayerGenreView},_getArtistView:function(a){!this.cloudPlayerArtistView||this.cloudPlayerArtistView.artistName!==a?this.cloudPlayerArtistView=new da({artistName:a,albumCollection:new m(null,{artistName:a,hideAlbumArtistName:!0}),trackCollection:new o(null,{artistName:a})}):this.cloudPlayerArtistView.changeTabView("albums");this.cloudPlayerArtistView.albumCollection.fetch();this.cloudPlayerArtistView.trackCollection.fetch();return this.cloudPlayerArtistView},_getScrollableView:function(a,
c){var c=c||{},b=new H(c);b.hostContent(a);return b},_hostCloudPlayerView:function(a,c,b,d){a=a?this.getAnchorLayoutHostingView(this.getView(c)):this.getView(c);b.fetch();this.layout.hostContent(this.getView("cloudPlayerHomeView"),x.CP_TITLE);this.getView("cloudPlayerHomeView").setTabContent(a,d)},_changeTitle:function(a){a&&this.layout.setTitle(a)}},{NAME:"MusicSmallCompositor",CP_TITLE:"Amazon Music",CP_PLAYLISTS_TITLE:"Playlists",CP_ALBUMS_TITLE:"Albums",CP_ARTISTS_TITLE:"Artists",CP_GENRES_TITLE:"Genres",
CP_SONGS_TITLE:"Songs",IHR_TITLE:"iHeartRadio",IHR_LIVERADIO_TITLE:"Live Radio",IHR_THEMES_TITLE:"Talk Themes",IHR_SHOWS_TITLE:"Shows & Personalities",IHR_PERFECTFOR_TITLE:"Perfect For",IHR_MYSTATIONS_TITLE:"My Stations",IHR_ORIGINALS:"Originals",TI_TITLE:"TuneIn"});return x});
define("views/nowplaying/thumbs-view","jquery,backbone,models/player-model,views/base-view,collections/media-collection,music-player".split(","),function(f,g,b,a,c,d){var e=function(a){return f("
You have now completed this voice training session. Come back as often as you like to continue to improve recognition.\n Each session will be different from the last.
This session will occur on ';(m=c.currentDevice)?
e=m.call(a,{hash:{},data:b}):(m=a&&a.currentDevice,e=typeof m==="function"?m.call(a,{hash:{},data:b}):m);d+=f(e)+".\n To use a different "+f((m=c.constant||a&&a.constant,o={hash:{},data:b},m?m.call(a,"deviceName",o):g.call(a,"constant","deviceName",o)))+", select the "+f((m=c.constant||a&&a.constant,o={hash:{},data:b},m?m.call(a,"deviceName",o):g.call(a,"constant","deviceName",o)))+" you want to use from the drop-down above.
\n ';(m=c.clickOrTap)?e=m.call(a,{hash:{},data:b}):(m=a&&a.clickOrTap,e=typeof m==="function"?m.call(a,{hash:{},data:b}):m);d+=g(e)+' "';(m=c.buttonText)?e=m.call(a,{hash:{},data:b}):(m=a&&a.buttonText,e=typeof m==="function"?m.call(a,{hash:{},data:b}):m);d+=g(e)+'" to agree to all the\n terms found here.\n Your Amazon Music will be saved to the cloud to protect your purchases.\n Amazon '+
g((m=c.constant||a&&a.constant,o={hash:{},data:b},m?m.call(a,"deviceName",o):f.call(a,"constant","deviceName",o)))+" processes and retains audio and other information,\n such as your music playlists and your to-do and shopping lists, in the cloud to provide and improve our services.\n Amazon "+g((m=c.constant||a&&a.constant,o={hash:{},data:b},m?m.call(a,"deviceName",o):f.call(a,"constant","deviceName",o)))+' may exchange information with third-party services to fulfill your\n requests. Purchases will be made using your 1-Click payment method.\n Learn more.\n
See all ';(d=c.totalResultCount)?d=d.call(a,{hash:{},data:b}):
(d=a&&a.totalResultCount,d=typeof d==="function"?d.call(a,{hash:{},data:b}):d);e+=i(d)+" songs
It\'s lonely here. Import your music to play it on Amazon '+
i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+'. All your Amazon purchases and the first 250 imported songs are stored for free.
See all ';(e=c.totalResultCount)?e=e.call(a,{hash:{},data:b}):(e=a&&a.totalResultCount,e=typeof e===g?e.call(a,{hash:{},data:b}):e);d+=i(e)+" playlists
Find a Station Perfect for this ';(d=c.weekdayName)?d=d.call(a,{hash:{},data:e}):(d=a&&a.weekdayName,d=typeof d==="function"?d.call(a,{hash:{},data:e}):d);b+=i(d)+" ";(d=c.dayPart)?d=d.call(a,{hash:{},data:e}):(d=a&&a.dayPart,d=typeof d==="function"?d.call(a,{hash:{},data:e}):d);b+=i(d)+'...
With an iHeartRadio account, simply pick a song or artist to create your own commercial-free, uninterrupted custom station featuring music from that artist or similar ones.
Please wait while the wake word is updated. You will not be able to use your Amazon "+i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+" or "+i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"appName",
g):d.call(a,"constant","appName",g)))+' during this time.
'+
i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+' is great for streaming music and media:
See your requests immediately on your ';
(c=c.autocastClientType)?a=c.call(a,{hash:{},data:e}):(c=a&&a.autocastClientType,a=typeof c==="function"?c.call(a,{hash:{},data:e}):c);b+=d(a)+'. Your screen will wake automatically and show you more details when you make a request to Echo.
The '+
i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+" remote is provided for improved performance in a noisy room or from far away.
\n
You may also use the remote to adjust volume, pause music and skip songs.
'+
i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+" knows the answer to all sorts of questions about famous people, places, dates, events, and more.
Say the following phrase aloud to '+
i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+':
\n
Alexa, what\'s the weather?
\n\n
\n
Always say "Alexa" to wake '+i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+" up.
\n
You can speak directly to "+i((f=c.constant||a&&a.constant,g={hash:{},data:e},
f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+". You don't need the remote.
You are ready to start using Amazon '+i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+'.\n You can always visit Things to Try in the menu to repeat this guide or to learn more about things you can say.
\n \n\n
Train '+i((f=c.constant||a&&
a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+' to better understand your voice by completing a short voice training session.\n Begin voice training session
Put batteries in your '+i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+' remote
\n
\n \n
\n
\n
\n
Insert the included AAA batteries into the remote.
\n
Press the Forward button on the remote.
\n
It will connect with '+
i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+' automatically.
Before you can proceed, your ';(f=c.formFactorName)?f=f.call(a,
{hash:{},data:e}):(f=a&&a.formFactorName,f=typeof f==="function"?f.call(a,{hash:{},data:e}):f);b+=d(f)+' needs to reconnect to your Wi-Fi network.
\n \n
\n
Go to your Wi-Fi settings on this ';(f=c.formFactorName)?f=f.call(a,{hash:{},data:e}):(f=a&&a.formFactorName,f=typeof f==="function"?f.call(a,{hash:{},data:e}):f);b+=d(f)+" and select your Wi-Fi network (not the Amazon-XXX network). After you have selected the network, ";if((f=c["if"].call(a,
a&&a.isMobile,{hash:{},inverse:this.program(3,function(){return"continue"},e),fn:this.program(1,function(){return"return to this screen"},e),data:e}))||f===0)b+=f;b+='.
\n ';if((d=c["if"].call(a,a&&a.isAndroid,{hash:{},inverse:this.program(3,function(a,b){var e="",d,f,g;e+="\n Connect your ";(f=c.formFactorName)?d=f.call(a,{hash:{},data:b}):(f=a&&a.formFactorName,d=typeof f==="function"?f.call(a,{hash:{},data:b}):f);e+=j(d)+" to "+j((f=c.constant||a&&a.constant,g={hash:{},
data:b},f?f.call(a,"deviceName",g):i.call(a,"constant","deviceName",g)))+"\n ";return e},e),fn:this.program(1,function(a,b){var e="",d,f;e+="\n Manually connect to "+j((d=c.constant||a&&a.constant,f={hash:{},data:b},d?d.call(a,"deviceName",f):i.call(a,"constant","deviceName",f)))+"\n ";return e},e),data:e}))||d===0)b+=d;b+='\n
\n
\n \n
\n
\n
\n \n Go to your Wi-Fi settings on this ';(f=c.formFactorName)?d=f.call(a,{hash:{},data:e}):(f=a&&a.formFactorName,d=typeof f==="function"?f.call(a,{hash:{},data:e}):f);b+=j(d)+' and select the "Amazon';if((d=c["if"].call(a,a&&a.last3,{hash:{},inverse:this.program(7,function(){return"-XXX"},e),fn:this.program(5,
function(a,b){var e="",d;e+="-";(d=c.last3)?d=d.call(a,{hash:{},data:b}):(d=a&&a.last3,d=typeof d==="function"?d.call(a,{hash:{},data:b}):d);e+=j(d);return e},e),data:e}))||d===0)b+=d;b+='" network.\n It may take up to a minute to display. Wait until '+j((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):i.call(a,"constant","deviceName",g)))+" says you are connected, ";if((d=c["if"].call(a,a&&a.isMobile,{hash:{},inverse:this.program(11,function(){return"then continue"},
e),fn:this.program(9,function(){return"then return to this screen"},e),data:e}))||d===0)b+=d;b+='.\n \n
Make sure your '+i((f=c.constant||a&&a.constant,
g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+' is plugged into a power outlet. Wait for the light ring to turn orange (takes one minute), then continue.
Uncheck ';(f=c.networkCheckLabel)?d=f.call(a,{hash:{},data:e}):(f=a&&a.networkCheckLabel,d=typeof f==="function"?f.call(a,{hash:{},data:e}):f);b+=i(d)+". Return to the Amazon "+i((f=c.constant||a&&a.constant,
g={hash:{},data:e},f?f.call(a,"appName",g):j.call(a,"constant","appName",g)))+' when done.
\n History shows your voice interactions with Amazon '+d((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):i.call(a,"constant","deviceName",g)))+". ";(f=c.clickOrTap)?f=f.call(a,{hash:{},data:e}):
(f=a&&a.clickOrTap,f=typeof f==="function"?f.call(a,{hash:{},data:e}):f);b+=d(f)+' a line to see details, hear recordings, provide feedback, or delete recordings. Learn more.\n
\n Wake up sound\n Play a confirmation sound when you wake your '+q((k=c.constant||a&&a.constant,n={hash:{},data:e},k?k.call(a,"deviceName",n):d.call(a,"constant","deviceName",n)))+".\n
\n End of request sound\n Play a confirmation sound after you finish speaking to your '+q((k=c.constant||a&&a.constant,n={hash:{},data:e},k?k.call(a,"deviceName",n):d.call(a,"constant","deviceName",
n)))+".\n
\n Enable custom stations\n Custom radio may contain explicit content and may be inappropriate for listeners under the age of 13. By restricting explicit content, access to custom radio will be disabled.\n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n
\n Broadcast to Facebook\n Share your iHeartRadio activity on Facebook.\n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n
\n Manage iHeartRadio settings\n View terms and conditions and manage settings.\n
\n '+
r((o=c.constant||a&&a.constant,q={hash:{},data:e},o?o.call(a,"deviceName",q):s.call(a,"constant","deviceName",q)))+' device location\n This ZIP code will be used as your location for weather, Flash Briefing, and alarm.\n
\n Voicecast\n Send more details about news, weather, and more upon request to this ';
(d=c.autocastFormFactor)?d=d.call(a,{hash:{},data:b}):(d=a&&a.autocastFormFactor,d=typeof d===t?d.call(a,{hash:{},data:b}):d);e+=r(d)+', by saying "Send this to my ';(d=c.autocastFormFactor)?d=d.call(a,{hash:{},data:b}):(d=a&&a.autocastFormFactor,d=typeof d===t?d.call(a,{hash:{},data:b}):d);e+=r(d)+'"\n
\n
\n
\n \n \n
\n
\n
\n\n
\n
\n Automatic Voicecast\n See your requests immediately on this ';
(d=c.autocastFormFactor)?d=d.call(a,{hash:{},data:b}):(d=a&&a.autocastFormFactor,d=typeof d===t?d.call(a,{hash:{},data:b}):d);e+=r(d)+'. Your screen will wake up automatically and show you more details as you speak to your Echo.\n
\n '+
r((o=c.constant||a&&a.constant,q={hash:{},data:e},o?o.call(a,"deviceNameTitle",q):s.call(a,"constant","deviceNameTitle",q)))+' is registered to:\n ';if((m=c["if"].call(a,a&&a.customerName,{hash:{},inverse:p.program(27,function(){return"a member of this household"},e),fn:p.program(25,function(a,b){var d;(d=c.customerName)?d=d.call(a,{hash:{},data:b}):(d=a&&a.customerName,d=typeof d===t?d.call(a,{hash:{},data:b}):d);return r(d)},e),data:e}))||m===0)b+=m;b+='\n
It will take a few minutes to update the system after you change your wake word. You will not be able to use your Amazon '+
j((g=c.constant||a&&a.constant,i={hash:{},data:e},g?g.call(a,"deviceName",i):d.call(a,"constant","deviceName",i)))+" or the "+j((g=c.constant||a&&a.constant,i={hash:{},data:e},g?g.call(a,"appName",i):d.call(a,"constant","appName",i)))+' during this time.
\n
\n
'+j((g=c.constant||a&&a.constant,i={hash:{},data:e},g?g.call(a,"deviceNameTitle",i):d.call(a,"constant","deviceNameTitle",i)))+" wake word: ";(g=c.wakeWord)?g=g.call(a,{hash:{},data:e}):
(g=a&&a.wakeWord,g=typeof g==="function"?g.call(a,{hash:{},data:e}):g);b+=j(g)+'
\n In an Amazon household with '+p((e=(e=a&&a.householdMember,e==null||e===!1?e:e.name),typeof e===q?e.apply(a):e))+"\n ";if((e=c["if"].call(a,(e=a&&a.householdMember,e==null||e===!1?e:e.eulaSigned),{hash:{},inverse:s.program(12,
n,b),fn:s.program(10,k,b),data:b}))||e===0)d+=e;d+='\n
\n ";return d}function k(){return'\n Manage your Amazon household.\n '}function n(a,b){var e="",d,f;e+='\n Will have access to Amazon '+
p((d=c.constant||a&&a.constant,f={hash:{},data:b},d?d.call(a,"deviceName",f):r.call(a,"constant","deviceName",f)))+" after logging into the "+p((d=c.constant||a&&a.constant,f={hash:{},data:b},d?d.call(a,"appName",f):r.call(a,"constant","appName",f)))+".\n ";return e}this.compilerInfo=[4,">= 1.0.0"];var c=this.merge(c,b.helpers),e=e||{},b="",m,o,q="function",p=this.escapeExpression,s=this,r=c.helperMissing;b+='
\n History\n View requests to your '+p((m=c.constant||a&&a.constant,o={hash:{},
data:e},m?m.call(a,"deviceName",o):r.call(a,"constant","deviceName",o)))+'.\n
\n Purchase by voice\n Enable purchasing by voice on your '+
i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+'.\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n Require confirmation code\n Enter a 4-digit code that you\'ll say aloud when confirming purchases. Note that this code will appear in your history.\n
\n
\n
\n \n Save Changes\n
\n
\n
\n
\n\n
\n
\n
\n Manage 1-Click settings\n Update your 1-Click payment methods.\n
Searching for your remote...\n\n\n '}
this.compilerInfo=[4,">= 1.0.0"];var c=this.merge(c,b.helpers),e=e||{},b="",i,j,k=c.helperMissing,n=this.escapeExpression,m=this;b+='
Your new wake word is ";(f=c.wakeWord)?d=f.call(a,{hash:{},data:e}):(f=a&&a.wakeWord,d=typeof f==="function"?f.call(a,{hash:{},data:e}):f);b+=i(d)+". When speaking, you will need to say "";(f=c.wakeWord)?d=f.call(a,{hash:{},data:e}):(f=a&&a.wakeWord,d=typeof f==="function"?f.call(a,{hash:{},data:e}):f);b+=i(d)+"" to get your "+i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):j.call(a,
"constant","deviceName",g)))+"'s attention.
\nVoice request not intended for your '+o((d=c.constant||a&&a.constant,f={hash:{},data:b},d?d.call(a,"deviceName",f):p.call(a,"constant","deviceName",f)))+"—nothing was returned.\n
Amazon '+g((e=c.constant||a&&a.constant,m={hash:{},data:b},e?e.call(a,"deviceName",m):f.call(a,"constant","deviceName",m)))+' is not connected
\n
\n
To play music and media, your '+g((e=c.constant||a&&a.constant,m={hash:{},data:b},e?e.call(a,"deviceName",m):f.call(a,"constant","deviceName",m)))+' must be online. Go to Wi-Fi setup.
Amazon '+g((d=c.constant||a&&a.constant,m={hash:{},data:b},d?d.call(a,"deviceName",m):f.call(a,"constant","deviceName",m)))+' can play any music, radio station, or show you like - just ask. Here are some examples:
\n
\n
"';(d=c.wakeWord)?d=d.call(a,{hash:{},data:b}):(d=a&&a.wakeWord,d=typeof d==="function"?d.call(a,{hash:{},data:b}):d);e+=g(d)+', play some music."
\n
"';
(d=c.wakeWord)?d=d.call(a,{hash:{},data:b}):(d=a&&a.wakeWord,d=typeof d==="function"?d.call(a,{hash:{},data:b}):d);e+=g(d)+', play music by Johnny Cash."
\n
"';(d=c.wakeWord)?d=d.call(a,{hash:{},data:b}):(d=a&&a.wakeWord,d=typeof d==="function"?d.call(a,{hash:{},data:b}):d);e+=g(d)+', play music by Bruno Mars."
\n
"';(d=c.wakeWord)?d=d.call(a,{hash:{},data:b}):(d=a&&a.wakeWord,d=typeof d==="function"?d.call(a,{hash:{},data:b}):d);e+=g(d)+', play Fox Sports on iHeartRadio."
Control playback and select music using the Bluetooth device connected to your '+
i((f=c.constant||a&&a.constant,g={hash:{},data:e},f?f.call(a,"deviceName",g):d.call(a,"constant","deviceName",g)))+".