function AmazonNavigationNodesModel(){function o(){E(),t="",n=0,r=12e4}function u(e){var i=T(e),s=i===t&&Date.now()-(n+r)<=0;return s}function a(r,i){r!=undefined&&i&&(t=T(r),e=i,n=Date.now(),E())}function f(){E(),t="",n=0,e={}}function l(t,n){t=w(t);var r=[],i=c(t),s=i.length,o=b(t);if(!n&&i.length>0){var u=e.navigationNodeDescriptions[t].displayTag||[];n=!u||u.indexOf("INLINE")==-1?!0:!1}for(var a=0;a<s;++a){var f=h(i[a],o,n);f&&f.getName()!=undefined&&r.push(f)}return r}function c(t){var n=[];if(e.navigationNodeDescriptions[t]!=undefined&&e.navigationNodeDescriptions[t].items!=undefined&&e.navigationNodeDescriptions[t].items.constructor==Array){var r=e.navigationNodeDescriptions[t].items,i=r.length;for(var s=0;s<i;++s)n.push(S(r[s]))}return n}function h(t,n,r){var i=new AmazonNavigationNode;if(e.itemDescriptions[t]!=undefined){var s=e.itemDescriptions[t];s.itemLabel!=undefined&&i.setName(s.itemLabel),s.subtitle!=undefined&&i.setSubTitle(s.subtitle),s.image&&s.image.uri!==undefined&&i.setImageURL(s.image.uri);if(!s.playable&&!s.navigationNodeSummary)return;s.playable&&d(s.playable,i,n),s.navigationNodeSummary&&p(s.navigationNodeSummary,r,i)}return i}function p(n,r,i){var s=S(n),o=e.navigationNodeSummaries[s];if(o){var u=o.description;if(u!=undefined){i.setIsNavigable(!0);var a=C(t,u);i.setURI(a),i.setId(a.replace(/(.*)#/,""));if(!r&&u[0]=="#"){var f=S(u);f&&i.setChildren(l(f,!0))}i.isPlayable()?i.setType(AmazonWorker.NodeType.PLAYLIST):i.setType(AmazonWorker.NodeType.NAVIGABLE_NODE)}}}function d(n,r,i){n=S(n);var s=e.playables[n];if(s&&s.naturalTrackPointer){r.setIsPlayable(!0);if(s.trackDefinition!=undefined)r.setType(AmazonWorker.NodeType.TRACK),s.naturalTrackPointer.indexWithinChunk!=undefined&&r.setTrackIndex(s.naturalTrackPointer.indexWithinChunk),v(s.trackDefinition,r),r.setPresetName(i.title),r.setPresetURI(i.uri),r.setURI(C(t,s.naturalTrackPointer.chunk));else if(s.self){var o=C(t,s.self);r.setPresetURI(o),r.setPresetName(r.getName()),r.setURI(o),r.setType(AmazonWorker.NodeType.STATION)}else r.setType(AmazonWorker.NodeType.UNPLAYABLE_STATION),r.setURI(C(t,s.naturalTrackPointer.chunk)),r.setPresetURI(""),r.setPresetName(r.getName())}}function v(t,n){t=S(t);var r=e.trackDefinitions[t];r&&(r.image&&r.image.uri&&n.setImageURL(r.image.uri),r.artist&&r.artist.name&&n.setArtistName(r.artist.name),r.album&&r.album.name&&n.setAlbumName(r.album.name),n.setSubTitle(""),r.audio==undefined&&r.autoSkipOnError&&n.setItemAvailability(!1))}function m(n,r){var i="";r=w(r);if(e.navigationNodeDescriptions[r]&&e.navigationNodeDescriptions[r][n]!=undefined){i=e.navigationNodeDescriptions[r][n];if(i==""||i=="#"||i[0]=="#"&&r==S(i))return"";i=C(t,i);var s=x(i);i=N(T(i)),i&&(i+="#"+s)}return i}function g(e){return m("nextPage",e)}function y(e){return m("prevPage",e)}function b(n){var r={title:"",uri:""};if(e.navigationNodeDescriptions[n]!=undefined&&e.navigationNodeDescriptions[n].summary!=undefined){var i=S(e.navigationNodeDescriptions[n].summary);if(e.navigationNodeSummaries[i]&&e.navigationNodeSummaries[i].title&&e.navigationNodeSummaries[i].playable){r.title=e.navigationNodeSummaries[i].title;var s=S(e.navigationNodeSummaries[i].playable);e.playables[s]&&e.playables[s].self&&(r.uri=t+e.playables[s].self)}}return r}function w(t){if(t==undefined||t=="")e.result!=undefined?t=e.result.toString():t="top";return S(t)}function E(){e||(e={}),e.navigationNodeDescriptions==undefined&&(e.navigationNodeDescriptions={}),e.navigationNodeSummaries==undefined&&(e.navigationNodeSummaries={}),e.itemDescriptions==undefined&&(e.itemDescriptions={}),e.playables==undefined&&(e.playables={}),e.trackDefinitions==undefined&&(e.trackDefinitions={})}function S(e){return e==undefined&&(e=""),e.toString().replace(/^#/,"")}function x(e){return e!=undefined?e.toString().replace(/^.*?\#/,""):""}function T(e){return e!=undefined?e.toString().replace(/\#.*/,""):""}function N(e){if(e==undefined||e=="")return"";var t=RegExp(/\/([^\/]+)\/\.\.\//gi),n=e;while(t.exec(n))n=n.replace(t,"/");var r=n.length-1;return r>=0&&n[r]!="/"&&(n+="/"),n}function C(e,t){var n=e||"";return t?t.toString().match(/^http[s]?:\/\//)?t:(n=n.toString().replace(/\#.*/,""),t[0]!="#"&&(n=n.toString().replace(/\?.*/,"")),n+=t,n):n}function k(){s=[]}function L(e){e?s=e:s=[]}function A(){return s}this.setNavigationNodesResponse=a,this.getNavigationNodes=l,this.hasFreshNavigationData=u,this.getNextPageURI=g,this.getPrevPageURI=y,this.clearCachedNavigationResponse=f,this.getCachedNavigationNodes=A,this.cacheNavigationNodes=L,this.clearCachedNavigationNodes=k;var e,t,n,r,i,s;o(this)};