// (c) 2010-2011 Jeremy Ashkenas, DocumentCloud Inc.
// (c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Backbone may be freely distributed under the MIT license.
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
// Distributed under MIT license
/*!
* Includes BabySitter
* https://github.com/marionettejs/backbone.babysitter/
*
* Includes Wreqr
* https://github.com/marionettejs/backbone.wreqr/
*/
/** @license
*
* SoundManager 2: JavaScript Sound for the Web
* ----------------------------------------------
* https://schillmania.com/projects/soundmanager2/
*
* Copyright (c) 2007, Scott Schiller. All rights reserved.
* Code provided under the BSD License:
* https://schillmania.com/projects/soundmanager2/license.txt
*
* V2.97a.20131201
*/
/**
* @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: https://github.com/requirejs/text for details
*/
/*! Copyright (c) 2013 Brandon Aaron (https://brandon.aaron.sh)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 3.1.9
*
* Requires: jQuery 1.2.2+
*/
/*!
* jScrollPane - v2.0.19 - 2013-11-16
* https://jscrollpane.kelvinluck.com/
*
* Copyright (c) 2013 Kelvin Luck
* Dual licensed under the MIT or GPL licenses.
*/
function replaceURLWithHTMLLinks(e){var t=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;return e.replace(t,"$1")}function pad(e,t){for(var n=e+"";n.lengthl;l++)if(e=o[l],s=this._events[e]){if(this._events[e]=a=[],t||i)for(c=0,d=s.length;d>c;c++)r=s[c],(t&&t!==r.callback&&t!==r.callback._callback||i&&i!==r.context)&&a.push(r);a.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=s.call(arguments,1);if(!u(this,"trigger",e,t))return this;var n=this._events[e],i=this._events.all;return n&&p(n,t),i&&p(i,arguments),this},stopListening:function(e,t,i){var a=this._listeningTo;if(!a)return this;var r=!t&&!i;i||"object"!=typeof t||(i=this),e&&((a={})[e._listenId]=e);for(var s in a)e=a[s],e.off(t,i,this),(r||n.isEmpty(e._events))&&delete this._listeningTo[s];return this}},l=/\s+/,u=function(e,t,n,i){if(!n)return!0;if("object"==typeof n){for(var a in n)e[t].apply(e,[a,n[a]].concat(i));return!1}if(l.test(n)){for(var r=n.split(l),s=0,o=r.length;o>s;s++)e[t].apply(e,[r[s]].concat(i));return!1}return!0},p=function(e,t){var n,i=-1,a=e.length,r=t[0],s=t[1],o=t[2];switch(t.length){case 0:for(;++id;d++)this.trigger("change:"+o[d],this,c[o[d]],i)}if(u)return this;if(!l)for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,n.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var i in this.attributes)t[i]=void 0;return this.set(t,n.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!n.isEmpty(this.changed):n.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?n.clone(this.changed):!1;var t,i=!1,a=this._changing?this._previousAttributes:this.attributes;for(var r in e)n.isEqual(a[r],t=e[r])||((i||(i={}))[r]=t);return i},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(e){e=e?n.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,i=e.success;return e.success=function(n){return t.set(t.parse(n,e),e)?(i&&i(t,n,e),void t.trigger("sync",t,n,e)):!1},H(this,e),this.sync("read",this,e)},save:function(e,t,i){var a,r,s,o=this.attributes;if(null==e||"object"==typeof e?(a=e,i=t):(a={})[e]=t,i=n.extend({validate:!0},i),a&&!i.wait){if(!this.set(a,i))return!1}else if(!this._validate(a,i))return!1;a&&i.wait&&(this.attributes=n.extend({},o,a)),void 0===i.parse&&(i.parse=!0);var l=this,u=i.success;return i.success=function(e){l.attributes=o;var t=l.parse(e,i);return i.wait&&(t=n.extend(a||{},t)),n.isObject(t)&&!l.set(t,i)?!1:(u&&u(l,e,i),void l.trigger("sync",l,e,i))},H(this,i),r=this.isNew()?"create":i.patch?"patch":"update","patch"===r&&(i.attrs=a),s=this.sync(r,this,i),a&&i.wait&&(this.attributes=o),s},destroy:function(e){e=e?n.clone(e):{};var t=this,i=e.success,a=function(){t.trigger("destroy",t,t.collection,e)};if(e.success=function(n){(e.wait||t.isNew())&&a(),i&&i(t,n,e),t.isNew()||t.trigger("sync",t,n,e)},this.isNew())return e.success(),!1;H(this,e);var r=this.sync("delete",this,e);return e.wait||a(),r},url:function(){var e=n.result(this,"urlRoot")||n.result(this.collection,"url")||$();return this.isNew()?e:e+("/"===e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(e){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(e){return this._validate({},n.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=n.extend({},this.attributes,e);var i=this.validationError=this.validate(e,t)||null;return i?(this.trigger("invalid",this,i,n.extend(t,{validationError:i})),!1):!0}});var h=["keys","values","pairs","invert","pick","omit"];n.each(h,function(e){d.prototype[e]=function(){var t=s.call(arguments);return t.unshift(this.attributes),n[e].apply(n,t)}});var f=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,n.extend({silent:!0},t))},m={add:!0,remove:!0,merge:!0},g={add:!0,remove:!1};n.extend(f.prototype,o,{model:d,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,n.extend({merge:!1},t,g))},remove:function(e,t){var i=!n.isArray(e);e=i?[e]:n.clone(e),t||(t={});var a,r,s,o;for(a=0,r=e.length;r>a;a++)o=e[a]=this.get(e[a]),o&&(delete this._byId[o.id],delete this._byId[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,t.silent||(t.index=s,o.trigger("remove",o,this,t)),this._removeReference(o));return i?e[0]:e},set:function(e,t){t=n.defaults({},t,m),t.parse&&(e=this.parse(e,t));var i=!n.isArray(e);e=i?e?[e]:[]:n.clone(e);var a,r,s,o,l,u,p,c=t.at,h=this.model,f=this.comparator&&null==c&&t.sort!==!1,g=n.isString(this.comparator)?this.comparator:null,v=[],y=[],_={},w=t.add,b=t.merge,k=t.remove,C=!f&&w&&k?[]:!1;for(a=0,r=e.length;r>a;a++){if(l=e[a],s=l instanceof d?o=l:l[h.prototype.idAttribute],u=this.get(s))k&&(_[u.cid]=!0),b&&(l=l===o?o.attributes:l,t.parse&&(l=u.parse(l,t)),u.set(l,t),f&&!p&&u.hasChanged(g)&&(p=!0)),e[a]=u;else if(w){if(o=e[a]=this._prepareModel(l,t),!o)continue;v.push(o),o.on("all",this._onModelEvent,this),this._byId[o.cid]=o,null!=o.id&&(this._byId[o.id]=o)}C&&C.push(u||o)}if(k){for(a=0,r=this.length;r>a;++a)_[(o=this.models[a]).cid]||y.push(o);y.length&&this.remove(y,t)}if(v.length||C&&C.length)if(f&&(p=!0),this.length+=v.length,null!=c)for(a=0,r=v.length;r>a;a++)this.models.splice(c+a,0,v[a]);else{C&&(this.models.length=0);var P=C||v;for(a=0,r=P.length;r>a;a++)this.models.push(P[a])}if(p&&this.sort({silent:!0}),!t.silent){for(a=0,r=v.length;r>a;a++)(o=v[a]).trigger("add",o,this,t);(p||C&&C.length)&&this.trigger("sort",this,t)}return i?e[0]:e},reset:function(e,t){t||(t={});for(var i=0,a=this.models.length;a>i;i++)this._removeReference(this.models[i]);return t.previousModels=this.models,this._reset(),e=this.add(e,n.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,n.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return this.add(e,n.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(){return s.apply(this.models,arguments)},get:function(e){return null==e?void 0:this._byId[e.id]||this._byId[e.cid]||this._byId[e]},at:function(e){return this.models[e]},where:function(e,t){return n.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),n.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(n.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return n.invoke(this.models,"get",e)},fetch:function(e){e=e?n.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=e.success,i=this;return e.success=function(n){var a=e.reset?"reset":"set";i[a](n,e),t&&t(i,n,e),i.trigger("sync",i,n,e)},H(this,e),this.sync("read",this,e)},create:function(e,t){if(t=t?n.clone(t):{},!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var i=this,a=t.success;return t.success=function(e,t,n){n.wait&&i.add(e,n),a&&a(e,t,n)},e.save(null,t),e},parse:function(e){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof d)return e.collection||(e.collection=this),e;t=t?n.clone(t):{},t.collection=this;var i=new this.model(e,t);return i.validationError?(this.trigger("invalid",this,i.validationError,t),!1):i},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,i){("add"!==e&&"remove"!==e||n===this)&&("destroy"===e&&this.remove(t,i),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],null!=t.id&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments))}});var v=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain"];n.each(v,function(e){f.prototype[e]=function(){var t=s.call(arguments);return t.unshift(this.models),n[e].apply(n,t)}});var y=["groupBy","countBy","sortBy"];n.each(y,function(e){f.prototype[e]=function(t,i){var a=n.isFunction(t)?t:function(e){return e.get(t)};return n[e](this.models,a,i)}});var _=t.View=function(e){this.cid=n.uniqueId("view"),e||(e={}),n.extend(this,n.pick(e,b)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},w=/^(\S+)\s*(.*)$/,b=["model","collection","el","id","attributes","className","tagName","events"];n.extend(_.prototype,o,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,n){return this.$el&&this.undelegateEvents(),this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0],n!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=n.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var i=e[t];if(n.isFunction(i)||(i=this[e[t]]),i){var a=t.match(w),r=a[1],s=a[2];i=n.bind(i,this),r+=".delegateEvents"+this.cid,""===s?this.$el.on(r,i):this.$el.on(r,s,i)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(this.el)this.setElement(n.result(this,"el"),!1);else{var e=n.extend({},n.result(this,"attributes"));this.id&&(e.id=n.result(this,"id")),this.className&&(e["class"]=n.result(this,"className"));var i=t.$("<"+n.result(this,"tagName")+">").attr(e);this.setElement(i,!1)}}}),t.sync=function(e,i,a){var r=C[e];n.defaults(a||(a={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var s={type:r,dataType:"json"};if(a.url||(s.url=n.result(i,"url")||$()),null!=a.data||!i||"create"!==e&&"update"!==e&&"patch"!==e||(s.contentType="application/json",s.data=JSON.stringify(a.attrs||i.toJSON(a))),a.emulateJSON&&(s.contentType="application/x-www-form-urlencoded",s.data=s.data?{model:s.data}:{}),a.emulateHTTP&&("PUT"===r||"DELETE"===r||"PATCH"===r)){s.type="POST",a.emulateJSON&&(s.data._method=r);var o=a.beforeSend;a.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",r),o?o.apply(this,arguments):void 0}}"GET"===s.type||a.emulateJSON||(s.processData=!1),"PATCH"===s.type&&k&&(s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var l=a.xhr=t.ajax(n.extend(s,a));return i.trigger("request",i,l,a),l};var k=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),C={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var P=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},M=/\((.*?)\)/g,T=/(\(\?)?:\w+/g,x=/\*\w+/g,O=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(P.prototype,o,{initialize:function(){},route:function(e,i,a){n.isRegExp(e)||(e=this._routeToRegExp(e)),n.isFunction(i)&&(a=i,i=""),a||(a=this[i]);var r=this;return t.history.route(e,function(n){var s=r._extractParameters(e,n);a&&a.apply(r,s),r.trigger.apply(r,["route:"+i].concat(s)),r.trigger("route",i,s),t.history.trigger("route",r,i,s)}),this},navigate:function(e,n){return t.history.navigate(e,n),this},_bindRoutes:function(){if(this.routes){this.routes=n.result(this,"routes");for(var e,t=n.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(O,"\\$&").replace(M,"(?:$1)?").replace(T,function(e,t){return t?e:"([^/]+)"}).replace(x,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var i=e.exec(t).slice(1);return n.map(i,function(e){return e?decodeURIComponent(e):null})}});var A=t.History=function(){this.handlers=[],n.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},j=/^[#\/]|\s+$/g,I=/^\/+|\/+$/g,S=/msie [\w.]+/,E=/\/$/,R=/[?#].*$/;A.started=!1,n.extend(A.prototype,o,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(null==e)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(E,"");e.indexOf(n)||(e=e.slice(n.length))}else e=this.getHash();return e.replace(j,"")},start:function(e){if(A.started)throw new Error("Backbone.history has already been started");A.started=!0,this.options=n.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var i=this.getFragment(),a=document.documentMode,r=S.exec(navigator.userAgent.toLowerCase())&&(!a||7>=a);this.root=("/"+this.root+"/").replace(I,"/"),r&&this._wantsHashChange&&(this.iframe=t.$('').hide().appendTo("body")[0].contentWindow,this.navigate(i)),this._hasPushState?t.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!r?t.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=i;var s=this.location,o=s.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!o)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._hasPushState&&o&&s.hash&&(this.fragment=this.getHash().replace(j,""),this.history.replaceState({},document.title,this.root+this.fragment+s.search))}return this.options.silent?void 0:this.loadUrl()},stop:function(){t.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),A.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(){var e=this.getFragment();return e===this.fragment&&this.iframe&&(e=this.getFragment(this.getHash(this.iframe))),e===this.fragment?!1:(this.iframe&&this.navigate(e),void this.loadUrl())},loadUrl:function(e){return e=this.fragment=this.getFragment(e),n.any(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0})},navigate:function(e,t){if(!A.started)return!1;t&&t!==!0||(t={trigger:!!t});var n=this.root+(e=this.getFragment(e||""));if(e=e.replace(R,""),this.fragment!==e){if(this.fragment=e,""===e&&"/"!==n&&(n=n.slice(0,-1)),this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){var i=e.href.replace(/(javascript:|#).*$/,"");e.replace(i+"#"+t)}else e.hash="#"+t}}),t.history=new A;var L=function(e,t){var i,a=this;i=e&&n.has(e,"constructor")?e.constructor:function(){return a.apply(this,arguments)},n.extend(i,a,t);var r=function(){this.constructor=i};return r.prototype=a.prototype,i.prototype=new r,e&&n.extend(i.prototype,e),i.__super__=a.prototype,i};d.extend=f.extend=P.extend=_.extend=A.extend=L;var $=function(){throw new Error('A "url" property or function must be specified')},H=function(e,t){var n=t.error;t.error=function(i){n&&n(e,i,t),e.trigger("error",e,i,t)}};return t}),function(e,t){if("object"==typeof exports){var n=require("underscore"),i=require("backbone");module.exports=t(n,i)}else"function"==typeof define&&define.amd&&define("backbone.wreqr",["underscore","backbone"],t)}(this,function(e,t){return t.Wreqr=function(e,t,n){var i={};return i.Handlers=function(e,t){var n=function(e){this.options=e,this._wreqrHandlers={},t.isFunction(this.initialize)&&this.initialize(e)};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events,{setHandlers:function(e){t.each(e,function(e,n){var i=null;t.isObject(e)&&!t.isFunction(e)&&(i=e.context,e=e.callback),this.setHandler(n,e,i)},this)},setHandler:function(e,t,n){var i={callback:t,context:n};this._wreqrHandlers[e]=i,this.trigger("handler:add",e,t,n)},hasHandler:function(e){return!!this._wreqrHandlers[e]},getHandler:function(e){var t=this._wreqrHandlers[e];if(!t)throw new Error("Handler not found for '"+e+"'");return function(){var e=Array.prototype.slice.apply(arguments);return t.callback.apply(t.context,e)}},removeHandler:function(e){delete this._wreqrHandlers[e]},removeAllHandlers:function(){this._wreqrHandlers={}}}),n}(e,n),i.CommandStorage=function(){var t=function(e){this.options=e,this._commands={},n.isFunction(this.initialize)&&this.initialize(e)};return n.extend(t.prototype,e.Events,{getCommands:function(e){var t=this._commands[e];return t||(t={command:e,instances:[]},this._commands[e]=t),t},addCommand:function(e,t){var n=this.getCommands(e);n.instances.push(t)},clearCommands:function(e){var t=this.getCommands(e);t.instances=[]}}),t}(),i.Commands=function(e){return e.Handlers.extend({storageType:e.CommandStorage,constructor:function(t){this.options=t||{},this._initializeStorage(this.options),this.on("handler:add",this._executeCommands,this);var n=Array.prototype.slice.call(arguments);e.Handlers.prototype.constructor.apply(this,n)},execute:function(e,t){e=arguments[0],t=Array.prototype.slice.call(arguments,1),this.hasHandler(e)?this.getHandler(e).apply(this,t):this.storage.addCommand(e,t)},_executeCommands:function(e,t,i){var a=this.storage.getCommands(e);n.each(a.instances,function(e){t.apply(i,e)}),this.storage.clearCommands(e)},_initializeStorage:function(e){var t,i=e.storageType||this.storageType;t=n.isFunction(i)?new i:i,this.storage=t}})}(i),i.RequestResponse=function(e){return e.Handlers.extend({request:function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return this.getHandler(e).apply(this,t)}})}(i),i.EventAggregator=function(e,t){var n=function(){};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events),n}(e,n),i}(t,t.Marionette,e),t.Wreqr}),function(e,t){if("object"==typeof exports){var n=require("underscore"),i=require("backbone");module.exports=t(n,i)}else"function"==typeof define&&define.amd&&define("backbone.babysitter",["underscore","backbone"],t)}(this,function(e,t){"option strict";return t.ChildViewContainer=function(e,t){var n=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(e,this.add,this)};t.extend(n.prototype,{add:function(e,t){var n=e.cid;return this._views[n]=e,e.model&&(this._indexByModel[e.model.cid]=n),t&&(this._indexByCustom[t]=n),this._updateLength(),this},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){var t=this._indexByModel[e];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){var n=e.cid;return e.model&&delete this._indexByModel[e.model.cid],t.any(this._indexByCustom,function(e,t){return e===n?(delete this._indexByCustom[t],!0):void 0},this),delete this._views[n],this._updateLength(),this},call:function(e){this.apply(e,t.tail(arguments))},apply:function(e,n){t.each(this._views,function(i){t.isFunction(i[e])&&i[e].apply(i,n||[])})},_updateLength:function(){this.length=t.size(this._views)}});var i=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return t.each(i,function(e){n.prototype[e]=function(){var n=t.values(this._views),i=[n].concat(t.toArray(arguments));return t[e].apply(t,i)}}),n}(t,e),t.ChildViewContainer}),function(e,t){if("object"==typeof exports){var n=require("underscore"),i=require("backbone"),a=require("backbone.wreqr"),r=require("backbone.babysitter");module.exports=t(n,i,a,r)}else"function"==typeof define&&define.amd&&define("marionette",["underscore","backbone","backbone.wreqr","backbone.babysitter"],t)}(this,function(e,t){!function(e,t,n){function i(e){return s.call(e)}function a(e,t){var n=new Error(e);throw n.name=t||"Error",n}var r={};t.Marionette=r,r.$=t.$;var s=Array.prototype.slice;return r.extend=t.Model.extend,r.getOption=function(e,t){if(e&&t){var n;return n=e.options&&t in e.options&&void 0!==e.options[t]?e.options[t]:e[t]}},r.normalizeMethods=function(e){var t,i={};return n.each(e,function(e,a){t=e,n.isFunction(t)||(t=this[t]),t&&(i[a]=t)},this),i},r.triggerMethod=function(){function e(e,t,n){return n.toUpperCase()}var t=/(^|:)(\w)/gi,i=function(i){var a="on"+i.replace(t,e),r=this[a];return n.isFunction(this.trigger)&&this.trigger.apply(this,arguments),n.isFunction(r)?r.apply(this,n.tail(arguments)):void 0};return i}(),r.MonitorDOMRefresh=function(e){function t(e){e._isShown=!0,a(e)}function i(e){e._isRendered=!0,a(e)}function a(e){e._isShown&&e._isRendered&&r(e)&&n.isFunction(e.triggerMethod)&&e.triggerMethod("dom:refresh")}function r(t){return e.contains(t.el)}return function(e){e.listenTo(e,"show",function(){t(e)}),e.listenTo(e,"render",function(){i(e)})}}(document.documentElement),function(e){function t(e,t,i,r){var s=r.split(/\s+/);n.each(s,function(n){var r=e[n];r||a("Method '"+n+"' was configured as an event handler, but does not exist."),e.listenTo(t,i,r,e)})}function i(e,t,n,i){e.listenTo(t,n,i,e)}function r(e,t,i,a){var r=a.split(/\s+/);n.each(r,function(n){var a=e[n];e.stopListening(t,i,a,e)})}function s(e,t,n,i){e.stopListening(t,n,i,e)}function o(e,t,i,a,r){t&&i&&(n.isFunction(i)&&(i=i.call(e)),n.each(i,function(i,s){n.isFunction(i)?a(e,t,s,i):r(e,t,s,i)}))}e.bindEntityEvents=function(e,n,a){o(e,n,a,i,t)},e.unbindEntityEvents=function(e,t,n){o(e,t,n,s,r)}}(r),r.Callbacks=function(){this._deferred=r.$.Deferred(),this._callbacks=[]},n.extend(r.Callbacks.prototype,{add:function(e,t){this._callbacks.push({cb:e,ctx:t}),this._deferred.done(function(n,i){t&&(n=t),e.call(n,i)})},run:function(e,t){this._deferred.resolve(t,e)},reset:function(){var e=this._callbacks;this._deferred=r.$.Deferred(),this._callbacks=[],n.each(e,function(e){this.add(e.cb,e.ctx)},this)}}),r.Controller=function(e){this.triggerMethod=r.triggerMethod,this.options=e||{},n.isFunction(this.initialize)&&this.initialize(this.options)},r.Controller.extend=r.extend,n.extend(r.Controller.prototype,t.Events,{close:function(){this.stopListening(),this.triggerMethod("close"),this.unbind()}}),r.Region=function(e){if(this.options=e||{},this.el=r.getOption(this,"el"),!this.el){var t=new Error("An 'el' must be specified for a region.");throw t.name="NoElError",t}if(this.initialize){var n=Array.prototype.slice.apply(arguments);this.initialize.apply(this,n)}},n.extend(r.Region,{buildRegion:function(e,t){var i="string"==typeof e,a="string"==typeof e.selector,r="undefined"==typeof e.regionType,s="function"==typeof e;if(!s&&!i&&!a)throw new Error("Region must be specified as a Region type, a selector string or an object with selector property");var o,l;i&&(o=e),e.selector&&(o=e.selector,delete e.selector),s&&(l=e),!s&&r&&(l=t),e.regionType&&(l=e.regionType,delete e.regionType),(i||s)&&(e={}),e.el=o;var u=new l(e);return e.parentEl&&(u.getEl=function(t){var i=e.parentEl;return n.isFunction(i)&&(i=i()),i.find(t)}),u}}),n.extend(r.Region.prototype,t.Events,{show:function(e){this.ensureEl();var t=e.isClosed||n.isUndefined(e.$el),i=e!==this.currentView;i&&this.close(),e.render(),(i||t)&&this.open(e),this.currentView=e,r.triggerMethod.call(this,"show",e),r.triggerMethod.call(e,"show")},ensureEl:function(){this.$el&&0!==this.$el.length||(this.$el=this.getEl(this.el))},getEl:function(e){return r.$(e)},open:function(e){this.$el.empty().append(e.el)},close:function(){var e=this.currentView;e&&!e.isClosed&&(e.close?e.close():e.remove&&e.remove(),r.triggerMethod.call(this,"close",e),delete this.currentView)},attachView:function(e){this.currentView=e},reset:function(){this.close(),delete this.$el}}),r.Region.extend=r.extend,r.RegionManager=function(e){var t=e.Controller.extend({constructor:function(t){this._regions={},e.Controller.prototype.constructor.call(this,t)},addRegions:function(e,t){var i={};return n.each(e,function(e,a){"string"==typeof e&&(e={selector:e}),e.selector&&(e=n.defaults({},e,t));var r=this.addRegion(a,e);i[a]=r},this),i},addRegion:function(t,i){var a,r=n.isObject(i),s=n.isString(i),o=!!i.selector;return a=s||r&&o?e.Region.buildRegion(i,e.Region):n.isFunction(i)?e.Region.buildRegion(i,e.Region):i,this._store(t,a),this.triggerMethod("region:add",t,a),a},get:function(e){return this._regions[e]},removeRegion:function(e){var t=this._regions[e];this._remove(e,t)},removeRegions:function(){n.each(this._regions,function(e,t){this._remove(t,e)},this)},closeRegions:function(){n.each(this._regions,function(e){e.close()},this)},close:function(){this.removeRegions();var t=Array.prototype.slice.call(arguments);e.Controller.prototype.close.apply(this,t)},_store:function(e,t){this._regions[e]=t,this._setLength()},_remove:function(e,t){t.close(),delete this._regions[e],this._setLength(),this.triggerMethod("region:remove",e,t)},_setLength:function(){this.length=n.size(this._regions)}}),i=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return n.each(i,function(e){t.prototype[e]=function(){var t=n.values(this._regions),i=[t].concat(n.toArray(arguments));return n[e].apply(n,i)}}),t}(r),r.TemplateCache=function(e){this.templateId=e},n.extend(r.TemplateCache,{templateCaches:{},get:function(e){var t=this.templateCaches[e];return t||(t=new r.TemplateCache(e),this.templateCaches[e]=t),t.load()},clear:function(){var e,t=i(arguments),n=t.length;if(n>0)for(e=0;n>e;e++)delete this.templateCaches[t[e]];else this.templateCaches={}}}),n.extend(r.TemplateCache.prototype,{load:function(){if(this.compiledTemplate)return this.compiledTemplate;var e=this.loadTemplate(this.templateId);return this.compiledTemplate=this.compileTemplate(e),this.compiledTemplate},loadTemplate:function(e){var t=r.$(e).html();return t&&0!==t.length||a("Could not find template: '"+e+"'","NoTemplateError"),t},compileTemplate:function(e){return n.template(e)}}),r.Renderer={render:function(e,t){if(!e){var n=new Error("Cannot render the template since it's false, null or undefined.");throw n.name="TemplateNotFoundError",n}var i;return(i="function"==typeof e?e:r.TemplateCache.get(e))(t)}},r.View=t.View.extend({constructor:function(e){n.bindAll(this,"render");var i=Array.prototype.slice.apply(arguments);this.options=n.extend({},n.result(this,"options"),n.isFunction(e)?e.call(this):e),this.events=this.normalizeUIKeys(n.result(this,"events")),t.View.prototype.constructor.apply(this,i),r.MonitorDOMRefresh(this),this.listenTo(this,"show",this.onShowCalled,this)},triggerMethod:r.triggerMethod,normalizeMethods:r.normalizeMethods,getTemplate:function(){return r.getOption(this,"template")},mixinTemplateHelpers:function(e){e=e||{};var t=r.getOption(this,"templateHelpers");return n.isFunction(t)&&(t=t.call(this)),n.extend(e,t)},normalizeUIKeys:function(e){return"undefined"!=typeof e?(n.each(n.keys(e),function(t){var n=t.split("@ui.");2===n.length&&(e[n[0]+this.ui[n[1]]]=e[t],delete e[t])},this),e):void 0},configureTriggers:function(){if(this.triggers){var e={},t=this.normalizeUIKeys(n.result(this,"triggers"));return n.each(t,function(t,i){var a=n.isObject(t),r=a?t.event:t;e[i]=function(e){if(e){var n=e.preventDefault,i=e.stopPropagation,s=a?t.preventDefault:n,o=a?t.stopPropagation:i;s&&n&&n.apply(e),o&&i&&i.apply(e)}var l={view:this,model:this.model,collection:this.collection};this.triggerMethod(r,l)}},this),e}},delegateEvents:function(e){this._delegateDOMEvents(e),r.bindEntityEvents(this,this.model,r.getOption(this,"modelEvents")),r.bindEntityEvents(this,this.collection,r.getOption(this,"collectionEvents"))},_delegateDOMEvents:function(e){e=e||this.events,n.isFunction(e)&&(e=e.call(this));var i={},a=this.configureTriggers();n.extend(i,e,a),t.View.prototype.delegateEvents.call(this,i)},undelegateEvents:function(){var e=Array.prototype.slice.call(arguments);t.View.prototype.undelegateEvents.apply(this,e),r.unbindEntityEvents(this,this.model,r.getOption(this,"modelEvents")),r.unbindEntityEvents(this,this.collection,r.getOption(this,"collectionEvents"))
},onShowCalled:function(){},close:function(){if(!this.isClosed){var e=this.triggerMethod("before:close");e!==!1&&(this.isClosed=!0,this.triggerMethod("close"),this.unbindUIElements(),this.remove())}},bindUIElements:function(){if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var e=n.result(this,"_uiBindings");this.ui={},n.each(n.keys(e),function(t){var n=e[t];this.ui[t]=this.$(n)},this)}},unbindUIElements:function(){this.ui&&this._uiBindings&&(n.each(this.ui,function(e,t){delete this.ui[t]},this),this.ui=this._uiBindings,delete this._uiBindings)}}),r.ItemView=r.View.extend({constructor:function(){r.View.prototype.constructor.apply(this,i(arguments))},serializeData:function(){var e={};return this.model?e=this.model.toJSON():this.collection&&(e={items:this.collection.toJSON()}),e},render:function(){this.isClosed=!1,this.triggerMethod("before:render",this),this.triggerMethod("item:before:render",this);var e=this.serializeData();e=this.mixinTemplateHelpers(e);var t=this.getTemplate(),n=r.Renderer.render(t,e);return this.$el.html(n),this.bindUIElements(),this.triggerMethod("render",this),this.triggerMethod("item:rendered",this),this},close:function(){this.isClosed||(this.triggerMethod("item:before:close"),r.View.prototype.close.apply(this,i(arguments)),this.triggerMethod("item:closed"))}}),r.CollectionView=r.View.extend({itemViewEventPrefix:"itemview",constructor:function(){this._initChildViewStorage(),r.View.prototype.constructor.apply(this,i(arguments)),this._initialEvents(),this.initRenderBuffer()},initRenderBuffer:function(){this.elBuffer=document.createDocumentFragment(),this._bufferedChildren=[]},startBuffering:function(){this.initRenderBuffer(),this.isBuffering=!0},endBuffering:function(){this.isBuffering=!1,this.appendBuffer(this,this.elBuffer),this._triggerShowBufferedChildren(),this.initRenderBuffer()},_triggerShowBufferedChildren:function(){this._isShown&&(n.each(this._bufferedChildren,function(e){r.triggerMethod.call(e,"show")}),this._bufferedChildren=[])},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this.addChildView,this),this.listenTo(this.collection,"remove",this.removeItemView,this),this.listenTo(this.collection,"reset",this.render,this))},addChildView:function(e){this.closeEmptyView();var t=this.getItemView(e),n=this.collection.indexOf(e);this.addItemView(e,t,n)},onShowCalled:function(){this.children.each(function(e){r.triggerMethod.call(e,"show")})},triggerBeforeRender:function(){this.triggerMethod("before:render",this),this.triggerMethod("collection:before:render",this)},triggerRendered:function(){this.triggerMethod("render",this),this.triggerMethod("collection:rendered",this)},render:function(){return this.isClosed=!1,this.triggerBeforeRender(),this._renderChildren(),this.triggerRendered(),this},_renderChildren:function(){this.startBuffering(),this.closeEmptyView(),this.closeChildren(),this.isEmpty(this.collection)?this.showEmptyView():this.showCollection(),this.endBuffering()},showCollection:function(){var e;this.collection.each(function(t,n){e=this.getItemView(t),this.addItemView(t,e,n)},this)},showEmptyView:function(){var e=this.getEmptyView();if(e&&!this._showingEmptyView){this._showingEmptyView=!0;var n=new t.Model;this.addItemView(n,e,0)}},closeEmptyView:function(){this._showingEmptyView&&(this.closeChildren(),delete this._showingEmptyView)},getEmptyView:function(){return r.getOption(this,"emptyView")},getItemView:function(){var e=r.getOption(this,"itemView");return e||a("An `itemView` must be specified","NoItemViewError"),e},addItemView:function(e,t,i){var a=r.getOption(this,"itemViewOptions");n.isFunction(a)&&(a=a.call(this,e,i));var s=this.buildItemView(e,t,a);return this.addChildViewEventForwarding(s),this.triggerMethod("before:item:added",s),this.children.add(s),this.renderItemView(s,i),this._isShown&&!this.isBuffering&&r.triggerMethod.call(s,"show"),this.triggerMethod("after:item:added",s),s},addChildViewEventForwarding:function(e){var t=r.getOption(this,"itemViewEventPrefix");this.listenTo(e,"all",function(){var a=i(arguments),s=a[0],o=this.normalizeMethods(this.getItemEvents());a[0]=t+":"+s,a.splice(1,0,e),"undefined"!=typeof o&&n.isFunction(o[s])&&o[s].apply(this,a),r.triggerMethod.apply(this,a)},this)},getItemEvents:function(){return n.isFunction(this.itemEvents)?this.itemEvents.call(this):this.itemEvents},renderItemView:function(e,t){e.render(),this.appendHtml(this,e,t)},buildItemView:function(e,t,i){var a=n.extend({model:e},i);return new t(a)},removeItemView:function(e){var t=this.children.findByModel(e);this.removeChildView(t),this.checkEmpty()},removeChildView:function(e){e&&(this.stopListening(e),e.close?e.close():e.remove&&e.remove(),this.children.remove(e)),this.triggerMethod("item:removed",e)},isEmpty:function(){return!this.collection||0===this.collection.length},checkEmpty:function(){this.isEmpty(this.collection)&&this.showEmptyView()},appendBuffer:function(e,t){e.$el.append(t)},appendHtml:function(e,t){e.isBuffering?(e.elBuffer.appendChild(t.el),e._bufferedChildren.push(t)):e.$el.append(t.el)},_initChildViewStorage:function(){this.children=new t.ChildViewContainer},close:function(){this.isClosed||(this.triggerMethod("collection:before:close"),this.closeChildren(),this.triggerMethod("collection:closed"),r.View.prototype.close.apply(this,i(arguments)))},closeChildren:function(){this.children.each(function(e){this.removeChildView(e)},this),this.checkEmpty()}}),r.CompositeView=r.CollectionView.extend({constructor:function(){r.CollectionView.prototype.constructor.apply(this,i(arguments))},_initialEvents:function(){this.once("render",function(){this.collection&&(this.listenTo(this.collection,"add",this.addChildView,this),this.listenTo(this.collection,"remove",this.removeItemView,this),this.listenTo(this.collection,"reset",this._renderChildren,this))})},getItemView:function(){var e=r.getOption(this,"itemView")||this.constructor;return e||a("An `itemView` must be specified","NoItemViewError"),e},serializeData:function(){var e={};return this.model&&(e=this.model.toJSON()),e},render:function(){this.isRendered=!0,this.isClosed=!1,this.resetItemViewContainer(),this.triggerBeforeRender();var e=this.renderModel();return this.$el.html(e),this.bindUIElements(),this.triggerMethod("composite:model:rendered"),this._renderChildren(),this.triggerMethod("composite:rendered"),this.triggerRendered(),this},_renderChildren:function(){this.isRendered&&(this.triggerMethod("composite:collection:before:render"),r.CollectionView.prototype._renderChildren.call(this),this.triggerMethod("composite:collection:rendered"))},renderModel:function(){var e={};e=this.serializeData(),e=this.mixinTemplateHelpers(e);var t=this.getTemplate();return r.Renderer.render(t,e)},appendBuffer:function(e,t){var n=this.getItemViewContainer(e);n.append(t)},appendHtml:function(e,t){if(e.isBuffering)e.elBuffer.appendChild(t.el),e._bufferedChildren.push(t);else{var n=this.getItemViewContainer(e);n.append(t.el)}},getItemViewContainer:function(e){if("$itemViewContainer"in e)return e.$itemViewContainer;var t,i=r.getOption(e,"itemViewContainer");if(i){var s=n.isFunction(i)?i.call(this):i;t=e.$(s),t.length<=0&&a("The specified `itemViewContainer` was not found: "+e.itemViewContainer,"ItemViewContainerMissingError")}else t=e.$el;return e.$itemViewContainer=t,t},resetItemViewContainer:function(){this.$itemViewContainer&&delete this.$itemViewContainer}}),r.Layout=r.ItemView.extend({regionType:r.Region,constructor:function(e){e=e||{},this._firstRender=!0,this._initializeRegions(e),r.ItemView.prototype.constructor.call(this,e)},render:function(){this.isClosed&&this._initializeRegions(),this._firstRender?this._firstRender=!1:this.isClosed||this._reInitializeRegions();var e=Array.prototype.slice.apply(arguments),t=r.ItemView.prototype.render.apply(this,e);return t},close:function(){if(!this.isClosed){this.regionManager.close();var e=Array.prototype.slice.apply(arguments);r.ItemView.prototype.close.apply(this,e)}},addRegion:function(e,t){var n={};return n[e]=t,this._buildRegions(n)[e]},addRegions:function(e){return this.regions=n.extend({},this.regions,e),this._buildRegions(e)},removeRegion:function(e){return delete this.regions[e],this.regionManager.removeRegion(e)},_buildRegions:function(e){var t=this,n={regionType:r.getOption(this,"regionType"),parentEl:function(){return t.$el}};return this.regionManager.addRegions(e,n)},_initializeRegions:function(e){var t;this._initRegionManager(),t=n.isFunction(this.regions)?this.regions(e):this.regions||{},this.addRegions(t)},_reInitializeRegions:function(){this.regionManager.closeRegions(),this.regionManager.each(function(e){e.reset()})},_initRegionManager:function(){this.regionManager=new r.RegionManager,this.listenTo(this.regionManager,"region:add",function(e,t){this[e]=t,this.trigger("region:add",e,t)}),this.listenTo(this.regionManager,"region:remove",function(e,t){delete this[e],this.trigger("region:remove",e,t)})}}),r.AppRouter=t.Router.extend({constructor:function(e){t.Router.prototype.constructor.apply(this,i(arguments)),this.options=e||{};var n=r.getOption(this,"appRoutes"),a=this._getController();this.processAppRoutes(a,n)},appRoute:function(e,t){var n=this._getController();this._addAppRoute(n,e,t)},processAppRoutes:function(e,t){if(t){var i=n.keys(t).reverse();n.each(i,function(n){this._addAppRoute(e,n,t[n])},this)}},_getController:function(){return r.getOption(this,"controller")},_addAppRoute:function(e,t,i){var a=e[i];if(!a)throw new Error("Method '"+i+"' was not found on the controller");this.route(t,i,n.bind(a,e))}}),r.Application=function(e){this._initRegionManager(),this._initCallbacks=new r.Callbacks,this.vent=new t.Wreqr.EventAggregator,this.commands=new t.Wreqr.Commands,this.reqres=new t.Wreqr.RequestResponse,this.submodules={},n.extend(this,e),this.triggerMethod=r.triggerMethod},n.extend(r.Application.prototype,t.Events,{execute:function(){var e=Array.prototype.slice.apply(arguments);this.commands.execute.apply(this.commands,e)},request:function(){var e=Array.prototype.slice.apply(arguments);return this.reqres.request.apply(this.reqres,e)},addInitializer:function(e){this._initCallbacks.add(e)},start:function(e){this.triggerMethod("initialize:before",e),this._initCallbacks.run(e,this),this.triggerMethod("initialize:after",e),this.triggerMethod("start",e)},addRegions:function(e){return this._regionManager.addRegions(e)},closeRegions:function(){this._regionManager.closeRegions()},removeRegion:function(e){this._regionManager.removeRegion(e)},getRegion:function(e){return this._regionManager.get(e)},module:function(e,t){var n=r.Module;t&&(n=t.moduleClass||n);var a=i(arguments);return a.unshift(this),n.create.apply(n,a)},_initRegionManager:function(){this._regionManager=new r.RegionManager,this.listenTo(this._regionManager,"region:add",function(e,t){this[e]=t}),this.listenTo(this._regionManager,"region:remove",function(e){delete this[e]})}}),r.Application.extend=r.extend,r.Module=function(e,t,i){this.moduleName=e,this.options=n.extend({},this.options,i),this.initialize=i.initialize||this.initialize,this.submodules={},this._setupInitializersAndFinalizers(),this.app=t,this.startWithParent=!0,this.triggerMethod=r.triggerMethod,n.isFunction(this.initialize)&&this.initialize(this.options,e,t)},r.Module.extend=r.extend,n.extend(r.Module.prototype,t.Events,{initialize:function(){},addInitializer:function(e){this._initializerCallbacks.add(e)},addFinalizer:function(e){this._finalizerCallbacks.add(e)},start:function(e){this._isInitialized||(n.each(this.submodules,function(t){t.startWithParent&&t.start(e)}),this.triggerMethod("before:start",e),this._initializerCallbacks.run(e,this),this._isInitialized=!0,this.triggerMethod("start",e))},stop:function(){this._isInitialized&&(this._isInitialized=!1,r.triggerMethod.call(this,"before:stop"),n.each(this.submodules,function(e){e.stop()}),this._finalizerCallbacks.run(void 0,this),this._initializerCallbacks.reset(),this._finalizerCallbacks.reset(),r.triggerMethod.call(this,"stop"))},addDefinition:function(e,t){this._runModuleDefinition(e,t)},_runModuleDefinition:function(e,i){if(e){var a=n.flatten([this,this.app,t,r,r.$,n,i]);e.apply(this,a)}},_setupInitializersAndFinalizers:function(){this._initializerCallbacks=new r.Callbacks,this._finalizerCallbacks=new r.Callbacks}}),n.extend(r.Module,{create:function(e,t,a){var r=e,s=i(arguments);s.splice(0,3),t=t.split(".");var o=t.length,l=[];return l[o-1]=a,n.each(t,function(t,n){var i=r;r=this._getModule(i,t,e,a),this._addModuleDefinition(i,r,l[n],s)},this),r},_getModule:function(e,t,i,a){var s=r.Module,o=n.extend({},a);a&&(s=a.moduleClass||s);var l=e[t];return l||(l=new s(t,i,o),e[t]=l,e.submodules[t]=l),l},_addModuleDefinition:function(e,t,i,a){var r,s;n.isFunction(i)?(r=i,s=!0):n.isObject(i)?(r=i.define,s="undefined"!=typeof i.startWithParent?i.startWithParent:!0):s=!0,r&&t.addDefinition(r,a),t.startWithParent=t.startWithParent&&s,t.startWithParent&&!t.startWithParentIsConfigured&&(t.startWithParentIsConfigured=!0,e.addInitializer(function(e){t.startWithParent&&t.start(e)}))}}),r}(this,t,e);return t.Marionette}),function(e,t){function n(n,i){function a(e){return ut.preferFlash&&at&&!ut.ignoreFlash&&ut.flash[e]!==t&&ut.flash[e]}function r(e){return function(t){var n=this._s;return n&&n._a?e.call(this,t):null}}this.setupOptions={url:n||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100},this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null},this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},opus:{type:["audio/ogg; codecs=opus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=i||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20131201",this.altURL=this.movieURL=this.version=null,this.enabled=this.swfLoaded=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.didFlashBlock=this.muted=!1,this.filePattern=null,this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i},this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1},this.sandbox={},this.html5={usingFlash:null},this.flash={},this.ignoreFlash=this.html5Only=!1;var s,o,l,u,p,c,d,h,f,m,g,v,y,_,w,b,k,C,P,M,T,x,O,A,j,I,S,E,R,L,$,H,D,q,F,B,V,z,U,N,W,X,Y,Q,J,G,K,Z,et,tt,nt,it,at,rt,st,ot,lt,ut=this,pt=null,ct=null,dt=navigator.userAgent,ht=e.location.href.toString(),ft=document,mt=[],gt=!1,vt=!1,yt=!1,_t=!1,wt=!1,bt=null,kt=null,Ct=!1,Pt=!1,Mt=0,Tt=null,xt=[],Ot=null,At=Array.prototype.slice,jt=!1,It=0,St=dt.match(/(ipad|iphone|ipod)/i),Et=dt.match(/android/i),Rt=dt.match(/msie/i),Lt=dt.match(/webkit/i),$t=dt.match(/safari/i)&&!dt.match(/chrome/i),Ht=dt.match(/opera/i),Dt=dt.match(/(mobile|pre\/|xoom)/i)||St||Et,qt=!ht.match(/usehtml5audio/i)&&!ht.match(/sm2\-ignorebadua/i)&&$t&&!dt.match(/silk/i)&&dt.match(/OS X 10_6_([3-7])/i),Ft=ft.hasFocus!==t?ft.hasFocus():null,Bt=$t&&(ft.hasFocus===t||!ft.hasFocus()),Vt=!Bt,zt=/(mp3|mp4|mpa|m4a|m4b)/i,Ut=ft.location?ft.location.protocol.match(/http/i):null,Nt=Ut?"":"https://",Wt=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,Xt="mpeg4 aac flv mov mp4 m4v f4v m4a m4b mp4v 3gp 3g2".split(" "),Yt=RegExp("\\.("+Xt.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!Ut;var Qt;try{Qt=Audio!==t&&(Ht&&opera!==t&&10>opera.version()?new Audio(null):new Audio).canPlayType!==t}catch(Jt){Qt=!1}this.hasHTML5=Qt,this.setup=function(e){var n=!ut.url;return e!==t&&yt&&Ot&&ut.ok(),f(e),e&&(n&&A&&e.url!==t&&ut.beginDelayedInit(),!A&&e.url!==t&&"complete"===ft.readyState&&setTimeout(x,1)),ut},this.supported=this.ok=function(){return Ot?yt&&!_t:ut.useHTML5Audio&&ut.hasHTML5},this.getMovie=function(t){return o(t)||ft[t]||e[t]},this.createSound=function(e,n){function i(){return a=B(a),ut.sounds[a.id]=new s(a),ut.soundIDs.push(a.id),ut.sounds[a.id]}var a,r=null;if(!yt||!ut.ok())return!1;if(n!==t&&(e={id:e,url:n}),a=h(e),a.url=X(a.url),void 0===a.id&&(a.id=ut.setupOptions.idPrefix+It++),z(a.id,!0))return ut.sounds[a.id];if(J(a))r=i(),r._setup_html5(a);else{if(ut.html5Only||ut.html5.usingFlash&&a.url&&a.url.match(/data\:/i))return i();c>8&&null===a.isMovieStar&&(a.isMovieStar=!(!a.serverURL&&!(a.type&&a.type.match(Wt)||a.url&&a.url.match(Yt)))),a=V(a,void 0),r=i(),8===c?ct._createSound(a.id,a.loops||1,a.usePolicyFile):(ct._createSound(a.id,a.url,a.usePeakData,a.useWaveformData,a.useEQData,a.isMovieStar,a.isMovieStar?a.bufferTime:!1,a.loops||1,a.serverURL,a.duration||null,a.autoPlay,!0,a.autoLoad,a.usePolicyFile),a.serverURL||(r.connected=!0,a.onconnect&&a.onconnect.apply(r))),!a.serverURL&&(a.autoLoad||a.autoPlay)&&r.load(a)}return!a.serverURL&&a.autoPlay&&r.play(),r},this.destroySound=function(e,t){if(!z(e))return!1;var n,i=ut.sounds[e];for(i._iO={},i.stop(),i.unload(),n=0;n=0;e--)ut.sounds[ut.soundIDs[e]].pause()},this.resume=function(e){return z(e)?ut.sounds[e].resume():!1},this.resumeAll=function(){var e;for(e=ut.soundIDs.length-1;e>=0;e--)ut.sounds[ut.soundIDs[e]].resume()},this.togglePause=function(e){return z(e)?ut.sounds[e].togglePause():!1},this.setPan=function(e,t){return z(e)?ut.sounds[e].setPan(t):!1},this.setVolume=function(e,t){return z(e)?ut.sounds[e].setVolume(t):!1},this.mute=function(e){var t=0;if(e instanceof String&&(e=null),e)return z(e)?ut.sounds[e].mute():!1;for(t=ut.soundIDs.length-1;t>=0;t--)ut.sounds[ut.soundIDs[t]].mute();return ut.muted=!0},this.muteAll=function(){ut.mute()},this.unmute=function(e){if(e instanceof String&&(e=null),e)return z(e)?ut.sounds[e].unmute():!1;for(e=ut.soundIDs.length-1;e>=0;e--)ut.sounds[ut.soundIDs[e]].unmute();return ut.muted=!1,!0},this.unmuteAll=function(){ut.unmute()},this.toggleMute=function(e){return z(e)?ut.sounds[e].toggleMute():!1},this.getMemoryUse=function(){var e=0;return ct&&8!==c&&(e=parseInt(ct._getMemoryUse(),10)),e},this.disable=function(n){var i;if(n===t&&(n=!1),_t)return!1;for(_t=!0,i=ut.soundIDs.length-1;i>=0;i--)L(ut.sounds[ut.soundIDs[i]]);return d(n),nt.remove(e,"load",y),!0},this.canPlayMIME=function(e){var t;return ut.hasHTML5&&(t=G({type:e})),!t&&Ot&&(t=e&&ut.ok()?!!(c>8&&e.match(Wt)||e.match(ut.mimePattern)):null),t},this.canPlayURL=function(e){var t;return ut.hasHTML5&&(t=G({url:e})),!t&&Ot&&(t=e&&ut.ok()?!!e.match(ut.filePattern):null),t},this.canPlayLink=function(e){return e.type!==t&&e.type&&ut.canPlayMIME(e.type)?!0:ut.canPlayURL(e.href)},this.getSoundById=function(e){return e?ut.sounds[e]:null},this.onready=function(t,n){if("function"!=typeof t)throw D("needFunction","onready");return n||(n=e),g("onready",t,n),v(),!0},this.ontimeout=function(t,n){if("function"!=typeof t)throw D("needFunction","ontimeout");return n||(n=e),g("ontimeout",t,n),v({type:"ontimeout"}),!0},this._wD=this._writeDebug=function(){return!0},this._debug=function(){},this.reboot=function(t,n){var i,a,r;for(i=ut.soundIDs.length-1;i>=0;i--)ut.sounds[ut.soundIDs[i]].destruct();if(ct)try{Rt&&(kt=ct.innerHTML),bt=ct.parentNode.removeChild(ct)}catch(s){}if(kt=bt=Ot=ct=null,ut.enabled=A=yt=Ct=Pt=gt=vt=_t=jt=ut.swfLoaded=!1,ut.soundIDs=[],ut.sounds={},It=0,t)mt=[];else for(i in mt)if(mt.hasOwnProperty(i))for(a=0,r=mt[i].length;r>a;a++)mt[i][a].fired=!1;return ut.html5={usingFlash:null},ut.flash={},ut.html5Only=!1,ut.ignoreFlash=!1,e.setTimeout(function(){T(),n||ut.beginDelayedInit()},20),ut},this.reset=function(){return ut.reboot(!0,!0)},this.getMoviePercent=function(){return ct&&"PercentLoaded"in ct?ct.PercentLoaded():null},this.beginDelayedInit=function(){wt=!0,x(),setTimeout(function(){return Pt?!1:(I(),M(),Pt=!0)},20),_()},this.destruct=function(){ut.disable(!0)},s=function(e){var n,i,a,r,s,o,l,u,p,d,f,m=this,g=!1,v=[],y=0,_=null;i=n=null,this.sID=this.id=e.id,this.url=e.url,this._iO=this.instanceOptions=this.options=h(e),this.pan=this.options.pan,this.volume=this.options.volume,this.isHTML5=!1,this._a=null,f=this.url?!1:!0,this.id3={},this._debug=function(){},this.load=function(e){var n,i=null;if(e!==t?m._iO=h(e,m.options):(e=m.options,m._iO=e,_&&_!==m.url&&(m._iO.url=m.url,m.url=null)),m._iO.url||(m._iO.url=m.url),m._iO.url=X(m._iO.url),n=m.instanceOptions=m._iO,!n.url&&!m.url)return m;if(n.url===m.url&&0!==m.readyState&&2!==m.readyState)return 3===m.readyState&&n.onload&<(m,function(){n.onload.apply(m,[!!m.duration])}),m;if(m.loaded=!1,m.readyState=1,m.playState=0,m.id3={},J(n))i=m._setup_html5(n),i._called_load||(m._html5_canplay=!1,m.url!==n.url&&(m._a.src=n.url,m.setPosition(0)),m._a.autobuffer="auto",m._a.preload="auto",m._a._called_load=!0);else{if(ut.html5Only||m._iO.url&&m._iO.url.match(/data\:/i))return m;try{m.isHTML5=!1,m._iO=V(B(n)),n=m._iO,8===c?ct._load(m.id,n.url,n.stream,n.autoPlay,n.usePolicyFile):ct._load(m.id,n.url,!!n.stream,!!n.autoPlay,n.loops||1,!!n.autoLoad,n.usePolicyFile)}catch(a){S({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}}return m.url=n.url,m},this.unload=function(){return 0!==m.readyState&&(m.isHTML5?(o(),m._a&&(m._a.pause(),_=Z(m._a))):8===c?ct._unload(m.id,"about:blank"):ct._unload(m.id),a()),m},this.destruct=function(e){m.isHTML5?(o(),m._a&&(m._a.pause(),Z(m._a),jt||s(),m._a._s=null,m._a=null)):(m._iO.onfailure=null,ct._destroySound(m.id)),e||ut.destroySound(m.id,!0)},this.start=this.play=function(e,n){var i,a,r,s,o;if(a=!0,a=null,n=n===t?!0:n,e||(e={}),m.url&&(m._iO.url=m.url),m._iO=h(m._iO,m.options),m._iO=h(e,m._iO),m._iO.url=X(m._iO.url),m.instanceOptions=m._iO,!m.isHTML5&&m._iO.serverURL&&!m.connected)return m.getAutoPlay()||m.setAutoPlay(!0),m;if(J(m._iO)&&(m._setup_html5(m._iO),l()),1===m.playState&&!m.paused&&(i=m._iO.multiShot,i||(m.isHTML5&&m.setPosition(m._iO.position),a=m)),null!==a)return a;if(e.url&&e.url!==m.url&&(m.readyState||m.isHTML5||8!==c||!f?m.load(m._iO):f=!1),m.loaded||(0===m.readyState?(m.isHTML5||ut.html5Only?m.isHTML5?m.load(m._iO):a=m:(m._iO.autoPlay=!0,m.load(m._iO)),m.instanceOptions=m._iO):2===m.readyState&&(a=m)),null!==a)return a;if(!m.isHTML5&&9===c&&08&&!m.getAutoPlay())&&m.instanceCount++,m._iO.onposition&&0===m.playState&&u(m),m.playState=1,m.paused=!1,m.position=m._iO.position===t||isNaN(m._iO.position)?0:m._iO.position,m.isHTML5||(m._iO=V(B(m._iO))),m._iO.onplay&&n&&(m._iO.onplay.apply(m),g=!0),m.setVolume(m._iO.volume,!0),m.setPan(m._iO.pan,!0),m.isHTML5?2>m.instanceCount?(l(),a=m._setup_html5(),m.setPosition(m._iO.position),a.play()):(r=new Audio(m._iO.url),s=function(){nt.remove(r,"ended",s),m._onfinish(m),Z(r),r=null},o=function(){nt.remove(r,"canplay",o);try{r.currentTime=m._iO.position/1e3}catch(e){}r.play()},nt.add(r,"ended",s),void 0!==m._iO.volume&&(r.volume=Math.max(0,Math.min(1,m._iO.volume/100))),m.muted&&(r.muted=!0),m._iO.position?nt.add(r,"canplay",o):r.play()):(a=ct._start(m.id,m._iO.loops||1,9===c?m.position:m.position/1e3,m._iO.multiShot||!1),9===c&&!a&&m._iO.onplayerror&&m._iO.onplayerror.apply(m))}return m},this.stop=function(e){var t=m._iO;return 1===m.playState&&(m._onbufferchange(0),m._resetOnPosition(0),m.paused=!1,m.isHTML5||(m.playState=0),p(),t.to&&m.clearOnPosition(t.to),m.isHTML5?m._a&&(e=m.position,m.setPosition(0),m.position=e,m._a.pause(),m.playState=0,m._onTimer(),o()):(ct._stop(m.id,e),t.serverURL&&m.unload()),m.instanceCount=0,m._iO={},t.onstop&&t.onstop.apply(m)),m},this.setAutoPlay=function(e){m._iO.autoPlay=e,m.isHTML5||(ct._setAutoPlay(m.id,e),e&&!m.instanceCount&&1===m.readyState&&m.instanceCount++)},this.getAutoPlay=function(){return m._iO.autoPlay},this.setPosition=function(e){e===t&&(e=0);var n=m.isHTML5?Math.max(e,0):Math.min(m.duration||m._iO.duration,Math.max(e,0));if(m.position=n,e=m.position/1e3,m._resetOnPosition(m.position),m._iO.position=n,m.isHTML5){if(m._a){if(m._html5_canplay){if(m._a.currentTime!==e)try{m._a.currentTime=e,(0===m.playState||m.paused)&&m._a.pause()}catch(i){}}else if(e)return m;m.paused&&m._onTimer(!0)}}else e=9===c?m.position:e,m.readyState&&2!==m.readyState&&ct._setPosition(m.id,e,m.paused||!m.playState,m._iO.multiShot);return m},this.pause=function(e){return m.paused||0===m.playState&&1!==m.readyState?m:(m.paused=!0,m.isHTML5?(m._setup_html5().pause(),o()):(e||e===t)&&ct._pause(m.id,m._iO.multiShot),m._iO.onpause&&m._iO.onpause.apply(m),m)},this.resume=function(){var e=m._iO;return m.paused?(m.paused=!1,m.playState=1,m.isHTML5?(m._setup_html5().play(),l()):(e.isMovieStar&&!e.serverURL&&m.setPosition(m.position),ct._pause(m.id,e.multiShot)),!g&&e.onplay?(e.onplay.apply(m),g=!0):e.onresume&&e.onresume.apply(m),m):m},this.togglePause=function(){return 0===m.playState?(m.play({position:9!==c||m.isHTML5?m.position/1e3:m.position}),m):(m.paused?m.resume():m.pause(),m)},this.setPan=function(e,n){return e===t&&(e=0),n===t&&(n=!1),m.isHTML5||ct._setPan(m.id,e),m._iO.pan=e,n||(m.pan=e,m.options.pan=e),m},this.setVolume=function(e,n){return e===t&&(e=100),n===t&&(n=!1),m.isHTML5?m._a&&(ut.muted&&!m.muted&&(m.muted=!0,m._a.muted=!0),m._a.volume=Math.max(0,Math.min(1,e/100))):ct._setVolume(m.id,ut.muted&&!m.muted||m.muted?0:e),m._iO.volume=e,n||(m.volume=e,m.options.volume=e),m},this.mute=function(){return m.muted=!0,m.isHTML5?m._a&&(m._a.muted=!0):ct._setVolume(m.id,0),m},this.unmute=function(){m.muted=!1;var e=m._iO.volume!==t;return m.isHTML5?m._a&&(m._a.muted=!1):ct._setVolume(m.id,e?m._iO.volume:m.options.volume),m},this.toggleMute=function(){return m.muted?m.unmute():m.mute()},this.onposition=this.onPosition=function(e,n,i){return v.push({position:parseInt(e,10),method:n,scope:i!==t?i:m,fired:!1}),m},this.clearOnPosition=function(e,t){var n;if(e=parseInt(e,10),isNaN(e))return!1;for(n=0;n=e)return!1;for(e-=1;e>=0;e--)t=v[e],!t.fired&&m.position>=t.position&&(t.fired=!0,y++,t.method.apply(t.scope,[t.position]));return!0},this._resetOnPosition=function(e){var t,n;if(t=v.length,!t)return!1;for(t-=1;t>=0;t--)n=v[t],n.fired&&e<=n.position&&(n.fired=!1,y--);return!0},d=function(){var e,t,n=m._iO,i=n.from,a=n.to;return t=function(){m.clearOnPosition(a,t),m.stop()},e=function(){null===a||isNaN(a)||m.onPosition(a,t)},null!==i&&!isNaN(i)&&(n.position=i,n.multiShot=!1,e()),n},u=function(){var e,t=m._iO.onposition;if(t)for(e in t)t.hasOwnProperty(e)&&m.onPosition(parseInt(e,10),t[e])},p=function(){var e,t=m._iO.onposition;if(t)for(e in t)t.hasOwnProperty(e)&&m.clearOnPosition(parseInt(e,10))},l=function(){m.isHTML5&&U(m)},o=function(){m.isHTML5&&N(m)},a=function(e){e||(v=[],y=0),g=!1,m._hasTimer=null,m._a=null,m._html5_canplay=!1,m.bytesLoaded=null,m.bytesTotal=null,m.duration=m._iO&&m._iO.duration?m._iO.duration:null,m.durationEstimate=null,m.buffered=[],m.eqData=[],m.eqData.left=[],m.eqData.right=[],m.failures=0,m.isBuffering=!1,m.instanceOptions={},m.instanceCount=0,m.loaded=!1,m.metadata={},m.readyState=0,m.muted=!1,m.paused=!1,m.peakData={left:0,right:0},m.waveformData={left:[],right:[]},m.playState=0,m.position=null,m.id3={}},a(),this._onTimer=function(e){var t,a=!1,r={};return m._hasTimer||e?(m._a&&(e||(01?"loop":""},this._setup_html5=function(e){e=h(m._iO,e);var t,n=jt?pt:m._a,i=decodeURI(e.url);if(jt?i===decodeURI(it)&&(t=!0):i===decodeURI(_)&&(t=!0),n){if(n._s)if(jt)n._s&&n._s.playState&&!t&&n._s.stop();else if(!jt&&i===decodeURI(_))return m._apply_loop(n,e.loops),n;t||(_&&a(!1),n.src=e.url,it=_=m.url=e.url,n._called_load=!1)}else e.autoLoad||e.autoPlay?(m._a=new Audio(e.url),m._a.load()):m._a=Ht&&10>opera.version()?new Audio(null):new Audio,n=m._a,n._called_load=!1,jt&&(pt=n);return m.isHTML5=!0,m._a=n,n._s=m,r(),m._apply_loop(n,e.loops),e.autoLoad||e.autoPlay?m.load():(n.autobuffer=!1,n.preload="auto"),n},r=function(){if(m._a._added_events)return!1;var e;m._a._added_events=!0;for(e in ot)ot.hasOwnProperty(e)&&m._a&&m._a.addEventListener(e,ot[e],!1);return!0},s=function(){var e;m._a._added_events=!1;for(e in ot)ot.hasOwnProperty(e)&&m._a&&m._a.removeEventListener(e,ot[e],!1)},this._onload=function(e){var t=!!e||!m.isHTML5&&8===c&&m.duration;return m.loaded=t,m.readyState=t?3:2,m._onbufferchange(0),m._iO.onload&<(m,function(){m._iO.onload.apply(m,[t])}),!0},this._onbufferchange=function(e){return 0===m.playState||e&&m.isBuffering||!e&&!m.isBuffering?!1:(m.isBuffering=1===e,m._iO.onbufferchange&&m._iO.onbufferchange.apply(m),!0)},this._onsuspend=function(){return m._iO.onsuspend&&m._iO.onsuspend.apply(m),!0},this._onfailure=function(e,t,n){m.failures++,m._iO.onfailure&&1===m.failures&&m._iO.onfailure(m,e,t,n)},this._onfinish=function(){var e=m._iO.onfinish;m._onbufferchange(0),m._resetOnPosition(0),m.instanceCount&&(m.instanceCount--,m.instanceCount||(p(),m.playState=0,m.paused=!1,m.instanceCount=0,m.instanceOptions={},m._iO={},o(),m.isHTML5&&(m.position=0)),(!m.instanceCount||m._iO.multiShotEvents)&&e&<(m,function(){e.apply(m)}))},this._whileloading=function(e,t,n,i){var a=m._iO;m.bytesLoaded=e,m.bytesTotal=t,m.duration=Math.floor(n),m.bufferLength=i,m.durationEstimate=m.isHTML5||a.isMovieStar?m.duration:a.duration?m.duration>a.duration?m.duration:a.duration:parseInt(m.bytesTotal/m.bytesLoaded*m.duration,10),m.isHTML5||(m.buffered=[{start:0,end:m.duration}]),(3!==m.readyState||m.isHTML5)&&a.whileloading&&a.whileloading.apply(m)
},this._whileplaying=function(e,n,i,a,r){var s=m._iO;return isNaN(e)||null===e?!1:(m.position=Math.max(0,e),m._processOnPosition(),!m.isHTML5&&c>8&&(s.usePeakData&&n!==t&&n&&(m.peakData={left:n.leftPeak,right:n.rightPeak}),s.useWaveformData&&i!==t&&i&&(m.waveformData={left:i.split(","),right:a.split(",")}),s.useEQData&&r!==t&&r&&r.leftEQ&&(e=r.leftEQ.split(","),m.eqData=e,m.eqData.left=e,r.rightEQ!==t&&r.rightEQ&&(m.eqData.right=r.rightEQ.split(",")))),1===m.playState&&(!m.isHTML5&&8===c&&!m.position&&m.isBuffering&&m._onbufferchange(0),s.whileplaying&&s.whileplaying.apply(m)),!0)},this._oncaptiondata=function(e){m.captiondata=e,m._iO.oncaptiondata&&m._iO.oncaptiondata.apply(m,[e])},this._onmetadata=function(e,t){var n,i,a={};for(n=0,i=e.length;i>n;n++)a[e[n]]=t[n];m.metadata=a,m._iO.onmetadata&&m._iO.onmetadata.apply(m)},this._onid3=function(e,t){var n,i,a=[];for(n=0,i=e.length;i>n;n++)a[e[n]]=t[n];m.id3=h(m.id3,a),m._iO.onid3&&m._iO.onid3.apply(m)},this._onconnect=function(e){e=1===e,(m.connected=e)&&(m.failures=0,z(m.id)&&(m.getAutoPlay()?m.play(t,m.getAutoPlay()):m._iO.autoLoad&&m.load()),m._iO.onconnect&&m._iO.onconnect.apply(m,[e]))},this._ondataerror=function(){03&&e.pop()):3===t&&e.push(!1),e}function n(e,t){var n=e.shift(),r=[a[t]];i?n[r](e[0],e[1]):n[r].apply(n,e)}var i=e.attachEvent,a={add:i?"attachEvent":"addEventListener",remove:i?"detachEvent":"removeEventListener"};return{add:function(){n(t(arguments),"add")},remove:function(){n(t(arguments),"remove")}}}(),ot={abort:r(function(){}),canplay:r(function(){var e,n=this._s;if(n._html5_canplay)return!0;if(n._html5_canplay=!0,n._onbufferchange(0),e=n._iO.position===t||isNaN(n._iO.position)?null:n._iO.position/1e3,n.position&&this.currentTime!==e)try{this.currentTime=e}catch(i){}n._iO._oncanplay&&n._iO._oncanplay()}),canplaythrough:r(function(){var e=this._s;e.loaded||(e._onbufferchange(0),e._whileloading(e.bytesLoaded,e.bytesTotal,e._get_html5_duration()),e._onload(!0))}),ended:r(function(){this._s._onfinish()}),error:r(function(){this._s._onload(!1)}),loadeddata:r(function(){var e=this._s;!e._loaded&&!$t&&(e.duration=e._get_html5_duration())}),loadedmetadata:r(function(){}),loadstart:r(function(){this._s._onbufferchange(1)}),play:r(function(){this._s._onbufferchange(0)}),playing:r(function(){this._s._onbufferchange(0)}),progress:r(function(e){var t,n,i=this._s,a=0,a=e.target.buffered;t=e.loaded||0;var r=e.total||1;if(i.buffered=[],a&&a.length){for(t=0,n=a.length;n>t;t++)i.buffered.push({start:1e3*a.start(t),end:1e3*a.end(t)});a=1e3*(a.end(0)-a.start(0)),t=Math.min(1,a/(1e3*e.target.duration))}isNaN(t)||(i._onbufferchange(0),i._whileloading(t,r,i._get_html5_duration()),t&&r&&t===r&&ot.canplaythrough.call(this,e))}),ratechange:r(function(){}),suspend:r(function(e){var t=this._s;ot.progress.call(this,e),t._onsuspend()}),stalled:r(function(){}),timeupdate:r(function(){this._s._onTimer()}),waiting:r(function(){this._s._onbufferchange(1)})},J=function(e){return e&&(e.type||e.url||e.serverURL)?e.serverURL||e.type&&a(e.type)?!1:e.type?G({type:e.type}):G({url:e.url})||ut.html5Only||e.url.match(/data\:/i):!1},Z=function(e){var t;return e&&(t=$t?"about:blank":ut.html5.canPlayType("audio/wav")?"data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w==":"about:blank",e.src=t,void 0!==e._called_unload&&(e._called_load=!1)),jt&&(it=null),t},G=function(e){if(!ut.useHTML5Audio||!ut.hasHTML5)return!1;var n=e.url||null;e=e.type||null;var i,r=ut.audioFormats;if(e&&ut.html5[e]!==t)return ut.html5[e]&&!a(e);if(!K){K=[];for(i in r)r.hasOwnProperty(i)&&(K.push(i),r[i].related&&(K=K.concat(r[i].related)));K=RegExp("\\.("+K.join("|")+")(\\?.*)?$","i")}return i=n?n.toLowerCase().match(K):null,i&&i.length?i=i[1]:e&&(n=e.indexOf(";"),i=(-1!==n?e.substr(0,n):e).substr(6)),i&&ut.html5[i]!==t?n=ut.html5[i]&&!a(i):(e="audio/"+i,n=ut.html5.canPlayType({type:e}),n=(ut.html5[i]=n)&&ut.html5[e]&&!a(e)),n},tt=function(){function e(e){var t,n=t=!1;if(!s||"function"!=typeof s.canPlayType)return t;if(e instanceof Array){for(r=0,t=e.length;t>r;r++)(ut.html5[e[r]]||s.canPlayType(e[r]).match(ut.html5Test))&&(n=!0,ut.html5[e[r]]=!0,ut.flash[e[r]]=!!e[r].match(zt));t=n}else e=s&&"function"==typeof s.canPlayType?s.canPlayType(e):!1,t=!(!e||!e.match(ut.html5Test));return t}if(!ut.useHTML5Audio||!ut.hasHTML5)return Ot=ut.html5.usingFlash=!0,!1;var n,i,a,r,s=Audio!==t?Ht&&10>opera.version()?new Audio(null):new Audio:null,o={};a=ut.audioFormats;for(n in a)if(a.hasOwnProperty(n)&&(i="audio/"+n,o[n]=e(a[n].type),o[i]=o[n],n.match(zt)?(ut.flash[n]=!0,ut.flash[i]=!0):(ut.flash[n]=!1,ut.flash[i]=!1),a[n]&&a[n].related))for(r=a[n].related.length-1;r>=0;r--)o["audio/"+a[n].related[r]]=o[n],ut.html5[a[n].related[r]]=o[n],ut.flash[a[n].related[r]]=o[n];return o.canPlayType=s?e:null,ut.html5=h(ut.html5,o),ut.html5.usingFlash=Q(),Ot=ut.html5.usingFlash,!0},P={},D=function(){},B=function(e){return 8===c&&1c&&(ut.flashVersion=c=9),ut.version=ut.versionNumber+(ut.html5Only?" (HTML5-only mode)":9===c?" (AS3/Flash 9)":" (AS2/Flash 8)"),c>8?(ut.defaultOptions=h(ut.defaultOptions,ut.flash9Options),ut.features.buffering=!0,ut.defaultOptions=h(ut.defaultOptions,ut.movieStarOptions),ut.filePatterns.flash9=RegExp("\\.(mp3|"+Xt.join("|")+")(\\?.*)?$","i"),ut.features.movieStar=!0):ut.features.movieStar=!1,ut.filePattern=ut.filePatterns[8!==c?"flash9":"flash8"],ut.movieURL=(8===c?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",e),ut.features.peakData=ut.features.waveformData=ut.features.eqData=c>8},E=function(e,t){return ct?void ct._setPolling(e,t):!1},R=function(){},z=this.getSoundById,F=function(){var e=[];return ut.debugMode&&e.push("sm2_debug"),ut.debugFlash&&e.push("flash_debug"),ut.useHighPerformance&&e.push("high_performance"),e.join(" ")},q=function(){D("fbHandler");var e=ut.getMoviePercent(),t={type:"FLASHBLOCK"};return ut.html5Only?!1:void(ut.ok()?ut.oMC&&(ut.oMC.className=[F(),"movieContainer","swf_loaded"+(ut.didFlashBlock?" swf_unblocked":"")].join(" ")):(Ot&&(ut.oMC.className=F()+" movieContainer "+(null===e?"swf_timedout":"swf_error")),ut.didFlashBlock=!0,v({type:"ontimeout",ignoreInit:!0,error:t}),S(t)))},g=function(e,n,i){mt[e]===t&&(mt[e]=[]),mt[e].push({method:n,scope:i||null,fired:!1})},v=function(e){if(e||(e={type:ut.ok()?"onready":"ontimeout"}),!yt&&e&&!e.ignoreInit||"ontimeout"===e.type&&(ut.ok()||_t&&!e.ignoreInit))return!1;var t,n={success:e&&e.ignoreInit?ut.ok():!_t},i=e&&e.type?mt[e.type]||[]:[],a=[],n=[n],r=Ot&&!ut.ok();for(e.error&&(n[0].error=e.error),e=0,t=i.length;t>e;e++)!0!==i[e].fired&&a.push(i[e]);if(a.length)for(e=0,t=a.length;t>e;e++)a[e].scope?a[e].method.apply(a[e].scope,n):a[e].method.apply(this,n),r||(a[e].fired=!0);return!0},y=function(){e.setTimeout(function(){ut.useFlashBlock&&q(),v(),"function"==typeof ut.onload&&ut.onload.apply(e),ut.waitForWindowLoad&&nt.add(e,"load",y)},1)},rt=function(){if(at!==t)return at;var n,i=!1,a=navigator,r=a.plugins,s=e.ActiveXObject;if(r&&r.length)(a=a.mimeTypes)&&a["application/x-shockwave-flash"]&&a["application/x-shockwave-flash"].enabledPlugin&&a["application/x-shockwave-flash"].enabledPlugin.description&&(i=!0);else if(s!==t&&!dt.match(/MSAppHost/i)){try{n=new s("ShockwaveFlash.ShockwaveFlash")}catch(o){n=null}i=!!n}return at=i},Q=function(){var e,t,n=ut.audioFormats;if(St&&dt.match(/os (1|2|3_0|3_1)/i)?(ut.hasHTML5=!1,ut.html5Only=!0,ut.oMC&&(ut.oMC.style.display="none")):!ut.useHTML5Audio||ut.html5&&ut.html5.canPlayType||(ut.hasHTML5=!1),ut.useHTML5Audio&&ut.hasHTML5)for(t in Y=!0,n)n.hasOwnProperty(t)&&n[t].required&&(ut.html5.canPlayType(n[t].type)?ut.preferFlash&&(ut.flash[t]||ut.flash[n[t].type])&&(e=!0):(Y=!1,e=!0));return ut.ignoreFlash&&(e=!1,Y=!0),ut.html5Only=ut.hasHTML5&&ut.useHTML5Audio&&!e,!ut.html5Only},X=function(e){var t,n,i=0;if(e instanceof Array){for(t=0,n=e.length;n>t;t++)if(e[t]instanceof Object){if(ut.canPlayMIME(e[t].type)){i=t;break}}else if(ut.canPlayURL(e[t])){i=t;break}e[i].url&&(e[i]=e[i].url),e=e[i]}return e},U=function(e){e._hasTimer||(e._hasTimer=!0,!Dt&&ut.html5PollingInterval&&(null===Tt&&0===Mt&&(Tt=setInterval(W,ut.html5PollingInterval)),Mt++))},N=function(e){e._hasTimer&&(e._hasTimer=!1,!Dt&&ut.html5PollingInterval&&Mt--)},W=function(){var e;if(null!==Tt&&!Mt)return clearInterval(Tt),Tt=null,!1;for(e=ut.soundIDs.length-1;e>=0;e--)ut.sounds[ut.soundIDs[e]].isHTML5&&ut.sounds[ut.soundIDs[e]]._hasTimer&&ut.sounds[ut.soundIDs[e]]._onTimer()},S=function(n){n=n!==t?n:{},"function"==typeof ut.onerror&&ut.onerror.apply(e,[{type:n.type!==t?n.type:null}]),n.fatal!==t&&n.fatal&&ut.disable()},st=function(){if(!qt||!rt())return!1;var e,t,n=ut.audioFormats;for(t in n)if(n.hasOwnProperty(t)&&("mp3"===t||"mp4"===t)&&(ut.html5[t]=!1,n[t]&&n[t].related))for(e=n[t].related.length-1;e>=0;e--)ut.html5[n[t].related[e]]=!1},this._setSandboxType=function(){},this._externalInterfaceOK=function(){return ut.swfLoaded?!1:(ut.swfLoaded=!0,Bt=!1,qt&&st(),void setTimeout(p,Rt?100:1))},I=function(e,n){function i(e,t){return''}if(gt&&vt)return!1;if(ut.html5Only)return k(),ut.oMC=o(ut.movieID),p(),vt=gt=!0,!1;var a,r,s,l=n||ut.url,u=ut.altURL||l,c=j(),d=F(),h=null,h=ft.getElementsByTagName("html")[0],h=h&&h.dir&&h.dir.match(/rtl/i);if(e=e===t?ut.id:e,k(),ut.url=H(Ut?l:u),n=ut.url,ut.wmode=!ut.wmode&&ut.useHighPerformance?"transparent":ut.wmode,null!==ut.wmode&&(dt.match(/msie 8/i)||!Rt&&!ut.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(xt.push(P.spcWmode),ut.wmode=null),c={name:e,id:e,src:n,quality:"high",allowScriptAccess:ut.allowScriptAccess,bgcolor:ut.bgColor,pluginspage:Nt+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:ut.wmode,hasPriority:"true"},ut.debugFlash&&(c.FlashVars="debug=1"),ut.wmode||delete c.wmode,Rt)l=ft.createElement("div"),r=['"].join("");else for(a in l=ft.createElement("embed"),c)c.hasOwnProperty(a)&&l.setAttribute(a,c[a]);if(R(),d=F(),c=j())if(ut.oMC=o(ut.movieID)||ft.createElement("div"),ut.oMC.id)s=ut.oMC.className,ut.oMC.className=(s?s+" ":"movieContainer")+(d?" "+d:""),ut.oMC.appendChild(l),Rt&&(a=ut.oMC.appendChild(ft.createElement("div")),a.className="sm2-object-box",a.innerHTML=r),vt=!0;else{if(ut.oMC.id=ut.movieID,ut.oMC.className="movieContainer "+d,a=d=null,ut.useFlashBlock||(ut.useHighPerformance?d={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(d={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},h&&(d.left=Math.abs(parseInt(d.left,10))+"px"))),Lt&&(ut.oMC.style.zIndex=1e4),!ut.debugFlash)for(s in d)d.hasOwnProperty(s)&&(ut.oMC.style[s]=d[s]);try{Rt||ut.oMC.appendChild(l),c.appendChild(ut.oMC),Rt&&(a=ut.oMC.appendChild(ft.createElement("div")),a.className="sm2-object-box",a.innerHTML=r),vt=!0}catch(f){throw Error(D("domError")+" \n"+f.toString())}}return gt=!0},M=function(){return ut.html5Only?(I(),!1):ct||!ut.url?!1:(ct=ut.getMovie(ut.id),ct||(bt?(Rt?ut.oMC.innerHTML=kt:ut.oMC.appendChild(bt),bt=null,gt=!0):I(ut.id,ut.url),ct=ut.getMovie(ut.id)),"function"==typeof ut.oninitmovie&&setTimeout(ut.oninitmovie,1),!0)},_=function(){setTimeout(w,1e3)},b=function(){e.setTimeout(function(){ut.setup({preferFlash:!1}).reboot(),ut.didFlashBlock=!0,ut.beginDelayedInit()},1)},w=function(){var t,n=!1;return!ut.url||Ct?!1:(Ct=!0,nt.remove(e,"load",_),at&&Bt&&!Ft?!1:(yt||(t=ut.getMoviePercent(),t>0&&100>t&&(n=!0)),void setTimeout(function(){return t=ut.getMoviePercent(),n?(Ct=!1,e.setTimeout(_,1),!1):void(!yt&&Vt&&(null===t?ut.useFlashBlock||0===ut.flashLoadTimeout?ut.useFlashBlock&&q():!ut.useFlashBlock&&Y?b():v({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}}):0!==ut.flashLoadTimeout&&(!ut.useFlashBlock&&Y?b():$(!0))))},ut.flashLoadTimeout)))},C=function(){return Ft||!Bt?(nt.remove(e,"focus",C),!0):(Ft=Vt=!0,Ct=!1,_(),nt.remove(e,"focus",C),!0)},d=function(t){if(yt)return!1;if(ut.html5Only)return yt=!0,y(),!0;var n,i=!0;return ut.useFlashBlock&&ut.flashLoadTimeout&&!ut.getMoviePercent()||(yt=!0),n={type:!at&&Ot?"NO_FLASH":"INIT_TIMEOUT"},(_t||t)&&(ut.useFlashBlock&&ut.oMC&&(ut.oMC.className=F()+" "+(null===ut.getMoviePercent()?"swf_timedout":"swf_error")),v({type:"ontimeout",error:n,ignoreInit:!0}),S(n),i=!1),_t||(ut.waitForWindowLoad&&!wt?nt.add(e,"load",y):y()),i},u=function(){var e,n=ut.setupOptions;for(e in n)n.hasOwnProperty(e)&&(ut[e]===t?ut[e]=n[e]:ut[e]!==n[e]&&(ut.setupOptions[e]=ut[e]))},p=function(){if(yt)return!1;if(ut.html5Only)return yt||(nt.remove(e,"load",ut.beginDelayedInit),ut.enabled=!0,d()),!0;M();try{ct._externalInterfaceTest(!1),E(!0,ut.flashPollingInterval||(ut.useHighPerformance?10:50)),ut.debugMode||ct._disableDebug(),ut.enabled=!0,ut.html5Only||nt.add(e,"unload",l)}catch(t){return S({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),$(!0),d(),!1}return d(),nt.remove(e,"load",ut.beginDelayedInit),!0},x=function(){return A?!1:(A=!0,u(),R(),!at&&ut.hasHTML5&&ut.setup({useHTML5Audio:!0,preferFlash:!1}),tt(),!at&&Ot&&(xt.push(P.needFlash),ut.setup({flashLoadTimeout:1})),ft.removeEventListener&&ft.removeEventListener("DOMContentLoaded",x,!1),M(),!0)},et=function(){return"complete"===ft.readyState&&(x(),ft.detachEvent("onreadystatechange",et)),!0},O=function(){wt=!0,nt.remove(e,"load",O)},T=function(){Dt&&(ut.setupOptions.useHTML5Audio=!0,ut.setupOptions.preferFlash=!1,St||Et&&!dt.match(/android\s2\.3/i))&&(St&&(ut.ignoreFlash=!0),jt=!0)},T(),rt(),nt.add(e,"focus",C),nt.add(e,"load",_),nt.add(e,"load",O),ft.addEventListener?ft.addEventListener("DOMContentLoaded",x,!1):ft.attachEvent?ft.attachEvent("onreadystatechange",et):S({type:"NO_DOM2_EVENTS",fatal:!0})}var i=null;void 0!==e.SM2_DEFER&&SM2_DEFER||(i=new n),e.SoundManager=n,e.soundManager=i}(window),define("soundmanager2",function(e){return function(){var t;return t||e.soundManager}}(this)),define("text",["module"],function(e){var t,n,i,a,r,s=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],o=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,l=/
Please note, this is a STATIC archive of website www.digitalmarketer.com from 25 Apr 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
]*>\s*([\s\S]+)\s*<\/body>/im,u="undefined"!=typeof location&&location.href,p=u&&location.protocol&&location.protocol.replace(/\:/,""),c=u&&location.hostname,d=u&&(location.port||void 0),h={},f=e.config&&e.config()||{};return t={version:"2.0.10",strip:function(e){if(e){e=e.replace(o,"");var t=e.match(l);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:f.createXhr||function(){var e,t,n;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(t=0;3>t;t+=1){n=s[t];try{e=new ActiveXObject(n)}catch(i){}if(e){s=[n];break}}return e},parseName:function(e){var t,n,i,a=!1,r=e.indexOf("."),s=0===e.indexOf("./")||0===e.indexOf("../");return-1!==r&&(!s||r>1)?(t=e.substring(0,r),n=e.substring(r+1,e.length)):t=e,i=n||t,r=i.indexOf("!"),-1!==r&&(a="strip"===i.substring(r+1),i=i.substring(0,r),n?n=i:t=i),{moduleName:t,ext:n,strip:a}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,i,a){var r,s,o,l=t.xdRegExp.exec(e);return l?(r=l[2],s=l[3],s=s.split(":"),o=s[1],s=s[0],!(r&&r!==n||s&&s.toLowerCase()!==i.toLowerCase()||(o||s)&&o!==a)):!0},finishLoad:function(e,n,i,a){i=n?t.strip(i):i,f.isBuild&&(h[e]=i),a(i)},load:function(e,n,i,a){if(a.isBuild&&!a.inlineText)return void i();f.isBuild=a.isBuild;var r=t.parseName(e),s=r.moduleName+(r.ext?"."+r.ext:""),o=n.toUrl(s),l=f.useXhr||t.useXhr;return 0===o.indexOf("empty:")?void i():void(!u||l(o,p,c,d)?t.get(o,function(n){t.finishLoad(e,r.strip,n,i)},function(e){i.error&&i.error(e)}):n([s],function(e){t.finishLoad(r.moduleName+"."+r.ext,r.strip,e,i)}))},write:function(e,n,i){if(h.hasOwnProperty(n)){var a=t.jsEscape(h[n]);i.asModule(e+"!"+n,"define(function () { return '"+a+"';});\n")}},writeFile:function(e,n,i,a,r){var s=t.parseName(n),o=s.ext?"."+s.ext:"",l=s.moduleName+o,u=i.toUrl(s.moduleName+o)+".js";t.load(l,i,function(){var n=function(e){return a(u,e)};n.asModule=function(e,t){return a.asModule(e,u,t)},t.write(e,l,n,r)},r)}},"node"===f.env||!f.env&&"undefined"!=typeof process&&process.versions&&process.versions.node&&!process.versions["node-webkit"]?(n=require.nodeRequire("fs"),t.get=function(e,t,i){try{var a=n.readFileSync(e,"utf8");0===a.indexOf("")&&(a=a.substring(1)),t(a)}catch(r){i(r)}}):"xhr"===f.env||!f.env&&t.createXhr()?t.get=function(e,n,i,a){var r,s=t.createXhr();if(s.open("GET",e,!0),a)for(r in a)a.hasOwnProperty(r)&&s.setRequestHeader(r.toLowerCase(),a[r]);f.onXhr&&f.onXhr(s,e),s.onreadystatechange=function(){var t,a;4===s.readyState&&(t=s.status,t>399&&600>t?(a=new Error(e+" HTTP status: "+t),a.xhr=s,i(a)):n(s.responseText),f.onXhrComplete&&f.onXhrComplete(s,e))},s.send(null)}:"rhino"===f.env||!f.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java?t.get=function(e,t){var n,i,a="utf-8",r=new java.io.File(e),s=java.lang.System.getProperty("line.separator"),o=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(r),a)),l="";try{for(n=new java.lang.StringBuffer,i=o.readLine(),i&&i.length()&&65279===i.charAt(0)&&(i=i.substring(1)),null!==i&&n.append(i);null!==(i=o.readLine());)n.append(s),n.append(i);l=String(n.toString())}finally{o.close()}t(l)}:("xpconnect"===f.env||!f.env&&"undefined"!=typeof Components&&Components.classes&&Components.interfaces)&&(i=Components.classes,a=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),r="@mozilla.org/windows-registry-key;1"in i,t.get=function(e,t){var n,s,o,l={};r&&(e=e.replace(/\//g,"\\")),o=new FileUtils.File(e);try{n=i["@mozilla.org/network/file-input-stream;1"].createInstance(a.nsIFileInputStream),n.init(o,1,0,!1),s=i["@mozilla.org/intl/converter-input-stream;1"].createInstance(a.nsIConverterInputStream),s.init(n,"utf-8",n.available(),a.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),s.readString(n.available(),l),s.close(),n.close(),t(l.value)}catch(u){throw new Error((o&&o.path||"")+": "+u)}}),t}),define("text!templates/spp-template.html",[],function(){return'\r\n\r\n\r\n'}),define("text!templates/player-template.html",[],function(){return'<% if ( data.show_logo != undefined && data.show_logo != null ) { %>\r\n \r\n
\r\n
\r\n<% } %>\r\n\r\n\r\n
<%= data.show_name %>
\r\n
<%= data.title %>
\r\n
\r\n \r\n
\r\n\r\n
\r\n \r\n
\r\n <% if ( data.paid == true ) { %>\r\n <% if ( data.speedcontrol == true ) { %>\r\n \r\n <% } %>\r\n <% } %>\r\n \r\n \r\n \r\n
\r\n\r\n
Show Notes\r\n \r\n
'}),define("text!templates/podcast-track-template.html",[],function(){return'\r\n
<%= parseInt( data.episode_number, 10) %>
\r\n
<%= data.title_without_episode_number %>
\r\n
'}),define("text!templates/playlist-template.html",[],function(){return'\r\n\r\n'}),define("text!templates/playlist-header-template.html",[],function(){return""}),define("text!templates/playlist-footer-template.html",[],function(){return'\r\n<% if ( AP_Player.licensed == true ) { %>\r\n \r\n<% } else { %>\r\n \r\n<% } %>\r\n'}),define("text!templates/current-track-template.html",[],function(){return'\r\n\r\n
\r\n \r\n <%= show_notes %>\r\n
\r\n
\r\n
\r\n
\r\n
\r\n'}),define("apps/smart-podcast-player/core/view",["app","text!templates/spp-template.html","text!templates/player-template.html","text!templates/podcast-track-template.html","text!templates/playlist-template.html","text!templates/playlist-header-template.html","text!templates/playlist-footer-template.html","text!templates/current-track-template.html"],function(e,t){return e.module("AskPatPlayerApp.Core.View",function(e,n,i,a,r,s){e.AP_Player=a.Layout.extend({template:s.template(t),regions:{playerRegion:".spp-player-container",trackDetailsRegion:".spp-track-details-container",playlistRegion:".spp-playlist-container"},onRender:function(){this.$(".spp-player-container").show()}})}),e.AskPatPlayerApp.Core.View}),define("entities/podcast-track",["app"],function(e){e.module("Entities",function(e,t,n,i,a,r){var s=[],o=[],l=[];e.Player=n.Model.extend({defaults:{data:{}}}),e.Track=n.Model.extend({defaults:{data:{active:!1,artwork_url:"",attachments_uri:"",bpm:null,comment_count:0,commentable:!0,created_at:"",current_time:"0:00:00",description:"",download_count:0,download_url:"",downloadable:!0,download:!0,duration:0,duration_time:"0:00:00",episode_number:0,embeddable_by:"all",email:"",fallback_permalink:"",favoritings_count:0,genre:"",id:0,isrc:"",key_signature:"",kind:"track",label_id:null,label_name:"",license:"",method:"file",original_content_size:0,original_format:"mp3",paid:!1,permalink:"",permalink_url:"",playing:!1,playback_count:0,purchase_title:null,purchase_url:null,release:"",release_day:null,release_month:null,release_year:null,sharing:"",show_name:"",state:"",stream_url:"",streamable:!0,subscription:"",tag_list:"",tags:"",tag_string:"",title:"",track_type:"",uri:"",user:{avatar_url:"",id:0,kind:"user",permalink:"",permalink_url:"",uri:"",username:""},user_id:0,video_url:null,waveform_url:"",show_notes:""}}}),e.Tracks=n.Collection.extend({model:e.Track,comparators:{newest:function(e){return-e.get("id")},oldest:function(e){return e.get("id")},mostPopular:function(e){return-e.get("playback_count")},leastPopular:function(e){return e.get("playback_count")}},setComparator:function(e){return this.comparator=this.comparators[e],this},totalPlaybackCount:function(){return this.reduce(function(e,t){var n=t.get("data");return n.playback_count},0)}});var u=function(t){var n,i=t.model.get("options"),r=t.model.get("region"),o=i.stream,l=new Array,u={action:"get_soundcloud_tracks",stream:o};if(a.ajax({url:AP_Player.ajaxurl,dataType:"json",type:"POST",async:!1,data:u,success:function(e){n=e}}),void 0!=n&&null!=n){var p=n.length;a.each(n,function(n,a){var r=/(?:[^\s"]+|"[^"]*")+/g;if(void 0!==a.tag_list&&""!=a.tag_list.trim()){var s=a.tag_list.match(r);s=s.join(",").replace(/\"|\"|\"|\"/g,"").toLowerCase(),a.tag_string=s,s=s.split(","),a.tags=s}else a.tags=new Array;var o=Math.ceil(a.duration/1e3),u=Math.floor(o/60),c=Math.floor(u/60),d=c,h=u%60,f=o%60;if(a.duration_time=d+":"+pad(h,2)+":"+pad(f,2),a.playing=!1,a.paid=i.paid,void 0!=i.numbering){var m=i.numbering,g=(m.split("#").length-1,new RegExp("[#]{1,10}")),v=m.replace(g,"([0-9]{0,4})"),y=a.title.match(v);y&&(a.episode_number=y[1]);var _=new RegExp(v,"g");a.title_without_episode_number=a.title.replace(_,"")}else a.title_without_episode_number=a.title,a.episode_number=p;a.download=i.download,a.social=i.social,a.social_twitter=i.social_twitter,a.social_facebook=i.social_facebook,a.social_gplus=i.social_gplus,a.social_linkedin=i.social_linkedin,a.social_stumble=i.social_stumble,a.social_pinterest=i.social_pinterest,a.social_email=i.social_email,a.poweredby=i.poweredby,a.speedcontrol=i.speedcontrol,a.show_logo=void 0!==i.show_image?i.show_image:a.artwork_url,a.show_name=i.show_name,a.hashtag=i.hashtag,a.fallback_permalink=void 0!=i.permalink?i.permalink:"",a.email="?subject=",a.email+=void 0!==a.show_name?": "+encodeURIComponent(a.title)+"&body=Hi,%0D%0A%0D%0AI thought you might enjoy this episode of "+a.show_name+":%0D%0A%0D%0A"+a.title+"%0D%0A":": "+encodeURIComponent(a.title)+"&body=Hi,%0D%0A%0D%0AI thought you might enjoy this podcast:%0D%0A%0D%0A"+a.title+"%0D%0A",a.email+=""!=a.permalink_url?a.permalink_url+"%0D%0A%0D%0AEnjoy!":a.fallback_permalink+"%0D%0A%0D%0AEnjoy!",a.method=a.permalink_url.indexOf("soundcloud.com")>0?"soundcloud":"file";var w=/\n/g;if("soundcloud"==a.method){a.show_notes=""+a.description+"
",a.show_notes=replaceURLWithHTMLLinks(a.show_notes),a.show_notes=a.show_notes.replace(w,"
");var b=/
\s*<\/p>/g;a.show_notes=a.show_notes.replace(b,"")}else a.show_notes=a.description;void 0!=t.model.attributes.options.subscription&&(a.subscription=t.model.attributes.options.subscription),a.stream_url=a.stream_url.indexOf("&")>-1?a.stream_url.slice(0,a.stream_url.indexOf("&")):a.stream_url;var k={data:a},C=new e.Track(k),P=C.get("data");P.cid=C.cid,C.set({data:P}),l.push(C),p--})}"oldest"==t.model.attributes.options.sort&&l.reverse(),s[r]=new e.Tracks(l)},p=function(t,n,i){var a=t.model.get("region");if(""==i)l[a]=s[a];else{var o=n.filter(function(e){{var t=e.get("data");t.tags}return r.indexOf(t.tags,i)>-1});l[a]=new e.Tracks(o)}return l[a]},c=function(t,n,i,r){var s=t.model.get("region"),o=new Array,u=(i-1)*r,p=i*r;return a.each(n.models,function(e,t){e>=u&&p>e&&o.push(t)}),l[s]=new e.Tracks(o),l[s]},d=function(e){var t=e.model.get("region");void 0===o[t]&&f(e);var n=o[t].find(function(e){var t=e.attributes.data;return t.playing===!0});return n?n:o[t].first()},h=function(e,t){var n=e.find(function(e){var n=e.attributes.data;return n.id===t});return n?n:-1},f=function(e){var t=e.model.get("region");return void 0===o[t]&&(void 0===s[t]&&u(e),o[t]=s[t]),o[t]},m={getTrackEntities:function(e){var t=e.model.get("region");return void 0===s[t]&&u(e),s[t]},getCurrentTrack:function(e){return d(e)},getPagedTracks:function(e,t,n,i){return c(e,t,n,i)},getCurrentTracks:function(e){return f(e)},getTracksByTag:function(e,t,n){var i=e.model.get("region");return l[i]=p(e,t,n),o[i]=l[i],l[i]},setValueAll:function(e,t,n){var i=e.model.get("region");void 0===o[i]&&f(e),s[i].each(function(e){var i=e.get("data");i[t]=n,e.set({data:i})}),o[i].each(function(e){var i=e.get("data");i[t]=n,e.set({data:i})})},setValue:function(e,t,n,i){var a=e.model.get("region");void 0===o[a]&&f(e);var r=h(s[a],t.attributes.data.id),l=h(o[a],t.attributes.data.id),u=o[a].at(o[a].indexOf(l)),p=u.get("data");p[n]=i;var c=(s[a].at(s[a].indexOf(r)),u.get("data"));c[n]=i}};t.reqres.setHandler("track:entities",function(e){return m.getTrackEntities(e)}),t.reqres.setHandler("track:entity:current",function(e){return m.getCurrentTrack(e)}),t.reqres.setHandler("track:entities:current",function(e){return m.getCurrentTracks(e)}),t.reqres.setHandler("track:entities:paged",function(e,t,n,i){return m.getPagedTracks(e,t,n,i)}),t.reqres.setHandler("track:entities:tagged",function(e,t,n){return m.getTracksByTag(e,t,n)}),t.reqres.setHandler("track:entities:set",function(e,t,n){m.setValueAll(e,t,n)}),t.reqres.setHandler("track:entity:set",function(e,t,n,i){m.setValue(e,t,n,i)})})}),define("entities/podcast-player",["app","entities/podcast-track"],function(e){return e.module("Entities",function(e,t){var n=[],i=function(e){var i=e.model.get("region");
n[i]=t.request("track:entity:current",e)},a={getPlayerEntities:function(e){var t=e.model.get("region");return void 0===n[t]&&i(e),n[t]}};t.reqres.setHandler("player:entity",function(e){return a.getPlayerEntities(e)})}),e.Entities}),define("apps/smart-podcast-player/core/controller",["app","apps/smart-podcast-player/core/view","entities/podcast-track","entities/podcast-player","soundmanager2"],function(e,t){return e.module("AskPatPlayerApp.Core",function(e,n,i,a,r){e.Controller={init:function(){r(".smart-podcast-player").length>0&&n.trigger("core:color:setup"),r(".smart-podcast-player").each(function(e,a){var s="SPP_"+e,o=new t.AP_Player({model:new i.Model({region:s,options:{stream:r(a).data("stream"),sort:r(a).data("sort"),show_name:r(a).data("showName"),color:r(a).data("color"),link_color:r(a).data("link_color"),numbering:r(a).data("numbering"),download:r(a).data("download"),subscription:r(a).data("subscription"),show_image:r(a).data("image"),player_uid:r(a).data("uid"),hashtag:r(a).data("hashtag"),social:r(a).data("social"),social_twitter:r(a).data("social_twitter"),social_facebook:r(a).data("social_facebook"),social_gplus:r(a).data("social_gplus"),social_linkedin:r(a).data("social_linkedin"),social_stumble:r(a).data("social_stumble"),social_pinterest:r(a).data("social_pinterest"),social_email:r(a).data("social_email"),poweredby:r(a).data("poweredby"),speedcontrol:r(a).data("speedcontrol"),permalink:r(a).data("permalink"),current_page:1,tracks_per_page:10,paid:r(a).data("paid"),consumer_key:AP_Player.soundcloudConsumerKey}})}),l=new i.Marionette.Region({el:r(a)});n.regions=n.regions?n.regions:{},n[s]=l,n.trigger("playlist:init",o),n.trigger("track-details:init",o),n.trigger("player:init",o),n[s].show(o);var u="?spp_view=1",p=o.model.get("options");u+="&url="+(void 0!=p.stream?p.stream:""),u+="&sort="+(void 0!=p.sort?encodeURIComponent(p.sort):""),u+="&numbering="+(void 0!=p.numbering?encodeURIComponent(p.numbering):""),u+="&download="+(void 0!=p.download?encodeURIComponent(p.download):""),u+="&subscription="+(void 0!=p.subscription?p.subscription:""),u+="&show_name="+(void 0!=p.show_name?encodeURIComponent(p.show_name):""),u+="&image="+(void 0!=p.image?encodeURIComponent(p.image):""),u+="&social="+(void 0!=p.social?encodeURIComponent(p.social):""),u+="&poweredby="+(void 0!=p.poweredby?encodeURIComponent(p.poweredby):""),u+="&speedcontrol="+(void 0!=p.speedcontrol?encodeURIComponent(p.speedcontrol):""),u+="&color="+(void 0!=p.color?encodeURIComponent(p.color):""),u+="&link_color="+(void 0!=p.link_color?encodeURIComponent(p.link_color):""),u+="&subscription="+(void 0!=p.subscription?encodeURIComponent(p.subscription):"")})},setupColors:function(){var e=new Array,t=new Array;r(".smart-podcast-player").each(function(n,i){var a=r(i).attr("class"),s=a.trim().split(/\s+/);r.each(s,function(n,i){var a=i.indexOf("spp-color-");if(a>-1){var s=i.replace("spp-color-","");-1==r.inArray(s,e)&&e.push(s)}var a=i.indexOf("spp-link-color-");if(a>-1){var s=i.replace("spp-link-color-","");-1==r.inArray(s,t)&&t.push(s)}})});var n={action:"get_colors",spp_colors:e,spp_link_colors:t};r.post(AP_Player.ajaxurl,n,function(e){r("head").append(e)})}}}),e.AskPatPlayerApp.Core.Controller}),define("apps/smart-podcast-player/playlist/view",["app","text!templates/podcast-track-template.html","text!templates/playlist-template.html","text!templates/playlist-header-template.html","text!templates/playlist-footer-template.html"],function(e,t,n,i,a){return e.module("AskPatPlayerApp.Playlist.View",function(e,r,s,o,l,u){e.Track=o.ItemView.extend({template:u.template(t),className:"spp-track",triggers:{"click .spp-play":"track:play","click .spp-track-title":"track:preview"},modelEvents:{change:"render"},events:{},initialize:function(){this.spp_elements={spp:null,loaded_container:null,loaded:null,duration:null,position:null,current_time:null};var e=this.model.get("data"),t="track_"+this.model.cid,n=(e.stream_url+"?consumer_key="+AP_Player.soundcloudConsumerKey,soundManager.getSoundById(t));n||this.createSound()},createSound:function(){var e=this,t=this.model.get("data"),n="track_"+this.model.cid,i=t.stream_url+"?consumer_key="+AP_Player.soundcloudConsumerKey;soundManager.createSound({id:n,url:i,hover:!1,onplay:function(){e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),l(e.spp_elements.spp).addClass("spp-playing")},onresume:function(){e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),l(e.spp_elements.spp).addClass("spp-playing")},onpause:function(){e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),l(e.spp_elements.spp).removeClass("spp-playing")},onfinish:function(){e.trigger("track:next")},whileloading:function(){var t=this.bytesLoaded/this.bytesTotal*100+"%";e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),e.spp_elements.loaded_container=null!==e.spp_elements.loaded_container?e.spp_elements.loaded_container:l(e.spp_elements.spp).find(".spp-loaded-container"),e.spp_elements.loaded=null!==e.spp_elements.loaded?e.spp_elements.loaded:l(e.spp_elements.loaded_container).find(".spp-loaded"),l(e.spp_elements.loaded).css({width:t}),this.bytesLoaded/this.bytesTotal>.98&&l(e.spp_elements.loaded_container).fadeOut("slow")},whileplaying:function(){var t,n,i,a,r=this.durationEstimate,s=this.position,o=r-s;t=s/1e3,n=t/60,i=n/60,a=Math.floor(i)+":"+pad(Math.floor(n%60),2)+":"+pad(Math.floor(t%60),2),t=o/1e3,n=t/60,i=n/60,remaining_time=pad(Math.floor(n),2)+":"+pad(Math.floor(t%60),2),e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),e.spp_elements.duration=null!==e.spp_elements.duration?e.spp_elements.duration:l(e.spp_elements.spp).find(".spp-duration"),e.spp_elements.current_time=null!==e.spp_elements.current_time?e.spp_elements.current_time:l(e.spp_elements.spp).find(".spp-current-time"),e.spp_elements.position=null!==e.spp_elements.position?e.spp_elements.position:l(e.spp_elements.spp).find(".spp-position"),l(e.spp_elements.duration).text("-"+remaining_time);var u=s/r*100;e.trigger("track:progress:update",u),l(e.spp_elements.current_time).css({width:u+"%"});var p=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);(!l(e.spp_elements.spp).hasClass("hover")||p)&&l(e.spp_elements.position).css({left:u+"%"})}})},onRender:function(){var e=this.model.get("data"),t="track_"+this.model.cid;e.active===!0&&this.$el.addClass("active"),this.$el.attr("data-tid",t)}}),e.Tracks=o.CollectionView.extend({itemView:e.Track,className:"spp-track-list",initialize:function(){var e=this;l(window).on("spp_resize",function(){e.resize()})},resize:function(){this.trigger("resize")}}),e.PlaylistRegion=o.Layout.extend({template:u.template(n),className:"spp-playlist",regions:{headerRegion:".spp-playlist-header",tracksRegion:".spp-playlist-tracks",footerRegion:".spp-playlist-footer"}}),e.PlaylistHeader=o.ItemView.extend({template:u.template(i),className:"spp-playlist-header",initialize:function(){this.render()},triggers:{"click h3 span":"tracks:filter","change .spp-playlist-sorter":"tracks:sort"},events:{"click .spp-playlist-tag":"filterTag"},filterTag:function(e){this.trigger("playlist:filter",l(e.currentTarget).text())}}),e.PlaylistFooter=o.ItemView.extend({template:u.template(a),className:"spp-playlist-footer",triggers:{"click .spp-playlist-next-page":"nav:next-page","click .spp-playlist-prev-page":"nav:prev-page","click .spp-sort":"playlist:sort"},initialize:function(){this.render()}})}),e.AskPatPlayerApp.Playlist.View}),define("entities/playlist",["app","entities/podcast-track"],function(e){return e.module("Entities",function(e,t,n){var i=[],a=[];e.PlaylistHeader=n.Model.extend({defaults:{data:{}}}),e.PlaylistFooter=n.Model.extend({defaults:{data:{}}});var r=function(t){var n=t.model.get("region");i[n]=new e.PlaylistHeader({})},s=function(n){var i=t.request("track:entities",n),r=n.model.get("region"),s=n.model.get("options"),o={current_page:1,num_pages:Math.ceil(i.length/s.tracks_per_page)};a[r]=new e.PlaylistFooter({data:o})},o={getPlaylistHeader:function(e){var t=e.model.get("region");return void 0===i[t]&&r(e),i[t]},getPlaylistFooter:function(e){var t=e.model.get("region");return void 0===a[t]&&s(e),a[t]}};t.reqres.setHandler("playlist:header",function(e){return o.getPlaylistHeader(e)}),t.reqres.setHandler("playlist:footer",function(e){return o.getPlaylistFooter(e)})}),e.Entities}),function(e){function t(){this===a.elem&&(a.pos=[-260,-260],a.elem=!1,r=3)}var n,i,a={pos:[-260,-260]},r=3,s=document,o=s.documentElement,l=s.body;e.event.special.mwheelIntent={setup:function(){var n=e(this).bind("mousewheel",e.event.special.mwheelIntent.handler);return this!==s&&this!==o&&this!==l&&n.bind("mouseleave",t),n=null,!0},teardown:function(){return e(this).unbind("mousewheel",e.event.special.mwheelIntent.handler).unbind("mouseleave",t),!0},handler:function(t){var s=[t.clientX,t.clientY];return this===a.elem||Math.abs(a.pos[0]-s[0])>r||Math.abs(a.pos[1]-s[1])>r?(a.elem=this,a.pos=s,r=250,clearTimeout(i),i=setTimeout(function(){r=10},200),clearTimeout(n),n=setTimeout(function(){r=3},1500),t=e.extend({},t,{type:"mwheelIntent"}),(e.event.dispatch||e.event.handle).apply(this,arguments)):void 0}},e.fn.extend({mwheelIntent:function(e){return e?this.bind("mwheelIntent",e):this.trigger("mwheelIntent")},unmwheelIntent:function(e){return this.unbind("mwheelIntent",e)}}),e(function(){l=s.body,e(s).bind("mwheelIntent.mwheelIntentDefault",e.noop)})}(jQuery),define("mwheel-intent",function(){}),function(e){"function"==typeof define&&define.amd?define("vendor/jquery.mousewheel",["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var s=t||window.event,o=l.call(arguments,1),u=0,p=0,c=0,d=0;if(t=e.event.fix(s),t.type="mousewheel","detail"in s&&(c=-1*s.detail),"wheelDelta"in s&&(c=s.wheelDelta),"wheelDeltaY"in s&&(c=s.wheelDeltaY),"wheelDeltaX"in s&&(p=-1*s.wheelDeltaX),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(p=-1*c,c=0),u=0===c?p:c,"deltaY"in s&&(c=-1*s.deltaY,u=c),"deltaX"in s&&(p=s.deltaX,0===c&&(u=-1*p)),0!==c||0!==p){if(1===s.deltaMode){var h=e.data(this,"mousewheel-line-height");u*=h,c*=h,p*=h}else if(2===s.deltaMode){var f=e.data(this,"mousewheel-page-height");u*=f,c*=f,p*=f}return d=Math.max(Math.abs(c),Math.abs(p)),(!r||r>d)&&(r=d,i(s,d)&&(r/=40)),i(s,d)&&(u/=40,p/=40,c/=40),u=Math[u>=1?"floor":"ceil"](u/r),p=Math[p>=1?"floor":"ceil"](p/r),c=Math[c>=1?"floor":"ceil"](c/r),t.deltaX=p,t.deltaY=c,t.deltaFactor=r,t.deltaMode=0,o.unshift(t,u,p,c),a&&clearTimeout(a),a=setTimeout(n,200),(e.event.dispatch||e.event.handle).apply(this,o)}}function n(){r=null}function i(e,t){return p.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var a,r,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],o="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var u=s.length;u;)e.event.fixHooks[s[--u]]=e.event.mouseHooks;var p=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var n=o.length;n;)this.addEventListener(o[--n],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",p.getLineHeight(this)),e.data(this,"mousewheel-page-height",p.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=o.length;e;)this.removeEventListener(o[--e],t,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),!function(e,t,n){e.fn.jScrollPane=function(i){function a(i,a){function r(t){var a,o,u,c,d,h,g=!1,v=!1;if(B=t,V===n)d=i.scrollTop(),h=i.scrollLeft(),i.css({overflow:"hidden",padding:0}),z=i.innerWidth()+_t,U=i.innerHeight(),i.width(z),V=e('
').css("padding",yt).append(i.children()),N=e('').css({width:z+"px",height:U+"px"}).append(V).appendTo(i);else{if(i.css("width",""),g=B.stickToBottom&&O(),v=B.stickToRight&&A(),c=i.innerWidth()+_t!=z||i.outerHeight()!=U,c&&(z=i.innerWidth()+_t,U=i.innerHeight(),N.css({width:z+"px",height:U+"px"})),!c&&wt==W&&V.outerHeight()==X)return void i.width(z);wt=W,V.css("width",""),i.width(z),N.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}V.css("overflow","auto"),W=t.contentWidth?t.contentWidth:V[0].scrollWidth,X=V[0].scrollHeight,V.css("overflow",""),Y=W/z,Q=X/U,J=Q>1,G=Y>1,G||J?(i.addClass("jspScrollable"),a=B.maintainPosition&&(et||it),a&&(o=T(),u=x()),s(),l(),p(),a&&(P(v?W-z:o,!1),C(g?X-U:u,!1)),E(),j(),q(),B.enableKeyboardNavigation&&L(),B.clickOnTrack&&f(),H(),B.hijackInternalLinks&&D()):(i.removeClass("jspScrollable"),V.css({top:0,left:0,width:N.width()-_t}),I(),R(),$(),m()),B.autoReinitialise&&!vt?vt=setInterval(function(){r(B)},B.autoReinitialiseDelay):!B.autoReinitialise&&vt&&clearInterval(vt),d&&i.scrollTop(0)&&C(d,!1),h&&i.scrollLeft(0)&&P(h,!1),i.trigger("jsp-initialised",[G||J])}function s(){J&&(N.append(e('').append(e(''),e('').append(e('').append(e(''),e(''))),e(''))),at=N.find(">.jspVerticalBar"),rt=at.find(">.jspTrack"),K=rt.find(">.jspDrag"),B.showArrows&&(ut=e('').bind("mousedown.jsp",d(0,-1)).bind("click.jsp",S),pt=e('').bind("mousedown.jsp",d(0,1)).bind("click.jsp",S),B.arrowScrollOnHover&&(ut.bind("mouseover.jsp",d(0,-1,ut)),pt.bind("mouseover.jsp",d(0,1,pt))),c(rt,B.verticalArrowPositions,ut,pt)),ot=U,N.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){ot-=e(this).outerHeight()}),K.hover(function(){K.addClass("jspHover")},function(){K.removeClass("jspHover")}).bind("mousedown.jsp",function(t){e("html").bind("dragstart.jsp selectstart.jsp",S),K.addClass("jspActive");var n=t.pageY-K.position().top;return e("html").bind("mousemove.jsp",function(e){v(e.pageY-n,!1)}).bind("mouseup.jsp mouseleave.jsp",g),!1}),o())}function o(){rt.height(ot+"px"),et=0,st=B.verticalGutter+rt.outerWidth(),V.width(z-st-_t);try{0===at.position().left&&V.css("margin-left",st+"px")}catch(e){}}function l(){G&&(N.append(e('').append(e(''),e('').append(e('').append(e(''),e(''))),e(''))),ct=N.find(">.jspHorizontalBar"),dt=ct.find(">.jspTrack"),tt=dt.find(">.jspDrag"),B.showArrows&&(mt=e('').bind("mousedown.jsp",d(-1,0)).bind("click.jsp",S),gt=e('').bind("mousedown.jsp",d(1,0)).bind("click.jsp",S),B.arrowScrollOnHover&&(mt.bind("mouseover.jsp",d(-1,0,mt)),gt.bind("mouseover.jsp",d(1,0,gt))),c(dt,B.horizontalArrowPositions,mt,gt)),tt.hover(function(){tt.addClass("jspHover")},function(){tt.removeClass("jspHover")}).bind("mousedown.jsp",function(t){e("html").bind("dragstart.jsp selectstart.jsp",S),tt.addClass("jspActive");var n=t.pageX-tt.position().left;return e("html").bind("mousemove.jsp",function(e){_(e.pageX-n,!1)}).bind("mouseup.jsp mouseleave.jsp",g),!1}),ht=N.innerWidth(),u())}function u(){N.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){ht-=e(this).outerWidth()}),dt.width(ht+"px"),it=0}function p(){if(G&&J){var t=dt.outerHeight(),n=rt.outerWidth();ot-=t,e(ct).find(">.jspCap:visible,>.jspArrow").each(function(){ht+=e(this).outerWidth()}),ht-=n,U-=n,z-=t,dt.parent().append(e('').css("width",t+"px")),o(),u()}G&&V.width(N.outerWidth()-_t+"px"),X=V.outerHeight(),Q=X/U,G&&(ft=Math.ceil(1/Y*ht),ft>B.horizontalDragMaxWidth?ft=B.horizontalDragMaxWidth:ftB.verticalDragMaxHeight?lt=B.verticalDragMaxHeight:lts)et-p>n?bt.scrollByY(-r):v(n);else{if(!(s>0))return void u();n>et+p?bt.scrollByY(r):v(n)}i=setTimeout(l,o?B.initialDelay:B.trackClickRepeatFreq),o=!1},u=function(){i&&clearTimeout(i),i=null,e(document).unbind("mouseup.jsp",u)};return l(),e(document).bind("mouseup.jsp",u),!1}}),G&&dt.bind("mousedown.jsp",function(t){if(t.originalTarget===n||t.originalTarget==t.currentTarget){var i,a=e(this),r=a.offset(),s=t.pageX-r.left-it,o=!0,l=function(){var e=a.offset(),n=t.pageX-e.left-ft/2,r=z*B.scrollPagePercent,p=nt*r/(W-z);if(0>s)it-p>n?bt.scrollByX(-r):_(n);else{if(!(s>0))return void u();n>it+p?bt.scrollByX(r):_(n)}i=setTimeout(l,o?B.initialDelay:B.trackClickRepeatFreq),o=!1},u=function(){i&&clearTimeout(i),i=null,e(document).unbind("mouseup.jsp",u)};return l(),e(document).bind("mouseup.jsp",u),!1}})}function m(){dt&&dt.unbind("mousedown.jsp"),rt&&rt.unbind("mousedown.jsp")}function g(){e("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp"),K&&K.removeClass("jspActive"),tt&&tt.removeClass("jspActive")}function v(e,t){J&&(0>e?e=0:e>Z&&(e=Z),t===n&&(t=B.animateScroll),t?bt.animate(K,"top",e,y):(K.css("top",e),y(e)))}function y(e){e===n&&(e=K.position().top),N.scrollTop(0),et=e;var t=0===et,a=et==Z,r=e/Z,s=-r*(X-U);(kt!=t||Pt!=a)&&(kt=t,Pt=a,i.trigger("jsp-arrow-change",[kt,Pt,Ct,Mt])),b(t,a),V.css("top",s),i.trigger("jsp-scroll-y",[-s,t,a]).trigger("scroll")}function _(e,t){G&&(0>e?e=0:e>nt&&(e=nt),t===n&&(t=B.animateScroll),t?bt.animate(tt,"left",e,w):(tt.css("left",e),w(e)))}function w(e){e===n&&(e=tt.position().left),N.scrollTop(0),it=e;var t=0===it,a=it==nt,r=e/nt,s=-r*(W-z);(Ct!=t||Mt!=a)&&(Ct=t,Mt=a,i.trigger("jsp-arrow-change",[kt,Pt,Ct,Mt])),k(t,a),V.css("left",s),i.trigger("jsp-scroll-x",[-s,t,a]).trigger("scroll")}function b(e,t){B.showArrows&&(ut[e?"addClass":"removeClass"]("jspDisabled"),pt[t?"addClass":"removeClass"]("jspDisabled"))}function k(e,t){B.showArrows&&(mt[e?"addClass":"removeClass"]("jspDisabled"),gt[t?"addClass":"removeClass"]("jspDisabled"))}function C(e,t){var n=e/(X-U);v(n*Z,t)}function P(e,t){var n=e/(W-z);_(n*nt,t)}function M(t,n,i){var a,r,s,o,l,u,p,c,d,h=0,f=0;try{a=e(t)}catch(m){return}for(r=a.outerHeight(),s=a.outerWidth(),N.scrollTop(0),N.scrollLeft(0);!a.is(".jspPane");)if(h+=a.position().top,f+=a.position().left,a=a.offsetParent(),/^body|html$/i.test(a[0].nodeName))return;o=x(),u=o+U,o>h||n?c=h-B.horizontalGutter:h+r>u&&(c=h-U+r+B.horizontalGutter),isNaN(c)||C(c,i),l=T(),p=l+z,l>f||n?d=f-B.horizontalGutter:f+s>p&&(d=f-z+s+B.horizontalGutter),isNaN(d)||P(d,i)}function T(){return-V.position().left}function x(){return-V.position().top}function O(){var e=X-U;return e>20&&e-x()<10}function A(){var e=W-z;return e>20&&e-T()<10}function j(){N.unbind(xt).bind(xt,function(e,t,n,i){var a=it,r=et,s=e.deltaFactor||B.mouseWheelSpeed;return bt.scrollBy(n*s,-i*s,!1),a==it&&r==et})}function I(){N.unbind(xt)}function S(){return!1}function E(){V.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(e){M(e.target,!1)})}function R(){V.find(":input,a").unbind("focus.jsp")}function L(){function t(){var e=it,t=et;switch(n){case 40:bt.scrollByY(B.keyboardSpeed,!1);break;case 38:bt.scrollByY(-B.keyboardSpeed,!1);break;case 34:case 32:bt.scrollByY(U*B.scrollPagePercent,!1);break;case 33:bt.scrollByY(-U*B.scrollPagePercent,!1);break;case 39:bt.scrollByX(B.keyboardSpeed,!1);break;case 37:bt.scrollByX(-B.keyboardSpeed,!1)}return a=e!=it||t!=et}var n,a,r=[];G&&r.push(ct[0]),J&&r.push(at[0]),V.focus(function(){i.focus()}),i.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(i){if(i.target===this||r.length&&e(i.target).closest(r).length){var s=it,o=et;switch(i.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:n=i.keyCode,t();break;case 35:C(X-U),n=null;break;case 36:C(0),n=null}return a=i.keyCode==n&&s!=it||o!=et,!a}}).bind("keypress.jsp",function(e){return e.keyCode==n&&t(),!a}),B.hideFocus?(i.css("outline","none"),"hideFocus"in N[0]&&i.attr("hideFocus",!0)):(i.css("outline",""),"hideFocus"in N[0]&&i.attr("hideFocus",!1))}function $(){i.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function H(){if(location.hash&&location.hash.length>1){var t,n,i=escape(location.hash.substr(1));try{t=e("#"+i+', a[name="'+i+'"]')}catch(a){return}t.length&&V.find(i)&&(0===N.scrollTop()?n=setInterval(function(){N.scrollTop()>0&&(M(t,!0),e(document).scrollTop(N.position().top),clearInterval(n))},50):(M(t,!0),e(document).scrollTop(N.position().top)))}}function D(){e(document.body).data("jspHijack")||(e(document.body).data("jspHijack",!0),e(document.body).delegate("a[href*=#]","click",function(n){var i,a,r,s,o,l,u=this.href.substr(0,this.href.indexOf("#")),p=location.href;if(-1!==location.href.indexOf("#")&&(p=location.href.substr(0,location.href.indexOf("#"))),u===p){i=escape(this.href.substr(this.href.indexOf("#")+1));try{a=e("#"+i+', a[name="'+i+'"]')}catch(c){return}a.length&&(r=a.closest(".jspScrollable"),s=r.data("jsp"),s.scrollToElement(a,!0),r[0].scrollIntoView&&(o=e(t).scrollTop(),l=a.offset().top,(o>l||l>o+e(t).height())&&r[0].scrollIntoView()),n.preventDefault())}}))}function q(){var e,t,n,i,a,r=!1;N.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(s){var o=s.originalEvent.touches[0];e=T(),t=x(),n=o.pageX,i=o.pageY,a=!1,r=!0}).bind("touchmove.jsp",function(s){if(r){var o=s.originalEvent.touches[0],l=it,u=et;return bt.scrollTo(e+n-o.pageX,t+i-o.pageY),a=a||Math.abs(n-o.pageX)>5||Math.abs(i-o.pageY)>5,l==it&&u==et}}).bind("touchend.jsp",function(){r=!1}).bind("click.jsp-touchclick",function(){return a?(a=!1,!1):void 0})}function F(){var e=x(),t=T();i.removeClass("jspScrollable").unbind(".jsp"),i.replaceWith(Tt.append(V.children())),Tt.scrollTop(e),Tt.scrollLeft(t),vt&&clearInterval(vt)}var B,V,z,U,N,W,X,Y,Q,J,G,K,Z,et,tt,nt,it,at,rt,st,ot,lt,ut,pt,ct,dt,ht,ft,mt,gt,vt,yt,_t,wt,bt=this,kt=!0,Ct=!0,Pt=!1,Mt=!1,Tt=i.clone(!1,!1).empty(),xt=e.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";"border-box"===i.css("box-sizing")?(yt=0,_t=0):(yt=i.css("paddingTop")+" "+i.css("paddingRight")+" "+i.css("paddingBottom")+" "+i.css("paddingLeft"),_t=(parseInt(i.css("paddingLeft"),10)||0)+(parseInt(i.css("paddingRight"),10)||0)),e.extend(bt,{reinitialise:function(t){t=e.extend({},B,t),r(t)},scrollToElement:function(e,t,n){M(e,t,n)},scrollTo:function(e,t,n){P(e,n),C(t,n)},scrollToX:function(e,t){P(e,t)},scrollToY:function(e,t){C(e,t)},scrollToPercentX:function(e,t){P(e*(W-z),t)},scrollToPercentY:function(e,t){C(e*(X-U),t)},scrollBy:function(e,t,n){bt.scrollByX(e,n),bt.scrollByY(t,n)},scrollByX:function(e,t){var n=T()+Math[0>e?"floor":"ceil"](e),i=n/(W-z);_(i*nt,t)},scrollByY:function(e,t){var n=x()+Math[0>e?"floor":"ceil"](e),i=n/(X-U);v(i*Z,t)},positionDragX:function(e,t){_(e,t)},positionDragY:function(e,t){v(e,t)},animate:function(e,t,n,i){var a={};a[t]=n,e.animate(a,{duration:B.animateDuration,easing:B.animateEase,queue:!1,step:i})},getContentPositionX:function(){return T()},getContentPositionY:function(){return x()},getContentWidth:function(){return W},getContentHeight:function(){return X},getPercentScrolledX:function(){return T()/(W-z)},getPercentScrolledY:function(){return x()/(X-U)},getIsScrollableH:function(){return G},getIsScrollableV:function(){return J},getContentPane:function(){return V},scrollToBottom:function(e){v(Z,e)},hijackInternalLinks:e.noop,destroy:function(){F()}}),r(a)}return i=e.extend({},e.fn.jScrollPane.defaults,i),e.each(["arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){i[this]=i[this]||i.speed}),this.each(function(){var t=e(this),n=t.data("jsp");n?n.reinitialise(i):(e("script",t).filter('[type="text/javascript"],:not([type])').remove(),n=new a(t,i),t.data("jsp",n))})},e.fn.jScrollPane.defaults={showArrows:!1,maintainPosition:!0,stickToBottom:!1,stickToRight:!1,clickOnTrack:!0,autoReinitialise:!1,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:n,animateScroll:!1,animateDuration:300,animateEase:"linear",hijackInternalLinks:!1,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:3,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:!1,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:!0,hideFocus:!1,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:.8}}(jQuery,this),define("vendor/jquery.jscrollpane.min",function(){}),define("apps/smart-podcast-player/playlist/controller",["app","apps/smart-podcast-player/playlist/view","entities/podcast-track","entities/playlist","vendor/jquery.jscrollpane.min","vendor/jquery.mousewheel"],function(e,t){return e.module("AskPatPlayerApp.Playlist",function(e,n,i,a,r){var s=[],o=[],l=[],u=[],p=[],c=[],d=[],h=[],f=[];e.Controller={init:function(e){var i=e.model.get("region"),a=e.model.get("options");s[i]=void 0===s[i]?n.request("track:entities",e):s[i],o[i]=void 0===o[i]?n.request("track:entities:current",e):o[i],l[i]=void 0===l[i]?n.request("track:entities:paged",e,o[i],a.current_page,a.tracks_per_page):l[i],u[i]=void 0===u[i]?[]:u[i],p[i]=n.request("playlist:header",e),c[i]=n.request("playlist:footer",e);var m=new t.PlaylistRegion({}),g=new t.Tracks({collection:l[i]}),v=new t.PlaylistHeader({model:p[i]}),y=new t.PlaylistFooter({model:c[i]});m.on("show",function(){m.headerRegion.show(v),m.tracksRegion.show(g),m.footerRegion.show(y)}),v.on("playlist:filter",function(t){t=t.replace("×",""),n.trigger("playlist:filter",e,t)}),v.on("show",function(){this.$el.addClass("spp-empty")}),g.on("resize",function(){g.$el.removeData("jsp").removeClass("jspScrollable"),g.$(".jspContainer").remove(),g.$el.attr("style",""),this.render()}),g.on("show",function(){window.innerWidth>768&&this.$el.jScrollPane()}),g.on("playlist:sort",function(){var t=o[i].models;o[i].models=t.reverse(),a.current_page=1,l[i]=n.request("track:entities:paged",e,o[i],a.current_page,a.tracks_per_page),g.collection=l[i],g.render()}),g.on("render",function(){var e=v.$el.outerHeight();window.innerWidth>768?(this.$el.height(449-e),this.$el.jScrollPane()):this.$el.height("auto")}),g.on("itemview:track:loading",function(e,t){var n=(r(".spp-loaded-container"),r(".spp-loaded"));r(n).width(t)}),g.on("itemview:track:next",function(){o[i]=n.request("track:entities:current",e);var t=n.request("track:entity:current",e);t||(t=o[i].first());var a=o[i].indexOf(t),r=a1&&(a.current_page=a.current_page-1,l[i]=n.request("track:entities:paged",e,o[i],a.current_page,a.tracks_per_page),g.collection=l[i],g.render()),y.model.attributes.data.current_page=a.current_page,y.render()}),g.on("paging:goto:track",function(t){o[i]=n.request("track:entities:current",e);var r=(Math.ceil(o[i].length/a.tracks_per_page),o[i].indexOf(t)),s=r+10?c:1,l[i]=n.request("track:entities:paged",e,o[i],a.current_page,a.tracks_per_page),g.collection=l[i],g.render(),y.model.attributes.data.current_page=a.current_page,y.render())}),y.on("playlist:sort",function(){g.trigger("playlist:sort"),this.$(".spp-sort").toggleClass("spp-sort-reverse")}),y.on("nav:next-page",function(){g.trigger("paging:next")}),y.on("nav:prev-page",function(){g.trigger("paging:prev")}),y.on("render",function(){var t=e.model.get("options");o[i]=n.request("track:entities:current",e);var a=Math.ceil(o[i].length/t.tracks_per_page);1==t.current_page?r(".spp-playlist-prev-page").addClass("spp-disabled"):r(".spp-playlist-prev-page").removeClass("spp-disabled"),t.current_page==a?r(".spp-playlist-next-page").addClass("spp-disabled"):r(".spp-playlist-next-page").removeClass("spp-disabled")}),y.on("show",function(){var t=e.model.get("options");o[i]=n.request("track:entities:current",e);var a=Math.ceil(o[i].length/t.tracks_per_page);1==t.current_page?this.$(".spp-playlist-prev-page").addClass("spp-disabled"):this.$(".spp-playlist-prev-page").removeClass("spp-disabled"),t.current_page==a?this.$(".spp-playlist-next-page").addClass("spp-disabled"):this.$(".spp-playlist-next-page").removeClass("spp-disabled")}),d[i]=g,h[i]=v,f[i]=y,e.playlistRegion.show(m)},gotoPlaylistTrackPage:function(e,t){var n=e.model.get("region");d[n].trigger("paging:goto:track",t)},updatePaging:function(e){var t=e.model.get("region");d[t].trigger("paging:update")},filter:function(e,t){var i=e.model.get("region"),a=e.model.get("options"),s=r.inArray(t,u[i]);if("-1"==s?u[i].push(t):u[i].splice(s,1),u[i].length<1){h[i].$el.html("").addClass("spp-empty"),o[i]=n.request("track:entities",e),o[i]=n.request("track:entities:tagged",e,o[i],"");{Math.ceil(o[i].length/a.tracks_per_page)}l[i]=n.request("track:entities:paged",e,o[i],1,a.tracks_per_page);var p=Math.ceil(o[i].length/a.tracks_per_page);d[i].collection=l[i],d[i].render(),a.current_page=f[i].model.attributes.data.current_page=1,f[i].model.attributes.data.num_pages=p,f[i].render()}else{var c="";r.each(u[i],function(e,t){c+=''+t+'×'}),h[i].$el.html(c).removeClass("spp-empty"),o[i]=n.request("track:entities",e),r.each(u[i],function(t,a){o[i]=n.request("track:entities:tagged",e,o[i],a)
});{Math.ceil(o[i].length/a.tracks_per_page)}l[i]=n.request("track:entities:paged",e,o[i],1,a.tracks_per_page),o[i]=n.request("track:entities:current",e);var p=Math.ceil(o[i].length/a.tracks_per_page);d[i].collection=l[i],d[i].render(),a.current_page=f[i].model.attributes.data.current_page=1,f[i].model.attributes.data.num_pages=p,f[i].render()}}}}),e.AskPatPlayerApp.Playlist.Controller}),define("text!templates/track-details-template.html",[],function(){return'\r\n\r\n\r\n \r\n <% if ( data.social == true ) { %>\r\n
\r\n <% if ( data.social_twitter == true ) { %>\r\n \r\n <% } %> \r\n <% if ( data.social_facebook == true ) { %>\r\n
Facebook\r\n <% } %> \r\n <% if ( data.social_gplus == true ) { %>\r\n
Google+\r\n <% } %> \r\n <% if ( data.social_linkedin == true ) { %>\r\n
LinkedIn\r\n <% } %> \r\n <% if ( data.social_stumble == true ) { %>\r\n
StumbleUpon\r\n <% } %> \r\n <% if ( data.social_pinterest == true ) { %>\r\n
Pinterest\r\n <% } %> \r\n <% if ( data.social_email == true ) { %>\r\n
Email\r\n <% } %> \r\n
\r\n <% } %> \r\n \r\n
\r\n <%= data.show_notes %>\r\n
\r\n\r\n
\r\n\r\n<% if ( data.poweredby == true ) { %>\r\n \r\n<% } %>\r\n\r\n
\r\n \r\n
\r\n'}),define("apps/smart-podcast-player/track-details/view",["app","text!templates/track-details-template.html"],function(e,t){return e.module("AskPatPlayerApp.TrackDetails.View",function(e,n,i,a,r,s){e.TrackDetails=a.Layout.extend({template:s.template(t),className:"spp-track-details",triggers:{"click .spp-play-pause-btn":"play","click .spp-button-download":"track:download","click .spp-previous-btn":"track:previous","click .spp-next-btn":"track:next","click .spp-currently-playing":"track:current","click .details-btn":"content:toggle"},events:{"click .spp-player-tag":"filterTag","click .spp-progress-container":"seek","click .spp-share-btn":"share"},initialize:function(){var e=this;r(window).on("spp_resize",function(){e.resize()})},resize:function(){this.trigger("resize")},socialPopup:function(e,t){window.open(t,"pinterest","screenX=100,screenY=100,height=360,width=730"),e.preventDefault(),e.stopPropagation()},share:function(e){var t=this,n=t.model.get("data"),i=r(e.currentTarget),a=""!=n.fallback_permalink&&null!=n.fallback_permalink&&void 0!=n.fallback_permalink?n.fallback_permalink:""!=n.permalink_url?n.permalink_url:"";if(i.hasClass("spp-facebook")&&this.socialPopup(e,"https://www.facebook.com/sharer/sharer.php?s=100&p[url]="+encodeURIComponent(a)+"&p[images][0]=&p[title]="+encodeURIComponent(n.title)),i.hasClass("spp-twitter")){var s=encodeURIComponent(n.title)+" "+encodeURIComponent(a);""!=n.hashtag&&void 0!=n.hashtag&&(s=s+" "+encodeURIComponent("#"+n.hashtag)),this.socialPopup(e,"https://twitter.com/home?status="+s)}i.hasClass("spp-gplus")&&this.socialPopup(e,"https://plus.google.com/share?url="+encodeURIComponent(a)),i.hasClass("spp-stumble")&&this.socialPopup(e,"https://www.stumbleupon.com/submit?url="+encodeURIComponent(a)+"&title="+encodeURIComponent(n.title)),i.hasClass("spp-pinterest")&&this.socialPopup(e,"https://pinterest.com/pin/create/button/?url="+encodeURIComponent(a)),i.hasClass("spp-linkedin")&&this.socialPopup(e,"https://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(a)+"&title="+encodeURIComponent(n.title))},seek:function(e){function t(){n.bytesLoaded/n.bytesTotal>p&&(n.pause(),n.setPosition(p*l),n.spp-play(),clearInterval(u))}var n=soundManager.getSoundById("track_"+this.model.get("id")),i=e.offsetX,a=e.offsetY,s=r(e.currentTarget).width(),o=n.spp-o,l=this.model.get("duration");void 0==i&&(i=e.pageX-this.$(".spp-progress-container").offset().left),void 0==a&&(a=e.pageY-this.$(".spp-progress-container").offset().top);var u,p=i/s;if(n.bytesLoaded/n.bytesTotal>p)n.pause(),n.setPosition(p*l),n.spp-play();else{this.$el.hasClass("playing")||n.spp-play(),n.pause();var c=100*p+"%";r(e.currentTarget).find(".spp-progress-icon").css({left:c}),u=setInterval(t,250)}},filterTag:function(e){this.trigger("playlist:filter",this,r(e.currentTarget).text())},onRender:function(){var e=this.model.get("data"),t=e.tags,n="";r.each(t,function(e,t){n+=''+t+""}),this.$(".spp-tag-list").html(n)}})}),e.AskPatPlayerApp.TrackDetails.View}),define("apps/smart-podcast-player/track-details/controller",["app","apps/smart-podcast-player/track-details/view","entities/podcast-track","soundmanager2","vendor/jquery.jscrollpane.min","vendor/jquery.mousewheel"],function(e,t){return e.module("AskPatPlayerApp.TrackDetails",function(e,n,i,a,r){var s=[];e.Controller={init:function(e){var i=e.model.get("region"),a=(e.model.get("options"),n.request("track:entity:current",e)),o=new t.TrackDetails({model:a});o.on("show",function(){window.innerWidth>768&&o.$el.jScrollPane()}),o.on("playlist:filter",function(t,i){n.trigger("playlist:filter",e,i)}),o.on("resize",function(){window.innerWidth>768&&r(".spp-player .spp-track-details-container").show(),o.$el.removeData("jsp").removeClass("jspScrollable"),o.$el.attr("style","").attr("tabindex",""),o.$(".jspContainer").remove(),o.render(),window.innerWidth>768&&o.$el.jScrollPane()}),o.on("track:download",function(e){var t=e.model.get("data"),n=t.download_url;"https:"===location.protocol&&(n=n.replace(/^http:\/\//i,"https://"));var i=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);if(i||"soundcloud"==t.method&&("http:"!==location.protocol||i))window.location=n+"?consumer_key="+AP_Player.soundcloudConsumerKey;else{var a="soundcloud"==t.method?n+"?consumer_key="+AP_Player.soundcloudConsumerKey:AP_Player.homeUrl+"?spp_download="+n;e.view.$(".spp-downloader").prop("src",a)}}),o.on("track:current",function(){var t=n.request("track:entity:current",e);o.$el.removeData("jsp").removeClass("jspScrollable"),o.$el.attr("style","").attr("tabindex",""),o.$(".jspContainer").remove(),this.model=t,this.render(),window.innerWidth>768&&this.$el.jScrollPane()}),o.on("render",function(){o.$el.removeClass("spp-current"),window.innerWidth>768?o.$el.jScrollPane():(o.$el.removeData("jsp").removeClass("jspScrollable"),o.$el.attr("style","").attr("tabindex",""),o.$(".jspContainer").remove());var t=n.request("track:entity:current",e);t.attributes.data.id===o.model.attributes.data.id&&o.$el.addClass("spp-current")}),e.trackDetailsRegion.show(o),s[i]=o},show:function(e,t){var n=e.model.get("region"),i=s[n];i.$el.removeData("jsp").removeClass("jspScrollable"),i.$el.attr("style","").attr("tabindex",""),i.$(".jspContainer").remove(),i.model=t,i.render(),window.innerWidth>768&&i.$el.jScrollPane()}}}),e.AskPatPlayerApp.TrackDetails.Controller}),define("apps/smart-podcast-player/player/view",["app","text!templates/player-template.html"],function(e,t){return e.module("AskPatPlayerApp.Player.View",function(e,n,i,a,r,s){e.Player=a.ItemView.extend({template:s.template(t),className:"spp-player",triggers:{"click .spp-play":"track:play","click .spp-next":"track:next","click .spp-previous":"track:previous","click .spp-speed":"track:speed","click .spp-show-notes-button":"track:show-notes"},events:{"mousemove .spp-track":"cursorMove","mouseout .spp-track":"cursorOut","click .spp-track":"seek"},initialize:function(){this.hover=!1;var e=this;r(window).on("spp_resize",function(){e.resize()})},resize:function(){this.trigger("resize")},seek:function(e){this.trigger("track:seek",e)},cursorMove:function(e){this.trigger("cursor:move",e)},cursorOut:function(e){this.trigger("cursor:out",e)},onRender:function(){}})}),e.AskPatPlayerApp.Player.View}),define("apps/smart-podcast-player/player/controller",["app","apps/smart-podcast-player/player/view","entities/podcast-player","entities/podcast-track","soundmanager2"],function(e,t){return e.module("AskPatPlayerApp.Player",function(e,n,i,a,r){var s=[],o=[],l=[];e.Controller={init:function(e){var i=e.model.get("region"),a=e.model.get("options"),u=n.request("player:entity",e);l[i]=new t.Player({model:u});var p=0,c=n.request("track:entities",e);c.each(function(e){var t=e.get("data");p+="number"==typeof t.playback_count?t.playback_count:0}),l[i].on("resize",function(){var e=l[i].model.get("data");if(window.innerWidth>768){var t=l[i].$el.outerWidth();null===e.show_logo||void 0===e.show_logo||""===e.show_logo?t=t:t-=100,l[i].$(".spp-track").css({width:t+"px"}),l[i].$(".spp-show-logo").show()}else l[i].$(".spp-track").css({width:"100%"}),l[i].$(".spp-show-logo").hide()}),l[i].on("track:show-notes",function(){this.$el.parents(".smart-podcast-player").find(".spp-track-details-container").is(":visible")?(this.$el.parents(".smart-podcast-player").find(".spp-track-details-container").hide(),l[i].$(".spp-show-notes-button").text("Show Notes")):(this.$el.parents(".smart-podcast-player").find(".spp-track-details-container").show(),l[i].$(".spp-show-notes-button").text("Hide Notes"))}),l[i].on("show",function(){var e=l[i].model.get("data");if(window.innerWidth>768){var t=l[i].$el.outerWidth();null===e.show_logo||void 0===e.show_logo||""===e.show_logo?t=t:t-=100,l[i].$(".spp-track").css({width:t+"px"}),l[i].$(".spp-show-logo").show()}else l[i].$(".spp-track").css({width:"100%"}),l[i].$(".spp-show-logo").hide();if(p){var n=p.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" Listens";""!=e.show_name&&void 0!==e.show_name&&(n=" • "+n),l[i].$(".spp-show-count").text(n)}}),l[i].on("render",function(){var e=l[i].model.get("data");if(window.innerWidth>768){var t=l[i].$el.outerWidth();null===e.show_logo||void 0===e.show_logo||""===e.show_logo?t=t:t-=100,l[i].$(".spp-track").css({width:t+"px"}),l[i].$(".spp-show-logo").show()}else l[i].$(".spp-track").css({width:"100%"}),l[i].$(".spp-show-logo").hide();if(p){var n=p.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" Listens";""!=e.show_name&&void 0!==e.show_name&&(n=" • "+n),l[i].$(".spp-show-count").text(n)}}),l[i].on("track:play",function(t){var i=this.$el.hasClass("spp-playing"),a=(t.model.get("data"),"track_"+t.model.cid);r(".spp-track, .smart-track-player").removeClass("spp-playing"),i?(r(".spp-player").removeClass("spp-playing"),this.$(".spp-player-playlist .spp-track").removeClass("spp-active"),soundManager.pauseAll(),n.request("track:entities:set",e,"playing",!1)):(soundManager.pauseAll(),soundManager.play(a),this.$el.addClass("spp-playing"),n.request("track:entities:set",e,"playing",!1),n.request("track:entity:set",e,t.model,"playing",!0),r('.spp-track[data-tid="'+a+'"]').addClass("spp-playing"))}),l[i].on("track:speed",function(t){var i=this.$el.hasClass("spp-playing"),a=(t.model.get("data"),"track_"+t.model.cid),s=soundManager.getSoundById(a);r(".spp-track, .smart-track-player").removeClass("spp-playing"),i||(soundManager.pauseAll(),soundManager.play(a),this.$el.addClass("spp-playing"),n.request("track:entities:set",e,"playing",!1),n.request("track:entity:set",e,t.model,"playing",!0),r('.spp-track[data-tid="'+a+'"]').addClass("spp-playing")),s.isHTML5&&(.5==s._a.playbackRate?(this.$el.hasClass("spp-speeding-half")&&this.$el.removeClass("spp-speeding-half"),s._a.playbackRate=1):1==s._a.playbackRate?(this.$el.addClass("spp-speeding-onehalf"),s._a.playbackRate=1.5):1.5==s._a.playbackRate?(this.$el.hasClass("spp-speeding-onehalf")&&this.$el.removeClass("spp-speeding-onehalf"),this.$el.addClass("spp-speeding-two"),s._a.playbackRate=2):2==s._a.playbackRate?(this.$el.hasClass("spp-speeding-two")&&this.$el.removeClass("spp-speeding-two"),this.$el.addClass("spp-speeding-three"),s._a.playbackRate=3):3==s._a.playbackRate?(this.$el.hasClass("spp-speeding-three")&&this.$el.removeClass("spp-speeding-three"),this.$el.addClass("spp-speeding-half"),s._a.playbackRate=.5):s._a.playbackRate=1)}),l[i].on("track:seek",function(e){function t(){a.bytesLoaded/a.bytesTotal>c&&(a.setPosition(c*a.durationEstimate),a.play(),clearInterval(p))}if(window.innerWidth>768){{var n=l[i].model.get("data"),a=soundManager.getSoundById("track_"+l[i].model.cid),s=l[i].$(".spp-track").offset(),o=e.pageX-s.left,u=r(e.currentTarget).outerWidth();a.position,n.durationEstimate}void 0==o&&(o=e.pageX-this.$(".spp-track").offset().left);var p,c=o/u;a.bytesLoaded/a.bytesTotal>c?(a.pause(),a.setPosition(c*a.durationEstimate),a.play()):(this.$el.hasClass("spp-playing")||a.play(),a.pause(),p=setInterval(t,250))}}),l[i].on("cursor:move",function(e){if(window.innerWidth>768){l[i].$el.addClass("spp-hover");var t=l[i].$(".spp-track").offset(),n=e.pageX-t.left;this.$(".spp-position").css({left:n+"px"})}}),l[i].on("cursor:out",function(){if(window.innerWidth>768){var e=l[i].model.get("data"),t=soundManager.getSoundById("track_"+l[i].model.cid);if(t){var n=t.position,a=e.duration,r=n/a*100;l[i].$(".spp-position").css({left:r+"%"})}l[i].$el.removeClass("spp-hover")}}),l[i].on("track:next",function(t){var u=t.model,p=(u.get("data"),"track_"+u.cid);soundManager.pauseAll(),soundManager.unload(p),r(".spp-player").removeClass("spp-playing"),s[i]=n.request("track:entities:current",e),o[i]=n.request("track:entities:paged",e,s[i],a.current_page,a.tracks_per_page);var c=s[i].indexOf(u),d=c+1,h=s[i].length-1,f=s[i].at(h>d?d:0);n.trigger("playlist:paging:track",e,f),l[i].trigger("track:update",f)}),l[i].on("track:previous",function(t){var r=t.model,u=(r.get("data"),"track_"+r.cid);soundManager.pauseAll(),soundManager.unload(u),s[i]=n.request("track:entities:current",e),o[i]=n.request("track:entities:paged",e,s[i],a.current_page,a.tracks_per_page);var p=s[i].indexOf(r),c=p-1,d=s[i].length-1,h=s[i].at(0>c?d:c);n.trigger("playlist:paging:track",e,h),l[i].trigger("track:update",h)}),l[i].on("track:update",function(t){{var a=(t.get("data"),"track_"+t.cid),s=(l[i].model.get("data"),"track_"+l[i].model.cid);this.$el.hasClass("spp-playing")}r(".spp-player").removeClass("spp-playing"),r(".spp-track").removeClass("spp-active"),s==a?l[i].trigger("track:play",this):(r('.spp-track[data-tid="'+s+'"]').addClass("spp-active"),soundManager.pauseAll(),soundManager.unload(s),l[i].model=t,l[i].render(),l[i].trigger("track:play",this),n.trigger("playlist:paging:update",e),n.trigger("track-details:show",e,t))}),e.playerRegion.show(l[i])},playTrack:function(e,t){var n=e.model.get("region");l[n].trigger("track:update",t)}}}),e.AskPatPlayerApp.Player.Controller}),define("apps/smart-podcast-player/app",["app"],function(e){return e.module("AskPatPlayerApp",function(e,t){var n={initCore:function(e){require(["apps/smart-podcast-player/core/controller"],function(t){t.init(e)})},setupColors:function(e){require(["apps/smart-podcast-player/core/controller"],function(t){t.setupColors(e)})},initPlaylist:function(e){require(["apps/smart-podcast-player/playlist/controller"],function(t){t.init(e)})},updatePlaylistPaging:function(e){require(["apps/smart-podcast-player/playlist/controller"],function(t){t.updatePaging(e)})},gotoPlaylistTrackPage:function(e,t){require(["apps/smart-podcast-player/playlist/controller"],function(n){n.gotoPlaylistTrackPage(e,t)})},filterPlaylist:function(e,t){require(["apps/smart-podcast-player/playlist/controller"],function(n){n.filter(e,t)})},initTrackDetails:function(e){require(["apps/smart-podcast-player/track-details/controller"],function(t){t.init(e)})},showTrack:function(e,t){require(["apps/smart-podcast-player/track-details/controller"],function(n){n.show(e,t)})},initPlayer:function(e){require(["apps/smart-podcast-player/player/controller"],function(t){t.init(e)})},playTrack:function(e,t){require(["apps/smart-podcast-player/player/controller"],function(n){n.playTrack(e,t)})}};t.on("app:core:init",function(){n.initCore()}),t.on("core:color:setup",function(){n.setupColors()}),t.on("player:track:play",function(e,t){n.playTrack(e,t)}),t.on("player:init",function(e){n.initPlayer(e)}),t.on("playlist:paging:update",function(e){n.updatePlaylistPaging(e)}),t.on("playlist:paging:track",function(e,t){n.gotoPlaylistTrackPage(e,t)}),t.on("playlist:init",function(e){n.initPlaylist(e)}),t.on("playlist:filter",function(e,t){n.filterPlaylist(e,t)}),t.on("track-details:init",function(e){n.initTrackDetails(e)}),t.on("track-details:show",function(e,t){n.showTrack(e,t)})}),e.PlaylistApp}),define("app",["jquery","marionette","soundmanager2"],function(e,t){var n=new t.Application;return n.options={},n.options.current_page=1,n.options.tracks_per_page=10,n.on("initialize:after",function(){(jQuery(".smart-podcast-player").length>0||jQuery(".smart-track-player").length>0)&&require(["apps/smart-podcast-player/app"],function(){soundManager.setup({url:AP_Player.baseUrl+"vendor/SoundManager2/swf/",flashVersion:9,useHighPerformance:!0,wmode:"transparent",useHTML5Audio:!0,preferFlash:!1,onready:function(){n.trigger("app:core:init")}})})}),n}),define("text!templates/track-template.html",[],function(){return'<% if ( data.show_logo != undefined && data.show_logo != null ) { %>\r\n \r\n
\r\n
\r\n<% } %>\r\n\r\n\r\n <% if ( data.artist != undefined && data.artist != null ) { %>\r\n
<%= data.artist %>
\r\n <% } %> \r\n\r\n
<%= data.title %>
\r\n
\r\n \r\n
\r\n\r\n
\r\n\r\n
\r\n <% if ( data.paid == true ) { %>\r\n <% if ( data.speedcontrol == true ) { %>\r\n
\r\n <% } %>\r\n <% if ( data.social == true ) { %>\r\n
\r\n \r\n <% if ( data.social_twitter == true ) { %>\r\n \r\n <% } %>\r\n <% if ( data.social_facebook == true ) { %>\r\n
Share\r\n <% } %>\r\n <% if ( data.social_gplus == true ) { %>\r\n
Share\r\n <% } %>\r\n <% if ( data.social_linkedin == true ) { %>\r\n
Share\r\n <% } %>\r\n <% if ( data.social_stumble == true ) { %>\r\n
Share\r\n <% } %>\r\n <% if ( data.social_pinterest == true ) { %>\r\n
Share\r\n <% } %>\r\n
\r\n \r\n <% } %>\r\n <% } %>\r\n\r\n <% var adl = document.createElement(\'a\'); %>\r\n <% var adloff = /Firefox/i.test(navigator.userAgent); %>\r\n\r\n <% if ( data.download == true && (typeof adl.download != "undefined") && (!adloff) && data.method != \'soundcloud\' ) { %>
<% } %>\r\n <% if ( data.download == true && (typeof adl.download == "undefined" || (adloff) || data.method == \'soundcloud\' ) ) { %>
<% } %>\r\n
\r\n
\r\n\r\n
\r\n \r\n
\r\n\r\n<%if ( data.paid != true ) { %>\r\n \r\n<% } %>\r\n'}),define("apps/smart-track-player/player/view",["app","text!templates/track-template.html"],function(e,t){return e.module("SmartTrackPlayerApp.Player.View",function(e,n,i,a,r,s){e.Player=a.ItemView.extend({template:s.template(t),className:"smart-track-player",events:{"mousemove .spp-track":"cursorMove","mouseout .spp-track":"cursorOut","click .spp-position":"seek","click .spp-play":"play","click .spp-button-download":"download","click .spp-dload":"download","click .spp-speed":"speed","hover .spp-play":"shareOut","hover .spp-button-download":"shareOut","hover .spp-dload":"shareOut","hover .spp-dloada":"shareOut","hover .spp-speed":"shareOut","hover .spp-share":"shareOn","hover .spp-share-options":"shareOn","click .spp-share":"shareOn","click .spp-share-icon":"share","mouseleave .spp-controls":"shareOut"},initialize:function(){this.hover=!1;var e=this;r(window).on("resize",function(){e.resize()})},download:function(e){e.preventDefault();var t=this.model.get("data"),n=t.download_url;"https:"===location.protocol&&(n=n.replace(/^http:\/\//i,"https://"));var i=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);if(i||"soundcloud"==t.method&&("http:"!==location.protocol||i)){var a="soundcloud"==t.method?n+"?consumer_key="+AP_Player.soundcloudConsumerKey:n;window.location=a}else{var a="soundcloud"==t.method?n+"?consumer_key="+AP_Player.soundcloudConsumerKey:AP_Player.homeUrl+"?spp_download="+n;this.$(".spp-downloader").prop("src",a)}},resize:function(){var e=this.model.get("data");if(window.innerWidth>768){var t=r(".smart-track-player").first().outerWidth();null===e.artwork_url||void 0===e.artwork_url||(t-=100),this.$(".spp-track").css({width:t+"px"})}else this.$(".spp-track").css({width:"100%"})},socialPopup:function(e,t){window.open(t,"pinterest","screenX=100,screenY=100,height=360,width=730"),e.preventDefault(),e.stopPropagation()},shareOn:function(){this.$(".spp-share-options").css("display","block")},shareOut:function(){this.$(".spp-share-options").css("display","none")},share:function(e){var t=this,n=t.model.get("data"),i=r(e.currentTarget),a=window.location.href;if((i.hasClass("spp-facebook")||i.hasClass("spp-fb-btn"))&&this.socialPopup(e,"https://www.facebook.com/sharer/sharer.php?s=100&p[url]="+encodeURIComponent(a)+"&p[images][0]=&p[title]="+encodeURIComponent(n.title)),i.hasClass("spp-twitter")||i.hasClass("spp-twitter-btn")){var s=encodeURIComponent(n.title)+" "+encodeURIComponent(a);""!=n.hashtag&&void 0!=n.hashtag&&(s=s+" "+encodeURIComponent("#"+n.hashtag)),this.socialPopup(e,"https://twitter.com/home?status="+s)}(i.hasClass("spp-gplus")||i.hasClass("spp-gplus-btn"))&&this.socialPopup(e,"https://plus.google.com/share?url="+encodeURIComponent(a)),(i.hasClass("spp-stumble")||i.hasClass("spp-stumble-btn"))&&this.socialPopup(e,"https://www.stumbleupon.com/submit?url="+encodeURIComponent(a)+"&title="+encodeURIComponent(n.title)),(i.hasClass("spp-pinterest")||i.hasClass("spp-pinterest-btn"))&&this.socialPopup(e,"https://pinterest.com/pin/create/button/?url="+encodeURIComponent(a)),(i.hasClass("spp-linkedin")||i.hasClass("spp-linkedin-btn"))&&this.socialPopup(e,"https://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(a)+"&title="+encodeURIComponent(n.title))},stop:function(){this.$el.removeClass("spp-playing")},seek:function(e){function t(){a.bytesLoaded/a.bytesTotal>d&&(p=null!==a.duration?a.duration:a.durationEstimate,s.pause(),a.setPosition(d*p),s.play(),clearInterval(c))}if(r(window).outerWidth()>768){var n=this.model.get("data"),i="smart_track_"+n.track_uid+"_"+this.model.cid,a=soundManager.getSoundById(i),s=this;void 0===a&&(a=this.createSound(),a.load());var o=this.$(".spp-track").offset(),l=e.pageX-o.left,u=this.$(".spp-track").outerWidth(),p=null!==a.duration?a.duration:a.durationEstimate;void 0==l&&(l=e.pageX-this.$(".spp-track").offset().left);var c,d=l/u;a.bytesLoaded/a.bytesTotal>d&&null!==p?(p=null!==a.duration?a.duration:a.durationEstimate,this.$el.hasClass("spp-playing")&&this.pause(),a.setPosition(d*p),this.play()):(this.pause(),c=setInterval(t,250))}},cursorMove:function(e){if(this.trigger("cursor:move",e),window.innerWidth>768){this.hover=!0;var t=this.$(".spp-track").offset(),n=e.pageX-t.left;this.$(".spp-position").css({left:n+"px"})}},cursorOut:function(){if(window.innerWidth>768){var e=this.model.get("data"),t="smart_track_"+e.track_uid+"_"+this.model.cid,n=soundManager.getSoundById(t);if(n){var i=n.position,a=n.duration,r=i/a*100;this.$(".spp-position").css({left:r+"%"})}this.hover=!1}},onRender:function(){{var e=this.model.get("data");"smart_track_"+e.track_uid+"_"+this.model.cid}if(window.innerWidth>768){var t=r(".smart-track-player").first().outerWidth();null===e.show_logo||void 0===e.show_logo||(t-=60),this.$(".spp-track").css({width:t+"px"})}else this.$(".spp-track").css({width:"100%"}),this.$(".spp-show-logo").hide();void 0!==e.download&&this.$el.addClass("spp-has-download"),void 0!==e.color&&this.$el.addClass("stp-color-"+e.color),void 0!==e.get&&0!=e.get&&"file"==e.method&&this.fetchTrackData(e.url)},fetchTrackData:function(e){var t=this,n={action:"fetch_track_data",url:e};console.log("Getting track data"),r.post(AP_Player.ajaxurl,n,function(e){var n=t.model.get("data");e=JSON.parse(e),"0"!=e?(void 0===typeof e.title||void 0!=n.title&&'Getting file data...'!=n.title||(n.title=e.title),void 0!==typeof e.artist&&void 0==n.artist&&(n.artist=e.artist),n.get=!1,t.model.set({data:n}),void 0!==typeof e.title&&t.$(".spp-track-title").text(n.title),void 0!==typeof e.artist&&(t.$(".spp-artist").length>0?t.$(".spp-artist").text(n.artist):t.$(".spp-track-title").before(''+n.artist+"
")),void 0!=t.loading_timer&&clearInterval(t.loading_timer),t.render()):(n.title="Unable to retrieve track data",n.get=!1,t.model.set({data:n}),t.render())})},pause:function(){var e=this.model.get("data"),t="smart_track_"+e.track_uid+"_"+this.model.cid,n=soundManager.getSoundById(t);n.pause(),this.$el.removeClass("spp-playing")},speed:function(){var e=this.model.get("data"),t="smart_track_"+e.track_uid+"_"+this.model.cid,n=soundManager.getSoundById(t);if(void 0===n)n=this.createSound(),this.play();else{var i=this.$el.hasClass("spp-playing");i||this.play()}n.isHTML5&&(.5==n._a.playbackRate?(this.$el.hasClass("spp-speeding-half")&&this.$el.removeClass("spp-speeding-half"),n._a.playbackRate=1):1==n._a.playbackRate?(this.$el.addClass("spp-speeding-onehalf"),n._a.playbackRate=1.5):1.5==n._a.playbackRate?(this.$el.hasClass("spp-speeding-onehalf")&&this.$el.removeClass("spp-speeding-onehalf"),this.$el.addClass("spp-speeding-two"),n._a.playbackRate=2):2==n._a.playbackRate?(this.$el.hasClass("spp-speeding-two")&&this.$el.removeClass("spp-speeding-two"),this.$el.addClass("spp-speeding-three"),n._a.playbackRate=3):3==n._a.playbackRate?(this.$el.hasClass("spp-speeding-three")&&this.$el.removeClass("spp-speeding-three"),this.$el.addClass("spp-speeding-half"),n._a.playbackRate=.5):n._a.playbackRate=1)},play:function(){var e=this.$el.hasClass("spp-playing"),t=this.model.get("data"),n="smart_track_"+t.track_uid+"_"+this.model.cid,i=soundManager.getSoundById(n);void 0===i&&(i=this.createSound()),r(".spp-track").removeClass("spp-playing"),e?(this.$el.removeClass("spp-playing"),soundManager.pauseAll()):(soundManager.pauseAll(),i.play(),this.$el.addClass("spp-playing"))},createSound:function(){var e=this,t=this.model,n=t.get("data"),i="smart_track_"+n.track_uid+"_"+this.model.cid,a=soundManager.createSound({id:i,url:n.url,type:"audio/mp3",onload:function(){},onresume:function(){},onplay:function(){},onid3:function(){},onfinish:function(){e.stop()},whileloading:function(){var t=this.bytesLoaded/this.bytesTotal*100+"%";e.$(".spp-loaded").width(t),this.bytesLoaded/this.bytesTotal==1&&e.$(".spp-loaded-container").fadeOut("slow")},whileplaying:function(){var t,n,i,a,r=this.durationEstimate,s=this.position,o=r-s;t=s/1e3,n=t/60,i=n/60,a=Math.floor(i)+":"+pad(Math.floor(n%60),2)+":"+pad(Math.floor(t%60),2),t=o/1e3,n=t/60,i=n/60,remaining_time=pad(Math.floor(n),2)+":"+pad(Math.floor(t%60),2),e.$(".spp-duration").text("-"+remaining_time);var l=s/r*100;e.$(".spp-current-time").css({width:l+"%"}),e.hover===!1&&e.$(".spp-position").css({left:l+"%"})}});return a}})}),e.SmartTrackPlayerApp.Player.View}),define("entities/player-track",["app"],function(e){e.module("Entities",function(e,t,n){e.Player=n.Model.extend({defaults:{data:{}}}),e.Track=n.Model.extend({defaults:{data:{active:!1,artwork_url:"",attachments_uri:"",bpm:null,comment_count:0,commentable:!0,created_at:"",current_time:"0:00:00",description:"",download_count:0,download_url:"",downloadable:!0,duration:0,duration_time:"0:00:00",episode_number:0,embeddable_by:"all",favoritings_count:0,filename:"",genre:"",id:0,isrc:"",key_signature:"",kind:"track",label_id:null,label_name:"",license:"",original_content_size:0,original_format:"mp3",permalink:"",permalink_url:"",playing:!1,playback_count:0,purchase_title:null,purchase_url:null,release:"",release_day:null,release_month:null,release_year:null,sharing:"",show_name:"",state:"",stream_url:"",streamable:!0,tag_list:"",tags:"",tag_string:"",title:"",track_type:"",uri:"",user:{avatar_url:"",id:0,kind:"user",permalink:"",permalink_url:"",uri:"",username:""},user_id:0,video_url:null,waveform_url:"",show_notes:""}}})})}),define("entities/player",["app","entities/player-track"],function(e){return e.module("Entities",function(e,t){var n=[],i=function(e){var i=e.model.get("region");n[i]=t.request("track:entity:current",e)},a={getPlayerEntities:function(e){var t=e.model.get("region");return void 0===n[t]&&i(e),n[t]}};t.reqres.setHandler("player:entity",function(e){return a.getPlayerEntities(e)})}),e.Entities}),define("apps/smart-track-player/player/controller",["app-player","apps/smart-track-player/player/view","entities/player","entities/player-track","soundmanager2"],function(e,t){return e.module("SmartTrackPlayerApp.Player",function(e,n,i,a,r){e.Controller={init:function(){r(".smart-track-player").length>0&&n.trigger("core:color:setup"),r(".smart-track-player").each(function(e,n){var a=r(n).data("url"),s={url:a,track_uid:r(n).data("uid"),show_logo:r(n).data("image"),download:r(n).data("download"),download_url:a,color:r(n).data("color"),title:r(n).data("title"),artist:r(n).data("artist"),filename:"",social:r(n).data("social"),social_twitter:r(n).data("social_twitter"),social_facebook:r(n).data("social_facebook"),social_gplus:r(n).data("social_gplus"),social_linkedin:r(n).data("social_linkedin"),social_stumble:r(n).data("social_stumble"),social_pinterest:r(n).data("social_pinterest"),social_email:r(n).data("social_email"),speedcontrol:r(n).data("speedcontrol"),paid:r(n).data("paid"),get:r(n).data("get"),method:"file"},o=document.createElement("a");
o.href=a;var l=o.hostname;if(l.indexOf("soundcloud.com")>-1){var u="",p={action:"get_soundcloud_track",stream:a};r.ajax({url:AP_Player.ajaxurl,dataType:"json",async:!1,type:"POST",data:p,success:function(e){u=e}}),s.method="soundcloud",s.url=u.stream_url+"?consumer_key="+AP_Player.soundcloudConsumerKey,s.title=s.title?s.title:u.title,s.download_url=u.download_url,s.filename=u.permalink+".mp3";var c=new i.Model({data:s}),d=new t.Player({model:c});d.render(),r(n).after(d.$el);var h="?spp_view=1";h+="&type=track",h+="&url="+s.url,h+="&download="+(void 0!=s.download?encodeURIComponent(s.download):""),h+="&title="+(void 0!=s.title?encodeURIComponent(s.title):""),h+="&artist="+(void 0!=s.artist?encodeURIComponent(s.artist):""),h+="&image="+(void 0!=s.image?encodeURIComponent(s.image):""),h+="&color="+(void 0!=s.color?encodeURIComponent(s.color):""),r(n).remove()}else{void 0!=s.get&&void 0==s.title&&(s.title='Getting file data...'),s.filename=s.url.replace(/^.*[\\\/]/,"");var c=new i.Model({data:s}),d=new t.Player({model:c});d.on("render",function(){if(this.$(".spp-loading-ellipsis").length>0){var e=this,t=0;this.loading_timer=setInterval(function(){t++;var n=new Array(t%5).join(".");e.$(".spp-loading-ellipsis").text("."+n)},300)}}),d.render(),r(n).after(d.$el);var h="?spp_view=1";h+="&type=track",h+="&url="+s.url,h+="&download="+(void 0!=s.download?encodeURIComponent(s.download):""),h+="&image="+(void 0!=s.image?encodeURIComponent(s.image):""),h+="&color="+(void 0!=s.color?encodeURIComponent(s.color):""),r(n).remove()}})},setupColors:function(){var e=new Array;r(".smart-track-player").each(function(t,n){var i=r(n).attr("class"),a=i.trim().split(/\s+/);r.each(a,function(t,n){var i=n.indexOf("stp-color-");if(i>-1){var a=n.replace("stp-color-","");-1==r.inArray(a,e)&&e.push(a)}})});var t={action:"get_colors",stp_colors:e};r.post(AP_Player.ajaxurl,t,function(e){r("head").append(e)})}}}),e.SmartTrackPlayerApp.Player.Controller}),define("apps/smart-track-player/app",["app-player"],function(e){return e.module("SmartTrackPlayerApp",function(e,t){var n={initPlayer:function(){require(["apps/smart-track-player/player/controller"],function(e){e.init()})},setupColors:function(e){require(["apps/smart-track-player/player/controller"],function(t){t.setupColors(e)})}};t.on("player:init",function(){n.initPlayer()}),t.on("core:color:setup",function(){n.setupColors()})}),e.SmartTrackPlayerApp}),define("app-player",["marionette","soundmanager2"],function(e){var t=new e.Application;return t.options={},t.on("initialize:after",function(){jQuery(".smart-track-player").length>0&&require(["apps/smart-track-player/app"],function(){soundManager.setup({url:AP_Player.baseUrl+"vendor/SoundManager2/swf/",flashVersion:9,wmode:"transparent",useHTML5Audio:!0,preferFlash:!1,onready:function(){t.trigger("player:init")}})})}),t}),"function"==typeof jQuery&&define("jquery",function(){return jQuery}),"function"==typeof _&&define("underscore",function(){return _}),require.config({name:"AP_Player_App",baseUrl:"/wp-content/plugins/smart-podcast-player/assets/js/",urlArgs:"bust="+(new Date).getTime(),paths:{backbone:"vendor/amdjs/backbone","backbone.wreqr":"vendor/amdjs/backbone.wreqr","backbone.babysitter":"vendor/amdjs/backbone.babysitter",marionette:"vendor/amdjs/marionette",soundmanager2:"vendor/soundmanager2-jsmin","mwheel-intent":"vendor/mwheelIntent"},shim:{soundmanager2:{exports:"soundManager"},"vendor/jquery.mousewheel":["jquery","mwheel-intent"],"vendor/jquery.jscrollpane.min":["jquery","vendor/jquery.mousewheel","mwheel-intent"]}}),require(["jquery","app"],function(e,t){var n=jQuery(window).width(),i=jQuery(window).height();jQuery(window).on("resize",function(){(n!=jQuery(window).width()||i!=jQuery(window).height())&&(n=jQuery(window).width(),i=jQuery(window).height(),jQuery(window).trigger("spp_resize"))}),e(window).resize(function(){e(".smart-podcast-player").each(function(){var t=e(this).parent(),n=e(t).width(),i=e(window).width();768>n||768>i?t.addClass("spp-player-small"):t.removeClass("spp-player-small")})}),e(".smart-podcast-player").each(function(){var t=e(this).parent(),n=e(t).width(),i=e(window).width();(768>n||768>i)&&t.addClass("spp-player-small")}),t.start()}),require(["jquery","app-player"],function(e,t){jQuery(".smart-track-player ").length>0&&t.start()}),define("main",function(){});