@widgetic/editor 3.10.53 → 3.10.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/editor.js CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * V2.97a.20170601
12
12
  */
13
- !function(i,o){"use strict";function s(t,e){function r(t){return pt.preferFlash&&ot&&!pt.ignoreFlash&&pt.flash[t]!==o&&pt.flash[t]}function n(t){return function(e){var r=this._s;return r&&r._a?t.call(this,e):null}}this.setupOptions={url:t||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,forceUseGlobalHTML5Audio:!1,ignoreMobileRestrictions:!1,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onerror:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,playbackRate:1,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100},this.flash9Options={onfailure:null,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},flac:{type:["audio/flac"],required:!1}},this.movieID="sm2-container",this.id=e||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20170601",this.version=null,this.movieURL=null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!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.html5Only=!1,this.ignoreFlash=!1;var s,a,u,l,c,p,d,h,f,g,_,y,v,m,b,w,E,P,S,x,k,A,O,T,C,R,M,I,D,L,F,U,N,j,B,q,z,H,V,W,G,$,J,Q,Y,K,X,Z,tt,et,rt,nt,it,ot,st,at,ut,lt,ct,pt=this,dt=null,ht=null,ft=navigator.userAgent,gt=i.location.href.toString(),_t=document,yt=[],vt=!1,mt=!1,bt=!1,wt=!1,Et=!1,Pt=null,St=null,xt=!1,kt=!1,At=0,Ot=null,Tt=[],Ct=null,Rt=Array.prototype.slice,Mt=!1,It=0,Dt=ft.match(/(ipad|iphone|ipod)/i),Lt=ft.match(/android/i),Ft=ft.match(/msie|trident/i),Ut=ft.match(/webkit/i),Nt=ft.match(/safari/i)&&!ft.match(/chrome/i),jt=ft.match(/opera/i),Bt=ft.match(/(mobile|pre\/|xoom)/i)||Dt||Lt,qt=!gt.match(/usehtml5audio/i)&&!gt.match(/sm2-ignorebadua/i)&&Nt&&!ft.match(/silk/i)&&ft.match(/OS\sX\s10_6_([3-7])/i),zt=(i.console!==o&&console.log,_t.hasFocus!==o?_t.hasFocus():null),Ht=Nt&&(_t.hasFocus===o||!_t.hasFocus()),Vt=!Ht,Wt=/(mp3|mp4|mpa|m4a|m4b)/i,Gt=_t.location?_t.location.protocol.match(/http/i):null,$t=Gt?"":"//",Jt=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4|m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,Qt=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","m4b","mp4v","3gp","3g2"],Yt=new RegExp("\\.("+Qt.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!Gt,B={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"},X=[null,"MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"],this.hasHTML5=function(){try{return Audio!==o&&(jt&&opera!==o&&opera.version()<10?new Audio(null):new Audio).canPlayType!==o}catch(t){return!1}}(),this.setup=function(t){var e=!pt.url;return t!==o&&bt&&Ct&&pt.ok()&&(t.flashVersion!==o||t.url!==o||t.html5Test),f(t),Mt||(Bt?pt.setupOptions.ignoreMobileRestrictions&&!pt.setupOptions.forceUseGlobalHTML5Audio||(Tt.push(S.globalHTML5),Mt=!0):pt.setupOptions.forceUseGlobalHTML5Audio&&(Tt.push(S.globalHTML5),Mt=!0)),!ct&&Bt&&(pt.setupOptions.ignoreMobileRestrictions?Tt.push(S.ignoreMobile):(pt.setupOptions.useHTML5Audio=!0,pt.setupOptions.preferFlash=!1,Dt?pt.ignoreFlash=!0:(Lt&&!ft.match(/android\s2\.3/i)||!Lt)&&(Mt=!0))),t&&(e&&O&&t.url!==o&&pt.beginDelayedInit(),O||t.url===o||"complete"!==_t.readyState||setTimeout(k,1)),ct=!0,pt},this.ok=function(){return Ct?bt&&!wt:pt.useHTML5Audio&&pt.hasHTML5},this.supported=this.ok,this.getMovie=function(t){return a(t)||_t[t]||i[t]},this.createSound=function(t,e){function r(){return n=q(n),pt.sounds[n.id]=new s(n),pt.soundIDs.push(n.id),pt.sounds[n.id]}var n,i=null;if(!bt||!pt.ok())return!1;if(e!==o&&(t={id:t,url:e}),n=h(t),n.url=$(n.url),n.id===o&&(n.id=pt.setupOptions.idPrefix+It++),H(n.id,!0))return pt.sounds[n.id];if(Y(n))i=r(),i._setup_html5(n);else{if(pt.html5Only)return r();if(pt.html5.usingFlash&&n.url&&n.url.match(/data:/i))return r();p>8&&null===n.isMovieStar&&(n.isMovieStar=!!(n.serverURL||n.type&&n.type.match(Jt)||n.url&&n.url.match(Yt))),n=z(n,void 0),i=r(),8===p?ht._createSound(n.id,n.loops||1,n.usePolicyFile):(ht._createSound(n.id,n.url,n.usePeakData,n.useWaveformData,n.useEQData,n.isMovieStar,!!n.isMovieStar&&n.bufferTime,n.loops||1,n.serverURL,n.duration||null,n.autoPlay,!0,n.autoLoad,n.usePolicyFile),n.serverURL||(i.connected=!0,n.onconnect&&n.onconnect.apply(i))),n.serverURL||!n.autoLoad&&!n.autoPlay||i.load(n)}return!n.serverURL&&n.autoPlay&&i.play(),i},this.destroySound=function(t,e){if(!H(t))return!1;var r,n=pt.sounds[t];for(n.stop(),n._iO={},n.unload(),r=0;r<pt.soundIDs.length;r++)if(pt.soundIDs[r]===t){pt.soundIDs.splice(r,1);break}return e||n.destruct(!0),n=null,delete pt.sounds[t],!0},this.load=function(t,e){return!!H(t)&&pt.sounds[t].load(e)},this.unload=function(t){return!!H(t)&&pt.sounds[t].unload()},this.onPosition=function(t,e,r,n){return!!H(t)&&pt.sounds[t].onposition(e,r,n)},this.onposition=this.onPosition,this.clearOnPosition=function(t,e,r){return!!H(t)&&pt.sounds[t].clearOnPosition(e,r)},this.play=function(t,e){var r=null,n=e&&!(e instanceof Object);if(!bt||!pt.ok())return!1;if(H(t,n))n&&(e={url:e});else{if(!n)return!1;n&&(e={url:e}),e&&e.url&&(e.id=t,r=pt.createSound(e).play())}return null===r&&(r=pt.sounds[t].play(e)),r},this.start=this.play,this.setPlaybackRate=function(t,e,r){return!!H(t)&&pt.sounds[t].setPlaybackRate(e,r)},this.setPosition=function(t,e){return!!H(t)&&pt.sounds[t].setPosition(e)},this.stop=function(t){return!!H(t)&&pt.sounds[t].stop()},this.stopAll=function(){var t;for(t in pt.sounds)pt.sounds.hasOwnProperty(t)&&pt.sounds[t].stop()},this.pause=function(t){return!!H(t)&&pt.sounds[t].pause()},this.pauseAll=function(){var t;for(t=pt.soundIDs.length-1;t>=0;t--)pt.sounds[pt.soundIDs[t]].pause()},this.resume=function(t){return!!H(t)&&pt.sounds[t].resume()},this.resumeAll=function(){var t;for(t=pt.soundIDs.length-1;t>=0;t--)pt.sounds[pt.soundIDs[t]].resume()},this.togglePause=function(t){return!!H(t)&&pt.sounds[t].togglePause()},this.setPan=function(t,e){return!!H(t)&&pt.sounds[t].setPan(e)},this.setVolume=function(t,e){var r,n;if(t!==o&&!isNaN(t)&&e===o){for(r=0,n=pt.soundIDs.length;r<n;r++)pt.sounds[pt.soundIDs[r]].setVolume(t);return!1}return!!H(t)&&pt.sounds[t].setVolume(e)},this.mute=function(t){var e=0;if(t instanceof String&&(t=null),t)return!!H(t)&&pt.sounds[t].mute();for(e=pt.soundIDs.length-1;e>=0;e--)pt.sounds[pt.soundIDs[e]].mute();return pt.muted=!0,!0},this.muteAll=function(){pt.mute()},this.unmute=function(t){var e;if(t instanceof String&&(t=null),t)return!!H(t)&&pt.sounds[t].unmute();for(e=pt.soundIDs.length-1;e>=0;e--)pt.sounds[pt.soundIDs[e]].unmute();return pt.muted=!1,!0},this.unmuteAll=function(){pt.unmute()},this.toggleMute=function(t){return!!H(t)&&pt.sounds[t].toggleMute()},this.getMemoryUse=function(){var t=0;return ht&&8!==p&&(t=parseInt(ht._getMemoryUse(),10)),t},this.disable=function(t){var e;if(t===o&&(t=!1),wt)return!1;for(wt=!0,e=pt.soundIDs.length-1;e>=0;e--)D(pt.sounds[pt.soundIDs[e]]);return D(pt),d(t),nt.remove(i,"load",v),!0},this.canPlayMIME=function(t){var e;return pt.hasHTML5&&(e=K({type:t})),!e&&Ct&&(e=t&&pt.ok()?!!((p>8?t.match(Jt):null)||t.match(pt.mimePattern)):null),e},this.canPlayURL=function(t){var e;return pt.hasHTML5&&(e=K({url:t})),!e&&Ct&&(e=t&&pt.ok()?!!t.match(pt.filePattern):null),e},this.canPlayLink=function(t){return!(t.type===o||!t.type||!pt.canPlayMIME(t.type))||pt.canPlayURL(t.href)},this.getSoundById=function(t,e){return t?pt.sounds[t]:null},this.onready=function(t,e){var r=!1;if("function"!=typeof t)throw U("needFunction","onready");return e||(e=i),_("onready",t,e),y(),r=!0,r},this.ontimeout=function(t,e){var r=!1;if("function"!=typeof t)throw U("needFunction","ontimeout");return e||(e=i),_("ontimeout",t,e),y({type:"ontimeout"}),r=!0,r},this._writeDebug=function(t,e){return!0},this._wD=this._writeDebug,this._debug=function(){},this.reboot=function(t,e){var r,n,o;for(r=pt.soundIDs.length-1;r>=0;r--)pt.sounds[pt.soundIDs[r]].destruct();if(ht)try{Ft&&(St=ht.innerHTML),Pt=ht.parentNode.removeChild(ht)}catch(t){}if(St=Pt=Ct=ht=null,pt.enabled=O=bt=xt=kt=vt=mt=wt=Mt=pt.swfLoaded=!1,pt.soundIDs=[],pt.sounds={},It=0,ct=!1,t)yt=[];else for(r in yt)if(yt.hasOwnProperty(r))for(n=0,o=yt[r].length;n<o;n++)yt[r][n].fired=!1;return pt.html5={usingFlash:null},pt.flash={},pt.html5Only=!1,pt.ignoreFlash=!1,i.setTimeout(function(){e||pt.beginDelayedInit()},20),pt},this.reset=function(){return pt.reboot(!0,!0)},this.getMoviePercent=function(){return ht&&"PercentLoaded"in ht?ht.PercentLoaded():null},this.beginDelayedInit=function(){Et=!0,k(),setTimeout(function(){return!kt&&(C(),x(),kt=!0,!0)},20),m()},this.destruct=function(){pt.disable(!0)},s=function(t){var e,r,n,i,s,a,u,l,c,d,f=this,g=!1,_=[],y=0,v=null;c={duration:null,time:null},this.id=t.id,this.sID=this.id,this.url=t.url,this.options=h(t),this.instanceOptions=this.options,this._iO=this.instanceOptions,this.pan=this.options.pan,this.volume=this.options.volume,this.isHTML5=!1,this._a=null,d=!this.url,this.id3={},this._debug=function(){},this.load=function(t){var e,r=null;if(t!==o?f._iO=h(t,f.options):(t=f.options,f._iO=t,v&&v!==f.url&&(f._iO.url=f.url,f.url=null)),f._iO.url||(f._iO.url=f.url),f._iO.url=$(f._iO.url),f.instanceOptions=f._iO,e=f._iO,!e.url&&!f.url)return f;if(e.url===f.url&&0!==f.readyState&&2!==f.readyState)return 3===f.readyState&&e.onload&&lt(f,function(){e.onload.apply(f,[!!f.duration])}),f;if(f.loaded=!1,f.readyState=1,f.playState=0,f.id3={},Y(e))r=f._setup_html5(e),r._called_load||(f._html5_canplay=!1,f.url!==e.url&&(f._a.src=e.url,f.setPosition(0)),f._a.autobuffer="auto",f._a.preload="auto",f._a._called_load=!0);else{if(pt.html5Only)return f;if(f._iO.url&&f._iO.url.match(/data:/i))return f;try{f.isHTML5=!1,f._iO=z(q(e)),f._iO.autoPlay&&(f._iO.position||f._iO.from)&&(f._iO.autoPlay=!1),e=f._iO,8===p?ht._load(f.id,e.url,e.stream,e.autoPlay,e.usePolicyFile):ht._load(f.id,e.url,!!e.stream,!!e.autoPlay,e.loops||1,!!e.autoLoad,e.usePolicyFile)}catch(t){R({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}}return f.url=e.url,f},this.unload=function(){return 0!==f.readyState&&(f.isHTML5?(i(),f._a&&(f._a.pause(),v=tt(f._a))):8===p?ht._unload(f.id,"about:blank"):ht._unload(f.id),e()),f},this.destruct=function(t){f.isHTML5?(i(),f._a&&(f._a.pause(),tt(f._a),Mt||n(),f._a._s=null,f._a=null)):(f._iO.onfailure=null,ht._destroySound(f.id)),t||pt.destroySound(f.id,!0)},this.play=function(t,e){var r,n,i,u,c,_=!0;if(e=e===o||e,t||(t={}),f.url&&(f._iO.url=f.url),f._iO=h(f._iO,f.options),f._iO=h(t,f._iO),f._iO.url=$(f._iO.url),f.instanceOptions=f._iO,!f.isHTML5&&f._iO.serverURL&&!f.connected)return f.getAutoPlay()||f.setAutoPlay(!0),f;if(Y(f._iO)&&(f._setup_html5(f._iO),s()),1===f.playState&&!f.paused&&!f._iO.multiShot)return f.isHTML5&&f.setPosition(f._iO.position),f;if(t.url&&t.url!==f.url&&(f.readyState||f.isHTML5||8!==p||!d?f.load(f._iO):d=!1),!f.loaded)if(0===f.readyState){if(f.isHTML5||pt.html5Only){if(!f.isHTML5)return f;f.load(f._iO)}else f._iO.autoPlay=!0,f.load(f._iO);f.instanceOptions=f._iO}else if(2===f.readyState)return f;return!f.isHTML5&&9===p&&f.position>0&&f.position===f.duration&&(t.position=0),f.paused&&f.position>=0&&(!f._iO.serverURL||f.position>0)?f.resume():(f._iO=h(t,f._iO),(!f.isHTML5&&null!==f._iO.position&&f._iO.position>0||null!==f._iO.from&&f._iO.from>0||null!==f._iO.to)&&0===f.instanceCount&&0===f.playState&&!f._iO.serverURL&&(n=function(){f._iO=h(t,f._iO),f.play(f._iO)},f.isHTML5&&!f._html5_canplay?f.load({_oncanplay:n}):f.isHTML5||f.loaded||f.readyState&&2===f.readyState||f.load({onload:n}),f._iO=l()),(!f.instanceCount||f._iO.multiShotEvents||f.isHTML5&&f._iO.multiShot&&!Mt||!f.isHTML5&&p>8&&!f.getAutoPlay())&&f.instanceCount++,f._iO.onposition&&0===f.playState&&a(f),f.playState=1,f.paused=!1,f.position=f._iO.position===o||isNaN(f._iO.position)?0:f._iO.position,f.isHTML5||(f._iO=z(q(f._iO))),f._iO.onplay&&e&&(f._iO.onplay.apply(f),g=!0),f.setVolume(f._iO.volume,!0),f.setPan(f._iO.pan,!0),1!==f._iO.playbackRate&&f.setPlaybackRate(f._iO.playbackRate),f.isHTML5?f.instanceCount<2?(s(),r=f._setup_html5(),f.setPosition(f._iO.position),r.play()):(i=new Audio(f._iO.url),u=function(){nt.remove(i,"ended",u),f._onfinish(f),tt(i),i=null},c=function(){nt.remove(i,"canplay",c);try{i.currentTime=f._iO.position/1e3}catch(t){}i.play()},nt.add(i,"ended",u),f._iO.volume!==o&&(i.volume=Math.max(0,Math.min(1,f._iO.volume/100))),f.muted&&(i.muted=!0),f._iO.position?nt.add(i,"canplay",c):i.play()):(_=ht._start(f.id,f._iO.loops||1,9===p?f.position:f.position/1e3,f._iO.multiShot||!1),9!==p||_||f._iO.onplayerror&&f._iO.onplayerror.apply(f))),f},this.start=this.play,this.stop=function(t){var e,r=f._iO;return 1===f.playState&&(f._onbufferchange(0),f._resetOnPosition(0),f.paused=!1,f.isHTML5||(f.playState=0),u(),r.to&&f.clearOnPosition(r.to),f.isHTML5?f._a&&(e=f.position,f.setPosition(0),f.position=e,f._a.pause(),f.playState=0,f._onTimer(),i()):(ht._stop(f.id,t),r.serverURL&&f.unload()),f.instanceCount=0,f._iO={},r.onstop&&r.onstop.apply(f)),f},this.setAutoPlay=function(t){f._iO.autoPlay=t,f.isHTML5||(ht._setAutoPlay(f.id,t),t&&(f.instanceCount||1!==f.readyState||f.instanceCount++))},this.getAutoPlay=function(){return f._iO.autoPlay},this.setPlaybackRate=function(t){var e=Math.max(.5,Math.min(4,t));if(f.isHTML5)try{f._iO.playbackRate=e,f._a.playbackRate=e}catch(t){}return f},this.setPosition=function(t){t===o&&(t=0);var e,r,n=f.isHTML5?Math.max(t,0):Math.min(f.duration||f._iO.duration,Math.max(t,0));if(f.position=n,r=f.position/1e3,f._resetOnPosition(f.position),f._iO.position=n,f.isHTML5){if(f._a){if(f._html5_canplay){if(f._a.currentTime.toFixed(3)!==r.toFixed(3))try{f._a.currentTime=r,(0===f.playState||f.paused)&&f._a.pause()}catch(t){}}else if(r)return f;f.paused&&f._onTimer(!0)}}else e=9===p?f.position:r,f.readyState&&2!==f.readyState&&ht._setPosition(f.id,e,f.paused||!f.playState,f._iO.multiShot);return f},this.pause=function(t){return f.paused||0===f.playState&&1!==f.readyState?f:(f.paused=!0,f.isHTML5?(f._setup_html5().pause(),i()):(t||t===o)&&ht._pause(f.id,f._iO.multiShot),f._iO.onpause&&f._iO.onpause.apply(f),f)},this.resume=function(){var t=f._iO;return f.paused?(f.paused=!1,f.playState=1,f.isHTML5?(f._setup_html5().play(),s()):(t.isMovieStar&&!t.serverURL&&f.setPosition(f.position),ht._pause(f.id,t.multiShot)),!g&&t.onplay?(t.onplay.apply(f),g=!0):t.onresume&&t.onresume.apply(f),f):f},this.togglePause=function(){return 0===f.playState?(f.play({position:9!==p||f.isHTML5?f.position/1e3:f.position}),f):(f.paused?f.resume():f.pause(),f)},this.setPan=function(t,e){return t===o&&(t=0),e===o&&(e=!1),f.isHTML5||ht._setPan(f.id,t),f._iO.pan=t,e||(f.pan=t,f.options.pan=t),f},this.setVolume=function(t,e){return t===o&&(t=100),e===o&&(e=!1),f.isHTML5?f._a&&(pt.muted&&!f.muted&&(f.muted=!0,f._a.muted=!0),f._a.volume=Math.max(0,Math.min(1,t/100))):ht._setVolume(f.id,pt.muted&&!f.muted||f.muted?0:t),f._iO.volume=t,e||(f.volume=t,f.options.volume=t),f},this.mute=function(){return f.muted=!0,f.isHTML5?f._a&&(f._a.muted=!0):ht._setVolume(f.id,0),f},this.unmute=function(){f.muted=!1;var t=f._iO.volume!==o;return f.isHTML5?f._a&&(f._a.muted=!1):ht._setVolume(f.id,t?f._iO.volume:f.options.volume),f},this.toggleMute=function(){return f.muted?f.unmute():f.mute()},this.onPosition=function(t,e,r){return _.push({position:parseInt(t,10),method:e,scope:r!==o?r:f,fired:!1}),f},this.onposition=this.onPosition,this.clearOnPosition=function(t,e){var r;if(t=parseInt(t,10),!isNaN(t))for(r=0;r<_.length;r++)t===_[r].position&&(e&&e!==_[r].method||(_[r].fired&&y--,_.splice(r,1)))},this._processOnPosition=function(){var t,e,r=_.length;if(!r||!f.playState||y>=r)return!1;for(t=r-1;t>=0;t--)e=_[t],!e.fired&&f.position>=e.position&&(e.fired=!0,y++,e.method.apply(e.scope,[e.position]),r=_.length);return!0},this._resetOnPosition=function(t){var e,r,n=_.length;if(!n)return!1;for(e=n-1;e>=0;e--)r=_[e],r.fired&&t<=r.position&&(r.fired=!1,y--);return!0},l=function(){var t,e,r=f._iO,n=r.from,i=r.to;return e=function(){f.clearOnPosition(i,e),f.stop()},t=function(){null===i||isNaN(i)||f.onPosition(i,e)},null===n||isNaN(n)||(r.position=n,r.multiShot=!1,t()),r},a=function(){var t,e=f._iO.onposition;if(e)for(t in e)e.hasOwnProperty(t)&&f.onPosition(parseInt(t,10),e[t])},u=function(){var t,e=f._iO.onposition;if(e)for(t in e)e.hasOwnProperty(t)&&f.clearOnPosition(parseInt(t,10))},s=function(){f.isHTML5&&V(f)},i=function(){f.isHTML5&&W(f)},e=function(t){t||(_=[],y=0),g=!1,f._hasTimer=null,f._a=null,f._html5_canplay=!1,f.bytesLoaded=null,f.bytesTotal=null,f.duration=f._iO&&f._iO.duration?f._iO.duration:null,f.durationEstimate=null,f.buffered=[],f.eqData=[],f.eqData.left=[],f.eqData.right=[],f.failures=0,f.isBuffering=!1,f.instanceOptions={},f.instanceCount=0,f.loaded=!1,f.metadata={},f.readyState=0,f.muted=!1,f.paused=!1,f.peakData={left:0,right:0},f.waveformData={left:[],right:[]},f.playState=0,f.position=null,f.id3={}},e(),this._onTimer=function(t){var e,r,n=!1,i={};return(f._hasTimer||t)&&f._a&&(t||(f.playState>0||1===f.readyState)&&!f.paused)&&(e=f._get_html5_duration(),e!==c.duration&&(c.duration=e,f.duration=e,n=!0),f.durationEstimate=f.duration,r=1e3*f._a.currentTime||0,r!==c.time&&(c.time=r,n=!0),(n||t)&&f._whileplaying(r,i,i,i,i)),n},this._get_html5_duration=function(){var t=f._iO,e=f._a&&f._a.duration?1e3*f._a.duration:t&&t.duration?t.duration:null;return e&&!isNaN(e)&&e!==1/0?e:null},this._apply_loop=function(t,e){t.loop=e>1?"loop":""},this._setup_html5=function(t){var n,i=h(f._iO,t),o=Mt?dt:f._a,s=decodeURI(i.url);if(Mt?s===decodeURI(it)&&(n=!0):s===decodeURI(v)&&(n=!0),o){if(o._s)if(Mt)o._s&&o._s.playState&&!n&&o._s.stop();else if(!Mt&&s===decodeURI(v))return f._apply_loop(o,i.loops),o;n||(v&&e(!1),o.src=i.url,f.url=i.url,v=i.url,it=i.url,o._called_load=!1)}else i.autoLoad||i.autoPlay?(f._a=new Audio(i.url),f._a.load()):f._a=jt&&opera.version()<10?new Audio(null):new Audio,o=f._a,o._called_load=!1,Mt&&(dt=o);return f.isHTML5=!0,f._a=o,o._s=f,r(),f._apply_loop(o,i.loops),i.autoLoad||i.autoPlay?f.load():(o.autobuffer=!1,o.preload="auto"),o},r=function(){if(f._a._added_events)return!1;var t;f._a._added_events=!0;for(t in ut)ut.hasOwnProperty(t)&&function(t,e,r){f._a&&f._a.addEventListener(t,e,r||!1)}(t,ut[t]);return!0},n=function(){var t;f._a._added_events=!1;for(t in ut)ut.hasOwnProperty(t)&&function(t,e,r){f._a&&f._a.removeEventListener(t,e,r||!1)}(t,ut[t])},this._onload=function(t){var e=!!t||!f.isHTML5&&8===p&&f.duration;return f.loaded=e,f.readyState=e?3:2,f._onbufferchange(0),e||f.isHTML5||f._onerror(),f._iO.onload&&lt(f,function(){f._iO.onload.apply(f,[e])}),!0},this._onerror=function(t,e){f._iO.onerror&&lt(f,function(){f._iO.onerror.apply(f,[t,e])})},this._onbufferchange=function(t){return 0!==f.playState&&(!(t&&f.isBuffering||!t&&!f.isBuffering)&&(f.isBuffering=1===t,f._iO.onbufferchange&&f._iO.onbufferchange.apply(f,[t]),!0))},this._onsuspend=function(){return f._iO.onsuspend&&f._iO.onsuspend.apply(f),!0},this._onfailure=function(t,e,r){f.failures++,f._iO.onfailure&&1===f.failures&&f._iO.onfailure(t,e,r)},this._onwarning=function(t,e,r){f._iO.onwarning&&f._iO.onwarning(t,e,r)},this._onfinish=function(){var t=f._iO.onfinish;f._onbufferchange(0),f._resetOnPosition(0),f.instanceCount&&(f.instanceCount--,f.instanceCount||(u(),f.playState=0,f.paused=!1,f.instanceCount=0,f.instanceOptions={},f._iO={},i(),f.isHTML5&&(f.position=0)),f.instanceCount&&!f._iO.multiShotEvents||t&&lt(f,function(){t.apply(f)}))},this._whileloading=function(t,e,r,n){var i=f._iO;f.bytesLoaded=t,f.bytesTotal=e,f.duration=Math.floor(r),f.bufferLength=n,f.isHTML5||i.isMovieStar?f.durationEstimate=f.duration:i.duration?f.durationEstimate=f.duration>i.duration?f.duration:i.duration:f.durationEstimate=parseInt(f.bytesTotal/f.bytesLoaded*f.duration,10),f.isHTML5||(f.buffered=[{start:0,end:f.duration}]),(3!==f.readyState||f.isHTML5)&&i.whileloading&&i.whileloading.apply(f)},this._whileplaying=function(t,e,r,n,i){var s,a=f._iO;return!isNaN(t)&&null!==t&&(f.position=Math.max(0,t),f._processOnPosition(),!f.isHTML5&&p>8&&(a.usePeakData&&e!==o&&e&&(f.peakData={left:e.leftPeak,right:e.rightPeak}),a.useWaveformData&&r!==o&&r&&(f.waveformData={left:r.split(","),right:n.split(",")}),a.useEQData&&i!==o&&i&&i.leftEQ&&(s=i.leftEQ.split(","),f.eqData=s,f.eqData.left=s,i.rightEQ!==o&&i.rightEQ&&(f.eqData.right=i.rightEQ.split(",")))),1===f.playState&&(f.isHTML5||8!==p||f.position||!f.isBuffering||f._onbufferchange(0),a.whileplaying&&a.whileplaying.apply(f)),!0)},this._oncaptiondata=function(t){f.captiondata=t,f._iO.oncaptiondata&&f._iO.oncaptiondata.apply(f,[t])},this._onmetadata=function(t,e){var r,n,i={};for(r=0,n=t.length;r<n;r++)i[t[r]]=e[r];f.metadata=i,f._iO.onmetadata&&f._iO.onmetadata.call(f,f.metadata)},this._onid3=function(t,e){var r,n,i=[];for(r=0,n=t.length;r<n;r++)i[t[r]]=e[r];f.id3=h(f.id3,i),f._iO.onid3&&f._iO.onid3.apply(f)},this._onconnect=function(t){t=1===t,f.connected=t,t&&(f.failures=0,H(f.id)&&(f.getAutoPlay()?f.play(o,f.getAutoPlay()):f._iO.autoLoad&&f.load()),f._iO.onconnect&&f._iO.onconnect.apply(f,[t]))},this._ondataerror=function(t){f.playState>0&&f._iO.ondataerror&&f._iO.ondataerror.apply(f)}},T=function(){return _t.body||_t.getElementsByTagName("div")[0]},a=function(t){return _t.getElementById(t)},h=function(t,e){var r,n,i=t||{};r=e===o?pt.defaultOptions:e;for(n in r)r.hasOwnProperty(n)&&i[n]===o&&("object"!=typeof r[n]||null===r[n]?i[n]=r[n]:i[n]=h(i[n],r[n]));return i},lt=function(t,e){t.isHTML5||8!==p?e():i.setTimeout(e,0)},g={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},f=function(t,e){var r,n=!0,i=e!==o,s=pt.setupOptions,a=g;for(r in t)if(t.hasOwnProperty(r))if("object"!=typeof t[r]||null===t[r]||t[r]instanceof Array||t[r]instanceof RegExp)i&&a[e]!==o?pt[e][r]=t[r]:s[r]!==o?(pt.setupOptions[r]=t[r],pt[r]=t[r]):a[r]===o?n=!1:pt[r]instanceof Function?pt[r].apply(pt,t[r]instanceof Array?t[r]:[t[r]]):pt[r]=t[r];else{if(a[r]!==o)return f(t[r],r);n=!1}return n},nt=function(){function t(t){var e=Rt.call(t),r=e.length;return o?(e[1]="on"+e[1],r>3&&e.pop()):3===r&&e.push(!1),e}function e(t,e){var r=t.shift(),n=[s[e]];o?r[n](t[0],t[1]):r[n].apply(r,t)}function r(){e(t(arguments),"add")}function n(){e(t(arguments),"remove")}var o=i.attachEvent,s={add:o?"attachEvent":"addEventListener",remove:o?"detachEvent":"removeEventListener"};return{add:r,remove:n}}(),ut={abort:n(function(){}),canplay:n(function(){var t,e=this._s;if(!e._html5_canplay){if(e._html5_canplay=!0,e._onbufferchange(0),t=e._iO.position===o||isNaN(e._iO.position)?null:e._iO.position/1e3,this.currentTime!==t)try{this.currentTime=t}catch(t){}e._iO._oncanplay&&e._iO._oncanplay()}}),canplaythrough:n(function(){var t=this._s;t.loaded||(t._onbufferchange(0),t._whileloading(t.bytesLoaded,t.bytesTotal,t._get_html5_duration()),t._onload(!0))}),durationchange:n(function(){var t,e=this._s;t=e._get_html5_duration(),isNaN(t)||t===e.duration||(e.durationEstimate=e.duration=t)}),ended:n(function(){this._s._onfinish()}),error:n(function(){var t=X[this.error.code]||null;this._s._onload(!1),this._s._onerror(this.error.code,t)}),loadeddata:n(function(){var t=this._s;t._loaded||Nt||(t.duration=t._get_html5_duration())}),loadedmetadata:n(function(){}),loadstart:n(function(){this._s._onbufferchange(1)}),play:n(function(){this._s._onbufferchange(0)}),playing:n(function(){this._s._onbufferchange(0)}),progress:n(function(t){var e,r,n=this._s,i=0,o=(t.type,t.target.buffered),s=t.loaded||0,a=t.total||1;if(n.buffered=[],o&&o.length){for(e=0,r=o.length;e<r;e++)n.buffered.push({start:1e3*o.start(e),end:1e3*o.end(e)});i=1e3*(o.end(0)-o.start(0)),s=Math.min(1,i/(1e3*t.target.duration))}isNaN(s)||(n._whileloading(s,a,n._get_html5_duration()),s&&a&&s===a&&ut.canplaythrough.call(this,t))}),ratechange:n(function(){}),suspend:n(function(t){var e=this._s;ut.progress.call(this,t),e._onsuspend()}),stalled:n(function(){}),timeupdate:n(function(){this._s._onTimer()}),waiting:n(function(){this._s._onbufferchange(1)})},Y=function(t){return!(!t||!(t.type||t.url||t.serverURL))&&(!(t.serverURL||t.type&&r(t.type))&&(t.type?K({type:t.type}):K({url:t.url})||pt.html5Only||t.url.match(/data:/i)))},tt=function(t){var e;return t&&(e=Nt?"about:blank":pt.html5.canPlayType("audio/wav")?"data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w==":"about:blank",t.src=e,t._called_unload!==o&&(t._called_load=!1)),Mt&&(it=null),e},K=function(t){if(!pt.useHTML5Audio||!pt.hasHTML5)return!1;var e,n,i,s,a=t.url||null,u=t.type||null,l=pt.audioFormats;if(u&&pt.html5[u]!==o)return pt.html5[u]&&!r(u);if(!Z){Z=[];for(s in l)l.hasOwnProperty(s)&&(Z.push(s),l[s].related&&(Z=Z.concat(l[s].related)));Z=new RegExp("\\.("+Z.join("|")+")(\\?.*)?$","i")}return i=a?a.toLowerCase().match(Z):null,i&&i.length?i=i[1]:u?(n=u.indexOf(";"),i=(-1!==n?u.substr(0,n):u).substr(6)):e=!1,i&&pt.html5[i]!==o?e=pt.html5[i]&&!r(i):(u="audio/"+i,e=pt.html5.canPlayType({type:u}),pt.html5[i]=e,e=e&&pt.html5[u]&&!r(u)),e},rt=function(){function t(t){var e,r,n=!1,o=!1;if(!s||"function"!=typeof s.canPlayType)return n;if(t instanceof Array){for(i=0,r=t.length;i<r;i++)(pt.html5[t[i]]||s.canPlayType(t[i]).match(pt.html5Test))&&(o=!0,pt.html5[t[i]]=!0,pt.flash[t[i]]=!!t[i].match(Wt));n=o}else e=!(!s||"function"!=typeof s.canPlayType)&&s.canPlayType(t),n=!(!e||!e.match(pt.html5Test));return n}if(!pt.useHTML5Audio||!pt.hasHTML5)return pt.html5.usingFlash=!0,Ct=!0,!1;var e,r,n,i,s=Audio!==o?jt&&opera.version()<10?new Audio(null):new Audio:null,a={};n=pt.audioFormats;for(e in n)if(n.hasOwnProperty(e)&&(r="audio/"+e,a[e]=t(n[e].type),a[r]=a[e],e.match(Wt)?(pt.flash[e]=!0,pt.flash[r]=!0):(pt.flash[e]=!1,pt.flash[r]=!1),n[e]&&n[e].related))for(i=n[e].related.length-1;i>=0;i--)a["audio/"+n[e].related[i]]=a[e],pt.html5[n[e].related[i]]=a[e],pt.flash[n[e].related[i]]=a[e];return a.canPlayType=s?t:null,pt.html5=h(pt.html5,a),pt.html5.usingFlash=Q(),Ct=pt.html5.usingFlash,!0},S={},U=function(){},q=function(t){return 8===p&&t.loops>1&&t.stream&&(t.stream=!1),t},z=function(t,e){return t&&!t.usePolicyFile&&(t.onid3||t.usePeakData||t.useWaveformData||t.useEQData)&&(t.usePolicyFile=!0),t},u=function(){return!1},D=function(t){var e;for(e in t)t.hasOwnProperty(e)&&"function"==typeof t[e]&&(t[e]=u);e=null},L=function(t){t===o&&(t=!1),(wt||t)&&pt.disable(t)},F=function(t){var e;if(t)if(t.match(/\.swf(\?.*)?$/i)){if(t.substr(t.toLowerCase().lastIndexOf(".swf?")+4))return t}else t.lastIndexOf("/")!==t.length-1&&(t+="/");return e=(t&&-1!==t.lastIndexOf("/")?t.substr(0,t.lastIndexOf("/")+1):"./")+pt.movieURL,pt.noSWFCache&&(e+="?ts="+(new Date).getTime()),e},E=function(){8!==(p=parseInt(pt.flashVersion,10))&&9!==p&&(pt.flashVersion=p=8);var t=pt.debugMode||pt.debugFlash?"_debug.swf":".swf";pt.useHTML5Audio&&!pt.html5Only&&pt.audioFormats.mp4.required&&p<9&&(pt.flashVersion=p=9),pt.version=pt.versionNumber+(pt.html5Only?" (HTML5-only mode)":9===p?" (AS3/Flash 9)":" (AS2/Flash 8)"),p>8?(pt.defaultOptions=h(pt.defaultOptions,pt.flash9Options),pt.features.buffering=!0,pt.defaultOptions=h(pt.defaultOptions,pt.movieStarOptions),pt.filePatterns.flash9=new RegExp("\\.(mp3|"+Qt.join("|")+")(\\?.*)?$","i"),pt.features.movieStar=!0):pt.features.movieStar=!1,pt.filePattern=pt.filePatterns[8!==p?"flash9":"flash8"],pt.movieURL=(8===p?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",t),pt.features.peakData=pt.features.waveformData=pt.features.eqData=p>8},M=function(t,e){ht&&ht._setPolling(t,e)},I=function(){},H=this.getSoundById,j=function(){var t=[];return pt.debugMode&&t.push(B.sm2Debug),pt.debugFlash&&t.push(B.flashDebug),pt.useHighPerformance&&t.push(B.highPerf),t.join(" ")},N=function(){var t=(U("fbHandler"),pt.getMoviePercent()),e=B,r={type:"FLASHBLOCK"};pt.html5Only||(pt.ok()?pt.oMC&&(pt.oMC.className=[j(),e.swfDefault,e.swfLoaded+(pt.didFlashBlock?" "+e.swfUnblocked:"")].join(" ")):(Ct&&(pt.oMC.className=j()+" "+e.swfDefault+" "+(null===t?e.swfTimedout:e.swfError)),pt.didFlashBlock=!0,y({type:"ontimeout",ignoreInit:!0,error:r}),R(r)))},_=function(t,e,r){yt[t]===o&&(yt[t]=[]),yt[t].push({method:e,scope:r||null,fired:!1})},y=function(t){if(t||(t={type:pt.ok()?"onready":"ontimeout"}),!bt&&t&&!t.ignoreInit)return!1;if("ontimeout"===t.type&&(pt.ok()||wt&&!t.ignoreInit))return!1;var e,r,n={success:t&&t.ignoreInit?pt.ok():!wt},i=t&&t.type?yt[t.type]||[]:[],o=[],s=[n],a=Ct&&!pt.ok();for(t.error&&(s[0].error=t.error),e=0,r=i.length;e<r;e++)!0!==i[e].fired&&o.push(i[e]);if(o.length)for(e=0,r=o.length;e<r;e++)o[e].scope?o[e].method.apply(o[e].scope,s):o[e].method.apply(this,s),a||(o[e].fired=!0);return!0},v=function(){i.setTimeout(function(){pt.useFlashBlock&&N(),y(),"function"==typeof pt.onload&&pt.onload.apply(i),pt.waitForWindowLoad&&nt.add(i,"load",v)},1)},st=function(){if(ot!==o)return ot;var t,e,r,n,s=!1,a=navigator,u=i.ActiveXObject;try{n=a.plugins}catch(t){n=void 0}if(n&&n.length)e="application/x-shockwave-flash",(r=a.mimeTypes)&&r[e]&&r[e].enabledPlugin&&r[e].enabledPlugin.description&&(s=!0);else if(u!==o&&!ft.match(/MSAppHost/i)){try{t=new u("ShockwaveFlash.ShockwaveFlash")}catch(e){t=null}s=!!t,t=null}return ot=s,s},Q=function(){var t,e,r=pt.audioFormats;if(Dt&&!!ft.match(/os (1|2|3_0|3_1)\s/i)?(pt.hasHTML5=!1,pt.html5Only=!0,pt.oMC&&(pt.oMC.style.display="none")):pt.useHTML5Audio&&(pt.html5&&pt.html5.canPlayType||(pt.hasHTML5=!1)),pt.useHTML5Audio&&pt.hasHTML5){J=!0;for(e in r)r.hasOwnProperty(e)&&r[e].required&&(pt.html5.canPlayType(r[e].type)?pt.preferFlash&&(pt.flash[e]||pt.flash[r[e].type])&&(t=!0):(J=!1,t=!0))}return pt.ignoreFlash&&(t=!1,J=!0),pt.html5Only=pt.hasHTML5&&pt.useHTML5Audio&&!t,!pt.html5Only},$=function(t){var e,r,n,i=0;if(t instanceof Array){for(e=0,r=t.length;e<r;e++)if(t[e]instanceof Object){if(pt.canPlayMIME(t[e].type)){i=e;break}}else if(pt.canPlayURL(t[e])){i=e;break}t[i].url&&(t[i]=t[i].url),n=t[i]}else n=t;return n},V=function(t){t._hasTimer||(t._hasTimer=!0,!Bt&&pt.html5PollingInterval&&(null===Ot&&0===At&&(Ot=setInterval(G,pt.html5PollingInterval)),At++))},W=function(t){t._hasTimer&&(t._hasTimer=!1,!Bt&&pt.html5PollingInterval&&At--)},G=function(){var t;if(null!==Ot&&!At)return clearInterval(Ot),void(Ot=null);for(t=pt.soundIDs.length-1;t>=0;t--)pt.sounds[pt.soundIDs[t]].isHTML5&&pt.sounds[pt.soundIDs[t]]._hasTimer&&pt.sounds[pt.soundIDs[t]]._onTimer()},R=function(t){t=t!==o?t:{},"function"==typeof pt.onerror&&pt.onerror.apply(i,[{type:t.type!==o?t.type:null}]),t.fatal!==o&&t.fatal&&pt.disable()},at=function(){if(qt&&st()){var t,e,r=pt.audioFormats;for(e in r)if(r.hasOwnProperty(e)&&("mp3"===e||"mp4"===e)&&(pt.html5[e]=!1,r[e]&&r[e].related))for(t=r[e].related.length-1;t>=0;t--)pt.html5[r[e].related[t]]=!1}},this._setSandboxType=function(t){},this._externalInterfaceOK=function(t){if(!pt.swfLoaded){pt.swfLoaded=!0,Ht=!1,qt&&at(),setTimeout(c,Ft?100:1)}},C=function(t,e){function r(t,e){return'<param name="'+t+'" value="'+e+'" />'}if(vt&&mt)return!1;if(pt.html5Only)return E(),pt.oMC=a(pt.movieID),c(),vt=!0,mt=!0,!1;var n,i,s,u,l,p,d,h,f=e||pt.url,g=pt.altURL||f,_=T(),y=j(),v=null,m=_t.getElementsByTagName("html")[0];if(v=m&&m.dir&&m.dir.match(/rtl/i),t=t===o?pt.id:t,E(),pt.url=F(Gt?f:g),e=pt.url,pt.wmode=!pt.wmode&&pt.useHighPerformance?"transparent":pt.wmode,null!==pt.wmode&&(ft.match(/msie 8/i)||!Ft&&!pt.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Tt.push(S.spcWmode),pt.wmode=null),n={name:t,id:t,src:e,quality:"high",allowScriptAccess:pt.allowScriptAccess,bgcolor:pt.bgColor,pluginspage:$t+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:pt.wmode,hasPriority:"true"},pt.debugFlash&&(n.FlashVars="debug=1"),pt.wmode||delete n.wmode,Ft)i=_t.createElement("div"),u=['<object id="'+t+'" data="'+e+'" type="'+n.type+'" title="'+n.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">',r("movie",e),r("AllowScriptAccess",pt.allowScriptAccess),r("quality",n.quality),pt.wmode?r("wmode",pt.wmode):"",r("bgcolor",pt.bgColor),r("hasPriority","true"),pt.debugFlash?r("FlashVars",n.FlashVars):"","</object>"].join("");else{i=_t.createElement("embed");for(s in n)n.hasOwnProperty(s)&&i.setAttribute(s,n[s])}if(I(),y=j(),_=T())if(pt.oMC=a(pt.movieID)||_t.createElement("div"),pt.oMC.id)h=pt.oMC.className,pt.oMC.className=(h?h+" ":B.swfDefault)+(y?" "+y:""),pt.oMC.appendChild(i),Ft&&(l=pt.oMC.appendChild(_t.createElement("div")),l.className=B.swfBox,l.innerHTML=u),mt=!0;else{if(pt.oMC.id=pt.movieID,pt.oMC.className=B.swfDefault+" "+y,p=null,l=null,pt.useFlashBlock||(pt.useHighPerformance?p={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(p={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},v&&(p.left=Math.abs(parseInt(p.left,10))+"px"))),Ut&&(pt.oMC.style.zIndex=1e4),!pt.debugFlash)for(d in p)p.hasOwnProperty(d)&&(pt.oMC.style[d]=p[d]);try{Ft||pt.oMC.appendChild(i),_.appendChild(pt.oMC),Ft&&(l=pt.oMC.appendChild(_t.createElement("div")),l.className=B.swfBox,l.innerHTML=u),mt=!0}catch(t){throw new Error(U("domError")+" \n"+t.toString())}}return vt=!0,!0},x=function(){return pt.html5Only?(C(),!1):!ht&&(!!pt.url&&(ht=pt.getMovie(pt.id),ht||(Pt?(Ft?pt.oMC.innerHTML=St:pt.oMC.appendChild(Pt),Pt=null,vt=!0):C(pt.id,pt.url),ht=pt.getMovie(pt.id)),"function"==typeof pt.oninitmovie&&setTimeout(pt.oninitmovie,1),!0))},m=function(){setTimeout(b,1e3)},w=function(){i.setTimeout(function(){pt.setup({preferFlash:!1}).reboot(),pt.didFlashBlock=!0,pt.beginDelayedInit()},1)},b=function(){var t,e=!1;pt.url&&(xt||(xt=!0,nt.remove(i,"load",m),ot&&Ht&&!zt||(bt||(t=pt.getMoviePercent())>0&&t<100&&(e=!0),setTimeout(function(){if(t=pt.getMoviePercent(),e)return xt=!1,void i.setTimeout(m,1);!bt&&Vt&&(null===t?pt.useFlashBlock||0===pt.flashLoadTimeout?pt.useFlashBlock&&N():!pt.useFlashBlock&&J?w():y({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}}):0===pt.flashLoadTimeout||(!pt.useFlashBlock&&J?w():L(!0)))},pt.flashLoadTimeout))))},P=function(){function t(){nt.remove(i,"focus",P)}return zt||!Ht?(t(),!0):(Vt=!0,zt=!0,xt=!1,m(),t(),!0)},d=function(t){if(bt)return!1;if(pt.html5Only)return bt=!0,v(),!0;var e,r=pt.useFlashBlock&&pt.flashLoadTimeout&&!pt.getMoviePercent(),n=!0;return r||(bt=!0),e={type:!ot&&Ct?"NO_FLASH":"INIT_TIMEOUT"},(wt||t)&&(pt.useFlashBlock&&pt.oMC&&(pt.oMC.className=j()+" "+(null===pt.getMoviePercent()?B.swfTimedout:B.swfError)),y({type:"ontimeout",error:e,ignoreInit:!0}),R(e),n=!1),wt||(pt.waitForWindowLoad&&!Et?nt.add(i,"load",v):v()),n},l=function(){var t,e=pt.setupOptions;for(t in e)e.hasOwnProperty(t)&&(pt[t]===o?pt[t]=e[t]:pt[t]!==e[t]&&(pt.setupOptions[t]=pt[t]))},c=function(){function t(){nt.remove(i,"load",pt.beginDelayedInit)}if(bt)return!1;if(pt.html5Only)return bt||(t(),pt.enabled=!0,d()),!0;x();try{ht._externalInterfaceTest(!1),M(!0,pt.flashPollingInterval||(pt.useHighPerformance?10:50)),pt.debugMode||ht._disableDebug(),pt.enabled=!0,pt.html5Only||nt.add(i,"unload",u)}catch(t){return R({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),L(!0),d(),!1}return d(),t(),!0},k=function(){return!O&&(O=!0,l(),I(),!ot&&pt.hasHTML5&&pt.setup({useHTML5Audio:!0,preferFlash:!1}),rt(),!ot&&Ct&&(Tt.push(S.needFlash),pt.setup({flashLoadTimeout:1})),_t.removeEventListener&&_t.removeEventListener("DOMContentLoaded",k,!1),x(),!0)},et=function(){return"complete"===_t.readyState&&(k(),_t.detachEvent("onreadystatechange",et)),!0},A=function(){Et=!0,k(),nt.remove(i,"load",A)},st(),nt.add(i,"focus",P),nt.add(i,"load",m),nt.add(i,"load",A),_t.addEventListener?_t.addEventListener("DOMContentLoaded",k,!1):_t.attachEvent?_t.attachEvent("onreadystatechange",et):R({type:"NO_DOM2_EVENTS",fatal:!0})}if(!i||!i.document)throw new Error("SoundManager requires a browser with window and document objects.");var a=null;i.SM2_DEFER!==o&&SM2_DEFER||(a=new s),"object"==typeof t&&t&&"object"==typeof t.exports?(t.exports.SoundManager=s,t.exports.soundManager=a):void 0!==(n=function(){function t(t){if(!i.soundManager&&t instanceof Function){var e=t(s);e instanceof s&&(i.soundManager=e)}return i.soundManager}return{constructor:s,getInstance:t}}.call(e,r,e,t))&&(t.exports=n),i.SoundManager=s,i.soundManager=a}(window)}).call(e,r(46)(t))},function(t,e,r){var n,i,o,s,a,u,l,c,p,d,h;h=function(t){return(window.opener||window.parent).postMessage(JSON.stringify(t),"*")},o=window.location.hash.replace("#",""),a={},n=null,u={load:function(){return h({t:"w",id:o})},notify:function(t,e){return t=t.type||t,h({t:"ee",id:o,d:e,e:t})}},c=function(t,e){var r,i,a,u,l;if(null==e&&(e={}),i=e.preview||e.source.frames[o])return i.Blogvio.auth.token(n),window.require._require.push(i.require),a=i.getData(),r=a.composition,l=a.widget,u=a.user,u||(u={id:"591bf4ecd85c6d076c787001",premium:!1,upload_token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1OTFiZjRlY2Q4NWM2ZDA3NmM3ODcwMDEiLCJjb250ZXh0Ijp7ImlkIjoiYXBwIiwibmFtZSI6ImFwcCJ9LCJtYXhRdW90YSI6MTAwMDAwMDAwMCwiYXVkIjoiZmlsZS11cGxvYWQiLCJleHAiOjE2MjI2MjY4NTF9.Hg_6L3taBamqc9hkxk9cMWh3HihwyvtMzev_K384xPE"}),s(r,l,i,u)},s=function(t,e,n,i){var o,s,c,p;return(o=$("body")).toggleClass("is-popup",!!window.opener),c=r(128),p=(null!=i?i.premium:void 0)||!1,s=r(113).default,s.init({user:i,uploadToken:(null!=i?i.upload_token:void 0)||""}),window.editor=new c({el:o,remote:n,initOptions:a,premium:p}),t?editor.edit(t.id).then(l).fail(function(t){return console.log(t.stack)}):editor.new(e.id).then(l).fail(function(t){return console.log(t.stack)}),editor.bind("skin:select",function(t){return u.notify("skin:select",t)}),editor.$bind("skin:save",function(t,e){return u.notify("skin:save",e)}),editor.$bind("skin:destroy",function(t,e){return u.notify("skin:destroy",e)}),editor.$bind("composition:save",u.notify),editor.$bind("composition:temporary:save",u.notify),editor.$bind("content:auth-req",u.notify),editor.$bind("step:intent",u.notify),editor.$bind("Control:upgrade",u.notify),editor.$bind("Content:upgrade",u.notify),$(window).on("unload",window.editor.release.bind(editor)),editor},l=function(){return u.notify("editor:init")},i=function(t){var e,r,n;r={};for(e in t)"object"!=typeof(n=t[e])&&(r[e]=n);return r},p=function(t){return Widgetic.Event.on(window,t,function(t){return u.notify(Widgetic.UI.Editor.RELAY,i(t))})},d=function(){var t,e,r,i;return r={ready:c,step:function(t){return window.editor.step(t.d)},token:function(t){var e;return t.d?(Blogvio.auth.token(n=t.d),null!=(e=window.editor)?e.preview.remote.Blogvio.auth.token(n):void 0):Blogvio.auth.disconnect()},cont:function(t){return window.editor.el.trigger("content:"+t.d.source+":add",{items:t.d.data})},opts:function(t){return window.editor?window.editor.composition?window.editor.setOptions(t.d):window.editor.setInitOptions(t.d):a=t.d},ree:function(t){return p(t.d)}},i=window.location,t=decodeURIComponent((i.search.match(/(?:lo=)([^\#\&$]*)/)||[0,i.origin])[1]),e=function(e){var n,i,o,s;if(e.origin===t)try{n=JSON.parse(e.data),"function"==typeof r[o=n.t]&&r[o](n,{source:e.source})}catch(t){i=t,null!=(s=window.localStorage)&&s.debug_on_error,console.error(i.stack)}},Blogvio.Event.on(window,"load",function(){return Blogvio.Event.on(window,"message",e),u.load()}),Blogvio.Event.on(window,"unload",function(){return window.editor.release()})},t.exports={run:d,ready:c}},function(t,e,r){var n,i,o,s,a,u,l,c=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty;o=window.require("spine/controller"),i=window.require("spine/controller/container"),l=r(129),a=r(158),u=window.require("core/models/widget"),n=window.require("core/models/composition"),window.require("core/models/skin"),window.require("core/models/content"),s=function(t){function e(t){if(this._onSkinItemSelected=c(this._onSkinItemSelected,this),this._initialize=c(this._initialize,this),this._editComposition=c(this._editComposition,this),this._newComposition=c(this._newComposition,this),!t.remote)throw new Error("Remote UI.composition is missing!");t.premium||(t.premium=!1),e.__super__.constructor.apply(this,arguments),this.preview=new a(this.remote),this.editor=new l({premium:this.premium}),this.append(this.editor),$("html").toggleClass("isTouch",!(void 0===document.documentElement.ontouchstart))}return p(e,t),e.include(i),e.VERSION="1.9.24",e.prototype.events={"SkinItem:selected":"_onSkinItemSelected"},e.prototype.hasPendingChange=function(){return this.editor.hasPendingChange()},e.prototype.initSave=function(){return this.editor.initSave()},e.prototype.new=function(t){return this.preview.startLoading(),u.load(t).then(this._newComposition).then(this._initialize).then(function(t){return function(){return t.setOptions()}}(this)).fail(function(t){return console.error(t)})},e.prototype.edit=function(t){return n.load(t).then(this._editComposition).then(this._initialize).then(function(t){return function(){return t.setOptions()}}(this)).fail(function(t){return console.error(t)})},e.prototype.step=function(){var t;return(t=this.editor).step.apply(t,arguments)},e.prototype.selectSkin=function(t){return this.editor.selectSkin(t)},e.prototype._newComposition=function(t){return this.widget=t,this.composition=new n({widget_id:this.widget.id,width:this.widget.width,height:this.widget.height}),this.composition.save({ajax:!1})},e.prototype._editComposition=function(t){return this.composition=t,this.widget=this.composition.getWidget()},e.prototype._initialize=function(){return this.editor.for(this.composition),this.preview.load(this.composition)},e.prototype._onSkinItemSelected=function(t,e){return this.trigger("skin:select",e),this.preview.setSkin(e)},e.prototype.setInitOptions=function(t){this.initOptions=t},e.prototype.setOptions=function(t){return this.editor.setOptions($.extend({step:"skin"},t||this.initOptions))},e.prototype.release=function(){return this._release(this),this.preview.release(),e.__super__.release.apply(this,arguments)},e}(o),t.exports=s},function(t,e,r){var n,i,o,s,a,u,l,c,p=function(t,e){return function(){return t.apply(e,arguments)}},d=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;u=window.require("spine/controller/tabs"),window.require("core/models/content"),window.require("core/models/skin"),window.require("core/models/composition"),window.require("core/models/widget"),a=r(130),n=r(138),i=r(151),s=r(155),r(116),c=window.require("spine/utils/timestamp"),o=r(156),l=function(t){function e(){this.onBeforeUnload=p(this.onBeforeUnload,this),this.activateSource=p(this.activateSource,this),this.setCompositionName=p(this.setCompositionName,this),this.skin_editor=p(this.skin_editor,this),this.navigation=p(this.navigation,this),this._onInitialized=p(this._onInitialized,this),this._waitForInit=p(this._waitForInit,this),this._onViewChange=p(this._onViewChange,this),this._updateLoggedInStatus=p(this._updateLoggedInStatus,this),this._updatePersistedStatus=p(this._updatePersistedStatus,this),this._onValidateLength=p(this._onValidateLength,this),c("WidgetEditor:constructor"),e.__super__.constructor.apply(this,arguments),this.children(function(t){return function(e){return"function"==typeof e.setPremium?e.setPremium(t.premium):void 0}}(this)),this.refreshElements(),this.el.append(this.tabs.el),o.place(this.el),Blogvio.pubsub.subscribe("api/token/update",this._updateLoggedInStatus),this.el.attr("editorVersion","3.10.53")}return d(e,t),e.prototype.tabContainer=r(116),e.prototype.tabRenderer=r(157),e.prototype.className="editor",e.prototype.tabContainerClass="editor-footer",e.prototype.containerClass="editor-container",e.prototype.events={viewChange:"_onViewChange","Footer:step":"_onStep","Breadcrumb:step":"_onStep","Save:close":"_onSaveClose","DetailsEditor:empty":"_onDetailsEditorEmpty","editor:content:notification":"_onContentNotification","editor:content:browserState":"_onContentBrowserState"},e.prototype.controllers={skin:a,content:n,details:i,save:s},e.prototype.steps={skin:"skin",edit_skin:"skin",theme:"skin",content:"content",details:"details",done:"save"},e.prototype.stepValidators={skin:function(){return!!this.composition||console.warn("No composition set")},edit_skin:function(){return this.stepValidators.skin.call(this)&&null==this.canEditSkin||this.canEditSkin},theme:function(){return this.stepValidators.skin.call(this)},content:function(){return!!this.stepValidators.skin.call(this)&&(!this.hasPendingChange()||(this.initSave(),this.step("skin"),!1))},details:function(){return!!this.stepValidators.content.call(this)&&(!!this.composition.hasEnoughContent()||(this.content.notificator.notify(this.composition.validateLength().errorMsg),this.step("content"),!1))},done:function(){return!!this.stepValidators.details.call(this)}},e.prototype.for=function(t){return c("WidgetEditor:for"),this.initialize(t),this.skin.for(this.composition),this.content.for(this.composition),this.details.for(this.composition),this.save.for(this.composition),this},e.prototype.initialize=function(t){return c("WidgetEditor:initialize"),this.stopListening(this.composition),this.composition=t,this._waitForInit(),this._updatePersistedStatus(),this._updateLoggedInStatus(),this.listenTo(this.composition,"validateLength",this._onValidateLength),this.composition.validateLength(),$(window).on("beforeunload",this.onBeforeUnload)},e.prototype.hasPendingChange=function(){return this.skin.hasPendingChange()},e.prototype.initSave=function(){return this.skin.initSave()},e.prototype.step=function(t){var e;return this.steps[t]?(e=this[this.steps[t]],this.stepValidators[t].call(this)&&e.active(t),this._updatePersistedStatus()):console.warn("The editor does not have the "+t+" step.")},e.prototype.selectSkin=function(t,e){return null==e&&(e=!0),this.skin.select(t,e)},e.prototype._onStep=function(t,e){return this.step(e),this.$trigger("step:intent",{step:e,skin_pending:this.hasPendingChange(),content:this.composition.hasEnoughContent()})},e.prototype._onValidateLength=function(t,e,r){if(this.composition)return this.el.attr({minValid:e||"min"!==r,maxValid:e||"max"!==r})},e.prototype._updatePersistedStatus=function(){return this.el.attr("persisted-comp",this.composition.isPersisted())},e.prototype._updateLoggedInStatus=function(){var t,e;return e=Blogvio.auth.status(),t="connected"===e.status,this.el.toggleClass("anonymous-user",!t)},e.prototype._onViewChange=function(t,e){return this.el.attr("current-view",e)},e.prototype._waitForInit=function(){return this.initCount=0,this.listenToOnce(this.skin,"initialized",this._onInitialized),this.listenToOnce(this.content,"initialized",this._onInitialized),this.listenToOnce(this.details,"initialized",this._onInitialized)},e.prototype._onInitialized=function(){if(3==++this.initCount)return this.trigger("initialized")},e.prototype._onContentNotification=function(t,e){return this.el.attr("notification-visible",e.show)},e.prototype._onContentBrowserState=function(t,e){return this.el.attr("content-browser-service",e.service),this.el.attr("content-browser-auth",e.authenticated)},e.prototype._onDetailsEditorEmpty=function(){return this.step("content")},e.prototype._onSaveClose=function(){return this.step("details")},e.prototype.setOptions=function(){var t;return t={skin_editor:"skin_editor",step:"step",navigation:"navigation",skin:"selectSkin",composition:"setCompositionName",sources:"addContentSources",active_source:"activateSource"},function(e){var r,n,i,o;null==e&&(e={}),o=[];for(i in t)r=t[i],(n=e[i])&&o.push("function"==typeof this[r]?this[r](n):void 0);return o}}(),e.prototype.navigation=function(t){var e;return null!=t.steps&&this.el.attr("data-steps",t.steps.join(" ")),(e=this.tabs).setOptions.apply(e,arguments)},e.prototype.skin_editor=function(t){return null==t&&(t={}),null!=t.enabled&&(this.canEditSkin=t.enabled),this.skin.setOptions(t)},e.prototype.addContentSources=function(t){var e,r,n;null==t&&(t={}),e=[];for(n in t)r=t[n],e.push(this.content.addBrowser(r,n));return e},e.prototype.setCompositionName=function(t){if(null==t&&(t={}),null!=t.name)return this.composition.name=t.name},e.prototype.activateSource=function(t){return this.content.focusBrowser(t)},e.prototype.release=function(){return this._release(this),e.__super__.release.apply(this,arguments)},e.prototype.onBeforeUnload=function(){if(this.hasPendingChange())return"There are some unsaved changes!"},e}(u),t.exports=l},function(t,e,r){var n,i,o,s,a,u,l,c,p,d=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty;o=window.require("spine/controller"),i=window.require("spine/controller/container"),n=window.require("spine/controller/activateable"),l=r(131),a=r(134),u=r(136),s=r(137),p=window.require("core/models/skin"),window.require("core/models/composition"),c=function(t){function e(){this.release=d(this.release,this),this.setOptions=d(this.setOptions,this),this.edit_skin=d(this.edit_skin,this),this.activate=d(this.activate,this),this._onSkinChange=d(this._onSkinChange,this),this._onSkinItemSelected=d(this._onSkinItemSelected,this),this._onSkinCreate=d(this._onSkinCreate,this),this._onSkinDestroy=d(this._onSkinDestroy,this),this._onSkinSave=d(this._onSkinSave,this),this.initialize=d(this.initialize,this),e.__super__.constructor.apply(this,arguments),this.savePopup=new u({place:this.el}),this.deletePopup=new s({place:this.el})}return h(e,t),e.prototype.className="skin-config",e.prototype.title="Theme",e.prototype.nextTitle="Skin",e.include(i),e.include(n),e.prototype.controllers={selector:l,editor:a},e.prototype.events={saveItem:"saveItem",deleteItem:"deleteItem","SkinItem:selected":"_onSkinItemSelected"},e.prototype.setPremium=function(t){return this.premium=t,this.editor.setAccessLevel(+this.premium)},e.prototype.initSave=function(){return this.selector.initSave()},e.prototype.hasPendingChange=function(){return this.selector.hasPendingChange()},e.prototype.saveItem=function(t,e){return null==e&&(e={}),t.stopPropagation(),this.savePopup.saveItem(e.controller,e.item)},e.prototype.deleteItem=function(t,e){return null==e&&(e={}),t.stopPropagation(),this.deletePopup.deleteItem(e.controller,e.item)},e.prototype.select=function(t,e){var r;return null==e&&(e=!1),t.widget_id===this.widget.id&&(r=t,this.selector.select(r.id,e))},e.prototype.for=function(t){return this.composition=t,this.widget=this.composition.getWidget(),this.initialize(),this},e.prototype.initialize=function(t){var e,r;return this.composition?this.widget?(this.stopListening(),this.listenTo(p,"save",this._onSkinSave),this.listenTo(p,"destroy",this._onSkinDestroy),this.listenTo(p,"create",this._onSkinCreate),this.listenTo(p,"change",this._onSkinChange),r=p.findAllByAttribute("widget_id",this.widget.id),r=r.filter(function(t){return t.isPreset()}).concat(r.filter(function(t){return!t.isPreset()})),e=this.widget.skinMeta,this.editor.parseMeta(e,this.composition),this.selector.refresh(r),this.editor.display(),this.select(this.composition.getSkin()||r[0]),this.trigger("initialized")):console.warn("No widget set"):console.warn("No composition set")},e.prototype._onSkinSave=function(t,e){if(null==e&&(e={}),e.ajax||e.fromApi)return this.$trigger("skin:save",t)},e.prototype._onSkinDestroy=function(t,e){return this.$trigger("skin:destroy",t)},e.prototype._onSkinCreate=function(t){var e;if(t.widget_id===(null!=(e=this.widget)?e.id:void 0))return this.initialize(),this.selector.toggleBtn(),this.selector.select(t.id)},e.prototype._onSkinItemSelected=function(t,e){var r;return this.composition.updateAttribute("skin_id",e.id,{ajax:!1}),null!=(r=this.currentSkin)&&r.used(-1),this.currentSkin=e,this.currentSkin.used(1),this.editor.setSkin(e)},e.prototype._onSkinChange=function(t,e,r){var n;if(this.editor.skinChanged(t),(null!=(n=this.currentSkin)?n.eql(t):void 0)&&r.changedID)return this.composition.updateAttribute("skin_id",t.id,{ajax:!1})},e.prototype.activate=function(t){return n.activate.apply(this,arguments),this.$trigger("viewChange","skin"),"function"==typeof this[t]&&this[t](),this},e.prototype.edit_skin=function(){return this.delay(this.selector.editSkinState,15)},e.prototype.setOptions=function(t){if(null!=t.enabled&&!t.enabled)return this.selector.hideEditBtn()},e.prototype.release=function(){return this.currentSkin.reset(),e.__super__.release.apply(this,arguments)},e}(o),t.exports=c},function(t,e,r){var n,i,o,s,a=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=window.require("spine/controller"),n=window.require("spine/controller/container"),o=r(132),r(7),window.require("core/models/skin"),s=function(t){function e(){this.onMouseLeaveBtn=a(this.onMouseLeaveBtn,this),this.hideEditBtn=a(this.hideEditBtn,this),this.toggleBtn=a(this.toggleBtn,this),this.editSkinState=a(this.editSkinState,this),this.expand=a(this.expand,this),this.toggleState=a(this.toggleState,this),this.hasPendingChange=a(this.hasPendingChange,this),e.__super__.constructor.apply(this,arguments),this.prepend(r(40),$('<span class="after">')),this.toggleState()}return u(e,t),e.prototype.className="skin-presets",e.include(n),e.prototype.canExpand=!0,e.prototype.controllers={list:o},e.prototype.elements={".toggle-skin-edit":"btn"},e.prototype.events={"click .toggle-skin-edit":"toggleState","mouseleave .toggle-skin-edit":"onMouseLeaveBtn"},e.prototype.hasPendingChange=function(){return this.list.pending},e.prototype.initSave=function(){return this.list.initSave()},e.prototype.refresh=function(t){return this.list.refresh(t)},e.prototype.select=function(t,e){return this.list.select(t,e)},e.prototype.toggleState=function(){return(this.canExpand&&"expanded"===this.state?this.editSkinState:this.expand)()},e.prototype.expand=function(){return this.hasPendingChange()?this.initSave():(this.btn.addClass("no-hover"),this.el.addClass("expanded"),this.list.setState(this.state="expanded"))},e.prototype.editSkinState=function(){return this.btn.addClass("no-hover"),this.el.removeClass("expanded"),this.list.setState(this.state="contracted")},e.prototype.toggleBtn=function(t){return this.btn.toggleClass("no-action",null!=t&&"boolean"==typeof t?t:this.hasPendingChange())},e.prototype.hideEditBtn=function(){return this.canExpand=!this.btn.hide()},e.prototype.onMouseLeaveBtn=function(){return this.btn.removeClass("no-hover")},e}(i),t.exports=s},function(t,e,r){var n,i,o,s,a,u=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=window.require("spine/controller/activator"),a=window.require("core/models/skin"),s=r(5),i=r(133),o=function(t){function e(){this.onItemDestroy=u(this.onItemDestroy,this),this.repositionChild=u(this.repositionChild,this),this.refreshScroll=u(this.refreshScroll,this),this.scrollToItem=u(this.scrollToItem,this),this.scrollToActive=u(this.scrollToActive,this),this.setState=u(this.setState,this),this._canceled=u(this._canceled,this),this._changed=u(this._changed,this),this.refresh=u(this.refresh,this),this.select=u(this.select,this),e.__super__.constructor.apply(this,arguments),this.last_scroll={expanded:0,contracted:0},this.pending=!1,this.state="expanded",this.$bind("changed",this._changed).$bind("cancel",this._canceled),this.listenTo(a,"destroy",this.onItemDestroy),this.$bind("SkinItem:activate",function(t){return function(e,r){return t.activeChild=r.item,t.scrollToActive()}}(this)),this.listenTo(a,"create",this.scrollToActive)}return l(e,t),e.prototype.className="presets-list",e.include(s),e.prototype.select=function(t,e){return this.activeChild=t?this.children().filter(function(e){return e.item.id===t})[0]:this.children()[0],this.activeChild.active({force:e})},e.prototype.refresh=function(t){var e;return this.children(function(t){return t.release()}),this.append.apply(this,function(){var r,n,o;for(o=[],r=0,n=t.length;r<n;r++)e=t[r],o.push(new i({item:e}));return o}()),this.pending=!1,this.delay(this.refreshScroll,850),this},e.prototype.initSave=function(){return this.children(function(t){return t.isActive()})[0].initSave()},e.prototype._changed=function(t,e){var r,n;if(!this.pending)return this.pending=!0,this.scroll().disable(),r=this.activeChild.el.index(),n=this.scroll().offset().top,this.children(function(t){return function(t){return t.positionOnChange(r,n)}}())},e.prototype._canceled=function(){if(this.pending)return this.pending=!1,this.repositionChild(),this.scroll().disable(),this.delay(function(t){return function(){return t.refreshScroll(),t.skin=t.activeChild.item,t.scrollToActive()}}(this),850)},e.prototype.setState=function(t){var e;return this.last_scroll[this.state]=(null!=(e=this.container)?e.scrollTop():void 0)||0,this.state=t,this.repositionChild(),this.scroll().disable(),this.delay(function(t){return function(){return t.scrollToItem(t.activeChild,t.refreshScroll)}}(this),750)},e.prototype.scrollToActive=function(t){if(t instanceof a)return this.skin=t;if(this.skin&&this.skin.id===this.activeChild.item.id)return this.skin=null,this.scrollToItem(this.activeChild)},e.prototype.scrollToItem=function(t,e){var r;return null==t&&(t=this.activeChild),null==e&&(e=function(){}),r=(null!=t?t.el.get(0).offsetTop:void 0)+parseInt(null!=t?t.el.css("padding-top"):void 0)||0,r-=this.container.height()-(null!=t?t.el.height():void 0),r>0?this.container.animate({scrollTop:r},450,e):e()},e.prototype.refreshScroll=function(t){if(t||!this.pending)return this.scroll().enable()},e.prototype.repositionChild=function(t){return this.children(function(e){return e.reposition(null!=t?t.destroyed:void 0)}),this.scroll().update()},e.prototype.onItemDestroy=function(){return this.scroll().disable(),this.repositionChild.apply(this,arguments),this.delay(this.refreshScroll,850)},e}(n),t.exports=o},function(t,e){var r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;r=window.require("spine/controller/activateable"),n=window.require("spine/controller"),i=window.require("core/models/skin"),o=function(t){function e(t){this.positionOnChange=s(this.positionOnChange,this),this.reposition=s(this.reposition,this),this.getPosition=s(this.getPosition,this),this.width=s(this.width,this),this.state=s(this.state,this),this._enter=s(this._enter,this),this.cancelSave=s(this.cancelSave,this),this.allChanges=s(this.allChanges,this),this.deactivate=s(this.deactivate,this),this.activate=s(this.activate,this),this.uses=s(this.uses,this),this.added=s(this.added,this),t.tag=null==t.item.user_id?"span":"div",e.__super__.constructor.apply(this,arguments),this.uses(this.item,{used:!0}).$addClass(null==this.item.user_id?"is-preset":"isnt-preset"),this.colors=i.meta(this.item.widget_id).colorAttributes.concat(),this.render(),this.item.freeze(),this.listenTo(this.item,"update",this.uses),this.listenTo(this.item,"update",this.allChanges)}return a(e,t),e.prototype.className="presets-list-item",e.include(r),e.prototype.template="editor/views/skinitem",e.prototype.events={click:"active","mouseenter .presets-list-colors":"_enter","click .presets-list-delete":"initDelete","click .cancel":"cancelSave","click .save":"initSave"},e.prototype.interval=0,e.prototype.height=60,e.prototype.added=function(){return e.__super__.added.apply(this,arguments),this.reposition(!0),this.delay(function(t){return function(){return t.el.addClass("skin--added")}}(this)),this},e.prototype.initSave=function(){return this.$trigger("saveItem",{item:this.item,controller:this})},e.prototype.uses=function(t,e){return null==e&&(e={}),e.used?(this.el.toggleClass("can-delete",null!=t.user_id&&!Boolean(t.uses>>0)),this):this},e.prototype.activate=function(t){return this.isActive()&&!0!==t.force?this:(r.activate.apply(this,arguments),this.$trigger("SkinItem:activate",$.extend({},t,{item:this})),this.$trigger("SkinItem:selected",this.item),this)},e.prototype.deactivate=function(){return r.deactivate.apply(this,arguments),this._countChanges()>0&&this.cancelSave(),this},e.prototype.allChanges=function(t,e){var r,n,o,s,a,u,l,c;if(null==e&&(e={}),!(e.used||(r=e.attribute,o=i.meta(t.widget_id).colorAttributes,null!=r&&((this.changes||(this.changes={}))[r]=1,this.$trigger("changed").$addClass("changed").$(".total").text(a=this._countChanges()),this.$(".text").text(1===a?"change":"changes"),o.indexOf(r)<0)))){for(s=null!=r?[r]:o,c=[],u=0,l=s.length;u<l;u++)n=s[u],c.push(this.$("[data-name='"+n+"']").css({backgroundColor:this.item[n]}));return c}},e.prototype.cancelSave=function(){return this.changes={},this.$removeClass("changed").$trigger("cancel").item.reset()},e.prototype.override=function(){return this.changes={},this.$removeClass("changed").$trigger("cancel").item.freeze()},e.prototype.initDelete=function(t){return t.stopImmediatePropagation(),t.preventDefault(),this.$trigger("deleteItem",{item:this.item,controller:this})},e.prototype._countChanges=function(){var t,e;return function(){var r,n;r=this.changes,n=[];for(t in r)e=r[t],n.push(t);return n}.call(this).length},e.prototype._enter=function(t){if("expanded"===this.state())return t.preventDefault()},e.prototype.state=function(){return this.parent().state},e.prototype.width=function(){return{expanded:245,contracted:100}[this.state()]},e.prototype.getPosition=function(){return"expanded"===this.state()?{top:this.height*parseInt(this.index/2)-20,left:this.width()*(this.index%2)}:{top:this.height*this.index-20,left:0}},e.prototype.reposition=function(t){return t&&(this.index=this.el.index()||0),this.el.css(this.getPosition())},e.prototype.positionOnChange=function(t,e){return this.isActive()?this.el.css({top:e-20,left:0}):this.el.css({left:0,top:this.height*(this.index-t)-20+(t<this.index?440+e:e)})},e}(n),t.exports=o},function(t,e,r){var n,i,o,s,a,u,l,c,p,d,h,f=function(t,e){return function(){return t.apply(e,arguments)}},g=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;c=window.require("spine/controller/tabs"),s=r(135),window.require("core/models/skin"),i=window.require("spine/controller/activator"),n=window.require("spine/controller/activateable"),o=window.require("spine/controller"),p=r(12).createPopup,h=r(38),d=function(t,e,r){if(-1!==r&&(e[r].before(t.el),!t.isVisible()))return d(t,e,r-1)},u=function(t){function e(){return this.isVisible=f(this.isVisible,this),e.__super__.constructor.apply(this,arguments)}return g(e,t),e.include(n),e.prototype.events={click:"active"},e.prototype.isVisible=function(){return 0===this.el.position().top},e}(o),l=function(t){function e(){this._onChildActivate=f(this._onChildActivate,this),this.tabClick=f(this.tabClick,this),this.afterAdd=f(this.afterAdd,this),this.clear=f(this.clear,this),this.toggleItem=f(this.toggleItem,this),this.hideList=f(this.hideList,this),e.__super__.constructor.apply(this,arguments),this.tabsByName={},this.listenTo($(document),"click",function(t){return function(e){var r;if(!$(e.target).is(".multi-tabs-toggle"))return null!=(r=t.popup)?r.hide():void 0}}(this)),this.el.prepend(this.toggle=$("<div class='multi-tabs-toggle' data-icon='❯'></div>")),this.list=$("<div class='multi-tabs-list'></div>"),this.list.on("click",".multi-tab-item",this.tabClick)}return g(e,t),e.prototype.containerClass="skin-editor-tabs-list",e.prototype.events={"click .multi-tabs-toggle":"toggleItem","click .activateable":"hideList"},e.prototype.hideList=function(t){var e,r;return null!=(r=this.popup)&&r.hide(),e=$(t.target).controller(),e.el.hasClass("hidden")||this.list.children().removeClass("active"),this.list.children().each(function(t){return function(t,r){var n;if(n=$(r),n.data("tab")===e)return n.addClass("active").siblings().removeClass("active")}}())},e.prototype.toggleItem=function(t){return this._createPopup().then(function(t){return function(){return t.popup.visible?t.popup.hide():t.popup.show()}}(this))},e.prototype.clear=function(){return this.list.empty(),this.tabsByName={},this.children().forEach(function(t){return function(e){return t.stopListening(e)}}(this)),this.toggle.hide()},e.prototype.afterAdd=function(t){var r;return e.__super__.afterAdd.apply(this,arguments),this.listenTo(t,"activate",this._onChildActivate),this.list.append(r=$("<div class='multi-tab-item'>"+t.panel.tabTitle+"</div>")),this.tabsByName[t.panel.tabTitle]=t,r.data("tab",t),t.el.data("multi-tab-list-item",r)},e.prototype.tabClick=function(t){var e,r;return null!=(e=this.popup)&&e.hide(),r=$(t.target),r.data("tab").active()},e.prototype.update=function(t,e){var r,n,i,o,s,a,u;o={};for(u in t){n=t[u],o[u]=!0;for(r in n)if(a=n[r],h(a.if,e)){o[u]=!1;break}}for(u in o)i=o[u],this.tabsByName[u].el.toggleClass("empty",i),null!=(s=this.tabsByName[u].el.data("multi-tab-list-item"))&&s.toggleClass("empty",i);return this.children(function(t){return t.el.is(".active.empty")}).map(function(t){return function(){return t.children(function(t){return t.el.is(":not(.empty)")})}}(this)).forEach(function(t){return t[0].active()}),this._updateVisibleTabs(),!0},e.prototype._onChildActivate=function(t,e){return this.children().forEach(function(t){return t.$removeClass("active")}),t.$addClass("active"),t.isVisible()||d(t,this.children().map(function(t){return t.el}),2),this._updateVisibleTabs()},e.prototype._updateVisibleTabs=function(){var t,e,r;if(r=this.children().map(function(t){return{tab:t,visible:t.isVisible()}}),r.forEach(function(t){return t.tab.el.data("multi-tab-list-item").toggle(!t.visible)}),t=r.map(function(t){return t.visible}).reduce(function(t,e){return t&&e}),this.toggle.toggle(!t),t)return null!=(e=this.popup)?e.hide():void 0},e.prototype._createPopup=function(){return this.popupPromise?this.popupPromise:this.popupPromise=p({topOffset:25,leftOffset:23,anchor:this.toggle}).then(function(t){return function(e){return t.popup=e,t.popup.append(t.list)}}(this)).catch(function(t){return console.error(t.stack)})},e}(i),a=function(t){function e(){return this.updateSkin=f(this.updateSkin,this),this.parseMeta=f(this.parseMeta,this),e.__super__.constructor.apply(this,arguments)}return g(e,t),e.prototype.tabRenderer=u,e.prototype.className="skin-editor",e.prototype.tabContainerClass="skin-editor-tabs",e.prototype.tabContainer=l,e.prototype.containerClass="skin-editor-container",e.prototype.tabTemplate=function(t){return t.panel.tabTitle},e.prototype.setAccessLevel=function(t){this.accessLevel=t},e.prototype.parseMeta=function(t,e){var r,n,i,o,a,u,l;for(this.meta=t,a=this.children(),n=0,i=a.length;n<i;n++)r=a[n],r.release();this.tabs.clear(),u=this.meta.tabs;for(l in u)o=u[l],this.append(new s({meta:o,tabTitle:l,composition:e,accessLevel:this.accessLevel}));return this.tabs.update(this.meta.tabs,e.getSkin())},e.prototype.display=function(t){var e;return null==t&&(t=0),null!=(e=this.children()[t])?e.active():void 0},e.prototype.updateSkin=function(t){var e,r,n,i,o,s;i=!1,s=this.meta.tabs;for(e in s){o=s[e];for(n in o)r=o[n],null==t[n]&&((i||(i={}))[n]=r.options.default)}if(i)return t.updateAttributes(i,{from:this,ajax:!1})},e.prototype.setSkin=function(t){return this.updateSkin(t),this.children(function(e){return e.skinLoad(t)})},e.prototype.skinChanged=function(t){return this.tabs.update(this.meta.tabs,t)},e}(c),t.exports=a},function(t,e,r){var n,i,o,s,a,u=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;o=window.require("spine/controller"),i=window.require("spine/controller/container"),n=window.require("spine/controller/activateable"),window.require("core/models/skin"),s=r(5),a=function(t){function e(){this.onScroll=u(this.onScroll,this),this.skinLoad=u(this.skinLoad,this),e.__super__.constructor.apply(this,arguments),this.bind("activate",function(t){return function(){if(t.skin)return t.skinLoad(t.skin)}}(this))}return l(e,t),e.prototype.className="controls",e.include(i),e.include(n),e.include(s),e.prototype.skinLoad=function(t){var e,r,n,i,o,s,a;if(null==this.skin){a=this.meta;for(r in a)i=a[r],e=window.require(i.control),o=this.accessLevel>=(i.access||0),s=i.options,n=i.if,o||(s.readonly=!0),this.append(new e({item:t,attribute:r,options:s,composition:this.composition,isAccesible:o,conditions:n}))}return this.children(function(e){return e.setItem(t)}),this.skin=t,this.scroll().update()},e.prototype.onScroll=function(){return this.children(function(t){return"function"==typeof t.deactivate?t.deactivate():void 0})},e}(o),t.exports=a},function(t,e,r){var n,i,o,s,a,u,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;n=window.require("spine/controller"),s=window.require("core/models/skin"),i=r(13),u={confirmBtnClass:"green-button button--uc button--save create-button",cancelBtnClass:"dim-button button--uc button--overwrite override-button",title:"How do you want to proceed?",content:'<input class="general-input skin-name" type="text" placeholder="Untitled Theme" />',note:"Changes will also apply to previous uses of this theme.",confirmBtn:"Create a new theme",cancelBtn:"Overwrite previous theme",separator:!0},a={confirmBtnClass:u.confirmBtnClass,cancelBtnClass:u.cancelBtnClass,title:"Create a new theme?",content:u.content,confirmBtn:"Create",separator:!1},o=function(t){function e(){this._closePopup=l(this._closePopup,this),this._onSaveCanceled=l(this._onSaveCanceled,this),this.override=l(this.override,this),this.save=l(this.save,this),e.__super__.constructor.apply(this,arguments),this.popup=new i({className:"popup skin-save-popup"}),this.listenTo(this.popup,"canceled",this._onSaveCanceled)}return c(e,t),e.prototype.saveItem=function(t){return this.model=(this.item=t).item,this.popup.render(null!=this.model.user_id?u:a).pop(this.place,this.save,this.override)},e.prototype.save=function(){var t,e;return t=this.model.attributes(),delete t.id,delete t.uses,t=$.extend({},t,{name:this.popup.el.find("input").val(),user_id:1}),this.item.item.reset(),e=new s(t),e.save(),this.item.changes={}},e.prototype.override=function(){return this.item.override(),this.item.item.save()},e.prototype._onSaveCanceled=function(){return this.model.trigger("save-canceled")},e.prototype._closePopup=function(){return this.popup.close()},e}(n),t.exports=o},function(t,e,r){var n,i,o,s,a,u=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=window.require("spine/controller"),o=r(13),s=window.require("core/models/skin"),a=function(t){return{confirmBtnClass:"green-button button--uc popup-button red-button",cancelBtnClass:"dim-button button--uc popup-button dark-purple-button",title:'Delete Theme "'+t.name+'"?',confirmBtn:"Delete",cancelBtn:"Cancel"}},i=function(t){function e(){this._closePopup=u(this._closePopup,this),this.deleteit=u(this.deleteit,this),this.deleteItem=u(this.deleteItem,this),e.__super__.constructor.apply(this,arguments),this.popup=new o({className:"popup skin-delete-popup"})}return l(e,t),e.prototype.deleteItem=function(t){return this.model=(this.item=t).item,this.popup.render(a(this.model)).pop(this.place,this.deleteit),this.listenToOnce(s,"selected",this._closePopup)},e.prototype.deleteit=function(t){var e;return this.stopListening(s,"selected",this._closePopup),this.item.isActive()&&(e=this.item.el,e.next().add(e.prev()).first().controller().active()),this.item.release(),this.model.destroy()},e.prototype._closePopup=function(){return this.popup.close()},e}(n),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l,c,p,d,h=function(t,e){return function(){return t.apply(e,arguments)}},f=function(t,e){function r(){this.constructor=t}for(var n in e)g.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},g={}.hasOwnProperty;n=window.require("spine/controller/activateable"),p=window.require("spine/controller/tabs"),a=window.require("core/models/content"),window.require("core/models/composition"),c=r(106),i=r(50),u=r(139),l=r(141),d=r(112),o=r(53).default,s=function(t){function e(){this.afterAdd=h(this.afterAdd,this),this._onBrowserState=h(this._onBrowserState,this),this.showError=h(this.showError,this),this._onItemUpdate=h(this._onItemUpdate,this),this._onItemCreate=h(this._onItemCreate,this),this.onItemDestroy=h(this.onItemDestroy,this),this.contentUpdate=h(this.contentUpdate,this),this.contentRemove=h(this.contentRemove,this),this.contentAdd=h(this.contentAdd,this),this._freeContentCanAdd=h(this._freeContentCanAdd,this),this._premiumContentCanAdd=h(this._premiumContentCanAdd,this),this.contentCanAdd=h(this.contentCanAdd,this),this.focusBrowser=h(this.focusBrowser,this),this.legacyAddBrowser=h(this.legacyAddBrowser,this),this.addBrowser=h(this.addBrowser,this),this.initialize=h(this.initialize,this),this.deactivate=h(this.deactivate,this),this.activate=h(this.activate,this),this.browsers={},e.__super__.constructor.apply(this,arguments),this.el.prepend((this.notificator=new l).el),o.Content.events.error(this.showError),this.$bind("error",function(t){return function(e,r){return t.showError(r)}}(this))}return f(e,t),e.prototype.className="content-browser",e.prototype.tabContainerClass="content-browser-tabs",e.prototype.containerClass="content-browser-container",e.prototype.title="Content",e.prototype.nextTitle="Edit Content",e.prototype.tabRenderer=c,e.include(n),e.prototype.interval=0,e.prototype.events={"editor:browser:active":"_onBrowserState","editor:browser:auth":"_onBrowserState"},e.prototype.children=function(t){var e,r,n,i;null==t&&(t=function(){return!0}),n=this.browsers,i=[];for(e in n)r=n[e],t(r)&&i.push(r);return i},e.prototype.setPremium=function(t){this.premium=t},e.prototype.activate=function(){var t,e;return n.activate.apply(this,arguments),null!=(t=this.children(function(t){return t.isActive()}))&&null!=(e=t[0])&&"function"==typeof e.auth&&e.auth(),this.$trigger("viewChange","content"),this},e.prototype.deactivate=function(){var t;return n.deactivate.apply(this,arguments),null!=(t=this.children(function(t){return t.isActive()})[0])&&"function"==typeof t.refreshChildren?t.refreshChildren():void 0},e.prototype.for=function(t){return this.composition=t,this.initialize(),this},e.prototype.initialize=function(){var t,e,r,n,i;if(!this.composition)return console.warn("No composition set");this.children(function(t){return t.release()}),this.stopListening(),this.meta=this.composition.contentMeta(),this.browserOptions=null!=(e=this.meta.browser)?e.options:void 0,this.addBrowser(d),(i=null!=(r=this.meta.browser)?r.sources:void 0)&&(delete i.facebook,delete i.websearch,delete i.blogvio,delete i.dropbox,delete i.flickr,delete i["google-drive"]);for(t in i)n=i[t],this.legacyAddBrowser(n,t);return this.meta.input&&(this.append(this.input=new u({control:this.meta.input,composition:this.composition})),this.browsers.input=this.input,this.listenTo(this.input,"canAdd",this.contentCanAdd)),this.listenTo(a,"destroy",this.onItemDestroy),this.listenTo(a,"update",this._onItemUpdate),this.listenTo(a,"create",this._onItemCreate),this.listenTo(a,"change",function(t){return function(){return t.el.toggleClass("has-reached-max",t.composition.maxContentReached())}}(this)),this.children()[0].active(),this.trigger("initialized")},e.prototype.addBrowser=function(t){var e,r,n,i;if(t.isCompatible(null!=(r=this.browserOptions)?r.types:void 0))return e=new t({filetypes:null!=(n=this.browserOptions)?n.types:void 0}),e.on("toggle",function(e){return function(r){var n,i,s;if(i=r.file,s=r.options,!((null!=s?s.afterUpload:void 0)&&o.Content.maxContentReached(e.composition)))try{return o.Content.toggleItem(e.composition,t.name,i.id,i.url,e.meta.attributes.title?{title:i.name}:void 0)}catch(t){return n=t,console.warn(n)}}}(this)),e.on("clearContent",function(e){return function(){return o.Content.clearContent(e.composition,t.name)}}(this)),e.observe("selected",function(t){return e.tab.count(t.length)}),i=function(r){return function(){var r,n;return r=o.Content.getItemsByService(t.name),n=r.map(function(t){return t.metadata.id}),e.set({selected:n})}}(),o.Content.events.change(i),i(),this.append(this.browsers[t.name]=e)},e.prototype.legacyAddBrowser=function(t,e){var r,n,o;return r=window.require(t.module||"editor/content/service/default"),o=this.composition.getContent().filter(function(t){var r;return(null!=(r=t.metadata)?r.service:void 0)===e}).map(function(t){return t.metadata}),i=window.require(t.browser||r.browser),this.browsers[e]=n=new i({content:o,title:e,Service:r,options:$.extend({},this.browserOptions,t.options||{})}),this.listenTo(n,"add",this.contentAdd),this.listenTo(n,"remove",this.contentRemove),this.listenTo(n,"update",this.contentUpdate),this.listenTo(n,"canAdd",this.contentCanAdd),this.append(n)},e.prototype.focusBrowser=function(t){var e;return null!=(e=this.browsers[t]||{links:this.input}[t])?e.active():void 0},e.prototype.contentCanAdd=function(t,e){return this.premium?this._premiumContentCanAdd(t,e):this._freeContentCanAdd(t,e)},e.prototype._premiumContentCanAdd=function(t,e){return this.composition.maxContentReached()?e?void 0:this.showError("max",!0):t.call(this)},e.prototype._freeContentCanAdd=function(t,e){var r;return r=this.composition.contentMeta().options.free_user_limit,this.composition.maxContentReached(r)?e?void 0:this.showError("maxFree",!0):t.call(this)},e.prototype.contentAdd=function(t){var e,r,n;r={},n=this.meta.attributes;for(e in n)n[e],null!=t[e]&&(r[e]=t[e]);return r.metadata=t,r.composition_id=this.composition.id,r[this.meta.browser.options.attribute]=t.url,new a(r).save()},e.prototype.contentRemove=function(t){var e,r;if(this.stopListening(a,"destroy",this.onItemDestroy),r=a.all().filter(function(e){return function(r){var n;return(null!=(n=r.metadata)?n.id:void 0)===t.id&&r.composition_id===e.composition.id}}(this)),null!=(e=r[0])&&e.destroy(),this.listenTo(a,"destroy",this.onItemDestroy),!this.composition.hasEnoughContent())return this.showError("min",!0)},e.prototype.contentUpdate=function(t,e,r){var n;if(n=a.all().filter(function(e){return function(e){return e.metadata===t}}()),n.length)return n[0].updateAttribute(e,r)},e.prototype.onItemDestroy=function(t){var e,r,n;if(t.composition_id===this.composition.id)return(n=null!=(e=t.metadata)?e.service:void 0)&&"directinput"!==n&&null!=(r=this.browsers[n])&&"function"==typeof r.removeEntry&&r.removeEntry(t.metadata),!0},e.prototype._onItemCreate=function(t){var e,r,n;if(t.composition_id===this.composition.id)return(n=null!=(e=t.metadata)?e.service:void 0)&&"directinput"!==n?null!=(r=this.browsers[n])&&"function"==typeof r.addEntry&&r.addEntry(t.metadata):this.input.addEntry(t),!0},e.prototype._onItemUpdate=function(t){var e,r,n;if(t.composition_id===this.composition.id)return(n=null!=(e=t.metadata)?e.service:void 0)&&"directinput"!==n&&null!=(r=this.browsers[n])&&"function"==typeof r.updateEntry&&r.updateEntry(t,t.metadata),!0},e.prototype.showError=function(t,e){var r;return null==e&&(e=!1),r=this.composition[t+"ErrorMsg"]?this.composition[t+"ErrorMsg"]():t,this.notificator.notify(r,{timeout:1e4,onClick:e?function(t){return function(){return t.$trigger("Content:upgrade")}}(this):void 0})},e.prototype._onBrowserState=function(t,e){return this.$trigger("editor:content:browserState",e)},e.prototype.afterAdd=function(t){if(e.__super__.afterAdd.apply(this,arguments),t.options.pos)return this.tabs.el.children(":nth-child("+t.options.pos+")").before(t.tab.el)},e.prototype.release=function(){return this._release(this),e.__super__.release.apply(this,arguments)},e}(p),t.exports=s},function(t,e,r){var n,i,o,s,a,u,l,c,p=function(t,e){return function(){return t.apply(e,arguments)}},d=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=window.require("spine/controller"),i=window.require("spine/controller/container"),n=window.require("spine/controller/activateable"),l=r(5),o=window.require("core/models/content"),u=r(140),window.require("core/models/composition"),c=function(t){return function(e){return e.item.eql(t)}},a=function(t){function e(){this._onCompositionSave=p(this._onCompositionSave,this),this.activate=p(this.activate,this),this.active=p(this.active,this),this._release=p(this._release,this),this.onItemCreated=p(this.onItemCreated,this),this.new=p(this.new,this),this._new=p(this._new,this),this.contentItems=p(this.contentItems,this),e.__super__.constructor.apply(this,arguments),this.append.apply(this,this.contentItems()),this.delay(function(t){return function(){return t.new(),t.tab.el.attr("control",t.control.control),t._updateTabCount()}}(this)),this.listenTo(this.composition,"save",this._onCompositionSave),this.listenTo(o,"destroy",this.delay.bind(this,this.new))}return d(e,t),e.prototype.className="directinput browser",e.prototype.title="directinput",e.prototype.serviceTitle="link",e.include(i),e.include(n),e.include(l),e.prototype.attributes={authenticated:!0},e.prototype.contentItems=function(){return this.composition.getContent().filter(function(t){var e,r;return!(null!=(e=t.metadata)?e.service:void 0)||"directinput"===(null!=(r=t.metadata)?r.service:void 0)}).map(function(t){return function(e){return new u({control:t.control,item:e})}}(this))},e.prototype.addEntry=function(t){var e;if(!this.children(c(t)).length)return this.append(e=new u({control:this.control,item:t})),this._getNewField().el.insertAfter(e.el),this._updateTabCount(),this.scroll().update(),this},e.prototype._new=function(t){return null!=this.field?this.field.enable():(this.item=new o({metadata:{service:"directinput"},composition_id:this.composition.id}),this.field=new u({control:this.control,item:this.item}),this.item.one("create",this.onItemCreated),this.append(this.field),this._updateTabCount(),this.scroll().update(),t?this.scroll().scrollTo("bottom",{inertia:!1}):void 0)},e.prototype.new=function(t){if(this._updateTabCount(),this._new(t),this.field.disable(),this.trigger("canAdd",this.field.enable,!0),!this._count())return this._new()},e.prototype.onItemCreated=function(){return this.item=this.field=null,this.new()},e.prototype._release=function(t){return i._release.apply(this,[t]),this._updateTabCount(),this.scroll().update()},e.prototype.active=function(){return n.active.apply(this,arguments),this.$trigger("editor:browser:active",{service:"directinput",authenticated:!1}),this.scroll().update()},e.prototype.activate=function(){if(n.activate.apply(this,arguments),null!=this.field)return this.field.disable(),this.trigger("canAdd",this.field.enable,!0)},e.prototype._updateTabCount=function(){var t;return null!=(t=this.tab)?t.count(this._count()):void 0},e.prototype._count=function(){return this.children(function(t){return!t.item.isNew()}).length},e.prototype._getNewField=function(){return this.children(function(t){return t.item.isNew()})[0]},e.prototype._onCompositionSave=function(t,e){var r;if(e.changedID)return null!=(r=this._getNewField())?r.item.composition_id=this.composition.id:void 0},e}(s),t.exports=a},function(t,e){var r,n,i,o=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=window.require("spine/controller"),r=window.require("spine/controller/container"),i=function(t){function e(){this.onInputFocus=o(this.onInputFocus,this),this.disable=o(this.disable,this),this.enable=o(this.enable,this);var t;e.__super__.constructor.apply(this,arguments),this.control=$.extend(!0,{},this.control),this.item.isNew()&&this.$addClass("new"),this.listenTo(this.item,"create",function(t){return function(){return t.$removeClass("new")}}(this)),this.listenTo(this.item,"destroy",this.release),t=window.require(this.control.control),this.control=new t({item:this.item,attribute:this.control.attribute,options:this.control.options}),this.append(this.control,"<span class='field-delete' data-icon='⏍'></span>")}return s(e,t),e.prototype.className="directinput-field",e.prototype.title="directinput",e.include(r),e.prototype.elements={".field-delete":"del",input:"input"},e.prototype.events={"click .field-delete":"_delete","focus input":"onInputFocus","click .input-textarea":"onInputFocus"},e.prototype._delete=function(){return this.item.destroy()},e.prototype.enable=function(){return this.el.toggleClass("disabled",this.disabled=!1)},e.prototype.disable=function(){return this.el.toggleClass("disabled",this.disabled=!0)},e.prototype.onInputFocus=function(){if(this.parent().trigger("canAdd",function(){},!this.disabled),this.disabled)return this.input.blur()},e}(n),t.exports=i},function(t,e){var r,n=function(t,e){return function(){return t.apply(e,arguments)}};r=function(){function t(){this._onClick=n(this._onClick,this),this.notify=n(this.notify,this),this.close=n(this.close,this),this.render=n(this.render,this),this.template=n(this.template,this),this.el=$('<div class="'+this.className+'">'),this.message="",this.el.on("click",".close",this.close),this.el.on("click",this._onClick)}return t.prototype.className="message notification",t.prototype.template=function(t){return"<div class='text'>"+t+"</div><div class='close' data-icon='x'></div>"},t.prototype.render=function(t){return this.message=null!=t?t:this.message,this.el.html(this.template(this.message))},t.prototype.close=function(t){return null!=t&&t.stopPropagation(),clearTimeout(this.interval),this.el.transition({top:-60,queue:!1}),this.el.trigger("editor:notification",{show:!1})},t.prototype.notify=function(t,e){return null==e&&(e={}),this.el.trigger("editor:notification",{show:!0}),this.render(t),clearTimeout(this.interval),this.clickAction=e.onClick,this.el.show().stop(!0,!1).transition({top:0},function(t){return function(){return t.interval=setTimeout(t.close,e.interval||3e3)}}(this))},t.prototype._onClick=function(t){return t.preventDefault(),"function"==typeof this.clickAction&&this.clickAction(),this.close(t)},t}(),t.exports=r},function(t,e,r){(function(t,n){var i;(function(o){"use strict";var s=0,a=Array.prototype.slice,u=function(t,e){var r=t[e];if(r===o&&j.strict)throw new Error("Bottle was unable to resolve a service. `"+e+"` is undefined.");return r},l=function(t){return this.nested[t]||(this.nested[t]=N.pop())},c=function(t){return t.split(".").reduce(u,this)},p=function(t,e){var r=t.split(".");return t=r.pop(),d.call(r.reduce(F,this.container),t,e),this},d=function(t,e){Object.defineProperty(this,t,{configurable:!1,enumerable:!0,value:e,writable:!1})},h=function(t,e){var r,n;return"function"==typeof t&&(e=t,t="__global__"),r=t.split("."),n=r.shift(),r.length?l.call(this,n).decorator(r.join("."),e):(this.decorators[n]||(this.decorators[n]=[]),this.decorators[n].push(e)),this},f=function(t){return this.deferred.push(t),this},g=function(t){return(t||[]).map(c,this.container)},_=function(t,e){return k.call(this,t,function(){this.$get=e})},y=function(t,e){return _.call(this,t,function(t){return{instance:e.bind(e,t)}})},v=function(t){return!/^\$(?:decorator|register|list)$|Provider$/.test(t)},m=function(t){return Object.keys(t||this.container||{}).filter(v)},b=function(t,e,r,n){var i={configurable:!0,enumerable:!0};return t.length?i.get=function(){var e=0,n=function(i){if(i)throw i;t[e]&&t[e++](r,n)};return n(),r}:(i.value=r,i.writable=!0),Object.defineProperty(n,e,i),n[e]},w=function(t,e){var r,n;return"function"==typeof t&&(e=t,t="__global__"),r=t.split("."),n=r.shift(),r.length?l.call(this,n).middleware(r.join("."),e):(this.middlewares[n]||(this.middlewares[n]=[]),this.middlewares[n].push(e)),this},E={},P=function(t){var e;return"string"==typeof t?(e=E[t],e||(E[t]=e=new N,e.constant("BOTTLE_NAME",t)),e):new N},S=function(t){"string"==typeof t?delete E[t]:E={}},x=function(t,e){return e(t)},k=function(t,e){var r,n;return r=t.split("."),this.providerMap[t]&&1===r.length&&!this.container[t+"Provider"]?console.error(t+" provider already instantiated."):(this.originalProviders[t]=e,this.providerMap[t]=!0,n=r.shift(),r.length?(T.call(this,n,e,r),this):O.call(this,n,e))},A=function(t,e){return(t[e]||[]).concat(t.__global__||[])},O=function(t,e){var r,n,i,s,a;return this.id,i=this.container,s=this.decorators,a=this.middlewares,r=t+"Provider",n=Object.create(null),n[r]={configurable:!0,enumerable:!0,get:function(){var t=new e;return delete i[r],i[r]=t,t}},n[t]={configurable:!0,enumerable:!0,get:function(){var e,n=i[r];return n&&(e=A(s,t).reduce(x,n.$get(i)),delete i[r],delete i[t]),e===o?e:b(A(a,t),t,e,i)}},Object.defineProperties(i,n),this},T=function(t,e,r){var n;return n=l.call(this,t),this.factory(t,function(){return n.container}),n.provider(r.join("."),e)},C=function(t){var e=t.$value===o?t:t.$value;return this[t.$type||"service"].apply(this,[t.$name,e].concat(t.$inject||[]))},R=function(t){delete this.providerMap[t],delete this.container[t],delete this.container[t+"Provider"]},M=function(){var t=this.originalProviders;Object.keys(this.originalProviders).forEach(function(e){var r=e.split(".");r.length>1&&(R.call(this,r[0]),r.forEach(R,l.call(this,r[0]))),R.call(this,e),this.provider(e,t[e])},this)},I=function(t){return this.deferred.forEach(function(e){e(t)}),this},D=function(t,e){var r=arguments.length>2?a.call(arguments,2):null,n=this;return _.call(this,t,function(){var t=e;if(r){var i=r.map(c,n.container);i.unshift(e),t=e.bind.apply(e,i)}return new t})},L=function(t,e){var r;return r=t.split("."),t=r.pop(),U.call(r.reduce(F,this.container),t,e),this},F=function(t,e){var r=t[e];return r||(r={},U.call(t,e,r)),r},U=function(t,e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})},N=function t(e){if(!(this instanceof t))return t.pop(e);this.id=s++,this.decorators={},this.middlewares={},this.nested={},this.providerMap={},this.originalProviders={},this.deferred=[],this.container={$decorator:h.bind(this),$register:C.bind(this),$list:m.bind(this)}};N.prototype={constant:p,decorator:h,defer:f,digest:g,factory:_,instanceFactory:y,list:m,middleware:w,provider:k,resetProviders:M,register:C,resolve:I,service:D,value:L},N.pop=P,N.clear=S,N.list=m;var j=N.config={strict:!1},B={function:!0,object:!0};!function(s){var a=B[typeof e]&&e&&!e.nodeType&&e,u=B[typeof t]&&t&&!t.nodeType&&t,l=(u&&u.exports,B[typeof n]&&n);!l||l.global!==l&&l.window!==l||(s=l),s.Bottle=N,(i=function(){return N}.call(e,r,e,t))!==o&&(t.exports=i)}(B[typeof window]&&window||this)}).call(this)}).call(e,r(46)(t),r(39))},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(54),u=r(55),l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=window.require("core/models/content"),p=function(t){function e(t){i(this,e);var r=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.userIsPremium=t.premium,r.events=["change","error"],c.on("change",r._broadcast.change),r}return s(e,t),l(e,[{key:"getItemsByService",value:function(t){return c.select(function(e){return!!e.metadata&&e.metadata.service===t})}},{key:"maxContentReached",value:function(t){var e=t.contentMeta(),r=this.userIsPremium?e.options.max:e.options.free_user_limit;return t.maxContentReached(r)}},{key:"toggleItem",value:function(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=this.getItemsByService(e).filter(function(t){return t.metadata.id===r}).pop();s?s.destroy():this.addItem(t,n,i,Object.assign({},o,{id:r,service:e}))}},{key:"clearContent",value:function(t,e){this.getItemsByService(e).forEach(function(t){return t.destroy()})}},{key:"addItem",value:function(t,e,r,i){var o=t.contentMeta();if(this.maxContentReached(t)&&o.options.max>1)throw this._broadcast.error(this.userIsPremium?"max":"maxFree"),new Error("Cannot add more than max items");this.maxContentReached(t)&&1===o.options.max&&c.select(function(e){return e.composition_id===t.id}).forEach(function(t){return t.destroy()}),new c(Object.assign({},r,n({composition_id:t.id,metadata:i},o.options.mainAttribute,e))).save()}}]),e}(u.a(a.a));e.a=p},function(t,e,r){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=r(54),a=r(55),u=r(114),l=r.n(u),c=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),p=function t(e){o(this,t),this.id=++t.guid,Object.assign(this,t.defaults,e)};p.defaults={lastModified:void 0,state:"complete",thumbnail:void 0,url:void 0,error:void 0,name:void 0,progress:0,size:0,type:"*",uploadFile:void 0},p.guid=0;var d=function(t){return t.indexOf("/")>0?t.slice(0,t.indexOf("/")):t},h=function(t){function e(t,r){o(this,e);var i=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return i.user=t.id,i.token=r,i.refreshed={},i.files=[],i.maxFilesize=t.premium?250:25,i.quota=1e3*(t.premium?1e4:250)*1e3,i.used=0,i.events=["update","complete"],i}return i(e,t),c(e,[{key:"getMaxFileSize",value:function(){return this.maxFilesize}},{key:"getUploadURL",value:function(){return"/upload?user="+this.user}},{key:"getAuthHeaders",value:function(){return{"w-utoken":this.token}}},{key:"getFiles",value:function(t){var e=this;return t=d(t),this.refreshed[t]?Promise.resolve(this.files.filter(function(e){return e.type===t})):this._fetch(t).then(function(t){return e.files.push.apply(e.files,t)}).then(this._broadcast.update).then(function(r){return e.files.filter(function(e){return e.type===t})})}},{key:"get",value:function(t){return this.files.filter(function(e){return e.id===t})[0]}},{key:"upload",value:function(t){var e=new p({state:"new",size:t.size,name:t.name,type:d(t.type),lastModified:Date.now(),uploadFile:t});console.log("on upload file:",e),this.files.push(e),this.used+=t.size,this._broadcast.update()}},{key:"uploadComplete",value:function(t,e){if("error"!==t.status){var r=JSON.parse(t.xhr.response),n=r.files.data[0];this.used=r.quota.used,this._update(t,function(t){t.state="complete",t.id=n.id,t.path=n.path,t.url=r.hostUrl+t.path,t.lastModified=n.lastModified}),this._broadcast.complete([this.get(n.id),e])}}},{key:"accept",value:function(t,e){if(this.used<this.quota)return e();e("The file exceeds the quota by "+l.a(this.used-this.quota)+".")}},{key:"remove",value:function(t){this.files=this.files.filter(function(e){return e.id!==t.id}),this.used-=t.size,"complete"===t.state&&this._remove(t),this._broadcast.update()}},{key:"setThumbnail",value:function(t,e){this._update(t,function(t){return t.thumbnail=e})}},{key:"setError",value:function(t,e){this.used-=t.size,this._update(t,function(t){t.error=e,t.size=0})}},{key:"setUploadProgress",value:function(t,e,r){this._update(t,function(t){return t.progress=e})}},{key:"setUploadState",value:function(t,e){this._update(t,function(t){return t.state=e})}},{key:"_update",value:function(t,e){this.files=this.files.map(function(r){return r.uploadFile===t&&e(r),r}),this._broadcast.update()}},{key:"_fetch",value:function(t){var e=this;return jQuery.ajax({url:"/upload/?user="+this.user+"&type="+t,headers:this.getAuthHeaders()}).then(function(r){return e.refreshed[t]=!0,e.used=r.quota.used,r.files.data.map(function(t){var e=d(t.mime),n=r.hostUrl+t.path,i="image"===e?n:void 0;return new p({id:t.id,type:e,url:n,thumbnail:i,path:t.path,name:t.name,size:t.size,lastModified:t.lastModified})})})}},{key:"_remove",value:function(t){return jQuery.ajax({method:"DELETE",url:"/upload/?user="+this.user+"&filePath="+t.path,headers:this.getAuthHeaders()}).then(function(t){}).then(this._broadcast.update).catch(console.error.bind(console))}}]),e}(a.a(s.a));e.a=h},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=r(54),a=r(55),u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l=function(t){function e(){n(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.events=["state"],t.sounds={},t}return o(e,t),u(e,[{key:"load",value:function(t,e){this.sounds[t]||this._initSound(t,e)}},{key:"getState",value:function(t){return this.sounds[t]?this.sounds[t].state:"uninitialized"}},{key:"togglePlay",value:function(t){this._isPlaying(t)?this.stop(t):this.play(t)}},{key:"play",value:function(t){if(!this.sounds[t])throw new Error("Sound must be loaded first");var e=this.sounds[t].sound;window.soundManager.stopAll(),this.sounds[t].state="loading",e.setPosition(0).play()}},{key:"stop",value:function(t){if(!this.sounds[t])throw new Error("Sound must be loaded first");this.sounds[t].sound.stop()}},{key:"_initSound",value:function(t,e){var r=this._onStatusChange.bind(this,t),n={url:e,volume:100,onpause:r,onstop:r,onresume:r,onfinish:r,onload:r,onplay:r};return this.sounds[t]={sound:window.soundManager.createSound(n),state:"paused"}}},{key:"_onStatusChange",value:function(t){this.sounds[t].state=this._isPlaying(t)?"playing":this._isLoading(t)?"loading":"paused",this._broadcast.state(t)}},{key:"_isPlaying",value:function(t){var e=this.sounds[t].sound;return!!e&&(!e.paused&&1===e.playState&&3===e.readyState)}},{key:"_isLoading",value:function(t){var e=this.sounds[t].sound;return!!e&&1===e.readyState}}]),e}(a.a(s.a));e.a=l},function(t,e,r){"use strict";function n(){var t=P.e("style");t.id="svelte-1421520638-style",t.textContent='\n section[svelte-1421520638], [svelte-1421520638] section {\n display: flex;\n flex-direction: column;\n padding-left: 20px;\n height: calc(100% - 25px);\n color: #665b68;\n }\n\n a[svelte-1421520638]:focus, [svelte-1421520638] a:focus {\n outline: none;\n }\n\n [svelte-1421520638].error-panel, [svelte-1421520638] .error-panel {\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n text-align: center;\n padding-right: 20px;\n }\n\n [svelte-1421520638].browser-nav, [svelte-1421520638] .browser-nav {\n position: static;\n\n font-family: ProximaNova-Regular;\n font-size: 16px;\n color: #0055FF;\n }\n\n [svelte-1421520638].blogvio-browser-title, [svelte-1421520638] .blogvio-browser-title {\n margin-top: 0;\n font: 30px/60px "ProximaNova-Regular";\n color: #0055FF;\n }\n\n [svelte-1421520638].nano, [svelte-1421520638] .nano {\n flex: 1;\n }\n\n strong[svelte-1421520638], [svelte-1421520638] strong {\n color: #0055FF;\n }\n\n [svelte-1421520638].dropzone_plchldr, [svelte-1421520638] .dropzone_plchldr {\n position: relative;\n margin: 20px 20px 20px 0;\n height: 75px;\n }\n\n [svelte-1421520638].dropzone, [svelte-1421520638] .dropzone {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n [svelte-1421520638].scrolling-container, [svelte-1421520638] .scrolling-container {\n transition: opacity 200ms ease-in;\n }\n\n [svelte-1421520638].dropzone--dragging .scrolling-container, [svelte-1421520638] .dropzone--dragging .scrolling-container {\n opacity: 0.4;\n }\n\n [svelte-1421520638].dropzone--dragging .dropzone, [svelte-1421520638] .dropzone--dragging .dropzone {\n top: -100px;\n }\n\n [svelte-1421520638].dropzone--large .dropzone, [svelte-1421520638] .dropzone--large .dropzone,\n [svelte-1421520638].dropzone--dragging .dropzone--large .dropzone, [svelte-1421520638] .dropzone--dragging .dropzone--large .dropzone {\n top: -200px;\n }\n\n [svelte-1421520638].icon, [svelte-1421520638] .icon {\n display: inline-block;\n width: 1em;\n height: 1em;\n stroke-width: 0;\n stroke: currentColor;\n fill: currentColor\n }\n\n [svelte-1421520638].clear-content svg, [svelte-1421520638] .clear-content svg {\n width: 14px;\n fill: #a0a0a0;\n position: relative;\n top: 1px;\n right: 2px;\n }\n\n [svelte-1421520638].clear-content:hover svg, [svelte-1421520638] .clear-content:hover svg {\n fill: #665b68;\n }\n',P.b(t,document.head)}function i(t,e){var r,n,i,o,s,a,u,l,c,p,d,h,f,g=new E.a({_root:e._root,data:{service:"Uploads"}});g.on("update",function(t){e._onUpdate(t)}),g.on("complete",function(t){e._onUploadComplete(t)}),e.refs.Uploads=g;var _=!t.loading&&y(t,e);return{create:function(){g._fragment.create(),r=P.g("\n\n"),n=P.f("svg"),i=P.f("symbol"),o=P.f("title"),s=P.g("upload"),a=P.f("path"),u=P.f("path"),l=P.f("symbol"),c=P.f("title"),p=P.g("error"),d=P.f("path"),h=P.g("\n\n"),_&&_.create(),f=P.d(),this.hydrate()},hydrate:function(t){P.p(n,"svelte-1421520638",""),P.p(n,"style","position: absolute; width: 0; height: 0; overflow: hidden"),P.p(n,"version","1.1"),P.p(n,"xmlns","http://www.w3.org/2000/svg"),P.p(n,"xmlns:xlink","http://www.w3.org/1999/xlink"),P.p(i,"id","icon-upload"),P.p(i,"viewBox","0 0 32 32"),P.p(a,"d","M30.038 19.938c-0.706 0-1.275 0.569-1.275 1.275v7.544h-25.525v-7.544c0-0.706-0.569-1.275-1.275-1.275s-1.275 0.569-1.275 1.275v8.825c0 0.706 0.569 1.275 1.275 1.275h28.075c0.706 0 1.275-0.569 1.275-1.275v-8.825c0-0.706-0.569-1.275-1.275-1.275z"),P.p(u,"d","M9.137 10.625l5.588-5.581v16.194c0 0.706 0.569 1.275 1.275 1.275s1.275-0.569 1.275-1.275v-16.194l5.587 5.581c0.769 0.713 1.556 0.25 1.806 0 0.5-0.5 0.5-1.306 0-1.806l-7.769-7.756c-0.5-0.5-1.306-0.5-1.806 0l-7.756 7.756c-0.5 0.5-0.5 1.306 0 1.806 0.494 0.5 1.306 0.5 1.8 0z"),P.p(l,"id","icon-error"),P.p(l,"viewBox","0 0 21.9 21.9"),P.p(d,"d","M14.1 11.3c-.2-.2-.2-.5 0-.7l7.5-7.5c.2-.2.3-.5.3-.7s-.1-.5-.3-.7L20.2.3c-.2-.2-.5-.3-.7-.3-.3 0-.5.1-.7.3l-7.5 7.5c-.2.2-.5.2-.7 0L3.1.3C2.9.1 2.6 0 2.4 0s-.5.1-.7.3L.3 1.7c-.2.2-.3.5-.3.7s.1.5.3.7l7.5 7.5c.2.2.2.5 0 .7L.3 18.8c-.2.2-.3.5-.3.7s.1.5.3.7l1.4 1.4c.2.2.5.3.7.3s.5-.1.7-.3l7.5-7.5c.2-.2.5-.2.7 0l7.5 7.5c.2.2.5.3.7.3s.5-.1.7-.3l1.4-1.4c.2-.2.3-.5.3-.7s-.1-.5-.3-.7l-7.5-7.5z"),P.p(d,"fill","#de2618")},mount:function(t,e){g._fragment.mount(t,e),P.l(r,t,e),P.l(n,t,e),P.b(i,n),P.b(o,i),P.b(s,o),P.b(a,i),P.b(u,i),P.b(l,n),P.b(c,l),P.b(p,c),P.b(d,l),P.l(h,t,e),_&&_.mount(t,e),P.l(f,t,e)},update:function(t,r){r.loading?_&&(_.unmount(),_.destroy(),_=null):_?_.update(t,r):(_=y(r,e),_.create(),_.mount(f.parentNode,f))},unmount:function(){g._fragment.unmount(),P.i(r),P.i(n),P.i(h),_&&_.unmount(),P.i(f)},destroy:function(){e.refs.Uploads===g&&(e.refs.Uploads=null),g.destroy(!1),_&&_.destroy()}}}function o(t,e){var r,n,i,o;return{create:function(){r=P.e("span"),i=P.g(n=t.selectedForDeletion.length),o=P.g(" files selected for removal")},mount:function(t,e){P.l(r,t,e),P.b(i,r),P.b(o,r)},update:function(t,e){n!==(n=e.selectedForDeletion.length)&&(i.data=n)},unmount:function(){P.i(r)},destroy:P.m}}function s(t,e){var r,n;return{create:function(){r=P.e("span"),n=P.g("Select files to be removed from the server")},mount:function(t,e){P.l(r,t,e),P.b(n,r)},update:P.m,unmount:function(){P.i(r)},destroy:P.m}}function a(t,e){function r(t){e.set({deleteMode:!0})}var n;return{create:function(){n=P.e("div"),this.hydrate()},hydrate:function(t){n.className="browser-logout",P.p(n,"data-tooltip-text","Permanently remove files from server"),P.p(n,"data-tooltip-position","80% 3%"),P.p(n,"data-icon","⏍"),P.a(n,"click",r)},mount:function(t,e){P.l(n,t,e)},unmount:function(){P.i(n)},destroy:function(){P.o(n,"click",r)}}}function u(t,e){function r(t){e.fire("clearContent")}var n,i,o,s;return{create:function(){n=P.e("div"),i=P.f("svg"),o=P.f("path"),s=P.f("path"),this.hydrate()},hydrate:function(t){n.className="browser-logout clear-content",P.p(n,"data-tooltip-text","Clear Content"),P.a(n,"click",r),P.p(i,"xmlns","http://www.w3.org/2000/svg"),P.p(i,"viewBox","0 0 512 512"),P.p(o,"d","M490.667 85.333h-64v-64C426.667 9.551 417.115 0 405.333 0h-384C9.551 0 0 9.551 0 21.333V448c0 11.782 9.551 21.333 21.333 21.333h64v21.333c0 11.782 9.551 21.333 21.333 21.333h384c11.782 0 21.333-9.551 21.333-21.333v-384c.001-11.781-9.55-21.333-21.332-21.333zm-448 341.334v-384H384v42.667H106.667c-11.782 0-21.333 9.551-21.333 21.333v320H42.667zm426.666 42.666H128V128h341.333v341.333z"),P.p(s,"d","M389.176 208.158c-8.331-8.331-21.839-8.331-30.17 0l-60.339 60.339-60.339-60.339c-8.331-8.331-21.839-8.331-30.17 0s-8.331 21.839 0 30.17l60.339 60.339-60.339 60.339c-8.331 8.331-8.331 21.839 0 30.17s21.839 8.331 30.17 0l60.339-60.339 60.339 60.339c8.331 8.331 21.839 8.331 30.17 0s8.331-21.839 0-30.17l-60.339-60.339 60.339-60.339c8.331-8.332 8.331-21.839 0-30.17z")},mount:function(t,e){P.l(n,t,e),P.b(i,n),P.b(o,i),P.b(s,i)},unmount:function(){P.i(n)},destroy:function(){P.o(n,"click",r)}}}function l(t,e){function r(t){e.deleteSelected()}function n(t){e.set({deleteMode:!1,selectedForDeletion:[]})}function i(t){return t.selectedForDeletion.length?o:s}var a,u,l,c,p,d=i(t),h=d(t,e);return{create:function(){a=P.e("div"),u=P.g("\n "),l=P.e("div"),c=P.g("\n "),h.create(),p=P.d(),this.hydrate()},hydrate:function(t){a.className="browser-logout",P.p(a,"data-tooltip-text","Permanently remove selected files from server (action cannot be undone)"),P.p(a,"data-tooltip-position","80% 3%"),P.p(a,"data-icon","✓"),P.a(a,"click",r),l.className="browser-logout",P.p(l,"data-tooltip-text","Cancel action"),P.p(l,"data-icon","x"),P.a(l,"click",n)},mount:function(t,e){P.l(a,t,e),P.l(u,t,e),P.l(l,t,e),P.l(c,t,e),h.mount(t,e),P.l(p,t,e)},update:function(t,r){d===(d=i(r))&&h?h.update(t,r):(h.unmount(),h.destroy(),h=d(r,e),h.create(),h.mount(p.parentNode,p))},unmount:function(){P.i(a),P.i(u),P.i(l),P.i(c),h.unmount(),P.i(p)},destroy:function(){P.o(a,"click",r),P.o(l,"click",n),h.destroy()}}}function c(t,e){var r,n,i=t.allowDelete&&a(t,e),o=t.allowClear&&u(t,e);return{create:function(){i&&i.create(),r=P.g("\n "),o&&o.create(),n=P.d()},mount:function(t,e){i&&i.mount(t,e),P.l(r,t,e),o&&o.mount(t,e),P.l(n,t,e)},update:function(t,s){s.allowDelete?i||(i=a(s,e),i.create(),i.mount(r.parentNode,r)):i&&(i.unmount(),i.destroy(),i=null),s.allowClear?o||(o=u(s,e),o.create(),o.mount(n.parentNode,n)):o&&(o.unmount(),o.destroy(),o=null)},unmount:function(){i&&i.unmount(),P.i(r),o&&o.unmount(),P.i(n)},destroy:function(){i&&i.destroy(),o&&o.destroy()}}}function p(t,e){for(var r,n=t.files,i=[],o=0;o<n.length;o+=1)i[o]=d(t,n,n[o],o,e);return{create:function(){for(var t=0;t<i.length;t+=1)i[t].create();r=P.d()},mount:function(t,e){for(var n=0;n<i.length;n+=1)i[n].mount(t,e);P.l(r,t,e)},update:function(t,n){var o=n.files;if("files"in t||"deleteMode"in t||"selected"in t||"selectedForDeletion"in t){for(var s=0;s<o.length;s+=1)i[s]?i[s].update(t,n,o,o[s],s):(i[s]=d(n,o,o[s],s,e),i[s].create(),i[s].mount(r.parentNode,r));for(;s<i.length;s+=1)i[s].unmount(),i[s].destroy();i.length=o.length}},unmount:function(){for(var t=0;t<i.length;t+=1)i[t].unmount();P.i(r)},destroy:function(){P.h(i,!1,0)}}}function d(t,e,r,n,i){var o=new w.a({_root:i._root,data:{file:r,selected:x.helpers.isSelected(r.id,t.deleteMode,t.selected,t.selectedForDeletion),selectedIcon:t.deleteMode?"delete":"check"}});return o.on("select",function(t){i.toggle(t)}),{create:function(){o._fragment.create()},mount:function(t,e){o._fragment.mount(t,e)},update:function(t,e,r,n,i){var s={};"files"in t&&(s.file=n),("files"in t||"deleteMode"in t||"selected"in t||"selectedForDeletion"in t)&&(s.selected=x.helpers.isSelected(n.id,e.deleteMode,e.selected,e.selectedForDeletion)),"deleteMode"in t&&(s.selectedIcon=e.deleteMode?"delete":"check"),Object.keys(s).length&&o.set(s)},unmount:function(){o._fragment.unmount()},destroy:function(){o.destroy(!1)}}}function h(t,e){var r=p(t,e),n=new b.a({_root:e._root,_yield:r,data:{class:"content-list"}});return e.refs.scrollPane=n,{create:function(){r.create(),n._fragment.create()},mount:function(t,e){n._fragment.mount(t,e)},update:function(t,e){r.update(t,e)},unmount:function(){n._fragment.unmount()},destroy:function(){e.refs.scrollPane===n&&(e.refs.scrollPane=null),r.destroy(),n.destroy(!1)}}}function f(t,e){var r,n,i,o,s,a,u,l,c,p,d,h;return{create:function(){r=P.e("div"),n=P.e("h2"),i=P.g("Hey there!"),o=P.g("\n "),s=P.e("h3"),a=P.g("You haven't uploaded any "),l=P.g(u=t.filetypes),c=P.g(" files yet."),p=P.g("\n "),d=P.e("span"),h=P.g("Drag some over or click below!"),this.hydrate()},hydrate:function(t){r.className="error-panel",r.style.cssText="height: 100%",n.className="blogvio-browser-title"},mount:function(t,e){P.l(r,t,e),P.b(n,r),P.b(i,n),P.b(o,r),P.b(s,r),P.b(a,s),P.b(l,s),P.b(c,s),P.b(p,r),P.b(d,r),P.b(h,d)},update:function(t,e){u!==(u=e.filetypes)&&(l.data=u)},unmount:function(){P.i(r)},destroy:P.m}}function g(t,e){function r(t){e.refresh(t)}var n,i,o,s,a,u,l,c,p,d,h,f,g,_,y,v,m;return{create:function(){n=P.e("div"),i=P.e("h2"),o=P.g("Failed to load uploaded files."),s=P.g("\n "),a=P.e("p"),l=P.g(u=t.error.message),c=P.g("\n "),p=P.e("a"),d=P.g("Click here to try again"),h=P.e("br"),f=P.g("\n "),g=P.e("span"),_=P.g("or "),y=P.e("a"),v=P.g("contact support"),m=P.g(" if the error persists."),this.hydrate()},hydrate:function(t){P.p(n,"svelte-1421520638",""),n.className="error-panel",i.className="blogvio-browser-title",p.href="#",P.a(p,"click",r),y.href="mailto:support@widgetic.com"},mount:function(t,e){P.l(n,t,e),P.b(i,n),P.b(o,i),P.b(s,n),P.b(a,n),P.b(l,a),P.b(c,n),P.b(p,n),P.b(d,p),P.b(h,n),P.b(f,n),P.b(g,n),P.b(_,g),P.b(y,g),P.b(v,y),P.b(m,g)},update:function(t,e){u!==(u=e.error.message)&&(l.data=u)},unmount:function(){P.i(n)},destroy:function(){P.o(p,"click",r)}}}function _(t,e){function r(t){return t.deleteMode?l:c}function n(t){return t.files.length?h:f}var i,o,s,a,u,p,d,g,_=r(t),y=_(t,e),v=n(t),b=v(t,e),w=new m.a({_root:e._root,data:{filetypes:t.filetypes+"/*",maxFilesize:t.maxFilesize,instanceId:t.instanceId}});return w.on("new",function(t){e._onDropZoneNewUpload(t)}),w.on("upload",function(t){e._onDropZoneUpload(t)}),w.on("dragging",function(t){e.set({dragging:t})}),w.on("error",function(t){e.fire("error",t)}),e.refs.dropzone=w,{create:function(){i=P.e("div"),y.create(),o=P.g("\n "),s=P.e("section"),u=P.g("\n "),b.create(),p=P.g("\n\n \n "),d=P.e("div"),w._fragment.create(),this.hydrate()},hydrate:function(e){P.p(i,"svelte-1421520638",""),i.className="browser-nav",P.p(s,"svelte-1421520638",""),s.className=a=t.dragging?"dropzone--dragging":"",d.className=g="dropzone_plchldr "+(t.files.length?"":"dropzone--large")},mount:function(t,e){P.l(i,t,e),y.mount(i,null),P.l(o,t,e),P.l(s,t,e),P.b(u,s),b.mount(s,null),P.b(p,s),P.b(d,s),w._fragment.mount(d,null)},update:function(t,o){_===(_=r(o))&&y?y.update(t,o):(y.unmount(),y.destroy(),y=_(o,e),y.create(),y.mount(i,null)),a!==(a=o.dragging?"dropzone--dragging":"")&&(s.className=a),v===(v=n(o))&&b?b.update(t,o):(b.unmount(),b.destroy(),b=v(o,e),b.create(),b.mount(s,p)),g!==(g="dropzone_plchldr "+(o.files.length?"":"dropzone--large"))&&(d.className=g);var u={};"filetypes"in t&&(u.filetypes=o.filetypes+"/*"),"maxFilesize"in t&&(u.maxFilesize=o.maxFilesize),"instanceId"in t&&(u.instanceId=o.instanceId),Object.keys(u).length&&w.set(u)},unmount:function(){P.i(i),y.unmount(),P.i(o),P.i(s),b.unmount()},destroy:function(){y.destroy(),b.destroy(),e.refs.dropzone===w&&(e.refs.dropzone=null),w.destroy(!1)}}}function y(t,e){function r(t){return t.error?g:_}var n,i=r(t),o=i(t,e);return{create:function(){o.create(),n=P.d()},mount:function(t,e){o.mount(t,e),P.l(n,t,e)},update:function(t,s){i===(i=r(s))&&o?o.update(t,s):(o.unmount(),o.destroy(),o=i(s,e),o.create(),o.mount(n.parentNode,n))},unmount:function(){o.unmount(),P.i(n)},destroy:function(){o.destroy()}}}function v(t){t=t||{},this.refs={},this._state=P.c(x.data(),t.data),this._observers={pre:Object.create(null),post:Object.create(null)},this._handlers=Object.create(null),this._root=t._root||this,this._yield=t._yield,this._torndown=!1,document.getElementById("svelte-1421520638-style")||n(),this._renderHooks=[],this._fragment=i(this._state,this),t.target&&(this._fragment.create(),this._fragment.mount(t.target,null)),this._flush(),t._root?t._root._renderHooks.push(x.oncreate.bind(this)):x.oncreate.call(this)}Object.defineProperty(e,"__esModule",{value:!0});var m=r(147),b=r(149),w=r(150),E=r(57),P=r(15),S=function(){function t(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),x=function(){var t=0;return{data:function(){return{instanceId:++t,loading:!0,error:null,files:[],dragging:!1,filetypes:"*",deleteMode:!1,selected:[],selectedForDeletion:[],maxFilesize:10,allowDelete:!0,allowClear:!0}},helpers:{isSelected:function(t,e,r,n){return e?n.includes(t):r.includes(t)}},oncreate:function(){this.Uploads=this.refs.Uploads.instance(),this.set({maxFilesize:this.Uploads.getMaxFileSize()}),this.refresh(),this.scrollToListBottom()},ondestroy:function(){this.observer.cancel()},methods:{toggle:function(t){if(t.error)return this.Uploads.remove(t),this.refresh();this.get("deleteMode")?this._toggleDelete(t):this._toggleSelect(t)},activate:function(){this.refs.scrollPane&&(this.refs.scrollPane.update(),this.scrollToListBottom())},refresh:function(t){var e=this;return t&&t.preventDefault(),this.Uploads.getFiles(this.get("filetypes")).then(function(t){return t=t.sort(function(t,e){var r=t.lastModified;r||(r=t.id.substring(t.id.indexOf("_u")+3)),r||(r=0);var n=e.lastModified;return n||(n=e.id.substring(e.id.indexOf("_u")+3)),n||(n=0),r-n}),console.log("uploadedFiles after sort: ",t),e.set({files:t})}).then(this.activate.bind(this)).catch(this._reportError.bind(this)).then(function(t){e.set({loading:!1,error:null}),e.scrollToListBottom()})},deleteSelected:function(){var t=this,e=this.get("selected");this.get("selectedForDeletion").forEach(function(r){var n=t.Uploads.get(r);e.includes(r)&&t._toggleSelect(n),t.Uploads.remove(n)}),this.set({deleteMode:!1,selectedForDeletion:[]})},_toggleSelect:function(t,e){this.fire("toggle",{file:t,options:e})},_toggleDelete:function(t){var e=this.get("selectedForDeletion");e.includes(t.id)?e=e.filter(function(e){return e!==t.id}):e.push(t.id),this.set({selectedForDeletion:e})},_reportError:function(t){var e=t;"string"==typeof t&&(e={message:t}),t.jqXHR&&(e={message:t.jqXHR.statusText+" ("+t.jqXHR.responseText+")"}),console.error(t),this.set({error:e}),this.fire("error",e)},_onDropZoneNewUpload:function(t){this.scrollToListBottom()},scrollToListBottom:function(){this.refs.scrollPane&&this.refs.scrollPane.scrollBottom()},_onDropZoneUpload:function(t){this.toggle(t)},_onUpdate:function(t){this.refresh()},_onUploadComplete:function(t){var e=S(t,2),r=e[0];e[1]===this.get("instanceId")&&this._toggleSelect(r,{afterUpload:!0})}}}}();P.c(v.prototype,x.methods,P.n),v.prototype._set=function(t){var e=this._state;this._state=P.c({},e,t),P.k(this,this._observers.pre,t,e),this._fragment.update(t,this._state),P.k(this,this._observers.post,t,e),this._flush()},v.prototype.teardown=v.prototype.destroy=function(t){this.fire("destroy"),x.ondestroy.call(this),!1!==t&&this._fragment.unmount(),this._fragment.destroy(),this._fragment=null,this._state={},this._torndown=!0},e.default=v},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e,r,n){(n||"quota"in e&&g.j(t.quota,r.quota))&&(t.prettyQuota=e.prettyQuota=_.computed.prettyQuota(t.quota)),(n||"used"in e&&g.j(t.used,r.used))&&(t.prettyUsed=e.prettyUsed=_.computed.prettyUsed(t.used))}function o(){var t=g.e("style");t.id="svelte-3178269493-style",t.textContent='\n [svelte-3178269493].dropzone, [svelte-3178269493] .dropzone {\n display: flex;\n align-items: center;\n justify-content: center;\n\n background: #fff;\n border: 1px dashed #b8b8b8;\n\n font-size: 14px;\n font-family: "ProximaNova-Regular";\n text-align: center;\n cursor: pointer;\n\n transition: top 300ms ease-in, background 150ms ease-in 50ms;\n }\n\n [svelte-3178269493].dropzone_stats, [svelte-3178269493] .dropzone_stats {\n pointer-events: none;\n }\n\n [svelte-3178269493].dropzone_stats span, [svelte-3178269493] .dropzone_stats span {\n transition: opacity 150ms ease-in 150ms;\n }\n\n [svelte-3178269493].dropzone:hover, [svelte-3178269493] .dropzone:hover {\n border-color: #888;\n }\n\n [svelte-3178269493].dropzone.dropzone--dragging, [svelte-3178269493] .dropzone.dropzone--dragging,\n [svelte-3178269493].dropzone:hover, [svelte-3178269493] .dropzone:hover {\n background: #f4f5f8;\n }\n\n [svelte-3178269493].dropzone--dragging .dropzone_stats span, [svelte-3178269493] .dropzone--dragging .dropzone_stats span {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n [svelte-3178269493].dropzone--dragging .dropzone_stats .icon, [svelte-3178269493] .dropzone--dragging .dropzone_stats .icon {\n transform: scale(3) translateY(20%);\n }\n\n [svelte-3178269493].dz-message, [svelte-3178269493] .dz-message, [svelte-3178269493].dz-preview, [svelte-3178269493] .dz-preview {\n display: none\n }\n\n [svelte-3178269493].icon, [svelte-3178269493] .icon {\n fill: #929292;\n transition: transform 300ms ease-in;\n }\n',g.b(t,document.head)}function s(t,e){function r(t){return t.uploading.total>0?a:u}var n,i,o,s,l=new d.a({_root:e._root,data:{service:"Uploads"}});l.on("update",function(t){e._onUploadsUpdate()}),e.refs.Uploads=l;var c=r(t),p=c(t,e);return{create:function(){l._fragment.create(),n=g.g("\n\n"),i=g.e("div"),s=g.e("div"),p.create(),this.hydrate()},hydrate:function(e){g.p(i,"svelte-3178269493",""),i.className=o="dropzone "+(t.dragging?"dropzone--dragging":""),s.className="dropzone_stats"},mount:function(t,r){l._fragment.mount(t,r),g.l(n,t,r),g.l(i,t,r),e.refs.dropzone=i,g.b(s,i),p.mount(s,null)},update:function(t,n){o!==(o="dropzone "+(n.dragging?"dropzone--dragging":""))&&(i.className=o),c===(c=r(n))&&p?p.update(t,n):(p.unmount(),p.destroy(),p=c(n,e),p.create(),p.mount(s,null))},unmount:function(){l._fragment.unmount(),g.i(n),g.i(i),e.refs.dropzone===i&&(e.refs.dropzone=null),p.unmount()},destroy:function(){e.refs.Uploads===l&&(e.refs.Uploads=null),l.destroy(!1),p.destroy()}}}function a(t,e){var r,n,i,o,s,a,u;return{create:function(){r=g.e("strong"),n=g.g("Uploading "),o=g.g(i=t.uploading.now),s=g.g(" / "),u=g.g(a=t.uploading.total)},mount:function(t,e){g.l(r,t,e),g.b(n,r),g.b(o,r),g.b(s,r),g.b(u,r)},update:function(t,e){i!==(i=e.uploading.now)&&(o.data=i),a!==(a=e.uploading.total)&&(u.data=a)},unmount:function(){g.i(r)},destroy:g.m}}function u(t,e){var r,n,i,o,s,a,u,l,c,p,d,h,f,_;return{create:function(){r=g.f("svg"),n=g.f("use"),i=g.g("\n "),o=g.e("br"),s=g.g("\n "),a=g.e("span"),u=g.e("strong"),c=g.g(l=t.prettyUsed),p=g.g(" out of "),d=g.e("strong"),f=g.g(h=t.prettyQuota),_=g.g(" used."),this.hydrate()},hydrate:function(t){g.p(r,"class","icon icon-upload"),g.q(n,"xlink:href","#icon-upload")},mount:function(t,e){g.l(r,t,e),g.b(n,r),g.l(i,t,e),g.l(o,t,e),g.l(s,t,e),g.l(a,t,e),g.b(u,a),g.b(c,u),g.b(p,a),g.b(d,a),g.b(f,d),g.b(_,a)},update:function(t,e){l!==(l=e.prettyUsed)&&(c.data=l),h!==(h=e.prettyQuota)&&(f.data=h)},unmount:function(){g.i(r),g.i(i),g.i(o),g.i(s),g.i(a)},destroy:g.m}}function l(t){t=t||{},this.refs={},this._state=g.c(_.data(),t.data),i(this._state,this._state,{},!0),this._observers={pre:Object.create(null),post:Object.create(null)},this._handlers=Object.create(null),this._root=t._root||this,this._yield=t._yield,this._torndown=!1,document.getElementById("svelte-3178269493-style")||o(),this._renderHooks=[],this._fragment=s(this._state,this),t.target&&(this._fragment.create(),this._fragment.mount(t.target,null)),this._flush(),t._root?t._root._renderHooks.push(_.oncreate.bind(this)):_.oncreate.call(this)}var c=r(148),p=r.n(c),d=r(57),h=r(114),f=r.n(h),g=r(15),_=function(){return{data:function(){return{filetypes:"*",used:0,quota:0,uploading:{total:0,now:0},dragging:!1,maxFilesize:10,instanceId:0}},computed:{prettyQuota:function(t){return f.a(t)},prettyUsed:function(t){return f.a(t)}},oncreate:function(){var t;this.Uploads=this.refs.Uploads.instance(),this.set({quota:this.Uploads.quota,used:this.Uploads.used}),this.dropzone=new p.a(this.refs.dropzone,{acceptedFiles:this.get("filetypes"),url:this.Uploads.getUploadURL(),headers:this.Uploads.getAuthHeaders(),accept:this.Uploads.accept.bind(this.Uploads),uploadMultiple:!1,maxFilesize:this.get("maxFilesize")});var e=(t={dragenter:this._onDragEnter.bind(this),dragleave:this._onDragLeave.bind(this),drop:this._onDragLeave.bind(this),addedfile:this._onAddedFile.bind(this),thumbnail:this._onThumbnail.bind(this),error:this._onError.bind(this),uploadprogress:this._onUploadProgress.bind(this),processing:this._updateFileState.bind(this,"processing"),sending:this._updateFileState.bind(this,"sending"),success:this._updateFileState.bind(this,"success"),complete:this._updateFileState.bind(this,"complete"),canceled:this._updateFileState.bind(this,"canceled")},n(t,"complete",this._onComplete.bind(this)),n(t,"totaluploadprogress",this._onTotalUploadProgress.bind(this)),n(t,"queuecomplete",this._onQueueComplete.bind(this)),t);for(var r in e)this.dropzone.on(r,e[r])},methods:{_onDragEnter:function(){this.set({dragging:!0}),this.fire("dragging",!0)},_onDragLeave:function(){this.set({dragging:!1}),this.fire("dragging",!1)},_onAddedFile:function(t){this.fire("new"),this.Uploads.upload(t)},_onThumbnail:function(t,e){this.Uploads.setThumbnail(t,e)},_onError:function(t,e){console.error(e),this.fire("error",{message:e}),this.Uploads.setError(t,e)},_onUploadProgress:function(t,e,r){this.Uploads.setUploadProgress(t,e,r)},_onComplete:function(t){this.Uploads.uploadComplete(t,this.get("instanceId"))},_updateFileState:function(t,e){this.Uploads.setUploadState(e,t)},_onTotalUploadProgress:function(){var t=this.dropzone.getAcceptedFiles().length,e=this.dropzone.getQueuedFiles().length,r=(this.dropzone.getUploadingFiles().length,t-e);this.set({uploading:{total:t,now:r}})},_onQueueComplete:function(){this.dropzone.removeAllFiles()},_onUploadsUpdate:function(){this.set({quota:this.Uploads.quota,used:this.Uploads.used})}}}}();g.c(l.prototype,_.methods,g.n),l.prototype._set=function(t){var e=this._state;this._state=g.c({},e,t),i(this._state,t,e,!1),g.k(this,this._observers.pre,t,e),this._fragment.update(t,this._state),g.k(this,this._observers.post,t,e),this._flush()},l.prototype.teardown=l.prototype.destroy=function(t){this.fire("destroy"),!1!==t&&this._fragment.unmount(),this._fragment.destroy(),this._fragment=null,this._state={},this._torndown=!0},e.a=l},function(t,e,r){(function(t){(function(){var e,r,n,i,o,s,a,u,l=[].slice,c={}.hasOwnProperty,p=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};a=function(){},r=function(){function t(){}return t.prototype.addEventListener=t.prototype.on,t.prototype.on=function(t,e){return this._callbacks=this._callbacks||{},this._callbacks[t]||(this._callbacks[t]=[]),this._callbacks[t].push(e),this},t.prototype.emit=function(){var t,e,r,n,i,o;if(n=arguments[0],t=2<=arguments.length?l.call(arguments,1):[],this._callbacks=this._callbacks||{},r=this._callbacks[n])for(i=0,o=r.length;i<o;i++)e=r[i],e.apply(this,t);return this},t.prototype.removeListener=t.prototype.off,t.prototype.removeAllListeners=t.prototype.off,t.prototype.removeEventListener=t.prototype.off,t.prototype.off=function(t,e){var r,n,i,o;if(!this._callbacks||0===arguments.length)return this._callbacks={},this;if(!(r=this._callbacks[t]))return this;if(1===arguments.length)return delete this._callbacks[t],this;for(n=i=0,o=r.length;i<o;n=++i)if(r[n]===e){r.splice(n,1);break}return this},t}(),e=function(t){function e(t,r){var i,o,s;if(this.element=t,this.version=e.version,this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,""),this.clickableElements=[],this.listeners=[],this.files=[],"string"==typeof this.element&&(this.element=document.querySelector(this.element)),!this.element||null==this.element.nodeType)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");if(e.instances.push(this),this.element.dropzone=this,i=null!=(s=e.optionsForElement(this.element))?s:{},this.options=n({},this.defaultOptions,i,null!=r?r:{}),this.options.forceFallback||!e.isBrowserSupported())return this.options.fallback.call(this);if(null==this.options.url&&(this.options.url=this.element.getAttribute("action")),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");this.options.acceptedMimeTypes&&(this.options.acceptedFiles=this.options.acceptedMimeTypes,delete this.options.acceptedMimeTypes),this.options.method=this.options.method.toUpperCase(),(o=this.getExistingFallback())&&o.parentNode&&o.parentNode.removeChild(o),!1!==this.options.previewsContainer&&(this.options.previewsContainer?this.previewsContainer=e.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(!0===this.options.clickable?this.clickableElements=[this.element]:this.clickableElements=e.getElements(this.options.clickable,"clickable")),this.init()}var n,i;return p(e,t),e.prototype.Emitter=r,e.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],e.prototype.defaultOptions={url:null,method:"post",withCredentials:!1,parallelUploads:2,uploadMultiple:!1,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,filesizeBase:1e3,maxFiles:null,params:{},clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",accept:function(t,e){return e()},init:function(){return a},forceFallback:!1,fallback:function(){var t,r,n,i,o,s;for(this.element.className=this.element.className+" dz-browser-not-supported",s=this.element.getElementsByTagName("div"),i=0,o=s.length;i<o;i++)t=s[i],/(^| )dz-message($| )/.test(t.className)&&(r=t,t.className="dz-message");return r||(r=e.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(r)),n=r.getElementsByTagName("span")[0],n&&(null!=n.textContent?n.textContent=this.options.dictFallbackMessage:null!=n.innerText&&(n.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(t){var e,r,n;return e={srcX:0,srcY:0,srcWidth:t.width,srcHeight:t.height},r=t.width/t.height,e.optWidth=this.options.thumbnailWidth,e.optHeight=this.options.thumbnailHeight,null==e.optWidth&&null==e.optHeight?(e.optWidth=e.srcWidth,e.optHeight=e.srcHeight):null==e.optWidth?e.optWidth=r*e.optHeight:null==e.optHeight&&(e.optHeight=1/r*e.optWidth),n=e.optWidth/e.optHeight,t.height<e.optHeight||t.width<e.optWidth?(e.trgHeight=e.srcHeight,e.trgWidth=e.srcWidth):r>n?(e.srcHeight=t.height,e.srcWidth=e.srcHeight*n):(e.srcWidth=t.width,e.srcHeight=e.srcWidth/n),e.srcX=(t.width-e.srcWidth)/2,e.srcY=(t.height-e.srcHeight)/2,e},drop:function(t){return this.element.classList.remove("dz-drag-hover")},dragstart:a,dragend:function(t){return this.element.classList.remove("dz-drag-hover")},dragenter:function(t){return this.element.classList.add("dz-drag-hover")},dragover:function(t){return this.element.classList.add("dz-drag-hover")},dragleave:function(t){return this.element.classList.remove("dz-drag-hover")},paste:a,reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(t){var r,n,i,o,s,a,u,l,c,p,d,h,f;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){for(t.previewElement=e.createElement(this.options.previewTemplate.trim()),t.previewTemplate=t.previewElement,this.previewsContainer.appendChild(t.previewElement),p=t.previewElement.querySelectorAll("[data-dz-name]"),o=0,u=p.length;o<u;o++)r=p[o],r.textContent=this._renameFilename(t.name);for(d=t.previewElement.querySelectorAll("[data-dz-size]"),s=0,l=d.length;s<l;s++)r=d[s],r.innerHTML=this.filesize(t.size);for(this.options.addRemoveLinks&&(t._removeLink=e.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'+this.options.dictRemoveFile+"</a>"),t.previewElement.appendChild(t._removeLink)),n=function(r){return function(n){return n.preventDefault(),n.stopPropagation(),t.status===e.UPLOADING?e.confirm(r.options.dictCancelUploadConfirmation,function(){return r.removeFile(t)}):r.options.dictRemoveFileConfirmation?e.confirm(r.options.dictRemoveFileConfirmation,function(){return r.removeFile(t)}):r.removeFile(t)}}(this),h=t.previewElement.querySelectorAll("[data-dz-remove]"),f=[],a=0,c=h.length;a<c;a++)i=h[a],f.push(i.addEventListener("click",n));return f}},removedfile:function(t){var e;return t.previewElement&&null!=(e=t.previewElement)&&e.parentNode.removeChild(t.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(t,e){var r,n,i,o;if(t.previewElement){for(t.previewElement.classList.remove("dz-file-preview"),o=t.previewElement.querySelectorAll("[data-dz-thumbnail]"),n=0,i=o.length;n<i;n++)r=o[n],r.alt=t.name,r.src=e;return setTimeout(function(e){return function(){return t.previewElement.classList.add("dz-image-preview")}}(),1)}},error:function(t,e){var r,n,i,o,s;if(t.previewElement){for(t.previewElement.classList.add("dz-error"),"String"!=typeof e&&e.error&&(e=e.error),o=t.previewElement.querySelectorAll("[data-dz-errormessage]"),s=[],n=0,i=o.length;n<i;n++)r=o[n],s.push(r.textContent=e);return s}},errormultiple:a,processing:function(t){if(t.previewElement&&(t.previewElement.classList.add("dz-processing"),t._removeLink))return t._removeLink.textContent=this.options.dictCancelUpload},processingmultiple:a,uploadprogress:function(t,e,r){var n,i,o,s,a;if(t.previewElement){for(s=t.previewElement.querySelectorAll("[data-dz-uploadprogress]"),a=[],i=0,o=s.length;i<o;i++)n=s[i],"PROGRESS"===n.nodeName?a.push(n.value=e):a.push(n.style.width=e+"%");return a}},totaluploadprogress:a,sending:a,sendingmultiple:a,success:function(t){if(t.previewElement)return t.previewElement.classList.add("dz-success")},successmultiple:a,canceled:function(t){return this.emit("error",t,"Upload canceled.")},canceledmultiple:a,complete:function(t){if(t._removeLink&&(t._removeLink.textContent=this.options.dictRemoveFile),t.previewElement)return t.previewElement.classList.add("dz-complete")},completemultiple:a,maxfilesexceeded:a,maxfilesreached:a,queuecomplete:a,addedfiles:a,previewTemplate:'<div class="dz-preview dz-file-preview">\n <div class="dz-image"><img data-dz-thumbnail /></div>\n <div class="dz-details">\n <div class="dz-size"><span data-dz-size></span></div>\n <div class="dz-filename"><span data-dz-name></span></div>\n </div>\n <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <div class="dz-success-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Check</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>\n </g>\n </svg>\n </div>\n <div class="dz-error-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Error</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <g id="Check-+-Oval-2" sketch:type="MSLayerGroup" stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">\n <path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" sketch:type="MSShapeGroup"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>'},n=function(){var t,e,r,n,i,o,s;for(n=arguments[0],r=2<=arguments.length?l.call(arguments,1):[],o=0,s=r.length;o<s;o++){e=r[o];for(t in e)i=e[t],n[t]=i}return n},e.prototype.getAcceptedFiles=function(){var t,e,r,n,i;for(n=this.files,i=[],e=0,r=n.length;e<r;e++)t=n[e],t.accepted&&i.push(t);return i},e.prototype.getRejectedFiles=function(){var t,e,r,n,i;for(n=this.files,i=[],e=0,r=n.length;e<r;e++)t=n[e],t.accepted||i.push(t);return i},e.prototype.getFilesWithStatus=function(t){var e,r,n,i,o;for(i=this.files,o=[],r=0,n=i.length;r<n;r++)e=i[r],e.status===t&&o.push(e);return o},e.prototype.getQueuedFiles=function(){return this.getFilesWithStatus(e.QUEUED)},e.prototype.getUploadingFiles=function(){return this.getFilesWithStatus(e.UPLOADING)},e.prototype.getAddedFiles=function(){return this.getFilesWithStatus(e.ADDED)},e.prototype.getActiveFiles=function(){var t,r,n,i,o;for(i=this.files,o=[],r=0,n=i.length;r<n;r++)t=i[r],t.status!==e.UPLOADING&&t.status!==e.QUEUED||o.push(t);return o},e.prototype.init=function(){var t,r,n,i,o,s,a;for("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(e.createElement('<div class="dz-default dz-message"><span>'+this.options.dictDefaultMessage+"</span></div>")),this.clickableElements.length&&(n=function(t){return function(){return t.hiddenFileInput&&t.hiddenFileInput.parentNode.removeChild(t.hiddenFileInput),t.hiddenFileInput=document.createElement("input"),t.hiddenFileInput.setAttribute("type","file"),(null==t.options.maxFiles||t.options.maxFiles>1)&&t.hiddenFileInput.setAttribute("multiple","multiple"),t.hiddenFileInput.className="dz-hidden-input",null!=t.options.acceptedFiles&&t.hiddenFileInput.setAttribute("accept",t.options.acceptedFiles),null!=t.options.capture&&t.hiddenFileInput.setAttribute("capture",t.options.capture),t.hiddenFileInput.style.visibility="hidden",t.hiddenFileInput.style.position="absolute",t.hiddenFileInput.style.top="0",t.hiddenFileInput.style.left="0",t.hiddenFileInput.style.height="0",t.hiddenFileInput.style.width="0",document.querySelector(t.options.hiddenInputContainer).appendChild(t.hiddenFileInput),t.hiddenFileInput.addEventListener("change",function(){var e,r,i,o;if(r=t.hiddenFileInput.files,r.length)for(i=0,o=r.length;i<o;i++)e=r[i],t.addFile(e);return t.emit("addedfiles",r),n()})}}(this))(),this.URL=null!=(s=window.URL)?s:window.webkitURL,a=this.events,i=0,o=a.length;i<o;i++)t=a[i],this.on(t,this.options[t]);return this.on("uploadprogress",function(t){return function(){return t.updateTotalUploadProgress()}}(this)),this.on("removedfile",function(t){return function(){return t.updateTotalUploadProgress()}}(this)),this.on("canceled",function(t){return function(e){return t.emit("complete",e)}}(this)),this.on("complete",function(t){return function(e){if(0===t.getAddedFiles().length&&0===t.getUploadingFiles().length&&0===t.getQueuedFiles().length)return setTimeout(function(){return t.emit("queuecomplete")},0)}}(this)),r=function(t){return t.stopPropagation(),t.preventDefault?t.preventDefault():t.returnValue=!1},this.listeners=[{element:this.element,events:{dragstart:function(t){return function(e){return t.emit("dragstart",e)}}(this),dragenter:function(t){return function(e){return r(e),t.emit("dragenter",e)}}(this),dragover:function(t){return function(e){var n;try{n=e.dataTransfer.effectAllowed}catch(t){}return e.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",r(e),t.emit("dragover",e)}}(this),dragleave:function(t){return function(e){return t.emit("dragleave",e)}}(this),drop:function(t){return function(e){return r(e),t.drop(e)}}(this),dragend:function(t){return function(e){return t.emit("dragend",e)}}(this)}}],this.clickableElements.forEach(function(t){return function(r){return t.listeners.push({element:r,events:{click:function(n){return(r!==t.element||n.target===t.element||e.elementInside(n.target,t.element.querySelector(".dz-message")))&&t.hiddenFileInput.click(),!0}}})}}(this)),this.enable(),this.options.init.call(this)},e.prototype.destroy=function(){var t;return this.disable(),this.removeAllFiles(!0),(null!=(t=this.hiddenFileInput)?t.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,e.instances.splice(e.instances.indexOf(this),1)},e.prototype.updateTotalUploadProgress=function(){var t,e,r,n,i,o,s,a;if(n=0,r=0,t=this.getActiveFiles(),t.length){for(a=this.getActiveFiles(),o=0,s=a.length;o<s;o++)e=a[o],n+=e.upload.bytesSent,r+=e.upload.total;i=100*n/r}else i=100;return this.emit("totaluploadprogress",i,r,n)},e.prototype._getParamName=function(t){return"function"==typeof this.options.paramName?this.options.paramName(t):this.options.paramName+(this.options.uploadMultiple?"["+t+"]":"")},e.prototype._renameFilename=function(t){return"function"!=typeof this.options.renameFilename?t:this.options.renameFilename(t)},e.prototype.getFallbackForm=function(){var t,r,n,i;return(t=this.getExistingFallback())?t:(n='<div class="dz-fallback">',this.options.dictFallbackText&&(n+="<p>"+this.options.dictFallbackText+"</p>"),n+='<input type="file" name="'+this._getParamName(0)+'" '+(this.options.uploadMultiple?'multiple="multiple"':void 0)+' /><input type="submit" value="Upload!"></div>',r=e.createElement(n),"FORM"!==this.element.tagName?(i=e.createElement('<form action="'+this.options.url+'" enctype="multipart/form-data" method="'+this.options.method+'"></form>'),i.appendChild(r)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=i?i:r)},e.prototype.getExistingFallback=function(){var t,e,r,n,i,o;for(e=function(t){var e,r,n;for(r=0,n=t.length;r<n;r++)if(e=t[r],/(^| )fallback($| )/.test(e.className))return e},o=["div","form"],n=0,i=o.length;n<i;n++)if(r=o[n],t=e(this.element.getElementsByTagName(r)))return t},e.prototype.setupEventListeners=function(){var t,e,r,n,i,o,s;for(o=this.listeners,s=[],n=0,i=o.length;n<i;n++)t=o[n],s.push(function(){var n,i;n=t.events,i=[];for(e in n)r=n[e],i.push(t.element.addEventListener(e,r,!1));return i}());return s},e.prototype.removeEventListeners=function(){var t,e,r,n,i,o,s;for(o=this.listeners,s=[],n=0,i=o.length;n<i;n++)t=o[n],s.push(function(){var n,i;n=t.events,i=[];for(e in n)r=n[e],i.push(t.element.removeEventListener(e,r,!1));return i}());return s},e.prototype.disable=function(){var t,e,r,n,i;for(this.clickableElements.forEach(function(t){return t.classList.remove("dz-clickable")}),this.removeEventListeners(),n=this.files,i=[],e=0,r=n.length;e<r;e++)t=n[e],i.push(this.cancelUpload(t));return i},e.prototype.enable=function(){return this.clickableElements.forEach(function(t){return t.classList.add("dz-clickable")}),this.setupEventListeners()},e.prototype.filesize=function(t){var e,r,n,i,o,s,a,u;if(n=0,i="b",t>0){for(s=["TB","GB","MB","KB","b"],r=a=0,u=s.length;a<u;r=++a)if(o=s[r],e=Math.pow(this.options.filesizeBase,4-r)/10,t>=e){n=t/Math.pow(this.options.filesizeBase,4-r),i=o;break}n=Math.round(10*n)/10}return"<strong>"+n+"</strong> "+i},e.prototype._updateMaxFilesReachedClass=function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")},e.prototype.drop=function(t){var e,r;t.dataTransfer&&(this.emit("drop",t),e=t.dataTransfer.files,this.emit("addedfiles",e),e.length&&(r=t.dataTransfer.items,r&&r.length&&null!=r[0].webkitGetAsEntry?this._addFilesFromItems(r):this.handleFiles(e)))},e.prototype.paste=function(t){var e,r;if(null!=(null!=t&&null!=(r=t.clipboardData)?r.items:void 0))return this.emit("paste",t),e=t.clipboardData.items,e.length?this._addFilesFromItems(e):void 0},e.prototype.handleFiles=function(t){var e,r,n,i;for(i=[],r=0,n=t.length;r<n;r++)e=t[r],i.push(this.addFile(e));return i},e.prototype._addFilesFromItems=function(t){var e,r,n,i,o;for(o=[],n=0,i=t.length;n<i;n++)r=t[n],null!=r.webkitGetAsEntry&&(e=r.webkitGetAsEntry())?e.isFile?o.push(this.addFile(r.getAsFile())):e.isDirectory?o.push(this._addFilesFromDirectory(e,e.name)):o.push(void 0):null!=r.getAsFile&&(null==r.kind||"file"===r.kind)?o.push(this.addFile(r.getAsFile())):o.push(void 0);return o},e.prototype._addFilesFromDirectory=function(t,e){var r,n,i;return r=t.createReader(),n=function(t){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log(t):void 0},(i=function(t){return function(){return r.readEntries(function(r){var n,o,s;if(r.length>0){for(o=0,s=r.length;o<s;o++)n=r[o],n.isFile?n.file(function(r){if(!t.options.ignoreHiddenFiles||"."!==r.name.substring(0,1))return r.fullPath=e+"/"+r.name,t.addFile(r)}):n.isDirectory&&t._addFilesFromDirectory(n,e+"/"+n.name);i()}return null},n)}}(this))()},e.prototype.accept=function(t,r){return t.size>1024*this.options.maxFilesize*1024?r(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(t.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):e.isValidFile(t,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(r(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",t)):this.options.accept.call(this,t,r):r(this.options.dictInvalidFileType)},e.prototype.addFile=function(t){return t.upload={progress:0,total:t.size,bytesSent:0},this.files.push(t),t.status=e.ADDED,this.emit("addedfile",t),this._enqueueThumbnail(t),this.accept(t,function(e){return function(r){return r?(t.accepted=!1,e._errorProcessing([t],r)):(t.accepted=!0,e.options.autoQueue&&e.enqueueFile(t)),e._updateMaxFilesReachedClass()}}(this))},e.prototype.enqueueFiles=function(t){var e,r,n;for(r=0,n=t.length;r<n;r++)e=t[r],this.enqueueFile(e);return null},e.prototype.enqueueFile=function(t){if(t.status!==e.ADDED||!0!==t.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(t.status=e.QUEUED,this.options.autoProcessQueue)return setTimeout(function(t){return function(){return t.processQueue()}}(this),0)},e.prototype._thumbnailQueue=[],e.prototype._processingThumbnail=!1,e.prototype._enqueueThumbnail=function(t){if(this.options.createImageThumbnails&&t.type.match(/image.*/)&&t.size<=1024*this.options.maxThumbnailFilesize*1024)return this._thumbnailQueue.push(t),setTimeout(function(t){return function(){return t._processThumbnailQueue()}}(this),0)},e.prototype._processThumbnailQueue=function(){if(!this._processingThumbnail&&0!==this._thumbnailQueue.length)return this._processingThumbnail=!0,this.createThumbnail(this._thumbnailQueue.shift(),function(t){return function(){return t._processingThumbnail=!1,t._processThumbnailQueue()}}(this))},e.prototype.removeFile=function(t){if(t.status===e.UPLOADING&&this.cancelUpload(t),this.files=u(this.files,t),this.emit("removedfile",t),0===this.files.length)return this.emit("reset")},e.prototype.removeAllFiles=function(t){var r,n,i,o;for(null==t&&(t=!1),o=this.files.slice(),n=0,i=o.length;n<i;n++)r=o[n],(r.status!==e.UPLOADING||t)&&this.removeFile(r);return null},e.prototype.createThumbnail=function(t,e){var r;return r=new FileReader,r.onload=function(n){return function(){return"image/svg+xml"===t.type?(n.emit("thumbnail",t,r.result),void(null!=e&&e())):n.createThumbnailFromUrl(t,r.result,e)}}(this),r.readAsDataURL(t)},e.prototype.createThumbnailFromUrl=function(t,e,r,n){var i;return i=document.createElement("img"),n&&(i.crossOrigin=n),i.onload=function(e){return function(){var n,o,a,u,l,c,p,d;if(t.width=i.width,t.height=i.height,a=e.options.resize.call(e,t),null==a.trgWidth&&(a.trgWidth=a.optWidth),null==a.trgHeight&&(a.trgHeight=a.optHeight),n=document.createElement("canvas"),o=n.getContext("2d"),n.width=a.trgWidth,n.height=a.trgHeight,s(o,i,null!=(l=a.srcX)?l:0,null!=(c=a.srcY)?c:0,a.srcWidth,a.srcHeight,null!=(p=a.trgX)?p:0,null!=(d=a.trgY)?d:0,a.trgWidth,a.trgHeight),u=n.toDataURL("image/png"),e.emit("thumbnail",t,u),null!=r)return r()}}(this),null!=r&&(i.onerror=r),i.src=e},e.prototype.processQueue=function(){var t,e,r,n;if(e=this.options.parallelUploads,r=this.getUploadingFiles().length,t=r,!(r>=e)&&(n=this.getQueuedFiles(),n.length>0)){if(this.options.uploadMultiple)return this.processFiles(n.slice(0,e-r));for(;t<e;){if(!n.length)return;this.processFile(n.shift()),t++}}},e.prototype.processFile=function(t){return this.processFiles([t])},e.prototype.processFiles=function(t){var r,n,i;for(n=0,i=t.length;n<i;n++)r=t[n],r.processing=!0,r.status=e.UPLOADING,this.emit("processing",r);return this.options.uploadMultiple&&this.emit("processingmultiple",t),this.uploadFiles(t)},e.prototype._getFilesWithXhr=function(t){var e;return function(){var r,n,i,o;for(i=this.files,o=[],r=0,n=i.length;r<n;r++)e=i[r],e.xhr===t&&o.push(e);return o}.call(this)},e.prototype.cancelUpload=function(t){var r,n,i,o,s,a,u;if(t.status===e.UPLOADING){for(n=this._getFilesWithXhr(t.xhr),i=0,s=n.length;i<s;i++)r=n[i],r.status=e.CANCELED;for(t.xhr.abort(),o=0,a=n.length;o<a;o++)r=n[o],this.emit("canceled",r);this.options.uploadMultiple&&this.emit("canceledmultiple",n)}else(u=t.status)!==e.ADDED&&u!==e.QUEUED||(t.status=e.CANCELED,this.emit("canceled",t),this.options.uploadMultiple&&this.emit("canceledmultiple",[t]));if(this.options.autoProcessQueue)return this.processQueue()},i=function(){var t,e;return e=arguments[0],t=2<=arguments.length?l.call(arguments,1):[],"function"==typeof e?e.apply(this,t):e},e.prototype.uploadFile=function(t){return this.uploadFiles([t])},e.prototype.uploadFiles=function(t){var r,o,s,a,u,l,c,p,d,h,f,g,_,y,v,m,b,w,E,P,S,x,k,A,O,T,C,R,M,I,D,L,F,U;for(E=new XMLHttpRequest,P=0,A=t.length;P<A;P++)r=t[P],r.xhr=E;g=i(this.options.method,t),b=i(this.options.url,t),E.open(g,b,!0),E.withCredentials=!!this.options.withCredentials,v=null,s=function(e){return function(){var n,i,o;for(o=[],n=0,i=t.length;n<i;n++)r=t[n],o.push(e._errorProcessing(t,v||e.options.dictResponseError.replace("{{statusCode}}",E.status),E));return o}}(this),m=function(e){return function(n){var i,o,s,a,u,l,c,p,d;if(null!=n)for(o=100*n.loaded/n.total,s=0,l=t.length;s<l;s++)r=t[s],r.upload={progress:o,total:n.total,bytesSent:n.loaded};else{for(i=!0,o=100,a=0,c=t.length;a<c;a++)r=t[a],100===r.upload.progress&&r.upload.bytesSent===r.upload.total||(i=!1),r.upload.progress=o,r.upload.bytesSent=r.upload.total;if(i)return}for(d=[],u=0,p=t.length;u<p;u++)r=t[u],d.push(e.emit("uploadprogress",r,o,r.upload.bytesSent));return d}}(this),E.onload=function(r){return function(n){var i;if(t[0].status!==e.CANCELED&&4===E.readyState){if(v=E.responseText,E.getResponseHeader("content-type")&&~E.getResponseHeader("content-type").indexOf("application/json"))try{v=JSON.parse(v)}catch(t){n=t,v="Invalid JSON response from server."}return m(),200<=(i=E.status)&&i<300?r._finished(t,v,n):s()}}}(this),E.onerror=function(r){return function(){if(t[0].status!==e.CANCELED)return s()}}(),y=null!=(M=E.upload)?M:E,y.onprogress=m,l={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"},this.options.headers&&n(l,this.options.headers);for(a in l)(u=l[a])&&E.setRequestHeader(a,u);if(o=new FormData,this.options.params){I=this.options.params;for(f in I)w=I[f],o.append(f,w)}for(S=0,O=t.length;S<O;S++)r=t[S],this.emit("sending",r,E,o);if(this.options.uploadMultiple&&this.emit("sendingmultiple",t,E,o),"FORM"===this.element.tagName)for(D=this.element.querySelectorAll("input, textarea, select, button"),x=0,T=D.length;x<T;x++)if(p=D[x],d=p.getAttribute("name"),h=p.getAttribute("type"),"SELECT"===p.tagName&&p.hasAttribute("multiple"))for(L=p.options,k=0,C=L.length;k<C;k++)_=L[k],_.selected&&o.append(d,_.value);else(!h||"checkbox"!==(F=h.toLowerCase())&&"radio"!==F||p.checked)&&o.append(d,p.value);for(c=R=0,U=t.length-1;0<=U?R<=U:R>=U;c=0<=U?++R:--R)o.append(this._getParamName(c),t[c],this._renameFilename(t[c].name));return this.submitRequest(E,o,t)},e.prototype.submitRequest=function(t,e,r){return t.send(e)},e.prototype._finished=function(t,r,n){var i,o,s;for(o=0,s=t.length;o<s;o++)i=t[o],i.status=e.SUCCESS,this.emit("success",i,r,n),this.emit("complete",i);if(this.options.uploadMultiple&&(this.emit("successmultiple",t,r,n),this.emit("completemultiple",t)),this.options.autoProcessQueue)return this.processQueue()},e.prototype._errorProcessing=function(t,r,n){var i,o,s;for(o=0,s=t.length;o<s;o++)i=t[o],i.status=e.ERROR,this.emit("error",i,r,n),this.emit("complete",i);if(this.options.uploadMultiple&&(this.emit("errormultiple",t,r,n),this.emit("completemultiple",t)),this.options.autoProcessQueue)return this.processQueue()},e}(r),e.version="4.3.0",e.options={},e.optionsForElement=function(t){return t.getAttribute("id")?e.options[n(t.getAttribute("id"))]:void 0},e.instances=[],e.forElement=function(t){if("string"==typeof t&&(t=document.querySelector(t)),null==(null!=t?t.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return t.dropzone},e.autoDiscover=!0,e.discover=function(){var t,r,n,i,o,s;for(document.querySelectorAll?n=document.querySelectorAll(".dropzone"):(n=[],t=function(t){var e,r,i,o;for(o=[],r=0,i=t.length;r<i;r++)e=t[r],/(^| )dropzone($| )/.test(e.className)?o.push(n.push(e)):o.push(void 0);return o},t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))),s=[],i=0,o=n.length;i<o;i++)r=n[i],!1!==e.optionsForElement(r)?s.push(new e(r)):s.push(void 0);return s},e.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i],e.isBrowserSupported=function(){var t,r,n,i,o;if(t=!0,window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(o=e.blacklistedBrowsers,n=0,i=o.length;n<i;n++)r=o[n],r.test(navigator.userAgent)&&(t=!1);else t=!1;else t=!1;return t},u=function(t,e){var r,n,i,o;for(o=[],n=0,i=t.length;n<i;n++)(r=t[n])!==e&&o.push(r);return o},n=function(t){return t.replace(/[\-_](\w)/g,function(t){return t.charAt(1).toUpperCase()})},e.createElement=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.childNodes[0]},e.elementInside=function(t,e){if(t===e)return!0;for(;t=t.parentNode;)if(t===e)return!0;return!1},e.getElement=function(t,e){var r;if("string"==typeof t?r=document.querySelector(t):null!=t.nodeType&&(r=t),null==r)throw new Error("Invalid `"+e+"` option provided. Please provide a CSS selector or a plain HTML element.");return r},e.getElements=function(t,e){var r,n,i,o,s,a,u;if(t instanceof Array){n=[];try{for(i=0,s=t.length;i<s;i++)r=t[i],n.push(this.getElement(r,e))}catch(t){t,n=null}}else if("string"==typeof t)for(n=[],u=document.querySelectorAll(t),o=0,a=u.length;o<a;o++)r=u[o],n.push(r);else null!=t.nodeType&&(n=[t]);if(null==n||!n.length)throw new Error("Invalid `"+e+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return n},e.confirm=function(t,e,r){return window.confirm(t)?e():null!=r?r():void 0},e.isValidFile=function(t,e){var r,n,i,o,s;if(!e)return!0;for(e=e.split(","),n=t.type,r=n.replace(/\/.*$/,""),o=0,s=e.length;o<s;o++)if(i=e[o],i=i.trim(),"."===i.charAt(0)){if(-1!==t.name.toLowerCase().indexOf(i.toLowerCase(),t.name.length-i.length))return!0}else if(/\/\*$/.test(i)){if(r===i.replace(/\/.*$/,""))return!0}else if(n===i)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(t){return this.each(function(){return new e(this,t)})}),void 0!==t&&null!==t?t.exports=e:window.Dropzone=e,e.ADDED="added",e.QUEUED="queued",e.ACCEPTED=e.QUEUED,e.UPLOADING="uploading",e.PROCESSING=e.UPLOADING,e.CANCELED="canceled",e.ERROR="error",e.SUCCESS="success",o=function(t){var e,r,n,i,o,s,a,u,l;for(t.naturalWidth,s=t.naturalHeight,r=document.createElement("canvas"),r.width=1,r.height=s,n=r.getContext("2d"),n.drawImage(t,0,0),i=n.getImageData(0,0,1,s).data,l=0,o=s,a=s;a>l;)e=i[4*(a-1)+3],0===e?o=a:l=a,a=o+l>>1;return u=a/s,0===u?1:u},s=function(t,e,r,n,i,s,a,u,l,c){var p;return p=o(e),t.drawImage(e,r,n,i,s,a,u,l,c/p)},i=function(t,e){var r,n,i,o,s,a,u,l,c;if(i=!1,c=!0,n=t.document,l=n.documentElement,r=n.addEventListener?"addEventListener":"attachEvent",u=n.addEventListener?"removeEventListener":"detachEvent",a=n.addEventListener?"":"on",o=function(r){if("readystatechange"!==r.type||"complete"===n.readyState)return("load"===r.type?t:n)[u](a+r.type,o,!1),!i&&(i=!0)?e.call(t,r.type||r):void 0},s=function(){try{l.doScroll("left")}catch(t){return t,void setTimeout(s,50)}return o("poll")},"complete"!==n.readyState){if(n.createEventObject&&l.doScroll){try{c=!t.frameElement}catch(t){}c&&s()}return n[r](a+"DOMContentLoaded",o,!1),n[r](a+"readystatechange",o,!1),t[r](a+"load",o,!1)}},e._autoDiscoverFunction=function(){if(e.autoDiscover)return e.discover()},i(window,e._autoDiscoverFunction)}).call(this)}).call(e,r(46)(t))},function(t,e,r){"use strict";function n(t,e){var r,n;return{create:function(){r=o.e("div"),n=o.e("div"),this.hydrate()},hydrate:function(t){r.className="nano scrolling-container",n.className="scroll-content"},mount:function(t,i){o.l(r,t,i),e.refs.nano=r,o.b(n,r),e._yield&&e._yield.mount(n,null)},unmount:function(){o.i(r),e.refs.nano===r&&(e.refs.nano=null),e._yield&&e._yield.unmount()},destroy:o.m}}function i(t){t=t||{},this.refs={},this._state=t.data||{},this._observers={pre:Object.create(null),post:Object.create(null)},this._handlers=Object.create(null),this._root=t._root||this,this._yield=t._yield,this._torndown=!1,this._fragment=n(this._state,this),t.target&&(this._fragment.create(),this._fragment.mount(t.target,null)),t._root?t._root._renderHooks.push(s.oncreate.bind(this)):s.oncreate.call(this)}var o=r(15),s=function(){return{oncreate:function(){$(this.refs.nano).nanoScroller({preventPageScrolling:!0,disableResize:!0,contentClass:"scroll-content",paneClass:"scroll-pane"})},ondestroy:function(){$(this.refs.nano).nanoScroller({destroy:!0})},methods:{update:function(){$(this.refs.nano).nanoScroller()},scrollTop:function(){$(this.refs.nano).find(".scroll-content").animate({scrollTop:0},500)},scrollBottom:function(){$(this.refs.nano).nanoScroller({scroll:"bottom"})}}}}();o.c(i.prototype,s.methods,o.n),i.prototype._set=function(t){var e=this._state;this._state=o.c({},e,t),o.k(this,this._observers.pre,t,e),o.k(this,this._observers.post,t,e)},i.prototype.teardown=i.prototype.destroy=function(t){this.fire("destroy"),s.ondestroy.call(this),!1!==t&&this._fragment.unmount(),this._fragment.destroy(),this._fragment=null,this._state={},this._torndown=!0},e.a=i},function(t,e,r){"use strict";function n(){var t=p.e("style");t.id="svelte-201504670-style",t.textContent="\n [svelte-201504670].browser-entry-icon, [svelte-201504670] .browser-entry-icon {\n display: none;\n }\n\n [svelte-201504670].upload--is-complete .browser-entry-icon, [svelte-201504670] .upload--is-complete .browser-entry-icon {\n display: block;\n }\n\n [svelte-201504670].browser-entry-info:before, [svelte-201504670] .browser-entry-info:before {\n display: none;\n }\n\n [svelte-201504670].browser-audio.upload--is-complete .browser-entry-info:before, [svelte-201504670] .browser-audio.upload--is-complete .browser-entry-info:before {\n display: inline-block;\n }\n\n [svelte-201504670].icon-error, [svelte-201504670] .icon-error {\n position: absolute;\n top: 0;\n left: 45px;\n width: 20px;\n height: 100%;\n z-index: 1;\n }\n\n [svelte-201504670].browser-image-prew_img, [svelte-201504670] .browser-image-prew_img {\n opacity: 1;\n }\n\n [svelte-201504670].upload-error .browser-entry-prew:after, [svelte-201504670] .upload-error .browser-entry-prew:after {\n display: none;\n }\n\n [svelte-201504670].upload--is-sending .browser-image-prew_img, [svelte-201504670] .upload--is-sending .browser-image-prew_img,\n [svelte-201504670].upload-error .browser-image-prew_img, [svelte-201504670] .upload-error .browser-image-prew_img {\n opacity: .2;\n }\n\n [svelte-201504670].progress-bar, [svelte-201504670] .progress-bar {\n background: #cccacf;\n position: absolute;\n top: 32px;\n width: 80px;\n left: 15px;\n height: 7px;\n border-radius: 3px;\n font-family: 'ProximaNova-Regular';\n font-size: 12px;\n }\n [svelte-201504670].progress-bar_fill, [svelte-201504670] .progress-bar_fill {\n background: #adadb3;\n height: 100%;\n border-radius: inherit;\n transition: width 100ms linear;\n }\n\n [svelte-201504670].upload--is-sending .progress-bar, [svelte-201504670] .upload--is-sending .progress-bar {\n background: transparent;\n }\n\n [svelte-201504670].upload--is-complete .progress-bar, [svelte-201504670] .upload--is-complete .progress-bar {\n display: none;\n }\n",p.b(t,document.head)}function i(t,e){function r(t){var r=e.get();e.fire("select",r.file)}function n(t){return 100===t.file.progress&&"sending"===t.file.state?a:u}function i(t){e.togglePlay()}var l,d,h,f,g,_,y,v,m,b,w,E,P,S,x=new c.a({_root:e._root,data:{service:"Sounds"}});x.on("state",function(t){var r=this._context.state;e._onSoundsStateChange(r.file.id)}),e.refs.Sounds=x,x._context={state:t};var k=t.file.error&&o(t,e),A=t.file.thumbnail&&s(t,e),O=n(t),T=O(t,e);return{create:function(){x._fragment.create(),l=p.g("\n\n"),d=p.e("div"),f=p.e("div"),_=p.e("span"),y=p.g("\n "),k&&k.create(),v=p.g("\n "),A&&A.create(),m=p.g("\n "),b=p.e("div"),T.create(),w=p.g("\n "),E=p.e("div"),S=p.g(P=t.file.name),this.hydrate()},hydrate:function(e){p.p(d,"svelte-201504670",""),d.className=h="browser-"+t.file.type+" "+t.state+" browser-entry activateable upload--is-"+t.file.state+" "+(t.selected?"active":"")+" "+(t.file.error?"upload-error":""),f.className=g="browser-entry-prew browser-entry-prew--"+t.selectedIcon,p.a(f,"click",r),_.className="browser-entry-icon",b.className="progress-bar",E.className="browser-entry-info",p.a(E,"click",i)},mount:function(t,e){x._fragment.mount(t,e),p.l(l,t,e),p.l(d,t,e),p.b(f,d),p.b(_,f),p.b(y,f),k&&k.mount(f,null),p.b(v,f),A&&A.mount(f,null),p.b(m,f),p.b(b,f),T.mount(b,null),p.b(w,d),p.b(E,d),p.b(S,E)},update:function(t,r){x._context.state=r,h!==(h="browser-"+r.file.type+" "+r.state+" browser-entry activateable upload--is-"+r.file.state+" "+(r.selected?"active":"")+" "+(r.file.error?"upload-error":""))&&(d.className=h),g!==(g="browser-entry-prew browser-entry-prew--"+r.selectedIcon)&&(f.className=g),r.file.error?k||(k=o(r,e),k.create(),k.mount(f,v)):k&&(k.unmount(),k.destroy(),k=null),r.file.thumbnail?A?A.update(t,r):(A=s(r,e),A.create(),A.mount(f,m)):A&&(A.unmount(),A.destroy(),A=null),O===(O=n(r))&&T?T.update(t,r):(T.unmount(),T.destroy(),T=O(r,e),T.create(),T.mount(b,null)),P!==(P=r.file.name)&&(S.data=P)},unmount:function(){x._fragment.unmount(),p.i(l),p.i(d),k&&k.unmount(),A&&A.unmount(),T.unmount()},destroy:function(){e.refs.Sounds===x&&(e.refs.Sounds=null),x.destroy(!1),p.o(f,"click",r),k&&k.destroy(),A&&A.destroy(),T.destroy(),p.o(E,"click",i)}}}function o(t,e){var r,n;return{create:function(){r=p.f("svg"),n=p.f("use"),this.hydrate()},hydrate:function(t){p.p(r,"class","icon icon-error"),p.q(n,"xlink:href","#icon-error")},mount:function(t,e){p.l(r,t,e),p.b(n,r)},unmount:function(){p.i(r)},destroy:p.m}}function s(t,e){var r,n;return{create:function(){r=p.e("div"),this.hydrate()},hydrate:function(e){r.className="browser-image-prew_img",r.style.cssText=n="background-image: url('"+t.file.thumbnail+"')",p.p(r,"width","112"),p.p(r,"height","71")},mount:function(t,e){p.l(r,t,e)},update:function(t,e){n!==(n="background-image: url('"+e.file.thumbnail+"')")&&(r.style.cssText=n)},unmount:function(){p.i(r)},destroy:p.m}}function a(t,e){var r,n;return{create:function(){r=p.e("div"),n=p.g("Processing..."),this.hydrate()},hydrate:function(t){r.style.cssText="width: 100%"},mount:function(t,e){p.l(r,t,e),p.b(n,r)},update:p.m,unmount:function(){p.i(r)},destroy:p.m}}function u(t,e){var r,n;return{create:function(){r=p.e("div"),this.hydrate()},hydrate:function(e){r.className="progress-bar_fill",r.style.cssText=n="width: "+t.file.progress+"%"},mount:function(t,e){p.l(r,t,e)},update:function(t,e){n!==(n="width: "+e.file.progress+"%")&&(r.style.cssText=n)},unmount:function(){p.i(r)},destroy:p.m}}function l(t){t=t||{},this.refs={},this._state=p.c(d.data(),t.data),this._observers={pre:Object.create(null),post:Object.create(null)},this._handlers=Object.create(null),this._root=t._root||this,this._yield=t._yield,this._torndown=!1,document.getElementById("svelte-201504670-style")||n(),this._renderHooks=[],this._fragment=i(this._state,this),t.target&&(this._fragment.create(),this._fragment.mount(t.target,null)),this._flush()}var c=r(57),p=r(15),d=function(){return{data:function(){return{file:void 0,selected:!1,state:"paused",selectedIcon:"check"}},methods:{togglePlay:function(){var t=this.get("file");if("audio"!==t.type)return this.fire("select",t);if(!t.url)throw new Error("File is missing the URL");this.refs.Sounds.instance().load(t.id,t.url),this.refs.Sounds.instance().togglePlay(t.id)},_onSoundsStateChange:function(t){this.set({state:this.refs.Sounds.instance().getState(t)})}}}}();p.c(l.prototype,d.methods,p.n),l.prototype._set=function(t){var e=this._state;this._state=p.c({},e,t),p.k(this,this._observers.pre,t,e),this._fragment.update(t,this._state),p.k(this,this._observers.post,t,e),this._flush()},l.prototype.teardown=l.prototype.destroy=function(t){this.fire("destroy"),!1!==t&&this._fragment.unmount(),this._fragment.destroy(),this._fragment=null,this._state={},this._torndown=!0},e.a=l},function(t,e,r){var n,i,o,s,a,u,l,c=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty;i=window.require("spine/controller/activator"),n=window.require("spine/controller/activateable"),l=r(5),u=r(152),s=window.require("core/models/content"),o=r(153),a=function(t){function e(){this.onScroll=c(this.onScroll,this),this.activate=c(this.activate,this),this._onActivate=c(this._onActivate,this),this.addItem=c(this.addItem,this),this._release=c(this._release,this),this._relocate=c(this._relocate,this),this.scrollBottom=c(this.scrollBottom,this),this.scrollTop=c(this.scrollTop,this),this.onDrop=c(this.onDrop,this),this.onDrag=c(this.onDrag,this),this.onDragStart=c(this.onDragStart,this),this.initialize=c(this.initialize,this),e.__super__.constructor.apply(this,arguments),this.scroll(),this.container.sortable({itemSelector:".item-details",handle:".item-details-order",onDragStart:this.onDragStart,onDrop:this.onDrop,onDrag:this.onDrag}),this.bulkEditor=new o,this.bulkEditor.toggle(),this.bulkEditor.bind("toggle",function(t){return function(e){return setTimeout(function(){return t.scroll().update()},500)}}(this)),this.items=[]}return p(e,t),e.prototype.className="editor-content",e.prototype.autoDeactivate=!1,e.prototype.title="Details",e.prototype.nextTitle="Edit Details",e.prototype.interval=0,e.prototype.vh=0,e.prototype.eof=0,e.include(n),e.include(l),e.prototype.for=function(t){return this.composition=t,this.initialize(),this.el.prepend(this.bulkEditor.el),this.bulkEditor.for(this.composition),this},e.prototype.initialize=function(t){return this.composition?(this.children(function(t){return t.release()}),this.stopListening(),this.listenTo(s,"create",this.addItem),this.composition.getContent().forEach(this.addItem),this.trigger("initialized")):console.warn("No composition set")},e.prototype.onDragStart=function(t,e,r){return t.controller().deactivate(),r(t,e),t.controller().deactivate(),this.scroll().update(),this.$item=$(t),this.vh=this.container.parent().height(),this.oh=this.container[0].scrollHeight,this.eof=this.el.offset()},e.prototype.onDrag=function(t,e,r){var n,i,o;if(r(t,e),i=this.$item.offset(),this.position=e,this.offset=i,this.dragged=this.$item,o=i.top-this.eof.top<30,n=i.top-this.eof.top>this.vh-10,!o&&!n)return clearInterval(this.interval),this.interval=0;if(o){if(0===this.interval)return this.interval=setInterval(this.scrollTop,10)}else if(n&&0===this.interval)return this.interval=setInterval(this.scrollBottom,10)},e.prototype.onDrop=function(t,e,r){return r(t,e),t.controller().onDrop(),this.$item=null,this._relocate(),clearInterval(this.interval),this.interval=0},e.prototype.scrollTop=function(){var t;if((t=this.container.scrollTop())>0)return this.scroll().scrollTo(t-4),this.dragged.css({top:parseInt(this.dragged.css("top"))-4})},e.prototype.scrollBottom=function(){var t,e;if(e=this.container.scrollTop(),(t=parseInt(this.dragged.css("top")))<this.oh-4)return this.scroll().scrollTo(e+4),this.dragged.css({top:4+t})},e.prototype._relocate=function(){return this.children(function(t){return t.item.order!==t.el.index()+1}).forEach(function(t){return t.item.updateAttribute("order",t.el.index()+1,{attribute:"order"})}),this.scroll().update()},e.prototype._release=function(){return e.__super__._release.apply(this,arguments),setTimeout(this._relocate,100),this.delay(function(t){return function(){if(t.isActive()&&0===t.children().length)return t.$trigger("DetailsEditor:empty")}}(this))},e.prototype.addItem=function(t){var e;if(t.composition_id===this.composition.id)return this.append(e=new u({item:t,meta:t.meta()})),t.updateAttribute("order",e.el.index()+1,{attribute:"order"}),this.scroll().update(),this.items.push(e)},e.prototype._onActivate=function(){var t;if(!this.children(function(t){return t.isActive()}).length)return null!=(t=this.children(function(t){return!t.isInvalid})[0])&&t.activate({animate:!0}),this.scroll().update()},e.prototype.activate=function(){return n.activate.apply(this,arguments),this.$trigger("viewChange","details"),this.delay(this._onActivate),this},e.prototype.onScroll=function(){return this.children(function(t){var e;return"function"==typeof(e=t.attributes).deactivate?e.deactivate():void 0})},e}(i),t.exports=a},function(t,e,r){var n,i,o,s,a,u=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=window.require("spine/controller"),o=window.require("spine/controller/container"),n=window.require("spine/controller/activateable"),i=r(115),a=function(t){function e(){this._onItemValidation=u(this._onItemValidation,this),this.destroy=u(this.destroy,this),this.toggle=u(this.toggle,this),this._change=u(this._change,this);var t,r,n,o;e.__super__.constructor.apply(this,arguments),this.item.bind("destroy",this.release),this.item.bind("change",this._change),r="<div class='item-details-order'></div>",o="<div class='item-details-toggle'></div>",t="<div class='item-details-delete' data-icon='⏍'></div>",n=$("<div class='item-details-right'></div>"),this.attributes=new i({options:this.meta.attributes,item:this.item}),n.append(o,t),this.append(r,this.attributes,n)}return l(e,t),e.prototype.className="item-details",e.prototype.tag="li",e.include(o),e.include(n),e.prototype.elements={".item-details-order":"place",".item-details-toggle":"toggleButton"},e.prototype.events={"click .item-details-toggle":"toggle","click .item-details-delete":"destroy",invalid:"_onItemValidation",valid:"_onItemValidation"},e.prototype._change=function(t,e,r){if("order"===r.attribute)return this.place.html(t.order)},e.prototype.activate=function(t){if(null==t&&(t={}),!(this.attributes.length<2||this.isInvalid))return n.activate.apply(this,[t]),t.animate&&this.animateFirstAttribute(),this.attributes.update()},e.prototype.deactivate=function(){return n.deactivate.apply(this,arguments),this.attributes.deactivate()},e.prototype.toggle=function(){return this.isActive()?this.deactivate():this.activate(),this.parent().scroll().update()},e.prototype.destroy=function(){return this.item.destroy()},e.prototype._onItemValidation=function(t){if(this.isInvalid="invalid"===t.type&&this.attributes.el.children().first().is(t.target),this.el.toggleClass("item-invalid",this.isInvalid),this.isInvalid)return this.deactivate()},e.prototype.animateFirstAttribute=function(){var t;return t=this.el.height(),this.el.height(this.el.css("minHeight")),this.el.addClass("transitions").on("transitionend webkitTransitionEnd",function(t){return function(e){if($(e.target).is(t.el))return t.el.removeAttr("style").removeClass("transitions"),t.parent().scroll().update(),t.el.off("transitionend webkitTransitionEnd")}}(this)).height(t)},e.prototype.onDrop=function(){return this.attributes.onDrop()},e}(s),t.exports=a},function(t,e,r){var n,i,o,s,a=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=window.require("spine/controller"),o=window.require("core/models/content"),n=r(154),i=function(t){function e(){return this.onItemChange=a(this.onItemChange,this),this.updateItemAttributes=a(this.updateItemAttributes,this),this.onItemAdded=a(this.onItemAdded,this),this._change=a(this._change,this),this.initialize=a(this.initialize,this),this.for=a(this.for,this),this.toggle=a(this.toggle,this),e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.className="details_bulk-editor activateable",e.prototype.elements={".item-details":"attributesEl"},e.prototype.events={"click .item-toggle":"toggle"},e.prototype._isActive=!1,e.prototype.template=function(){return'<div class="bulk-editor-header">\n\t<div class="bulk-editor-title">'+this.options.title+"</div>\n\t<div class='item-details-right'>\n\t\t"+(this.options.help_text?'<div class="control-help" data-tooltip-text="'+this.options.help_text+'"></div>':"")+'\n\t\t<div class="item-toggle multi-tabs-toggle" data-icon="❯">\n\t\t\t<span data-icon="❯"></span>\n\t\t</div>\n\t</div>\n</div>\n<div class="item-details"></div>'},e.prototype.toggle=function(){return this._isActive=!this._isActive,this.trigger("toggle",this._isActive),this.el.toggleClass("active",this._isActive),this.attributesEl.css({"margin-bottom":this._isActive?0:-this.attributesElHeight})},e.prototype.for=function(t){return this.composition=t,null==this.composition.contentMeta().bulkEditor?this.el.addClass("empty"):(this.item=this.composition.bulkContent(),this.item.bind("change",this._change),this.listenTo(o,"create",this.onItemAdded),this.listenTo(o,"change",this.onItemChange),this.initialize(this.composition.contentMeta()))},e.prototype.initialize=function(t){var e,r,i,o;for(this.options=t.bulkEditor,this.render(),this.numAttributes=this.options.attributes.length,this.el.toggleClass("single-attribute",1===this.numAttributes),o=this.options.attributes,r=0,i=o.length;r<i;r++)e=o[r],(this.attributes||(this.attributes={}))[e]=t.attributes[e];return this.attrPanel=new n({options:this.attributes,item:this.item,el:this.attributesEl}),this.attributesElHeight=this.attributesEl.outerHeight()},e.prototype._change=function(t,e,r){var n;if("metadata"!==(n=r.attribute))return this.composition.getContent().forEach(function(t){return function(e){if(e.id!==t.item.id&&!e.editedMeta(n))return e.attrMeta(n,!1),e.updateAttribute(n,t.item[n],{attribute:n,from:t})}}(this))},e.prototype.onItemAdded=function(t){if(t.composition_id===this.composition.id)return this.updateItemAttributes(o.find(t.id))},e.prototype.updateItemAttributes=function(t){var e,r,n;if(t.composition_id===this.composition.id){r=this.attributes,n=[];for(e in r)r[e],t.editedMeta(e)||t[e]===this.item[e]||(t.attrMeta(e,!1,{silent:!0}),n.push(t.updateAttribute(e,this.item[e],{attribute:e,from:this})));return n}},e.prototype.onItemChange=function(t,e,r){var n,i,o,s,a;if("metadata"===r.attribute&&!r.silent){for(s=this.composition.getContent(),a=[],i=0,o=s.length;i<o;i++)n=s[i],n.id===t.id&&a.push(this.updateItemAttributes(n));return a}},e}(s),t.exports=i},function(t,e,r){var n,i,o,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=window.require("spine/controller"),n=r(115),i=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.attributes=new n({options:this.options,item:this.item,isEditable:function(){return!0}}),this.el.append(this.attributes.el)}return s(e,t),e}(o),t.exports=i},function(t,e){var r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;n=window.require("spine/controller"),r=window.require("spine/controller/activateable"),window.require("core/models/composition"),o=window.require("core/models/widget"),window.require("core/models/user"),i=function(t){function e(){this.onPopupClose=s(this.onPopupClose,this),this.notifyShareIntent=s(this.notifyShareIntent,this),this.publishComposition=s(this.publishComposition,this),this.ready=s(this.ready,this),this._activate=s(this._activate,this),e.__super__.constructor.apply(this,arguments),this.render()}return a(e,t),e.prototype.className="embedder",e.prototype.template="editor/views/embed",e.prototype.nextTitle="Publish",e.prototype.title="Done",e.include(r),e.prototype.elements={".view-comp-btn":"compBtn",".ready-icon":"readyIcon"},e.prototype.events={"click .share-btn":"notifyShareIntent"},e.prototype.for=function(t){if(this.composition=t,this.composition.isPersisted())return this.widget||(this.widget=o.find(this.composition.widget_id))},e.prototype.activate=function(){if(!this.isActive())return this.$trigger("viewChange","save"),this.publishComposition().then(this.for.bind(this,this.composition)).then(this._activate).then(this.ready)},e.prototype._activate=function(){return r.activate.apply(this,arguments)},e.prototype.ready=function(){return this.delay($.fn.show.bind(this.readyIcon))},e.prototype.publishComposition=function(){return this.composition.persist().then(function(t){return function(e){return t.$trigger("composition:save",e)}}(this)).fail(function(t){return function(e){return console.warn("Persisting the composition failed. Saved as temporary."),t.$trigger("composition:temporary:save",t.composition)}}(this))},e.prototype.notifyShareIntent=function(t){return t.preventDefault(),this.$trigger("sharew-intent",$(t.target).data("target"))},e.prototype.onPopupClose=function(){if(this.pop)return this.$trigger("Save:close",this.pop=!1)},e}(n),t.exports=i},function(t,e,r){var n,i,o=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=r(13),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.className="popup login-popup",e.prototype.confirmBtnClass="dim-button button--uc login-button",e.prototype.cancelBtnClass="green-button button--uc button--icon-right button--go register-button",e.prototype.title="Login or sign up.",e.prototype.content="",e.prototype.note="",e.prototype.separator=!1,e.prototype.confirmBtn="Log in",e.prototype.cancelBtn="Sign up free",e.prototype.setTitle=function(t){return null==t&&(t="Login or sign up."),this.title=t,this.render(this),this},e.prototype.place=function(t){return this.pop=this.pop.bind(this,t)},e.prototype.onConfirm=function(){return this.$trigger("login-intent")},e.prototype.onCancel=function(){return this.$trigger("signup-intent")},e}(i),t.exports=new n},function(t,e){var r,n,i,o=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=window.require("spine/controller"),r=window.require("spine/controller/activateable"),n=function(t){function e(){return this.render=o(this.render,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.include(r),e.prototype.tag="a",e.prototype.events={click:"click"},e.prototype.render=function(){return this.$addClass(this.panel.title.toLowerCase()).html(this.panel.title),this},e.prototype.click=function(){return this.$trigger("Breadcrumb:step",this.panel.title.toLowerCase())},e}(i),t.exports=n},function(t,e){var r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;window.require("core/models/skin"),r=window.require("core/models/content"),n=window.require("spine/core/events"),i=window.require("spine/core/module"),o=function(t){function e(t){this.remote=t,this.release=s(this.release,this),this.removeDemoContent=s(this.removeDemoContent,this),this.addContent=s(this.addContent,this),this.resize=s(this.resize,this),this.load=s(this.load,this),this.style=$('<style type="text/css">'),e.__super__.constructor.apply(this,arguments),this.currentWidget=this.remote.getPreview().widget(),this._loadDependencies()}return a(e,t),e.include(n),e.prototype.load=function(t){return this.composition=t,this.stopListening(r,"create",this.removeDemoContent),this.stopListening(r,"create",this.addContent),this.composition.getContent().length||this.listenTo(r,"create",this.removeDemoContent),this.listenTo(r,"create",this.addContent),this.listenTo(this.composition,"update",this.resize),this.lastSkin&&this.setSkin(this.lastSkin),this.trigger("initialized"),this},e.prototype.resize=function(t){return this.currentWidget.resize()},e.prototype.addContent=function(t){if(t.composition_id===this.composition.id)return this.currentWidget.addContent(t)},e.prototype.removeDemoContent=function(t){if(t.composition_id===this.composition.id)return r.all().filter(function(t){return t._isDemoContent}).forEach(function(t){return t.destroy()}),this.currentWidget.clearContent(),this.stopListening(r,"create",this.removeDemoContent)},e.prototype.setSkin=function(t){return this.lastSkin=t,this.currentWidget.setSkin(this.lastSkin)},e.prototype._loadDependencies=function(){var t;if(null!=this.remote.window.SoundManager&&(t=new this.remote.window.SoundManager),null!=this.remote.window.soundManager&&(t=this.remote.window.soundManager),t&&(window.soundManager=t,t.setup(this.remote.window.soundManager.setup())),!window.videojs)return window.videojs=this.remote.window.videojs},e.prototype.release=function(){return this.trigger("release",this),this.unbind(),this.stopListening()},e}(i),t.exports=o},function(t,e,r){function n(t){return r(i(t))}function i(t){var e=o[t];if(!(e+1))throw new Error("Cannot find module '"+t+"'.");return e}var o={"./audio.coffee":19,"./browser.coffee":160,"./color.coffee":91,"./date-time/calendar/index.coffee":20,"./date-time/calendar/months.coffee":21,"./date-time/calendar/years.coffee":22,"./date-time/clock.coffee":23,"./date-time/helper.coffee":24,"./date-time/index.coffee":92,"./date-time/popup.coffee":25,"./details/audio.coffee":93,"./details/image.coffee":94,"./details/video.coffee":95,"./dropdown.coffee":7,"./font/font-item.coffee":29,"./font/font-list.coffee":30,"./font/fonts-popup.coffee":31,"./font/index.coffee":96,"./image.coffee":27,"./index.coffee":2,"./orderPicker.coffee":97,"./position/grid-panel.coffee":32,"./position/index.coffee":98,"./position/panel.coffee":6,"./position/pixel-panel.coffee":34,"./position/popup.coffee":33,"./position/reference-panel.coffee":35,"./range.coffee":99,"./rss.coffee":100,"./scale.coffee":101,"./slider.coffee":102,"./stepper.coffee":3,"./text.coffee":11,"./textarea.coffee":103,"./toggle.coffee":104,"./url.coffee":4,"./video.coffee":28};n.keys=function(){return Object.keys(o)},n.resolve=i,t.exports=n,n.id=159},function(t,e,r){var n,i,o,s,a,u,l,c,p,d,h,f=function(t,e){return function(){return t.apply(e,arguments)}},g=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;u=r(2),l=window.require("spine/controller"),n=window.require("spine/controller/activateable"),a=window.require("spine/controller/container"),d=window.require("spine/controller/tabs"),p=r(106),i=r(50),h=r(112),c=function(t){function e(t){this.onChange=f(this.onChange,this),this.clear=f(this.clear,this);var r;e.__super__.constructor.apply(this,arguments),$.extend(t.options,{readonly:!1}),r=window.require(t.control),this.control=new r({attribute:this.attribute,options:t.options}),this.append(this.control,"<span class='field-delete' data-icon='⏍'></span>"),this.control.bind("change:"+this.control.type,this.onChange),this.recount=function(t){return function(){}}(),this.addEntry=function(t){return function(e){var r;return null==e&&(e={}),t.control.update(e.url),t.tab.count((r=Boolean(e.url||!1))>>0),t.el.toggleClass("old",r)}}(this),this.removeEntry=function(t){return function(e){return null==e&&(e={}),t.control.update(""),t.tab.count(0),t.el.toggleClass("old",!1)}}(this)}return g(e,t),e.prototype.title="directinput",e.prototype.serviceTitle="link",e.prototype.className="directinput directinputpopup",e.include(n),e.include(a),e.prototype.attributes={authenticated:!0},e.prototype.containerClass="directinput-field",e.prototype.events={"click .field-delete":"clear"},e.prototype.clear=function(){return this.control.update(""),this.onChange()},e.prototype.onChange=function(t){var e;return null==t&&(t={}),this.tab.count((e=Boolean(t.value||!1))>>0),this.el.toggleClass("old",e),this.trigger("beforeChange"),e?this.trigger("urlChange",{url:t.value,service:null}):this.trigger("urlRemove")},e.prototype.release=function(){return this.control.release(),e.__super__.release.apply(this,arguments)},e}(l),s=function(t){function e(t,r,n){this.anchor=n,this.activate=f(this.activate,this),this.deactivate=f(this.deactivate,this),this.set=f(this.set,this),this.clearServices=f(this.clearServices,this),this.contentRemove=f(this.contentRemove,this),this.contentCanAdd=f(this.contentCanAdd,this),this.contentAdd=f(this.contentAdd,this),this.addBrowser=f(this.addBrowser,this),e.__super__.constructor.apply(this,arguments),this.input=new c(r),this.browsers=[],this.input.bind("beforeChange",this.clearServices),this.input.bind("urlChange",this.contentAdd),this.input.bind("urlRemove",this.contentRemove),delete this.sources.websearch,delete this.sources.blogvio,delete this.sources.dropbox,delete this.sources.flickr,delete this.sources["google-drive"],this.$bind("click",function(t){return t.stopPropagation()}),this.listenTo($("body"),"click",function(t){return function(){if(t.isActive())return t.deactivate()}}(this))}return g(e,t),e.prototype.className="content-browser browser-popup",e.prototype.tabContainerClass="content-browser-tabs",e.prototype.containerClass="content-browser-container",e.prototype.tabRenderer=p,e.include(n),e.prototype.interval=0,e.prototype.events={"click .message .close":"closeMessage","click .browser-logout":"deactivate"},e.prototype.elements={".message":"message",".message .text":"text"},e.prototype.children=function(t){var e,r,n,i;null==t&&(t=function(){return!0}),n=this.browsers,i=[];for(e in n)r=n[e],t(r)&&i.push(r);return i},e.prototype._initBrowsers=function(t){var e,r,n,o,s;t.append(this.el),this.addBrowser(h,{allowDelete:!1,allowClear:!1}),o=this.sources;for(n in o)s=o[n],e=window.require(s.module),r=null!=s.browser?window.require(s.browser):i,this.browsers[n]=r=new r({content:[],title:n,Service:e,options:$.extend({},this.options,s.options||{})}),this.listenTo(r,"add",this.contentAdd),this.listenTo(r,"remove",this.contentRemove),this.listenTo(r,"canAdd",this.contentCanAdd),this.append(r);return this.browsers.inpt=this.input,this.append(this.input)},e.prototype.addBrowser=function(t,e){var r,n;if(t.isCompatible(this.options.types))return r=new t(Object.assign({filetypes:this.options.types},e)),r.on("toggle",function(e){return function(r){var n,i,o;return n=r.file,r.options,e.clear(),n.id!==(null!=(o=e.item)?o.id:void 0)?(i={id:n.id,url:n.url,service:t.name},e.item=i,e.trigger("select",i)):(e.item=null,e.trigger("select"))}}(this)),r.observe("selected",function(t){return r.tab.count(t.length)}),r.observe("loading",function(t){return function(e){var r;return r=$("style[id^=svelte]"),$(t.popup.head).append(r.clone())}}(this),{defer:!0}),n=function(e){return function(){var n;return(null!=(n=e.item)?n.service:void 0)===t.name?r.set({selected:[e.item.id]}):r.set({selected:[]})}}(this),this.on("select",n),n(),this.append(this.browsers[t.name]=r)},e.prototype.contentAdd=function(t){return t&&(this.item=t),this.trigger("select",t)},e.prototype.contentCanAdd=function(t){return this.clear(),null!=t?t.call(this):void 0},e.prototype.contentRemove=function(t){if(null!=this.item)return this.item=null,this.trigger("select")},e.prototype.clearServices=function(){var t;if(this.item)return null!=(t=this.browsers[this.item.service])&&"function"==typeof t.removeEntry?t.removeEntry(this.item):void 0},e.prototype.clear=function(){var t;if(this.item)return"function"==typeof(t=this.browsers[this.item.service||"inpt"]).removeEntry?t.removeEntry(this.item):void 0},e.prototype.set=function(t){return this.clear(),this.item=t},e.prototype.deactivate=function(){var t;return null!=(t=this.popup)&&t.hide(),n.deactivate.apply(this,arguments)},e.prototype.activate=function(){return this._createPopup().then(function(t){return function(){var e;return t.popup.show(),t.item?(e=t.browsers[t.item.service||"inpt"],e.active(),t.set(t.item),e.recount()):t.children(function(t){return t.isActive()}).length<1&&t.children()[0].active(),n.activate.apply(t,arguments)}}(this))},e.prototype.release=function(){var t,r,n,i;this.input.release(),n=this.browsers;for(t in n)r=n[t],r.release();return null!=(i=this.popup)&&i.release(),e.__super__.release.apply(this,arguments)},e.prototype._createPopup=function(){return this.popupPromise?this.popupPromise:this.popupPromise=Blogvio.UI.popup.new({anchor:this.anchor,topOffset:6,leftOffset:-9,css:["https://widgetic.com/bundles/blogvioapp/css/editor/editor.css"]}).then(function(t){return function(e){return t.popup=e,t._initBrowsers(t.popup),t.popup.append(t.el)}}(this)).fail(function(t){return console.error(t.stack)})},e}(d),o=function(t){function e(){this.deactivate=f(this.deactivate,this),this.browse=f(this.browse,this),this.select=f(this.select,this),this.setItem=f(this.setItem,this),this.update=f(this.update,this);var t,r;e.__super__.constructor.apply(this,arguments),(r=$.extend({},this.options.input))&&(r.options.readonly=!0,t=window.require(r.control),this.control=new t({item:this.item,attribute:this.attribute,options:r.options,isDetailInput:this.isDetailInput}),this.input.prepend(this.control.el)),this.options.browser&&(this.browserPopup=new s(this.options.browser,this.options.input,this.browseButton),this.browserPopup.bind("select",this.select))}return g(e,t),e.prototype.template="core/views/browser",e.prototype.className="control control-browser",e.prototype.elements={".input-browser":"input",".input-browser-browse":"browseButton"},e.prototype.events={"click .input-browser-browse, input:text, .url-thumb":"browse"},e.prototype.update=function(t,e,r){var n;if(null==r&&(r={}),t[this.attribute]&&r.from!==this&&this.browserPopup)return this.browserPopup.set(("function"==typeof t.attrMeta?t.attrMeta(this.attribute):void 0)||(null!=(n=t.metas)?n[this.attribute]:void 0)||{url:t[this.attribute]})},e.prototype.setItem=function(t){return e.__super__.setItem.apply(this,arguments),this.control.setItem(t)},e.prototype.select=function(t){var e,r;return this.change(r=t?t.url:""),"function"==typeof(e=this.item).attrMeta&&e.attrMeta(this.attribute,(null!=t?t.service:void 0)?t:null),this.control.$addClass("valid"),this.trigger("change:"+(this.type||"control"),{attribute:this.attribute,val:r,value:r})},e.prototype.browse=function(t){return t.stopPropagation(),this.browserPopup.isActive()?this.browserPopup.deactivate():this.browserPopup.activate()},e.prototype.release=function(){var t,r;return null!=(t=this.control)&&t.release(),null!=(r=this.browserPopup)&&r.release(),e.__super__.release.apply(this,arguments)},e.prototype.deactivate=function(){return this.browserPopup.deactivate()},e}(u),t.exports=o},function(t,e,r){function n(t){return r(i(t))}function i(t){var e=o[t];if(!(e+1))throw new Error("Cannot find module '"+t+"'.");return e}var o={"./base/photoitem.coffee":162,"./cache.coffee":117,"./default.coffee":163,"./dropbox.coffee":164,"./facebook.coffee":165,"./flickr.coffee":166,"./google-drive-sdk.coffee":118,"./google-drive.coffee":167,"./instagram-social.coffee":168,"./instagram.coffee":169,"./share-popup.coffee":119,"./soundcloud.coffee":170};n.keys=function(){return Object.keys(o)},n.resolve=i,t.exports=n,n.id=161},function(t,e){var r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=window.require("spine/controller"),r=window.require("spine/controller/activateable"),n=window.require("core/models/content"),o=function(t){function e(){this._create=s(this._create,this),this._destroy=s(this._destroy,this),this.error=s(this.error,this),this.done=s(this.done,this),this.toggle=s(this.toggle,this),e.__super__.constructor.apply(this,arguments),this.$bind("click",this.toggle),this.item=new n,this.listenTo(n,"destroy",this._destroy),this.listenTo(n,"create",this._create)}return a(e,t),e.prototype.className="service-photo-item loading",e.prototype.elements={img:"img"},e.include(r),e.prototype.photoOptions=null,e.prototype.photoData=null,e.prototype.toggle=function(t){var e;if(!this.el.is(".loading"))return this.isActive()?this.item.destroy():(e={},e[""+this.attribute]=this.photoData,e.options=this.photoOptions,this.item.updateAttributes(e,{attribute:this.attribute,from:this}))},e.prototype.done=function(){return this.$trigger("itemReady").$removeClass("loading")},e.prototype.error=function(){return this.$trigger("itemReady").release()},e.prototype._destroy=function(t){if(this.item&&t&&t.eql(this.item))return this.deactivate(),this.item=new n},e.prototype._create=function(t){if(this.item&&t&&t.eql(this.item))return this.activate()},e}(i),t.exports=o},function(t,e,r){var n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;o=r(8),i=r(9),n=function(t){function e(){this.triggerAuthRequire=s(this.triggerAuthRequire,this),this.newEntry=s(this.newEntry,this),this.addContentEntry=s(this.addContentEntry,this),this.addItems=s(this.addItems,this),e.__super__.constructor.apply(this,arguments),this.title=""+this.title[0].toUpperCase()+this.title.slice(1),this.authenticated=!1,this.authPromise=(this.authDef=new $.Deferred).promise(),window.editor.el.bind("content:"+this.title.toLowerCase()+":add",this.addItems)}return a(e,t),e.prototype.hideDisconnectBtn=!0,e.prototype._auth=function(t){if(this.triggerAuthRequire(t),this.trigger("auth",this.authenticated),this.authenticated)return setTimeout(function(t){return function(){return t.authDef.resolve()}}(this))},e.prototype.addItems=function(t,e){return null==e&&(e={items:[]}),this.authenticated||this.auth(!(this.authenticated=!0)),this.authPromise.then(function(t){return function(){return t.hasAddContentEntry||t.trigger("refresh",[t.addContentEntry()]),t.trigger("refresh",(e.items||[]).map(t.newEntry))}}(this))},e.prototype.refresh=function(t){return t},e.prototype.addContentEntry=function(){var t;return this.hasAddContentEntry=!0,t=this.newEntry({name:"Add content",url:"/",type:"button"}),t.className="add-content-entity",t.bind("select",this.triggerAuthRequire.bind(this,!0)),t},e.prototype.newEntry=function(t){var e,r,n;e=new i({service:this,name:t.name||t.title||t.url,path:t.url,type:t.type,url:t.url});for(r in t)n=t[r],e[r]=n;return e},e.prototype.getURL=function(t,e){return e(t.url)},e.prototype.preview=function(t){return t.url},e.prototype.deauth=function(){},e.prototype.triggerAuthRequire=function(t){return this.trigger("auth-req",{interactive:t,source:this.title,"content-type":this.options.types})},e}(o),t.exports=n},function(t,e,r){var n,i,o,s,a,u,l,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty,d=function(t,e){return function(){return t.apply(e,arguments)}};a=r(8),o=r(9),u='<a class="add-content-instr-link" target="_blank" href="http://blog.widgetic.com/post/101481120261/how-to-load-your-content-from-dropbox">How to load your content?</a>',n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.openWindow=function(t){return this.popup.location.href=t},e.prototype.openPopup=function(){return this.popup=window.open("/connect/dropbox.html","_dropboxOauthSigninWindow",this.popupWindowSpec(980,700))},e}(Dropbox.Drivers.Popup),l={client:{key:"ekn9VjZx0VA=|nnWESTkqe31UYqt/Qllbpa2sjX1YmmcmNEPH/vwn0w==",sandbox:!0,fileRoot:"auto"},driver:{receiverUrl:"https://widgetic.com/connect/dropbox",rememberUser:!0}},s={image:["image/png","image/jpeg","image/jpg","image/gif","image/bmp"],audio:["audio/mp3","audio/mpeg"],video:["video/mp4"],folder:["inode/directory"]},Dropbox.Stat.prototype.entry=function(t,e){var r,n,i;n={name:this.name,path:this.path,id:this.path};for(r in s)i=s[r],i.indexOf(this.mimeType)>-1&&(n.type=r);return new o(n)},i=function(t){function e(){this.onAuth=d(this.onAuth,this);var t;e.__super__.constructor.apply(this,arguments),this.authenticated=!1,(this.client=new Dropbox.Client(l.client)).authDriver(new n(l.driver)),this.allMime=[].concat.apply([],function(){var e,r,n,i;for(n=this.options.types,i=[],e=0,r=n.length;e<r;e++)t=n[e],null!=s[t]&&i.push(s[t]);return i}.call(this)).concat(s.folder),this.root.navTitle="Dropbox/Apps/Blogvio"}return c(e,t),e.prototype.responses={},e.prototype.faqLink=$(u),e.prototype._auth=function(t){return null==t&&(t=!0),t&&n.prototype.openPopup(),this.client.authenticate({interactive:t},this.onAuth)},e.prototype.onAuth=function(t,e){if(this.trigger("auth",!t&&e.isAuthenticated()),t)return this.client.reset()},e.prototype.refresh=function(t){return this.client.stat(t.path,{readDir:!0,cacheHash:t.hash},function(e){return function(r,n,i){return t.hash=(null!=n?n.versionTag:void 0)||t.hash,r&&(r.status=304)?i=e.responses[t.hash]||[]:(i=i.filter(function(t){return e.allMime.indexOf(t.mimeType)>-1}).map(function(t){return t.entry()}),e.responses[t.hash]=i),e.trigger("refresh",i)}}(this))},e.prototype.getURL=function(t,e){return t.url?e(t.url):this.client.makeUrl(t.path,{downloadHack:!0,long:!0},function(t,r){return e(r.url)})},e.prototype.preview=function(t){return this.client.thumbnailUrl(t.path,{size:"m"})},e.prototype.deauth=function(){return this.client.signOut(function(t){return function(){return t.trigger("auth",!1)}}(this))},e}(a),t.exports=i},function(t,e,r){var n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty,l=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};o=r(8),n=r(9),i=function(t){function e(){this.getPermissions=s(this.getPermissions,this),this._onFBRespond=s(this._onFBRespond,this),this._requestFBPages=s(this._requestFBPages,this),this._requestFBPhotoSet=s(this._requestFBPhotoSet,this),this.getEntryFetchPath=s(this.getEntryFetchPath,this),e.__super__.constructor.apply(this,arguments),this.permissions={},this.authenticated=!1,this.root.id="me",this.root.album=!0,this.apiReady=e.initFB()}return a(e,t),e.initFB=function(){return new Promise(function(t,e){return window.fbAsyncInit=function(e){return function(){return FB.init({status:!0,cookie:!0,xfbml:!1,appId:"126231267555748"}),t()}}(),function(t,e,r){var n,i;if(n=t.getElementsByTagName(e)[0],!t.getElementById(r))return i=t.createElement(e),i.id=r,i.src="//connect.facebook.net/en_US/all.js",n.parentNode.insertBefore(i,n)}(document,"script","facebook-jssdk")})},e.prototype.refresh=function(t){return this.entry=t,this.entry.children=[],this.pages=!1,this._requestFBPhotoSet(this.getEntryFetchPath(this.entry),this._onFBRespond)},e.prototype.getEntryFetchPath=function(t){var e,r,n;return n={},r=!!~this.options.types.indexOf("image"),r?(e="photos",n={fields:"id,images,name"}):(e="videos/uploaded",n={fields:"id,source,picture,description,format"}),t.album&&(e="albums",n={fields:"id, name, count"}),{path:t.id+"/"+e,options:n}},e.prototype._requestFBPhotoSet=function(t,e){var r,n;return r={},t.constructor===Object&&(n=t,t=n.path,r=n.options),FB.api(t,"GET",r,e)},e.prototype._requestFBPages=function(){return FB.api("me/accounts",this._onFBRespond)},e.prototype._onFBRespond=function(t){var e,r,i,o,s,a,u,l,c;return e=t.data||[],(this.entry.root||this.entry.album)&&(e=e.filter(function(t){return t.count>0||t.perms&&t.category&&null==t.count})),e=this.mapEntries(e),!this.entry.root&&!this.entry.album||(null!=(a=this.entry.children)?a.filter(function(t){return t.my_album}).length:void 0)||(e||(e=[]),r=!!~this.options.types.indexOf("image"),u=r?["Photos",this.entry.path+"/photos"]:["Videos",this.entry.path+"/videos"],i=u[0],s=u[1],"me"===this.entry.id&&(i="My "+i),e.push(new n({service:this,name:i,path:s,id:this.entry.id,type:"folder",my_album:!0}))),!this.entry.root||null==this.permissions.manage_pages||this.permissions.manage_pages||(null!=(l=this.entry.children)?l.filter(function(t){return t.pages}).length:void 0)||(e.push(o=new n({service:this,name:"Pages",path:"accept_pages",type:"button",pages:!0})),o.bind("select",this._auth.bind(this,!0))),this.trigger("refresh",e),null!=(s=null!=(c=t.paging)?c.next:void 0)?this._requestFBPhotoSet(s,this._onFBRespond):this.entry.root&&!this.pages?(this.pages=!0,this._requestFBPages()):void 0},e.prototype.mapEntries=function(t){return t.map(function(t){return function(e){var r;return r={images:e.images,id:e.id,name:e.name},r.type=null!=e.images?"image":e.format?"video":"folder","folder"===r.type&&(r.album=!(!e.perms||!e.category)),r.path=t.entry.path+"/"+e.id,r.preview="image"===r.type?e.images[Math.max(0,e.images.length-4)].source:t.entry.picture,"video"===r.type&&(r.source=e.source),new n(r)}}(this))},e.prototype.preview=function(t){return t.preview},e.prototype.getURL=function(t,e){return e("image"===t.type?t.images[0].source:t.source)},e.prototype._auth=function(t){var e;return null==t&&(t=!0),e=function(t){return function(e){return"connected"===e.status?t.getPermissions():t.trigger("auth",t.authenticated=!1)}}(this),t?FB.login(e,{scope:"user_photos,user_videos,manage_pages"}):FB.getLoginStatus(e)},e.prototype.deauth=function(){return FB.logout(function(t){return function(){return t.trigger("auth",!1)}}(this))},e.prototype.getPermissions=function(){return FB.api("/me/permissions",function(t){return function(e){var r,n;return t.permissions={},e.data.forEach(function(e){return t.permissions[e.permission]="granted"===e.status}),r=l.call(t.options.types,"image")>=0||l.call(t.options.types,"photo")>=0,n=l.call(t.options.types,"video")>=0,(r&&t.permissions.user_photos||n&&t.permissions.user_videos)&&null!=t.permissions.manage_pages?t.trigger("auth",t.authenticated=!0):t.trigger("auth",t.authenticated=!1)}}(this))},e}(o),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l,c=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty,h=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};o=r(8),n=r(9),a="e80667fd637788dde877f5684d496d85",localStorage.getItem("flickrTokenFor")!==a&&localStorage.removeItem("flickrAuthToken"),localStorage.setItem("flickrTokenFor",a),s={key:a,secret:"5a90030ecac5b4fc",sig:"05eb1494ce939ce3098bbcdc7300b5e3",token:null!=(u=localStorage.getItem("flickrAuthToken"))?u.split("::")[0]:void 0,nsid:null!=(l=localStorage.getItem("flickrAuthToken"))?l.split("::")[1]:void 0,perms:"read",rest:"https://api.flickr.com/services/rest/"},i=function(t){function e(){this.call=c(this.call,this),this._onRespond=c(this._onRespond,this),this.listEntries=c(this.listEntries,this),this.doAuth=c(this.doAuth,this),this.refresh=c(this.refresh,this),e.__super__.constructor.apply(this,arguments),this.authenticated=null!=s.token&&null!=s.nsid,h.call(this.options.types,"image")>=0&&this.options.types.push("photo")}return p(e,t),e.prototype.auth_url="https://flickr.com/services/auth/?api_key="+s.key+"&perms="+s.perms+"&api_sig="+s.sig,e.prototype.refresh=function(t){return this.entry=t,this.getMediaList().done(this._onRespond)},e.prototype._auth=function(t){return null==t&&(t=!0),this.trigger("auth",this.authenticated),!this.authenticated&&t&&this.doAuth()},e.prototype.doAuth=function(){if(window.flickrReady=function(t){return function(e){return t.call({api_key:s.key,frob:e,method:"flickr.auth.getToken"}).done(function(e){return e=$(e),s.nsid=e.find("user").attr("nsid"),s.token=e.find("token").text(),localStorage.setItem("flickrAuthToken",s.token+"::"+s.nsid),t.trigger("auth",t.authenticated=!0)})}}(this),null==s.token)return window.open(this.auth_url,"Flickr connect","width=990,height=825")},e.prototype.deauth=function(){return this.trigger("auth",this.authenticated=!1),localStorage.removeItem("flickrAuthToken")},e.prototype.getMediaList=function(){return this.call({api_key:s.key,auth_token:s.token,extras:"media",format:"json",method:"flickr.people.getPhotos",nojsoncallback:1,user_id:s.nsid})},e.prototype.listEntries=function(t){var e,r,i,o,s;for(s=[],e=0,r=t.length;e<r;e++)i=t[e],o=i.media,h.call(this.options.types,o)>=0&&(i.type=this.options.types[0],i.path="/"+i.id,s.push(new n(i)));return s},e.prototype._onRespond=function(t){return t.photos.total?this.trigger("refresh",this.entry.children=this.listEntries(t.photos.photo)):this.trigger("refresh",this.entry.children=[])},e.prototype.call=function(t,e){var r,n;return null==t&&(t={}),t.api_sig=s.secret+function(){var e;e=[];for(r in t)n=t[r],e.push(""+r+n);return e}().join(""),t.api_sig=Crypto.MD5(t.api_sig),$.ajax(s.rest,{data:t})},e.prototype.preview=function(t){return"https://farm"+t.farm+".staticflickr.com/"+t.server+"/"+t.id+"_"+t.secret+"_q.jpg"},e.prototype.getURL=function(t,e){return"image"===t.type?e("https://farm"+t.farm+".staticflickr.com/"+t.server+"/"+t.id+"_"+t.secret+".jpg"):this.getVideoSizes(t).done(function(t){return function(r){return t.videoUrl(r.sizes.size,e)}}(this))},e.prototype.getVideoSizes=function(t){return this.call({api_key:s.key,auth_token:s.token,format:"json",method:"flickr.photos.getSizes",nojsoncallback:1,photo_id:t.id,user_id:s.nsid})},e.prototype.videoUrl=function(t,e){var r,n,i;for(r=0,n=t.length;r<n;r++)if(i=t[r],"Site MP4"===i.label)return e(i.source)},e}(o),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty,d=[].slice;o=r(8),n=r(9),s=r(119),u=r(118),a=r(117),i=function(t){function e(){this.createQuery=l(this.createQuery,this),this.requestDriverFiles=l(this.requestDriverFiles,this),this.getDriverFiles=l(this.getDriverFiles,this),this.getDriverFolders=l(this.getDriverFolders,this),this.checkEmpty=l(this.checkEmpty,this),this.gotResponse=l(this.gotResponse,this),this.getDriverData=l(this.getDriverData,this),this.refresh=l(this.refresh,this),this.onGoglAuth=l(this.onGoglAuth,this),this._auth=l(this._auth,this),e.__super__.constructor.apply(this,arguments),this.title="Google Drive",~this.options.types.indexOf("image")&&(this.type="image"),~this.options.types.indexOf("video")&&(this.type="video"),~this.options.types.indexOf("audio")&&(this.type="audio"),this.root.id="root",u.then(function(t){return function(){return gapi.auth2.getAuthInstance().isSignedIn.listen(t.onGoglAuth)}}(this))}return c(e,t),e.prototype.scope="https://www.googleapis.com/auth/drive.readonly",e.prototype._auth=function(t){return u.then(function(t){return function(){return gapi.auth2.getAuthInstance().isSignedIn.get()?t.trigger("auth",!0):gapi.auth2.getAuthInstance().signIn()}}(this))},e.prototype.onGoglAuth=function(t){return t?this.trigger("auth",!0):this.trigger("auth",!1)},e.prototype.refresh=function(t){var e;return this.entry=t,e=function(e){return function(){return e.gotResponse.apply(e,[t.id].concat(d.call(arguments)))}}(this),this.getDriverData(t,e)},e.prototype.getDriverData=function(t,e){return this.getDriverFolders(t.id,e).then(function(r){return function(){return r.getDriverFiles(t.id,r.type,e).then(e.bind(r,[],!0))}}(this))},e.prototype.gotResponse=function(t,e,r){var i,o;if(this.entry.id===t)return o=this,i=(e.files||[]).map(function(t){return function(e){var r,u,l;if(e)return r=!e.permissions.filter(function(t){return"anyone"===t.id||"anyoneWithLink"===t.id}).length,l=e.mimeType.match(/image|video|folder|audio/)[0],new n({id:e.id,type:l,path:t.entry.path+"/"+e.name,name:e.name,preview:null!=(u=e.thumbnailLink)?u.replace(/s\d+$/,"s250"):void 0,url:e.webContentLink,parent:e.parents[0].id,isPrivate:r,order:.5*("folder"===l)+parseFloat("0."+new Date(e.createdDate).getTime()),webLink:e.webViewLink,onActivate:function(){return!this.isPrivate||(s.pop($("body")),s.off("confirmed"),s.bind("confirmed",function(t){return function(){return gapi.client.drive.permissions.create({resource:{type:"anyone",role:"reader"},fileId:e.id,fields:"id"}).execute(function(r){return r.error?(console.error(r.error),alert("An error has occurred. The permissions have not been modified.")):(a.clear(e.parents[0]),t.isPrivate=!1,o.trigger("refresh",i,{hard:!0}))})}}(this)),!this.isPrivate)}})}}(this)).filter(function(t){return!(!t||!t.id)}).sort(function(t,e){return-(t.order-e.order)}),i.length&&this.trigger("refresh",i),r&&!this.entry.children.length?this.trigger("refresh",[]):void 0},e.prototype.checkEmpty=function(){return this.trigger("refresh",[])},e.prototype.getURL=function(t,e){return e(t.url)},e.prototype.preview=function(t){return t.preview},e.prototype.deauth=function(){return this.trigger("auth",this.authenticated=!1)},e.prototype.getDriverFolders=function(t,e){return this.getDriverFiles(t,"folder",e)},e.prototype.getDriverFiles=function(t,e,r){var n,i;return n=new $.Deferred,(i=function(o){return function(s){return o.requestDriverFiles(t,e,s).then(function(e){var s;return r(e),e.nextPageToken?void(o.entry.id===t&&(s=o.entry.children.slice(-1)[0])&&(s.onShow=function(){return i(e.nextPageToken),this.onShow=function(){}}.bind(s))):n.resolve()})}}(this))(null),n.promise()},e.prototype.requestDriverFiles=function(t,e,r){var n,i;return i=new $.Deferred,(n=a.get(t,r||e))&&i.resolve(n),a.check(t,r||e)||gapi.client.drive.files.list({q:this.createQuery(t,e),fields:"nextPageToken, files(id, name, mimeType, thumbnailLink, createdTime, permissions, parents, webContentLink, webViewLink)",pageToken:r}).execute(function(n){return function(n){return null!=n.result&&delete n.result,a.set(t,r||e,n),i.resolve(n)}}()),i.promise()},e.prototype.createQuery=function(t,e,r){var n,i;return n="mimeType contains '"+e+"/'","folder"===e&&(n="mimeType='application/vnd.google-apps.folder'"),i="trashed=false and ("+n+") and '"+t+"' in parents",r&&(i+=" and modifiedDate > '"+r+"'"),i},e}(o),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;o=r(8),u="https://widgetic.com/services/instagram",n={client_id:"542808610040105",client_secret:"0a88504381f577dbbef400d4232a4258",redirect_uri:u+"/auth_token",scope:"user_profile,user_media",response_type:"code",api_url:u,demo:"IGQVJVNUw5cHB5cUFiZATFxVmgyeWtSVFJjTDYyRmNnWDZAJZA3llVXREa1BsS1EtVGJ2UEdlbHJNbDV1UUQ2YkVSZA3YwS1dPWXJzYXFGQzdZAMlhBLTBWWWNkTVNHTGNDLW10dkdhNW0wMDVqMkhZAWEhqbgZDZD",token_storage:"redis",encodeToken:!1,redis_db:0,redis_prefix:"nstgrm:",port:8082},s=window.INSTAGRAM_SERVICE_CONFIG||n;try{s.token=localStorage.getItem("instagramAuthToken")}catch(t){}console.log("Editor Instagram Service current user's token:",s.token),a="https://api.instagram.com/oauth/authorize/?client_id="+s.client_id+"&redirect_uri="+s.redirect_uri+"&response_type="+s.response_type+"&scope="+s.scope,i=function(t){function e(){this.refresh=l(this.refresh,this),e.__super__.constructor.apply(this,arguments),this.user={},this.authenticated=!1}return c(e,t),e.browser="browser/controller/instagram",e.prototype.getToken=function(){return s.token},e.prototype.getUser=function(t){var e;return e=s.api_url+"/me",$.ajax({url:e,type:"GET",dataType:"json",headers:{"X-Token":t}})},e.prototype._auth=function(t){return null==t&&(t=!0),console.log("Editor Instagram Service _auth method:",t,s.token),null!=s.token&&this.getUser(s.token).then(function(t){return function(e){return console.log("Editor Instagram Service getUser result:",e),t.user=e,t.trigger("auth",t.authenticated=!0)}}(this)).catch(function(t){return function(){return console.log("Editor Instagram Service getUser error:",error),t.deauth()}}(this)),!this.authenticated&&t&&this.showAuthPopup()},e.prototype.showAuthPopup=function(){return window.instagramReady=function(t){return function(e,r){s.token=e;try{localStorage.setItem("instagramAuthToken",s.token=e)}catch(t){}return t.user=r,t.trigger("auth",t.authenticated=!0)}}(this),window.open(a,"Instagram connect","width=450,height=600")},e.prototype.refresh=function(t){return this.entry=t,this.trigger("refresh",[])},e.prototype.deauth=function(){this.authenticated=!1,s.token=null,this.trigger("auth",this.authenticated);try{return localStorage.removeItem("instagramAuthToken")}catch(t){}},e}(o),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l,c,p,d=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty,g=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};s=r(8),n=r(9),c="https://widgetic.com/services/instagram/",i={client_id:"542808610040105",client_secret:"0a88504381f577dbbef400d4232a4258",redirect_uri:c+"auth_token",scope:"user_profile,user_media",response_type:"code",api_url:c,demo:"IGQVJVNUw5cHB5cUFiZATFxVmgyeWtSVFJjTDYyRmNnWDZAJZA3llVXREa1BsS1EtVGJ2UEdlbHJNbDV1UUQ2YkVSZA3YwS1dPWXJzYXFGQzdZAMlhBLTBWWWNkTVNHTGNDLW10dkdhNW0wMDVqMkhZAWEhqbgZDZD",token_storage:"redis",encodeToken:!1,redis_db:0,redis_prefix:"nstgrm:",port:8082},a=window.INSTAGRAM_SERVICE_CONFIG||i;try{a.token=localStorage.getItem("instagramAuthToken")}catch(t){}u="https://api.instagram.com/oauth/authorize/?client_id="+a.client_id+"&redirect_uri="+a.redirect_uri+"&response_type="+a.response_type+"&scope="+a.scope,p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],l={_cache:{},def:function(){return new $.Deferred},has:function(t){return null!=l._cache[t]},get:function(t){return l.def().resolve(l._cache[t]).promise()},set:function(t,e){return l._cache[t]=e,l}},o=function(t){function e(){this.listEntries=d(this.listEntries,this),this.makeFolders=d(this.makeFolders,this),this._onRespond=d(this._onRespond,this),this.fetchFotos=d(this.fetchFotos,this),this.refresh=d(this.refresh,this),e.__super__.constructor.apply(this,arguments),this.user={},this.authenticated=!1,this.ajaxReqs=[]}return h(e,t),e.prototype.getUser=function(t){var e;return e=a.api_url+"me",$.ajax({url:e,type:"GET",dataType:"json",headers:{"X-Token":t}})},e.prototype._auth=function(t){return null==t&&(t=!0),null!=a.token&&this.getUser(a.token).then(function(t){return function(e){return t.user=e,t.trigger("auth",t.authenticated=!0)}}(this)).catch(function(t){return function(e){return t.deauth()}}(this)),!this.authenticated&&t&&this.showAuthPopup()},e.prototype.showAuthPopup=function(){return window.instagramReady=function(t){return function(e,r){a.token=e;try{localStorage.setItem("instagramAuthToken",a.token=e)}catch(t){}return t.user=r,t.trigger("auth",t.authenticated=!0)}}(this),window.open(u,"Instagram connect","width=450,height=600")},e.prototype.deauth=function(){this.authenticated=!1,a.token=null,this.trigger("auth",this.authenticated);try{return localStorage.removeItem("instagramAuthToken")}catch(t){}},e.prototype.refresh=function(t){return this.entry=t,this.entry.children=[],this.children={},this.fetchFotos().done(this._onRespond)},e.prototype.fetchFotos=function(t){var e;return null==t&&(t=""),e=a.api_url+"?num=999&q="+this.user.id+"&max_id="+t,this.ajaxReqs[t]=$.ajax({url:e,type:"GET",dataType:"json",headers:{"X-Token":a.token},success:function(e){return function(e){return l.set(t,e)}}(),fail:function(t){return function(t){return console.log("Fetch photos failed:",t)}}()}),l.has(t)?l.get(t):this.ajaxReqs[t]},e.prototype._onRespond=function(t){var e,r,n;if(e=t.media.filter(function(t){return function(e){var r;return r=e.type=e.media_type.toLowerCase(),g.call(t.options.types,r)>=0}}(this)),e=this.listEntries(e),this.entry.children=this.entry.children.concat(e),this.trigger("refresh",e),r=null!=(n=t.pagination)?n.next_max_id:void 0)return this.fetchFotos(r).done(this._onRespond)},e.prototype.makeFolders=function(t){var e,r,i,o,s,a,u,l,c,d;for(s={},u=0,l=t.length;u<l;u++)a=t[u],e=new Date(a.timestamp),o=p[e.getMonth()]+" "+e.getFullYear(),function(){var t,e,n,i;for(n=this.entry.children,i=[],t=0,e=n.length;t<e;t++)r=n[t],r.name===o&&i.push(r);return i}.call(this).length||(s[o]=new n({service:this,name:o,path:"/"+o,type:"folder",year:e.getFullYear(),month:e.getMonth()}));d=[];for(c in s)i=s[c],d.push(i);return d},e.prototype.listEntries=function(t){var e,r,i,o,s;for(e=[],i=0,o=t.length;i<o;i++)r=t[i],s={id:r.id,type:r.type,media_url:r.media_url,thumbnail_url:r.thumbnail_url,caption:r.caption,images:{image:r.media_url,thumbnail:r.thumbnail_url}},null!=r.videos&&(s.videos=r.videos),s.path=this.entry.path+"/"+r.id,this.children[r.id]=new n(s),e.push(this.children[r.id]);return e},e.prototype.preview=function(t){return t.images.image||t.images.thumbnail},e.prototype.getURL=function(t,e){return e(t[t.type+"s"].image)},e}(s),t.exports=o},function(t,e,r){var n,i,o,s,a,u,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;o=r(8),n=r(9),u="https://widgetic.com/wservices/soundcloud/",i=r(171),a={api_url:"https://api.soundcloud.com",client_id:"aed0aa63baf747a83ad0b6b246acddca",redirect_uri:"https://widgetic.com/connect/soundcloud",tracks_url:u+"tracks/",grant_type:"refresh_token"},i.initialize(a),i.client_id=a.client_id,i.api_url=a.api_url,i.tracks_url=a.tracks_url;try{i.auth_token=localStorage.getItem("soundcloudAuthToken")}catch(t){}try{i.userId=localStorage.getItem("soundcloudUserId")}catch(t){}s=function(t){function e(){this.newEntry=l(this.newEntry,this),this.fetchTracks=l(this.fetchTracks,this),this.fetchPlaylists=l(this.fetchPlaylists,this),this.checkAuth=l(this.checkAuth,this),this.auth=l(this.auth,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.SCGet=function(t){var e;return e=""+i.api_url+t,$.ajax({url:e,type:"GET",dataType:"json",headers:{Authorization:"OAuth "+i.auth_token}})},e.prototype.auth=function(t){return!i.userId&&t?this.showAuthPopup():this.checkAuth()},e.prototype.showAuthPopup=function(){return i.connect().then(function(t){return function(e){i.auth_token=e.oauth_token;try{localStorage.setItem("soundcloudAuthToken",i.auth_token)}catch(t){}return t.SCGet("/me").then(function(e){i.userId=e.id;try{localStorage.setItem("soundcloudUserId",i.userId)}catch(t){}return t.checkAuth()}).catch(function(e){return console.log("Editor getUser error:",e),t.deauth()})}}(this)).catch(function(t){return function(e){return console.log("SC Connect Error: "+e.message),t.deauth()}}(this))},e.prototype.checkAuth=function(){return this.trigger("auth",null!==i.userId)},e.prototype.deauth=function(){i.auth_token=null;try{localStorage.removeItem("soundcloudAuthToken")}catch(t){}i.userId=null;try{localStorage.removeItem("soundcloudUserId")}catch(t){}return this.checkAuth()},e.prototype.refresh=function(t){return this.currentFolder=t,this.currentFolder.root?this.fetchPlaylists():this.fetchTracks(this.currentFolder.id)},e.prototype.fetchPlaylists=function(){return this.SCGet("/users/"+i.userId+"/playlists").then(function(t){return function(e){return t.trigger("refresh",e.map(t.newEntry.bind(t,"folder")),{root:!0}),t.fetchTracks(t.currentFolder.id)}}(this)).catch(function(t){return function(t){return console.log("Fetch Playlist error: "+t.message)}}())},e.prototype.fetchTracks=function(t){var e;return e=t?"/playlists/"+t:"/users/"+i.userId+"/tracks",e+="?access=playable",this.SCGet(e).then(function(e){return function(r){var n;return n=r,r.tracks&&(n=r.tracks),e.trigger("refresh",n.map(function(t){return e.newEntry("audio",t)}),{root:!t})}}(this)).catch(function(t){return function(t){return console.log("Fetch Tracks error: "+t.message)}}())},e.prototype.newEntry=function(t,e,r){var i,o,s,a,u,l,c;return r?u=r+"/":(u=this.currentFolder.path,this.currentFolder.root||(u+="/")),u+=e.id,"folder"===t&&(o=e.tracks),i=e.artwork_url,a=e.id,s=e.duration,c=e.title,l=e.stream_url,new n($.extend({},{service:this,type:t,path:u,artwork_url:i,id:a,children:o,duration:s/1e3,title:c,stream_url:l,name:e.title}))},e.prototype.getURL=function(t,e){return e(i.tracks_url+"?id="+t.id+"&atoken="+i.auth_token)},e}(o),t.exports=s},function(t,e,r){!function(e,r){t.exports=r()}(0,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){(function(e){"use strict";var n=r(4),i=r(8),o=r(3),s=r(9),a=r(2).Promise,u=r(16),l=r(17);t.exports=e.SC={initialize:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];o.set("oauth_token",t.oauth_token),o.set("client_id",t.client_id),o.set("redirect_uri",t.redirect_uri),o.set("baseURL",t.baseURL),o.set("connectURL",t.connectURL)},get:function(t,e){return n.request("GET",t,e)},post:function(t,e){return n.request("POST",t,e)},put:function(t,e){return n.request("PUT",t,e)},delete:function(t){return n.request("DELETE",t)},upload:function(t){return n.upload(t)},connect:function(t){return s(t)},isConnected:function(){return void 0!==o.get("oauth_token")},oEmbed:function(t,e){return n.oEmbed(t,e)},resolve:function(t){return n.resolve(t)},Recorder:u,Promise:a,stream:function(t,e){return l(t,e)},connectCallback:function(){i.notifyDialog(this.location)}}}).call(e,function(){return this}())},function(t,e){t.exports=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){t.exports={SCAudio:r(1),SCAudioControllerHTML5Player:r(3),SCAudioControllerHLSMSEPlayer:r(5),SCAudioPublicApiStreamURLRetriever:r(12),MaestroCore:r(2),MaestroLoaders:r(11)}},function(t,e,r){!function(e,n){t.exports=function(t){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=99)}([function(e,r){e.exports=t},function(t,e,r){"use strict";var n=r(5);t.exports=function(t){if(!n(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,r){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,r){"use strict";t.exports=r(55)()?Symbol:r(54)},function(t,e,r){"use strict";var n,i=r(11),o=r(18),s=r(59),a=r(17);n=t.exports=function(t,e){var r,n,s,u,l;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],null==t?(r=s=!0,n=!1):(r=a.call(t,"c"),n=a.call(t,"e"),s=a.call(t,"w")),l={value:e,configurable:r,enumerable:n,writable:s},u?i(o(u),l):l},n.gs=function(t,e,r){var n,u,l,c;return"string"!=typeof t?(l=r,r=e,e=t,t=null):l=arguments[3],null==e?e=void 0:s(e)?null==r?r=void 0:s(r)||(l=r,r=void 0):(l=e,e=r=void 0),null==t?(n=!0,u=!1):(n=a.call(t,"c"),u=a.call(t,"e")),c={get:e,set:r,configurable:n,enumerable:u},l?i(o(l),c):c}},function(t,e,r){"use strict";var n=r(22)();t.exports=function(t){return t!==n&&null!==t}},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=function(t){function e(e){return t.call(this,e||"There was no format available that a player was able to play.")||this}return n(e,t),e.prototype.getCode=function(){return"SCAUDIO.NOT_SUPPORTED_ERROR"},e}(i.errors.PlayerFatalError);e.NotSupportedError=o},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call("");t.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===i)||!1}},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call(function(){return arguments}());t.exports=function(t){return n.call(t)===i}},function(t,e,r){"use strict";t.exports=r(20)()?Object.setPrototypeOf:r(19)},function(t,e,r){"use strict";var n,i=r(23),o=r(11),s=r(2),a=r(1),u=r(4),l=r(47),c=r(3),p=Object.defineProperty,d=Object.defineProperties;t.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");d(this,{__list__:u("w",a(t)),__context__:u("w",e),__nextIndex__:u("w",0)}),e&&(s(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,d(n.prototype,o({_next:u(function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__<this.__list__.length?this.__nextIndex__++:void this._unBind()}),next:u(function(){return this._createResult(this._next())}),_createResult:u(function(t){return void 0===t?{done:!0,value:void 0}:{done:!1,value:this._resolve(t)}}),_resolve:u(function(t){return this.__list__[t]}),_unBind:u(function(){this.__list__=null,delete this.__redo__,this.__context__&&(this.__context__.off("_add",this._onAdd),this.__context__.off("_delete",this._onDelete),this.__context__.off("_clear",this._onClear),this.__context__=null)}),toString:u(function(){return"[object "+(this[c.toStringTag]||"Object")+"]"})},l({_onAdd:u(function(t){if(!(t>=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void p(this,"__redo__",u("c",[t]));this.__redo__.forEach(function(e,r){e>=t&&(this.__redo__[r]=++e)},this),this.__redo__.push(t)}}),_onDelete:u(function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(e=this.__redo__.indexOf(t),-1!==e&&this.__redo__.splice(e,1),this.__redo__.forEach(function(e,r){e>t&&(this.__redo__[r]=--e)},this)))}),_onClear:u(function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0})}))),p(n.prototype,c.iterator,u(function(){return this}))},function(t,e,r){"use strict";t.exports=r(64)()?Object.assign:r(63)},function(t,e,r){"use strict";function n(){switch(window.document.hidden){case!0:return"background";case!1:return"foreground";default:return}}Object.defineProperty(e,"__esModule",{value:!0}),e.getAppState=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(97),i=r(96),o=r(95),s=r(94),a=r(93),u=r(92),l=r(91),c=r(90),p=r(89),d=r(88);e.renditions={httpMp3:n.httpMp3,httpAACHQ:d.httpAACHQ,hlsMp3:i.hlsMp3,encryptedHlsMp3:o.encryptedHlsMp3,hlsOpus:c.hlsOpus,encryptedHlsOpus:p.encryptedHlsOpus,hlsAACHQ:s.hlsAACHQ,encryptedHlsAACHQ:a.encryptedHlsAACHQ,apiMobile:u.apiMobile,maestroChromecast:l.maestroChromecast},e.allRenditions=Object.keys(e.renditions).map(function(t){return e.renditions[t]})},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(6),o=function(t){function e(){return t.call(this,"Failed to retrieve stream url.")||this}return n(e,t),e.prototype.getCode=function(){return"SCAUDIO.FAILED_RETRIEVING_URL"},e}(i.NotSupportedError);e.FailedRetrievingUrlError=o},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(6),o=function(t){function e(){return t.call(this,"There were no stream URLs.")||this}return n(e,t),e.prototype.getCode=function(){return"SCAUDIO.NO_STREAMS"},e}(i.NotSupportedError);e.NoStreamsError=o},function(t,e,r){"use strict";var n=r(51);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},function(t,e,r){"use strict";t.exports=r(58)()?String.prototype.contains:r(57)},function(t,e,r){"use strict";var n=r(5),i=Array.prototype.forEach,o=Object.create,s=function(t,e){var r;for(r in t)e[r]=t[r]};t.exports=function(t){var e=o(null);return i.call(arguments,function(t){n(t)&&s(Object(t),e)}),e}},function(t,e,r){"use strict";var n,i=r(66),o=r(1),s=Object.prototype.isPrototypeOf,a=Object.defineProperty,u={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(t,e){if(o(t),null===e||i(e))return t;throw new TypeError("Prototype must be null or an object")},t.exports=function(t){var e,r;return t?(2===t.level?t.set?(r=t.set,e=function(t,e){return r.call(n(t,e),e),t}):e=function(t,e){return n(t,e).__proto__=e,t}:e=function t(e,r){var i;return n(e,r),i=s.call(t.nullPolyfill,e),i&&delete t.nullPolyfill.__proto__,null===r&&(r=t.nullPolyfill),e.__proto__=r,i&&a(t.nullPolyfill,"__proto__",u),e},Object.defineProperty(e,"level",{configurable:!1,enumerable:!1,writable:!1,value:t.level})):null}(function(){var t,e=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{t=n.set,t.call(e,r)}catch(t){}if(Object.getPrototypeOf(e)===r)return{set:t,level:2}}return e.__proto__=r,Object.getPrototypeOf(e)===r?{level:2}:(e={},e.__proto__=r,Object.getPrototypeOf(e)===r&&{level:1})}()),r(65)},function(t,e,r){"use strict";var n=Object.create,i=Object.getPrototypeOf,o={};t.exports=function(){var t=Object.setPrototypeOf,e=arguments[0]||n;return"function"==typeof t&&i(t(e(null),o))===o}},function(t,e,r){"use strict";var n=r(70),i=Math.max;t.exports=function(t){return i(0,n(t))}},function(t,e,r){"use strict";t.exports=function(){}},function(t,e,r){"use strict";var n=r(1);t.exports=function(){return n(this).length=0,this}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.notSupportedError=new Error("Not supported.");var n=function(){function t(){this.supportsVolumeAutomation=!0,this.syncConfig={}}return t}();e.BaseController=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t}();e.BaseStreamUrlRetriever=n},function(t,e,r){"use strict";function n(t){return new o({startPos:0,endPos:t,startLevel:0,endLevel:1,fromEnd:!1})}function i(t){return new o({startPos:t,endPos:0,startLevel:1,endLevel:0,fromEnd:!0})}Object.defineProperty(e,"__esModule",{value:!0}),e.buildFadeIn=n,e.buildFadeOut=i;var o=function(){function t(t){var e=t.startPos,r=t.endPos,n=t.startLevel,i=t.endLevel,o=t.fromEnd,s=void 0!==o&&o;if(e<0)throw new Error("startPos invalid.");if(r<0||!s&&r<e||s&&e<r)throw new Error("endPos invalid.");if(n<0||n>1)throw new Error("startLevel invalid.");if(i<0||i>1)throw new Error("endLevel invalid.");this._startPos=e,this._endPos=r,this._startLevel=n,this._endLevel=i,this._fromEnd=s}return t.prototype.calculate=function(t,e){var r=this._fromEnd?e-500-this._startPos:this._startPos,n=this._fromEnd?e-500-this._endPos:this._endPos;if(t<r)return{level:this._startLevel,nextCalculatePosition:r-t};if(t<=n){var i=(t-r)/(n-r),o=Math.cos(i*Math.PI)/-2+.5;return{level:this._startLevel+(this._endLevel-this._startLevel)*o,nextCalculatePosition:t}}return{level:this._endLevel,nextCalculatePosition:1/0}},t}();e.Fade=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(6),i=r(15),o=r(14);!function(t){t.NotSupportedError=n.NotSupportedError,t.NoStreamsError=i.NoStreamsError,t.FailedRetrievingUrlError=o.FailedRetrievingUrlError}(e.errors||(e.errors={}))},function(t,e,r){"use strict";function n(t){switch(t){case i.SQ:return i.SQ;case i.HQ:return i.HQ}return null}Object.defineProperty(e,"__esModule",{value:!0});var i;!function(t){t.SQ="sq",t.HQ="hq"}(i=e.Quality||(e.Quality={})),e.resolveQuality=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=function(){function t(t){var e=this;this._player=t,this._onConnectionRequired=new n.eventDispatcher.EventDispatcher,this._onConnectionRecovered=new n.eventDispatcher.EventDispatcher,this._connectionRequired=!1,this._connectionLossTimer=null,this.onConnectionRequired=this._onConnectionRequired.getHandle(),this.onConnectionRecovered=this._onConnectionRecovered.getHandle();var r=function(){return e._calculateIfConnectionRequired()};window.addEventListener("online",r),window.addEventListener("offline",r),this._calculateIfConnectionRequired(),t.onChange.subscribe(function(n){var i=n.loading;n.dead&&null!==e._connectionLossTimer&&(window.clearTimeout(e._connectionLossTimer),window.removeEventListener("online",r),window.removeEventListener("offline",r)),t.isDead()||void 0===i||e._calculateIfConnectionRequired()})}return t.prototype.isConnectionRequired=function(){return this._connectionRequired},t.prototype._calculateIfConnectionRequired=function(){var t=this;this._player.isLoading()&&"navigator"in window&&!window.navigator.onLine?null===this._connectionLossTimer&&(this._connectionLossTimer=window.setTimeout(function(){t._connectionLossTimer=null,t._connectionRequired=!0,t._onConnectionRequired.dispatch(void 0)},1500)):this._connectionRequired?(this._connectionRequired=!1,this._onConnectionRecovered.dispatch(void 0)):null!==this._connectionLossTimer&&(window.clearTimeout(this._connectionLossTimer),this._connectionLossTimer=null)},t}();e.ConnectionRequiredHelper=i},function(t,e,r){"use strict";function n(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="",r=0;r<20;r++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}Object.defineProperty(e,"__esModule",{value:!0}),e.generateLogId=n},function(t,e,r){"use strict";function n(t,e){return void 0!==t?t:e}function i(t){if(!(t.streamUrlRetriever instanceof o.BaseStreamUrlRetriever))throw new Error("StreamUrlRetriever invalid.");if(void 0!==t.duration&&("number"!=typeof t.duration||t.duration<0))throw new Error("duration invalid.");if(void 0!==t.getURLOpts&&"object"!=typeof t.getURLOpts)throw new Error("getURLOpts invalid.");if(void 0!==t.preloadingEnabled&&"boolean"!=typeof t.preloadingEnabled)throw new Error("preloadingEnabled invalid.");if(void 0!==t.fadeOnPauseAndPlay&&"boolean"!=typeof t.fadeOnPauseAndPlay)throw new Error("fadeOnPauseAndPlay invalid.");if(void 0!==t.fadeOnSeek&&"boolean"!=typeof t.fadeOnSeek)throw new Error("fadeOnSeek invalid.");if(void 0!==t.mediaSessionEnabled&&"boolean"!=typeof t.mediaSessionEnabled)throw new Error("mediaSessionEnabled invalid.");if(void 0!==t.pausedMaxBufferLength&&("number"!=typeof t.pausedMaxBufferLength||t.pausedMaxBufferLength<0))throw new Error("pausedMaxBufferLength invalid.");if(void 0!==t.playingMaxBufferLength&&("number"!=typeof t.playingMaxBufferLength||t.playingMaxBufferLength<0))throw new Error("playingMaxBufferLength invalid.");if(void 0!==t.logger&&"function"!=typeof t.logger&&"object"!=typeof t.logger)throw new Error("logger invalid.");if(void 0!==t.audioReporter&&"function"!=typeof t.audioReporter)throw new Error("audioReporter invalid.");if(void 0!==t.audioCheckpointInterval&&("number"!=typeof t.audioCheckpointInterval||t.audioCheckpointInterval<0))throw new Error("audioCheckpointInterval invalid.");if(void 0!==t.audioPerformanceReporter&&"function"!=typeof t.audioPerformanceReporter)throw new Error("audioPerformanceReporter invalid.");if(void 0!==t.errorReporter&&"function"!=typeof t.errorReporter)throw new Error("errorReporter invalid.");if(void 0!==t.urlProviderRetryDelayCalculator&&"function"!=typeof t.urlProviderRetryDelayCalculator)throw new Error("urlProviderRetryDelayCalculator invalid.");return{controllers:t.controllers,streamUrlRetriever:t.streamUrlRetriever,getURLOpts:n(t.getURLOpts,{}),preloadingEnabled:n(t.preloadingEnabled,!1),pausedMaxBufferLength:n(t.pausedMaxBufferLength,2e3),playingMaxBufferLength:n(t.playingMaxBufferLength,9e4),fadeOnPauseAndPlay:n(t.fadeOnPauseAndPlay,!1),fadeOnSeek:n(t.fadeOnSeek,!1),audioCheckpointInterval:n(t.audioCheckpointInterval,3e4),urlProviderRetryDelayCalculator:n(t.urlProviderRetryDelayCalculator,s.helpers.retry.buildExponentialDelayCalculator()),streamUrlsExpire:n(t.streamUrlsExpire,!0),fetchEnabled:n(t.fetchEnabled,!0),duration:t.duration,audioReporter:t.audioReporter,audioPerformanceReporter:t.audioPerformanceReporter,errorReporter:t.errorReporter}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(25),s=r(0);e.validatePlayerDependencies=i},function(t,e,r){"use strict";function n(t){var r=t.streamUrlRetriever,n=t.getURLOpts,s=t.logger,a=t.urlProviderRetryDelayCalculator;return new i.helpers.abortableJob.AbortableJob(function(){var t=i.helpers.deferred.buildDeferred(),u=i.helpers.retry.retry(a,function(e){var a=e.scheduleRetry,u=r.getUrl(n);return s.debug("Retrieving a URL..."),u.onCompletion(function(e){e?e.rendition&&o.allRenditions.indexOf(e.rendition)<0?(s.warn("Unknown rendition. Skipping...",e.rendition),r.excludeRendition(e.rendition),a()):!e.success&&e.error.isTransient()?(s.warn("Transient error retrieving url.",e.error),a()):t.resolve(e):(s.debug("No URL provided."),t.resolve(null))}),u.onError(function(e){e!==i.helpers.abortableJob.abortedError&&s.error("Error retrieving URL.",e),t.reject(e)}),{onCancel:function(){return u.abort()}}},{onNoMoreRetries:function(){return t.reject(e.NoMoreAttemptsError)}}).cancel;return{result:t.promise,abort:function(){return u()}}}).run()}Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=r(13);e.NoMoreAttemptsError=new Error("No more attempts to retrieve URL."),e.retrieveUrl=n},function(t,e,r){"use strict";function n(t,e){var r=t.getMemoryCacheController();r&&r.setMaxCacheSize(e)}Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=function(){function t(t,e){this._maxCacheSize=t,this._players=[],this._updateTimer=null,this._logger=i.logger.prefixLogger(e,"CacheManager"),this._logger.debug("Initialized with cache size "+t+" bytes.")}return t.prototype.setCacheSize=function(t){this._maxCacheSize!==t&&(this._logger.debug("Updating cache size to "+t+" bytes."),this._maxCacheSize=t,this._update())},t.prototype.addPlayer=function(t){var e=this;if(this._logger.debug("Adding player to cache manager."),t.isDead())return void this._logger.debug("Player was dead.");var r=this._players;t.onChange.subscribe(function(n){var i=n.playing;!0===n.dead?(e._logger.debug("Removing player that became dead."),r.splice(r.indexOf(t),1),e._update()):!0===i?(e._logger.debug("Updating because player started playing."),r.splice(r.indexOf(t),1),r.unshift(t),e._update()):!1===i&&(e._logger.debug("Updating because player became paused."),e._update())}),t.isPlaying()?r.unshift(t):r.push(t),this._update()},t.prototype._update=function(){var t=this;if(this._updateTimer&&(window.clearTimeout(this._updateTimer),this._updateTimer=null),0===this._players.length)return void this._logger.debug("There are no longer any players to manage.");var e=this._players.reduce(function(t,e){return e.isPlaying()?t.playingPlayers.push(e):t.pausedPlayers.push(e),t},{playingPlayers:[],pausedPlayers:[]}),r=e.playingPlayers,i=e.pausedPlayers,o=r.reduce(function(t,e){return t+(e.getMemoryCacheUsage()||0)},0),s=i.reduce(function(t,e){return t+(e.getMemoryCacheUsage()||0)},0);if(o>this._maxCacheSize){this._logger.debug("All playing players are using more than the max cache size. Cleaning...",o,this._maxCacheSize);var a=this._maxCacheSize/r.length;r.forEach(function(t){return n(t,a)}),i.forEach(function(t){return n(t,0)})}else this._logger.debug("Recalculating cache sizes...",o+s,this._maxCacheSize),r.concat(i).reduce(function(e,r){return n(r,Math.max(0,t._maxCacheSize-e)),e+(r.getMemoryCacheUsage()||0)},0);this._updateTimer=window.setTimeout(function(){return t._update()},2e4)},t}();e.CacheManager=o},function(t,e,r){"use strict";t.exports=function(){return"undefined"!=typeof Map&&"[object Map]"===Object.prototype.toString.call(new Map)}()},function(t,e,r){"use strict";var n=Array.prototype.forEach,i=Object.create;t.exports=function(t){var e=i(null);return n.call(arguments,function(t){e[t]=!0}),e}},function(t,e,r){"use strict";t.exports=r(35)("key","value","key+value")},function(t,e,r){"use strict";var n,i=r(9),o=r(4),s=r(10),a=r(3).toStringTag,u=r(36),l=Object.defineProperties,c=s.prototype._unBind;n=t.exports=function(t,e){return this instanceof n?(s.call(this,t.__mapKeysData__,t),e&&u[e]||(e="key+value"),void l(this,{__kind__:o("",e),__values__:o("w",t.__mapValuesData__)})):new n(t,e)},i&&i(n,s),n.prototype=Object.create(s.prototype,{constructor:o(n),_resolve:o(function(t){return"value"===this.__kind__?this.__values__[t]:"key"===this.__kind__?this.__list__[t]:[this.__list__[t],this.__values__[t]]}),_unBind:o(function(){this.__values__=null,c.call(this)}),toString:o(function(){return"[object Map Iterator]"})}),Object.defineProperty(n.prototype,a,o("c","Map Iterator"))},function(t,e,r){"use strict";var n,i=r(9),o=r(4),s=r(3),a=r(10),u=Object.defineProperty;n=t.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),a.call(this,t),u(this,"__length__",o("",t.length))},i&&i(n,a),delete n.prototype.constructor,n.prototype=Object.create(a.prototype,{_next:o(function(){if(this.__list__)return this.__nextIndex__<this.__length__?this.__nextIndex__++:void this._unBind()}),_resolve:o(function(t){var e,r=this.__list__[t];return this.__nextIndex__===this.__length__?r:(e=r.charCodeAt(0),e>=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,s.toStringTag,o("c","String Iterator"))},function(t,e,r){"use strict";var n=r(2),i=r(1),o=Function.prototype.bind,s=Function.prototype.call,a=Object.keys,u=Object.prototype.propertyIsEnumerable;t.exports=function(t,e){return function(r,l){var c,p=arguments[2],d=arguments[3];return r=Object(i(r)),n(l),c=a(r),d&&c.sort("function"==typeof d?o.call(d,r):void 0),"function"!=typeof t&&(t=c[t]),s.call(t,c,function(t,n){return u.call(r,t)?s.call(l,p,r[t],t,r,n):e})}}},function(t,e,r){"use strict";t.exports=r(39)("forEach")},function(t,e,r){"use strict";var n=r(2),i=r(40),o=Function.prototype.call;t.exports=function(t,e){var r={},s=arguments[2];return n(e),i(t,function(t,n,i,a){r[n]=o.call(e,s,t,n,i,a)}),r}},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call(r(22));t.exports=function(t){return"function"==typeof t&&n.call(t)===i}},function(t,e,r){"use strict";var n=r(3).iterator,i=r(8),o=r(42),s=r(21),a=r(2),u=r(1),l=r(5),c=r(7),p=Array.isArray,d=Function.prototype.call,h={configurable:!0,enumerable:!0,writable:!0,value:null},f=Object.defineProperty;t.exports=function(t){var e,r,g,_,y,v,m,b,w,E,P=arguments[1],S=arguments[2];if(t=Object(u(t)),l(P)&&a(P),this&&this!==Array&&o(this))e=this;else{if(!P){if(i(t))return y=t.length,1!==y?Array.apply(null,t):(_=new Array(1),_[0]=t[0],_);if(p(t)){for(_=new Array(y=t.length),r=0;r<y;++r)_[r]=t[r];return _}}_=[]}if(!p(t))if(void 0!==(w=t[n])){for(m=a(w).call(t),e&&(_=new e),b=m.next(),r=0;!b.done;)E=P?d.call(P,S,b.value,r):b.value,e?(h.value=E,f(_,r,h)):_[r]=E,b=m.next(),++r;y=r}else if(c(t)){for(y=t.length,e&&(_=new e),r=0,g=0;r<y;++r)E=t[r],r+1<y&&(v=E.charCodeAt(0))>=55296&&v<=56319&&(E+=t[++r]),E=P?d.call(P,S,E,g):E,e?(h.value=E,f(_,g,h)):_[g]=E,++g;y=g}if(void 0===y)for(y=s(t.length),e&&(_=new e(y)),r=0;r<y;++r)E=P?d.call(P,S,t[r],r):t[r],e?(h.value=E,f(_,r,h)):_[r]=E;return e&&(h.value=null,_.length=y),_}},function(t,e,r){"use strict";t.exports=function(){var t,e,r=Array.from;return"function"==typeof r&&(t=["raz","dwa"],e=r(t),Boolean(e&&e!==t&&"dwa"===e[1]))}},function(t,e,r){"use strict";t.exports=r(44)()?Array.from:r(43)},function(t,e,r){"use strict";var n=r(45),i=r(11),o=r(1);t.exports=function(t){var e=Object(o(t)),r=arguments[1],s=Object(arguments[2]);if(e!==t&&!r)return e;var a={};return r?n(r,function(e){(s.ensure||e in t)&&(a[e]=t[e])}):i(a,t),a}},function(t,e,r){"use strict";var n,i=r(46),o=r(18),s=r(2),a=r(41),u=r(2),l=r(1),c=Function.prototype.bind,p=Object.defineProperty,d=Object.prototype.hasOwnProperty;n=function(t,e,r){var n,o=l(e)&&u(e.value);return n=i(e),delete n.writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&d.call(this,t)?o:(e.value=c.call(o,r.resolveContext?r.resolveContext(this):this),p(this,t,e),this[t])},n},t.exports=function(t){var e=o(arguments[1]);return null!=e.resolveContext&&s(e.resolveContext),a(t,function(t,r){return n(r,t,e)})}},function(t,e,r){"use strict";var n,i=r(9),o=r(17),s=r(4),a=r(3),u=r(10),l=Object.defineProperty;n=t.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,t),e=e?o.call(e,"key+value")?"key+value":o.call(e,"key")?"key":"value":"value",l(this,"__kind__",s("",e))},i&&i(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:s(function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t})}),l(n.prototype,a.toStringTag,s("c","Array Iterator"))},function(t,e,r){"use strict";var n=r(8),i=r(7),o=r(48),s=r(38),a=r(16),u=r(3).iterator;t.exports=function(t){return"function"==typeof a(t)[u]?t[u]():n(t)?new o(t):i(t)?new s(t):new o(t)}},function(t,e,r){"use strict";var n=r(8),i=r(2),o=r(7),s=r(49),a=Array.isArray,u=Function.prototype.call,l=Array.prototype.some;t.exports=function(t,e){var r,c,p,d,h,f,g,_,y=arguments[2];if(a(t)||n(t)?r="array":o(t)?r="string":t=s(t),i(e),p=function(){d=!0},"array"===r)return void l.call(t,function(t){return u.call(e,y,t,p),d});if("string"!==r)for(c=t.next();!c.done;){if(u.call(e,y,c.value,p),d)return;c=t.next()}else for(f=t.length,h=0;h<f&&(g=t[h],h+1<f&&(_=g.charCodeAt(0))>=55296&&_<=56319&&(g+=t[++h]),u.call(e,y,g,p),!d);++h);}},function(t,e,r){"use strict";var n=r(8),i=r(5),o=r(7),s=r(3).iterator,a=Array.isArray;t.exports=function(t){return!(!i(t)||!a(t)&&!o(t)&&!n(t)&&"function"!=typeof t[s])}},function(t,e,r){"use strict";t.exports=function(t){return!!t&&("symbol"==typeof t||!!t.constructor&&"Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag])}},function(t,e,r){"use strict";var n=r(52);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not a symbol");return t}},function(t,e,r){"use strict";var n,i,o,s,a=r(4),u=r(53),l=Object.create,c=Object.defineProperties,p=Object.defineProperty,d=Object.prototype,h=l(null);if("function"==typeof Symbol){n=Symbol;try{String(n()),s=!0}catch(t){}}var f=function(){var t=l(null);return function(e){for(var r,n,i=0;t[e+(i||"")];)++i;return e+=i||"",t[e]=!0,r="@@"+e,p(d,r,a.gs(null,function(t){n||(n=!0,p(this,r,a(t)),n=!1)})),r}}();o=function(t){if(this instanceof o)throw new TypeError("Symbol is not a constructor");return i(t)},t.exports=i=function t(e){var r;if(this instanceof t)throw new TypeError("Symbol is not a constructor");return s?n(e):(r=l(o.prototype),e=void 0===e?"":String(e),c(r,{__description__:a("",e),__name__:a("",f(e))}))},c(i,{for:a(function(t){return h[t]?h[t]:h[t]=i(String(t))}),keyFor:a(function(t){var e;u(t);for(e in h)if(h[e]===t)return e}),hasInstance:a("",n&&n.hasInstance||i("hasInstance")),isConcatSpreadable:a("",n&&n.isConcatSpreadable||i("isConcatSpreadable")),iterator:a("",n&&n.iterator||i("iterator")),match:a("",n&&n.match||i("match")),replace:a("",n&&n.replace||i("replace")),search:a("",n&&n.search||i("search")),species:a("",n&&n.species||i("species")),split:a("",n&&n.split||i("split")),toPrimitive:a("",n&&n.toPrimitive||i("toPrimitive")),toStringTag:a("",n&&n.toStringTag||i("toStringTag")),unscopables:a("",n&&n.unscopables||i("unscopables"))}),c(o.prototype,{constructor:a(i),toString:a("",function(){return this.__name__})}),c(i.prototype,{toString:a(function(){return"Symbol ("+u(this).__description__+")"}),valueOf:a(function(){return u(this)})}),p(i.prototype,i.toPrimitive,a("",function(){var t=u(this);return"symbol"==typeof t?t:t.toString()})),p(i.prototype,i.toStringTag,a("c","Symbol")),p(o.prototype,i.toStringTag,a("c",i.prototype[i.toStringTag])),p(o.prototype,i.toPrimitive,a("c",i.prototype[i.toPrimitive]))},function(t,e,r){"use strict";var n={object:!0,symbol:!0};t.exports=function(){var t;if("function"!=typeof Symbol)return!1;t=Symbol("test symbol");try{String(t)}catch(t){return!1}return!!n[typeof Symbol.iterator]&&!!n[typeof Symbol.toPrimitive]&&!!n[typeof Symbol.toStringTag]}},function(t,e,r){"use strict";var n,i,o,s,a,u,l,c=r(4),p=r(2),d=Function.prototype.apply,h=Function.prototype.call,f=Object.create,g=Object.defineProperty,_=Object.defineProperties,y=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};n=function(t,e){var r;return p(e),y.call(this,"__ee__")?r=this.__ee__:(r=v.value=f(null),g(this,"__ee__",v),v.value=null),r[t]?"object"==typeof r[t]?r[t].push(e):r[t]=[r[t],e]:r[t]=e,this},i=function(t,e){var r,i;return p(e),i=this,n.call(this,t,r=function(){o.call(i,t,r),d.call(e,this,arguments)}),r.__eeOnceListener__=e,this},o=function(t,e){var r,n,i,o;if(p(e),!y.call(this,"__ee__"))return this;if(r=this.__ee__,!r[t])return this;if("object"==typeof(n=r[t]))for(o=0;i=n[o];++o)i!==e&&i.__eeOnceListener__!==e||(2===n.length?r[t]=n[o?0:1]:n.splice(o,1));else n!==e&&n.__eeOnceListener__!==e||delete r[t];return this},s=function(t){var e,r,n,i,o;if(y.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(r=arguments.length,o=new Array(r-1),e=1;e<r;++e)o[e-1]=arguments[e];for(i=i.slice(),e=0;n=i[e];++e)d.call(n,this,o)}else switch(arguments.length){case 1:h.call(i,this);break;case 2:h.call(i,this,arguments[1]);break;case 3:h.call(i,this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),e=1;e<r;++e)o[e-1]=arguments[e];d.call(i,this,o)}},a={on:n,once:i,off:o,emit:s},u={on:c(n),once:c(i),off:c(o),emit:c(s)},l=_({},u),t.exports=e=function(t){return null==t?f(l):_(Object(t),u)},e.methods=a},function(t,e,r){"use strict";var n=String.prototype.indexOf;t.exports=function(t){return n.call(this,t,arguments[1])>-1}},function(t,e,r){"use strict";var n="razdwatrzy";t.exports=function(){return"function"==typeof n.contains&&!0===n.contains("dwa")&&!1===n.contains("foo")}},function(t,e,r){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,r){"use strict";var n=r(5),i=Object.keys;t.exports=function(t){return i(n(t)?Object(t):t)}},function(t,e,r){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,r){"use strict";t.exports=r(61)()?Object.keys:r(60)},function(t,e,r){"use strict";var n=r(62),i=r(1),o=Math.max;t.exports=function(t,e){var r,s,a,u=o(arguments.length,2);for(t=Object(i(t)),a=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},s=1;s<u;++s)e=arguments[s],n(e).forEach(a);if(void 0!==r)throw r;return t}},function(t,e,r){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(t={foo:"raz"},e(t,{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,r){"use strict";var n,i=Object.create;r(20)()||(n=r(19)),t.exports=function(){var t,e,r;return n?1!==n.level?i:(t={},e={},r={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(t){return"__proto__"===t?void(e[t]={configurable:!0,enumerable:!1,writable:!0,value:void 0}):void(e[t]=r)}),Object.defineProperties(t,e),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:t}),function(e,r){return i(null===e?t:e,r)}):i}()},function(t,e,r){"use strict";var n=r(5),i={function:!0,object:!0};t.exports=function(t){return n(t)&&i[typeof t]||!1}},function(t,e,r){"use strict";t.exports=function(t){return t=Number(t),isNaN(t)||0===t?t:t>0?1:-1}},function(t,e,r){"use strict";t.exports=function(){var t=Math.sign;return"function"==typeof t&&1===t(10)&&-1===t(-20)}},function(t,e,r){"use strict";t.exports=r(68)()?Math.sign:r(67)},function(t,e,r){"use strict";var n=r(69),i=Math.abs,o=Math.floor;t.exports=function(t){return isNaN(t)?0:(t=Number(t),0!==t&&isFinite(t)?n(t)*o(i(t)):t)}},function(t,e,r){"use strict";t.exports=function(t){return t!==t}},function(t,e,r){"use strict";t.exports=function(){var t=Number.isNaN;return"function"==typeof t&&!t({})&&t(NaN)&&!t(34)}},function(t,e,r){"use strict";t.exports=r(72)()?Number.isNaN:r(71)},function(t,e,r){"use strict";var n=r(73),i=r(21),o=r(1),s=Array.prototype.indexOf,a=Object.prototype.hasOwnProperty,u=Math.abs,l=Math.floor;t.exports=function(t){var e,r,c,p;if(!n(t))return s.apply(this,arguments);for(r=i(o(this).length),c=arguments[1],c=isNaN(c)?0:c>=0?l(c):i(this.length)-l(u(c)),e=c;e<r;++e)if(a.call(this,e)&&(p=this[e],n(p)))return e;return-1}},function(t,e,r){"use strict";var n,i=r(23),o=r(74),s=r(9),a=r(2),u=r(1),l=r(4),c=r(56),p=r(3),d=r(16),h=r(50),f=r(37),g=r(34),_=Function.prototype.call,y=Object.defineProperties,v=Object.getPrototypeOf;t.exports=n=function(){var t,e,r,i=arguments[0];if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");return r=g&&s&&Map!==n?s(new Map,v(this)):this,null!=i&&d(i),y(r,{__mapKeysData__:l("c",t=[]),__mapValuesData__:l("c",e=[])}),i?(h(i,function(r){var n=u(r)[0];r=r[1],-1===o.call(t,n)&&(t.push(n),e.push(r))},r),r):r},g&&(s&&s(n,Map),n.prototype=Object.create(Map.prototype,{constructor:l(n)})),c(y(n.prototype,{clear:l(function(){this.__mapKeysData__.length&&(i.call(this.__mapKeysData__),i.call(this.__mapValuesData__),this.emit("_clear"))}),delete:l(function(t){var e=o.call(this.__mapKeysData__,t);return-1!==e&&(this.__mapKeysData__.splice(e,1),this.__mapValuesData__.splice(e,1),this.emit("_delete",e,t),!0)}),entries:l(function(){return new f(this,"key+value")}),forEach:l(function(t){var e,r,n=arguments[1];for(a(t),e=this.entries(),r=e._next();void 0!==r;)_.call(t,n,this.__mapValuesData__[r],this.__mapKeysData__[r],this),r=e._next()}),get:l(function(t){var e=o.call(this.__mapKeysData__,t);if(-1!==e)return this.__mapValuesData__[e]}),has:l(function(t){return-1!==o.call(this.__mapKeysData__,t)}),keys:l(function(){return new f(this,"key")}),set:l(function(t,e){var r,n=o.call(this.__mapKeysData__,t);return-1===n&&(n=this.__mapKeysData__.push(t)-1,r=!0),this.__mapValuesData__[n]=e,r&&this.emit("_add",n,t),this}),size:l.gs(function(){return this.__mapKeysData__.length}),values:l(function(){return new f(this,"value")}),toString:l(function(){return"[object Map]"})})),Object.defineProperty(n.prototype,p.iterator,l(function(){return this.entries()})),Object.defineProperty(n.prototype,p.toStringTag,l("c","Map"))},function(t,e,r){"use strict";t.exports=function(){var t,e,r;if("function"!=typeof Map)return!1;try{t=new Map([["raz","one"],["dwa","two"],["trzy","three"]])}catch(t){return!1}return"[object Map]"===String(t)&&3===t.size&&"function"==typeof t.clear&&"function"==typeof t.delete&&"function"==typeof t.entries&&"function"==typeof t.forEach&&"function"==typeof t.get&&"function"==typeof t.has&&"function"==typeof t.keys&&"function"==typeof t.set&&"function"==typeof t.values&&(e=t.entries(),r=e.next(),!1===r.done&&!!r.value&&"raz"===r.value[0]&&"one"===r.value[1])}},function(t,e,r){"use strict";t.exports=r(76)()?Map:r(75)},function(t,e,r){"use strict";function n(t){var e=t.split("//",2);return 1===e.length?e[0].split("/",1)[0]:e[1]?e[1].split("/",1)[0]:""}function i(t){var e=l.exec(t);return e&&e[0]||""}function o(t,e,r){return{name:e.name,preset:t.preset,bitrate:t.bitrate,protocol:t.rendition.scProtocol,host:n(r),url:i(r),format:t.rendition.scFormat,quality:t.quality}}Object.defineProperty(e,"__esModule",{value:!0});var s=r(77),a=r(0),u=r(24),l=/^[^?#]*/,c=function(){function t(t){var e=t.logger,r=t.controllers,n=t.playerId,i=t.streamUrlsExpire,o=t.fetchEnabled,u=t.fadeOnPauseAndPlay,l=t.fadeOnSeek,c=t.cacheManager,p=t.providePlayer,d=t.removePlayer,h=t.streamUrlRetriever,f=t.getURLOpts,g=t.errorEventGenerator,_=t.audioPerformanceEventGenerator;this._quality=null,this._onQualityChanged=new a.eventDispatcher.EventDispatcher,this._controllerIndexByRendition=new s,this._controlledPlayerWithRendition=null,this.onQualityChanged=this._onQualityChanged.getHandle(),this._logger=a.logger.prefixLogger(e,"ControllerManager"),this._controllers=r,this._playerId=n,this._streamUrlsExpire=i,this._fetchEnabled=o,this._fadeOnPauseAndPlay=u,this._fadeOnSeek=l,this._cacheManager=c,this._providePlayer=p,this._removePlayer=d,this._streamUrlRetriever=h,this._getURLOpts=f,this._errorEventGenerator=g||null,this._audioPerformanceEventGenerator=_||null}return t.prototype.buildNextController=function(t,e){var r=this;if(this._controlledPlayerWithRendition)throw new Error("A player is already being controlled.");this._logger.debug("Building next controller.");var n=this._controllerIndexByRendition.get(t.rendition)||0;if(n>=this._controllers.length)this._logger.debug("No more controllers for this rendition."),e({excludeRendition:!0,immediateRetry:!0});else{var i=!1,o=function(o){if(i)throw new Error("performNextAction() already called");i=!0,"MOVE_ON"!==o&&"MOVE_ON_SAME_RENDITION"!==o||(r._logger.debug("Controller will not be used again."),r._controllerIndexByRendition.set(t.rendition,n+1)),"MOVE_ON_SAME_RENDITION"===o?r.buildNextController(t,e):e({excludeRendition:!1,immediateRetry:"MOVE_ON"===o})};this._manageController(t,this._controllers[n],o)}},t.prototype.releaseCurrentController=function(t){var e=t.retry;if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");this._controlledPlayerWithRendition.releaseControl({retry:e})},t.prototype.getQuality=function(){return this._quality},t.prototype.getPlayerDetails=function(){if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");var t=this._controlledPlayerWithRendition;return o(t.initialUrlAndRendition,t.controller,t.controlledPlayer.getUrl())},t.prototype._manageController=function(t,e,r){var n=this,i=function(){n._removePlayer(),n._controlledPlayerWithRendition=null,s&&s.kill()};if(this._logger.debug("Preparing controller.",e.name),!e.isRenditionSupported(t.rendition,{streamUrlExpires:this._streamUrlsExpire}))return this._logger.debug("Skipping controller because rendition not supported."),void r("MOVE_ON_SAME_RENDITION");var s,l=!1,c=function(t){var e=t.retry;l||(l=!0,n._logger.debug("Releasing control."),i(),r(e?"RETRY":"MOVE_ON"))};try{this._logger.debug("Building player.");var p=e.buildPlayer({logger:a.logger.prefixLogger(this._logger,e.name+"-Controller"),playerId:this._playerId,urlAndRendition:t,streamUrlExpires:this._streamUrlsExpire,fetchEnabled:this._fetchEnabled,releaseControl:c,fadeOnPauseAndPlay:this._fadeOnPauseAndPlay,fadeOnSeek:this._fadeOnSeek,getNewUrl:function(){return n._getNewUrlWithSameRendition(t.rendition)},reportError:function(r){n._errorEventGenerator&&n._errorEventGenerator.reportManualEvent(r,o(t,e,p?p.getUrl():t.url))},reportPerformance:function(t){!l&&n._audioPerformanceEventGenerator&&n._audioPerformanceEventGenerator.reportManualEvent(t)}});if(s=p.getPlayer(),l)this._logger.warn("Player released during constrution."),s.kill();else if(s.isDead()){var d=s.getFatalError();d instanceof a.errors.NotSupportedError?this._logger.debug("Player not supported (during construction)."):this._logger.error("Error during construction.",d),r("MOVE_ON_SAME_RENDITION")}else{this._logger.debug("Player built."),s.onChange.subscribe(function(t){var e=t.dead,r=t.fatalError;e&&(r&&n._logger.error("Fatal player error occurred.",r),c({retry:!1}))}),this._cacheManager.addPlayer(s),this._controlledPlayerWithRendition={controller:e,controlledPlayer:p,initialUrlAndRendition:t,releaseControl:c},this._providePlayer(p.getPlayer(),e.syncConfig,e.supportsVolumeAutomation),this._logger.debug("Player provided to proxy.");var h=t.quality||null;this._quality!==h&&(this._logger.debug("Quality changed.",h),this._quality=h,this._onQualityChanged.dispatch(h))}}catch(t){t===u.notSupportedError?this._logger.debug("Player not supported. Not constructed."):this._logger.error("Error during construction.",t),i(),r("MOVE_ON_SAME_RENDITION")}},t.prototype._getNewUrlWithSameRendition=function(t){var e=this;return new a.helpers.abortableJob.AbortableJob(function(){var r=e._streamUrlRetriever.getUrl(e._getURLOpts);return{result:r.whenComplete().then(function(e){var r=null;return e&&e.success&&e.rendition===t&&(r=e.url),r}),abort:function(){return r.abort()}}}).run()},t}();e.ControllerManager=c},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(12),o=1e3,s=function(){function t(t,e,r,i,s){this._checkpointTimer=null,this._logger=n.logger.prefixLogger(i,"AudioEventGenerator"),this._player=t,this._eventReporter=e,this._checkpointInterval=Math.max(o,r),this._getPlayerDetails=s,this._startReporting()}return t.prototype._startReporting=function(){var t=this,e=this._player;e.onChange.subscribe(function(r){var n=r.actuallyPlaying,i=r.ended;!0===n&&!e.isEnded()||!1===i&&e.isActuallyPlaying()?(t._checkpointTimer||(t._checkpointTimer=window.setInterval(function(){t._reportEvent("checkpoint")},t._checkpointInterval)),t._reportEvent("play")):(!1===n&&!e.isEnded()||!0===i&&e.isActuallyPlaying())&&(t._checkpointTimer&&(window.clearInterval(t._checkpointTimer),t._checkpointTimer=null),t._reportEvent("pause"))})},t.prototype._reportEvent=function(t){var e=this._getPlayerDetails();if(!e)return void this._logger.warn("Cannot report event because there is no player.",t);var r=this._player.getDuration();if(null===r)throw new Error("Duration should exist now.");var n={type:t,position:this._player.getPosition(),duration:r,preset:e.preset,quality:e.quality,playerType:e.name,appState:i.getAppState()};this._logger.debug("Generated audio event.",n),this._eventReporter(n)},t}();e.AudioEventGenerator=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){this._delayFactor=0,this._lastRequestTime=0}return t.prototype.getDelay=function(t){var e=void 0===t?{}:t,r=e.maxDelay,n=void 0===r?3e4:r,i=e.numInstantRuns,o=void 0===i?5:i,s=Date.now()-this._lastRequestTime;this._lastRequestTime=Date.now(),this._delayFactor=Math.max(0,this._delayFactor-s/n),this._delayFactor++;var a=this._delayFactor-o;return a>0?Math.pow(2,a):0},t}();e.DecayingExponentialDelayCalculator=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(12),o=function(){function t(t,e,r,i,o,s){this._logger=n.logger.prefixLogger(s,"ErrorGenerator"),this._player=t,this._logCollector=e,this._logId=r,this._trackId=i,this._eventReporter=o,this._listenForProxyFatalError()}return t.prototype.reportManualEvent=function(t,e){"NOT_SUPPORTED_ERROR"!==t&&"HLS_MSE_PLAYER.NO_TRANSMUXER_ERROR"!==t&&(this._logger.debug("Reporting manual error event.",t),this._reportEvent(t,e))},t.prototype._listenForProxyFatalError=function(){var t=this;this._player.onError.subscribe(function(e){e instanceof n.errors.PlayerFatalError&&t._reportEvent(e.getCode())})},t.prototype._reportEvent=function(t,e){var r={errorCode:t,log:this._logCollector.getLog(),logId:this._logId,trackId:this._trackId,protocol:e&&e.protocol,playerType:e&&e.name?e.name:"MaestroUnknown",host:e&&e.host,bitrate:e&&e.bitrate,format:e&&e.format,preset:e&&e.preset,quality:e&&e.quality,url:e&&e.url,appState:i.getAppState()};this._logger.debug("Generated audio error event.",r),this._eventReporter(r)},t}();e.ErrorEventGenerator=o},function(t,e,r){"use strict";function n(t,e){var r=t.getBufferedTimeRanges();return r?o(r,function(t){return t.containsTime(e)})||new i.TimeRange(e,0):null}Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=i.helpers.find,s=function(){function t(t){var e=t.proxy,r=t.getPlayer;this._getPlayer=r;var i=this._position=e.getPosition(),o=this._initialActualPlayer=r();if(o){var s=n(o,i);this._initialBuffered=s?s.end-i:null}else this._initialBuffered=null}return t.prototype.getPreloaded=function(){var t=this._initialBuffered;return null!==t&&this._initialActualPlayer&&this._getPlayer()===this._initialActualPlayer?0===t?"no":t>=2e3?"yes":"partial":null},t}();e.PreloadingCalculator=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=n.helpers.time.now,o=function(){function t(){this._start=null,this._end=null}return t.prototype.start=function(){if(this.isComplete())throw new Error("Timer completed.");this._start=i()},t.prototype.isComplete=function(){return null!==this._end},t.prototype.stop=function(){if(null===this._start)throw new Error("Not started.");this._end=i()},t.prototype.getTime=function(){if(null===this._end)throw new Error("Not completed.");return this._end-this._start},t}();e.Timer=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(83),o=r(82),s=r(12),a=function(){function t(t,e,r,i,o){this._logger=n.logger.prefixLogger(i,"AudioPerformanceEventGenerator"),this._proxy=t,this._getPlayer=e,this._eventReporter=r,this._getPlayerDetails=o,this._measureGeneralEvents()}return t.prototype.reportManualEvent=function(t){this._logger.debug("Reporting manual audio performance event.",t),this._eventReporter(t)},t.prototype._measureGeneralEvents=function(){var t=this,e=this._proxy,r=null,n=null,s=null,a=null,u=null,l=null,c=null,p=!0;e.onChange.subscribe(function(d){var h=d.playing,f=d.actuallyPlaying,g=d.seek,_=d.seeking,y=d.stalled,v=d.ended;if(!0!==d.dead&&!1!==h||!a||(a.stop(),a.getTime()>=1e3&&t._reportEvent("rageSkip",a.getTime(),null),a=null),e.isDead())return void(c&&window.clearTimeout(c));var m=e.getSeekState();e.isActuallyPlaying()||a||!(!0===h||e.isPlaying()&&!0===y)||(a=new i.Timer,a.start()),!0===h&&(r||(r=new i.Timer,r.start(),n=new o.PreloadingCalculator({proxy:e,getPlayer:t._getPlayer}),c=window.setTimeout(function(){t._reportEvent("longInitialBuffering",0,null)},3e4),0===e.getPosition()&&(p=!1))),!1===h&&(c&&window.clearTimeout(c),r&&!r.isComplete()&&(r=null)),!0===f&&(a=null,r&&!r.isComplete()&&(r.stop(),c&&window.clearTimeout(c),t._reportEvent("play",r.getTime(),n.getPreloaded()))),g&&"IN_PROGRESS"===g.state&&e.isReady()&&(s=new i.Timer,s.start(),u=new o.PreloadingCalculator({proxy:e,getPlayer:t._getPlayer}),!0===_&&t._reportEvent("seekStart",0,null)),(g&&"COMPLETED"===g.state&&!e.isStalled()||!1===y&&m&&"COMPLETED"===m.state)&&s&&(s.stop(),t._reportEvent("seek",s.getTime(),u.getPreloaded()),s=null),!0!==y||!e.isPlaying()||m&&"IN_PROGRESS"===m.state||r&&r.isComplete()&&(l=new i.Timer,l.start(),t._reportEvent("rebufferingStart",e.getPosition(),null)),!1===y&&(r&&r.isComplete()&&(a=null),l&&(l.stop(),t._reportEvent("rebufferingEnd",l.getTime(),null),l=null)),!0!==v||p||(t._reportEvent("uninterruptedPlay",0,null),p=!0),!(m&&"IN_PROGRESS"===m.state)&&!0===y&&e.isActuallyPlaying()&&(p=!0)})},t.prototype._reportEvent=function(t,e,r){var n=this._getPlayerDetails();if(!n)return void this._logger.warn("Cannot report event because there is no player.",t,e);var i={type:t,latency:e,protocol:n.protocol,playerType:n.name,host:n.host,bitrate:n.bitrate,format:n.format,preset:n.preset,quality:n.quality,preloaded:r||void 0,appState:s.getAppState()};this._logger.debug("Generated audio performance event.",i),this._eventReporter(i)},t}();e.AudioPerformanceEventGenerator=a},function(t,e,r){"use strict";function n(t){return t.map(function(t){try{return JSON.stringify(t)}catch(t){return"<unavailable>"}})}var i=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t){void 0===t&&(t=200),this._bufferSize=t,this._log=[]}return t.prototype.getLog=function(){return this._log.map(function(t){return i({},t,{data:n(t.data)})})},t.prototype.debug=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this._push({level:"debug",msg:t,data:e,time:Date.now()})},t.prototype.info=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this._push({level:"info",msg:t,data:e,time:Date.now()})},t.prototype.warn=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this._push({level:"warn",msg:t,data:e,time:Date.now()})},t.prototype.error=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this._push({level:"error",msg:t,data:e,time:Date.now()})},t.prototype._push=function(t){this._log.push(t)>this._bufferSize&&this._log.shift()},t}();e.LogCollector=o},function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t){if("number"!=typeof t)throw new Error("level must be a number.");if(t<0||t>1)throw new Error("Invalid volume level.");I=t,M.forEach(function(e){return e.setVolume(t)})}function o(){return I}function s(t){if("boolean"!=typeof t)throw new Error("muteEnabled must be a boolean.");D=t,M.forEach(function(e){return e.setMuted(t)})}function a(){return D}function u(t){if("number"!=typeof t||t<0)throw new Error("Invalid size.");C.setCacheSize(t)}var l=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var c=r(0),p=r(26),d=r(85),h=r(84),f=r(81),g=r(80),_=r(79),y=r(78),v=r(33),m=r(32),b=r(6),w=r(15),E=r(31),P=r(30),S=r(29),x=r(14),k=r(13),A=c.eventDispatcher.EventDispatcher,O=c.helpers.Promise,T=c.helpers.deferred.buildDeferred,C=new v.CacheManager(15e7,c.logger.noOpLogger),R=-1,M=[],I=1,D=!1;e.setGlobalVolume=i,e.getGlobalVolume=o,e.setGlobalMuted=s,e.getGlobalMuted=a,e.setCacheSize=u;var L=function(t){function e(e){var r=t.call(this,e)||this;r._onPreloadingEnabled=new A,r._onPreloadingDisabled=new A,r._retryDelayCalculator=new g.DecayingExponentialDelayCalculator,r._errorEventGenerator=null,r._fadeOutVolumeAutomator=null,r._volumeAutomators=[],r._volumeScale=1,r._userVolume=1,r._volumeAutomationSupported=!1,r._timer=null,r._pauseFadeTimer=null,r._pauseFadeDeferred=null,r._pauseFade=null,r._executionState={state:"IDLE"},r._preloadingListeners=[],r._retrieveAndBuildTimer=null,r._hadAStreamUrl=!1;var n=r._config=E.validatePlayerDependencies(e);r._preloadingEnabled=n.preloadingEnabled,r._getURLOpts=n.getURLOpts,r._controllers=n.controllers;var i=r._connectionRequiredHelper=new S.ConnectionRequiredHelper(r);r.onPreloadingEnabled=r._onPreloadingEnabled.getHandle(),r.onPreloadingDisabled=r._onPreloadingDisabled.getHandle(),r.onConnectionRequired=i.onConnectionRequired,r.onConnectionRecovered=i.onConnectionRecovered,r.onChange.subscribe(function(t){r.isDead()||((!1===t.playing||t.positionJumped||t.stalled||t.ended)&&r._completePauseFade(),r._pauseFade&&(!1===t.actuallyPlaying||t.ended||!0===t.playing)&&(r._removeVolumeAutomator(r._pauseFade),r._pauseFade=null),(t.positionJumped||void 0!==t.actuallyPlaying||void 0!==t.stalled)&&r._updateVolume(),void 0!==t.playing&&r._updateMaxBufferLength())});var o="SCAudio-"+ ++R,s=n.streamUrlRetriever.getTrackId();null!==s&&(o+="-"+s);var a=new d.LogCollector,u=c.logger.cloneLogger(a,r._logger);r._logger=c.logger.prefixLogger(u,o);var l=P.generateLogId();r._logger.info("Building player...",{ua:navigator.userAgent,getURLOpts:r._getURLOpts,logId:l}),M.push(r),r.setVolume(I,D),r._updateFadeOut();var p=null,v=null;n.audioPerformanceReporter&&(p=new h.AudioPerformanceEventGenerator(r,function(){return r._getPlayer()},n.audioPerformanceReporter,r._logger,function(){return r._getActivePlayerDetails()})),n.audioReporter&&new _.AudioEventGenerator(r,n.audioReporter,n.audioCheckpointInterval,r._logger,function(){return r._getActivePlayerDetails()}),n.errorReporter&&(v=r._errorEventGenerator=new f.ErrorEventGenerator(r,a,l,s,n.errorReporter,r._logger)),r._excludeUnsupportedRenditions();var m=r._controllerManager=new y.ControllerManager({logger:r._logger,controllers:n.controllers,playerId:o,streamUrlsExpire:n.streamUrlsExpire,fetchEnabled:n.fetchEnabled,fadeOnPauseAndPlay:n.fadeOnPauseAndPlay,fadeOnSeek:n.fadeOnSeek,cacheManager:C,providePlayer:function(t,e,n){r._volumeAutomationSupported=n,r._providePlayer(t,e),r._updateMaxBufferLength()},removePlayer:function(){r._getPlayer()&&r._removePlayer()},streamUrlRetriever:r._config.streamUrlRetriever,getURLOpts:r._getURLOpts,errorEventGenerator:v||void 0,audioPerformanceEventGenerator:p||void 0});if(r.onQualityChanged=m.onQualityChanged,void 0!==n.duration&&(r._logger.debug("Setting initial duration.",n.duration),r._setInitialDuration(n.duration)),r._preloadingEnabled)r._logger.debug("Preloading is enabled, so performing retrieve immediately."),r._retrieveAndBuild();else{r._logger.debug("Preloading is disabled, so deferring retrieve until either a play intent or preloading is enabled.");var b=function(){r._removePreloadingListeners(),r._logger.debug("Preloading now enabled or received a play request. Peforming retrieve."),r._retrieveAndBuild()};r._preloadingListeners.push(r.onPreloadingEnabled.subscribe(b),r.onPlayIntent.subscribe(b))}return r}return l(e,t),e.prototype.reload=function(t){void 0===t&&(t={}),this._ensureNotDead(),this._reloadStreamUrls(t)},e.prototype.enablePreloading=function(){this.isDead()||this._preloadingEnabled||(this._preloadingEnabled=!0,this._updateMaxBufferLength(),this._onPreloadingEnabled.dispatch(void 0))},e.prototype.disablePreloading=function(){this.isDead()||this._preloadingEnabled&&(this._preloadingEnabled=!1,this._updateMaxBufferLength(),this._onPreloadingDisabled.dispatch(void 0))},e.prototype.isPreloadingEnabled=function(){return this._preloadingEnabled},e.prototype.pauseAfterFade=function(t){var e=this;if(this._ensureNotDead(),this._pauseFadeDeferred)return this._pauseFadeDeferred.promise;if(!this.isPlaying()||!this.isActuallyPlaying())return O.resolve(this.pause());var r=T();this._pauseFadeDeferred=r;var n=this.getPosition();if(this._pauseFade)throw new Error("Fade should not already be assigned.");return this._pauseFade=new p.Fade({startPos:n,endPos:n+t,startLevel:1,endLevel:0}),this._addVolumeAutomator(this._pauseFade),this._pauseFadeTimer=window.setTimeout(function(){e._pauseFadeDeferred=null,r.resolve(e.pause({fadeDuration:0}))},t+50),r.promise},e.prototype.isConnectionRequired=function(){return this._connectionRequiredHelper.isConnectionRequired()},e.prototype.getQuality=function(){return this._controllerManager.getQuality()},e.prototype.getVolume=function(){return this._volumeAutomationSupported?this._userVolume:t.prototype.getVolume.call(this)},e.prototype._handleFatalError=function(t){this._logger.warn("Fatal error from current player.",t)},e.prototype._handleVolumeChange=function(e,r){this._userVolume=e,t.prototype._notifyVolumeChange.call(this,e,r),this._calculateAndSetVolume()},e.prototype._notifyVolumeChange=function(){},e.prototype._kill=function(){t.prototype._kill.call(this),this._timer&&window.clearTimeout(this._timer),this._abortPauseFade(),this._removePreloadingListeners(),M.splice(M.indexOf(this),1),"RETRIEVING_URL"===this._executionState.state?this._executionState.retrieveJob.abort():"CONTROLLING_PLAYER"===this._executionState.state&&this._controllerManager.releaseCurrentController({retry:!1}),this._executionState={state:"DEAD"},this._retrieveAndBuildTimer&&window.clearTimeout(this._retrieveAndBuildTimer)},e.prototype._excludeUnsupportedRenditions=function(){var t=this,e={streamUrlExpires:this._config.streamUrlsExpire};k.allRenditions.filter(function(r){return!t._controllers.some(function(t){return t.isRenditionSupported(r,e)})}).forEach(function(e){t._config.streamUrlRetriever.excludeRendition(e)})},e.prototype._addVolumeAutomator=function(t){this._volumeAutomators.indexOf(t)<0&&(this._volumeAutomators.push(t),this._updateVolume())},e.prototype._removeVolumeAutomator=function(t){var e=this._volumeAutomators.indexOf(t);e>=0&&(this._volumeAutomators.splice(e,1),this._updateVolume())},e.prototype._removePreloadingListeners=function(){this._preloadingListeners.forEach(function(t){return t.remove()})},e.prototype._getActivePlayerDetails=function(){return"CONTROLLING_PLAYER"!==this._executionState.state?null:this._controllerManager.getPlayerDetails()},e.prototype._updateFadeOut=function(){this._fadeOutVolumeAutomator&&this._removeVolumeAutomator(this._fadeOutVolumeAutomator),this._getURLOpts.snippet&&(this._fadeOutVolumeAutomator=p.buildFadeOut(3e3),this._addVolumeAutomator(this._fadeOutVolumeAutomator))},e.prototype._handleUnexpectedError=function(t){try{t()}catch(t){this._logger.error("Unexpected error.",t),this._triggerError(new c.errors.PlayerFatalError("An unexpected error occurred.",t))}},e.prototype._retrieveAndBuild=function(){var t=this;this._handleUnexpectedError(function(){if(-1===["IDLE","WAITING_TO_RETRIEVE"].indexOf(t._executionState.state))throw new Error("Invalid state for retrieveAndBuild().");t._logger.debug("Retrieving URL...");var e=m.retrieveUrl({streamUrlRetriever:t._config.streamUrlRetriever,urlProviderRetryDelayCalculator:t._config.urlProviderRetryDelayCalculator,getURLOpts:t._getURLOpts,logger:t._logger});t._executionState={state:"RETRIEVING_URL",retrieveJob:e},e.onCompletion(function(e){if(t._logger.debug("Retrieved URL.",!!e),e&&e.success){t._hadAStreamUrl=!0;var r=!1,n=function(n){var i=n.excludeRendition,o=n.immediateRetry;t._handleUnexpectedError(function(){if(r)throw new Error("startOver called multiple times.");if(r=!0,i&&t._config.streamUrlRetriever.excludeRendition(e.rendition),t._executionState={state:"WAITING_TO_RETRIEVE"},t.isDead())return void t._logger.debug("Stopping execution because player is dead.");if(o)t._logger.debug("Moving on immediately."),t._retrieveAndBuild();else{var n=t._retryDelayCalculator.getDelay();t._logger.debug("Will move on in "+n+"ms."),n?t._retrieveAndBuildTimer=window.setTimeout(function(){return t._retrieveAndBuild()},n):t._retrieveAndBuild()}})};t._handleUnexpectedError(function(){t._executionState={state:"CONTROLLING_PLAYER"},t._logger.debug("Building controller..."),t._controllerManager.buildNextController(e,n),t._logger.debug("Built controller.")})}else if(e&&e.rendition){if(t._logger.warn("Error retrieving URL. Moving on.",e.error),t._errorEventGenerator){var i="SCAUDIO.URL_RETRIEVER_ERROR."+t._config.streamUrlRetriever.name+"."+e.error.getCode();t._errorEventGenerator.reportManualEvent(i,{preset:e.preset,quality:e.quality,bitrate:e.bitrate,format:e.rendition.scFormat,protocol:e.rendition.scProtocol})}t._config.streamUrlRetriever.excludeRendition(e.rendition),t._executionState={state:"WAITING_TO_RETRIEVE"},t._retrieveAndBuild()}else e&&e.rendition&&t._logger.warn("Error retrieving URL for any rendition.",e.error),t._logger.info("Ran out of streams.",t._hadAStreamUrl),t._triggerError(t._hadAStreamUrl?new b.NotSupportedError:new w.NoStreamsError)}),e.onError(function(e){e!==c.helpers.abortableJob.abortedError&&(e===m.NoMoreAttemptsError?t._logger.error("Ran out of retries to retrieve URL."):t._logger.error("Unexpected error when retrieving a URL.",e),t._triggerError(new x.FailedRetrievingUrlError))})})},e.prototype._reloadStreamUrls=function(t){this._getURLOpts=t,this._updateFadeOut(),this._logger.info("Reloading stream URL's...",this._getURLOpts),"RETRIEVING_URL"===this._executionState.state?(this._logger.debug("Aborting current URL retrieve."),this._executionState.retrieveJob.abort(),this._executionState={state:"WAITING_TO_RETRIEVE"},this._retrieveAndBuild()):"CONTROLLING_PLAYER"===this._executionState.state?(this._logger.debug("Releasing controller."),this._controllerManager.releaseCurrentController({retry:!0})):this._logger.debug("Nothing to do."),this._logger.info("Reloaded stream URL's.")},e.prototype._completePauseFade=function(){if(this._pauseFadeDeferred){this._pauseFadeTimer&&window.clearTimeout(this._pauseFadeTimer);var t=this._pauseFadeDeferred;this._pauseFadeDeferred=null,t.resolve(this.pause())}},e.prototype._abortPauseFade=function(){this._pauseFadeTimer&&(window.clearTimeout(this._pauseFadeTimer),this._pauseFadeTimer=null),this._pauseFadeDeferred&&(this._pauseFadeDeferred.reject(new Error("Player was killed.")),this._pauseFadeDeferred=null)},e.prototype._updateVolume=function(){var t=this;if(this._volumeAutomationSupported){this._ensureNotDead(),this._timer&&(window.clearTimeout(this._timer),this._timer=null);var e=this.getDuration();if(null!==e){var r=this._volumeAutomators,i=this.getPosition(),o=1/0,s=1;r.forEach(function(t){var r=t.calculate(i,e),a=r.nextCalculatePosition,u=r.level;s*=n(0,1,u),a<o&&(o=a)}),this._volumeScale!==s&&(this._volumeScale=s,this._calculateAndSetVolume()),o<1/0&&this.isActuallyPlaying()&&!this.isStalled()&&(this._timer=window.setTimeout(function(){t._timer=null,t._updateVolume()},n(100,5e3,o-this.getPosition())))}}},e.prototype._calculateAndSetVolume=function(){this._volumeAutomationSupported?t.prototype._handleVolumeChange.call(this,this._userVolume*this._volumeScale,this.getMuted()):t.prototype._handleVolumeChange.call(this,this._userVolume,this.getMuted())},e.prototype._updateMaxBufferLength=function(){var t=this._getPlayer(),e=t&&t.getBufferController();e&&(this.isPlaying()?e.setMaxBufferLength(this._config.playingMaxBufferLength):e.setMaxBufferLength(this._preloadingEnabled?this._config.pausedMaxBufferLength:0))},e}(c.ProxyPlayerBase);e.Player=L},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e,r){void 0===t&&(t="UNKNOWN"),void 0===e&&(e=!1),void 0===r&&(r=null),this._code=t,this._transient=e,this._cause=r}return t.prototype.isTransient=function(){return this._transient},t.prototype.getCode=function(){return this._code},t.prototype.getCause=function(){return this._cause},t}();e.UrlRetrieverError=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.httpAACHQ={scProtocol:"http",scFormat:"aac",maestroFormat:{mimeType:"audio/mp4",audioCodec:{id:"mp4a.40.2"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encryptedHlsOpus={scProtocol:"encrypted-hls",scFormat:"opus",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/ogg",audioCodec:{id:"opus"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hlsOpus={scProtocol:"hls",scFormat:"opus",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/ogg",audioCodec:{id:"opus"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.maestroChromecast={scProtocol:"maestro.chromecast",maestroFormat:{}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.apiMobile={scProtocol:"sc.api-mobile",maestroFormat:{}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encryptedHlsAACHQ={scProtocol:"encrypted-hls",scFormat:"aac",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mp4",audioCodec:{id:"mp4a.40.2"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hlsAACHQ={scProtocol:"hls",scFormat:"aac",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mp4",audioCodec:{id:"mp4a.40.2"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encryptedHlsMp3={scProtocol:"encrypted-hls",scFormat:"mp3",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mpeg"}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hlsMp3={scProtocol:"hls",scFormat:"mp3",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mpeg"}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.httpMp3={scProtocol:"http",scFormat:"mp3",maestroFormat:{mimeType:"audio/mpeg"}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(26);!function(t){t.Fade=n.Fade,t.buildFadeIn=n.buildFadeIn,t.buildFadeOut=n.buildFadeOut}(e.volumeAutomation||(e.volumeAutomation={}))},function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),e.version="23.1.0",e.buildNumber=845;var i=r(98);e.volumeAutomation=i.volumeAutomation;var o=r(25);e.BaseStreamUrlRetriever=o.BaseStreamUrlRetriever,n(r(24));var s=r(13);e.renditions=s.renditions,e.allRenditions=s.allRenditions;var a=r(87);e.UrlRetrieverError=a.UrlRetrieverError;var u=r(86);e.Player=u.Player,e.setGlobalVolume=u.setGlobalVolume,e.setGlobalMuted=u.setGlobalMuted,e.getGlobalVolume=u.getGlobalVolume,e.getGlobalMuted=u.getGlobalMuted,e.setCacheSize=u.setCacheSize;var l=r(28);e.Quality=l.Quality,e.resolveQuality=l.resolveQuality,n(r(27))}])}(r(2))}(window)},function(t,e,r){!function(e,r){t.exports=function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=97)}([function(t,e,r){"use strict";var n=r(4);t.exports=function(t){if(!n(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,r){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,r){"use strict";t.exports=r(62)()?Symbol:r(61)},function(t,e,r){"use strict";function n(t){try{t()}catch(t){window.setTimeout(function(){throw t},0)}}Object.defineProperty(e,"__esModule",{value:!0}),e.deferException=n},function(t,e,r){"use strict";var n=r(24)();t.exports=function(t){return t!==n&&null!==t}},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(11),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.getCode=function(){return"PLAYER_FATAL_ERROR"},e}(i.PlayerError);e.PlayerFatalError=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(19),i=function(){function t(){this._listeners=[],this.dispatch=this.dispatch.bind(this)}return t.prototype.subscribe=function(t){var e=this,r={fn:t,payloads:[]};return this._listeners.push(r),{remove:function(){var t=e._listeners.indexOf(r);return t>=0&&(e._listeners.splice(t,1),!0)},retrieve:function(){return e._dispatchListenerPayloads(r)}}},t.prototype.dispatch=function(t,e){var r=this,i="number"==typeof e?{time:e}:e||{},o=void 0!==i.time?i.time:n.now(),s=this._listeners;s.forEach(function(e){return e.payloads.push({time:o,payload:t})});var a=!1;do{a=!s.some(function(t){var e=t.fn,n=t.payloads,i=n.shift();return!!i&&(r._callHandler(e,i),!0)})}while(!a)},t.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},t.prototype._dispatchListenerPayloads=function(t){for(var e=t.fn,r=t.payloads;;){var n=r.shift();if(!n)break;this._callHandler(e,n)}},t.prototype._callHandler=function(t,e){try{t(e.payload,e.time)}catch(t){window.setTimeout(function(){throw t},0)}},t}();e.EventDispatcher=i},function(t,e,r){"use strict";var n,i=r(14),o=r(23),s=r(66),a=r(22);n=t.exports=function(t,e){var r,n,s,u,l;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],null==t?(r=s=!0,n=!1):(r=a.call(t,"c"),n=a.call(t,"e"),s=a.call(t,"w")),l={value:e,configurable:r,enumerable:n,writable:s},u?i(o(u),l):l},n.gs=function(t,e,r){var n,u,l,c;return"string"!=typeof t?(l=r,r=e,e=t,t=null):l=arguments[3],null==e?e=void 0:s(e)?null==r?r=void 0:s(r)||(l=r,r=void 0):(l=e,e=r=void 0),null==t?(n=!0,u=!1):(n=a.call(t,"c"),u=a.call(t,"e")),c={get:e,set:r,configurable:n,enumerable:u},l?i(o(l),c):c}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(95);e.Promise=n.Promise},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call("");t.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===i)||!1}},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call(function(){return arguments}());t.exports=function(t){return n.call(t)===i}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._msg=t,this._cause=e}return t.prototype.getCode=function(){return"PLAYER_ERROR"},t.prototype.getMsg=function(){return this._msg},t.prototype.getCause=function(){return this._cause},t}();e.PlayerError=n},function(t,e,r){"use strict";function n(t,e){return{debug:function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return t.debug.apply(t,["["+e+"] "+r].concat(n))},error:function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return t.error.apply(t,["["+e+"] "+r].concat(n))},info:function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return t.info.apply(t,["["+e+"] "+r].concat(n))},warn:function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return t.warn.apply(t,["["+e+"] "+r].concat(n))}}}function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return{debug:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.forEach(function(t){return t.debug.apply(t,[e].concat(r))})},error:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.forEach(function(t){return t.error.apply(t,[e].concat(r))})},info:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.forEach(function(t){return t.info.apply(t,[e].concat(r))})},warn:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.forEach(function(t){return t.warn.apply(t,[e].concat(r))})}}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(36),s=o.isIE();e.noOpLogger={debug:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},error:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},info:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},warn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]}},e.consoleLogger={debug:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];s?console.log(t,e):(n=console.debug||console.log).call.apply(n,[console,t].concat(e));var n},error:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];s?console.log(t,e):(n=console.error||console.log).call.apply(n,[console,t].concat(e));var n},info:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];s?console.log(t,e):(n=console.info||console.log).call.apply(n,[console,t].concat(e));var n},warn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];s?console.log(t,e):(n=console.warn||console.log).call.apply(n,[console,t].concat(e));var n}},e.prefixLogger=n,e.cloneLogger=i},function(t,e,r){"use strict";function n(){var t,e,r=!1;return{promise:new i.Promise(function(r,n){t=r,e=n}),resolve:function(e){r||(r=!0,t(e))},reject:function(t){r||(r=!0,e(t))},isSettled:function(){return r}}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(8);e.buildDeferred=n},function(t,e,r){"use strict";t.exports=r(71)()?Object.assign:r(70)},function(t,e,r){"use strict";t.exports=r(27)()?Object.setPrototypeOf:r(26)},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(28),o=function(t){function e(e,r,n){return void 0===n&&(n="The player that the proxy was controlling had a fatal error."),t.call(this,e,r,n)||this}return n(e,t),e.prototype.getCode=function(){return"PROXY_PLAYER_PROVIDED_PLAYER_FATAL_ERROR"},e}(i.ProxyProvidedPlayerError);e.ProxyProvidedPlayerFatalError=o},function(t,e,r){"use strict";function n(t,e){var r=void 0;return t.some(function(t){return!!e(t)&&(r=t,!0)}),r}Object.defineProperty(e,"__esModule",{value:!0}),e.find=n},function(t,e,r){"use strict";function n(t,e){return t.then(e,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.always=n},function(t,e,r){"use strict";function n(){return"performance"in window&&window.performance.now?window.performance.now():Date.now()-i}Object.defineProperty(e,"__esModule",{value:!0});var i=Date.now();e.now=n},function(t,e,r){"use strict";var n,i=r(58),o=r(14),s=r(1),a=r(0),u=r(7),l=r(57),c=r(2),p=Object.defineProperty,d=Object.defineProperties;t.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");d(this,{__list__:u("w",a(t)),__context__:u("w",e),__nextIndex__:u("w",0)}),e&&(s(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,d(n.prototype,o({_next:u(function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__<this.__list__.length?this.__nextIndex__++:void this._unBind()}),next:u(function(){return this._createResult(this._next())}),_createResult:u(function(t){return void 0===t?{done:!0,value:void 0}:{done:!1,value:this._resolve(t)}}),_resolve:u(function(t){return this.__list__[t]}),_unBind:u(function(){this.__list__=null,delete this.__redo__,this.__context__&&(this.__context__.off("_add",this._onAdd),this.__context__.off("_delete",this._onDelete),this.__context__.off("_clear",this._onClear),this.__context__=null)}),toString:u(function(){return"[object "+(this[c.toStringTag]||"Object")+"]"})},l({_onAdd:u(function(t){if(!(t>=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void p(this,"__redo__",u("c",[t]));this.__redo__.forEach(function(e,r){e>=t&&(this.__redo__[r]=++e)},this),this.__redo__.push(t)}}),_onDelete:u(function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(e=this.__redo__.indexOf(t),-1!==e&&this.__redo__.splice(e,1),this.__redo__.forEach(function(e,r){e>t&&(this.__redo__[r]=--e)},this)))}),_onClear:u(function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0})}))),p(n.prototype,c.iterator,u(function(){return this}))},function(t,e,r){"use strict";var n=r(10),i=r(9),o=r(63),s=r(43),a=r(42),u=r(2).iterator;t.exports=function(t){return"function"==typeof a(t)[u]?t[u]():n(t)?new o(t):i(t)?new s(t):new o(t)}},function(t,e,r){"use strict";t.exports=r(65)()?String.prototype.contains:r(64)},function(t,e,r){"use strict";var n=r(4),i=Array.prototype.forEach,o=Object.create,s=function(t,e){var r;for(r in t)e[r]=t[r]};t.exports=function(t){var e=o(null);return i.call(arguments,function(t){n(t)&&s(Object(t),e)}),e}},function(t,e,r){"use strict";t.exports=function(){}},function(t,e,r){"use strict";var n=r(4),i={function:!0,object:!0};t.exports=function(t){return n(t)&&i[typeof t]||!1}},function(t,e,r){"use strict";var n,i=r(25),o=r(0),s=Object.prototype.isPrototypeOf,a=Object.defineProperty,u={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(t,e){if(o(t),null===e||i(e))return t;throw new TypeError("Prototype must be null or an object")},t.exports=function(t){var e,r;return t?(2===t.level?t.set?(r=t.set,e=function(t,e){return r.call(n(t,e),e),t}):e=function(t,e){return n(t,e).__proto__=e,t}:e=function t(e,r){var i;return n(e,r),i=s.call(t.nullPolyfill,e),i&&delete t.nullPolyfill.__proto__,null===r&&(r=t.nullPolyfill),e.__proto__=r,i&&a(t.nullPolyfill,"__proto__",u),e},Object.defineProperty(e,"level",{configurable:!1,enumerable:!1,writable:!1,value:t.level})):null}(function(){var t,e=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{t=n.set,t.call(e,r)}catch(t){}if(Object.getPrototypeOf(e)===r)return{set:t,level:2}}return e.__proto__=r,Object.getPrototypeOf(e)===r?{level:2}:(e={},e.__proto__=r,Object.getPrototypeOf(e)===r&&{level:1})}()),r(74)},function(t,e,r){"use strict";var n=Object.create,i=Object.getPrototypeOf,o={};t.exports=function(){var t=Object.setPrototypeOf,e=arguments[0]||n;return"function"==typeof t&&i(t(e(null),o))===o}},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(11),o=function(t){function e(e,r,n){void 0===n&&(n="The player that the proxy was controlling had an error.");var i=t.call(this,n)||this;return i._providedPlayerError=e,i._providedPlayer=r,i}return n(e,t),e.prototype.getCode=function(){return"PROXY_PLAYER_PROVIDED_PLAYER_ERROR"},e.prototype.getProvidedPlayerError=function(){return this._providedPlayerError},e.prototype.getProvidedPlayer=function(){return this._providedPlayer},e}(i.PlayerError);e.ProxyProvidedPlayerError=o},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),o=function(t){function e(e,r){return t.call(this,e,r)||this}return n(e,t),e.prototype.getCode=function(){return"IMPLEMENTATION_ERROR"},e}(i.PlayerFatalError);e.ImplementationError=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(3),i=function(){function t(t,e){this._inCallback=!1,this._onExit=t,this._onEnter=e||null}return t.prototype.enter=function(t){var e=this;if(this._inCallback)return t?t(this._onEnterResultRetriever):void 0;this._inCallback=!0;var r=[],i=!1;this._onEnter&&(this._onEnterResultRetriever={getResult:function(t){i?n.deferException(function(){return t(e._onEnterError,e._onEnterResult)}):r.push(t)}});try{var o=t?t(this._onEnterResultRetriever):void 0;if(this._onEnter){this._onEnterError=void 0,this._onEnterResult=void 0;try{this._onEnterResult=this._onEnter()}catch(t){this._onEnterError=t}i=!0,r.forEach(function(t){return n.deferException(function(){return t(e._onEnterError,e._onEnterResult)})})}return o}finally{this._inCallback=!1,n.deferException(function(){return e._onExit(e._onEnterError,e._onEnterResult)})}},t}();e.OnExit=i},function(t,e,r){"use strict";function n(t){var e=Object.create(null);return Object.keys(t).forEach(function(r){e[r]=t[r]}),e}Object.defineProperty(e,"__esModule",{value:!0});var i=r(30),o=r(3),s=function(){},a=function(){function t(t,e){void 0===e&&(e={});var r=this;this._subscribers=[],this._onExit=new i.OnExit(function(){return r._after()},function(){return r._onEnter()}),this._beforeUpdateError=void 0,this._inAfterUpdate=!1,this._dead=!1,this._officiallyDead=!1,this._errors=[],this._state=n(t),this._initialState=n(t),this._beforeUpdate=e.beforeUpdate||function(){},this._afterUpdate=e.afterUpdate||s,this._afterDispatches=e.afterDispatches||s}return t.prototype.subscribe=function(t,e){var r=this;if(void 0===e&&(e=!0),this._dead){var i=!1;return{retrieve:function(){},remove:function(){return!i&&(i=!0)}}}var o={callback:t,localState:e?n(this._state):this._initialState};return this._subscribers.push(o),e||this._updateSubscriber(o),{remove:function(){var e=r._subscribers.map(function(t){return t.callback}).indexOf(t);return e>=0&&(r._subscribers.splice(e,1),!0)},retrieve:function(){r._updateSubscriber(o)}}},t.prototype.subscribeIndividual=function(t,e,r){return this.subscribe(function(r){var n=r[t];void 0!==n&&e(n)},r)},t.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},t.prototype.getIndividualHandle=function(t){var e=this;return{subscribe:function(r){return e.subscribeIndividual(t,r)}}},t.prototype.update=function(t){var e=this;this._officiallyDead||(this._inAfterUpdate?t&&t(this._state,this._beforeUpdateError):this._onExit.enter(function(r){r.getResult(function(){try{t&&t(e._state,e._beforeUpdateError)}catch(t){e._errors.push(t)}})}))},t.prototype.getState=function(){return this._state},t.prototype.kill=function(){var t=this;this._dead||(this._dead=!0,window.setTimeout(function(){t._subscribers.splice(0),t._officiallyDead=!0},0))},t.prototype.isDead=function(){return this._dead},t.prototype._onEnter=function(){this._beforeUpdateError=void 0;try{this._beforeUpdate(this._state)}catch(t){this._beforeUpdateError=t}},t.prototype._after=function(){var t=this,e=this._errors;this._errors=[],o.deferException(function(){t._inAfterUpdate=!0;try{t._afterUpdate(t._state,{beforeUpdate:t._beforeUpdateError,update:e})}catch(e){throw t._inAfterUpdate=!1,e}t._inAfterUpdate=!1,t._subscribers.slice().forEach(function(e){return t._updateSubscriber(e)}),t._afterDispatches(t._state)})},t.prototype._updateSubscriber=function(t){var e=this._calculateDiff(t.localState);Object.keys(e).length&&(t.localState=n(this._state),o.deferException(function(){return t.callback(e,t.localState)}))},t.prototype._calculateDiff=function(t){var e=this,r=Object.create(null);return Object.keys(this._state).forEach(function(n){var i=e._state[n];i!==t[n]&&(r[n]=i)}),r},t}();e.StateManager=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t[t.LOADING=0]="LOADING",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.DEAD=3]="DEAD"}(e.State||(e.State={}))},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),o=function(t){function e(e){return t.call(this,e||"The player cannot play the provided descriptor.")||this}return n(e,t),e.prototype.getCode=function(){return"NOT_SUPPORTED_ERROR"},e}(i.PlayerFatalError);e.NotSupportedError=o},function(t,e,r){"use strict";function n(){return{ended:!1,loading:!1,playing:!1,actuallyPlaying:!1,volume:1,muted:!1,isFading:!1,fadeRate:null,isFadingForSeek:!1,playDeferred:null,pauseDeferred:null,ready:!1,seeking:!1,seek:null,positionJumped:null,stalled:!0,duration:null,dead:!1,state:p.State.PAUSED,fatalError:null,errorOccurred:null,position:0}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),o=r(33),s=r(6),a=r(13),u=r(17),l=r(19),c=r(8),p=r(32),d=r(12),h=r(31),f=r(29),g=r(3),_="undefined"!=typeof navigator&&"mediaSession"in navigator,y=150,v=25,m=35,b=1e3,w=_?navigator.mediaSession:null,E=function(){function t(t){var e=this;this._stateManager=new h.StateManager(n(),{afterUpdate:function(t,r){return e._afterUpdate(t,r)},afterDispatches:function(){return e._afterDispatches()},beforeUpdate:function(t){if(!t.dead&&(t.ready||!e._fatalErrorTriggered)){var r=e._getPosition(),n=t.duration;if(r<0)throw e._logger.error("Player provided invalid position.",r,n),e._triggerError(new f.ImplementationError("Player provided a position that was invalid.")),new Error("Player provided invalid position.");t.position=r,e._updateEndedInState(t)}}}),this._onError=new s.EventDispatcher,this._errors=[],this._fatalErrorTriggered=!1,this._loadingDelayTimer=null,this._stalled=!1,this._queuedDuration=null,this._readyDeferred=a.buildDeferred(),this._queuedSeekDeferreds=[],this._lastPlayError=null,this._lastPauseError=null,this._lastPlayedPosition=null,this._listenTimeBase=0,this._timePlaybackStarted=null,this._positionAfterLastUpdate=0,this._positionWhenStartedFadeOut=null,this._fadeStartAllowed=!1,this._seekFadeStartAllowed=!1,this._implementationIsFading=!1;var r=t.name;if(this._logger=d.prefixLogger(t.logger,"BasePlayer"+(r?"-"+r:"")),this._mediaSessionEnabled=!!t.mediaSessionEnabled,t.defaultFadeDuration&&t.defaultFadeDuration<0)throw new Error("defaultFadeDuration must be >= 0.");if(t.loadingDelay&&t.loadingDelay<0)throw new Error("loadingDelay must be >= 0.");this._defaultFadeDuration=void 0!==t.defaultFadeDuration?t.defaultFadeDuration:y,this._defaultSeekFadeOutDuration=void 0!==t.defaultSeekFadeOutDuration?t.defaultSeekFadeOutDuration:v,this._defaultSeekFadeInDuration=void 0!==t.defaultSeekFadeInDuration?t.defaultSeekFadeInDuration:m,this._loadingDelay=void 0!==t.loadingDelay?t.loadingDelay:b,this.onError=this._onError.getHandle(),this.whenReady=this._readyDeferred.promise,this._stateManager.subscribe(function(t,r){return e._onChange(t,r)}),this._stateManager.subscribe(function(t){var r=t.actuallyPlaying,n=t.seek;!0===r&&(e._fadeStartAllowed=!1),n&&"IN_PROGRESS"!==n.state&&(e._seekFadeStartAllowed=!1)}),this._stateManager.subscribe(function(t,r){var n=t.isFading;!r.dead&&!1===n&&e._implementationIsFading&&e._triggerError(new f.ImplementationError("Fade was still running when not allowed."))}),this._stateManager.subscribe(function(t,r){var n=t.playing,i=r.dead,o=r.fadeRate;if(!i&&void 0!==n)try{e._handlePlayPauseChange(n,{fadeRate:o||void 0}),n||(e._fadeStartAllowed=!1)}catch(t){e._triggerError(new f.ImplementationError("Exception occurred whilst handling play/pause change.",t))}}),this._stateManager.subscribe(function(t,r){var n=t.seek;if(!r.dead&&n&&"IN_PROGRESS"===n.state)try{e._seekFadeStartAllowed=!0,e._handleSeekChange(n.position,{fadeRate:{beforeSeek:n.fadeRate.beforeSeek||void 0,afterSeek:n.fadeRate.afterSeek||void 0}}),e._seekFadeStartAllowed=!1}catch(t){e._triggerError(new f.ImplementationError("Exception occurred whilst handling seek change.",t))}}),this.onChange=this._buildEventHandle(function(t,r){var n=r.ready;if(void 0!==n&&!0!==n)throw new Error("Ready state is invalid.");var i=r.duration;if(void 0!==i&&null===i)throw new Error("Duration state is invalid.");var o=r.dead;if(void 0!==o&&!0!==o)throw new Error("Dead state is invalid.");var s={ready:n,ended:r.ended,duration:i,volume:r.volume,muted:r.muted,playing:r.playing,actuallyPlaying:r.actuallyPlaying,stalled:r.stalled,loading:r.loading,fading:r.isFading,fadingForSeek:r.isFadingForSeek,playRejection:!1===r.playing?e._lastPlayError||void 0:void 0,pauseRejection:!0===r.playing?e._lastPauseError||void 0:void 0,seeking:r.seeking,seek:r.seek||void 0,positionJumped:void 0!==r.positionJumped||void 0,state:r.state,fatalError:r.fatalError||void 0,dead:o};Object.keys(s).some(function(t){return void 0!==s[t]})&&t(s)});var i=t.registerListeners;i&&g.deferException(function(){i({onChange:e.onChange,onError:e.onError})}),this._registerMediaSessionActionHandlers(),this._notifyMediaSessionPaused(),this.onDurationChange=this._buildEventHandle(function(t,e){var r=e.duration;void 0!==r&&null!==r&&t(r)}),this.onReady=this._buildEventHandle(function(t,e){!0===e.ready&&t(void 0)}),this.onStateChange=this._buildEventHandle(function(t,e){var r=e.state;void 0!==r&&t(r)}),this.onVolumeChange=this._buildEventHandle(function(t,e,r){var n=e.volume,i=e.muted,o=r.volume,s=r.muted;void 0===n&&void 0===i||t({volume:o,muted:s})}),this.onPlay=this._buildEventHandle(function(t,e){!0===e.actuallyPlaying&&t(void 0)}),this.onPlayIntent=this._buildEventHandle(function(t,e){!0===e.playing&&t(void 0)}),this.onPlayRejection=this._buildEventHandle(function(t,r){!1===r.playing&&e._lastPlayError&&t(e._lastPlayError)}),this.onPause=this._buildEventHandle(function(t,e){!1===e.actuallyPlaying&&t(void 0)}),this.onPauseIntent=this._buildEventHandle(function(t,e){!1===e.playing&&t(void 0)}),this.onPauseRejection=this._buildEventHandle(function(t,r){!0===r.playing&&e._lastPauseError&&t(e._lastPauseError)}),this.onSeek=this._buildEventHandle(function(t,e){var r=e.seek;r&&"COMPLETED"===r.state&&t(void 0)}),this.onSeekIntent=this._buildEventHandle(function(t,e){!0===e.seeking&&t(void 0)}),this.onSeekRejection=this._buildEventHandle(function(t,e){var r=e.seek;r&&"ERROR"===r.state&&t(r.error)}),this.onPositionJumped=this._buildEventHandle(function(t,e){void 0!==e.positionJumped&&t(void 0)}),this.onEnded=this._buildEventHandle(function(t,e){!0===e.ended&&t(void 0)}),this.onLeftEnded=this._buildEventHandle(function(t,e){!1===e.ended&&t(void 0)}),this.onStallStart=this._buildEventHandle(function(t,e){!0===e.stalled&&t(void 0)}),this.onStallEnd=this._buildEventHandle(function(t,e){!1===e.stalled&&t(void 0)}),this.onLoadStart=this._buildEventHandle(function(t,e){!0===e.loading&&t(void 0)}),this.onLoadEnd=this._buildEventHandle(function(t,e){!1===e.loading&&t(void 0)}),this.onFadeStart=this._buildEventHandle(function(t,e){!0===e.isFading&&t(void 0)}),this.onFadeEnd=this._buildEventHandle(function(t,e){!1===e.isFading&&t(void 0)}),this.onFadeForSeekStart=this._buildEventHandle(function(t,e){!0===e.isFadingForSeek&&t(void 0)}),this.onFadeForSeekEnd=this._buildEventHandle(function(t,e){!1===e.isFadingForSeek&&t(void 0)})}return t.prototype.isReady=function(){return this._stateManager.getState().ready},t.prototype.getPosition=function(){return this._getPositionOrPositionSeekingTo()},t.prototype.getLastPlayedPosition=function(){var t=this._stateManager.getState(),e=t.actuallyPlaying,r=t.stalled;return e&&!r?this.getPosition():this._lastPlayedPosition},t.prototype.getListenTime=function(){var t=this._stateManager.getState(),e=t.actuallyPlaying,r=t.ended,n=this._listenTimeBase;return e&&!r&&(n+=l.now()-this._timePlaybackStarted),n},t.prototype.isStalled=function(){return this._stateManager.getState().stalled},t.prototype.isLoading=function(){return this._stateManager.getState().loading},t.prototype.isFading=function(){return this._stateManager.getState().isFading},t.prototype.isFadingForSeek=function(){return this._stateManager.getState().isFadingForSeek},t.prototype.isPlaying=function(){return this._stateManager.getState().playing},t.prototype.isActuallyPlaying=function(){return this._stateManager.getState().actuallyPlaying},t.prototype.isEnded=function(){return this._stateManager.getState().ended},t.prototype.getState=function(){return this._stateManager.getState().state},t.prototype.getBufferController=function(){return null},t.prototype.getMemoryCacheMaxSize=function(){return null},t.prototype.getMemoryCacheUsage=function(){return null},t.prototype.getMemoryCacheController=function(){return null},t.prototype.getFatalError=function(){return this._stateManager.getState().fatalError},t.prototype.isDead=function(){return this._stateManager.getState().dead},t.prototype.getVolume=function(){return this._stateManager.getState().volume},t.prototype.getMuted=function(){return this._stateManager.getState().muted},t.prototype.getDuration=function(){var t=this._stateManager.getState(),e=t.ready,r=t.duration;return e?r:null},t.prototype.setVolume=function(t,e){if(t<0||t>1)throw new Error("Volume must be >= 0 and <= 1.");if(!this._stateManager.getState().dead){var r=this._stateManager.getState().muted;void 0===e&&(e=r);try{this._handleVolumeChange(t,e)}catch(t){throw this._triggerError(new f.ImplementationError("Exception occurred updating volume.",t)),t}}},t.prototype.setMuted=function(t){this.setVolume(this._stateManager.getState().volume,t)},t.prototype.getCurrentBufferedTimeRange=function(){var t=this.getBufferedTimeRanges();if(!t)return null;var e=this.getPosition();return u.find(t,function(t){return t.containsTime(e)})||null},t.prototype.play=function(t){var e=this;this._ensureNotDead(),this._logger.debug("play() called.",t);var r=a.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing)e._logger.debug("Intent is already to be playing.");else{e._logger.debug("Requesting play."),n.playing=!0;var i=e._extractFadeDuration(t);n.fadeRate=i?1/i:null,e._lastPlayError=null}n.playDeferred&&!n.playDeferred.isSettled()||(n.playDeferred=a.buildDeferred()),r.resolve(n.playDeferred.promise)}),r.promise}catch(t){return this._triggerError(new i.PlayerFatalError("Unexpected error when attempting to play.",t)),c.Promise.reject(t)}},t.prototype.pause=function(t){var e=this;this._ensureNotDead(),this._logger.debug("pause() called.",t);var r=a.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing){e._logger.debug("Requesting pause."),e._positionWhenStartedFadeOut=e._getPositionOrPositionSeekingTo(),n.playing=!1;var i=e._extractFadeDuration(t);n.fadeRate=i?1/i*-1:null,e._fadeStartAllowed=!0,e._lastPauseError=null}else e._logger.debug("Intent is already to be paused.");n.pauseDeferred&&!n.pauseDeferred.isSettled()||(n.pauseDeferred=a.buildDeferred()),r.resolve(n.pauseDeferred.promise)}),r.promise}catch(t){return this._triggerError(new i.PlayerFatalError("Unexpected error when attempting to pause.",t)),c.Promise.reject(t)}},t.prototype.seek=function(t,e){var r=this;this._ensureNotDead(),this._logger.debug("seek() called.",t);var n=a.buildDeferred();return this._stateManager.update(function(i){if(t<0)r._logger.warn("Rejecting seek immediately as the position was negative."),n.reject(new Error("You were attempting to seek to a negative time."));else if(null!==i.duration&&t>i.duration)r._logger.warn("Rejecting seek immediately as the duration is now known, and the requested positon was past it."),n.reject(new Error("You were attempting to seek past the end of the media."));else{i.stalled||!i.actuallyPlaying||i.seek&&"IN_PROGRESS"===i.seek.state||(r._lastPlayedPosition=r._getPositionOrPositionSeekingTo());var o=a.buildDeferred();if(i.seek&&"IN_PROGRESS"===i.seek.state&&i.seek.position===t)r._logger.debug("Seek already requested to the same position.",t);else{r._logger.debug("Requesting seek.",t),i.seeking=!0,r._positionWhenStartedFadeOut=null;var s=r._extractSeekFadeDurations(e,t),u=s.fadeOutDuration?1/s.fadeOutDuration*-1:null,l=s.fadeInDuration?1/s.fadeInDuration:null;i.seek={state:"IN_PROGRESS",position:t,fadeRate:{beforeSeek:u,afterSeek:l}},i.positionJumped=Object.create(null)}r._queuedSeekDeferreds.push({position:t,deferred:o}),n.resolve(o.promise)}}),n.promise},t.prototype.getSeekState=function(){return this._stateManager.getState().seek},t.prototype.kill=function(){var t=this;this._stateManager.update(function(e){e.dead||(t._logger.debug("kill() called."),e.dead=!0)})},t.prototype._update=function(t){this._stateManager.update(function(){return t&&t()})},t.prototype._ensureNotDead=function(){if(this._stateManager.getState().dead)throw new Error("Player is dead.")},t.prototype._notifyStalled=function(t){this._ensureNotDead(),this._stalled!==t&&(this._logger.debug("notifyStalled() called.",t),this._stalled=t,this._stateManager.update())},t.prototype._getQueuedSeekPosition=function(){var t=this.getSeekState();return t&&"IN_PROGRESS"===t.state?t.position:null},t.prototype._provideDuration=function(t){var e=this;this._ensureNotDead(),this._stateManager.update(function(r){if(r.duration!==t){var n=e._getPositionOrPositionSeekingTo();if(t<0||r.ready&&n>t)throw e._triggerError(new f.ImplementationError("Attempt to update duration to an invalid value.")),new Error("Duration cannot be less than the current position.");e._logger.debug("provideDuration() called.",t),r.ready?r.duration=t:e._queuedDuration=t}})},t.prototype._notifyVolumeChange=function(t,e){if(t<0||t>1)throw this._triggerError(new f.ImplementationError("Volume was out of range.",t)),new Error("Volume was out of range.");this._stateManager.update(function(r){r.volume=t,r.muted=e})},t.prototype._notifyPlaying=function(t){var e=this;this._ensureNotDead(),this._stateManager.update(function(r){if(!r.ready)throw e._triggerError(new f.ImplementationError("Attempt to register playback as started before ready.")),new Error("Player must be ready first.");t!==r.actuallyPlaying&&(e._logger.debug("notifyPlaying() called.",t),t||r.seeking||r.stalled||(e._lastPlayedPosition=e._getPositionOrPositionSeekingTo()),r.actuallyPlaying=r.playing=t,t?(e._lastPlayError=null,e._fadeStartAllowed=!0):(r.isFading=!1,e._fadeStartAllowed=!1,e._lastPauseError=null))})},t.prototype._notifyPlayRejection=function(t){var e=this;this._ensureNotDead(),t=t||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw e._triggerError(new f.ImplementationError("Attempt to reject a play request before player ready.")),new Error("Player must be ready first.");if(r.actuallyPlaying||!r.playing)throw e._triggerError(new f.ImplementationError("Attempt to reject a play request when not valid.")),new Error("Playing state is incorrect.");e._logger.debug("notifyPlayRejection() called.",t),r.playing=!1,e._lastPlayError=t})},t.prototype._notifyPauseRejection=function(t){var e=this;this._ensureNotDead(),t=t||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw e._triggerError(new f.ImplementationError("Attempt to reject pause request before player ready.")),new Error("Player must be ready first.");if(!r.actuallyPlaying||r.playing)throw e._triggerError(new f.ImplementationError("Attempt to reject pause request when not valid.")),new Error("Playing state is incorrect.");e._logger.debug("notifyPauseRejection() called.",t),r.playing=!0,r.fadeRate&&(r.fadeRate*=-1),e._lastPauseError=t})},t.prototype._notifySeekRejection=function(t){var e=this;this._ensureNotDead(),t=t||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw e._triggerError(new f.ImplementationError("Attempt to reject seek request before player ready.")),new Error("Player must be ready first.");if(!r.seek||"IN_PROGRESS"!==r.seek.state)throw e._triggerError(new f.ImplementationError("Attempt to reject seek request when none requested.")),new Error("A seek hasn't been requested.");if(null!==r.duration&&r.position>r.duration)throw e._triggerError(new f.ImplementationError("Attempt to reject seek request after duration changed below current position.")),new Error("Attempt to reject seek request after duration changed below current position.");e._logger.debug("notifySeekRejection() called.",t),r.seeking=!1,r.seek={state:"ERROR",error:t},r.positionJumped=Object.create(null)})},t.prototype._notifyFading=function(t){var e=this;if(this._ensureNotDead(),t&&!this._fadeStartAllowed){var r="Attempt to register fade as starting when not allowed.";throw this._triggerError(new f.ImplementationError(r)),new Error(r)}this._implementationIsFading=t,this._stateManager.update(function(r){r.isFading!==t&&(e._logger.debug("notifyFading() called",t),t||r.playing||null===e._positionWhenStartedFadeOut||e.seek(e._positionWhenStartedFadeOut,{fadeInDuration:0,fadeOutDuration:0}).catch(function(t){e._logger.warn("Seek back to position where fade out started failed.",t)}),r.isFading=t)})},t.prototype._notifyFadingForSeek=function(t){var e=this;if(this._ensureNotDead(),t&&!this._seekFadeStartAllowed){var r="Attempt to register fade as starting for seek when not allowed.";throw this._triggerError(new f.ImplementationError(r)),new Error(r)}this._stateManager.update(function(r){r.isFadingForSeek!==t&&(e._logger.debug("notifyFadingForSeek() called",t),r.isFadingForSeek=t)})},t.prototype._signalReady=function(){var t=this;this._ensureNotDead(),this._stateManager.update(function(e){if(e.ready)throw t._triggerError(new f.ImplementationError("Attempt to signal ready twice.")),new Error("Ready already signalled.");if(null===t._queuedDuration)throw t._triggerError(new f.ImplementationError("Attempt to signal ready when duration unknown.")),new Error("Duration is still unknown.");t._logger.debug("signalReady() called."),e.ready=!0,e.duration=t._queuedDuration,e.seek&&"IN_PROGRESS"===e.seek.state&&e.seek.position>e.duration&&(e.seeking=!1,e.seek={state:"ERROR",error:new Error("You were attempting to seek past the end of the media.")})})},t.prototype._signalSeekComplete=function(){var t=this;this._ensureNotDead(),this._stateManager.update(function(e){if(!e.ready)throw t._triggerError(new f.ImplementationError("Attempt to signal seek as complete before player ready.")),new Error("Player must be ready first.");if(!e.seek||"IN_PROGRESS"!==e.seek.state)throw t._triggerError(new f.ImplementationError("Attempt to signal seek as complete when none requested.")),new Error("There shouldn't be a seek in progress.");var r=e.duration;if(e.seek&&"IN_PROGRESS"===e.seek.state&&e.seek.position>r)throw new Error("Seek cannot have completed given it was to a time greater than the duration.");t._logger.debug("signalSeekComplete() called."),t._seekFadeStartAllowed=!0,e.seek={state:"COMPLETED",position:e.seek.position,fadeRate:e.seek.fadeRate},e.seeking=!1,e.position=e.seek.position})},t.prototype._triggerError=function(t){var e=this;t instanceof i.PlayerFatalError&&(this._fatalErrorTriggered=!0),this._stateManager.update(function(r){var n=!1;if(r.ready&&t instanceof o.NotSupportedError&&(t=new f.ImplementationError("Invalid NotSupportedError."),n=!0),t instanceof i.PlayerFatalError?(t instanceof o.NotSupportedError?e._logger.info("NotSupportedError occurred.",t):e._logger.error("Fatal error occurred.",t),r.fatalError?e._logger.warn("A fatal error already occurred.",r.fatalError):r.fatalError=t,e._errors.push(t),r.errorOccurred=Object.create(null),r.dead=!0):(e._logger.warn("Non-fatal error occurred.",t),e._errors.push(t),r.errorOccurred=Object.create(null)),n)throw new Error("Not supported errors are only valid before the player is ready.")})},t.prototype._buildEventHandle=function(t){var e=this;return{subscribe:function(r){var n=function(t){return r(t,l.now())};return e._stateManager.subscribe(function(e,r){t(n,e,r)})}}},t.prototype._finalizeState=function(t){this._updateEndedInState(t);var e=this._getPositionOrPositionSeekingTo();if(t.dead)this._lastPlayError=new Error("Player was killed."),t.loading=!1,this._clearLoadingDelay(),!t.playing&&t.isFading&&null!==this._positionWhenStartedFadeOut&&(this._logger.debug("Fade out was in progress. Pretending it completed."),t.isFading=!1,t.position=this._positionWhenStartedFadeOut),t.stalled=!0,t.actuallyPlaying=!1,t.isFadingForSeek=!1,t.playing=!1,t.state=p.State.DEAD;else{var r=!t.ended&&(!t.ready||this._stalled||!(!t.seek||"IN_PROGRESS"!==t.seek.state));r&&!t.stalled&&!t.seeking&&t.actuallyPlaying&&(this._lastPlayedPosition=e),t.stalled=r;!t.ended&&!t.isFading&&!t.isFadingForSeek&&(t.playing||t.actuallyPlaying)&&(t.stalled||t.playing!==t.actuallyPlaying)?this._loadingDelay?this._scheduleLoadingDelay():t.loading=!0:(t.loading=!1,this._clearLoadingDelay()),this._positionAfterLastUpdate!==e&&(this._positionAfterLastUpdate=e,t.playing||t.actuallyPlaying||(t.positionJumped=Object.create(null))),t.state=this._calculateState(t)}},t.prototype._updateEndedInState=function(t){t.ended=t.ready&&this._getPositionOrPositionSeekingTo()===t.duration},t.prototype._scheduleLoadingDelay=function(){var t=this;this._loadingDelayTimer||(this._loadingDelayTimer=window.setTimeout(function(){t._stateManager.update(function(t){return t.loading=!0})},this._loadingDelay))},t.prototype._clearLoadingDelay=function(){this._loadingDelayTimer&&(window.clearTimeout(this._loadingDelayTimer),this._loadingDelayTimer=null)},t.prototype._getPositionOrPositionSeekingTo=function(){this._stateManager.update();var t=this._stateManager.getState();return t.seek&&"IN_PROGRESS"===t.seek.state?t.seek.position:t.isFading&&!t.playing&&null!==this._positionWhenStartedFadeOut?this._positionWhenStartedFadeOut:t.ready&&null!==t.duration?t.position:0},t.prototype._calculateState=function(t){var e=t.dead,r=t.loading,n=t.playing,i=t.ended;return e?p.State.DEAD:r?p.State.LOADING:n&&!i?p.State.PLAYING:p.State.PAUSED},t.prototype._registerMediaSessionActionHandlers=function(){var t=this;this._mediaSessionEnabled&&w&&(w.setActionHandler("play",function(){t.isDead()||t.play()}),w.setActionHandler("pause",function(){t.isDead()||t.pause()}),w.setActionHandler("seekbackward",function(){t.isDead()||t.seek(Math.max(0,t.getPosition()-5e3))}),w.setActionHandler("seekforward",function(){t.isDead()||t.seek(Math.min(t.getDuration()||0,t.getPosition()+5e3))}))},t.prototype._notifyMediaSessionPlaying=function(){this._mediaSessionEnabled&&w&&(w.playbackState="playing")},t.prototype._notifyMediaSessionPaused=function(){this._mediaSessionEnabled&&w&&(w.playbackState="paused")},t.prototype._extractFadeDuration=function(t){return void 0===t&&(t={}),void 0===t.fadeDuration?!this._stateManager.getState().playing||this._getPositionOrPositionSeekingTo()>0?this._defaultFadeDuration:0:t.fadeDuration>0?t.fadeDuration:0},t.prototype._extractSeekFadeDurations=function(t,e){void 0===t&&(t={});var r;r=void 0!==t.fadeOutDuration?t.fadeOutDuration>0?t.fadeOutDuration:0:this._defaultSeekFadeOutDuration;var n;return n=void 0!==t.fadeInDuration?t.fadeInDuration>0?t.fadeInDuration:0:e>0?this._defaultSeekFadeInDuration:0,{fadeOutDuration:r,fadeInDuration:n}},t.prototype._afterUpdate=function(t,e){if(e.beforeUpdate||e.update.length>0)this._logger.error("Errors occurred during state update. Killing player.",e),this._triggerError(new i.PlayerFatalError("Errors occurred during state update.",e));else if(!t.dead&&t.ready){var r=t.duration;null!==r&&!t.seeking&&t.position>r&&(this._logger.error("Player provided invalid position.",t.position,r),this._triggerError(new f.ImplementationError("Player provided a position that was invalid.")))}this._finalizeState(t)},t.prototype._afterDispatches=function(){var t=this,e=this._errors;this._errors=[],e.forEach(function(e){return t._onError.dispatch(e)})},t.prototype._onChange=function(t,e){var r=this,n=t.ready,i=t.dead,o=t.fatalError,s=t.playing,a=t.actuallyPlaying,u=t.ended;if(!0===n&&(this._logger.debug("Resolving ready deferred."),this._readyDeferred.resolve(void 0)),!0===a&&this._registerMediaSessionActionHandlers(),!0===s?this._notifyMediaSessionPlaying():!1===s&&this._notifyMediaSessionPaused(),e.pauseDeferred&&!e.pauseDeferred.isSettled()&&e.playing){var c=this._lastPauseError||new Error("Pause request aborted.");this._logger.debug("Rejecting pause deferred.",c),e.pauseDeferred.reject(c)}if(e.playDeferred&&!e.playDeferred.isSettled()&&!e.playing){var c=this._lastPlayError||new Error("Play request aborted.");this._logger.debug("Rejecting play deferred.",c),e.playDeferred.reject(c)}if(e.playDeferred&&!e.playDeferred.isSettled()&&e.actuallyPlaying&&(this._logger.debug("Resolving play deferred."),e.playDeferred.resolve(void 0)),!e.pauseDeferred||e.pauseDeferred.isSettled()||e.actuallyPlaying||(this._logger.debug("Resolving pause deferred."),e.pauseDeferred.resolve(void 0)),!0===a&&!e.ended||!1===u&&e.actuallyPlaying?this._timePlaybackStarted=l.now():(!1===a&&!e.ended||!0===u&&e.actuallyPlaying)&&(this._listenTimeBase+=l.now()-this._timePlaybackStarted,this._timePlaybackStarted=null),this._queuedSeekDeferreds=this._queuedSeekDeferreds.filter(function(t){var n=t.position,i=t.deferred;if(e.seek)if("IN_PROGRESS"!==e.seek.state){if(!e.stalled||"ERROR"===e.seek.state)return"ERROR"!==e.seek.state?(r._logger.debug("Resolving seek()."),i.resolve(void 0)):(r._logger.debug("Rejecting seek().",e.seek.error),i.reject(e.seek.error)),!1}else if("IN_PROGRESS"!==e.seek.state||e.seek.position!==n)return r._logger.debug("Rejecting seek() because another seek was requested.",n),i.reject(new Error("Seek request aborted because another seek was requested to a different position.")),!1;return!0}),!0===i){this._logger.debug("Calling _kill() on player.");try{this._kill(),this._logger.info("Player killed.")}catch(t){this._triggerError(new f.ImplementationError("Exception occurred in _kill().",t)),this._logger.error("Exception when implementation was being killed.",t)}if(!e.ready){var c=o||new Error("Player was killed.");this._logger.debug("Rejecting whenReady."),this._readyDeferred.reject(c)}this._queuedSeekDeferreds.forEach(function(t){var e=t.position,n=t.deferred,i=o||new Error("Seek aborted as player killed.");r._logger.debug("Rejecting seek().",e),n.reject(i)}),this._stateManager.kill(),this._logger.debug("Player dead.")}},t}();e.BasePlayer=E},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var o=r(34),s=r(11),a=r(5),u=r(12),l=r(6),c=r(28),p=r(16),d=function(t){function e(e){var r=t.call(this,e)||this;return r._onProvidedPlayerError=new l.EventDispatcher,r._errorHandler=null,r._changeHandler=null,r._player=null,r._instanceLock=null,r._playConfig=void 0,r._pauseConfig=void 0,r._seekConfig=void 0,r._lastPlayerPosition=0,r._synced=!1,r._unsyncInProgress=!1,r._logger=u.prefixLogger(r._logger,"ProxyPlayerBase"),r.onProvidedPlayerError=r._onProvidedPlayerError.getHandle(),r}return n(e,t),e.prototype.play=function(e){return this._playConfig=e,t.prototype.play.call(this)},e.prototype.pause=function(e){return this._pauseConfig=e,t.prototype.pause.call(this)},e.prototype.seek=function(e,r){return this._seekConfig=r,t.prototype.seek.call(this,e)},e.prototype.getBufferedTimeRanges=function(){return this._player&&this._synced?this._player.getBufferedTimeRanges():null},e.prototype.getCurrentBufferedTimeRange=function(){return this._player&&this._synced?this._player.getCurrentBufferedTimeRange():null},e.prototype.getMaxBufferLength=function(){return this._player&&this._synced?this._player.getMaxBufferLength():null},e.prototype._providePlayer=function(t,e){if(void 0===e&&(e={}),e=i({syncPosition:!0,syncVolume:!0},e),this._ensureNotDead(),this._player)throw new Error("A player has already been provided.");this._logger.debug("providePlayer() called."),this._instanceLock=Object.create(null),this._player=t,this._sync(e)},e.prototype._removePlayer=function(){var t=this;if(this._ensureNotDead(),!this._player)throw new Error("There is no player to remove.");if(this._unsyncInProgress)throw new Error("Player is currently unsyncing.");this._logger.debug("removePlayer() called."),this._instanceLock=null,this._unsync(),this._player=null,this.isReady()&&!this.isDead()&&this._update(function(){var e=null!==t._getQueuedSeekPosition();t._notifyFading(!1),e||null===t._getQueuedSeekPosition()||t._signalSeekComplete(),t._notifyFadingForSeek(!1),t._notifyStalled(!0)})},e.prototype._setInitialDuration=function(t){var e=this;if(this._ensureNotDead(),t<0)throw new Error("Cannot set duration to a value < 0.");null===this.getDuration()&&this._update(function(){e._ensureBelowPosition(t),e._provideDuration(t),e.isReady()||(e._signalReady(),e._handleSkippedSeek())})},e.prototype._triggerError=function(e){t.prototype._triggerError.call(this,e)},e.prototype._getPlayer=function(){return this.isDead()?null:this._player},e.prototype._handleVolumeChange=function(t,e){this._synced&&this._player?this._player.setVolume(t,e):this._notifyVolumeChange(t,e)},e.prototype._handlePlayPauseChange=function(t){var e=this,r=this._player;r&&this._update(function(){t?e._playAndHandleAbort(r):(e._pauseAndHandleAbort(r),r.isFading()&&e._notifyFading(!0))})},e.prototype._handleSeekChange=function(t){var e=this._player;if(e&&this._synced){var r=this._seekConfig;this._seekConfig=void 0,e.seek(t,r),e.isFadingForSeek()&&this._notifyFadingForSeek(!0)}},e.prototype._getPosition=function(){if(this._player&&this._synced){if(!this._changeHandler)throw new Error("Handler should exist.");if(this._changeHandler.retrieve(),this._synced)return this._player.getPosition()}return this._lastPlayerPosition},e.prototype._kill=function(){this._player&&(this._unsync(),this._player.kill()),this._player=null},e.prototype._handleSkippedSeek=function(){if(this._player&&this._synced){var t=this.getSeekState(),e=this._player.getSeekState();!t||"IN_PROGRESS"!==t.state||e&&"IN_PROGRESS"===e.state||(this._logger.debug("Signalling seek as complete on proxy because provided player isn't seeking."),this._signalSeekComplete())}},e.prototype._ensureBelowPosition=function(t){this.getPosition()>t&&(this._logger.debug("Capping position.",t),this.seek(t),this.isReady()&&(this._lastPlayerPosition=t,this._signalSeekComplete()))},e.prototype._sync=function(t){var e=this,r=this._player;if(!r)throw new Error("Player should have become available by now.");if(this._logger.debug("Syncing...",this.isPlaying(),this.isActuallyPlaying()),r.isDead()){this._logger.debug("Provided player is dead.");var n=r.getFatalError();return void(n&&this._handleFatalError(n,r))}this._errorHandler=r.onError.subscribe(function(t){t instanceof a.PlayerFatalError?e._onProvidedPlayerError.dispatch(new p.ProxyProvidedPlayerFatalError(t,r)):(e._triggerError(t),e._onProvidedPlayerError.dispatch(new c.ProxyProvidedPlayerError(t,r)))}),this._changeHandler=r.onChange.subscribe(function(t){e._update(function(){if(e._logger.debug("Handling changes.",t),t.dead)return e._logger.debug("Player has gone to DEAD state."),e._unsync(),void(e.isDead()||t.fatalError&&e._handleFatalError(t.fatalError,r));if(void 0===t.volume&&void 0===t.muted||e._notifyVolumeChange(r.getVolume(),r.getMuted()),void 0!==t.duration&&(e._ensureBelowPosition(t.duration),e._provideDuration(t.duration),e.isReady()||(e._signalReady(),e._handleSkippedSeek(),e._notifyStalled(r.isStalled()))),t.seek){var n=e.getSeekState();n&&"IN_PROGRESS"===n.state||"IN_PROGRESS"!==t.seek.state?n&&"IN_PROGRESS"===n.state&&("COMPLETED"===t.seek.state&&n.position===t.seek.position?(e._signalSeekComplete(),r.isFadingForSeek()&&e._notifyFadingForSeek(!0)):"COMPLETED"===t.seek.state&&n.position!==t.seek.position?e._notifySeekRejection(new Error("Another seek occurred to a different position.")):"IN_PROGRESS"===t.seek.state&&n.position!==t.seek.position?e.seek(t.seek.position):"ERROR"===t.seek.state&&e._notifySeekRejection(t.seek.error)):e.seek(t.seek.position)}void 0!==t.stalled&&e._notifyStalled(t.stalled),!1===t.playing&&t.playRejection?e.isActuallyPlaying()?(e._triggerError(new s.PlayerError("Paused because a player was provided that refused to play.")),e._notifyPlaying(!1)):e._notifyPlayRejection(t.playRejection):!1===t.playing&&(r.isActuallyPlaying()?e.pause():void 0===t.actuallyPlaying&&e.isReady()&&e._notifyPlaying(!1)),!0===t.playing&&t.pauseRejection?e._notifyPauseRejection(t.pauseRejection):!0===t.playing&&e.play(),void 0!==t.actuallyPlaying&&t.actuallyPlaying!==e.isActuallyPlaying()&&(e._notifyPlaying(t.actuallyPlaying),t.actuallyPlaying&&r.isFading()&&e._notifyFading(!0)),!1===t.fading&&e._notifyFading(!1),!1===t.fadingForSeek&&e._notifyFadingForSeek(!1)})}),this._update(function(){var n=e._instanceLock;try{if(e._notifyStalled(r.isStalled()),r.isReady()){var i=r.getDuration();e._ensureBelowPosition(i),e._provideDuration(i),e.isReady()||(e._logger.debug("Provided player is already ready. Making proxy player ready."),e._signalReady())}if(t.syncVolume&&(r.setVolume(e.getVolume(),e.getMuted()),e._instanceLock!==n))return;var o=e.getSeekState();if(t.syncPosition){e._logger.debug("Seeking to match position.");var s=e.getPosition();r.getPosition()!==s?r.seek(s):(e._logger.debug("Skipping seek because already at same position."),e.isReady()&&o&&"IN_PROGRESS"===o.state&&e._signalSeekComplete())}else if(o&&"IN_PROGRESS"===o.state){e._logger.debug("Seeking to match position because a seek has been queued.");var u=e._seekConfig;e._seekConfig=void 0,r.seek(e.getPosition(),u)}else{var l=r.getSeekState();l&&"IN_PROGRESS"===l.state&&(e._logger.debug("Seeking on proxy to match seek that is in progress on provided player."),e.seek(l.position))}if(e._instanceLock!==n)return;if(r.isActuallyPlaying()?(e._logger.debug("Provided player is already playing."),e.isActuallyPlaying()||(e._notifyPlaying(!0),r.isFading()&&e._notifyFading(!0))):r.isPlaying()?(e._logger.debug("Provided player is preparing to play."),e.play()):e.isPlaying()?(e._logger.debug("Calling play() on provided player to match proxy."),e._playAndHandleAbort(r)):e.isReady()&&e.isActuallyPlaying()&&(e._logger.debug("Switching to paused state, as provided player and proxy intended state is paused."),e._notifyPlaying(!1)),e._instanceLock!==n)return;e._synced=!0,e._notifyVolumeChange(r.getVolume(),r.getMuted())}catch(t){e._triggerError(new a.PlayerFatalError("Unexpected error occurred whilst syncing.",t))}})},e.prototype._playAndHandleAbort=function(t){var e=this._instanceLock;this._logger.debug("Calling play() on provided player.");var r=this._playConfig;this._playConfig=this._pauseConfig=void 0,t.play(r),this._instanceLock===e&&!t.isPlaying()&&this.isPlaying()&&(this._logger.debug("Provided player was not playing after play() call completed."),this.isActuallyPlaying()?(this._triggerError(new s.PlayerError("Paused because a player was provided that refused to play.")),this._notifyPlaying(!1)):this.pause())},e.prototype._pauseAndHandleAbort=function(t){var e=this._instanceLock;this._logger.debug("Calling pause() on provided player.");var r=this._pauseConfig;this._playConfig=this._pauseConfig=void 0,t.pause(r),this._instanceLock===e&&t.isPlaying()&&!this.isPlaying()&&(this._logger.debug("Provided player was not paused after pause() call completed."),this.play())},e.prototype._unsync=function(){if(this._logger.debug("Unsyncing..."),this._changeHandler&&(this._changeHandler.remove(),this._changeHandler=null),this._errorHandler&&(this._errorHandler.remove(),this._errorHandler=null),!this._synced)return void this._logger.debug("Unsynced. (Sync never completed)");this._synced=!1,this._unsyncInProgress=!0;var t=this._player;if(t)try{this._lastPlayerPosition=t.getPosition()}catch(t){this._logger.error("Error whilst unsyncing.",t)}this._unsyncInProgress=!1,this._logger.debug("Unsynced.",this.isPlaying(),this.isActuallyPlaying())},e}(o.BasePlayer);e.ProxyPlayerBase=d},function(t,e,r){"use strict";function n(){return h}function i(){return y}function o(){return _}function s(){return f}function a(){return g}function u(){return p(v)}function l(){return p(m)}function c(){return p(b)}function p(t){var e=navigator.userAgent.match(t);if(e&&e.length>=3){var r=parseInt(e[1],10),n=parseInt(e[2],10);if(!isNaN(r)&&!isNaN(n))return{major:r,minor:n}}return null}Object.defineProperty(e,"__esModule",{value:!0});var d="undefined"!=typeof navigator?navigator.userAgent:"",h=!/chrome|opera/i.test(d)&&/safari/i.test(d),f=d.indexOf("MSIE ")>=0||d.indexOf("Trident/")>=0,g=d.indexOf("Edge/")>=0,_=/Chrom(?:e|ium)/.test(d),y=d.toLowerCase().indexOf("firefox")>=0,v=/version\/(\d+)\.(\d+)/i,m=/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)/,b=/Firefox\/(\d+)\.(\d+)/;e.isSafari=n,e.isFirefox=i,e.isChrome=o,e.isIE=s,e.isEdge=a,e.getSafariVersion=u,e.getChromeVersion=l,e.getFirefoxVersion=c},function(t,e,r){"use strict";function n(t,e){var r=e.convertResult,n=e.convertProgressUpdate,i=e.abortableJobOpts,s=e.passThroughAbort,a=void 0===s||s;return new l(function(){var e=t(),i=new u.EventDispatcher,s=!0,l=o.buildDeferred();return n&&e.onProgressUpdate(function(t){i.dispatch(n(t,s)),s=!1},{skipPast:!0}),e.onCompletion(function(t){try{l.resolve(r(t))}catch(t){l.reject(t)}}),e.onError(l.reject),{result:l.promise,progressUpdates:n?{onProgressUpdate:i,getProgressSoFar:function(){var t=e.getProgressSoFar();if(t){var r=n(t,s);return s=!1,r}return null}}:void 0,abort:function(){return a&&e.abort()}}},i)}Object.defineProperty(e,"__esModule",{value:!0});var i=r(8),o=r(13),s=r(18),a=r(3),u=r(6);e.abortedError=new Error("Job aborted."),e.map=n;var l=function(){function t(t,e){void 0===e&&(e={}),this._job=t,this._opts=e,this._counter=0,this._jobControl=null,this._promise=null,this._jobCompleted=!1}return t.prototype.run=function(){var t,r=this;if(this._jobControl)t=this._jobControl;else{try{t=this._jobControl=this._job()}catch(e){t=this._jobControl={result:i.Promise.reject(e)}}this._promise=t.result,s.always(this._promise,function(){r._jobCompleted=!0,r._opts.storeResult||(r._jobCompleted=!1,r._promise=null,r._jobControl=null)})}var n=this._promise;this._counter++;var u=o.buildDeferred(),l=!1,c=!1,p=void 0,d=!1,h=[],f=[],g=[],_=function(){d||(l=!0,r._counter--),h.forEach(function(t){return t.remove()})};return s.always(n,_),n.then(function(t){d||(p=t,f.forEach(function(e){return a.deferException(function(){return e(t)})}),f.splice(0),u.resolve(t))},function(t){d||(c=!0,p=t,g.forEach(function(e){return e(t)}),g.splice(0),u.reject(t))}),{whenComplete:function(){return u.promise},onProgressUpdate:function(e,r){if(void 0===r&&(r={}),t.progressUpdates){if(!d&&!l){var n=t.progressUpdates.onProgressUpdate.subscribe(function(t){return e(t)});h.push(n)}if(!r.skipPast){var i=t.progressUpdates.getProgressSoFar();i&&e(i)}}},getProgressSoFar:function(){return t.progressUpdates?t.progressUpdates.getProgressSoFar():null},onCompletion:function(t){l?!c&&a.deferException(function(){return t(p)}):f.push(t)},onError:function(t){d?a.deferException(function(){return t(e.abortedError)}):l?c&&a.deferException(function(){return t(p)}):g.push(t)},hasCompleted:function(){return l},hasErrored:function(){return c},isAborted:function(){return d},abort:function(){d||l||(d=!0,h.forEach(function(t){return t.remove()}),0==--r._counter&&!r._jobCompleted&&r._jobControl&&r._jobControl.abort&&(r._jobControl.abort(),r._promise=null,r._jobControl=null),g.forEach(function(t){return a.deferException(function(){return t(e.abortedError)})}),u.reject(e.abortedError))}}},t}();e.AbortableJob=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){if(this.start=t,this.duration=e,e<0)throw new RangeError("Duration must be >= 0.");this.end=t+e}return t.normalizeRawTimeRanges=function(t){return t.slice(0).sort(function(t,e){return t.start-e.start}).reduce(function(t,e,r){var n=t.length-1;return r>0&&t[n].end>=e.start?t[n].end=e.end:t.push(e),t},[])},t.normalize=function(e){return t.normalizeRawTimeRanges(e.map(function(t){return{start:t.start,end:t.end}})).map(function(e){return new t(e.start,e.end-e.start)})},t.getCoverage=function(e){if(0===e.length)return new t(0,0);var r=1/0,n=0;return e.forEach(function(t){t.start<r&&(r=t.start),t.end>n&&(n=t.end)}),new t(r,n-r)},t.rangesContainTime=function(t,e){return e.some(function(e){return e.containsTime(t)})},t.prototype.containsTime=function(t){return this.start<=t&&this.end>t},t}();e.TimeRange=n},function(t,e,r){"use strict";t.exports=function(){return"function"==typeof WeakMap&&"[object WeakMap]"===Object.prototype.toString.call(new WeakMap)}()},function(t,e,r){"use strict";var n=r(10),i=r(1),o=r(9),s=r(21),a=Array.isArray,u=Function.prototype.call,l=Array.prototype.some;t.exports=function(t,e){var r,c,p,d,h,f,g,_,y=arguments[2];if(a(t)||n(t)?r="array":o(t)?r="string":t=s(t),i(e),p=function(){d=!0},"array"===r)return void l.call(t,function(t){return u.call(e,y,t,p),d});if("string"!==r)for(c=t.next();!c.done;){if(u.call(e,y,c.value,p),d)return;c=t.next()}else for(f=t.length,h=0;h<f&&(g=t[h],h+1<f&&(_=g.charCodeAt(0))>=55296&&_<=56319&&(g+=t[++h]),u.call(e,y,g,p),!d);++h);}},function(t,e,r){"use strict";var n=r(10),i=r(4),o=r(9),s=r(2).iterator,a=Array.isArray;t.exports=function(t){return!(!i(t)||!a(t)&&!o(t)&&!n(t)&&"function"!=typeof t[s])}},function(t,e,r){"use strict";var n=r(41);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},function(t,e,r){"use strict";var n,i=r(15),o=r(7),s=r(2),a=r(20),u=Object.defineProperty;n=t.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),a.call(this,t),u(this,"__length__",o("",t.length))},i&&i(n,a),delete n.prototype.constructor,n.prototype=Object.create(a.prototype,{_next:o(function(){if(this.__list__)return this.__nextIndex__<this.__length__?this.__nextIndex__++:void this._unBind()}),_resolve:o(function(t){var e,r=this.__list__[t];return this.__nextIndex__===this.__length__?r:(e=r.charCodeAt(0),e>=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,s.toStringTag,o("c","String Iterator"))},function(t,e,r){"use strict";var n=r(1),i=r(0),o=Function.prototype.bind,s=Function.prototype.call,a=Object.keys,u=Object.prototype.propertyIsEnumerable;t.exports=function(t,e){return function(r,l){var c,p=arguments[2],d=arguments[3];return r=Object(i(r)),n(l),c=a(r),d&&c.sort("function"==typeof d?o.call(d,r):void 0),"function"!=typeof t&&(t=c[t]),s.call(t,c,function(t,n){return u.call(r,t)?s.call(l,p,r[t],t,r,n):e})}}},function(t,e,r){"use strict";t.exports=r(44)("forEach")},function(t,e,r){"use strict";var n=r(1),i=r(45),o=Function.prototype.call;t.exports=function(t,e){var r={},s=arguments[2];return n(e),i(t,function(t,n,i,a){r[n]=o.call(e,s,t,n,i,a)}),r}},function(t,e,r){"use strict";t.exports=function(t){return t=Number(t),isNaN(t)||0===t?t:t>0?1:-1}},function(t,e,r){"use strict";t.exports=function(){var t=Math.sign;return"function"==typeof t&&1===t(10)&&-1===t(-20)}},function(t,e,r){"use strict";t.exports=r(48)()?Math.sign:r(47)},function(t,e,r){"use strict";var n=r(49),i=Math.abs,o=Math.floor;t.exports=function(t){return isNaN(t)?0:(t=Number(t),0!==t&&isFinite(t)?n(t)*o(i(t)):t)}},function(t,e,r){"use strict";var n=r(50),i=Math.max;t.exports=function(t){return i(0,n(t))}},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call(r(24));t.exports=function(t){return"function"==typeof t&&n.call(t)===i}},function(t,e,r){"use strict";var n=r(2).iterator,i=r(10),o=r(52),s=r(51),a=r(1),u=r(0),l=r(4),c=r(9),p=Array.isArray,d=Function.prototype.call,h={configurable:!0,enumerable:!0,writable:!0,value:null},f=Object.defineProperty;t.exports=function(t){var e,r,g,_,y,v,m,b,w,E,P=arguments[1],S=arguments[2];if(t=Object(u(t)),l(P)&&a(P),this&&this!==Array&&o(this))e=this;else{if(!P){if(i(t))return y=t.length,1!==y?Array.apply(null,t):(_=new Array(1),_[0]=t[0],_);if(p(t)){for(_=new Array(y=t.length),r=0;r<y;++r)_[r]=t[r];return _}}_=[]}if(!p(t))if(void 0!==(w=t[n])){for(m=a(w).call(t),e&&(_=new e),b=m.next(),r=0;!b.done;)E=P?d.call(P,S,b.value,r):b.value,e?(h.value=E,f(_,r,h)):_[r]=E,b=m.next(),++r;y=r}else if(c(t)){for(y=t.length,e&&(_=new e),r=0,g=0;r<y;++r)E=t[r],r+1<y&&(v=E.charCodeAt(0))>=55296&&v<=56319&&(E+=t[++r]),E=P?d.call(P,S,E,g):E,e?(h.value=E,f(_,g,h)):_[g]=E,++g;y=g}if(void 0===y)for(y=s(t.length),e&&(_=new e(y)),r=0;r<y;++r)E=P?d.call(P,S,t[r],r):t[r],e?(h.value=E,f(_,r,h)):_[r]=E;return e&&(h.value=null,_.length=y),_}},function(t,e,r){"use strict";t.exports=function(){var t,e,r=Array.from;return"function"==typeof r&&(t=["raz","dwa"],e=r(t),Boolean(e&&e!==t&&"dwa"===e[1]))}},function(t,e,r){"use strict";t.exports=r(54)()?Array.from:r(53)},function(t,e,r){"use strict";var n=r(55),i=r(14),o=r(0);t.exports=function(t){var e=Object(o(t)),r=arguments[1],s=Object(arguments[2]);if(e!==t&&!r)return e;var a={};return r?n(r,function(e){(s.ensure||e in t)&&(a[e]=t[e])}):i(a,t),a}},function(t,e,r){"use strict";var n,i=r(56),o=r(23),s=r(1),a=r(46),u=r(1),l=r(0),c=Function.prototype.bind,p=Object.defineProperty,d=Object.prototype.hasOwnProperty;n=function(t,e,r){var n,o=l(e)&&u(e.value);return n=i(e),delete n.writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&d.call(this,t)?o:(e.value=c.call(o,r.resolveContext?r.resolveContext(this):this),p(this,t,e),this[t])},n},t.exports=function(t){var e=o(arguments[1]);return null!=e.resolveContext&&s(e.resolveContext),a(t,function(t,r){return n(r,t,e)})}},function(t,e,r){"use strict";var n=r(0);t.exports=function(){return n(this).length=0,this}},function(t,e,r){"use strict";t.exports=function(t){return!!t&&("symbol"==typeof t||!!t.constructor&&"Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag])}},function(t,e,r){"use strict";var n=r(59);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not a symbol");return t}},function(t,e,r){"use strict";var n,i,o,s,a=r(7),u=r(60),l=Object.create,c=Object.defineProperties,p=Object.defineProperty,d=Object.prototype,h=l(null);if("function"==typeof Symbol){n=Symbol;try{String(n()),s=!0}catch(t){}}var f=function(){var t=l(null);return function(e){for(var r,n,i=0;t[e+(i||"")];)++i;return e+=i||"",t[e]=!0,r="@@"+e,p(d,r,a.gs(null,function(t){n||(n=!0,p(this,r,a(t)),n=!1)})),r}}();o=function(t){if(this instanceof o)throw new TypeError("Symbol is not a constructor");return i(t)},t.exports=i=function t(e){var r;if(this instanceof t)throw new TypeError("Symbol is not a constructor");return s?n(e):(r=l(o.prototype),e=void 0===e?"":String(e),c(r,{__description__:a("",e),__name__:a("",f(e))}))},c(i,{for:a(function(t){return h[t]?h[t]:h[t]=i(String(t))}),keyFor:a(function(t){var e;u(t);for(e in h)if(h[e]===t)return e}),hasInstance:a("",n&&n.hasInstance||i("hasInstance")),isConcatSpreadable:a("",n&&n.isConcatSpreadable||i("isConcatSpreadable")),iterator:a("",n&&n.iterator||i("iterator")),match:a("",n&&n.match||i("match")),replace:a("",n&&n.replace||i("replace")),search:a("",n&&n.search||i("search")),species:a("",n&&n.species||i("species")),split:a("",n&&n.split||i("split")),toPrimitive:a("",n&&n.toPrimitive||i("toPrimitive")),toStringTag:a("",n&&n.toStringTag||i("toStringTag")),unscopables:a("",n&&n.unscopables||i("unscopables"))}),c(o.prototype,{constructor:a(i),toString:a("",function(){return this.__name__})}),c(i.prototype,{toString:a(function(){return"Symbol ("+u(this).__description__+")"}),valueOf:a(function(){return u(this)})}),p(i.prototype,i.toPrimitive,a("",function(){var t=u(this);return"symbol"==typeof t?t:t.toString()})),p(i.prototype,i.toStringTag,a("c","Symbol")),p(o.prototype,i.toStringTag,a("c",i.prototype[i.toStringTag])),p(o.prototype,i.toPrimitive,a("c",i.prototype[i.toPrimitive]))},function(t,e,r){"use strict";var n={object:!0,symbol:!0};t.exports=function(){var t;if("function"!=typeof Symbol)return!1;t=Symbol("test symbol");try{String(t)}catch(t){return!1}return!!n[typeof Symbol.iterator]&&!!n[typeof Symbol.toPrimitive]&&!!n[typeof Symbol.toStringTag]}},function(t,e,r){"use strict";var n,i=r(15),o=r(22),s=r(7),a=r(2),u=r(20),l=Object.defineProperty;n=t.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,t),e=e?o.call(e,"key+value")?"key+value":o.call(e,"key")?"key":"value":"value",l(this,"__kind__",s("",e))},i&&i(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:s(function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t})}),l(n.prototype,a.toStringTag,s("c","Array Iterator"))},function(t,e,r){"use strict";var n=String.prototype.indexOf;t.exports=function(t){return n.call(this,t,arguments[1])>-1}},function(t,e,r){"use strict";var n="razdwatrzy";t.exports=function(){return"function"==typeof n.contains&&!0===n.contains("dwa")&&!1===n.contains("foo")}},function(t,e,r){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,r){"use strict";var n=r(4),i=Object.keys;t.exports=function(t){return i(n(t)?Object(t):t)}},function(t,e,r){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,r){"use strict";t.exports=r(68)()?Object.keys:r(67)},function(t,e,r){"use strict";var n=r(69),i=r(0),o=Math.max;t.exports=function(t,e){var r,s,a,u=o(arguments.length,2);for(t=Object(i(t)),a=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},s=1;s<u;++s)e=arguments[s],n(e).forEach(a);if(void 0!==r)throw r;return t}},function(t,e,r){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(t={foo:"raz"},e(t,{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,r){"use strict";var n=Object.create(null),i=Math.random;t.exports=function(){var t;do{t=i().toString(36).slice(2)}while(n[t]);return t}},function(t,e,r){"use strict";var n=r(25);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not an Object");return t}},function(t,e,r){"use strict";var n,i=Object.create;r(27)()||(n=r(26)),t.exports=function(){var t,e,r;return n?1!==n.level?i:(t={},e={},r={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(t){return"__proto__"===t?void(e[t]={configurable:!0,enumerable:!1,writable:!0,value:void 0}):void(e[t]=r)}),Object.defineProperties(t,e),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:t}),function(e,r){return i(null===e?t:e,r)}):i}()},function(t,e,r){"use strict";var n,i=r(15),o=r(73),s=r(0),a=r(72),u=r(7),l=r(21),c=r(40),p=r(2).toStringTag,d=r(39),h=Array.isArray,f=Object.defineProperty,g=Object.prototype.hasOwnProperty,_=Object.getPrototypeOf;t.exports=n=function(){var t,e=arguments[0];if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");return t=d&&i&&WeakMap!==n?i(new WeakMap,_(this)):this,null!=e&&(h(e)||(e=l(e))),f(t,"__weakMapData__",u("c","$weakMap$"+a())),e?(c(e,function(e){s(e),t.set(e[0],e[1])}),t):t},d&&(i&&i(n,WeakMap),n.prototype=Object.create(WeakMap.prototype,{constructor:u(n)})),Object.defineProperties(n.prototype,{delete:u(function(t){return!!g.call(o(t),this.__weakMapData__)&&(delete t[this.__weakMapData__],!0)}),get:u(function(t){if(g.call(o(t),this.__weakMapData__))return t[this.__weakMapData__]}),has:u(function(t){return g.call(o(t),this.__weakMapData__)}),set:u(function(t,e){return f(o(t),this.__weakMapData__,u("c",e)),this}),toString:u(function(){return"[object WeakMap]"})}),f(n.prototype,p,u("c","WeakMap"))},function(t,e,r){"use strict";t.exports=function(){var t,e;if("function"!=typeof WeakMap)return!1;try{t=new WeakMap([[e={},"one"],[{},"two"],[{},"three"]])}catch(t){return!1}return"[object WeakMap]"===String(t)&&"function"==typeof t.set&&t.set({},1)===t&&"function"==typeof t.delete&&"function"==typeof t.has&&"one"===t.get(e)}},function(t,e,r){"use strict";t.exports=r(76)()?WeakMap:r(75)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(77),i=function(){function t(){this._map=new n}return t.prototype.get=function(t){return this._map.get(t)},t.prototype.set=function(t,e){this._map.set(t,e)},t.prototype.has=function(t){return this._map.has(t)},t.prototype.delete=function(t){return this._map.delete(t)},t}();e.SCWeakMap=i},function(t,e,r){!function(e){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/?#]*)(.*)$/,i=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=s.parseURL(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=s.normalizePath(i.path),s.buildURLFromParts(i)}var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return r.alwaysNormalize?(o.path=s.normalizePath(o.path),s.buildURLFromParts(o)):e;var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var u=n.exec(a.path);a.netLoc=u[1],a.path=u[2]}a.netLoc&&!a.path&&(a.path="/");var l={scheme:a.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(l.netLoc=a.netLoc,"/"!==o.path[0]))if(o.path){var c=a.path,p=c.substring(0,c.lastIndexOf("/")+1)+o.path;l.path=s.normalizePath(p)}else l.path=a.path,o.params||(l.params=a.params,o.query||(l.query=a.query));return null===l.path&&(l.path=r.alwaysNormalize?s.normalizePath(o.path):o.path),s.buildURLFromParts(l)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(i,"");t.length!==(t=t.replace(o,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}};t.exports=s}()},function(t,e,r){"use strict";function n(t){var e=s.exec(t);return e?e[1].toLowerCase():null}function i(t,e){return o.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}Object.defineProperty(e,"__esModule",{value:!0});var o=r(79),s=/^.*\.([^\.;\?#]*).*$/;e.getExtension=n,e.buildAbsoluteUrl=i},function(t,e,r){"use strict";function n(t){var e=new Uint8Array(t.reduce(function(t,e){return t+e.byteLength},0)),r=0;return t.forEach(function(t){e.set(t,r),r+=t.byteLength}),e}function i(t,e){if(Uint8Array.prototype.fill)t.fill(e);else for(var r=0;r<t.length;r++)t[r]=e}function o(t,e){if(Uint8Array.prototype.forEach)t.forEach(e);else for(var r=0;r<t.length;r++)e(t[r],r)}function s(t,e){if(void 0===e&&(e=!1),(t=Math.round(t))<0)throw new Error("Negative numbers not supported.");for(var r=Math.max(1,Math.ceil(Math.log(t+1)/Math.log(2)/8)),n=new Uint8Array(r),i=0;i<r;i++)n[e?i:r-1-i]=255&t,t>>>=8;return n}function a(t){if(t<0||t>Math.pow(2,53))throw new Error("Unrepresentable value: "+t);var e;for(e=1;e<=8&&!(t<Math.pow(2,7*e)-1);e++);for(var r=new Uint8Array(e),n=1;n<=e;n++){var i=255&t;r[e-n]=i,t-=i,t/=Math.pow(2,8)}return r[0]|=1<<8-e,r}Object.defineProperty(e,"__esModule",{value:!0}),e.combine=n,e.fill=i,e.forEach=o,e.numberToUint8Array=s,e.createVintBuffer=a},function(t,e,r){"use strict";function n(t){return t.filter(function(t){return null!=t})}Object.defineProperty(e,"__esModule",{value:!0}),e.compact=n},function(t,e,r){"use strict";function n(t,e,r){return void 0===r&&(r=new Error("Timed out.")),new i.Promise(function(n,i){var s=window.setTimeout(function(){i(r)},e);o.always(t,function(t){return window.clearTimeout(s),t}).then(n,i)})}Object.defineProperty(e,"__esModule",{value:!0});var i=r(8),o=r(18);e.promiseWithTimeout=n},function(t,e,r){"use strict";function n(){return o?new window.Map:new s}Object.defineProperty(e,"__esModule",{value:!0});var i=r(17),o="undefined"!=typeof window&&"Map"in window;e.buildCache=n;var s=function(){function t(){this._store=[]}return t.prototype.set=function(t,e){var r=i.find(this._store,function(e){return e.key===t});r?r.val=e:this._store.push({key:t,val:e})},t.prototype.get=function(t){var e=i.find(this._store,function(e){return e.key===t});if(e)return e.val},t}()},function(t,e,r){"use strict";function n(t,e,r){void 0===r&&(r={});var n=null,i=0,s=!1,a=null,u=function(){var l=!1,c=function(){if(l)throw new Error("scheduleRetry() already called.");if(l=!0,a=null,s)return!1;var e=t(++i);if(null===e){var c=r.onNoMoreRetries;return c&&o.deferException(function(){return c()}),!1}return n=window.setTimeout(u,e),!0};a=e({attemptNum:i,scheduleRetry:c})||null};return u(),{cancel:function(){s||(s=!0,n&&(window.clearTimeout(n),n=null),a&&a.onCancel())}}}function i(t){var e=void 0===t?{}:t,r=e.timeBase,n=void 0===r?500:r,i=e.threshold,o=void 0===i?3:i,s=e.delayCap,a=void 0===s?45e3:s,u=e.jitter,l=void 0===u?200:u,c=e.maxAttempts,p=void 0===c?null:c;if(n<=0)throw new Error("Time base must be > 0.");if(o<=0)throw new Error("Threshold must be > 0.");if(null!==a&&a<=0)throw new Error("Delay cap must be null or > 0.");if(null!==p&&p<1)throw new Error("Max attempts must be >= 1.");return function(t){if(null!==p&&t>=p)return null;var e=t>0?Math.pow(2,t/o-1):0;return Math.min(e*n,a||1/0)+Math.round(Math.random()*l)}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(3);e.retry=n,e.buildExponentialDelayCalculator=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(13),i=r(37),o=r(85),s=r(30),a=r(17),u=r(84),l=r(19),c=r(8),p=r(83),d=r(18),h=r(82),f=r(81),g=r(3),_=r(36),y=r(80),v=r(78);!function(t){t.OnExit=s.OnExit,t.find=a.find,t.Promise=c.Promise,t.promiseWithTimeout=p.promiseWithTimeout,t.always=d.always,t.compact=h.compact,t.deferException=g.deferException,t.SCWeakMap=v.SCWeakMap;!function(t){t.buildCache=u.buildCache}(t.cache||(t.cache={}));!function(t){t.buildDeferred=n.buildDeferred}(t.deferred||(t.deferred={}));!function(t){t.getExtension=y.getExtension,t.buildAbsoluteUrl=y.buildAbsoluteUrl}(t.url||(t.url={}));!function(t){t.AbortableJob=i.AbortableJob,t.map=i.map,t.abortedError=i.abortedError}(t.abortableJob||(t.abortableJob={}));!function(t){t.retry=o.retry,t.buildExponentialDelayCalculator=o.buildExponentialDelayCalculator}(t.retry||(t.retry={}));!function(t){t.isSafari=_.isSafari,t.getSafariVersion=_.getSafariVersion,t.isIE=_.isIE,t.isEdge=_.isEdge,t.isFirefox=_.isFirefox,t.isChrome=_.isChrome,t.getChromeVersion=_.getChromeVersion,t.getFirefoxVersion=_.getFirefoxVersion}(t.browser||(t.browser={}));!function(t){t.combine=f.combine,t.fill=f.fill,t.forEach=f.forEach,t.numberToUint8Array=f.numberToUint8Array,t.createVintBuffer=f.createVintBuffer}(t.arrayBuffer||(t.arrayBuffer={}));!function(t){t.now=l.now}(t.time||(t.time={}))}(e.helpers||(e.helpers={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._msg=t,this._cause=e}return t.prototype.getMsg=function(){return this._msg},t.prototype.getCause=function(){return this._cause},t}();e.LoaderError=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(87);!function(t){t.LoaderError=n.LoaderError}(e.loaderErrors||(e.loaderErrors={}))},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),o=function(t){function e(e,r){return t.call(this,e||"The URL update failed for some reason.",r)||this}return n(e,t),e.prototype.getCode=function(){return"URL_UPDATE_ERROR"},e}(i.PlayerFatalError);e.URLUpdateError=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(33),i=r(89),o=r(29),s=r(16),a=r(11),u=r(5);!function(t){t.PlayerError=a.PlayerError,t.PlayerFatalError=u.PlayerFatalError,t.NotSupportedError=n.NotSupportedError,t.URLUpdateError=i.URLUpdateError,t.ImplementationError=o.ImplementationError,t.ProxyProvidedPlayerFatalError=s.ProxyProvidedPlayerFatalError}(e.errors||(e.errors={}))},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(6),o=r(12),s=r(35),a=r(16),u=function(t){function e(e){var r=t.call(this,e)||this;return r._onPlayerProvided=new i.EventDispatcher,r._onPlayerRemoved=new i.EventDispatcher,r._shouldPassThroughFatalErrors=!!e.shouldPassThroughFatalErrors,r.onPlayerProvided=r._onPlayerProvided.getHandle(),r.onPlayerRemoved=r._onPlayerRemoved.getHandle(),r._logger=o.prefixLogger(r._logger,"ProxyPlayer"),r}return n(e,t),e.prototype.providePlayer=function(t,e){void 0===e&&(e={}),this._providePlayer(t,e),this._onPlayerProvided.dispatch(t)},e.prototype.removePlayer=function(){var t=this._getPlayer();if(!t)throw new Error("There is no player to remove.");this._removePlayer(),this._onPlayerRemoved.dispatch(t)},e.prototype.setInitialDuration=function(t){this._setInitialDuration(t)},e.prototype.getPlayer=function(){return this._getPlayer()},e.prototype._handleFatalError=function(t,e){this._shouldPassThroughFatalErrors?this._triggerError(t):this._triggerError(new a.ProxyProvidedPlayerFatalError(t,e))},e}(s.ProxyPlayerBase);e.ProxyPlayer=u},function(t,e){},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(t){if(c===setTimeout)return setTimeout(t,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function o(t){if(p===clearTimeout)return clearTimeout(t);if((p===n||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function s(){g&&h&&(g=!1,h.length?f=h.concat(f):_=-1,f.length&&a())}function a(){if(!g){var t=i(s);g=!0;for(var e=f.length;e;){for(h=f,f=[];++_<e;)h&&h[_].run();_=-1,e=f.length}h=null,g=!1,o(t)}}function u(t,e){this.fun=t,this.array=e}function l(){}var c,p,d=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(t){c=r}try{p="function"==typeof clearTimeout?clearTimeout:n}catch(t){p=n}}();var h,f=[],g=!1,_=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];f.push(new u(t,e)),1!==f.length||g||i(a)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.prependListener=l,d.prependOnceListener=l,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,r){(function(e,r){/*!
13
+ !function(i,o){"use strict";function s(t,e){function r(t){return pt.preferFlash&&ot&&!pt.ignoreFlash&&pt.flash[t]!==o&&pt.flash[t]}function n(t){return function(e){var r=this._s;return r&&r._a?t.call(this,e):null}}this.setupOptions={url:t||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,forceUseGlobalHTML5Audio:!1,ignoreMobileRestrictions:!1,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onerror:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,playbackRate:1,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100},this.flash9Options={onfailure:null,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},flac:{type:["audio/flac"],required:!1}},this.movieID="sm2-container",this.id=e||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20170601",this.version=null,this.movieURL=null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!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.html5Only=!1,this.ignoreFlash=!1;var s,a,u,l,c,p,d,h,f,g,_,y,v,m,b,w,E,P,S,x,k,A,O,T,C,R,M,I,D,L,F,U,N,j,B,q,z,H,V,W,G,$,J,Q,Y,K,X,Z,tt,et,rt,nt,it,ot,st,at,ut,lt,ct,pt=this,dt=null,ht=null,ft=navigator.userAgent,gt=i.location.href.toString(),_t=document,yt=[],vt=!1,mt=!1,bt=!1,wt=!1,Et=!1,Pt=null,St=null,xt=!1,kt=!1,At=0,Ot=null,Tt=[],Ct=null,Rt=Array.prototype.slice,Mt=!1,It=0,Dt=ft.match(/(ipad|iphone|ipod)/i),Lt=ft.match(/android/i),Ft=ft.match(/msie|trident/i),Ut=ft.match(/webkit/i),Nt=ft.match(/safari/i)&&!ft.match(/chrome/i),jt=ft.match(/opera/i),Bt=ft.match(/(mobile|pre\/|xoom)/i)||Dt||Lt,qt=!gt.match(/usehtml5audio/i)&&!gt.match(/sm2-ignorebadua/i)&&Nt&&!ft.match(/silk/i)&&ft.match(/OS\sX\s10_6_([3-7])/i),zt=(i.console!==o&&console.log,_t.hasFocus!==o?_t.hasFocus():null),Ht=Nt&&(_t.hasFocus===o||!_t.hasFocus()),Vt=!Ht,Wt=/(mp3|mp4|mpa|m4a|m4b)/i,Gt=_t.location?_t.location.protocol.match(/http/i):null,$t=Gt?"":"//",Jt=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4|m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,Qt=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","m4b","mp4v","3gp","3g2"],Yt=new RegExp("\\.("+Qt.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!Gt,B={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"},X=[null,"MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"],this.hasHTML5=function(){try{return Audio!==o&&(jt&&opera!==o&&opera.version()<10?new Audio(null):new Audio).canPlayType!==o}catch(t){return!1}}(),this.setup=function(t){var e=!pt.url;return t!==o&&bt&&Ct&&pt.ok()&&(t.flashVersion!==o||t.url!==o||t.html5Test),f(t),Mt||(Bt?pt.setupOptions.ignoreMobileRestrictions&&!pt.setupOptions.forceUseGlobalHTML5Audio||(Tt.push(S.globalHTML5),Mt=!0):pt.setupOptions.forceUseGlobalHTML5Audio&&(Tt.push(S.globalHTML5),Mt=!0)),!ct&&Bt&&(pt.setupOptions.ignoreMobileRestrictions?Tt.push(S.ignoreMobile):(pt.setupOptions.useHTML5Audio=!0,pt.setupOptions.preferFlash=!1,Dt?pt.ignoreFlash=!0:(Lt&&!ft.match(/android\s2\.3/i)||!Lt)&&(Mt=!0))),t&&(e&&O&&t.url!==o&&pt.beginDelayedInit(),O||t.url===o||"complete"!==_t.readyState||setTimeout(k,1)),ct=!0,pt},this.ok=function(){return Ct?bt&&!wt:pt.useHTML5Audio&&pt.hasHTML5},this.supported=this.ok,this.getMovie=function(t){return a(t)||_t[t]||i[t]},this.createSound=function(t,e){function r(){return n=q(n),pt.sounds[n.id]=new s(n),pt.soundIDs.push(n.id),pt.sounds[n.id]}var n,i=null;if(!bt||!pt.ok())return!1;if(e!==o&&(t={id:t,url:e}),n=h(t),n.url=$(n.url),n.id===o&&(n.id=pt.setupOptions.idPrefix+It++),H(n.id,!0))return pt.sounds[n.id];if(Y(n))i=r(),i._setup_html5(n);else{if(pt.html5Only)return r();if(pt.html5.usingFlash&&n.url&&n.url.match(/data:/i))return r();p>8&&null===n.isMovieStar&&(n.isMovieStar=!!(n.serverURL||n.type&&n.type.match(Jt)||n.url&&n.url.match(Yt))),n=z(n,void 0),i=r(),8===p?ht._createSound(n.id,n.loops||1,n.usePolicyFile):(ht._createSound(n.id,n.url,n.usePeakData,n.useWaveformData,n.useEQData,n.isMovieStar,!!n.isMovieStar&&n.bufferTime,n.loops||1,n.serverURL,n.duration||null,n.autoPlay,!0,n.autoLoad,n.usePolicyFile),n.serverURL||(i.connected=!0,n.onconnect&&n.onconnect.apply(i))),n.serverURL||!n.autoLoad&&!n.autoPlay||i.load(n)}return!n.serverURL&&n.autoPlay&&i.play(),i},this.destroySound=function(t,e){if(!H(t))return!1;var r,n=pt.sounds[t];for(n.stop(),n._iO={},n.unload(),r=0;r<pt.soundIDs.length;r++)if(pt.soundIDs[r]===t){pt.soundIDs.splice(r,1);break}return e||n.destruct(!0),n=null,delete pt.sounds[t],!0},this.load=function(t,e){return!!H(t)&&pt.sounds[t].load(e)},this.unload=function(t){return!!H(t)&&pt.sounds[t].unload()},this.onPosition=function(t,e,r,n){return!!H(t)&&pt.sounds[t].onposition(e,r,n)},this.onposition=this.onPosition,this.clearOnPosition=function(t,e,r){return!!H(t)&&pt.sounds[t].clearOnPosition(e,r)},this.play=function(t,e){var r=null,n=e&&!(e instanceof Object);if(!bt||!pt.ok())return!1;if(H(t,n))n&&(e={url:e});else{if(!n)return!1;n&&(e={url:e}),e&&e.url&&(e.id=t,r=pt.createSound(e).play())}return null===r&&(r=pt.sounds[t].play(e)),r},this.start=this.play,this.setPlaybackRate=function(t,e,r){return!!H(t)&&pt.sounds[t].setPlaybackRate(e,r)},this.setPosition=function(t,e){return!!H(t)&&pt.sounds[t].setPosition(e)},this.stop=function(t){return!!H(t)&&pt.sounds[t].stop()},this.stopAll=function(){var t;for(t in pt.sounds)pt.sounds.hasOwnProperty(t)&&pt.sounds[t].stop()},this.pause=function(t){return!!H(t)&&pt.sounds[t].pause()},this.pauseAll=function(){var t;for(t=pt.soundIDs.length-1;t>=0;t--)pt.sounds[pt.soundIDs[t]].pause()},this.resume=function(t){return!!H(t)&&pt.sounds[t].resume()},this.resumeAll=function(){var t;for(t=pt.soundIDs.length-1;t>=0;t--)pt.sounds[pt.soundIDs[t]].resume()},this.togglePause=function(t){return!!H(t)&&pt.sounds[t].togglePause()},this.setPan=function(t,e){return!!H(t)&&pt.sounds[t].setPan(e)},this.setVolume=function(t,e){var r,n;if(t!==o&&!isNaN(t)&&e===o){for(r=0,n=pt.soundIDs.length;r<n;r++)pt.sounds[pt.soundIDs[r]].setVolume(t);return!1}return!!H(t)&&pt.sounds[t].setVolume(e)},this.mute=function(t){var e=0;if(t instanceof String&&(t=null),t)return!!H(t)&&pt.sounds[t].mute();for(e=pt.soundIDs.length-1;e>=0;e--)pt.sounds[pt.soundIDs[e]].mute();return pt.muted=!0,!0},this.muteAll=function(){pt.mute()},this.unmute=function(t){var e;if(t instanceof String&&(t=null),t)return!!H(t)&&pt.sounds[t].unmute();for(e=pt.soundIDs.length-1;e>=0;e--)pt.sounds[pt.soundIDs[e]].unmute();return pt.muted=!1,!0},this.unmuteAll=function(){pt.unmute()},this.toggleMute=function(t){return!!H(t)&&pt.sounds[t].toggleMute()},this.getMemoryUse=function(){var t=0;return ht&&8!==p&&(t=parseInt(ht._getMemoryUse(),10)),t},this.disable=function(t){var e;if(t===o&&(t=!1),wt)return!1;for(wt=!0,e=pt.soundIDs.length-1;e>=0;e--)D(pt.sounds[pt.soundIDs[e]]);return D(pt),d(t),nt.remove(i,"load",v),!0},this.canPlayMIME=function(t){var e;return pt.hasHTML5&&(e=K({type:t})),!e&&Ct&&(e=t&&pt.ok()?!!((p>8?t.match(Jt):null)||t.match(pt.mimePattern)):null),e},this.canPlayURL=function(t){var e;return pt.hasHTML5&&(e=K({url:t})),!e&&Ct&&(e=t&&pt.ok()?!!t.match(pt.filePattern):null),e},this.canPlayLink=function(t){return!(t.type===o||!t.type||!pt.canPlayMIME(t.type))||pt.canPlayURL(t.href)},this.getSoundById=function(t,e){return t?pt.sounds[t]:null},this.onready=function(t,e){var r=!1;if("function"!=typeof t)throw U("needFunction","onready");return e||(e=i),_("onready",t,e),y(),r=!0,r},this.ontimeout=function(t,e){var r=!1;if("function"!=typeof t)throw U("needFunction","ontimeout");return e||(e=i),_("ontimeout",t,e),y({type:"ontimeout"}),r=!0,r},this._writeDebug=function(t,e){return!0},this._wD=this._writeDebug,this._debug=function(){},this.reboot=function(t,e){var r,n,o;for(r=pt.soundIDs.length-1;r>=0;r--)pt.sounds[pt.soundIDs[r]].destruct();if(ht)try{Ft&&(St=ht.innerHTML),Pt=ht.parentNode.removeChild(ht)}catch(t){}if(St=Pt=Ct=ht=null,pt.enabled=O=bt=xt=kt=vt=mt=wt=Mt=pt.swfLoaded=!1,pt.soundIDs=[],pt.sounds={},It=0,ct=!1,t)yt=[];else for(r in yt)if(yt.hasOwnProperty(r))for(n=0,o=yt[r].length;n<o;n++)yt[r][n].fired=!1;return pt.html5={usingFlash:null},pt.flash={},pt.html5Only=!1,pt.ignoreFlash=!1,i.setTimeout(function(){e||pt.beginDelayedInit()},20),pt},this.reset=function(){return pt.reboot(!0,!0)},this.getMoviePercent=function(){return ht&&"PercentLoaded"in ht?ht.PercentLoaded():null},this.beginDelayedInit=function(){Et=!0,k(),setTimeout(function(){return!kt&&(C(),x(),kt=!0,!0)},20),m()},this.destruct=function(){pt.disable(!0)},s=function(t){var e,r,n,i,s,a,u,l,c,d,f=this,g=!1,_=[],y=0,v=null;c={duration:null,time:null},this.id=t.id,this.sID=this.id,this.url=t.url,this.options=h(t),this.instanceOptions=this.options,this._iO=this.instanceOptions,this.pan=this.options.pan,this.volume=this.options.volume,this.isHTML5=!1,this._a=null,d=!this.url,this.id3={},this._debug=function(){},this.load=function(t){var e,r=null;if(t!==o?f._iO=h(t,f.options):(t=f.options,f._iO=t,v&&v!==f.url&&(f._iO.url=f.url,f.url=null)),f._iO.url||(f._iO.url=f.url),f._iO.url=$(f._iO.url),f.instanceOptions=f._iO,e=f._iO,!e.url&&!f.url)return f;if(e.url===f.url&&0!==f.readyState&&2!==f.readyState)return 3===f.readyState&&e.onload&&lt(f,function(){e.onload.apply(f,[!!f.duration])}),f;if(f.loaded=!1,f.readyState=1,f.playState=0,f.id3={},Y(e))r=f._setup_html5(e),r._called_load||(f._html5_canplay=!1,f.url!==e.url&&(f._a.src=e.url,f.setPosition(0)),f._a.autobuffer="auto",f._a.preload="auto",f._a._called_load=!0);else{if(pt.html5Only)return f;if(f._iO.url&&f._iO.url.match(/data:/i))return f;try{f.isHTML5=!1,f._iO=z(q(e)),f._iO.autoPlay&&(f._iO.position||f._iO.from)&&(f._iO.autoPlay=!1),e=f._iO,8===p?ht._load(f.id,e.url,e.stream,e.autoPlay,e.usePolicyFile):ht._load(f.id,e.url,!!e.stream,!!e.autoPlay,e.loops||1,!!e.autoLoad,e.usePolicyFile)}catch(t){R({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}}return f.url=e.url,f},this.unload=function(){return 0!==f.readyState&&(f.isHTML5?(i(),f._a&&(f._a.pause(),v=tt(f._a))):8===p?ht._unload(f.id,"about:blank"):ht._unload(f.id),e()),f},this.destruct=function(t){f.isHTML5?(i(),f._a&&(f._a.pause(),tt(f._a),Mt||n(),f._a._s=null,f._a=null)):(f._iO.onfailure=null,ht._destroySound(f.id)),t||pt.destroySound(f.id,!0)},this.play=function(t,e){var r,n,i,u,c,_=!0;if(e=e===o||e,t||(t={}),f.url&&(f._iO.url=f.url),f._iO=h(f._iO,f.options),f._iO=h(t,f._iO),f._iO.url=$(f._iO.url),f.instanceOptions=f._iO,!f.isHTML5&&f._iO.serverURL&&!f.connected)return f.getAutoPlay()||f.setAutoPlay(!0),f;if(Y(f._iO)&&(f._setup_html5(f._iO),s()),1===f.playState&&!f.paused&&!f._iO.multiShot)return f.isHTML5&&f.setPosition(f._iO.position),f;if(t.url&&t.url!==f.url&&(f.readyState||f.isHTML5||8!==p||!d?f.load(f._iO):d=!1),!f.loaded)if(0===f.readyState){if(f.isHTML5||pt.html5Only){if(!f.isHTML5)return f;f.load(f._iO)}else f._iO.autoPlay=!0,f.load(f._iO);f.instanceOptions=f._iO}else if(2===f.readyState)return f;return!f.isHTML5&&9===p&&f.position>0&&f.position===f.duration&&(t.position=0),f.paused&&f.position>=0&&(!f._iO.serverURL||f.position>0)?f.resume():(f._iO=h(t,f._iO),(!f.isHTML5&&null!==f._iO.position&&f._iO.position>0||null!==f._iO.from&&f._iO.from>0||null!==f._iO.to)&&0===f.instanceCount&&0===f.playState&&!f._iO.serverURL&&(n=function(){f._iO=h(t,f._iO),f.play(f._iO)},f.isHTML5&&!f._html5_canplay?f.load({_oncanplay:n}):f.isHTML5||f.loaded||f.readyState&&2===f.readyState||f.load({onload:n}),f._iO=l()),(!f.instanceCount||f._iO.multiShotEvents||f.isHTML5&&f._iO.multiShot&&!Mt||!f.isHTML5&&p>8&&!f.getAutoPlay())&&f.instanceCount++,f._iO.onposition&&0===f.playState&&a(f),f.playState=1,f.paused=!1,f.position=f._iO.position===o||isNaN(f._iO.position)?0:f._iO.position,f.isHTML5||(f._iO=z(q(f._iO))),f._iO.onplay&&e&&(f._iO.onplay.apply(f),g=!0),f.setVolume(f._iO.volume,!0),f.setPan(f._iO.pan,!0),1!==f._iO.playbackRate&&f.setPlaybackRate(f._iO.playbackRate),f.isHTML5?f.instanceCount<2?(s(),r=f._setup_html5(),f.setPosition(f._iO.position),r.play()):(i=new Audio(f._iO.url),u=function(){nt.remove(i,"ended",u),f._onfinish(f),tt(i),i=null},c=function(){nt.remove(i,"canplay",c);try{i.currentTime=f._iO.position/1e3}catch(t){}i.play()},nt.add(i,"ended",u),f._iO.volume!==o&&(i.volume=Math.max(0,Math.min(1,f._iO.volume/100))),f.muted&&(i.muted=!0),f._iO.position?nt.add(i,"canplay",c):i.play()):(_=ht._start(f.id,f._iO.loops||1,9===p?f.position:f.position/1e3,f._iO.multiShot||!1),9!==p||_||f._iO.onplayerror&&f._iO.onplayerror.apply(f))),f},this.start=this.play,this.stop=function(t){var e,r=f._iO;return 1===f.playState&&(f._onbufferchange(0),f._resetOnPosition(0),f.paused=!1,f.isHTML5||(f.playState=0),u(),r.to&&f.clearOnPosition(r.to),f.isHTML5?f._a&&(e=f.position,f.setPosition(0),f.position=e,f._a.pause(),f.playState=0,f._onTimer(),i()):(ht._stop(f.id,t),r.serverURL&&f.unload()),f.instanceCount=0,f._iO={},r.onstop&&r.onstop.apply(f)),f},this.setAutoPlay=function(t){f._iO.autoPlay=t,f.isHTML5||(ht._setAutoPlay(f.id,t),t&&(f.instanceCount||1!==f.readyState||f.instanceCount++))},this.getAutoPlay=function(){return f._iO.autoPlay},this.setPlaybackRate=function(t){var e=Math.max(.5,Math.min(4,t));if(f.isHTML5)try{f._iO.playbackRate=e,f._a.playbackRate=e}catch(t){}return f},this.setPosition=function(t){t===o&&(t=0);var e,r,n=f.isHTML5?Math.max(t,0):Math.min(f.duration||f._iO.duration,Math.max(t,0));if(f.position=n,r=f.position/1e3,f._resetOnPosition(f.position),f._iO.position=n,f.isHTML5){if(f._a){if(f._html5_canplay){if(f._a.currentTime.toFixed(3)!==r.toFixed(3))try{f._a.currentTime=r,(0===f.playState||f.paused)&&f._a.pause()}catch(t){}}else if(r)return f;f.paused&&f._onTimer(!0)}}else e=9===p?f.position:r,f.readyState&&2!==f.readyState&&ht._setPosition(f.id,e,f.paused||!f.playState,f._iO.multiShot);return f},this.pause=function(t){return f.paused||0===f.playState&&1!==f.readyState?f:(f.paused=!0,f.isHTML5?(f._setup_html5().pause(),i()):(t||t===o)&&ht._pause(f.id,f._iO.multiShot),f._iO.onpause&&f._iO.onpause.apply(f),f)},this.resume=function(){var t=f._iO;return f.paused?(f.paused=!1,f.playState=1,f.isHTML5?(f._setup_html5().play(),s()):(t.isMovieStar&&!t.serverURL&&f.setPosition(f.position),ht._pause(f.id,t.multiShot)),!g&&t.onplay?(t.onplay.apply(f),g=!0):t.onresume&&t.onresume.apply(f),f):f},this.togglePause=function(){return 0===f.playState?(f.play({position:9!==p||f.isHTML5?f.position/1e3:f.position}),f):(f.paused?f.resume():f.pause(),f)},this.setPan=function(t,e){return t===o&&(t=0),e===o&&(e=!1),f.isHTML5||ht._setPan(f.id,t),f._iO.pan=t,e||(f.pan=t,f.options.pan=t),f},this.setVolume=function(t,e){return t===o&&(t=100),e===o&&(e=!1),f.isHTML5?f._a&&(pt.muted&&!f.muted&&(f.muted=!0,f._a.muted=!0),f._a.volume=Math.max(0,Math.min(1,t/100))):ht._setVolume(f.id,pt.muted&&!f.muted||f.muted?0:t),f._iO.volume=t,e||(f.volume=t,f.options.volume=t),f},this.mute=function(){return f.muted=!0,f.isHTML5?f._a&&(f._a.muted=!0):ht._setVolume(f.id,0),f},this.unmute=function(){f.muted=!1;var t=f._iO.volume!==o;return f.isHTML5?f._a&&(f._a.muted=!1):ht._setVolume(f.id,t?f._iO.volume:f.options.volume),f},this.toggleMute=function(){return f.muted?f.unmute():f.mute()},this.onPosition=function(t,e,r){return _.push({position:parseInt(t,10),method:e,scope:r!==o?r:f,fired:!1}),f},this.onposition=this.onPosition,this.clearOnPosition=function(t,e){var r;if(t=parseInt(t,10),!isNaN(t))for(r=0;r<_.length;r++)t===_[r].position&&(e&&e!==_[r].method||(_[r].fired&&y--,_.splice(r,1)))},this._processOnPosition=function(){var t,e,r=_.length;if(!r||!f.playState||y>=r)return!1;for(t=r-1;t>=0;t--)e=_[t],!e.fired&&f.position>=e.position&&(e.fired=!0,y++,e.method.apply(e.scope,[e.position]),r=_.length);return!0},this._resetOnPosition=function(t){var e,r,n=_.length;if(!n)return!1;for(e=n-1;e>=0;e--)r=_[e],r.fired&&t<=r.position&&(r.fired=!1,y--);return!0},l=function(){var t,e,r=f._iO,n=r.from,i=r.to;return e=function(){f.clearOnPosition(i,e),f.stop()},t=function(){null===i||isNaN(i)||f.onPosition(i,e)},null===n||isNaN(n)||(r.position=n,r.multiShot=!1,t()),r},a=function(){var t,e=f._iO.onposition;if(e)for(t in e)e.hasOwnProperty(t)&&f.onPosition(parseInt(t,10),e[t])},u=function(){var t,e=f._iO.onposition;if(e)for(t in e)e.hasOwnProperty(t)&&f.clearOnPosition(parseInt(t,10))},s=function(){f.isHTML5&&V(f)},i=function(){f.isHTML5&&W(f)},e=function(t){t||(_=[],y=0),g=!1,f._hasTimer=null,f._a=null,f._html5_canplay=!1,f.bytesLoaded=null,f.bytesTotal=null,f.duration=f._iO&&f._iO.duration?f._iO.duration:null,f.durationEstimate=null,f.buffered=[],f.eqData=[],f.eqData.left=[],f.eqData.right=[],f.failures=0,f.isBuffering=!1,f.instanceOptions={},f.instanceCount=0,f.loaded=!1,f.metadata={},f.readyState=0,f.muted=!1,f.paused=!1,f.peakData={left:0,right:0},f.waveformData={left:[],right:[]},f.playState=0,f.position=null,f.id3={}},e(),this._onTimer=function(t){var e,r,n=!1,i={};return(f._hasTimer||t)&&f._a&&(t||(f.playState>0||1===f.readyState)&&!f.paused)&&(e=f._get_html5_duration(),e!==c.duration&&(c.duration=e,f.duration=e,n=!0),f.durationEstimate=f.duration,r=1e3*f._a.currentTime||0,r!==c.time&&(c.time=r,n=!0),(n||t)&&f._whileplaying(r,i,i,i,i)),n},this._get_html5_duration=function(){var t=f._iO,e=f._a&&f._a.duration?1e3*f._a.duration:t&&t.duration?t.duration:null;return e&&!isNaN(e)&&e!==1/0?e:null},this._apply_loop=function(t,e){t.loop=e>1?"loop":""},this._setup_html5=function(t){var n,i=h(f._iO,t),o=Mt?dt:f._a,s=decodeURI(i.url);if(Mt?s===decodeURI(it)&&(n=!0):s===decodeURI(v)&&(n=!0),o){if(o._s)if(Mt)o._s&&o._s.playState&&!n&&o._s.stop();else if(!Mt&&s===decodeURI(v))return f._apply_loop(o,i.loops),o;n||(v&&e(!1),o.src=i.url,f.url=i.url,v=i.url,it=i.url,o._called_load=!1)}else i.autoLoad||i.autoPlay?(f._a=new Audio(i.url),f._a.load()):f._a=jt&&opera.version()<10?new Audio(null):new Audio,o=f._a,o._called_load=!1,Mt&&(dt=o);return f.isHTML5=!0,f._a=o,o._s=f,r(),f._apply_loop(o,i.loops),i.autoLoad||i.autoPlay?f.load():(o.autobuffer=!1,o.preload="auto"),o},r=function(){if(f._a._added_events)return!1;var t;f._a._added_events=!0;for(t in ut)ut.hasOwnProperty(t)&&function(t,e,r){f._a&&f._a.addEventListener(t,e,r||!1)}(t,ut[t]);return!0},n=function(){var t;f._a._added_events=!1;for(t in ut)ut.hasOwnProperty(t)&&function(t,e,r){f._a&&f._a.removeEventListener(t,e,r||!1)}(t,ut[t])},this._onload=function(t){var e=!!t||!f.isHTML5&&8===p&&f.duration;return f.loaded=e,f.readyState=e?3:2,f._onbufferchange(0),e||f.isHTML5||f._onerror(),f._iO.onload&&lt(f,function(){f._iO.onload.apply(f,[e])}),!0},this._onerror=function(t,e){f._iO.onerror&&lt(f,function(){f._iO.onerror.apply(f,[t,e])})},this._onbufferchange=function(t){return 0!==f.playState&&(!(t&&f.isBuffering||!t&&!f.isBuffering)&&(f.isBuffering=1===t,f._iO.onbufferchange&&f._iO.onbufferchange.apply(f,[t]),!0))},this._onsuspend=function(){return f._iO.onsuspend&&f._iO.onsuspend.apply(f),!0},this._onfailure=function(t,e,r){f.failures++,f._iO.onfailure&&1===f.failures&&f._iO.onfailure(t,e,r)},this._onwarning=function(t,e,r){f._iO.onwarning&&f._iO.onwarning(t,e,r)},this._onfinish=function(){var t=f._iO.onfinish;f._onbufferchange(0),f._resetOnPosition(0),f.instanceCount&&(f.instanceCount--,f.instanceCount||(u(),f.playState=0,f.paused=!1,f.instanceCount=0,f.instanceOptions={},f._iO={},i(),f.isHTML5&&(f.position=0)),f.instanceCount&&!f._iO.multiShotEvents||t&&lt(f,function(){t.apply(f)}))},this._whileloading=function(t,e,r,n){var i=f._iO;f.bytesLoaded=t,f.bytesTotal=e,f.duration=Math.floor(r),f.bufferLength=n,f.isHTML5||i.isMovieStar?f.durationEstimate=f.duration:i.duration?f.durationEstimate=f.duration>i.duration?f.duration:i.duration:f.durationEstimate=parseInt(f.bytesTotal/f.bytesLoaded*f.duration,10),f.isHTML5||(f.buffered=[{start:0,end:f.duration}]),(3!==f.readyState||f.isHTML5)&&i.whileloading&&i.whileloading.apply(f)},this._whileplaying=function(t,e,r,n,i){var s,a=f._iO;return!isNaN(t)&&null!==t&&(f.position=Math.max(0,t),f._processOnPosition(),!f.isHTML5&&p>8&&(a.usePeakData&&e!==o&&e&&(f.peakData={left:e.leftPeak,right:e.rightPeak}),a.useWaveformData&&r!==o&&r&&(f.waveformData={left:r.split(","),right:n.split(",")}),a.useEQData&&i!==o&&i&&i.leftEQ&&(s=i.leftEQ.split(","),f.eqData=s,f.eqData.left=s,i.rightEQ!==o&&i.rightEQ&&(f.eqData.right=i.rightEQ.split(",")))),1===f.playState&&(f.isHTML5||8!==p||f.position||!f.isBuffering||f._onbufferchange(0),a.whileplaying&&a.whileplaying.apply(f)),!0)},this._oncaptiondata=function(t){f.captiondata=t,f._iO.oncaptiondata&&f._iO.oncaptiondata.apply(f,[t])},this._onmetadata=function(t,e){var r,n,i={};for(r=0,n=t.length;r<n;r++)i[t[r]]=e[r];f.metadata=i,f._iO.onmetadata&&f._iO.onmetadata.call(f,f.metadata)},this._onid3=function(t,e){var r,n,i=[];for(r=0,n=t.length;r<n;r++)i[t[r]]=e[r];f.id3=h(f.id3,i),f._iO.onid3&&f._iO.onid3.apply(f)},this._onconnect=function(t){t=1===t,f.connected=t,t&&(f.failures=0,H(f.id)&&(f.getAutoPlay()?f.play(o,f.getAutoPlay()):f._iO.autoLoad&&f.load()),f._iO.onconnect&&f._iO.onconnect.apply(f,[t]))},this._ondataerror=function(t){f.playState>0&&f._iO.ondataerror&&f._iO.ondataerror.apply(f)}},T=function(){return _t.body||_t.getElementsByTagName("div")[0]},a=function(t){return _t.getElementById(t)},h=function(t,e){var r,n,i=t||{};r=e===o?pt.defaultOptions:e;for(n in r)r.hasOwnProperty(n)&&i[n]===o&&("object"!=typeof r[n]||null===r[n]?i[n]=r[n]:i[n]=h(i[n],r[n]));return i},lt=function(t,e){t.isHTML5||8!==p?e():i.setTimeout(e,0)},g={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},f=function(t,e){var r,n=!0,i=e!==o,s=pt.setupOptions,a=g;for(r in t)if(t.hasOwnProperty(r))if("object"!=typeof t[r]||null===t[r]||t[r]instanceof Array||t[r]instanceof RegExp)i&&a[e]!==o?pt[e][r]=t[r]:s[r]!==o?(pt.setupOptions[r]=t[r],pt[r]=t[r]):a[r]===o?n=!1:pt[r]instanceof Function?pt[r].apply(pt,t[r]instanceof Array?t[r]:[t[r]]):pt[r]=t[r];else{if(a[r]!==o)return f(t[r],r);n=!1}return n},nt=function(){function t(t){var e=Rt.call(t),r=e.length;return o?(e[1]="on"+e[1],r>3&&e.pop()):3===r&&e.push(!1),e}function e(t,e){var r=t.shift(),n=[s[e]];o?r[n](t[0],t[1]):r[n].apply(r,t)}function r(){e(t(arguments),"add")}function n(){e(t(arguments),"remove")}var o=i.attachEvent,s={add:o?"attachEvent":"addEventListener",remove:o?"detachEvent":"removeEventListener"};return{add:r,remove:n}}(),ut={abort:n(function(){}),canplay:n(function(){var t,e=this._s;if(!e._html5_canplay){if(e._html5_canplay=!0,e._onbufferchange(0),t=e._iO.position===o||isNaN(e._iO.position)?null:e._iO.position/1e3,this.currentTime!==t)try{this.currentTime=t}catch(t){}e._iO._oncanplay&&e._iO._oncanplay()}}),canplaythrough:n(function(){var t=this._s;t.loaded||(t._onbufferchange(0),t._whileloading(t.bytesLoaded,t.bytesTotal,t._get_html5_duration()),t._onload(!0))}),durationchange:n(function(){var t,e=this._s;t=e._get_html5_duration(),isNaN(t)||t===e.duration||(e.durationEstimate=e.duration=t)}),ended:n(function(){this._s._onfinish()}),error:n(function(){var t=X[this.error.code]||null;this._s._onload(!1),this._s._onerror(this.error.code,t)}),loadeddata:n(function(){var t=this._s;t._loaded||Nt||(t.duration=t._get_html5_duration())}),loadedmetadata:n(function(){}),loadstart:n(function(){this._s._onbufferchange(1)}),play:n(function(){this._s._onbufferchange(0)}),playing:n(function(){this._s._onbufferchange(0)}),progress:n(function(t){var e,r,n=this._s,i=0,o=(t.type,t.target.buffered),s=t.loaded||0,a=t.total||1;if(n.buffered=[],o&&o.length){for(e=0,r=o.length;e<r;e++)n.buffered.push({start:1e3*o.start(e),end:1e3*o.end(e)});i=1e3*(o.end(0)-o.start(0)),s=Math.min(1,i/(1e3*t.target.duration))}isNaN(s)||(n._whileloading(s,a,n._get_html5_duration()),s&&a&&s===a&&ut.canplaythrough.call(this,t))}),ratechange:n(function(){}),suspend:n(function(t){var e=this._s;ut.progress.call(this,t),e._onsuspend()}),stalled:n(function(){}),timeupdate:n(function(){this._s._onTimer()}),waiting:n(function(){this._s._onbufferchange(1)})},Y=function(t){return!(!t||!(t.type||t.url||t.serverURL))&&(!(t.serverURL||t.type&&r(t.type))&&(t.type?K({type:t.type}):K({url:t.url})||pt.html5Only||t.url.match(/data:/i)))},tt=function(t){var e;return t&&(e=Nt?"about:blank":pt.html5.canPlayType("audio/wav")?"data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w==":"about:blank",t.src=e,t._called_unload!==o&&(t._called_load=!1)),Mt&&(it=null),e},K=function(t){if(!pt.useHTML5Audio||!pt.hasHTML5)return!1;var e,n,i,s,a=t.url||null,u=t.type||null,l=pt.audioFormats;if(u&&pt.html5[u]!==o)return pt.html5[u]&&!r(u);if(!Z){Z=[];for(s in l)l.hasOwnProperty(s)&&(Z.push(s),l[s].related&&(Z=Z.concat(l[s].related)));Z=new RegExp("\\.("+Z.join("|")+")(\\?.*)?$","i")}return i=a?a.toLowerCase().match(Z):null,i&&i.length?i=i[1]:u?(n=u.indexOf(";"),i=(-1!==n?u.substr(0,n):u).substr(6)):e=!1,i&&pt.html5[i]!==o?e=pt.html5[i]&&!r(i):(u="audio/"+i,e=pt.html5.canPlayType({type:u}),pt.html5[i]=e,e=e&&pt.html5[u]&&!r(u)),e},rt=function(){function t(t){var e,r,n=!1,o=!1;if(!s||"function"!=typeof s.canPlayType)return n;if(t instanceof Array){for(i=0,r=t.length;i<r;i++)(pt.html5[t[i]]||s.canPlayType(t[i]).match(pt.html5Test))&&(o=!0,pt.html5[t[i]]=!0,pt.flash[t[i]]=!!t[i].match(Wt));n=o}else e=!(!s||"function"!=typeof s.canPlayType)&&s.canPlayType(t),n=!(!e||!e.match(pt.html5Test));return n}if(!pt.useHTML5Audio||!pt.hasHTML5)return pt.html5.usingFlash=!0,Ct=!0,!1;var e,r,n,i,s=Audio!==o?jt&&opera.version()<10?new Audio(null):new Audio:null,a={};n=pt.audioFormats;for(e in n)if(n.hasOwnProperty(e)&&(r="audio/"+e,a[e]=t(n[e].type),a[r]=a[e],e.match(Wt)?(pt.flash[e]=!0,pt.flash[r]=!0):(pt.flash[e]=!1,pt.flash[r]=!1),n[e]&&n[e].related))for(i=n[e].related.length-1;i>=0;i--)a["audio/"+n[e].related[i]]=a[e],pt.html5[n[e].related[i]]=a[e],pt.flash[n[e].related[i]]=a[e];return a.canPlayType=s?t:null,pt.html5=h(pt.html5,a),pt.html5.usingFlash=Q(),Ct=pt.html5.usingFlash,!0},S={},U=function(){},q=function(t){return 8===p&&t.loops>1&&t.stream&&(t.stream=!1),t},z=function(t,e){return t&&!t.usePolicyFile&&(t.onid3||t.usePeakData||t.useWaveformData||t.useEQData)&&(t.usePolicyFile=!0),t},u=function(){return!1},D=function(t){var e;for(e in t)t.hasOwnProperty(e)&&"function"==typeof t[e]&&(t[e]=u);e=null},L=function(t){t===o&&(t=!1),(wt||t)&&pt.disable(t)},F=function(t){var e;if(t)if(t.match(/\.swf(\?.*)?$/i)){if(t.substr(t.toLowerCase().lastIndexOf(".swf?")+4))return t}else t.lastIndexOf("/")!==t.length-1&&(t+="/");return e=(t&&-1!==t.lastIndexOf("/")?t.substr(0,t.lastIndexOf("/")+1):"./")+pt.movieURL,pt.noSWFCache&&(e+="?ts="+(new Date).getTime()),e},E=function(){8!==(p=parseInt(pt.flashVersion,10))&&9!==p&&(pt.flashVersion=p=8);var t=pt.debugMode||pt.debugFlash?"_debug.swf":".swf";pt.useHTML5Audio&&!pt.html5Only&&pt.audioFormats.mp4.required&&p<9&&(pt.flashVersion=p=9),pt.version=pt.versionNumber+(pt.html5Only?" (HTML5-only mode)":9===p?" (AS3/Flash 9)":" (AS2/Flash 8)"),p>8?(pt.defaultOptions=h(pt.defaultOptions,pt.flash9Options),pt.features.buffering=!0,pt.defaultOptions=h(pt.defaultOptions,pt.movieStarOptions),pt.filePatterns.flash9=new RegExp("\\.(mp3|"+Qt.join("|")+")(\\?.*)?$","i"),pt.features.movieStar=!0):pt.features.movieStar=!1,pt.filePattern=pt.filePatterns[8!==p?"flash9":"flash8"],pt.movieURL=(8===p?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",t),pt.features.peakData=pt.features.waveformData=pt.features.eqData=p>8},M=function(t,e){ht&&ht._setPolling(t,e)},I=function(){},H=this.getSoundById,j=function(){var t=[];return pt.debugMode&&t.push(B.sm2Debug),pt.debugFlash&&t.push(B.flashDebug),pt.useHighPerformance&&t.push(B.highPerf),t.join(" ")},N=function(){var t=(U("fbHandler"),pt.getMoviePercent()),e=B,r={type:"FLASHBLOCK"};pt.html5Only||(pt.ok()?pt.oMC&&(pt.oMC.className=[j(),e.swfDefault,e.swfLoaded+(pt.didFlashBlock?" "+e.swfUnblocked:"")].join(" ")):(Ct&&(pt.oMC.className=j()+" "+e.swfDefault+" "+(null===t?e.swfTimedout:e.swfError)),pt.didFlashBlock=!0,y({type:"ontimeout",ignoreInit:!0,error:r}),R(r)))},_=function(t,e,r){yt[t]===o&&(yt[t]=[]),yt[t].push({method:e,scope:r||null,fired:!1})},y=function(t){if(t||(t={type:pt.ok()?"onready":"ontimeout"}),!bt&&t&&!t.ignoreInit)return!1;if("ontimeout"===t.type&&(pt.ok()||wt&&!t.ignoreInit))return!1;var e,r,n={success:t&&t.ignoreInit?pt.ok():!wt},i=t&&t.type?yt[t.type]||[]:[],o=[],s=[n],a=Ct&&!pt.ok();for(t.error&&(s[0].error=t.error),e=0,r=i.length;e<r;e++)!0!==i[e].fired&&o.push(i[e]);if(o.length)for(e=0,r=o.length;e<r;e++)o[e].scope?o[e].method.apply(o[e].scope,s):o[e].method.apply(this,s),a||(o[e].fired=!0);return!0},v=function(){i.setTimeout(function(){pt.useFlashBlock&&N(),y(),"function"==typeof pt.onload&&pt.onload.apply(i),pt.waitForWindowLoad&&nt.add(i,"load",v)},1)},st=function(){if(ot!==o)return ot;var t,e,r,n,s=!1,a=navigator,u=i.ActiveXObject;try{n=a.plugins}catch(t){n=void 0}if(n&&n.length)e="application/x-shockwave-flash",(r=a.mimeTypes)&&r[e]&&r[e].enabledPlugin&&r[e].enabledPlugin.description&&(s=!0);else if(u!==o&&!ft.match(/MSAppHost/i)){try{t=new u("ShockwaveFlash.ShockwaveFlash")}catch(e){t=null}s=!!t,t=null}return ot=s,s},Q=function(){var t,e,r=pt.audioFormats;if(Dt&&!!ft.match(/os (1|2|3_0|3_1)\s/i)?(pt.hasHTML5=!1,pt.html5Only=!0,pt.oMC&&(pt.oMC.style.display="none")):pt.useHTML5Audio&&(pt.html5&&pt.html5.canPlayType||(pt.hasHTML5=!1)),pt.useHTML5Audio&&pt.hasHTML5){J=!0;for(e in r)r.hasOwnProperty(e)&&r[e].required&&(pt.html5.canPlayType(r[e].type)?pt.preferFlash&&(pt.flash[e]||pt.flash[r[e].type])&&(t=!0):(J=!1,t=!0))}return pt.ignoreFlash&&(t=!1,J=!0),pt.html5Only=pt.hasHTML5&&pt.useHTML5Audio&&!t,!pt.html5Only},$=function(t){var e,r,n,i=0;if(t instanceof Array){for(e=0,r=t.length;e<r;e++)if(t[e]instanceof Object){if(pt.canPlayMIME(t[e].type)){i=e;break}}else if(pt.canPlayURL(t[e])){i=e;break}t[i].url&&(t[i]=t[i].url),n=t[i]}else n=t;return n},V=function(t){t._hasTimer||(t._hasTimer=!0,!Bt&&pt.html5PollingInterval&&(null===Ot&&0===At&&(Ot=setInterval(G,pt.html5PollingInterval)),At++))},W=function(t){t._hasTimer&&(t._hasTimer=!1,!Bt&&pt.html5PollingInterval&&At--)},G=function(){var t;if(null!==Ot&&!At)return clearInterval(Ot),void(Ot=null);for(t=pt.soundIDs.length-1;t>=0;t--)pt.sounds[pt.soundIDs[t]].isHTML5&&pt.sounds[pt.soundIDs[t]]._hasTimer&&pt.sounds[pt.soundIDs[t]]._onTimer()},R=function(t){t=t!==o?t:{},"function"==typeof pt.onerror&&pt.onerror.apply(i,[{type:t.type!==o?t.type:null}]),t.fatal!==o&&t.fatal&&pt.disable()},at=function(){if(qt&&st()){var t,e,r=pt.audioFormats;for(e in r)if(r.hasOwnProperty(e)&&("mp3"===e||"mp4"===e)&&(pt.html5[e]=!1,r[e]&&r[e].related))for(t=r[e].related.length-1;t>=0;t--)pt.html5[r[e].related[t]]=!1}},this._setSandboxType=function(t){},this._externalInterfaceOK=function(t){if(!pt.swfLoaded){pt.swfLoaded=!0,Ht=!1,qt&&at(),setTimeout(c,Ft?100:1)}},C=function(t,e){function r(t,e){return'<param name="'+t+'" value="'+e+'" />'}if(vt&&mt)return!1;if(pt.html5Only)return E(),pt.oMC=a(pt.movieID),c(),vt=!0,mt=!0,!1;var n,i,s,u,l,p,d,h,f=e||pt.url,g=pt.altURL||f,_=T(),y=j(),v=null,m=_t.getElementsByTagName("html")[0];if(v=m&&m.dir&&m.dir.match(/rtl/i),t=t===o?pt.id:t,E(),pt.url=F(Gt?f:g),e=pt.url,pt.wmode=!pt.wmode&&pt.useHighPerformance?"transparent":pt.wmode,null!==pt.wmode&&(ft.match(/msie 8/i)||!Ft&&!pt.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(Tt.push(S.spcWmode),pt.wmode=null),n={name:t,id:t,src:e,quality:"high",allowScriptAccess:pt.allowScriptAccess,bgcolor:pt.bgColor,pluginspage:$t+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:pt.wmode,hasPriority:"true"},pt.debugFlash&&(n.FlashVars="debug=1"),pt.wmode||delete n.wmode,Ft)i=_t.createElement("div"),u=['<object id="'+t+'" data="'+e+'" type="'+n.type+'" title="'+n.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">',r("movie",e),r("AllowScriptAccess",pt.allowScriptAccess),r("quality",n.quality),pt.wmode?r("wmode",pt.wmode):"",r("bgcolor",pt.bgColor),r("hasPriority","true"),pt.debugFlash?r("FlashVars",n.FlashVars):"","</object>"].join("");else{i=_t.createElement("embed");for(s in n)n.hasOwnProperty(s)&&i.setAttribute(s,n[s])}if(I(),y=j(),_=T())if(pt.oMC=a(pt.movieID)||_t.createElement("div"),pt.oMC.id)h=pt.oMC.className,pt.oMC.className=(h?h+" ":B.swfDefault)+(y?" "+y:""),pt.oMC.appendChild(i),Ft&&(l=pt.oMC.appendChild(_t.createElement("div")),l.className=B.swfBox,l.innerHTML=u),mt=!0;else{if(pt.oMC.id=pt.movieID,pt.oMC.className=B.swfDefault+" "+y,p=null,l=null,pt.useFlashBlock||(pt.useHighPerformance?p={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(p={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},v&&(p.left=Math.abs(parseInt(p.left,10))+"px"))),Ut&&(pt.oMC.style.zIndex=1e4),!pt.debugFlash)for(d in p)p.hasOwnProperty(d)&&(pt.oMC.style[d]=p[d]);try{Ft||pt.oMC.appendChild(i),_.appendChild(pt.oMC),Ft&&(l=pt.oMC.appendChild(_t.createElement("div")),l.className=B.swfBox,l.innerHTML=u),mt=!0}catch(t){throw new Error(U("domError")+" \n"+t.toString())}}return vt=!0,!0},x=function(){return pt.html5Only?(C(),!1):!ht&&(!!pt.url&&(ht=pt.getMovie(pt.id),ht||(Pt?(Ft?pt.oMC.innerHTML=St:pt.oMC.appendChild(Pt),Pt=null,vt=!0):C(pt.id,pt.url),ht=pt.getMovie(pt.id)),"function"==typeof pt.oninitmovie&&setTimeout(pt.oninitmovie,1),!0))},m=function(){setTimeout(b,1e3)},w=function(){i.setTimeout(function(){pt.setup({preferFlash:!1}).reboot(),pt.didFlashBlock=!0,pt.beginDelayedInit()},1)},b=function(){var t,e=!1;pt.url&&(xt||(xt=!0,nt.remove(i,"load",m),ot&&Ht&&!zt||(bt||(t=pt.getMoviePercent())>0&&t<100&&(e=!0),setTimeout(function(){if(t=pt.getMoviePercent(),e)return xt=!1,void i.setTimeout(m,1);!bt&&Vt&&(null===t?pt.useFlashBlock||0===pt.flashLoadTimeout?pt.useFlashBlock&&N():!pt.useFlashBlock&&J?w():y({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}}):0===pt.flashLoadTimeout||(!pt.useFlashBlock&&J?w():L(!0)))},pt.flashLoadTimeout))))},P=function(){function t(){nt.remove(i,"focus",P)}return zt||!Ht?(t(),!0):(Vt=!0,zt=!0,xt=!1,m(),t(),!0)},d=function(t){if(bt)return!1;if(pt.html5Only)return bt=!0,v(),!0;var e,r=pt.useFlashBlock&&pt.flashLoadTimeout&&!pt.getMoviePercent(),n=!0;return r||(bt=!0),e={type:!ot&&Ct?"NO_FLASH":"INIT_TIMEOUT"},(wt||t)&&(pt.useFlashBlock&&pt.oMC&&(pt.oMC.className=j()+" "+(null===pt.getMoviePercent()?B.swfTimedout:B.swfError)),y({type:"ontimeout",error:e,ignoreInit:!0}),R(e),n=!1),wt||(pt.waitForWindowLoad&&!Et?nt.add(i,"load",v):v()),n},l=function(){var t,e=pt.setupOptions;for(t in e)e.hasOwnProperty(t)&&(pt[t]===o?pt[t]=e[t]:pt[t]!==e[t]&&(pt.setupOptions[t]=pt[t]))},c=function(){function t(){nt.remove(i,"load",pt.beginDelayedInit)}if(bt)return!1;if(pt.html5Only)return bt||(t(),pt.enabled=!0,d()),!0;x();try{ht._externalInterfaceTest(!1),M(!0,pt.flashPollingInterval||(pt.useHighPerformance?10:50)),pt.debugMode||ht._disableDebug(),pt.enabled=!0,pt.html5Only||nt.add(i,"unload",u)}catch(t){return R({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),L(!0),d(),!1}return d(),t(),!0},k=function(){return!O&&(O=!0,l(),I(),!ot&&pt.hasHTML5&&pt.setup({useHTML5Audio:!0,preferFlash:!1}),rt(),!ot&&Ct&&(Tt.push(S.needFlash),pt.setup({flashLoadTimeout:1})),_t.removeEventListener&&_t.removeEventListener("DOMContentLoaded",k,!1),x(),!0)},et=function(){return"complete"===_t.readyState&&(k(),_t.detachEvent("onreadystatechange",et)),!0},A=function(){Et=!0,k(),nt.remove(i,"load",A)},st(),nt.add(i,"focus",P),nt.add(i,"load",m),nt.add(i,"load",A),_t.addEventListener?_t.addEventListener("DOMContentLoaded",k,!1):_t.attachEvent?_t.attachEvent("onreadystatechange",et):R({type:"NO_DOM2_EVENTS",fatal:!0})}if(!i||!i.document)throw new Error("SoundManager requires a browser with window and document objects.");var a=null;i.SM2_DEFER!==o&&SM2_DEFER||(a=new s),"object"==typeof t&&t&&"object"==typeof t.exports?(t.exports.SoundManager=s,t.exports.soundManager=a):void 0!==(n=function(){function t(t){if(!i.soundManager&&t instanceof Function){var e=t(s);e instanceof s&&(i.soundManager=e)}return i.soundManager}return{constructor:s,getInstance:t}}.call(e,r,e,t))&&(t.exports=n),i.SoundManager=s,i.soundManager=a}(window)}).call(e,r(46)(t))},function(t,e,r){var n,i,o,s,a,u,l,c,p,d,h;h=function(t){return(window.opener||window.parent).postMessage(JSON.stringify(t),"*")},o=window.location.hash.replace("#",""),a={},n=null,u={load:function(){return h({t:"w",id:o})},notify:function(t,e){return t=t.type||t,h({t:"ee",id:o,d:e,e:t})}},c=function(t,e){var r,i,a,u,l;if(null==e&&(e={}),i=e.preview||e.source.frames[o])return i.Blogvio.auth.token(n),window.require._require.push(i.require),a=i.getData(),r=a.composition,l=a.widget,u=a.user,u||(u={id:"591bf4ecd85c6d076c787001",premium:!1,upload_token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1OTFiZjRlY2Q4NWM2ZDA3NmM3ODcwMDEiLCJjb250ZXh0Ijp7ImlkIjoiYXBwIiwibmFtZSI6ImFwcCJ9LCJtYXhRdW90YSI6MTAwMDAwMDAwMCwiYXVkIjoiZmlsZS11cGxvYWQiLCJleHAiOjE2MjI2MjY4NTF9.Hg_6L3taBamqc9hkxk9cMWh3HihwyvtMzev_K384xPE"}),s(r,l,i,u)},s=function(t,e,n,i){var o,s,c,p;return(o=$("body")).toggleClass("is-popup",!!window.opener),c=r(128),p=(null!=i?i.premium:void 0)||!1,s=r(113).default,s.init({user:i,uploadToken:(null!=i?i.upload_token:void 0)||""}),window.editor=new c({el:o,remote:n,initOptions:a,premium:p}),t?editor.edit(t.id).then(l).fail(function(t){return console.log(t.stack)}):editor.new(e.id).then(l).fail(function(t){return console.log(t.stack)}),editor.bind("skin:select",function(t){return u.notify("skin:select",t)}),editor.$bind("skin:save",function(t,e){return u.notify("skin:save",e)}),editor.$bind("skin:destroy",function(t,e){return u.notify("skin:destroy",e)}),editor.$bind("composition:save",u.notify),editor.$bind("composition:temporary:save",u.notify),editor.$bind("content:auth-req",u.notify),editor.$bind("step:intent",u.notify),editor.$bind("Control:upgrade",u.notify),editor.$bind("Content:upgrade",u.notify),$(window).on("unload",window.editor.release.bind(editor)),editor},l=function(){return u.notify("editor:init")},i=function(t){var e,r,n;r={};for(e in t)"object"!=typeof(n=t[e])&&(r[e]=n);return r},p=function(t){return Widgetic.Event.on(window,t,function(t){return u.notify(Widgetic.UI.Editor.RELAY,i(t))})},d=function(){var t,e,r,i;return r={ready:c,step:function(t){return window.editor.step(t.d)},token:function(t){var e;return t.d?(Blogvio.auth.token(n=t.d),null!=(e=window.editor)?e.preview.remote.Blogvio.auth.token(n):void 0):Blogvio.auth.disconnect()},cont:function(t){return window.editor.el.trigger("content:"+t.d.source+":add",{items:t.d.data})},opts:function(t){return window.editor?window.editor.composition?window.editor.setOptions(t.d):window.editor.setInitOptions(t.d):a=t.d},ree:function(t){return p(t.d)}},i=window.location,t=decodeURIComponent((i.search.match(/(?:lo=)([^\#\&$]*)/)||[0,i.origin])[1]),e=function(e){var n,i,o,s;if(e.origin===t)try{n=JSON.parse(e.data),"function"==typeof r[o=n.t]&&r[o](n,{source:e.source})}catch(t){i=t,null!=(s=window.localStorage)&&s.debug_on_error,console.error(i.stack)}},Blogvio.Event.on(window,"load",function(){return Blogvio.Event.on(window,"message",e),u.load()}),Blogvio.Event.on(window,"unload",function(){return window.editor.release()})},t.exports={run:d,ready:c}},function(t,e,r){var n,i,o,s,a,u,l,c=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty;o=window.require("spine/controller"),i=window.require("spine/controller/container"),l=r(129),a=r(158),u=window.require("core/models/widget"),n=window.require("core/models/composition"),window.require("core/models/skin"),window.require("core/models/content"),s=function(t){function e(t){if(this._onSkinItemSelected=c(this._onSkinItemSelected,this),this._initialize=c(this._initialize,this),this._editComposition=c(this._editComposition,this),this._newComposition=c(this._newComposition,this),!t.remote)throw new Error("Remote UI.composition is missing!");t.premium||(t.premium=!1),e.__super__.constructor.apply(this,arguments),this.preview=new a(this.remote),this.editor=new l({premium:this.premium}),this.append(this.editor),$("html").toggleClass("isTouch",!(void 0===document.documentElement.ontouchstart))}return p(e,t),e.include(i),e.VERSION="1.9.24",e.prototype.events={"SkinItem:selected":"_onSkinItemSelected"},e.prototype.hasPendingChange=function(){return this.editor.hasPendingChange()},e.prototype.initSave=function(){return this.editor.initSave()},e.prototype.new=function(t){return this.preview.startLoading(),u.load(t).then(this._newComposition).then(this._initialize).then(function(t){return function(){return t.setOptions()}}(this)).fail(function(t){return console.error(t)})},e.prototype.edit=function(t){return n.load(t).then(this._editComposition).then(this._initialize).then(function(t){return function(){return t.setOptions()}}(this)).fail(function(t){return console.error(t)})},e.prototype.step=function(){var t;return(t=this.editor).step.apply(t,arguments)},e.prototype.selectSkin=function(t){return this.editor.selectSkin(t)},e.prototype._newComposition=function(t){return this.widget=t,this.composition=new n({widget_id:this.widget.id,width:this.widget.width,height:this.widget.height}),this.composition.save({ajax:!1})},e.prototype._editComposition=function(t){return this.composition=t,this.widget=this.composition.getWidget()},e.prototype._initialize=function(){return this.editor.for(this.composition),this.preview.load(this.composition)},e.prototype._onSkinItemSelected=function(t,e){return this.trigger("skin:select",e),this.preview.setSkin(e)},e.prototype.setInitOptions=function(t){this.initOptions=t},e.prototype.setOptions=function(t){return this.editor.setOptions($.extend({step:"skin"},t||this.initOptions))},e.prototype.release=function(){return this._release(this),this.preview.release(),e.__super__.release.apply(this,arguments)},e}(o),t.exports=s},function(t,e,r){var n,i,o,s,a,u,l,c,p=function(t,e){return function(){return t.apply(e,arguments)}},d=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;u=window.require("spine/controller/tabs"),window.require("core/models/content"),window.require("core/models/skin"),window.require("core/models/composition"),window.require("core/models/widget"),a=r(130),n=r(138),i=r(151),s=r(155),r(116),c=window.require("spine/utils/timestamp"),o=r(156),l=function(t){function e(){this.onBeforeUnload=p(this.onBeforeUnload,this),this.activateSource=p(this.activateSource,this),this.setCompositionName=p(this.setCompositionName,this),this.skin_editor=p(this.skin_editor,this),this.navigation=p(this.navigation,this),this._onInitialized=p(this._onInitialized,this),this._waitForInit=p(this._waitForInit,this),this._onViewChange=p(this._onViewChange,this),this._updateLoggedInStatus=p(this._updateLoggedInStatus,this),this._updatePersistedStatus=p(this._updatePersistedStatus,this),this._onValidateLength=p(this._onValidateLength,this),c("WidgetEditor:constructor"),e.__super__.constructor.apply(this,arguments),this.children(function(t){return function(e){return"function"==typeof e.setPremium?e.setPremium(t.premium):void 0}}(this)),this.refreshElements(),this.el.append(this.tabs.el),o.place(this.el),Blogvio.pubsub.subscribe("api/token/update",this._updateLoggedInStatus),this.el.attr("editorVersion","3.10.54")}return d(e,t),e.prototype.tabContainer=r(116),e.prototype.tabRenderer=r(157),e.prototype.className="editor",e.prototype.tabContainerClass="editor-footer",e.prototype.containerClass="editor-container",e.prototype.events={viewChange:"_onViewChange","Footer:step":"_onStep","Breadcrumb:step":"_onStep","Save:close":"_onSaveClose","DetailsEditor:empty":"_onDetailsEditorEmpty","editor:content:notification":"_onContentNotification","editor:content:browserState":"_onContentBrowserState"},e.prototype.controllers={skin:a,content:n,details:i,save:s},e.prototype.steps={skin:"skin",edit_skin:"skin",theme:"skin",content:"content",details:"details",done:"save"},e.prototype.stepValidators={skin:function(){return!!this.composition||console.warn("No composition set")},edit_skin:function(){return this.stepValidators.skin.call(this)&&null==this.canEditSkin||this.canEditSkin},theme:function(){return this.stepValidators.skin.call(this)},content:function(){return!!this.stepValidators.skin.call(this)&&(!this.hasPendingChange()||(this.initSave(),this.step("skin"),!1))},details:function(){return!!this.stepValidators.content.call(this)&&(!!this.composition.hasEnoughContent()||(this.content.notificator.notify(this.composition.validateLength().errorMsg),this.step("content"),!1))},done:function(){return!!this.stepValidators.details.call(this)}},e.prototype.for=function(t){return c("WidgetEditor:for"),this.initialize(t),this.skin.for(this.composition),this.content.for(this.composition),this.details.for(this.composition),this.save.for(this.composition),this},e.prototype.initialize=function(t){return c("WidgetEditor:initialize"),this.stopListening(this.composition),this.composition=t,this._waitForInit(),this._updatePersistedStatus(),this._updateLoggedInStatus(),this.listenTo(this.composition,"validateLength",this._onValidateLength),this.composition.validateLength(),$(window).on("beforeunload",this.onBeforeUnload)},e.prototype.hasPendingChange=function(){return this.skin.hasPendingChange()},e.prototype.initSave=function(){return this.skin.initSave()},e.prototype.step=function(t){var e;return this.steps[t]?(e=this[this.steps[t]],this.stepValidators[t].call(this)&&e.active(t),this._updatePersistedStatus()):console.warn("The editor does not have the "+t+" step.")},e.prototype.selectSkin=function(t,e){return null==e&&(e=!0),this.skin.select(t,e)},e.prototype._onStep=function(t,e){return this.step(e),this.$trigger("step:intent",{step:e,skin_pending:this.hasPendingChange(),content:this.composition.hasEnoughContent()})},e.prototype._onValidateLength=function(t,e,r){if(this.composition)return this.el.attr({minValid:e||"min"!==r,maxValid:e||"max"!==r})},e.prototype._updatePersistedStatus=function(){return this.el.attr("persisted-comp",this.composition.isPersisted())},e.prototype._updateLoggedInStatus=function(){var t,e;return e=Blogvio.auth.status(),t="connected"===e.status,this.el.toggleClass("anonymous-user",!t)},e.prototype._onViewChange=function(t,e){return this.el.attr("current-view",e)},e.prototype._waitForInit=function(){return this.initCount=0,this.listenToOnce(this.skin,"initialized",this._onInitialized),this.listenToOnce(this.content,"initialized",this._onInitialized),this.listenToOnce(this.details,"initialized",this._onInitialized)},e.prototype._onInitialized=function(){if(3==++this.initCount)return this.trigger("initialized")},e.prototype._onContentNotification=function(t,e){return this.el.attr("notification-visible",e.show)},e.prototype._onContentBrowserState=function(t,e){return this.el.attr("content-browser-service",e.service),this.el.attr("content-browser-auth",e.authenticated)},e.prototype._onDetailsEditorEmpty=function(){return this.step("content")},e.prototype._onSaveClose=function(){return this.step("details")},e.prototype.setOptions=function(){var t;return t={skin_editor:"skin_editor",step:"step",navigation:"navigation",skin:"selectSkin",composition:"setCompositionName",sources:"addContentSources",active_source:"activateSource"},function(e){var r,n,i,o;null==e&&(e={}),o=[];for(i in t)r=t[i],(n=e[i])&&o.push("function"==typeof this[r]?this[r](n):void 0);return o}}(),e.prototype.navigation=function(t){var e;return null!=t.steps&&this.el.attr("data-steps",t.steps.join(" ")),(e=this.tabs).setOptions.apply(e,arguments)},e.prototype.skin_editor=function(t){return null==t&&(t={}),null!=t.enabled&&(this.canEditSkin=t.enabled),this.skin.setOptions(t)},e.prototype.addContentSources=function(t){var e,r,n;null==t&&(t={}),e=[];for(n in t)r=t[n],e.push(this.content.addBrowser(r,n));return e},e.prototype.setCompositionName=function(t){if(null==t&&(t={}),null!=t.name)return this.composition.name=t.name},e.prototype.activateSource=function(t){return this.content.focusBrowser(t)},e.prototype.release=function(){return this._release(this),e.__super__.release.apply(this,arguments)},e.prototype.onBeforeUnload=function(){if(this.hasPendingChange())return"There are some unsaved changes!"},e}(u),t.exports=l},function(t,e,r){var n,i,o,s,a,u,l,c,p,d=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty;o=window.require("spine/controller"),i=window.require("spine/controller/container"),n=window.require("spine/controller/activateable"),l=r(131),a=r(134),u=r(136),s=r(137),p=window.require("core/models/skin"),window.require("core/models/composition"),c=function(t){function e(){this.release=d(this.release,this),this.setOptions=d(this.setOptions,this),this.edit_skin=d(this.edit_skin,this),this.activate=d(this.activate,this),this._onSkinChange=d(this._onSkinChange,this),this._onSkinItemSelected=d(this._onSkinItemSelected,this),this._onSkinCreate=d(this._onSkinCreate,this),this._onSkinDestroy=d(this._onSkinDestroy,this),this._onSkinSave=d(this._onSkinSave,this),this.initialize=d(this.initialize,this),e.__super__.constructor.apply(this,arguments),this.savePopup=new u({place:this.el}),this.deletePopup=new s({place:this.el})}return h(e,t),e.prototype.className="skin-config",e.prototype.title="Theme",e.prototype.nextTitle="Skin",e.include(i),e.include(n),e.prototype.controllers={selector:l,editor:a},e.prototype.events={saveItem:"saveItem",deleteItem:"deleteItem","SkinItem:selected":"_onSkinItemSelected"},e.prototype.setPremium=function(t){return this.premium=t,this.editor.setAccessLevel(+this.premium)},e.prototype.initSave=function(){return this.selector.initSave()},e.prototype.hasPendingChange=function(){return this.selector.hasPendingChange()},e.prototype.saveItem=function(t,e){return null==e&&(e={}),t.stopPropagation(),this.savePopup.saveItem(e.controller,e.item)},e.prototype.deleteItem=function(t,e){return null==e&&(e={}),t.stopPropagation(),this.deletePopup.deleteItem(e.controller,e.item)},e.prototype.select=function(t,e){var r;return null==e&&(e=!1),t.widget_id===this.widget.id&&(r=t,this.selector.select(r.id,e))},e.prototype.for=function(t){return this.composition=t,this.widget=this.composition.getWidget(),this.initialize(),this},e.prototype.initialize=function(t){var e,r;return this.composition?this.widget?(this.stopListening(),this.listenTo(p,"save",this._onSkinSave),this.listenTo(p,"destroy",this._onSkinDestroy),this.listenTo(p,"create",this._onSkinCreate),this.listenTo(p,"change",this._onSkinChange),r=p.findAllByAttribute("widget_id",this.widget.id),r=r.filter(function(t){return t.isPreset()}).concat(r.filter(function(t){return!t.isPreset()})),e=this.widget.skinMeta,this.editor.parseMeta(e,this.composition),this.selector.refresh(r),this.editor.display(),this.select(this.composition.getSkin()||r[0]),this.trigger("initialized")):console.warn("No widget set"):console.warn("No composition set")},e.prototype._onSkinSave=function(t,e){if(null==e&&(e={}),e.ajax||e.fromApi)return this.$trigger("skin:save",t)},e.prototype._onSkinDestroy=function(t,e){return this.$trigger("skin:destroy",t)},e.prototype._onSkinCreate=function(t){var e;if(t.widget_id===(null!=(e=this.widget)?e.id:void 0))return this.initialize(),this.selector.toggleBtn(),this.selector.select(t.id)},e.prototype._onSkinItemSelected=function(t,e){var r;return this.composition.updateAttribute("skin_id",e.id,{ajax:!1}),null!=(r=this.currentSkin)&&r.used(-1),this.currentSkin=e,this.currentSkin.used(1),this.editor.setSkin(e)},e.prototype._onSkinChange=function(t,e,r){var n;if(this.editor.skinChanged(t),(null!=(n=this.currentSkin)?n.eql(t):void 0)&&r.changedID)return this.composition.updateAttribute("skin_id",t.id,{ajax:!1})},e.prototype.activate=function(t){return n.activate.apply(this,arguments),this.$trigger("viewChange","skin"),"function"==typeof this[t]&&this[t](),this},e.prototype.edit_skin=function(){return this.delay(this.selector.editSkinState,15)},e.prototype.setOptions=function(t){if(null!=t.enabled&&!t.enabled)return this.selector.hideEditBtn()},e.prototype.release=function(){return this.currentSkin.reset(),e.__super__.release.apply(this,arguments)},e}(o),t.exports=c},function(t,e,r){var n,i,o,s,a=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=window.require("spine/controller"),n=window.require("spine/controller/container"),o=r(132),r(7),window.require("core/models/skin"),s=function(t){function e(){this.onMouseLeaveBtn=a(this.onMouseLeaveBtn,this),this.hideEditBtn=a(this.hideEditBtn,this),this.toggleBtn=a(this.toggleBtn,this),this.editSkinState=a(this.editSkinState,this),this.expand=a(this.expand,this),this.toggleState=a(this.toggleState,this),this.hasPendingChange=a(this.hasPendingChange,this),e.__super__.constructor.apply(this,arguments),this.prepend(r(40),$('<span class="after">')),this.toggleState()}return u(e,t),e.prototype.className="skin-presets",e.include(n),e.prototype.canExpand=!0,e.prototype.controllers={list:o},e.prototype.elements={".toggle-skin-edit":"btn"},e.prototype.events={"click .toggle-skin-edit":"toggleState","mouseleave .toggle-skin-edit":"onMouseLeaveBtn"},e.prototype.hasPendingChange=function(){return this.list.pending},e.prototype.initSave=function(){return this.list.initSave()},e.prototype.refresh=function(t){return this.list.refresh(t)},e.prototype.select=function(t,e){return this.list.select(t,e)},e.prototype.toggleState=function(){return(this.canExpand&&"expanded"===this.state?this.editSkinState:this.expand)()},e.prototype.expand=function(){return this.hasPendingChange()?this.initSave():(this.btn.addClass("no-hover"),this.el.addClass("expanded"),this.list.setState(this.state="expanded"))},e.prototype.editSkinState=function(){return this.btn.addClass("no-hover"),this.el.removeClass("expanded"),this.list.setState(this.state="contracted")},e.prototype.toggleBtn=function(t){return this.btn.toggleClass("no-action",null!=t&&"boolean"==typeof t?t:this.hasPendingChange())},e.prototype.hideEditBtn=function(){return this.canExpand=!this.btn.hide()},e.prototype.onMouseLeaveBtn=function(){return this.btn.removeClass("no-hover")},e}(i),t.exports=s},function(t,e,r){var n,i,o,s,a,u=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=window.require("spine/controller/activator"),a=window.require("core/models/skin"),s=r(5),i=r(133),o=function(t){function e(){this.onItemDestroy=u(this.onItemDestroy,this),this.repositionChild=u(this.repositionChild,this),this.refreshScroll=u(this.refreshScroll,this),this.scrollToItem=u(this.scrollToItem,this),this.scrollToActive=u(this.scrollToActive,this),this.setState=u(this.setState,this),this._canceled=u(this._canceled,this),this._changed=u(this._changed,this),this.refresh=u(this.refresh,this),this.select=u(this.select,this),e.__super__.constructor.apply(this,arguments),this.last_scroll={expanded:0,contracted:0},this.pending=!1,this.state="expanded",this.$bind("changed",this._changed).$bind("cancel",this._canceled),this.listenTo(a,"destroy",this.onItemDestroy),this.$bind("SkinItem:activate",function(t){return function(e,r){return t.activeChild=r.item,t.scrollToActive()}}(this)),this.listenTo(a,"create",this.scrollToActive)}return l(e,t),e.prototype.className="presets-list",e.include(s),e.prototype.select=function(t,e){return this.activeChild=t?this.children().filter(function(e){return e.item.id===t})[0]:this.children()[0],this.activeChild.active({force:e})},e.prototype.refresh=function(t){var e;return this.children(function(t){return t.release()}),this.append.apply(this,function(){var r,n,o;for(o=[],r=0,n=t.length;r<n;r++)e=t[r],o.push(new i({item:e}));return o}()),this.pending=!1,this.delay(this.refreshScroll,850),this},e.prototype.initSave=function(){return this.children(function(t){return t.isActive()})[0].initSave()},e.prototype._changed=function(t,e){var r,n;if(!this.pending)return this.pending=!0,this.scroll().disable(),r=this.activeChild.el.index(),n=this.scroll().offset().top,this.children(function(t){return function(t){return t.positionOnChange(r,n)}}())},e.prototype._canceled=function(){if(this.pending)return this.pending=!1,this.repositionChild(),this.scroll().disable(),this.delay(function(t){return function(){return t.refreshScroll(),t.skin=t.activeChild.item,t.scrollToActive()}}(this),850)},e.prototype.setState=function(t){var e;return this.last_scroll[this.state]=(null!=(e=this.container)?e.scrollTop():void 0)||0,this.state=t,this.repositionChild(),this.scroll().disable(),this.delay(function(t){return function(){return t.scrollToItem(t.activeChild,t.refreshScroll)}}(this),750)},e.prototype.scrollToActive=function(t){if(t instanceof a)return this.skin=t;if(this.skin&&this.skin.id===this.activeChild.item.id)return this.skin=null,this.scrollToItem(this.activeChild)},e.prototype.scrollToItem=function(t,e){var r;return null==t&&(t=this.activeChild),null==e&&(e=function(){}),r=(null!=t?t.el.get(0).offsetTop:void 0)+parseInt(null!=t?t.el.css("padding-top"):void 0)||0,r-=this.container.height()-(null!=t?t.el.height():void 0),r>0?this.container.animate({scrollTop:r},450,e):e()},e.prototype.refreshScroll=function(t){if(t||!this.pending)return this.scroll().enable()},e.prototype.repositionChild=function(t){return this.children(function(e){return e.reposition(null!=t?t.destroyed:void 0)}),this.scroll().update()},e.prototype.onItemDestroy=function(){return this.scroll().disable(),this.repositionChild.apply(this,arguments),this.delay(this.refreshScroll,850)},e}(n),t.exports=o},function(t,e){var r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;r=window.require("spine/controller/activateable"),n=window.require("spine/controller"),i=window.require("core/models/skin"),o=function(t){function e(t){this.positionOnChange=s(this.positionOnChange,this),this.reposition=s(this.reposition,this),this.getPosition=s(this.getPosition,this),this.width=s(this.width,this),this.state=s(this.state,this),this._enter=s(this._enter,this),this.cancelSave=s(this.cancelSave,this),this.allChanges=s(this.allChanges,this),this.deactivate=s(this.deactivate,this),this.activate=s(this.activate,this),this.uses=s(this.uses,this),this.added=s(this.added,this),t.tag=null==t.item.user_id?"span":"div",e.__super__.constructor.apply(this,arguments),this.uses(this.item,{used:!0}).$addClass(null==this.item.user_id?"is-preset":"isnt-preset"),this.colors=i.meta(this.item.widget_id).colorAttributes.concat(),this.render(),this.item.freeze(),this.listenTo(this.item,"update",this.uses),this.listenTo(this.item,"update",this.allChanges)}return a(e,t),e.prototype.className="presets-list-item",e.include(r),e.prototype.template="editor/views/skinitem",e.prototype.events={click:"active","mouseenter .presets-list-colors":"_enter","click .presets-list-delete":"initDelete","click .cancel":"cancelSave","click .save":"initSave"},e.prototype.interval=0,e.prototype.height=60,e.prototype.added=function(){return e.__super__.added.apply(this,arguments),this.reposition(!0),this.delay(function(t){return function(){return t.el.addClass("skin--added")}}(this)),this},e.prototype.initSave=function(){return this.$trigger("saveItem",{item:this.item,controller:this})},e.prototype.uses=function(t,e){return null==e&&(e={}),e.used?(this.el.toggleClass("can-delete",null!=t.user_id&&!Boolean(t.uses>>0)),this):this},e.prototype.activate=function(t){return this.isActive()&&!0!==t.force?this:(r.activate.apply(this,arguments),this.$trigger("SkinItem:activate",$.extend({},t,{item:this})),this.$trigger("SkinItem:selected",this.item),this)},e.prototype.deactivate=function(){return r.deactivate.apply(this,arguments),this._countChanges()>0&&this.cancelSave(),this},e.prototype.allChanges=function(t,e){var r,n,o,s,a,u,l,c;if(null==e&&(e={}),!(e.used||(r=e.attribute,o=i.meta(t.widget_id).colorAttributes,null!=r&&((this.changes||(this.changes={}))[r]=1,this.$trigger("changed").$addClass("changed").$(".total").text(a=this._countChanges()),this.$(".text").text(1===a?"change":"changes"),o.indexOf(r)<0)))){for(s=null!=r?[r]:o,c=[],u=0,l=s.length;u<l;u++)n=s[u],c.push(this.$("[data-name='"+n+"']").css({backgroundColor:this.item[n]}));return c}},e.prototype.cancelSave=function(){return this.changes={},this.$removeClass("changed").$trigger("cancel").item.reset()},e.prototype.override=function(){return this.changes={},this.$removeClass("changed").$trigger("cancel").item.freeze()},e.prototype.initDelete=function(t){return t.stopImmediatePropagation(),t.preventDefault(),this.$trigger("deleteItem",{item:this.item,controller:this})},e.prototype._countChanges=function(){var t,e;return function(){var r,n;r=this.changes,n=[];for(t in r)e=r[t],n.push(t);return n}.call(this).length},e.prototype._enter=function(t){if("expanded"===this.state())return t.preventDefault()},e.prototype.state=function(){return this.parent().state},e.prototype.width=function(){return{expanded:245,contracted:100}[this.state()]},e.prototype.getPosition=function(){return"expanded"===this.state()?{top:this.height*parseInt(this.index/2)-20,left:this.width()*(this.index%2)}:{top:this.height*this.index-20,left:0}},e.prototype.reposition=function(t){return t&&(this.index=this.el.index()||0),this.el.css(this.getPosition())},e.prototype.positionOnChange=function(t,e){return this.isActive()?this.el.css({top:e-20,left:0}):this.el.css({left:0,top:this.height*(this.index-t)-20+(t<this.index?440+e:e)})},e}(n),t.exports=o},function(t,e,r){var n,i,o,s,a,u,l,c,p,d,h,f=function(t,e){return function(){return t.apply(e,arguments)}},g=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;c=window.require("spine/controller/tabs"),s=r(135),window.require("core/models/skin"),i=window.require("spine/controller/activator"),n=window.require("spine/controller/activateable"),o=window.require("spine/controller"),p=r(12).createPopup,h=r(38),d=function(t,e,r){if(-1!==r&&(e[r].before(t.el),!t.isVisible()))return d(t,e,r-1)},u=function(t){function e(){return this.isVisible=f(this.isVisible,this),e.__super__.constructor.apply(this,arguments)}return g(e,t),e.include(n),e.prototype.events={click:"active"},e.prototype.isVisible=function(){return 0===this.el.position().top},e}(o),l=function(t){function e(){this._onChildActivate=f(this._onChildActivate,this),this.tabClick=f(this.tabClick,this),this.afterAdd=f(this.afterAdd,this),this.clear=f(this.clear,this),this.toggleItem=f(this.toggleItem,this),this.hideList=f(this.hideList,this),e.__super__.constructor.apply(this,arguments),this.tabsByName={},this.listenTo($(document),"click",function(t){return function(e){var r;if(!$(e.target).is(".multi-tabs-toggle"))return null!=(r=t.popup)?r.hide():void 0}}(this)),this.el.prepend(this.toggle=$("<div class='multi-tabs-toggle' data-icon='❯'></div>")),this.list=$("<div class='multi-tabs-list'></div>"),this.list.on("click",".multi-tab-item",this.tabClick)}return g(e,t),e.prototype.containerClass="skin-editor-tabs-list",e.prototype.events={"click .multi-tabs-toggle":"toggleItem","click .activateable":"hideList"},e.prototype.hideList=function(t){var e,r;return null!=(r=this.popup)&&r.hide(),e=$(t.target).controller(),e.el.hasClass("hidden")||this.list.children().removeClass("active"),this.list.children().each(function(t){return function(t,r){var n;if(n=$(r),n.data("tab")===e)return n.addClass("active").siblings().removeClass("active")}}())},e.prototype.toggleItem=function(t){return this._createPopup().then(function(t){return function(){return t.popup.visible?t.popup.hide():t.popup.show()}}(this))},e.prototype.clear=function(){return this.list.empty(),this.tabsByName={},this.children().forEach(function(t){return function(e){return t.stopListening(e)}}(this)),this.toggle.hide()},e.prototype.afterAdd=function(t){var r;return e.__super__.afterAdd.apply(this,arguments),this.listenTo(t,"activate",this._onChildActivate),this.list.append(r=$("<div class='multi-tab-item'>"+t.panel.tabTitle+"</div>")),this.tabsByName[t.panel.tabTitle]=t,r.data("tab",t),t.el.data("multi-tab-list-item",r)},e.prototype.tabClick=function(t){var e,r;return null!=(e=this.popup)&&e.hide(),r=$(t.target),r.data("tab").active()},e.prototype.update=function(t,e){var r,n,i,o,s,a,u;o={};for(u in t){n=t[u],o[u]=!0;for(r in n)if(a=n[r],h(a.if,e)){o[u]=!1;break}}for(u in o)i=o[u],this.tabsByName[u].el.toggleClass("empty",i),null!=(s=this.tabsByName[u].el.data("multi-tab-list-item"))&&s.toggleClass("empty",i);return this.children(function(t){return t.el.is(".active.empty")}).map(function(t){return function(){return t.children(function(t){return t.el.is(":not(.empty)")})}}(this)).forEach(function(t){return t[0].active()}),this._updateVisibleTabs(),!0},e.prototype._onChildActivate=function(t,e){return this.children().forEach(function(t){return t.$removeClass("active")}),t.$addClass("active"),t.isVisible()||d(t,this.children().map(function(t){return t.el}),2),this._updateVisibleTabs()},e.prototype._updateVisibleTabs=function(){var t,e,r;if(r=this.children().map(function(t){return{tab:t,visible:t.isVisible()}}),r.forEach(function(t){return t.tab.el.data("multi-tab-list-item").toggle(!t.visible)}),t=r.map(function(t){return t.visible}).reduce(function(t,e){return t&&e}),this.toggle.toggle(!t),t)return null!=(e=this.popup)?e.hide():void 0},e.prototype._createPopup=function(){return this.popupPromise?this.popupPromise:this.popupPromise=p({topOffset:25,leftOffset:23,anchor:this.toggle}).then(function(t){return function(e){return t.popup=e,t.popup.append(t.list)}}(this)).catch(function(t){return console.error(t.stack)})},e}(i),a=function(t){function e(){return this.updateSkin=f(this.updateSkin,this),this.parseMeta=f(this.parseMeta,this),e.__super__.constructor.apply(this,arguments)}return g(e,t),e.prototype.tabRenderer=u,e.prototype.className="skin-editor",e.prototype.tabContainerClass="skin-editor-tabs",e.prototype.tabContainer=l,e.prototype.containerClass="skin-editor-container",e.prototype.tabTemplate=function(t){return t.panel.tabTitle},e.prototype.setAccessLevel=function(t){this.accessLevel=t},e.prototype.parseMeta=function(t,e){var r,n,i,o,a,u,l;for(this.meta=t,a=this.children(),n=0,i=a.length;n<i;n++)r=a[n],r.release();this.tabs.clear(),u=this.meta.tabs;for(l in u)o=u[l],this.append(new s({meta:o,tabTitle:l,composition:e,accessLevel:this.accessLevel}));return this.tabs.update(this.meta.tabs,e.getSkin())},e.prototype.display=function(t){var e;return null==t&&(t=0),null!=(e=this.children()[t])?e.active():void 0},e.prototype.updateSkin=function(t){var e,r,n,i,o,s;i=!1,s=this.meta.tabs;for(e in s){o=s[e];for(n in o)r=o[n],null==t[n]&&((i||(i={}))[n]=r.options.default)}if(i)return t.updateAttributes(i,{from:this,ajax:!1})},e.prototype.setSkin=function(t){return this.updateSkin(t),this.children(function(e){return e.skinLoad(t)})},e.prototype.skinChanged=function(t){return this.tabs.update(this.meta.tabs,t)},e}(c),t.exports=a},function(t,e,r){var n,i,o,s,a,u=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;o=window.require("spine/controller"),i=window.require("spine/controller/container"),n=window.require("spine/controller/activateable"),window.require("core/models/skin"),s=r(5),a=function(t){function e(){this.onScroll=u(this.onScroll,this),this.skinLoad=u(this.skinLoad,this),e.__super__.constructor.apply(this,arguments),this.bind("activate",function(t){return function(){if(t.skin)return t.skinLoad(t.skin)}}(this))}return l(e,t),e.prototype.className="controls",e.include(i),e.include(n),e.include(s),e.prototype.skinLoad=function(t){var e,r,n,i,o,s,a;if(null==this.skin){a=this.meta;for(r in a)i=a[r],e=window.require(i.control),o=this.accessLevel>=(i.access||0),s=i.options,n=i.if,o||(s.readonly=!0),this.append(new e({item:t,attribute:r,options:s,composition:this.composition,isAccesible:o,conditions:n}))}return this.children(function(e){return e.setItem(t)}),this.skin=t,this.scroll().update()},e.prototype.onScroll=function(){return this.children(function(t){return"function"==typeof t.deactivate?t.deactivate():void 0})},e}(o),t.exports=a},function(t,e,r){var n,i,o,s,a,u,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;n=window.require("spine/controller"),s=window.require("core/models/skin"),i=r(13),u={confirmBtnClass:"green-button button--uc button--save create-button",cancelBtnClass:"dim-button button--uc button--overwrite override-button",title:"How do you want to proceed?",content:'<input class="general-input skin-name" type="text" placeholder="Untitled Theme" />',note:"Changes will also apply to previous uses of this theme.",confirmBtn:"Create a new theme",cancelBtn:"Overwrite previous theme",separator:!0},a={confirmBtnClass:u.confirmBtnClass,cancelBtnClass:u.cancelBtnClass,title:"Create a new theme?",content:u.content,confirmBtn:"Create",separator:!1},o=function(t){function e(){this._closePopup=l(this._closePopup,this),this._onSaveCanceled=l(this._onSaveCanceled,this),this.override=l(this.override,this),this.save=l(this.save,this),e.__super__.constructor.apply(this,arguments),this.popup=new i({className:"popup skin-save-popup"}),this.listenTo(this.popup,"canceled",this._onSaveCanceled)}return c(e,t),e.prototype.saveItem=function(t){return this.model=(this.item=t).item,this.popup.render(null!=this.model.user_id?u:a).pop(this.place,this.save,this.override)},e.prototype.save=function(){var t,e;return t=this.model.attributes(),delete t.id,delete t.uses,t=$.extend({},t,{name:this.popup.el.find("input").val(),user_id:1}),this.item.item.reset(),e=new s(t),e.save(),this.item.changes={}},e.prototype.override=function(){return this.item.override(),this.item.item.save()},e.prototype._onSaveCanceled=function(){return this.model.trigger("save-canceled")},e.prototype._closePopup=function(){return this.popup.close()},e}(n),t.exports=o},function(t,e,r){var n,i,o,s,a,u=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=window.require("spine/controller"),o=r(13),s=window.require("core/models/skin"),a=function(t){return{confirmBtnClass:"green-button button--uc popup-button red-button",cancelBtnClass:"dim-button button--uc popup-button dark-purple-button",title:'Delete Theme "'+t.name+'"?',confirmBtn:"Delete",cancelBtn:"Cancel"}},i=function(t){function e(){this._closePopup=u(this._closePopup,this),this.deleteit=u(this.deleteit,this),this.deleteItem=u(this.deleteItem,this),e.__super__.constructor.apply(this,arguments),this.popup=new o({className:"popup skin-delete-popup"})}return l(e,t),e.prototype.deleteItem=function(t){return this.model=(this.item=t).item,this.popup.render(a(this.model)).pop(this.place,this.deleteit),this.listenToOnce(s,"selected",this._closePopup)},e.prototype.deleteit=function(t){var e;return this.stopListening(s,"selected",this._closePopup),this.item.isActive()&&(e=this.item.el,e.next().add(e.prev()).first().controller().active()),this.item.release(),this.model.destroy()},e.prototype._closePopup=function(){return this.popup.close()},e}(n),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l,c,p,d,h=function(t,e){return function(){return t.apply(e,arguments)}},f=function(t,e){function r(){this.constructor=t}for(var n in e)g.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},g={}.hasOwnProperty;n=window.require("spine/controller/activateable"),p=window.require("spine/controller/tabs"),a=window.require("core/models/content"),window.require("core/models/composition"),c=r(106),i=r(50),u=r(139),l=r(141),d=r(112),o=r(53).default,s=function(t){function e(){this.afterAdd=h(this.afterAdd,this),this._onBrowserState=h(this._onBrowserState,this),this.showError=h(this.showError,this),this._onItemUpdate=h(this._onItemUpdate,this),this._onItemCreate=h(this._onItemCreate,this),this.onItemDestroy=h(this.onItemDestroy,this),this.contentUpdate=h(this.contentUpdate,this),this.contentRemove=h(this.contentRemove,this),this.contentAdd=h(this.contentAdd,this),this._freeContentCanAdd=h(this._freeContentCanAdd,this),this._premiumContentCanAdd=h(this._premiumContentCanAdd,this),this.contentCanAdd=h(this.contentCanAdd,this),this.focusBrowser=h(this.focusBrowser,this),this.legacyAddBrowser=h(this.legacyAddBrowser,this),this.addBrowser=h(this.addBrowser,this),this.initialize=h(this.initialize,this),this.deactivate=h(this.deactivate,this),this.activate=h(this.activate,this),this.browsers={},e.__super__.constructor.apply(this,arguments),this.el.prepend((this.notificator=new l).el),o.Content.events.error(this.showError),this.$bind("error",function(t){return function(e,r){return t.showError(r)}}(this))}return f(e,t),e.prototype.className="content-browser",e.prototype.tabContainerClass="content-browser-tabs",e.prototype.containerClass="content-browser-container",e.prototype.title="Content",e.prototype.nextTitle="Edit Content",e.prototype.tabRenderer=c,e.include(n),e.prototype.interval=0,e.prototype.events={"editor:browser:active":"_onBrowserState","editor:browser:auth":"_onBrowserState"},e.prototype.children=function(t){var e,r,n,i;null==t&&(t=function(){return!0}),n=this.browsers,i=[];for(e in n)r=n[e],t(r)&&i.push(r);return i},e.prototype.setPremium=function(t){this.premium=t},e.prototype.activate=function(){var t,e;return n.activate.apply(this,arguments),null!=(t=this.children(function(t){return t.isActive()}))&&null!=(e=t[0])&&"function"==typeof e.auth&&e.auth(),this.$trigger("viewChange","content"),this},e.prototype.deactivate=function(){var t;return n.deactivate.apply(this,arguments),null!=(t=this.children(function(t){return t.isActive()})[0])&&"function"==typeof t.refreshChildren?t.refreshChildren():void 0},e.prototype.for=function(t){return this.composition=t,this.initialize(),this},e.prototype.initialize=function(){var t,e,r,n,i;if(!this.composition)return console.warn("No composition set");this.children(function(t){return t.release()}),this.stopListening(),this.meta=this.composition.contentMeta(),this.browserOptions=null!=(e=this.meta.browser)?e.options:void 0,this.addBrowser(d),(i=null!=(r=this.meta.browser)?r.sources:void 0)&&(delete i.facebook,delete i.websearch,delete i.blogvio,delete i.dropbox,delete i.flickr,delete i["google-drive"]);for(t in i)n=i[t],this.legacyAddBrowser(n,t);return this.meta.input&&(this.append(this.input=new u({control:this.meta.input,composition:this.composition})),this.browsers.input=this.input,this.listenTo(this.input,"canAdd",this.contentCanAdd)),this.listenTo(a,"destroy",this.onItemDestroy),this.listenTo(a,"update",this._onItemUpdate),this.listenTo(a,"create",this._onItemCreate),this.listenTo(a,"change",function(t){return function(){return t.el.toggleClass("has-reached-max",t.composition.maxContentReached())}}(this)),this.children()[0].active(),this.trigger("initialized")},e.prototype.addBrowser=function(t){var e,r,n,i;if(t.isCompatible(null!=(r=this.browserOptions)?r.types:void 0))return e=new t({filetypes:null!=(n=this.browserOptions)?n.types:void 0}),e.on("toggle",function(e){return function(r){var n,i,s;if(i=r.file,s=r.options,!((null!=s?s.afterUpload:void 0)&&o.Content.maxContentReached(e.composition)))try{return o.Content.toggleItem(e.composition,t.name,i.id,i.url,e.meta.attributes.title?{title:i.name}:void 0)}catch(t){return n=t,console.warn(n)}}}(this)),e.on("clearContent",function(e){return function(){return o.Content.clearContent(e.composition,t.name)}}(this)),e.observe("selected",function(t){return e.tab.count(t.length)}),i=function(r){return function(){var r,n;return r=o.Content.getItemsByService(t.name),n=r.map(function(t){return t.metadata.id}),e.set({selected:n})}}(),o.Content.events.change(i),i(),this.append(this.browsers[t.name]=e)},e.prototype.legacyAddBrowser=function(t,e){var r,n,o;return r=window.require(t.module||"editor/content/service/default"),o=this.composition.getContent().filter(function(t){var r;return(null!=(r=t.metadata)?r.service:void 0)===e}).map(function(t){return t.metadata}),i=window.require(t.browser||r.browser),this.browsers[e]=n=new i({content:o,title:e,Service:r,options:$.extend({},this.browserOptions,t.options||{})}),this.listenTo(n,"add",this.contentAdd),this.listenTo(n,"remove",this.contentRemove),this.listenTo(n,"update",this.contentUpdate),this.listenTo(n,"canAdd",this.contentCanAdd),this.append(n)},e.prototype.focusBrowser=function(t){var e;return null!=(e=this.browsers[t]||{links:this.input}[t])?e.active():void 0},e.prototype.contentCanAdd=function(t,e){return this.premium?this._premiumContentCanAdd(t,e):this._freeContentCanAdd(t,e)},e.prototype._premiumContentCanAdd=function(t,e){return this.composition.maxContentReached()?e?void 0:this.showError("max",!0):t.call(this)},e.prototype._freeContentCanAdd=function(t,e){var r;return r=this.composition.contentMeta().options.free_user_limit,this.composition.maxContentReached(r)?e?void 0:this.showError("maxFree",!0):t.call(this)},e.prototype.contentAdd=function(t){var e,r,n;r={},n=this.meta.attributes;for(e in n)n[e],null!=t[e]&&(r[e]=t[e]);return r.metadata=t,r.composition_id=this.composition.id,r[this.meta.browser.options.attribute]=t.url,new a(r).save()},e.prototype.contentRemove=function(t){var e,r;if(this.stopListening(a,"destroy",this.onItemDestroy),r=a.all().filter(function(e){return function(r){var n;return(null!=(n=r.metadata)?n.id:void 0)===t.id&&r.composition_id===e.composition.id}}(this)),null!=(e=r[0])&&e.destroy(),this.listenTo(a,"destroy",this.onItemDestroy),!this.composition.hasEnoughContent())return this.showError("min",!0)},e.prototype.contentUpdate=function(t,e,r){var n;if(n=a.all().filter(function(e){return function(e){return e.metadata===t}}()),n.length)return n[0].updateAttribute(e,r)},e.prototype.onItemDestroy=function(t){var e,r,n;if(t.composition_id===this.composition.id)return(n=null!=(e=t.metadata)?e.service:void 0)&&"directinput"!==n&&null!=(r=this.browsers[n])&&"function"==typeof r.removeEntry&&r.removeEntry(t.metadata),!0},e.prototype._onItemCreate=function(t){var e,r,n;if(t.composition_id===this.composition.id)return(n=null!=(e=t.metadata)?e.service:void 0)&&"directinput"!==n?null!=(r=this.browsers[n])&&"function"==typeof r.addEntry&&r.addEntry(t.metadata):this.input.addEntry(t),!0},e.prototype._onItemUpdate=function(t){var e,r,n;if(t.composition_id===this.composition.id)return(n=null!=(e=t.metadata)?e.service:void 0)&&"directinput"!==n&&null!=(r=this.browsers[n])&&"function"==typeof r.updateEntry&&r.updateEntry(t,t.metadata),!0},e.prototype.showError=function(t,e){var r;return null==e&&(e=!1),r=this.composition[t+"ErrorMsg"]?this.composition[t+"ErrorMsg"]():t,this.notificator.notify(r,{timeout:1e4,onClick:e?function(t){return function(){return t.$trigger("Content:upgrade")}}(this):void 0})},e.prototype._onBrowserState=function(t,e){return this.$trigger("editor:content:browserState",e)},e.prototype.afterAdd=function(t){if(e.__super__.afterAdd.apply(this,arguments),t.options.pos)return this.tabs.el.children(":nth-child("+t.options.pos+")").before(t.tab.el)},e.prototype.release=function(){return this._release(this),e.__super__.release.apply(this,arguments)},e}(p),t.exports=s},function(t,e,r){var n,i,o,s,a,u,l,c,p=function(t,e){return function(){return t.apply(e,arguments)}},d=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=window.require("spine/controller"),i=window.require("spine/controller/container"),n=window.require("spine/controller/activateable"),l=r(5),o=window.require("core/models/content"),u=r(140),window.require("core/models/composition"),c=function(t){return function(e){return e.item.eql(t)}},a=function(t){function e(){this._onCompositionSave=p(this._onCompositionSave,this),this.activate=p(this.activate,this),this.active=p(this.active,this),this._release=p(this._release,this),this.onItemCreated=p(this.onItemCreated,this),this.new=p(this.new,this),this._new=p(this._new,this),this.contentItems=p(this.contentItems,this),e.__super__.constructor.apply(this,arguments),this.append.apply(this,this.contentItems()),this.delay(function(t){return function(){return t.new(),t.tab.el.attr("control",t.control.control),t._updateTabCount()}}(this)),this.listenTo(this.composition,"save",this._onCompositionSave),this.listenTo(o,"destroy",this.delay.bind(this,this.new))}return d(e,t),e.prototype.className="directinput browser",e.prototype.title="directinput",e.prototype.serviceTitle="link",e.include(i),e.include(n),e.include(l),e.prototype.attributes={authenticated:!0},e.prototype.contentItems=function(){return this.composition.getContent().filter(function(t){var e,r;return!(null!=(e=t.metadata)?e.service:void 0)||"directinput"===(null!=(r=t.metadata)?r.service:void 0)}).map(function(t){return function(e){return new u({control:t.control,item:e})}}(this))},e.prototype.addEntry=function(t){var e;if(!this.children(c(t)).length)return this.append(e=new u({control:this.control,item:t})),this._getNewField().el.insertAfter(e.el),this._updateTabCount(),this.scroll().update(),this},e.prototype._new=function(t){return null!=this.field?this.field.enable():(this.item=new o({metadata:{service:"directinput"},composition_id:this.composition.id}),this.field=new u({control:this.control,item:this.item}),this.item.one("create",this.onItemCreated),this.append(this.field),this._updateTabCount(),this.scroll().update(),t?this.scroll().scrollTo("bottom",{inertia:!1}):void 0)},e.prototype.new=function(t){if(this._updateTabCount(),this._new(t),this.field.disable(),this.trigger("canAdd",this.field.enable,!0),!this._count())return this._new()},e.prototype.onItemCreated=function(){return this.item=this.field=null,this.new()},e.prototype._release=function(t){return i._release.apply(this,[t]),this._updateTabCount(),this.scroll().update()},e.prototype.active=function(){return n.active.apply(this,arguments),this.$trigger("editor:browser:active",{service:"directinput",authenticated:!1}),this.scroll().update()},e.prototype.activate=function(){if(n.activate.apply(this,arguments),null!=this.field)return this.field.disable(),this.trigger("canAdd",this.field.enable,!0)},e.prototype._updateTabCount=function(){var t;return null!=(t=this.tab)?t.count(this._count()):void 0},e.prototype._count=function(){return this.children(function(t){return!t.item.isNew()}).length},e.prototype._getNewField=function(){return this.children(function(t){return t.item.isNew()})[0]},e.prototype._onCompositionSave=function(t,e){var r;if(e.changedID)return null!=(r=this._getNewField())?r.item.composition_id=this.composition.id:void 0},e}(s),t.exports=a},function(t,e){var r,n,i,o=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=window.require("spine/controller"),r=window.require("spine/controller/container"),i=function(t){function e(){this.onInputFocus=o(this.onInputFocus,this),this.disable=o(this.disable,this),this.enable=o(this.enable,this);var t;e.__super__.constructor.apply(this,arguments),this.control=$.extend(!0,{},this.control),this.item.isNew()&&this.$addClass("new"),this.listenTo(this.item,"create",function(t){return function(){return t.$removeClass("new")}}(this)),this.listenTo(this.item,"destroy",this.release),t=window.require(this.control.control),this.control=new t({item:this.item,attribute:this.control.attribute,options:this.control.options}),this.append(this.control,"<span class='field-delete' data-icon='⏍'></span>")}return s(e,t),e.prototype.className="directinput-field",e.prototype.title="directinput",e.include(r),e.prototype.elements={".field-delete":"del",input:"input"},e.prototype.events={"click .field-delete":"_delete","focus input":"onInputFocus","click .input-textarea":"onInputFocus"},e.prototype._delete=function(){return this.item.destroy()},e.prototype.enable=function(){return this.el.toggleClass("disabled",this.disabled=!1)},e.prototype.disable=function(){return this.el.toggleClass("disabled",this.disabled=!0)},e.prototype.onInputFocus=function(){if(this.parent().trigger("canAdd",function(){},!this.disabled),this.disabled)return this.input.blur()},e}(n),t.exports=i},function(t,e){var r,n=function(t,e){return function(){return t.apply(e,arguments)}};r=function(){function t(){this._onClick=n(this._onClick,this),this.notify=n(this.notify,this),this.close=n(this.close,this),this.render=n(this.render,this),this.template=n(this.template,this),this.el=$('<div class="'+this.className+'">'),this.message="",this.el.on("click",".close",this.close),this.el.on("click",this._onClick)}return t.prototype.className="message notification",t.prototype.template=function(t){return"<div class='text'>"+t+"</div><div class='close' data-icon='x'></div>"},t.prototype.render=function(t){return this.message=null!=t?t:this.message,this.el.html(this.template(this.message))},t.prototype.close=function(t){return null!=t&&t.stopPropagation(),clearTimeout(this.interval),this.el.transition({top:-60,queue:!1}),this.el.trigger("editor:notification",{show:!1})},t.prototype.notify=function(t,e){return null==e&&(e={}),this.el.trigger("editor:notification",{show:!0}),this.render(t),clearTimeout(this.interval),this.clickAction=e.onClick,this.el.show().stop(!0,!1).transition({top:0},function(t){return function(){return t.interval=setTimeout(t.close,e.interval||3e3)}}(this))},t.prototype._onClick=function(t){return t.preventDefault(),"function"==typeof this.clickAction&&this.clickAction(),this.close(t)},t}(),t.exports=r},function(t,e,r){(function(t,n){var i;(function(o){"use strict";var s=0,a=Array.prototype.slice,u=function(t,e){var r=t[e];if(r===o&&j.strict)throw new Error("Bottle was unable to resolve a service. `"+e+"` is undefined.");return r},l=function(t){return this.nested[t]||(this.nested[t]=N.pop())},c=function(t){return t.split(".").reduce(u,this)},p=function(t,e){var r=t.split(".");return t=r.pop(),d.call(r.reduce(F,this.container),t,e),this},d=function(t,e){Object.defineProperty(this,t,{configurable:!1,enumerable:!0,value:e,writable:!1})},h=function(t,e){var r,n;return"function"==typeof t&&(e=t,t="__global__"),r=t.split("."),n=r.shift(),r.length?l.call(this,n).decorator(r.join("."),e):(this.decorators[n]||(this.decorators[n]=[]),this.decorators[n].push(e)),this},f=function(t){return this.deferred.push(t),this},g=function(t){return(t||[]).map(c,this.container)},_=function(t,e){return k.call(this,t,function(){this.$get=e})},y=function(t,e){return _.call(this,t,function(t){return{instance:e.bind(e,t)}})},v=function(t){return!/^\$(?:decorator|register|list)$|Provider$/.test(t)},m=function(t){return Object.keys(t||this.container||{}).filter(v)},b=function(t,e,r,n){var i={configurable:!0,enumerable:!0};return t.length?i.get=function(){var e=0,n=function(i){if(i)throw i;t[e]&&t[e++](r,n)};return n(),r}:(i.value=r,i.writable=!0),Object.defineProperty(n,e,i),n[e]},w=function(t,e){var r,n;return"function"==typeof t&&(e=t,t="__global__"),r=t.split("."),n=r.shift(),r.length?l.call(this,n).middleware(r.join("."),e):(this.middlewares[n]||(this.middlewares[n]=[]),this.middlewares[n].push(e)),this},E={},P=function(t){var e;return"string"==typeof t?(e=E[t],e||(E[t]=e=new N,e.constant("BOTTLE_NAME",t)),e):new N},S=function(t){"string"==typeof t?delete E[t]:E={}},x=function(t,e){return e(t)},k=function(t,e){var r,n;return r=t.split("."),this.providerMap[t]&&1===r.length&&!this.container[t+"Provider"]?console.error(t+" provider already instantiated."):(this.originalProviders[t]=e,this.providerMap[t]=!0,n=r.shift(),r.length?(T.call(this,n,e,r),this):O.call(this,n,e))},A=function(t,e){return(t[e]||[]).concat(t.__global__||[])},O=function(t,e){var r,n,i,s,a;return this.id,i=this.container,s=this.decorators,a=this.middlewares,r=t+"Provider",n=Object.create(null),n[r]={configurable:!0,enumerable:!0,get:function(){var t=new e;return delete i[r],i[r]=t,t}},n[t]={configurable:!0,enumerable:!0,get:function(){var e,n=i[r];return n&&(e=A(s,t).reduce(x,n.$get(i)),delete i[r],delete i[t]),e===o?e:b(A(a,t),t,e,i)}},Object.defineProperties(i,n),this},T=function(t,e,r){var n;return n=l.call(this,t),this.factory(t,function(){return n.container}),n.provider(r.join("."),e)},C=function(t){var e=t.$value===o?t:t.$value;return this[t.$type||"service"].apply(this,[t.$name,e].concat(t.$inject||[]))},R=function(t){delete this.providerMap[t],delete this.container[t],delete this.container[t+"Provider"]},M=function(){var t=this.originalProviders;Object.keys(this.originalProviders).forEach(function(e){var r=e.split(".");r.length>1&&(R.call(this,r[0]),r.forEach(R,l.call(this,r[0]))),R.call(this,e),this.provider(e,t[e])},this)},I=function(t){return this.deferred.forEach(function(e){e(t)}),this},D=function(t,e){var r=arguments.length>2?a.call(arguments,2):null,n=this;return _.call(this,t,function(){var t=e;if(r){var i=r.map(c,n.container);i.unshift(e),t=e.bind.apply(e,i)}return new t})},L=function(t,e){var r;return r=t.split("."),t=r.pop(),U.call(r.reduce(F,this.container),t,e),this},F=function(t,e){var r=t[e];return r||(r={},U.call(t,e,r)),r},U=function(t,e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})},N=function t(e){if(!(this instanceof t))return t.pop(e);this.id=s++,this.decorators={},this.middlewares={},this.nested={},this.providerMap={},this.originalProviders={},this.deferred=[],this.container={$decorator:h.bind(this),$register:C.bind(this),$list:m.bind(this)}};N.prototype={constant:p,decorator:h,defer:f,digest:g,factory:_,instanceFactory:y,list:m,middleware:w,provider:k,resetProviders:M,register:C,resolve:I,service:D,value:L},N.pop=P,N.clear=S,N.list=m;var j=N.config={strict:!1},B={function:!0,object:!0};!function(s){var a=B[typeof e]&&e&&!e.nodeType&&e,u=B[typeof t]&&t&&!t.nodeType&&t,l=(u&&u.exports,B[typeof n]&&n);!l||l.global!==l&&l.window!==l||(s=l),s.Bottle=N,(i=function(){return N}.call(e,r,e,t))!==o&&(t.exports=i)}(B[typeof window]&&window||this)}).call(this)}).call(e,r(46)(t),r(39))},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=r(54),u=r(55),l=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=window.require("core/models/content"),p=function(t){function e(t){i(this,e);var r=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.userIsPremium=t.premium,r.events=["change","error"],c.on("change",r._broadcast.change),r}return s(e,t),l(e,[{key:"getItemsByService",value:function(t){return c.select(function(e){return!!e.metadata&&e.metadata.service===t})}},{key:"maxContentReached",value:function(t){var e=t.contentMeta(),r=this.userIsPremium?e.options.max:e.options.free_user_limit;return t.maxContentReached(r)}},{key:"toggleItem",value:function(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=this.getItemsByService(e).filter(function(t){return t.metadata.id===r}).pop();s?s.destroy():this.addItem(t,n,i,Object.assign({},o,{id:r,service:e}))}},{key:"clearContent",value:function(t,e){this.getItemsByService(e).forEach(function(t){return t.destroy()})}},{key:"addItem",value:function(t,e,r,i){var o=t.contentMeta();if(this.maxContentReached(t)&&o.options.max>1)throw this._broadcast.error(this.userIsPremium?"max":"maxFree"),new Error("Cannot add more than max items");this.maxContentReached(t)&&1===o.options.max&&c.select(function(e){return e.composition_id===t.id}).forEach(function(t){return t.destroy()}),new c(Object.assign({},r,n({composition_id:t.id,metadata:i},o.options.mainAttribute,e))).save()}}]),e}(u.a(a.a));e.a=p},function(t,e,r){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=r(54),a=r(55),u=r(114),l=r.n(u),c=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),p=function t(e){o(this,t),this.id=++t.guid,Object.assign(this,t.defaults,e)};p.defaults={lastModified:void 0,state:"complete",thumbnail:void 0,url:void 0,error:void 0,name:void 0,progress:0,size:0,type:"*",uploadFile:void 0},p.guid=0;var d=function(t){return t.indexOf("/")>0?t.slice(0,t.indexOf("/")):t},h=function(t){function e(t,r){o(this,e);var i=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return i.user=t.id,i.token=r,i.refreshed={},i.files=[],i.maxFilesize=t.premium?250:25,i.quota=1e3*(t.premium?1e4:250)*1e3,i.used=0,i.events=["update","complete"],i}return i(e,t),c(e,[{key:"getMaxFileSize",value:function(){return this.maxFilesize}},{key:"getUploadURL",value:function(){return"/upload?user="+this.user}},{key:"getAuthHeaders",value:function(){return{"w-utoken":this.token}}},{key:"getFiles",value:function(t){var e=this;return t=d(t),this.refreshed[t]?Promise.resolve(this.files.filter(function(e){return e.type===t})):this._fetch(t).then(function(t){return e.files.push.apply(e.files,t)}).then(this._broadcast.update).then(function(r){return e.files.filter(function(e){return e.type===t})})}},{key:"get",value:function(t){return this.files.filter(function(e){return e.id===t})[0]}},{key:"upload",value:function(t){var e=new p({state:"new",size:t.size,name:t.name,type:d(t.type),lastModified:Date.now(),uploadFile:t});this.files.push(e),this.used+=t.size,this._broadcast.update()}},{key:"uploadComplete",value:function(t,e){if("error"!==t.status){var r=JSON.parse(t.xhr.response),n=r.files.data[0];this.used=r.quota.used,this._update(t,function(t){t.state="complete",t.id=n.id,t.path=n.path,t.url=r.hostUrl+t.path,t.lastModified=n.lastModified}),this._broadcast.complete([this.get(n.id),e])}}},{key:"accept",value:function(t,e){if(this.used<this.quota)return e();e("The file exceeds the quota by "+l.a(this.used-this.quota)+".")}},{key:"remove",value:function(t){this.files=this.files.filter(function(e){return e.id!==t.id}),this.used-=t.size,"complete"===t.state&&this._remove(t),this._broadcast.update()}},{key:"setThumbnail",value:function(t,e){this._update(t,function(t){return t.thumbnail=e})}},{key:"setError",value:function(t,e){this.used-=t.size,this._update(t,function(t){t.error=e,t.size=0})}},{key:"setUploadProgress",value:function(t,e,r){this._update(t,function(t){return t.progress=e})}},{key:"setUploadState",value:function(t,e){this._update(t,function(t){return t.state=e})}},{key:"_update",value:function(t,e){this.files=this.files.map(function(r){return r.uploadFile===t&&e(r),r}),this._broadcast.update()}},{key:"_fetch",value:function(t){var e=this;return jQuery.ajax({url:"/upload/?user="+this.user+"&type="+t,headers:this.getAuthHeaders()}).then(function(r){return e.refreshed[t]=!0,e.used=r.quota.used,r.files.data.map(function(t){var e=d(t.mime),n=r.hostUrl+t.path,i="image"===e?n:void 0;return new p({id:t.id,type:e,url:n,thumbnail:i,path:t.path,name:t.name,size:t.size,lastModified:t.lastModified})})})}},{key:"_remove",value:function(t){return jQuery.ajax({method:"DELETE",url:"/upload/?user="+this.user+"&filePath="+t.path,headers:this.getAuthHeaders()}).then(function(t){}).then(this._broadcast.update).catch(console.error.bind(console))}}]),e}(a.a(s.a));e.a=h},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=r(54),a=r(55),u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),l=function(t){function e(){n(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.events=["state"],t.sounds={},t}return o(e,t),u(e,[{key:"load",value:function(t,e){this.sounds[t]||this._initSound(t,e)}},{key:"getState",value:function(t){return this.sounds[t]?this.sounds[t].state:"uninitialized"}},{key:"togglePlay",value:function(t){this._isPlaying(t)?this.stop(t):this.play(t)}},{key:"play",value:function(t){if(!this.sounds[t])throw new Error("Sound must be loaded first");var e=this.sounds[t].sound;window.soundManager.stopAll(),this.sounds[t].state="loading",e.setPosition(0).play()}},{key:"stop",value:function(t){if(!this.sounds[t])throw new Error("Sound must be loaded first");this.sounds[t].sound.stop()}},{key:"_initSound",value:function(t,e){var r=this._onStatusChange.bind(this,t),n={url:e,volume:100,onpause:r,onstop:r,onresume:r,onfinish:r,onload:r,onplay:r};return this.sounds[t]={sound:window.soundManager.createSound(n),state:"paused"}}},{key:"_onStatusChange",value:function(t){this.sounds[t].state=this._isPlaying(t)?"playing":this._isLoading(t)?"loading":"paused",this._broadcast.state(t)}},{key:"_isPlaying",value:function(t){var e=this.sounds[t].sound;return!!e&&(!e.paused&&1===e.playState&&3===e.readyState)}},{key:"_isLoading",value:function(t){var e=this.sounds[t].sound;return!!e&&1===e.readyState}}]),e}(a.a(s.a));e.a=l},function(t,e,r){"use strict";function n(){var t=P.e("style");t.id="svelte-2441907646-style",t.textContent='\n section[svelte-2441907646], [svelte-2441907646] section {\n display: flex;\n flex-direction: column;\n padding-left: 20px;\n height: calc(100% - 25px);\n color: #665b68;\n }\n\n a[svelte-2441907646]:focus, [svelte-2441907646] a:focus {\n outline: none;\n }\n\n [svelte-2441907646].error-panel, [svelte-2441907646] .error-panel {\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n text-align: center;\n padding-right: 20px;\n }\n\n [svelte-2441907646].browser-nav, [svelte-2441907646] .browser-nav {\n position: static;\n\n font-family: ProximaNova-Regular;\n font-size: 16px;\n color: #0055FF;\n }\n\n [svelte-2441907646].blogvio-browser-title, [svelte-2441907646] .blogvio-browser-title {\n margin-top: 0;\n font: 30px/60px "ProximaNova-Regular";\n color: #0055FF;\n }\n\n [svelte-2441907646].nano, [svelte-2441907646] .nano {\n flex: 1;\n }\n\n strong[svelte-2441907646], [svelte-2441907646] strong {\n color: #0055FF;\n }\n\n [svelte-2441907646].dropzone_plchldr, [svelte-2441907646] .dropzone_plchldr {\n position: relative;\n margin: 20px 20px 20px 0;\n height: 75px;\n }\n\n [svelte-2441907646].dropzone, [svelte-2441907646] .dropzone {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n [svelte-2441907646].scrolling-container, [svelte-2441907646] .scrolling-container {\n transition: opacity 200ms ease-in;\n }\n\n [svelte-2441907646].dropzone--dragging .scrolling-container, [svelte-2441907646] .dropzone--dragging .scrolling-container {\n opacity: 0.4;\n }\n\n [svelte-2441907646].dropzone--dragging .dropzone, [svelte-2441907646] .dropzone--dragging .dropzone {\n top: -100px;\n }\n\n [svelte-2441907646].dropzone--large .dropzone, [svelte-2441907646] .dropzone--large .dropzone,\n [svelte-2441907646].dropzone--dragging .dropzone--large .dropzone, [svelte-2441907646] .dropzone--dragging .dropzone--large .dropzone {\n top: -200px;\n }\n\n [svelte-2441907646].icon, [svelte-2441907646] .icon {\n display: inline-block;\n width: 1em;\n height: 1em;\n stroke-width: 0;\n stroke: currentColor;\n fill: currentColor\n }\n\n [svelte-2441907646].clear-content svg, [svelte-2441907646] .clear-content svg {\n width: 14px;\n fill: #a0a0a0;\n position: relative;\n top: 1px;\n right: 2px;\n }\n\n [svelte-2441907646].clear-content:hover svg, [svelte-2441907646] .clear-content:hover svg {\n fill: #665b68;\n }\n',P.b(t,document.head)}function i(t,e){var r,n,i,o,s,a,u,l,c,p,d,h,f,g=new E.a({_root:e._root,data:{service:"Uploads"}});g.on("update",function(t){e._onUpdate(t)}),g.on("complete",function(t){e._onUploadComplete(t)}),e.refs.Uploads=g;var _=!t.loading&&y(t,e);return{create:function(){g._fragment.create(),r=P.g("\n\n"),n=P.f("svg"),i=P.f("symbol"),o=P.f("title"),s=P.g("upload"),a=P.f("path"),u=P.f("path"),l=P.f("symbol"),c=P.f("title"),p=P.g("error"),d=P.f("path"),h=P.g("\n\n"),_&&_.create(),f=P.d(),this.hydrate()},hydrate:function(t){P.p(n,"svelte-2441907646",""),P.p(n,"style","position: absolute; width: 0; height: 0; overflow: hidden"),P.p(n,"version","1.1"),P.p(n,"xmlns","http://www.w3.org/2000/svg"),P.p(n,"xmlns:xlink","http://www.w3.org/1999/xlink"),P.p(i,"id","icon-upload"),P.p(i,"viewBox","0 0 32 32"),P.p(a,"d","M30.038 19.938c-0.706 0-1.275 0.569-1.275 1.275v7.544h-25.525v-7.544c0-0.706-0.569-1.275-1.275-1.275s-1.275 0.569-1.275 1.275v8.825c0 0.706 0.569 1.275 1.275 1.275h28.075c0.706 0 1.275-0.569 1.275-1.275v-8.825c0-0.706-0.569-1.275-1.275-1.275z"),P.p(u,"d","M9.137 10.625l5.588-5.581v16.194c0 0.706 0.569 1.275 1.275 1.275s1.275-0.569 1.275-1.275v-16.194l5.587 5.581c0.769 0.713 1.556 0.25 1.806 0 0.5-0.5 0.5-1.306 0-1.806l-7.769-7.756c-0.5-0.5-1.306-0.5-1.806 0l-7.756 7.756c-0.5 0.5-0.5 1.306 0 1.806 0.494 0.5 1.306 0.5 1.8 0z"),P.p(l,"id","icon-error"),P.p(l,"viewBox","0 0 21.9 21.9"),P.p(d,"d","M14.1 11.3c-.2-.2-.2-.5 0-.7l7.5-7.5c.2-.2.3-.5.3-.7s-.1-.5-.3-.7L20.2.3c-.2-.2-.5-.3-.7-.3-.3 0-.5.1-.7.3l-7.5 7.5c-.2.2-.5.2-.7 0L3.1.3C2.9.1 2.6 0 2.4 0s-.5.1-.7.3L.3 1.7c-.2.2-.3.5-.3.7s.1.5.3.7l7.5 7.5c.2.2.2.5 0 .7L.3 18.8c-.2.2-.3.5-.3.7s.1.5.3.7l1.4 1.4c.2.2.5.3.7.3s.5-.1.7-.3l7.5-7.5c.2-.2.5-.2.7 0l7.5 7.5c.2.2.5.3.7.3s.5-.1.7-.3l1.4-1.4c.2-.2.3-.5.3-.7s-.1-.5-.3-.7l-7.5-7.5z"),P.p(d,"fill","#de2618")},mount:function(t,e){g._fragment.mount(t,e),P.l(r,t,e),P.l(n,t,e),P.b(i,n),P.b(o,i),P.b(s,o),P.b(a,i),P.b(u,i),P.b(l,n),P.b(c,l),P.b(p,c),P.b(d,l),P.l(h,t,e),_&&_.mount(t,e),P.l(f,t,e)},update:function(t,r){r.loading?_&&(_.unmount(),_.destroy(),_=null):_?_.update(t,r):(_=y(r,e),_.create(),_.mount(f.parentNode,f))},unmount:function(){g._fragment.unmount(),P.i(r),P.i(n),P.i(h),_&&_.unmount(),P.i(f)},destroy:function(){e.refs.Uploads===g&&(e.refs.Uploads=null),g.destroy(!1),_&&_.destroy()}}}function o(t,e){var r,n,i,o;return{create:function(){r=P.e("span"),i=P.g(n=t.selectedForDeletion.length),o=P.g(" files selected for removal")},mount:function(t,e){P.l(r,t,e),P.b(i,r),P.b(o,r)},update:function(t,e){n!==(n=e.selectedForDeletion.length)&&(i.data=n)},unmount:function(){P.i(r)},destroy:P.m}}function s(t,e){var r,n;return{create:function(){r=P.e("span"),n=P.g("Select files to be removed from the server")},mount:function(t,e){P.l(r,t,e),P.b(n,r)},update:P.m,unmount:function(){P.i(r)},destroy:P.m}}function a(t,e){function r(t){e.set({deleteMode:!0})}var n;return{create:function(){n=P.e("div"),this.hydrate()},hydrate:function(t){n.className="browser-logout",P.p(n,"data-tooltip-text","Permanently remove files from server"),P.p(n,"data-tooltip-position","80% 3%"),P.p(n,"data-icon","⏍"),P.a(n,"click",r)},mount:function(t,e){P.l(n,t,e)},unmount:function(){P.i(n)},destroy:function(){P.o(n,"click",r)}}}function u(t,e){function r(t){e.fire("clearContent")}var n,i,o,s;return{create:function(){n=P.e("div"),i=P.f("svg"),o=P.f("path"),s=P.f("path"),this.hydrate()},hydrate:function(t){n.className="browser-logout clear-content",P.p(n,"data-tooltip-text","Clear Content"),P.a(n,"click",r),P.p(i,"xmlns","http://www.w3.org/2000/svg"),P.p(i,"viewBox","0 0 512 512"),P.p(o,"d","M490.667 85.333h-64v-64C426.667 9.551 417.115 0 405.333 0h-384C9.551 0 0 9.551 0 21.333V448c0 11.782 9.551 21.333 21.333 21.333h64v21.333c0 11.782 9.551 21.333 21.333 21.333h384c11.782 0 21.333-9.551 21.333-21.333v-384c.001-11.781-9.55-21.333-21.332-21.333zm-448 341.334v-384H384v42.667H106.667c-11.782 0-21.333 9.551-21.333 21.333v320H42.667zm426.666 42.666H128V128h341.333v341.333z"),P.p(s,"d","M389.176 208.158c-8.331-8.331-21.839-8.331-30.17 0l-60.339 60.339-60.339-60.339c-8.331-8.331-21.839-8.331-30.17 0s-8.331 21.839 0 30.17l60.339 60.339-60.339 60.339c-8.331 8.331-8.331 21.839 0 30.17s21.839 8.331 30.17 0l60.339-60.339 60.339 60.339c8.331 8.331 21.839 8.331 30.17 0s8.331-21.839 0-30.17l-60.339-60.339 60.339-60.339c8.331-8.332 8.331-21.839 0-30.17z")},mount:function(t,e){P.l(n,t,e),P.b(i,n),P.b(o,i),P.b(s,i)},unmount:function(){P.i(n)},destroy:function(){P.o(n,"click",r)}}}function l(t,e){function r(t){e.deleteSelected()}function n(t){e.set({deleteMode:!1,selectedForDeletion:[]})}function i(t){return t.selectedForDeletion.length?o:s}var a,u,l,c,p,d=i(t),h=d(t,e);return{create:function(){a=P.e("div"),u=P.g("\n "),l=P.e("div"),c=P.g("\n "),h.create(),p=P.d(),this.hydrate()},hydrate:function(t){a.className="browser-logout",P.p(a,"data-tooltip-text","Permanently remove selected files from server (action cannot be undone)"),P.p(a,"data-tooltip-position","80% 3%"),P.p(a,"data-icon","✓"),P.a(a,"click",r),l.className="browser-logout",P.p(l,"data-tooltip-text","Cancel action"),P.p(l,"data-icon","x"),P.a(l,"click",n)},mount:function(t,e){P.l(a,t,e),P.l(u,t,e),P.l(l,t,e),P.l(c,t,e),h.mount(t,e),P.l(p,t,e)},update:function(t,r){d===(d=i(r))&&h?h.update(t,r):(h.unmount(),h.destroy(),h=d(r,e),h.create(),h.mount(p.parentNode,p))},unmount:function(){P.i(a),P.i(u),P.i(l),P.i(c),h.unmount(),P.i(p)},destroy:function(){P.o(a,"click",r),P.o(l,"click",n),h.destroy()}}}function c(t,e){var r,n,i=t.allowDelete&&a(t,e),o=t.allowClear&&u(t,e);return{create:function(){i&&i.create(),r=P.g("\n "),o&&o.create(),n=P.d()},mount:function(t,e){i&&i.mount(t,e),P.l(r,t,e),o&&o.mount(t,e),P.l(n,t,e)},update:function(t,s){s.allowDelete?i||(i=a(s,e),i.create(),i.mount(r.parentNode,r)):i&&(i.unmount(),i.destroy(),i=null),s.allowClear?o||(o=u(s,e),o.create(),o.mount(n.parentNode,n)):o&&(o.unmount(),o.destroy(),o=null)},unmount:function(){i&&i.unmount(),P.i(r),o&&o.unmount(),P.i(n)},destroy:function(){i&&i.destroy(),o&&o.destroy()}}}function p(t,e){for(var r,n=t.files,i=[],o=0;o<n.length;o+=1)i[o]=d(t,n,n[o],o,e);return{create:function(){for(var t=0;t<i.length;t+=1)i[t].create();r=P.d()},mount:function(t,e){for(var n=0;n<i.length;n+=1)i[n].mount(t,e);P.l(r,t,e)},update:function(t,n){var o=n.files;if("files"in t||"deleteMode"in t||"selected"in t||"selectedForDeletion"in t){for(var s=0;s<o.length;s+=1)i[s]?i[s].update(t,n,o,o[s],s):(i[s]=d(n,o,o[s],s,e),i[s].create(),i[s].mount(r.parentNode,r));for(;s<i.length;s+=1)i[s].unmount(),i[s].destroy();i.length=o.length}},unmount:function(){for(var t=0;t<i.length;t+=1)i[t].unmount();P.i(r)},destroy:function(){P.h(i,!1,0)}}}function d(t,e,r,n,i){var o=new w.a({_root:i._root,data:{file:r,selected:x.helpers.isSelected(r.id,t.deleteMode,t.selected,t.selectedForDeletion),selectedIcon:t.deleteMode?"delete":"check"}});return o.on("select",function(t){i.toggle(t)}),{create:function(){o._fragment.create()},mount:function(t,e){o._fragment.mount(t,e)},update:function(t,e,r,n,i){var s={};"files"in t&&(s.file=n),("files"in t||"deleteMode"in t||"selected"in t||"selectedForDeletion"in t)&&(s.selected=x.helpers.isSelected(n.id,e.deleteMode,e.selected,e.selectedForDeletion)),"deleteMode"in t&&(s.selectedIcon=e.deleteMode?"delete":"check"),Object.keys(s).length&&o.set(s)},unmount:function(){o._fragment.unmount()},destroy:function(){o.destroy(!1)}}}function h(t,e){var r=p(t,e),n=new b.a({_root:e._root,_yield:r,data:{class:"content-list"}});return e.refs.scrollPane=n,{create:function(){r.create(),n._fragment.create()},mount:function(t,e){n._fragment.mount(t,e)},update:function(t,e){r.update(t,e)},unmount:function(){n._fragment.unmount()},destroy:function(){e.refs.scrollPane===n&&(e.refs.scrollPane=null),r.destroy(),n.destroy(!1)}}}function f(t,e){var r,n,i,o,s,a,u,l,c,p,d,h;return{create:function(){r=P.e("div"),n=P.e("h2"),i=P.g("Hey there!"),o=P.g("\n "),s=P.e("h3"),a=P.g("You haven't uploaded any "),l=P.g(u=t.filetypes),c=P.g(" files yet."),p=P.g("\n "),d=P.e("span"),h=P.g("Drag some over or click below!"),this.hydrate()},hydrate:function(t){r.className="error-panel",r.style.cssText="height: 100%",n.className="blogvio-browser-title"},mount:function(t,e){P.l(r,t,e),P.b(n,r),P.b(i,n),P.b(o,r),P.b(s,r),P.b(a,s),P.b(l,s),P.b(c,s),P.b(p,r),P.b(d,r),P.b(h,d)},update:function(t,e){u!==(u=e.filetypes)&&(l.data=u)},unmount:function(){P.i(r)},destroy:P.m}}function g(t,e){function r(t){e.refresh(t)}var n,i,o,s,a,u,l,c,p,d,h,f,g,_,y,v,m;return{create:function(){n=P.e("div"),i=P.e("h2"),o=P.g("Failed to load uploaded files."),s=P.g("\n "),a=P.e("p"),l=P.g(u=t.error.message),c=P.g("\n "),p=P.e("a"),d=P.g("Click here to try again"),h=P.e("br"),f=P.g("\n "),g=P.e("span"),_=P.g("or "),y=P.e("a"),v=P.g("contact support"),m=P.g(" if the error persists."),this.hydrate()},hydrate:function(t){P.p(n,"svelte-2441907646",""),n.className="error-panel",i.className="blogvio-browser-title",p.href="#",P.a(p,"click",r),y.href="mailto:support@widgetic.com"},mount:function(t,e){P.l(n,t,e),P.b(i,n),P.b(o,i),P.b(s,n),P.b(a,n),P.b(l,a),P.b(c,n),P.b(p,n),P.b(d,p),P.b(h,n),P.b(f,n),P.b(g,n),P.b(_,g),P.b(y,g),P.b(v,y),P.b(m,g)},update:function(t,e){u!==(u=e.error.message)&&(l.data=u)},unmount:function(){P.i(n)},destroy:function(){P.o(p,"click",r)}}}function _(t,e){function r(t){return t.deleteMode?l:c}function n(t){return t.files.length?h:f}var i,o,s,a,u,p,d,g,_=r(t),y=_(t,e),v=n(t),b=v(t,e),w=new m.a({_root:e._root,data:{filetypes:t.filetypes+"/*",maxFilesize:t.maxFilesize,instanceId:t.instanceId}});return w.on("new",function(t){e._onDropZoneNewUpload(t)}),w.on("upload",function(t){e._onDropZoneUpload(t)}),w.on("dragging",function(t){e.set({dragging:t})}),w.on("error",function(t){e.fire("error",t)}),e.refs.dropzone=w,{create:function(){i=P.e("div"),y.create(),o=P.g("\n "),s=P.e("section"),u=P.g("\n "),b.create(),p=P.g("\n\n \n "),d=P.e("div"),w._fragment.create(),this.hydrate()},hydrate:function(e){P.p(i,"svelte-2441907646",""),i.className="browser-nav",P.p(s,"svelte-2441907646",""),s.className=a=t.dragging?"dropzone--dragging":"",d.className=g="dropzone_plchldr "+(t.files.length?"":"dropzone--large")},mount:function(t,e){P.l(i,t,e),y.mount(i,null),P.l(o,t,e),P.l(s,t,e),P.b(u,s),b.mount(s,null),P.b(p,s),P.b(d,s),w._fragment.mount(d,null)},update:function(t,o){_===(_=r(o))&&y?y.update(t,o):(y.unmount(),y.destroy(),y=_(o,e),y.create(),y.mount(i,null)),a!==(a=o.dragging?"dropzone--dragging":"")&&(s.className=a),v===(v=n(o))&&b?b.update(t,o):(b.unmount(),b.destroy(),b=v(o,e),b.create(),b.mount(s,p)),g!==(g="dropzone_plchldr "+(o.files.length?"":"dropzone--large"))&&(d.className=g);var u={};"filetypes"in t&&(u.filetypes=o.filetypes+"/*"),"maxFilesize"in t&&(u.maxFilesize=o.maxFilesize),"instanceId"in t&&(u.instanceId=o.instanceId),Object.keys(u).length&&w.set(u)},unmount:function(){P.i(i),y.unmount(),P.i(o),P.i(s),b.unmount()},destroy:function(){y.destroy(),b.destroy(),e.refs.dropzone===w&&(e.refs.dropzone=null),w.destroy(!1)}}}function y(t,e){function r(t){return t.error?g:_}var n,i=r(t),o=i(t,e);return{create:function(){o.create(),n=P.d()},mount:function(t,e){o.mount(t,e),P.l(n,t,e)},update:function(t,s){i===(i=r(s))&&o?o.update(t,s):(o.unmount(),o.destroy(),o=i(s,e),o.create(),o.mount(n.parentNode,n))},unmount:function(){o.unmount(),P.i(n)},destroy:function(){o.destroy()}}}function v(t){t=t||{},this.refs={},this._state=P.c(x.data(),t.data),this._observers={pre:Object.create(null),post:Object.create(null)},this._handlers=Object.create(null),this._root=t._root||this,this._yield=t._yield,this._torndown=!1,document.getElementById("svelte-2441907646-style")||n(),this._renderHooks=[],this._fragment=i(this._state,this),t.target&&(this._fragment.create(),this._fragment.mount(t.target,null)),this._flush(),t._root?t._root._renderHooks.push(x.oncreate.bind(this)):x.oncreate.call(this)}Object.defineProperty(e,"__esModule",{value:!0});var m=r(147),b=r(149),w=r(150),E=r(57),P=r(15),S=function(){function t(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),x=function(){var t=0;return{data:function(){return{instanceId:++t,loading:!0,error:null,files:[],dragging:!1,filetypes:"*",deleteMode:!1,selected:[],selectedForDeletion:[],maxFilesize:10,allowDelete:!0,allowClear:!0}},helpers:{isSelected:function(t,e,r,n){return e?n.includes(t):r.includes(t)}},oncreate:function(){this.Uploads=this.refs.Uploads.instance(),this.set({maxFilesize:this.Uploads.getMaxFileSize()}),this.refresh(),this.scrollToListBottom()},ondestroy:function(){this.observer.cancel()},methods:{toggle:function(t){if(t.error)return this.Uploads.remove(t),this.refresh();this.get("deleteMode")?this._toggleDelete(t):this._toggleSelect(t)},activate:function(){this.refs.scrollPane&&(this.refs.scrollPane.update(),this.scrollToListBottom())},refresh:function(t){var e=this;return t&&t.preventDefault(),this.Uploads.getFiles(this.get("filetypes")).then(function(t){return t=t.sort(function(t,e){var r=t.lastModified;r||(r=t.id.substring(t.id.indexOf("_u")+3)),r||(r=0);var n=e.lastModified;return n||(n=e.id.substring(e.id.indexOf("_u")+3)),n||(n=0),r-n}),e.set({files:t})}).then(this.activate.bind(this)).catch(this._reportError.bind(this)).then(function(t){e.set({loading:!1,error:null}),e.scrollToListBottom()})},deleteSelected:function(){var t=this,e=this.get("selected");this.get("selectedForDeletion").forEach(function(r){var n=t.Uploads.get(r);e.includes(r)&&t._toggleSelect(n),t.Uploads.remove(n)}),this.set({deleteMode:!1,selectedForDeletion:[]})},_toggleSelect:function(t,e){this.fire("toggle",{file:t,options:e})},_toggleDelete:function(t){var e=this.get("selectedForDeletion");e.includes(t.id)?e=e.filter(function(e){return e!==t.id}):e.push(t.id),this.set({selectedForDeletion:e})},_reportError:function(t){var e=t;"string"==typeof t&&(e={message:t}),t.jqXHR&&(e={message:t.jqXHR.statusText+" ("+t.jqXHR.responseText+")"}),console.error(t),this.set({error:e}),this.fire("error",e)},_onDropZoneNewUpload:function(t){this.scrollToListBottom()},scrollToListBottom:function(){this.refs.scrollPane&&this.refs.scrollPane.scrollBottom()},_onDropZoneUpload:function(t){this.toggle(t)},_onUpdate:function(t){this.refresh()},_onUploadComplete:function(t){var e=S(t,2),r=e[0];e[1]===this.get("instanceId")&&this._toggleSelect(r,{afterUpload:!0})}}}}();P.c(v.prototype,x.methods,P.n),v.prototype._set=function(t){var e=this._state;this._state=P.c({},e,t),P.k(this,this._observers.pre,t,e),this._fragment.update(t,this._state),P.k(this,this._observers.post,t,e),this._flush()},v.prototype.teardown=v.prototype.destroy=function(t){this.fire("destroy"),x.ondestroy.call(this),!1!==t&&this._fragment.unmount(),this._fragment.destroy(),this._fragment=null,this._state={},this._torndown=!0},e.default=v},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e,r,n){(n||"quota"in e&&g.j(t.quota,r.quota))&&(t.prettyQuota=e.prettyQuota=_.computed.prettyQuota(t.quota)),(n||"used"in e&&g.j(t.used,r.used))&&(t.prettyUsed=e.prettyUsed=_.computed.prettyUsed(t.used))}function o(){var t=g.e("style");t.id="svelte-3178269493-style",t.textContent='\n [svelte-3178269493].dropzone, [svelte-3178269493] .dropzone {\n display: flex;\n align-items: center;\n justify-content: center;\n\n background: #fff;\n border: 1px dashed #b8b8b8;\n\n font-size: 14px;\n font-family: "ProximaNova-Regular";\n text-align: center;\n cursor: pointer;\n\n transition: top 300ms ease-in, background 150ms ease-in 50ms;\n }\n\n [svelte-3178269493].dropzone_stats, [svelte-3178269493] .dropzone_stats {\n pointer-events: none;\n }\n\n [svelte-3178269493].dropzone_stats span, [svelte-3178269493] .dropzone_stats span {\n transition: opacity 150ms ease-in 150ms;\n }\n\n [svelte-3178269493].dropzone:hover, [svelte-3178269493] .dropzone:hover {\n border-color: #888;\n }\n\n [svelte-3178269493].dropzone.dropzone--dragging, [svelte-3178269493] .dropzone.dropzone--dragging,\n [svelte-3178269493].dropzone:hover, [svelte-3178269493] .dropzone:hover {\n background: #f4f5f8;\n }\n\n [svelte-3178269493].dropzone--dragging .dropzone_stats span, [svelte-3178269493] .dropzone--dragging .dropzone_stats span {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n [svelte-3178269493].dropzone--dragging .dropzone_stats .icon, [svelte-3178269493] .dropzone--dragging .dropzone_stats .icon {\n transform: scale(3) translateY(20%);\n }\n\n [svelte-3178269493].dz-message, [svelte-3178269493] .dz-message, [svelte-3178269493].dz-preview, [svelte-3178269493] .dz-preview {\n display: none\n }\n\n [svelte-3178269493].icon, [svelte-3178269493] .icon {\n fill: #929292;\n transition: transform 300ms ease-in;\n }\n',g.b(t,document.head)}function s(t,e){function r(t){return t.uploading.total>0?a:u}var n,i,o,s,l=new d.a({_root:e._root,data:{service:"Uploads"}});l.on("update",function(t){e._onUploadsUpdate()}),e.refs.Uploads=l;var c=r(t),p=c(t,e);return{create:function(){l._fragment.create(),n=g.g("\n\n"),i=g.e("div"),s=g.e("div"),p.create(),this.hydrate()},hydrate:function(e){g.p(i,"svelte-3178269493",""),i.className=o="dropzone "+(t.dragging?"dropzone--dragging":""),s.className="dropzone_stats"},mount:function(t,r){l._fragment.mount(t,r),g.l(n,t,r),g.l(i,t,r),e.refs.dropzone=i,g.b(s,i),p.mount(s,null)},update:function(t,n){o!==(o="dropzone "+(n.dragging?"dropzone--dragging":""))&&(i.className=o),c===(c=r(n))&&p?p.update(t,n):(p.unmount(),p.destroy(),p=c(n,e),p.create(),p.mount(s,null))},unmount:function(){l._fragment.unmount(),g.i(n),g.i(i),e.refs.dropzone===i&&(e.refs.dropzone=null),p.unmount()},destroy:function(){e.refs.Uploads===l&&(e.refs.Uploads=null),l.destroy(!1),p.destroy()}}}function a(t,e){var r,n,i,o,s,a,u;return{create:function(){r=g.e("strong"),n=g.g("Uploading "),o=g.g(i=t.uploading.now),s=g.g(" / "),u=g.g(a=t.uploading.total)},mount:function(t,e){g.l(r,t,e),g.b(n,r),g.b(o,r),g.b(s,r),g.b(u,r)},update:function(t,e){i!==(i=e.uploading.now)&&(o.data=i),a!==(a=e.uploading.total)&&(u.data=a)},unmount:function(){g.i(r)},destroy:g.m}}function u(t,e){var r,n,i,o,s,a,u,l,c,p,d,h,f,_;return{create:function(){r=g.f("svg"),n=g.f("use"),i=g.g("\n "),o=g.e("br"),s=g.g("\n "),a=g.e("span"),u=g.e("strong"),c=g.g(l=t.prettyUsed),p=g.g(" out of "),d=g.e("strong"),f=g.g(h=t.prettyQuota),_=g.g(" used."),this.hydrate()},hydrate:function(t){g.p(r,"class","icon icon-upload"),g.q(n,"xlink:href","#icon-upload")},mount:function(t,e){g.l(r,t,e),g.b(n,r),g.l(i,t,e),g.l(o,t,e),g.l(s,t,e),g.l(a,t,e),g.b(u,a),g.b(c,u),g.b(p,a),g.b(d,a),g.b(f,d),g.b(_,a)},update:function(t,e){l!==(l=e.prettyUsed)&&(c.data=l),h!==(h=e.prettyQuota)&&(f.data=h)},unmount:function(){g.i(r),g.i(i),g.i(o),g.i(s),g.i(a)},destroy:g.m}}function l(t){t=t||{},this.refs={},this._state=g.c(_.data(),t.data),i(this._state,this._state,{},!0),this._observers={pre:Object.create(null),post:Object.create(null)},this._handlers=Object.create(null),this._root=t._root||this,this._yield=t._yield,this._torndown=!1,document.getElementById("svelte-3178269493-style")||o(),this._renderHooks=[],this._fragment=s(this._state,this),t.target&&(this._fragment.create(),this._fragment.mount(t.target,null)),this._flush(),t._root?t._root._renderHooks.push(_.oncreate.bind(this)):_.oncreate.call(this)}var c=r(148),p=r.n(c),d=r(57),h=r(114),f=r.n(h),g=r(15),_=function(){return{data:function(){return{filetypes:"*",used:0,quota:0,uploading:{total:0,now:0},dragging:!1,maxFilesize:10,instanceId:0}},computed:{prettyQuota:function(t){return f.a(t)},prettyUsed:function(t){return f.a(t)}},oncreate:function(){var t;this.Uploads=this.refs.Uploads.instance(),this.set({quota:this.Uploads.quota,used:this.Uploads.used}),this.dropzone=new p.a(this.refs.dropzone,{acceptedFiles:this.get("filetypes"),url:this.Uploads.getUploadURL(),headers:this.Uploads.getAuthHeaders(),accept:this.Uploads.accept.bind(this.Uploads),uploadMultiple:!1,maxFilesize:this.get("maxFilesize")});var e=(t={dragenter:this._onDragEnter.bind(this),dragleave:this._onDragLeave.bind(this),drop:this._onDragLeave.bind(this),addedfile:this._onAddedFile.bind(this),thumbnail:this._onThumbnail.bind(this),error:this._onError.bind(this),uploadprogress:this._onUploadProgress.bind(this),processing:this._updateFileState.bind(this,"processing"),sending:this._updateFileState.bind(this,"sending"),success:this._updateFileState.bind(this,"success"),complete:this._updateFileState.bind(this,"complete"),canceled:this._updateFileState.bind(this,"canceled")},n(t,"complete",this._onComplete.bind(this)),n(t,"totaluploadprogress",this._onTotalUploadProgress.bind(this)),n(t,"queuecomplete",this._onQueueComplete.bind(this)),t);for(var r in e)this.dropzone.on(r,e[r])},methods:{_onDragEnter:function(){this.set({dragging:!0}),this.fire("dragging",!0)},_onDragLeave:function(){this.set({dragging:!1}),this.fire("dragging",!1)},_onAddedFile:function(t){this.fire("new"),this.Uploads.upload(t)},_onThumbnail:function(t,e){this.Uploads.setThumbnail(t,e)},_onError:function(t,e){console.error(e),this.fire("error",{message:e}),this.Uploads.setError(t,e)},_onUploadProgress:function(t,e,r){this.Uploads.setUploadProgress(t,e,r)},_onComplete:function(t){this.Uploads.uploadComplete(t,this.get("instanceId"))},_updateFileState:function(t,e){this.Uploads.setUploadState(e,t)},_onTotalUploadProgress:function(){var t=this.dropzone.getAcceptedFiles().length,e=this.dropzone.getQueuedFiles().length,r=(this.dropzone.getUploadingFiles().length,t-e);this.set({uploading:{total:t,now:r}})},_onQueueComplete:function(){this.dropzone.removeAllFiles()},_onUploadsUpdate:function(){this.set({quota:this.Uploads.quota,used:this.Uploads.used})}}}}();g.c(l.prototype,_.methods,g.n),l.prototype._set=function(t){var e=this._state;this._state=g.c({},e,t),i(this._state,t,e,!1),g.k(this,this._observers.pre,t,e),this._fragment.update(t,this._state),g.k(this,this._observers.post,t,e),this._flush()},l.prototype.teardown=l.prototype.destroy=function(t){this.fire("destroy"),!1!==t&&this._fragment.unmount(),this._fragment.destroy(),this._fragment=null,this._state={},this._torndown=!0},e.a=l},function(t,e,r){(function(t){(function(){var e,r,n,i,o,s,a,u,l=[].slice,c={}.hasOwnProperty,p=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};a=function(){},r=function(){function t(){}return t.prototype.addEventListener=t.prototype.on,t.prototype.on=function(t,e){return this._callbacks=this._callbacks||{},this._callbacks[t]||(this._callbacks[t]=[]),this._callbacks[t].push(e),this},t.prototype.emit=function(){var t,e,r,n,i,o;if(n=arguments[0],t=2<=arguments.length?l.call(arguments,1):[],this._callbacks=this._callbacks||{},r=this._callbacks[n])for(i=0,o=r.length;i<o;i++)e=r[i],e.apply(this,t);return this},t.prototype.removeListener=t.prototype.off,t.prototype.removeAllListeners=t.prototype.off,t.prototype.removeEventListener=t.prototype.off,t.prototype.off=function(t,e){var r,n,i,o;if(!this._callbacks||0===arguments.length)return this._callbacks={},this;if(!(r=this._callbacks[t]))return this;if(1===arguments.length)return delete this._callbacks[t],this;for(n=i=0,o=r.length;i<o;n=++i)if(r[n]===e){r.splice(n,1);break}return this},t}(),e=function(t){function e(t,r){var i,o,s;if(this.element=t,this.version=e.version,this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,""),this.clickableElements=[],this.listeners=[],this.files=[],"string"==typeof this.element&&(this.element=document.querySelector(this.element)),!this.element||null==this.element.nodeType)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");if(e.instances.push(this),this.element.dropzone=this,i=null!=(s=e.optionsForElement(this.element))?s:{},this.options=n({},this.defaultOptions,i,null!=r?r:{}),this.options.forceFallback||!e.isBrowserSupported())return this.options.fallback.call(this);if(null==this.options.url&&(this.options.url=this.element.getAttribute("action")),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");this.options.acceptedMimeTypes&&(this.options.acceptedFiles=this.options.acceptedMimeTypes,delete this.options.acceptedMimeTypes),this.options.method=this.options.method.toUpperCase(),(o=this.getExistingFallback())&&o.parentNode&&o.parentNode.removeChild(o),!1!==this.options.previewsContainer&&(this.options.previewsContainer?this.previewsContainer=e.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(!0===this.options.clickable?this.clickableElements=[this.element]:this.clickableElements=e.getElements(this.options.clickable,"clickable")),this.init()}var n,i;return p(e,t),e.prototype.Emitter=r,e.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],e.prototype.defaultOptions={url:null,method:"post",withCredentials:!1,parallelUploads:2,uploadMultiple:!1,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,filesizeBase:1e3,maxFiles:null,params:{},clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",accept:function(t,e){return e()},init:function(){return a},forceFallback:!1,fallback:function(){var t,r,n,i,o,s;for(this.element.className=this.element.className+" dz-browser-not-supported",s=this.element.getElementsByTagName("div"),i=0,o=s.length;i<o;i++)t=s[i],/(^| )dz-message($| )/.test(t.className)&&(r=t,t.className="dz-message");return r||(r=e.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(r)),n=r.getElementsByTagName("span")[0],n&&(null!=n.textContent?n.textContent=this.options.dictFallbackMessage:null!=n.innerText&&(n.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(t){var e,r,n;return e={srcX:0,srcY:0,srcWidth:t.width,srcHeight:t.height},r=t.width/t.height,e.optWidth=this.options.thumbnailWidth,e.optHeight=this.options.thumbnailHeight,null==e.optWidth&&null==e.optHeight?(e.optWidth=e.srcWidth,e.optHeight=e.srcHeight):null==e.optWidth?e.optWidth=r*e.optHeight:null==e.optHeight&&(e.optHeight=1/r*e.optWidth),n=e.optWidth/e.optHeight,t.height<e.optHeight||t.width<e.optWidth?(e.trgHeight=e.srcHeight,e.trgWidth=e.srcWidth):r>n?(e.srcHeight=t.height,e.srcWidth=e.srcHeight*n):(e.srcWidth=t.width,e.srcHeight=e.srcWidth/n),e.srcX=(t.width-e.srcWidth)/2,e.srcY=(t.height-e.srcHeight)/2,e},drop:function(t){return this.element.classList.remove("dz-drag-hover")},dragstart:a,dragend:function(t){return this.element.classList.remove("dz-drag-hover")},dragenter:function(t){return this.element.classList.add("dz-drag-hover")},dragover:function(t){return this.element.classList.add("dz-drag-hover")},dragleave:function(t){return this.element.classList.remove("dz-drag-hover")},paste:a,reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(t){var r,n,i,o,s,a,u,l,c,p,d,h,f;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){for(t.previewElement=e.createElement(this.options.previewTemplate.trim()),t.previewTemplate=t.previewElement,this.previewsContainer.appendChild(t.previewElement),p=t.previewElement.querySelectorAll("[data-dz-name]"),o=0,u=p.length;o<u;o++)r=p[o],r.textContent=this._renameFilename(t.name);for(d=t.previewElement.querySelectorAll("[data-dz-size]"),s=0,l=d.length;s<l;s++)r=d[s],r.innerHTML=this.filesize(t.size);for(this.options.addRemoveLinks&&(t._removeLink=e.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'+this.options.dictRemoveFile+"</a>"),t.previewElement.appendChild(t._removeLink)),n=function(r){return function(n){return n.preventDefault(),n.stopPropagation(),t.status===e.UPLOADING?e.confirm(r.options.dictCancelUploadConfirmation,function(){return r.removeFile(t)}):r.options.dictRemoveFileConfirmation?e.confirm(r.options.dictRemoveFileConfirmation,function(){return r.removeFile(t)}):r.removeFile(t)}}(this),h=t.previewElement.querySelectorAll("[data-dz-remove]"),f=[],a=0,c=h.length;a<c;a++)i=h[a],f.push(i.addEventListener("click",n));return f}},removedfile:function(t){var e;return t.previewElement&&null!=(e=t.previewElement)&&e.parentNode.removeChild(t.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(t,e){var r,n,i,o;if(t.previewElement){for(t.previewElement.classList.remove("dz-file-preview"),o=t.previewElement.querySelectorAll("[data-dz-thumbnail]"),n=0,i=o.length;n<i;n++)r=o[n],r.alt=t.name,r.src=e;return setTimeout(function(e){return function(){return t.previewElement.classList.add("dz-image-preview")}}(),1)}},error:function(t,e){var r,n,i,o,s;if(t.previewElement){for(t.previewElement.classList.add("dz-error"),"String"!=typeof e&&e.error&&(e=e.error),o=t.previewElement.querySelectorAll("[data-dz-errormessage]"),s=[],n=0,i=o.length;n<i;n++)r=o[n],s.push(r.textContent=e);return s}},errormultiple:a,processing:function(t){if(t.previewElement&&(t.previewElement.classList.add("dz-processing"),t._removeLink))return t._removeLink.textContent=this.options.dictCancelUpload},processingmultiple:a,uploadprogress:function(t,e,r){var n,i,o,s,a;if(t.previewElement){for(s=t.previewElement.querySelectorAll("[data-dz-uploadprogress]"),a=[],i=0,o=s.length;i<o;i++)n=s[i],"PROGRESS"===n.nodeName?a.push(n.value=e):a.push(n.style.width=e+"%");return a}},totaluploadprogress:a,sending:a,sendingmultiple:a,success:function(t){if(t.previewElement)return t.previewElement.classList.add("dz-success")},successmultiple:a,canceled:function(t){return this.emit("error",t,"Upload canceled.")},canceledmultiple:a,complete:function(t){if(t._removeLink&&(t._removeLink.textContent=this.options.dictRemoveFile),t.previewElement)return t.previewElement.classList.add("dz-complete")},completemultiple:a,maxfilesexceeded:a,maxfilesreached:a,queuecomplete:a,addedfiles:a,previewTemplate:'<div class="dz-preview dz-file-preview">\n <div class="dz-image"><img data-dz-thumbnail /></div>\n <div class="dz-details">\n <div class="dz-size"><span data-dz-size></span></div>\n <div class="dz-filename"><span data-dz-name></span></div>\n </div>\n <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <div class="dz-success-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Check</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>\n </g>\n </svg>\n </div>\n <div class="dz-error-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Error</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <g id="Check-+-Oval-2" sketch:type="MSLayerGroup" stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">\n <path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" sketch:type="MSShapeGroup"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>'},n=function(){var t,e,r,n,i,o,s;for(n=arguments[0],r=2<=arguments.length?l.call(arguments,1):[],o=0,s=r.length;o<s;o++){e=r[o];for(t in e)i=e[t],n[t]=i}return n},e.prototype.getAcceptedFiles=function(){var t,e,r,n,i;for(n=this.files,i=[],e=0,r=n.length;e<r;e++)t=n[e],t.accepted&&i.push(t);return i},e.prototype.getRejectedFiles=function(){var t,e,r,n,i;for(n=this.files,i=[],e=0,r=n.length;e<r;e++)t=n[e],t.accepted||i.push(t);return i},e.prototype.getFilesWithStatus=function(t){var e,r,n,i,o;for(i=this.files,o=[],r=0,n=i.length;r<n;r++)e=i[r],e.status===t&&o.push(e);return o},e.prototype.getQueuedFiles=function(){return this.getFilesWithStatus(e.QUEUED)},e.prototype.getUploadingFiles=function(){return this.getFilesWithStatus(e.UPLOADING)},e.prototype.getAddedFiles=function(){return this.getFilesWithStatus(e.ADDED)},e.prototype.getActiveFiles=function(){var t,r,n,i,o;for(i=this.files,o=[],r=0,n=i.length;r<n;r++)t=i[r],t.status!==e.UPLOADING&&t.status!==e.QUEUED||o.push(t);return o},e.prototype.init=function(){var t,r,n,i,o,s,a;for("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(e.createElement('<div class="dz-default dz-message"><span>'+this.options.dictDefaultMessage+"</span></div>")),this.clickableElements.length&&(n=function(t){return function(){return t.hiddenFileInput&&t.hiddenFileInput.parentNode.removeChild(t.hiddenFileInput),t.hiddenFileInput=document.createElement("input"),t.hiddenFileInput.setAttribute("type","file"),(null==t.options.maxFiles||t.options.maxFiles>1)&&t.hiddenFileInput.setAttribute("multiple","multiple"),t.hiddenFileInput.className="dz-hidden-input",null!=t.options.acceptedFiles&&t.hiddenFileInput.setAttribute("accept",t.options.acceptedFiles),null!=t.options.capture&&t.hiddenFileInput.setAttribute("capture",t.options.capture),t.hiddenFileInput.style.visibility="hidden",t.hiddenFileInput.style.position="absolute",t.hiddenFileInput.style.top="0",t.hiddenFileInput.style.left="0",t.hiddenFileInput.style.height="0",t.hiddenFileInput.style.width="0",document.querySelector(t.options.hiddenInputContainer).appendChild(t.hiddenFileInput),t.hiddenFileInput.addEventListener("change",function(){var e,r,i,o;if(r=t.hiddenFileInput.files,r.length)for(i=0,o=r.length;i<o;i++)e=r[i],t.addFile(e);return t.emit("addedfiles",r),n()})}}(this))(),this.URL=null!=(s=window.URL)?s:window.webkitURL,a=this.events,i=0,o=a.length;i<o;i++)t=a[i],this.on(t,this.options[t]);return this.on("uploadprogress",function(t){return function(){return t.updateTotalUploadProgress()}}(this)),this.on("removedfile",function(t){return function(){return t.updateTotalUploadProgress()}}(this)),this.on("canceled",function(t){return function(e){return t.emit("complete",e)}}(this)),this.on("complete",function(t){return function(e){if(0===t.getAddedFiles().length&&0===t.getUploadingFiles().length&&0===t.getQueuedFiles().length)return setTimeout(function(){return t.emit("queuecomplete")},0)}}(this)),r=function(t){return t.stopPropagation(),t.preventDefault?t.preventDefault():t.returnValue=!1},this.listeners=[{element:this.element,events:{dragstart:function(t){return function(e){return t.emit("dragstart",e)}}(this),dragenter:function(t){return function(e){return r(e),t.emit("dragenter",e)}}(this),dragover:function(t){return function(e){var n;try{n=e.dataTransfer.effectAllowed}catch(t){}return e.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",r(e),t.emit("dragover",e)}}(this),dragleave:function(t){return function(e){return t.emit("dragleave",e)}}(this),drop:function(t){return function(e){return r(e),t.drop(e)}}(this),dragend:function(t){return function(e){return t.emit("dragend",e)}}(this)}}],this.clickableElements.forEach(function(t){return function(r){return t.listeners.push({element:r,events:{click:function(n){return(r!==t.element||n.target===t.element||e.elementInside(n.target,t.element.querySelector(".dz-message")))&&t.hiddenFileInput.click(),!0}}})}}(this)),this.enable(),this.options.init.call(this)},e.prototype.destroy=function(){var t;return this.disable(),this.removeAllFiles(!0),(null!=(t=this.hiddenFileInput)?t.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,e.instances.splice(e.instances.indexOf(this),1)},e.prototype.updateTotalUploadProgress=function(){var t,e,r,n,i,o,s,a;if(n=0,r=0,t=this.getActiveFiles(),t.length){for(a=this.getActiveFiles(),o=0,s=a.length;o<s;o++)e=a[o],n+=e.upload.bytesSent,r+=e.upload.total;i=100*n/r}else i=100;return this.emit("totaluploadprogress",i,r,n)},e.prototype._getParamName=function(t){return"function"==typeof this.options.paramName?this.options.paramName(t):this.options.paramName+(this.options.uploadMultiple?"["+t+"]":"")},e.prototype._renameFilename=function(t){return"function"!=typeof this.options.renameFilename?t:this.options.renameFilename(t)},e.prototype.getFallbackForm=function(){var t,r,n,i;return(t=this.getExistingFallback())?t:(n='<div class="dz-fallback">',this.options.dictFallbackText&&(n+="<p>"+this.options.dictFallbackText+"</p>"),n+='<input type="file" name="'+this._getParamName(0)+'" '+(this.options.uploadMultiple?'multiple="multiple"':void 0)+' /><input type="submit" value="Upload!"></div>',r=e.createElement(n),"FORM"!==this.element.tagName?(i=e.createElement('<form action="'+this.options.url+'" enctype="multipart/form-data" method="'+this.options.method+'"></form>'),i.appendChild(r)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=i?i:r)},e.prototype.getExistingFallback=function(){var t,e,r,n,i,o;for(e=function(t){var e,r,n;for(r=0,n=t.length;r<n;r++)if(e=t[r],/(^| )fallback($| )/.test(e.className))return e},o=["div","form"],n=0,i=o.length;n<i;n++)if(r=o[n],t=e(this.element.getElementsByTagName(r)))return t},e.prototype.setupEventListeners=function(){var t,e,r,n,i,o,s;for(o=this.listeners,s=[],n=0,i=o.length;n<i;n++)t=o[n],s.push(function(){var n,i;n=t.events,i=[];for(e in n)r=n[e],i.push(t.element.addEventListener(e,r,!1));return i}());return s},e.prototype.removeEventListeners=function(){var t,e,r,n,i,o,s;for(o=this.listeners,s=[],n=0,i=o.length;n<i;n++)t=o[n],s.push(function(){var n,i;n=t.events,i=[];for(e in n)r=n[e],i.push(t.element.removeEventListener(e,r,!1));return i}());return s},e.prototype.disable=function(){var t,e,r,n,i;for(this.clickableElements.forEach(function(t){return t.classList.remove("dz-clickable")}),this.removeEventListeners(),n=this.files,i=[],e=0,r=n.length;e<r;e++)t=n[e],i.push(this.cancelUpload(t));return i},e.prototype.enable=function(){return this.clickableElements.forEach(function(t){return t.classList.add("dz-clickable")}),this.setupEventListeners()},e.prototype.filesize=function(t){var e,r,n,i,o,s,a,u;if(n=0,i="b",t>0){for(s=["TB","GB","MB","KB","b"],r=a=0,u=s.length;a<u;r=++a)if(o=s[r],e=Math.pow(this.options.filesizeBase,4-r)/10,t>=e){n=t/Math.pow(this.options.filesizeBase,4-r),i=o;break}n=Math.round(10*n)/10}return"<strong>"+n+"</strong> "+i},e.prototype._updateMaxFilesReachedClass=function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")},e.prototype.drop=function(t){var e,r;t.dataTransfer&&(this.emit("drop",t),e=t.dataTransfer.files,this.emit("addedfiles",e),e.length&&(r=t.dataTransfer.items,r&&r.length&&null!=r[0].webkitGetAsEntry?this._addFilesFromItems(r):this.handleFiles(e)))},e.prototype.paste=function(t){var e,r;if(null!=(null!=t&&null!=(r=t.clipboardData)?r.items:void 0))return this.emit("paste",t),e=t.clipboardData.items,e.length?this._addFilesFromItems(e):void 0},e.prototype.handleFiles=function(t){var e,r,n,i;for(i=[],r=0,n=t.length;r<n;r++)e=t[r],i.push(this.addFile(e));return i},e.prototype._addFilesFromItems=function(t){var e,r,n,i,o;for(o=[],n=0,i=t.length;n<i;n++)r=t[n],null!=r.webkitGetAsEntry&&(e=r.webkitGetAsEntry())?e.isFile?o.push(this.addFile(r.getAsFile())):e.isDirectory?o.push(this._addFilesFromDirectory(e,e.name)):o.push(void 0):null!=r.getAsFile&&(null==r.kind||"file"===r.kind)?o.push(this.addFile(r.getAsFile())):o.push(void 0);return o},e.prototype._addFilesFromDirectory=function(t,e){var r,n,i;return r=t.createReader(),n=function(t){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log(t):void 0},(i=function(t){return function(){return r.readEntries(function(r){var n,o,s;if(r.length>0){for(o=0,s=r.length;o<s;o++)n=r[o],n.isFile?n.file(function(r){if(!t.options.ignoreHiddenFiles||"."!==r.name.substring(0,1))return r.fullPath=e+"/"+r.name,t.addFile(r)}):n.isDirectory&&t._addFilesFromDirectory(n,e+"/"+n.name);i()}return null},n)}}(this))()},e.prototype.accept=function(t,r){return t.size>1024*this.options.maxFilesize*1024?r(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(t.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):e.isValidFile(t,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(r(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",t)):this.options.accept.call(this,t,r):r(this.options.dictInvalidFileType)},e.prototype.addFile=function(t){return t.upload={progress:0,total:t.size,bytesSent:0},this.files.push(t),t.status=e.ADDED,this.emit("addedfile",t),this._enqueueThumbnail(t),this.accept(t,function(e){return function(r){return r?(t.accepted=!1,e._errorProcessing([t],r)):(t.accepted=!0,e.options.autoQueue&&e.enqueueFile(t)),e._updateMaxFilesReachedClass()}}(this))},e.prototype.enqueueFiles=function(t){var e,r,n;for(r=0,n=t.length;r<n;r++)e=t[r],this.enqueueFile(e);return null},e.prototype.enqueueFile=function(t){if(t.status!==e.ADDED||!0!==t.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(t.status=e.QUEUED,this.options.autoProcessQueue)return setTimeout(function(t){return function(){return t.processQueue()}}(this),0)},e.prototype._thumbnailQueue=[],e.prototype._processingThumbnail=!1,e.prototype._enqueueThumbnail=function(t){if(this.options.createImageThumbnails&&t.type.match(/image.*/)&&t.size<=1024*this.options.maxThumbnailFilesize*1024)return this._thumbnailQueue.push(t),setTimeout(function(t){return function(){return t._processThumbnailQueue()}}(this),0)},e.prototype._processThumbnailQueue=function(){if(!this._processingThumbnail&&0!==this._thumbnailQueue.length)return this._processingThumbnail=!0,this.createThumbnail(this._thumbnailQueue.shift(),function(t){return function(){return t._processingThumbnail=!1,t._processThumbnailQueue()}}(this))},e.prototype.removeFile=function(t){if(t.status===e.UPLOADING&&this.cancelUpload(t),this.files=u(this.files,t),this.emit("removedfile",t),0===this.files.length)return this.emit("reset")},e.prototype.removeAllFiles=function(t){var r,n,i,o;for(null==t&&(t=!1),o=this.files.slice(),n=0,i=o.length;n<i;n++)r=o[n],(r.status!==e.UPLOADING||t)&&this.removeFile(r);return null},e.prototype.createThumbnail=function(t,e){var r;return r=new FileReader,r.onload=function(n){return function(){return"image/svg+xml"===t.type?(n.emit("thumbnail",t,r.result),void(null!=e&&e())):n.createThumbnailFromUrl(t,r.result,e)}}(this),r.readAsDataURL(t)},e.prototype.createThumbnailFromUrl=function(t,e,r,n){var i;return i=document.createElement("img"),n&&(i.crossOrigin=n),i.onload=function(e){return function(){var n,o,a,u,l,c,p,d;if(t.width=i.width,t.height=i.height,a=e.options.resize.call(e,t),null==a.trgWidth&&(a.trgWidth=a.optWidth),null==a.trgHeight&&(a.trgHeight=a.optHeight),n=document.createElement("canvas"),o=n.getContext("2d"),n.width=a.trgWidth,n.height=a.trgHeight,s(o,i,null!=(l=a.srcX)?l:0,null!=(c=a.srcY)?c:0,a.srcWidth,a.srcHeight,null!=(p=a.trgX)?p:0,null!=(d=a.trgY)?d:0,a.trgWidth,a.trgHeight),u=n.toDataURL("image/png"),e.emit("thumbnail",t,u),null!=r)return r()}}(this),null!=r&&(i.onerror=r),i.src=e},e.prototype.processQueue=function(){var t,e,r,n;if(e=this.options.parallelUploads,r=this.getUploadingFiles().length,t=r,!(r>=e)&&(n=this.getQueuedFiles(),n.length>0)){if(this.options.uploadMultiple)return this.processFiles(n.slice(0,e-r));for(;t<e;){if(!n.length)return;this.processFile(n.shift()),t++}}},e.prototype.processFile=function(t){return this.processFiles([t])},e.prototype.processFiles=function(t){var r,n,i;for(n=0,i=t.length;n<i;n++)r=t[n],r.processing=!0,r.status=e.UPLOADING,this.emit("processing",r);return this.options.uploadMultiple&&this.emit("processingmultiple",t),this.uploadFiles(t)},e.prototype._getFilesWithXhr=function(t){var e;return function(){var r,n,i,o;for(i=this.files,o=[],r=0,n=i.length;r<n;r++)e=i[r],e.xhr===t&&o.push(e);return o}.call(this)},e.prototype.cancelUpload=function(t){var r,n,i,o,s,a,u;if(t.status===e.UPLOADING){for(n=this._getFilesWithXhr(t.xhr),i=0,s=n.length;i<s;i++)r=n[i],r.status=e.CANCELED;for(t.xhr.abort(),o=0,a=n.length;o<a;o++)r=n[o],this.emit("canceled",r);this.options.uploadMultiple&&this.emit("canceledmultiple",n)}else(u=t.status)!==e.ADDED&&u!==e.QUEUED||(t.status=e.CANCELED,this.emit("canceled",t),this.options.uploadMultiple&&this.emit("canceledmultiple",[t]));if(this.options.autoProcessQueue)return this.processQueue()},i=function(){var t,e;return e=arguments[0],t=2<=arguments.length?l.call(arguments,1):[],"function"==typeof e?e.apply(this,t):e},e.prototype.uploadFile=function(t){return this.uploadFiles([t])},e.prototype.uploadFiles=function(t){var r,o,s,a,u,l,c,p,d,h,f,g,_,y,v,m,b,w,E,P,S,x,k,A,O,T,C,R,M,I,D,L,F,U;for(E=new XMLHttpRequest,P=0,A=t.length;P<A;P++)r=t[P],r.xhr=E;g=i(this.options.method,t),b=i(this.options.url,t),E.open(g,b,!0),E.withCredentials=!!this.options.withCredentials,v=null,s=function(e){return function(){var n,i,o;for(o=[],n=0,i=t.length;n<i;n++)r=t[n],o.push(e._errorProcessing(t,v||e.options.dictResponseError.replace("{{statusCode}}",E.status),E));return o}}(this),m=function(e){return function(n){var i,o,s,a,u,l,c,p,d;if(null!=n)for(o=100*n.loaded/n.total,s=0,l=t.length;s<l;s++)r=t[s],r.upload={progress:o,total:n.total,bytesSent:n.loaded};else{for(i=!0,o=100,a=0,c=t.length;a<c;a++)r=t[a],100===r.upload.progress&&r.upload.bytesSent===r.upload.total||(i=!1),r.upload.progress=o,r.upload.bytesSent=r.upload.total;if(i)return}for(d=[],u=0,p=t.length;u<p;u++)r=t[u],d.push(e.emit("uploadprogress",r,o,r.upload.bytesSent));return d}}(this),E.onload=function(r){return function(n){var i;if(t[0].status!==e.CANCELED&&4===E.readyState){if(v=E.responseText,E.getResponseHeader("content-type")&&~E.getResponseHeader("content-type").indexOf("application/json"))try{v=JSON.parse(v)}catch(t){n=t,v="Invalid JSON response from server."}return m(),200<=(i=E.status)&&i<300?r._finished(t,v,n):s()}}}(this),E.onerror=function(r){return function(){if(t[0].status!==e.CANCELED)return s()}}(),y=null!=(M=E.upload)?M:E,y.onprogress=m,l={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"},this.options.headers&&n(l,this.options.headers);for(a in l)(u=l[a])&&E.setRequestHeader(a,u);if(o=new FormData,this.options.params){I=this.options.params;for(f in I)w=I[f],o.append(f,w)}for(S=0,O=t.length;S<O;S++)r=t[S],this.emit("sending",r,E,o);if(this.options.uploadMultiple&&this.emit("sendingmultiple",t,E,o),"FORM"===this.element.tagName)for(D=this.element.querySelectorAll("input, textarea, select, button"),x=0,T=D.length;x<T;x++)if(p=D[x],d=p.getAttribute("name"),h=p.getAttribute("type"),"SELECT"===p.tagName&&p.hasAttribute("multiple"))for(L=p.options,k=0,C=L.length;k<C;k++)_=L[k],_.selected&&o.append(d,_.value);else(!h||"checkbox"!==(F=h.toLowerCase())&&"radio"!==F||p.checked)&&o.append(d,p.value);for(c=R=0,U=t.length-1;0<=U?R<=U:R>=U;c=0<=U?++R:--R)o.append(this._getParamName(c),t[c],this._renameFilename(t[c].name));return this.submitRequest(E,o,t)},e.prototype.submitRequest=function(t,e,r){return t.send(e)},e.prototype._finished=function(t,r,n){var i,o,s;for(o=0,s=t.length;o<s;o++)i=t[o],i.status=e.SUCCESS,this.emit("success",i,r,n),this.emit("complete",i);if(this.options.uploadMultiple&&(this.emit("successmultiple",t,r,n),this.emit("completemultiple",t)),this.options.autoProcessQueue)return this.processQueue()},e.prototype._errorProcessing=function(t,r,n){var i,o,s;for(o=0,s=t.length;o<s;o++)i=t[o],i.status=e.ERROR,this.emit("error",i,r,n),this.emit("complete",i);if(this.options.uploadMultiple&&(this.emit("errormultiple",t,r,n),this.emit("completemultiple",t)),this.options.autoProcessQueue)return this.processQueue()},e}(r),e.version="4.3.0",e.options={},e.optionsForElement=function(t){return t.getAttribute("id")?e.options[n(t.getAttribute("id"))]:void 0},e.instances=[],e.forElement=function(t){if("string"==typeof t&&(t=document.querySelector(t)),null==(null!=t?t.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return t.dropzone},e.autoDiscover=!0,e.discover=function(){var t,r,n,i,o,s;for(document.querySelectorAll?n=document.querySelectorAll(".dropzone"):(n=[],t=function(t){var e,r,i,o;for(o=[],r=0,i=t.length;r<i;r++)e=t[r],/(^| )dropzone($| )/.test(e.className)?o.push(n.push(e)):o.push(void 0);return o},t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))),s=[],i=0,o=n.length;i<o;i++)r=n[i],!1!==e.optionsForElement(r)?s.push(new e(r)):s.push(void 0);return s},e.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i],e.isBrowserSupported=function(){var t,r,n,i,o;if(t=!0,window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(o=e.blacklistedBrowsers,n=0,i=o.length;n<i;n++)r=o[n],r.test(navigator.userAgent)&&(t=!1);else t=!1;else t=!1;return t},u=function(t,e){var r,n,i,o;for(o=[],n=0,i=t.length;n<i;n++)(r=t[n])!==e&&o.push(r);return o},n=function(t){return t.replace(/[\-_](\w)/g,function(t){return t.charAt(1).toUpperCase()})},e.createElement=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.childNodes[0]},e.elementInside=function(t,e){if(t===e)return!0;for(;t=t.parentNode;)if(t===e)return!0;return!1},e.getElement=function(t,e){var r;if("string"==typeof t?r=document.querySelector(t):null!=t.nodeType&&(r=t),null==r)throw new Error("Invalid `"+e+"` option provided. Please provide a CSS selector or a plain HTML element.");return r},e.getElements=function(t,e){var r,n,i,o,s,a,u;if(t instanceof Array){n=[];try{for(i=0,s=t.length;i<s;i++)r=t[i],n.push(this.getElement(r,e))}catch(t){t,n=null}}else if("string"==typeof t)for(n=[],u=document.querySelectorAll(t),o=0,a=u.length;o<a;o++)r=u[o],n.push(r);else null!=t.nodeType&&(n=[t]);if(null==n||!n.length)throw new Error("Invalid `"+e+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return n},e.confirm=function(t,e,r){return window.confirm(t)?e():null!=r?r():void 0},e.isValidFile=function(t,e){var r,n,i,o,s;if(!e)return!0;for(e=e.split(","),n=t.type,r=n.replace(/\/.*$/,""),o=0,s=e.length;o<s;o++)if(i=e[o],i=i.trim(),"."===i.charAt(0)){if(-1!==t.name.toLowerCase().indexOf(i.toLowerCase(),t.name.length-i.length))return!0}else if(/\/\*$/.test(i)){if(r===i.replace(/\/.*$/,""))return!0}else if(n===i)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(t){return this.each(function(){return new e(this,t)})}),void 0!==t&&null!==t?t.exports=e:window.Dropzone=e,e.ADDED="added",e.QUEUED="queued",e.ACCEPTED=e.QUEUED,e.UPLOADING="uploading",e.PROCESSING=e.UPLOADING,e.CANCELED="canceled",e.ERROR="error",e.SUCCESS="success",o=function(t){var e,r,n,i,o,s,a,u,l;for(t.naturalWidth,s=t.naturalHeight,r=document.createElement("canvas"),r.width=1,r.height=s,n=r.getContext("2d"),n.drawImage(t,0,0),i=n.getImageData(0,0,1,s).data,l=0,o=s,a=s;a>l;)e=i[4*(a-1)+3],0===e?o=a:l=a,a=o+l>>1;return u=a/s,0===u?1:u},s=function(t,e,r,n,i,s,a,u,l,c){var p;return p=o(e),t.drawImage(e,r,n,i,s,a,u,l,c/p)},i=function(t,e){var r,n,i,o,s,a,u,l,c;if(i=!1,c=!0,n=t.document,l=n.documentElement,r=n.addEventListener?"addEventListener":"attachEvent",u=n.addEventListener?"removeEventListener":"detachEvent",a=n.addEventListener?"":"on",o=function(r){if("readystatechange"!==r.type||"complete"===n.readyState)return("load"===r.type?t:n)[u](a+r.type,o,!1),!i&&(i=!0)?e.call(t,r.type||r):void 0},s=function(){try{l.doScroll("left")}catch(t){return t,void setTimeout(s,50)}return o("poll")},"complete"!==n.readyState){if(n.createEventObject&&l.doScroll){try{c=!t.frameElement}catch(t){}c&&s()}return n[r](a+"DOMContentLoaded",o,!1),n[r](a+"readystatechange",o,!1),t[r](a+"load",o,!1)}},e._autoDiscoverFunction=function(){if(e.autoDiscover)return e.discover()},i(window,e._autoDiscoverFunction)}).call(this)}).call(e,r(46)(t))},function(t,e,r){"use strict";function n(t,e){var r,n;return{create:function(){r=o.e("div"),n=o.e("div"),this.hydrate()},hydrate:function(t){r.className="nano scrolling-container",n.className="scroll-content"},mount:function(t,i){o.l(r,t,i),e.refs.nano=r,o.b(n,r),e._yield&&e._yield.mount(n,null)},unmount:function(){o.i(r),e.refs.nano===r&&(e.refs.nano=null),e._yield&&e._yield.unmount()},destroy:o.m}}function i(t){t=t||{},this.refs={},this._state=t.data||{},this._observers={pre:Object.create(null),post:Object.create(null)},this._handlers=Object.create(null),this._root=t._root||this,this._yield=t._yield,this._torndown=!1,this._fragment=n(this._state,this),t.target&&(this._fragment.create(),this._fragment.mount(t.target,null)),t._root?t._root._renderHooks.push(s.oncreate.bind(this)):s.oncreate.call(this)}var o=r(15),s=function(){return{oncreate:function(){$(this.refs.nano).nanoScroller({preventPageScrolling:!0,disableResize:!0,contentClass:"scroll-content",paneClass:"scroll-pane"})},ondestroy:function(){$(this.refs.nano).nanoScroller({destroy:!0})},methods:{update:function(){$(this.refs.nano).nanoScroller()},scrollTop:function(){$(this.refs.nano).find(".scroll-content").animate({scrollTop:0},500)},scrollBottom:function(){$(this.refs.nano).nanoScroller({scroll:"bottom"})}}}}();o.c(i.prototype,s.methods,o.n),i.prototype._set=function(t){var e=this._state;this._state=o.c({},e,t),o.k(this,this._observers.pre,t,e),o.k(this,this._observers.post,t,e)},i.prototype.teardown=i.prototype.destroy=function(t){this.fire("destroy"),s.ondestroy.call(this),!1!==t&&this._fragment.unmount(),this._fragment.destroy(),this._fragment=null,this._state={},this._torndown=!0},e.a=i},function(t,e,r){"use strict";function n(){var t=p.e("style");t.id="svelte-201504670-style",t.textContent="\n [svelte-201504670].browser-entry-icon, [svelte-201504670] .browser-entry-icon {\n display: none;\n }\n\n [svelte-201504670].upload--is-complete .browser-entry-icon, [svelte-201504670] .upload--is-complete .browser-entry-icon {\n display: block;\n }\n\n [svelte-201504670].browser-entry-info:before, [svelte-201504670] .browser-entry-info:before {\n display: none;\n }\n\n [svelte-201504670].browser-audio.upload--is-complete .browser-entry-info:before, [svelte-201504670] .browser-audio.upload--is-complete .browser-entry-info:before {\n display: inline-block;\n }\n\n [svelte-201504670].icon-error, [svelte-201504670] .icon-error {\n position: absolute;\n top: 0;\n left: 45px;\n width: 20px;\n height: 100%;\n z-index: 1;\n }\n\n [svelte-201504670].browser-image-prew_img, [svelte-201504670] .browser-image-prew_img {\n opacity: 1;\n }\n\n [svelte-201504670].upload-error .browser-entry-prew:after, [svelte-201504670] .upload-error .browser-entry-prew:after {\n display: none;\n }\n\n [svelte-201504670].upload--is-sending .browser-image-prew_img, [svelte-201504670] .upload--is-sending .browser-image-prew_img,\n [svelte-201504670].upload-error .browser-image-prew_img, [svelte-201504670] .upload-error .browser-image-prew_img {\n opacity: .2;\n }\n\n [svelte-201504670].progress-bar, [svelte-201504670] .progress-bar {\n background: #cccacf;\n position: absolute;\n top: 32px;\n width: 80px;\n left: 15px;\n height: 7px;\n border-radius: 3px;\n font-family: 'ProximaNova-Regular';\n font-size: 12px;\n }\n [svelte-201504670].progress-bar_fill, [svelte-201504670] .progress-bar_fill {\n background: #adadb3;\n height: 100%;\n border-radius: inherit;\n transition: width 100ms linear;\n }\n\n [svelte-201504670].upload--is-sending .progress-bar, [svelte-201504670] .upload--is-sending .progress-bar {\n background: transparent;\n }\n\n [svelte-201504670].upload--is-complete .progress-bar, [svelte-201504670] .upload--is-complete .progress-bar {\n display: none;\n }\n",p.b(t,document.head)}function i(t,e){function r(t){var r=e.get();e.fire("select",r.file)}function n(t){return 100===t.file.progress&&"sending"===t.file.state?a:u}function i(t){e.togglePlay()}var l,d,h,f,g,_,y,v,m,b,w,E,P,S,x=new c.a({_root:e._root,data:{service:"Sounds"}});x.on("state",function(t){var r=this._context.state;e._onSoundsStateChange(r.file.id)}),e.refs.Sounds=x,x._context={state:t};var k=t.file.error&&o(t,e),A=t.file.thumbnail&&s(t,e),O=n(t),T=O(t,e);return{create:function(){x._fragment.create(),l=p.g("\n\n"),d=p.e("div"),f=p.e("div"),_=p.e("span"),y=p.g("\n "),k&&k.create(),v=p.g("\n "),A&&A.create(),m=p.g("\n "),b=p.e("div"),T.create(),w=p.g("\n "),E=p.e("div"),S=p.g(P=t.file.name),this.hydrate()},hydrate:function(e){p.p(d,"svelte-201504670",""),d.className=h="browser-"+t.file.type+" "+t.state+" browser-entry activateable upload--is-"+t.file.state+" "+(t.selected?"active":"")+" "+(t.file.error?"upload-error":""),f.className=g="browser-entry-prew browser-entry-prew--"+t.selectedIcon,p.a(f,"click",r),_.className="browser-entry-icon",b.className="progress-bar",E.className="browser-entry-info",p.a(E,"click",i)},mount:function(t,e){x._fragment.mount(t,e),p.l(l,t,e),p.l(d,t,e),p.b(f,d),p.b(_,f),p.b(y,f),k&&k.mount(f,null),p.b(v,f),A&&A.mount(f,null),p.b(m,f),p.b(b,f),T.mount(b,null),p.b(w,d),p.b(E,d),p.b(S,E)},update:function(t,r){x._context.state=r,h!==(h="browser-"+r.file.type+" "+r.state+" browser-entry activateable upload--is-"+r.file.state+" "+(r.selected?"active":"")+" "+(r.file.error?"upload-error":""))&&(d.className=h),g!==(g="browser-entry-prew browser-entry-prew--"+r.selectedIcon)&&(f.className=g),r.file.error?k||(k=o(r,e),k.create(),k.mount(f,v)):k&&(k.unmount(),k.destroy(),k=null),r.file.thumbnail?A?A.update(t,r):(A=s(r,e),A.create(),A.mount(f,m)):A&&(A.unmount(),A.destroy(),A=null),O===(O=n(r))&&T?T.update(t,r):(T.unmount(),T.destroy(),T=O(r,e),T.create(),T.mount(b,null)),P!==(P=r.file.name)&&(S.data=P)},unmount:function(){x._fragment.unmount(),p.i(l),p.i(d),k&&k.unmount(),A&&A.unmount(),T.unmount()},destroy:function(){e.refs.Sounds===x&&(e.refs.Sounds=null),x.destroy(!1),p.o(f,"click",r),k&&k.destroy(),A&&A.destroy(),T.destroy(),p.o(E,"click",i)}}}function o(t,e){var r,n;return{create:function(){r=p.f("svg"),n=p.f("use"),this.hydrate()},hydrate:function(t){p.p(r,"class","icon icon-error"),p.q(n,"xlink:href","#icon-error")},mount:function(t,e){p.l(r,t,e),p.b(n,r)},unmount:function(){p.i(r)},destroy:p.m}}function s(t,e){var r,n;return{create:function(){r=p.e("div"),this.hydrate()},hydrate:function(e){r.className="browser-image-prew_img",r.style.cssText=n="background-image: url('"+t.file.thumbnail+"')",p.p(r,"width","112"),p.p(r,"height","71")},mount:function(t,e){p.l(r,t,e)},update:function(t,e){n!==(n="background-image: url('"+e.file.thumbnail+"')")&&(r.style.cssText=n)},unmount:function(){p.i(r)},destroy:p.m}}function a(t,e){var r,n;return{create:function(){r=p.e("div"),n=p.g("Processing..."),this.hydrate()},hydrate:function(t){r.style.cssText="width: 100%"},mount:function(t,e){p.l(r,t,e),p.b(n,r)},update:p.m,unmount:function(){p.i(r)},destroy:p.m}}function u(t,e){var r,n;return{create:function(){r=p.e("div"),this.hydrate()},hydrate:function(e){r.className="progress-bar_fill",r.style.cssText=n="width: "+t.file.progress+"%"},mount:function(t,e){p.l(r,t,e)},update:function(t,e){n!==(n="width: "+e.file.progress+"%")&&(r.style.cssText=n)},unmount:function(){p.i(r)},destroy:p.m}}function l(t){t=t||{},this.refs={},this._state=p.c(d.data(),t.data),this._observers={pre:Object.create(null),post:Object.create(null)},this._handlers=Object.create(null),this._root=t._root||this,this._yield=t._yield,this._torndown=!1,document.getElementById("svelte-201504670-style")||n(),this._renderHooks=[],this._fragment=i(this._state,this),t.target&&(this._fragment.create(),this._fragment.mount(t.target,null)),this._flush()}var c=r(57),p=r(15),d=function(){return{data:function(){return{file:void 0,selected:!1,state:"paused",selectedIcon:"check"}},methods:{togglePlay:function(){var t=this.get("file");if("audio"!==t.type)return this.fire("select",t);if(!t.url)throw new Error("File is missing the URL");this.refs.Sounds.instance().load(t.id,t.url),this.refs.Sounds.instance().togglePlay(t.id)},_onSoundsStateChange:function(t){this.set({state:this.refs.Sounds.instance().getState(t)})}}}}();p.c(l.prototype,d.methods,p.n),l.prototype._set=function(t){var e=this._state;this._state=p.c({},e,t),p.k(this,this._observers.pre,t,e),this._fragment.update(t,this._state),p.k(this,this._observers.post,t,e),this._flush()},l.prototype.teardown=l.prototype.destroy=function(t){this.fire("destroy"),!1!==t&&this._fragment.unmount(),this._fragment.destroy(),this._fragment=null,this._state={},this._torndown=!0},e.a=l},function(t,e,r){var n,i,o,s,a,u,l,c=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty;i=window.require("spine/controller/activator"),n=window.require("spine/controller/activateable"),l=r(5),u=r(152),s=window.require("core/models/content"),o=r(153),a=function(t){function e(){this.onScroll=c(this.onScroll,this),this.activate=c(this.activate,this),this._onActivate=c(this._onActivate,this),this.addItem=c(this.addItem,this),this._release=c(this._release,this),this._relocate=c(this._relocate,this),this.scrollBottom=c(this.scrollBottom,this),this.scrollTop=c(this.scrollTop,this),this.onDrop=c(this.onDrop,this),this.onDrag=c(this.onDrag,this),this.onDragStart=c(this.onDragStart,this),this.initialize=c(this.initialize,this),e.__super__.constructor.apply(this,arguments),this.scroll(),this.container.sortable({itemSelector:".item-details",handle:".item-details-order",onDragStart:this.onDragStart,onDrop:this.onDrop,onDrag:this.onDrag}),this.bulkEditor=new o,this.bulkEditor.toggle(),this.bulkEditor.bind("toggle",function(t){return function(e){return setTimeout(function(){return t.scroll().update()},500)}}(this)),this.items=[]}return p(e,t),e.prototype.className="editor-content",e.prototype.autoDeactivate=!1,e.prototype.title="Details",e.prototype.nextTitle="Edit Details",e.prototype.interval=0,e.prototype.vh=0,e.prototype.eof=0,e.include(n),e.include(l),e.prototype.for=function(t){return this.composition=t,this.initialize(),this.el.prepend(this.bulkEditor.el),this.bulkEditor.for(this.composition),this},e.prototype.initialize=function(t){return this.composition?(this.children(function(t){return t.release()}),this.stopListening(),this.listenTo(s,"create",this.addItem),this.composition.getContent().forEach(this.addItem),this.trigger("initialized")):console.warn("No composition set")},e.prototype.onDragStart=function(t,e,r){return t.controller().deactivate(),r(t,e),t.controller().deactivate(),this.scroll().update(),this.$item=$(t),this.vh=this.container.parent().height(),this.oh=this.container[0].scrollHeight,this.eof=this.el.offset()},e.prototype.onDrag=function(t,e,r){var n,i,o;if(r(t,e),i=this.$item.offset(),this.position=e,this.offset=i,this.dragged=this.$item,o=i.top-this.eof.top<30,n=i.top-this.eof.top>this.vh-10,!o&&!n)return clearInterval(this.interval),this.interval=0;if(o){if(0===this.interval)return this.interval=setInterval(this.scrollTop,10)}else if(n&&0===this.interval)return this.interval=setInterval(this.scrollBottom,10)},e.prototype.onDrop=function(t,e,r){return r(t,e),t.controller().onDrop(),this.$item=null,this._relocate(),clearInterval(this.interval),this.interval=0},e.prototype.scrollTop=function(){var t;if((t=this.container.scrollTop())>0)return this.scroll().scrollTo(t-4),this.dragged.css({top:parseInt(this.dragged.css("top"))-4})},e.prototype.scrollBottom=function(){var t,e;if(e=this.container.scrollTop(),(t=parseInt(this.dragged.css("top")))<this.oh-4)return this.scroll().scrollTo(e+4),this.dragged.css({top:4+t})},e.prototype._relocate=function(){return this.children(function(t){return t.item.order!==t.el.index()+1}).forEach(function(t){return t.item.updateAttribute("order",t.el.index()+1,{attribute:"order"})}),this.scroll().update()},e.prototype._release=function(){return e.__super__._release.apply(this,arguments),setTimeout(this._relocate,100),this.delay(function(t){return function(){if(t.isActive()&&0===t.children().length)return t.$trigger("DetailsEditor:empty")}}(this))},e.prototype.addItem=function(t){var e;if(t.composition_id===this.composition.id)return this.append(e=new u({item:t,meta:t.meta()})),t.updateAttribute("order",e.el.index()+1,{attribute:"order"}),this.scroll().update(),this.items.push(e)},e.prototype._onActivate=function(){var t;if(!this.children(function(t){return t.isActive()}).length)return null!=(t=this.children(function(t){return!t.isInvalid})[0])&&t.activate({animate:!0}),this.scroll().update()},e.prototype.activate=function(){return n.activate.apply(this,arguments),this.$trigger("viewChange","details"),this.delay(this._onActivate),this},e.prototype.onScroll=function(){return this.children(function(t){var e;return"function"==typeof(e=t.attributes).deactivate?e.deactivate():void 0})},e}(i),t.exports=a},function(t,e,r){var n,i,o,s,a,u=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=window.require("spine/controller"),o=window.require("spine/controller/container"),n=window.require("spine/controller/activateable"),i=r(115),a=function(t){function e(){this._onItemValidation=u(this._onItemValidation,this),this.destroy=u(this.destroy,this),this.toggle=u(this.toggle,this),this._change=u(this._change,this);var t,r,n,o;e.__super__.constructor.apply(this,arguments),this.item.bind("destroy",this.release),this.item.bind("change",this._change),r="<div class='item-details-order'></div>",o="<div class='item-details-toggle'></div>",t="<div class='item-details-delete' data-icon='⏍'></div>",n=$("<div class='item-details-right'></div>"),this.attributes=new i({options:this.meta.attributes,item:this.item}),n.append(o,t),this.append(r,this.attributes,n)}return l(e,t),e.prototype.className="item-details",e.prototype.tag="li",e.include(o),e.include(n),e.prototype.elements={".item-details-order":"place",".item-details-toggle":"toggleButton"},e.prototype.events={"click .item-details-toggle":"toggle","click .item-details-delete":"destroy",invalid:"_onItemValidation",valid:"_onItemValidation"},e.prototype._change=function(t,e,r){if("order"===r.attribute)return this.place.html(t.order)},e.prototype.activate=function(t){if(null==t&&(t={}),!(this.attributes.length<2||this.isInvalid))return n.activate.apply(this,[t]),t.animate&&this.animateFirstAttribute(),this.attributes.update()},e.prototype.deactivate=function(){return n.deactivate.apply(this,arguments),this.attributes.deactivate()},e.prototype.toggle=function(){return this.isActive()?this.deactivate():this.activate(),this.parent().scroll().update()},e.prototype.destroy=function(){return this.item.destroy()},e.prototype._onItemValidation=function(t){if(this.isInvalid="invalid"===t.type&&this.attributes.el.children().first().is(t.target),this.el.toggleClass("item-invalid",this.isInvalid),this.isInvalid)return this.deactivate()},e.prototype.animateFirstAttribute=function(){var t;return t=this.el.height(),this.el.height(this.el.css("minHeight")),this.el.addClass("transitions").on("transitionend webkitTransitionEnd",function(t){return function(e){if($(e.target).is(t.el))return t.el.removeAttr("style").removeClass("transitions"),t.parent().scroll().update(),t.el.off("transitionend webkitTransitionEnd")}}(this)).height(t)},e.prototype.onDrop=function(){return this.attributes.onDrop()},e}(s),t.exports=a},function(t,e,r){var n,i,o,s,a=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=window.require("spine/controller"),o=window.require("core/models/content"),n=r(154),i=function(t){function e(){return this.onItemChange=a(this.onItemChange,this),this.updateItemAttributes=a(this.updateItemAttributes,this),this.onItemAdded=a(this.onItemAdded,this),this._change=a(this._change,this),this.initialize=a(this.initialize,this),this.for=a(this.for,this),this.toggle=a(this.toggle,this),e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.className="details_bulk-editor activateable",e.prototype.elements={".item-details":"attributesEl"},e.prototype.events={"click .item-toggle":"toggle"},e.prototype._isActive=!1,e.prototype.template=function(){return'<div class="bulk-editor-header">\n\t<div class="bulk-editor-title">'+this.options.title+"</div>\n\t<div class='item-details-right'>\n\t\t"+(this.options.help_text?'<div class="control-help" data-tooltip-text="'+this.options.help_text+'"></div>':"")+'\n\t\t<div class="item-toggle multi-tabs-toggle" data-icon="❯">\n\t\t\t<span data-icon="❯"></span>\n\t\t</div>\n\t</div>\n</div>\n<div class="item-details"></div>'},e.prototype.toggle=function(){return this._isActive=!this._isActive,this.trigger("toggle",this._isActive),this.el.toggleClass("active",this._isActive),this.attributesEl.css({"margin-bottom":this._isActive?0:-this.attributesElHeight})},e.prototype.for=function(t){return this.composition=t,null==this.composition.contentMeta().bulkEditor?this.el.addClass("empty"):(this.item=this.composition.bulkContent(),this.item.bind("change",this._change),this.listenTo(o,"create",this.onItemAdded),this.listenTo(o,"change",this.onItemChange),this.initialize(this.composition.contentMeta()))},e.prototype.initialize=function(t){var e,r,i,o;for(this.options=t.bulkEditor,this.render(),this.numAttributes=this.options.attributes.length,this.el.toggleClass("single-attribute",1===this.numAttributes),o=this.options.attributes,r=0,i=o.length;r<i;r++)e=o[r],(this.attributes||(this.attributes={}))[e]=t.attributes[e];return this.attrPanel=new n({options:this.attributes,item:this.item,el:this.attributesEl}),this.attributesElHeight=this.attributesEl.outerHeight()},e.prototype._change=function(t,e,r){var n;if("metadata"!==(n=r.attribute))return this.composition.getContent().forEach(function(t){return function(e){if(e.id!==t.item.id&&!e.editedMeta(n))return e.attrMeta(n,!1),e.updateAttribute(n,t.item[n],{attribute:n,from:t})}}(this))},e.prototype.onItemAdded=function(t){if(t.composition_id===this.composition.id)return this.updateItemAttributes(o.find(t.id))},e.prototype.updateItemAttributes=function(t){var e,r,n;if(t.composition_id===this.composition.id){r=this.attributes,n=[];for(e in r)r[e],t.editedMeta(e)||t[e]===this.item[e]||(t.attrMeta(e,!1,{silent:!0}),n.push(t.updateAttribute(e,this.item[e],{attribute:e,from:this})));return n}},e.prototype.onItemChange=function(t,e,r){var n,i,o,s,a;if("metadata"===r.attribute&&!r.silent){for(s=this.composition.getContent(),a=[],i=0,o=s.length;i<o;i++)n=s[i],n.id===t.id&&a.push(this.updateItemAttributes(n));return a}},e}(s),t.exports=i},function(t,e,r){var n,i,o,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=window.require("spine/controller"),n=r(115),i=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.attributes=new n({options:this.options,item:this.item,isEditable:function(){return!0}}),this.el.append(this.attributes.el)}return s(e,t),e}(o),t.exports=i},function(t,e){var r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;n=window.require("spine/controller"),r=window.require("spine/controller/activateable"),window.require("core/models/composition"),o=window.require("core/models/widget"),window.require("core/models/user"),i=function(t){function e(){this.onPopupClose=s(this.onPopupClose,this),this.notifyShareIntent=s(this.notifyShareIntent,this),this.publishComposition=s(this.publishComposition,this),this.ready=s(this.ready,this),this._activate=s(this._activate,this),e.__super__.constructor.apply(this,arguments),this.render()}return a(e,t),e.prototype.className="embedder",e.prototype.template="editor/views/embed",e.prototype.nextTitle="Publish",e.prototype.title="Done",e.include(r),e.prototype.elements={".view-comp-btn":"compBtn",".ready-icon":"readyIcon"},e.prototype.events={"click .share-btn":"notifyShareIntent"},e.prototype.for=function(t){if(this.composition=t,this.composition.isPersisted())return this.widget||(this.widget=o.find(this.composition.widget_id))},e.prototype.activate=function(){if(!this.isActive())return this.$trigger("viewChange","save"),this.publishComposition().then(this.for.bind(this,this.composition)).then(this._activate).then(this.ready)},e.prototype._activate=function(){return r.activate.apply(this,arguments)},e.prototype.ready=function(){return this.delay($.fn.show.bind(this.readyIcon))},e.prototype.publishComposition=function(){return this.composition.persist().then(function(t){return function(e){return t.$trigger("composition:save",e)}}(this)).fail(function(t){return function(e){return console.warn("Persisting the composition failed. Saved as temporary."),t.$trigger("composition:temporary:save",t.composition)}}(this))},e.prototype.notifyShareIntent=function(t){return t.preventDefault(),this.$trigger("sharew-intent",$(t.target).data("target"))},e.prototype.onPopupClose=function(){if(this.pop)return this.$trigger("Save:close",this.pop=!1)},e}(n),t.exports=i},function(t,e,r){var n,i,o=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=r(13),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.className="popup login-popup",e.prototype.confirmBtnClass="dim-button button--uc login-button",e.prototype.cancelBtnClass="green-button button--uc button--icon-right button--go register-button",e.prototype.title="Login or sign up.",e.prototype.content="",e.prototype.note="",e.prototype.separator=!1,e.prototype.confirmBtn="Log in",e.prototype.cancelBtn="Sign up free",e.prototype.setTitle=function(t){return null==t&&(t="Login or sign up."),this.title=t,this.render(this),this},e.prototype.place=function(t){return this.pop=this.pop.bind(this,t)},e.prototype.onConfirm=function(){return this.$trigger("login-intent")},e.prototype.onCancel=function(){return this.$trigger("signup-intent")},e}(i),t.exports=new n},function(t,e){var r,n,i,o=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=window.require("spine/controller"),r=window.require("spine/controller/activateable"),n=function(t){function e(){return this.render=o(this.render,this),e.__super__.constructor.apply(this,arguments)}return s(e,t),e.include(r),e.prototype.tag="a",e.prototype.events={click:"click"},e.prototype.render=function(){return this.$addClass(this.panel.title.toLowerCase()).html(this.panel.title),this},e.prototype.click=function(){return this.$trigger("Breadcrumb:step",this.panel.title.toLowerCase())},e}(i),t.exports=n},function(t,e){var r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;window.require("core/models/skin"),r=window.require("core/models/content"),n=window.require("spine/core/events"),i=window.require("spine/core/module"),o=function(t){function e(t){this.remote=t,this.release=s(this.release,this),this.removeDemoContent=s(this.removeDemoContent,this),this.addContent=s(this.addContent,this),this.resize=s(this.resize,this),this.load=s(this.load,this),this.style=$('<style type="text/css">'),e.__super__.constructor.apply(this,arguments),this.currentWidget=this.remote.getPreview().widget(),this._loadDependencies()}return a(e,t),e.include(n),e.prototype.load=function(t){return this.composition=t,this.stopListening(r,"create",this.removeDemoContent),this.stopListening(r,"create",this.addContent),this.composition.getContent().length||this.listenTo(r,"create",this.removeDemoContent),this.listenTo(r,"create",this.addContent),this.listenTo(this.composition,"update",this.resize),this.lastSkin&&this.setSkin(this.lastSkin),this.trigger("initialized"),this},e.prototype.resize=function(t){return this.currentWidget.resize()},e.prototype.addContent=function(t){if(t.composition_id===this.composition.id)return this.currentWidget.addContent(t)},e.prototype.removeDemoContent=function(t){if(t.composition_id===this.composition.id)return r.all().filter(function(t){return t._isDemoContent}).forEach(function(t){return t.destroy()}),this.currentWidget.clearContent(),this.stopListening(r,"create",this.removeDemoContent)},e.prototype.setSkin=function(t){return this.lastSkin=t,this.currentWidget.setSkin(this.lastSkin)},e.prototype._loadDependencies=function(){var t;if(null!=this.remote.window.SoundManager&&(t=new this.remote.window.SoundManager),null!=this.remote.window.soundManager&&(t=this.remote.window.soundManager),t&&(window.soundManager=t,t.setup(this.remote.window.soundManager.setup())),!window.videojs)return window.videojs=this.remote.window.videojs},e.prototype.release=function(){return this.trigger("release",this),this.unbind(),this.stopListening()},e}(i),t.exports=o},function(t,e,r){function n(t){return r(i(t))}function i(t){var e=o[t];if(!(e+1))throw new Error("Cannot find module '"+t+"'.");return e}var o={"./audio.coffee":19,"./browser.coffee":160,"./color.coffee":91,"./date-time/calendar/index.coffee":20,"./date-time/calendar/months.coffee":21,"./date-time/calendar/years.coffee":22,"./date-time/clock.coffee":23,"./date-time/helper.coffee":24,"./date-time/index.coffee":92,"./date-time/popup.coffee":25,"./details/audio.coffee":93,"./details/image.coffee":94,"./details/video.coffee":95,"./dropdown.coffee":7,"./font/font-item.coffee":29,"./font/font-list.coffee":30,"./font/fonts-popup.coffee":31,"./font/index.coffee":96,"./image.coffee":27,"./index.coffee":2,"./orderPicker.coffee":97,"./position/grid-panel.coffee":32,"./position/index.coffee":98,"./position/panel.coffee":6,"./position/pixel-panel.coffee":34,"./position/popup.coffee":33,"./position/reference-panel.coffee":35,"./range.coffee":99,"./rss.coffee":100,"./scale.coffee":101,"./slider.coffee":102,"./stepper.coffee":3,"./text.coffee":11,"./textarea.coffee":103,"./toggle.coffee":104,"./url.coffee":4,"./video.coffee":28};n.keys=function(){return Object.keys(o)},n.resolve=i,t.exports=n,n.id=159},function(t,e,r){var n,i,o,s,a,u,l,c,p,d,h,f=function(t,e){return function(){return t.apply(e,arguments)}},g=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;u=r(2),l=window.require("spine/controller"),n=window.require("spine/controller/activateable"),a=window.require("spine/controller/container"),d=window.require("spine/controller/tabs"),p=r(106),i=r(50),h=r(112),c=function(t){function e(t){this.onChange=f(this.onChange,this),this.clear=f(this.clear,this);var r;e.__super__.constructor.apply(this,arguments),$.extend(t.options,{readonly:!1}),r=window.require(t.control),this.control=new r({attribute:this.attribute,options:t.options}),this.append(this.control,"<span class='field-delete' data-icon='⏍'></span>"),this.control.bind("change:"+this.control.type,this.onChange),this.recount=function(t){return function(){}}(),this.addEntry=function(t){return function(e){var r;return null==e&&(e={}),t.control.update(e.url),t.tab.count((r=Boolean(e.url||!1))>>0),t.el.toggleClass("old",r)}}(this),this.removeEntry=function(t){return function(e){return null==e&&(e={}),t.control.update(""),t.tab.count(0),t.el.toggleClass("old",!1)}}(this)}return g(e,t),e.prototype.title="directinput",e.prototype.serviceTitle="link",e.prototype.className="directinput directinputpopup",e.include(n),e.include(a),e.prototype.attributes={authenticated:!0},e.prototype.containerClass="directinput-field",e.prototype.events={"click .field-delete":"clear"},e.prototype.clear=function(){return this.control.update(""),this.onChange()},e.prototype.onChange=function(t){var e;return null==t&&(t={}),this.tab.count((e=Boolean(t.value||!1))>>0),this.el.toggleClass("old",e),this.trigger("beforeChange"),e?this.trigger("urlChange",{url:t.value,service:null}):this.trigger("urlRemove")},e.prototype.release=function(){return this.control.release(),e.__super__.release.apply(this,arguments)},e}(l),s=function(t){function e(t,r,n){this.anchor=n,this.activate=f(this.activate,this),this.deactivate=f(this.deactivate,this),this.set=f(this.set,this),this.clearServices=f(this.clearServices,this),this.contentRemove=f(this.contentRemove,this),this.contentCanAdd=f(this.contentCanAdd,this),this.contentAdd=f(this.contentAdd,this),this.addBrowser=f(this.addBrowser,this),e.__super__.constructor.apply(this,arguments),this.input=new c(r),this.browsers=[],this.input.bind("beforeChange",this.clearServices),this.input.bind("urlChange",this.contentAdd),this.input.bind("urlRemove",this.contentRemove),delete this.sources.websearch,delete this.sources.blogvio,delete this.sources.dropbox,delete this.sources.flickr,delete this.sources["google-drive"],this.$bind("click",function(t){return t.stopPropagation()}),this.listenTo($("body"),"click",function(t){return function(){if(t.isActive())return t.deactivate()}}(this))}return g(e,t),e.prototype.className="content-browser browser-popup",e.prototype.tabContainerClass="content-browser-tabs",e.prototype.containerClass="content-browser-container",e.prototype.tabRenderer=p,e.include(n),e.prototype.interval=0,e.prototype.events={"click .message .close":"closeMessage","click .browser-logout":"deactivate"},e.prototype.elements={".message":"message",".message .text":"text"},e.prototype.children=function(t){var e,r,n,i;null==t&&(t=function(){return!0}),n=this.browsers,i=[];for(e in n)r=n[e],t(r)&&i.push(r);return i},e.prototype._initBrowsers=function(t){var e,r,n,o,s;t.append(this.el),this.addBrowser(h,{allowDelete:!1,allowClear:!1}),o=this.sources;for(n in o)s=o[n],e=window.require(s.module),r=null!=s.browser?window.require(s.browser):i,this.browsers[n]=r=new r({content:[],title:n,Service:e,options:$.extend({},this.options,s.options||{})}),this.listenTo(r,"add",this.contentAdd),this.listenTo(r,"remove",this.contentRemove),this.listenTo(r,"canAdd",this.contentCanAdd),this.append(r);return this.browsers.inpt=this.input,this.append(this.input)},e.prototype.addBrowser=function(t,e){var r,n;if(t.isCompatible(this.options.types))return r=new t(Object.assign({filetypes:this.options.types},e)),r.on("toggle",function(e){return function(r){var n,i,o;return n=r.file,r.options,e.clear(),n.id!==(null!=(o=e.item)?o.id:void 0)?(i={id:n.id,url:n.url,service:t.name},e.item=i,e.trigger("select",i)):(e.item=null,e.trigger("select"))}}(this)),r.observe("selected",function(t){return r.tab.count(t.length)}),r.observe("loading",function(t){return function(e){var r;return r=$("style[id^=svelte]"),$(t.popup.head).append(r.clone())}}(this),{defer:!0}),n=function(e){return function(){var n;return(null!=(n=e.item)?n.service:void 0)===t.name?r.set({selected:[e.item.id]}):r.set({selected:[]})}}(this),this.on("select",n),n(),this.append(this.browsers[t.name]=r)},e.prototype.contentAdd=function(t){return t&&(this.item=t),this.trigger("select",t)},e.prototype.contentCanAdd=function(t){return this.clear(),null!=t?t.call(this):void 0},e.prototype.contentRemove=function(t){if(null!=this.item)return this.item=null,this.trigger("select")},e.prototype.clearServices=function(){var t;if(this.item)return null!=(t=this.browsers[this.item.service])&&"function"==typeof t.removeEntry?t.removeEntry(this.item):void 0},e.prototype.clear=function(){var t;if(this.item)return"function"==typeof(t=this.browsers[this.item.service||"inpt"]).removeEntry?t.removeEntry(this.item):void 0},e.prototype.set=function(t){return this.clear(),this.item=t},e.prototype.deactivate=function(){var t;return null!=(t=this.popup)&&t.hide(),n.deactivate.apply(this,arguments)},e.prototype.activate=function(){return this._createPopup().then(function(t){return function(){var e;return t.popup.show(),t.item?(e=t.browsers[t.item.service||"inpt"],e.active(),t.set(t.item),e.recount()):t.children(function(t){return t.isActive()}).length<1&&t.children()[0].active(),n.activate.apply(t,arguments)}}(this))},e.prototype.release=function(){var t,r,n,i;this.input.release(),n=this.browsers;for(t in n)r=n[t],r.release();return null!=(i=this.popup)&&i.release(),e.__super__.release.apply(this,arguments)},e.prototype._createPopup=function(){return this.popupPromise?this.popupPromise:this.popupPromise=Blogvio.UI.popup.new({anchor:this.anchor,topOffset:6,leftOffset:-9,css:["https://widgetic.com/bundles/blogvioapp/css/editor/editor.css"]}).then(function(t){return function(e){return t.popup=e,t._initBrowsers(t.popup),t.popup.append(t.el)}}(this)).fail(function(t){return console.error(t.stack)})},e}(d),o=function(t){function e(){this.deactivate=f(this.deactivate,this),this.browse=f(this.browse,this),this.select=f(this.select,this),this.setItem=f(this.setItem,this),this.update=f(this.update,this);var t,r;e.__super__.constructor.apply(this,arguments),(r=$.extend({},this.options.input))&&(r.options.readonly=!0,t=window.require(r.control),this.control=new t({item:this.item,attribute:this.attribute,options:r.options,isDetailInput:this.isDetailInput}),this.input.prepend(this.control.el)),this.options.browser&&(this.browserPopup=new s(this.options.browser,this.options.input,this.browseButton),this.browserPopup.bind("select",this.select))}return g(e,t),e.prototype.template="core/views/browser",e.prototype.className="control control-browser",e.prototype.elements={".input-browser":"input",".input-browser-browse":"browseButton"},e.prototype.events={"click .input-browser-browse, input:text, .url-thumb":"browse"},e.prototype.update=function(t,e,r){var n;if(null==r&&(r={}),t[this.attribute]&&r.from!==this&&this.browserPopup)return this.browserPopup.set(("function"==typeof t.attrMeta?t.attrMeta(this.attribute):void 0)||(null!=(n=t.metas)?n[this.attribute]:void 0)||{url:t[this.attribute]})},e.prototype.setItem=function(t){return e.__super__.setItem.apply(this,arguments),this.control.setItem(t)},e.prototype.select=function(t){var e,r;return this.change(r=t?t.url:""),"function"==typeof(e=this.item).attrMeta&&e.attrMeta(this.attribute,(null!=t?t.service:void 0)?t:null),this.control.$addClass("valid"),this.trigger("change:"+(this.type||"control"),{attribute:this.attribute,val:r,value:r})},e.prototype.browse=function(t){return t.stopPropagation(),this.browserPopup.isActive()?this.browserPopup.deactivate():this.browserPopup.activate()},e.prototype.release=function(){var t,r;return null!=(t=this.control)&&t.release(),null!=(r=this.browserPopup)&&r.release(),e.__super__.release.apply(this,arguments)},e.prototype.deactivate=function(){return this.browserPopup.deactivate()},e}(u),t.exports=o},function(t,e,r){function n(t){return r(i(t))}function i(t){var e=o[t];if(!(e+1))throw new Error("Cannot find module '"+t+"'.");return e}var o={"./base/photoitem.coffee":162,"./cache.coffee":117,"./default.coffee":163,"./dropbox.coffee":164,"./facebook.coffee":165,"./flickr.coffee":166,"./google-drive-sdk.coffee":118,"./google-drive.coffee":167,"./instagram-social.coffee":168,"./instagram.coffee":169,"./share-popup.coffee":119,"./soundcloud.coffee":170};n.keys=function(){return Object.keys(o)},n.resolve=i,t.exports=n,n.id=161},function(t,e){var r,n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=window.require("spine/controller"),r=window.require("spine/controller/activateable"),n=window.require("core/models/content"),o=function(t){function e(){this._create=s(this._create,this),this._destroy=s(this._destroy,this),this.error=s(this.error,this),this.done=s(this.done,this),this.toggle=s(this.toggle,this),e.__super__.constructor.apply(this,arguments),this.$bind("click",this.toggle),this.item=new n,this.listenTo(n,"destroy",this._destroy),this.listenTo(n,"create",this._create)}return a(e,t),e.prototype.className="service-photo-item loading",e.prototype.elements={img:"img"},e.include(r),e.prototype.photoOptions=null,e.prototype.photoData=null,e.prototype.toggle=function(t){var e;if(!this.el.is(".loading"))return this.isActive()?this.item.destroy():(e={},e[""+this.attribute]=this.photoData,e.options=this.photoOptions,this.item.updateAttributes(e,{attribute:this.attribute,from:this}))},e.prototype.done=function(){return this.$trigger("itemReady").$removeClass("loading")},e.prototype.error=function(){return this.$trigger("itemReady").release()},e.prototype._destroy=function(t){if(this.item&&t&&t.eql(this.item))return this.deactivate(),this.item=new n},e.prototype._create=function(t){if(this.item&&t&&t.eql(this.item))return this.activate()},e}(i),t.exports=o},function(t,e,r){var n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;o=r(8),i=r(9),n=function(t){function e(){this.triggerAuthRequire=s(this.triggerAuthRequire,this),this.newEntry=s(this.newEntry,this),this.addContentEntry=s(this.addContentEntry,this),this.addItems=s(this.addItems,this),e.__super__.constructor.apply(this,arguments),this.title=""+this.title[0].toUpperCase()+this.title.slice(1),this.authenticated=!1,this.authPromise=(this.authDef=new $.Deferred).promise(),window.editor.el.bind("content:"+this.title.toLowerCase()+":add",this.addItems)}return a(e,t),e.prototype.hideDisconnectBtn=!0,e.prototype._auth=function(t){if(this.triggerAuthRequire(t),this.trigger("auth",this.authenticated),this.authenticated)return setTimeout(function(t){return function(){return t.authDef.resolve()}}(this))},e.prototype.addItems=function(t,e){return null==e&&(e={items:[]}),this.authenticated||this.auth(!(this.authenticated=!0)),this.authPromise.then(function(t){return function(){return t.hasAddContentEntry||t.trigger("refresh",[t.addContentEntry()]),t.trigger("refresh",(e.items||[]).map(t.newEntry))}}(this))},e.prototype.refresh=function(t){return t},e.prototype.addContentEntry=function(){var t;return this.hasAddContentEntry=!0,t=this.newEntry({name:"Add content",url:"/",type:"button"}),t.className="add-content-entity",t.bind("select",this.triggerAuthRequire.bind(this,!0)),t},e.prototype.newEntry=function(t){var e,r,n;e=new i({service:this,name:t.name||t.title||t.url,path:t.url,type:t.type,url:t.url});for(r in t)n=t[r],e[r]=n;return e},e.prototype.getURL=function(t,e){return e(t.url)},e.prototype.preview=function(t){return t.url},e.prototype.deauth=function(){},e.prototype.triggerAuthRequire=function(t){return this.trigger("auth-req",{interactive:t,source:this.title,"content-type":this.options.types})},e}(o),t.exports=n},function(t,e,r){var n,i,o,s,a,u,l,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty,d=function(t,e){return function(){return t.apply(e,arguments)}};a=r(8),o=r(9),u='<a class="add-content-instr-link" target="_blank" href="http://blog.widgetic.com/post/101481120261/how-to-load-your-content-from-dropbox">How to load your content?</a>',n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.openWindow=function(t){return this.popup.location.href=t},e.prototype.openPopup=function(){return this.popup=window.open("/connect/dropbox.html","_dropboxOauthSigninWindow",this.popupWindowSpec(980,700))},e}(Dropbox.Drivers.Popup),l={client:{key:"ekn9VjZx0VA=|nnWESTkqe31UYqt/Qllbpa2sjX1YmmcmNEPH/vwn0w==",sandbox:!0,fileRoot:"auto"},driver:{receiverUrl:"https://widgetic.com/connect/dropbox",rememberUser:!0}},s={image:["image/png","image/jpeg","image/jpg","image/gif","image/bmp"],audio:["audio/mp3","audio/mpeg"],video:["video/mp4"],folder:["inode/directory"]},Dropbox.Stat.prototype.entry=function(t,e){var r,n,i;n={name:this.name,path:this.path,id:this.path};for(r in s)i=s[r],i.indexOf(this.mimeType)>-1&&(n.type=r);return new o(n)},i=function(t){function e(){this.onAuth=d(this.onAuth,this);var t;e.__super__.constructor.apply(this,arguments),this.authenticated=!1,(this.client=new Dropbox.Client(l.client)).authDriver(new n(l.driver)),this.allMime=[].concat.apply([],function(){var e,r,n,i;for(n=this.options.types,i=[],e=0,r=n.length;e<r;e++)t=n[e],null!=s[t]&&i.push(s[t]);return i}.call(this)).concat(s.folder),this.root.navTitle="Dropbox/Apps/Blogvio"}return c(e,t),e.prototype.responses={},e.prototype.faqLink=$(u),e.prototype._auth=function(t){return null==t&&(t=!0),t&&n.prototype.openPopup(),this.client.authenticate({interactive:t},this.onAuth)},e.prototype.onAuth=function(t,e){if(this.trigger("auth",!t&&e.isAuthenticated()),t)return this.client.reset()},e.prototype.refresh=function(t){return this.client.stat(t.path,{readDir:!0,cacheHash:t.hash},function(e){return function(r,n,i){return t.hash=(null!=n?n.versionTag:void 0)||t.hash,r&&(r.status=304)?i=e.responses[t.hash]||[]:(i=i.filter(function(t){return e.allMime.indexOf(t.mimeType)>-1}).map(function(t){return t.entry()}),e.responses[t.hash]=i),e.trigger("refresh",i)}}(this))},e.prototype.getURL=function(t,e){return t.url?e(t.url):this.client.makeUrl(t.path,{downloadHack:!0,long:!0},function(t,r){return e(r.url)})},e.prototype.preview=function(t){return this.client.thumbnailUrl(t.path,{size:"m"})},e.prototype.deauth=function(){return this.client.signOut(function(t){return function(){return t.trigger("auth",!1)}}(this))},e}(a),t.exports=i},function(t,e,r){var n,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty,l=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};o=r(8),n=r(9),i=function(t){function e(){this.getPermissions=s(this.getPermissions,this),this._onFBRespond=s(this._onFBRespond,this),this._requestFBPages=s(this._requestFBPages,this),this._requestFBPhotoSet=s(this._requestFBPhotoSet,this),this.getEntryFetchPath=s(this.getEntryFetchPath,this),e.__super__.constructor.apply(this,arguments),this.permissions={},this.authenticated=!1,this.root.id="me",this.root.album=!0,this.apiReady=e.initFB()}return a(e,t),e.initFB=function(){return new Promise(function(t,e){return window.fbAsyncInit=function(e){return function(){return FB.init({status:!0,cookie:!0,xfbml:!1,appId:"126231267555748"}),t()}}(),function(t,e,r){var n,i;if(n=t.getElementsByTagName(e)[0],!t.getElementById(r))return i=t.createElement(e),i.id=r,i.src="//connect.facebook.net/en_US/all.js",n.parentNode.insertBefore(i,n)}(document,"script","facebook-jssdk")})},e.prototype.refresh=function(t){return this.entry=t,this.entry.children=[],this.pages=!1,this._requestFBPhotoSet(this.getEntryFetchPath(this.entry),this._onFBRespond)},e.prototype.getEntryFetchPath=function(t){var e,r,n;return n={},r=!!~this.options.types.indexOf("image"),r?(e="photos",n={fields:"id,images,name"}):(e="videos/uploaded",n={fields:"id,source,picture,description,format"}),t.album&&(e="albums",n={fields:"id, name, count"}),{path:t.id+"/"+e,options:n}},e.prototype._requestFBPhotoSet=function(t,e){var r,n;return r={},t.constructor===Object&&(n=t,t=n.path,r=n.options),FB.api(t,"GET",r,e)},e.prototype._requestFBPages=function(){return FB.api("me/accounts",this._onFBRespond)},e.prototype._onFBRespond=function(t){var e,r,i,o,s,a,u,l,c;return e=t.data||[],(this.entry.root||this.entry.album)&&(e=e.filter(function(t){return t.count>0||t.perms&&t.category&&null==t.count})),e=this.mapEntries(e),!this.entry.root&&!this.entry.album||(null!=(a=this.entry.children)?a.filter(function(t){return t.my_album}).length:void 0)||(e||(e=[]),r=!!~this.options.types.indexOf("image"),u=r?["Photos",this.entry.path+"/photos"]:["Videos",this.entry.path+"/videos"],i=u[0],s=u[1],"me"===this.entry.id&&(i="My "+i),e.push(new n({service:this,name:i,path:s,id:this.entry.id,type:"folder",my_album:!0}))),!this.entry.root||null==this.permissions.manage_pages||this.permissions.manage_pages||(null!=(l=this.entry.children)?l.filter(function(t){return t.pages}).length:void 0)||(e.push(o=new n({service:this,name:"Pages",path:"accept_pages",type:"button",pages:!0})),o.bind("select",this._auth.bind(this,!0))),this.trigger("refresh",e),null!=(s=null!=(c=t.paging)?c.next:void 0)?this._requestFBPhotoSet(s,this._onFBRespond):this.entry.root&&!this.pages?(this.pages=!0,this._requestFBPages()):void 0},e.prototype.mapEntries=function(t){return t.map(function(t){return function(e){var r;return r={images:e.images,id:e.id,name:e.name},r.type=null!=e.images?"image":e.format?"video":"folder","folder"===r.type&&(r.album=!(!e.perms||!e.category)),r.path=t.entry.path+"/"+e.id,r.preview="image"===r.type?e.images[Math.max(0,e.images.length-4)].source:t.entry.picture,"video"===r.type&&(r.source=e.source),new n(r)}}(this))},e.prototype.preview=function(t){return t.preview},e.prototype.getURL=function(t,e){return e("image"===t.type?t.images[0].source:t.source)},e.prototype._auth=function(t){var e;return null==t&&(t=!0),e=function(t){return function(e){return"connected"===e.status?t.getPermissions():t.trigger("auth",t.authenticated=!1)}}(this),t?FB.login(e,{scope:"user_photos,user_videos,manage_pages"}):FB.getLoginStatus(e)},e.prototype.deauth=function(){return FB.logout(function(t){return function(){return t.trigger("auth",!1)}}(this))},e.prototype.getPermissions=function(){return FB.api("/me/permissions",function(t){return function(e){var r,n;return t.permissions={},e.data.forEach(function(e){return t.permissions[e.permission]="granted"===e.status}),r=l.call(t.options.types,"image")>=0||l.call(t.options.types,"photo")>=0,n=l.call(t.options.types,"video")>=0,(r&&t.permissions.user_photos||n&&t.permissions.user_videos)&&null!=t.permissions.manage_pages?t.trigger("auth",t.authenticated=!0):t.trigger("auth",t.authenticated=!1)}}(this))},e}(o),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l,c=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty,h=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};o=r(8),n=r(9),a="e80667fd637788dde877f5684d496d85",localStorage.getItem("flickrTokenFor")!==a&&localStorage.removeItem("flickrAuthToken"),localStorage.setItem("flickrTokenFor",a),s={key:a,secret:"5a90030ecac5b4fc",sig:"05eb1494ce939ce3098bbcdc7300b5e3",token:null!=(u=localStorage.getItem("flickrAuthToken"))?u.split("::")[0]:void 0,nsid:null!=(l=localStorage.getItem("flickrAuthToken"))?l.split("::")[1]:void 0,perms:"read",rest:"https://api.flickr.com/services/rest/"},i=function(t){function e(){this.call=c(this.call,this),this._onRespond=c(this._onRespond,this),this.listEntries=c(this.listEntries,this),this.doAuth=c(this.doAuth,this),this.refresh=c(this.refresh,this),e.__super__.constructor.apply(this,arguments),this.authenticated=null!=s.token&&null!=s.nsid,h.call(this.options.types,"image")>=0&&this.options.types.push("photo")}return p(e,t),e.prototype.auth_url="https://flickr.com/services/auth/?api_key="+s.key+"&perms="+s.perms+"&api_sig="+s.sig,e.prototype.refresh=function(t){return this.entry=t,this.getMediaList().done(this._onRespond)},e.prototype._auth=function(t){return null==t&&(t=!0),this.trigger("auth",this.authenticated),!this.authenticated&&t&&this.doAuth()},e.prototype.doAuth=function(){if(window.flickrReady=function(t){return function(e){return t.call({api_key:s.key,frob:e,method:"flickr.auth.getToken"}).done(function(e){return e=$(e),s.nsid=e.find("user").attr("nsid"),s.token=e.find("token").text(),localStorage.setItem("flickrAuthToken",s.token+"::"+s.nsid),t.trigger("auth",t.authenticated=!0)})}}(this),null==s.token)return window.open(this.auth_url,"Flickr connect","width=990,height=825")},e.prototype.deauth=function(){return this.trigger("auth",this.authenticated=!1),localStorage.removeItem("flickrAuthToken")},e.prototype.getMediaList=function(){return this.call({api_key:s.key,auth_token:s.token,extras:"media",format:"json",method:"flickr.people.getPhotos",nojsoncallback:1,user_id:s.nsid})},e.prototype.listEntries=function(t){var e,r,i,o,s;for(s=[],e=0,r=t.length;e<r;e++)i=t[e],o=i.media,h.call(this.options.types,o)>=0&&(i.type=this.options.types[0],i.path="/"+i.id,s.push(new n(i)));return s},e.prototype._onRespond=function(t){return t.photos.total?this.trigger("refresh",this.entry.children=this.listEntries(t.photos.photo)):this.trigger("refresh",this.entry.children=[])},e.prototype.call=function(t,e){var r,n;return null==t&&(t={}),t.api_sig=s.secret+function(){var e;e=[];for(r in t)n=t[r],e.push(""+r+n);return e}().join(""),t.api_sig=Crypto.MD5(t.api_sig),$.ajax(s.rest,{data:t})},e.prototype.preview=function(t){return"https://farm"+t.farm+".staticflickr.com/"+t.server+"/"+t.id+"_"+t.secret+"_q.jpg"},e.prototype.getURL=function(t,e){return"image"===t.type?e("https://farm"+t.farm+".staticflickr.com/"+t.server+"/"+t.id+"_"+t.secret+".jpg"):this.getVideoSizes(t).done(function(t){return function(r){return t.videoUrl(r.sizes.size,e)}}(this))},e.prototype.getVideoSizes=function(t){return this.call({api_key:s.key,auth_token:s.token,format:"json",method:"flickr.photos.getSizes",nojsoncallback:1,photo_id:t.id,user_id:s.nsid})},e.prototype.videoUrl=function(t,e){var r,n,i;for(r=0,n=t.length;r<n;r++)if(i=t[r],"Site MP4"===i.label)return e(i.source)},e}(o),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty,d=[].slice;o=r(8),n=r(9),s=r(119),u=r(118),a=r(117),i=function(t){function e(){this.createQuery=l(this.createQuery,this),this.requestDriverFiles=l(this.requestDriverFiles,this),this.getDriverFiles=l(this.getDriverFiles,this),this.getDriverFolders=l(this.getDriverFolders,this),this.checkEmpty=l(this.checkEmpty,this),this.gotResponse=l(this.gotResponse,this),this.getDriverData=l(this.getDriverData,this),this.refresh=l(this.refresh,this),this.onGoglAuth=l(this.onGoglAuth,this),this._auth=l(this._auth,this),e.__super__.constructor.apply(this,arguments),this.title="Google Drive",~this.options.types.indexOf("image")&&(this.type="image"),~this.options.types.indexOf("video")&&(this.type="video"),~this.options.types.indexOf("audio")&&(this.type="audio"),this.root.id="root",u.then(function(t){return function(){return gapi.auth2.getAuthInstance().isSignedIn.listen(t.onGoglAuth)}}(this))}return c(e,t),e.prototype.scope="https://www.googleapis.com/auth/drive.readonly",e.prototype._auth=function(t){return u.then(function(t){return function(){return gapi.auth2.getAuthInstance().isSignedIn.get()?t.trigger("auth",!0):gapi.auth2.getAuthInstance().signIn()}}(this))},e.prototype.onGoglAuth=function(t){return t?this.trigger("auth",!0):this.trigger("auth",!1)},e.prototype.refresh=function(t){var e;return this.entry=t,e=function(e){return function(){return e.gotResponse.apply(e,[t.id].concat(d.call(arguments)))}}(this),this.getDriverData(t,e)},e.prototype.getDriverData=function(t,e){return this.getDriverFolders(t.id,e).then(function(r){return function(){return r.getDriverFiles(t.id,r.type,e).then(e.bind(r,[],!0))}}(this))},e.prototype.gotResponse=function(t,e,r){var i,o;if(this.entry.id===t)return o=this,i=(e.files||[]).map(function(t){return function(e){var r,u,l;if(e)return r=!e.permissions.filter(function(t){return"anyone"===t.id||"anyoneWithLink"===t.id}).length,l=e.mimeType.match(/image|video|folder|audio/)[0],new n({id:e.id,type:l,path:t.entry.path+"/"+e.name,name:e.name,preview:null!=(u=e.thumbnailLink)?u.replace(/s\d+$/,"s250"):void 0,url:e.webContentLink,parent:e.parents[0].id,isPrivate:r,order:.5*("folder"===l)+parseFloat("0."+new Date(e.createdDate).getTime()),webLink:e.webViewLink,onActivate:function(){return!this.isPrivate||(s.pop($("body")),s.off("confirmed"),s.bind("confirmed",function(t){return function(){return gapi.client.drive.permissions.create({resource:{type:"anyone",role:"reader"},fileId:e.id,fields:"id"}).execute(function(r){return r.error?(console.error(r.error),alert("An error has occurred. The permissions have not been modified.")):(a.clear(e.parents[0]),t.isPrivate=!1,o.trigger("refresh",i,{hard:!0}))})}}(this)),!this.isPrivate)}})}}(this)).filter(function(t){return!(!t||!t.id)}).sort(function(t,e){return-(t.order-e.order)}),i.length&&this.trigger("refresh",i),r&&!this.entry.children.length?this.trigger("refresh",[]):void 0},e.prototype.checkEmpty=function(){return this.trigger("refresh",[])},e.prototype.getURL=function(t,e){return e(t.url)},e.prototype.preview=function(t){return t.preview},e.prototype.deauth=function(){return this.trigger("auth",this.authenticated=!1)},e.prototype.getDriverFolders=function(t,e){return this.getDriverFiles(t,"folder",e)},e.prototype.getDriverFiles=function(t,e,r){var n,i;return n=new $.Deferred,(i=function(o){return function(s){return o.requestDriverFiles(t,e,s).then(function(e){var s;return r(e),e.nextPageToken?void(o.entry.id===t&&(s=o.entry.children.slice(-1)[0])&&(s.onShow=function(){return i(e.nextPageToken),this.onShow=function(){}}.bind(s))):n.resolve()})}}(this))(null),n.promise()},e.prototype.requestDriverFiles=function(t,e,r){var n,i;return i=new $.Deferred,(n=a.get(t,r||e))&&i.resolve(n),a.check(t,r||e)||gapi.client.drive.files.list({q:this.createQuery(t,e),fields:"nextPageToken, files(id, name, mimeType, thumbnailLink, createdTime, permissions, parents, webContentLink, webViewLink)",pageToken:r}).execute(function(n){return function(n){return null!=n.result&&delete n.result,a.set(t,r||e,n),i.resolve(n)}}()),i.promise()},e.prototype.createQuery=function(t,e,r){var n,i;return n="mimeType contains '"+e+"/'","folder"===e&&(n="mimeType='application/vnd.google-apps.folder'"),i="trashed=false and ("+n+") and '"+t+"' in parents",r&&(i+=" and modifiedDate > '"+r+"'"),i},e}(o),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;o=r(8),u="https://widgetic.com/services/instagram",n={client_id:"542808610040105",client_secret:"0a88504381f577dbbef400d4232a4258",redirect_uri:u+"/auth_token",scope:"user_profile,user_media",response_type:"code",api_url:u,demo:"IGQVJVNUw5cHB5cUFiZATFxVmgyeWtSVFJjTDYyRmNnWDZAJZA3llVXREa1BsS1EtVGJ2UEdlbHJNbDV1UUQ2YkVSZA3YwS1dPWXJzYXFGQzdZAMlhBLTBWWWNkTVNHTGNDLW10dkdhNW0wMDVqMkhZAWEhqbgZDZD",token_storage:"redis",encodeToken:!1,redis_db:0,redis_prefix:"nstgrm:",port:8082},s=window.INSTAGRAM_SERVICE_CONFIG||n;try{s.token=localStorage.getItem("instagramAuthToken")}catch(t){}console.log("Editor Instagram Service current user's token:",s.token),a="https://api.instagram.com/oauth/authorize/?client_id="+s.client_id+"&redirect_uri="+s.redirect_uri+"&response_type="+s.response_type+"&scope="+s.scope,i=function(t){function e(){this.refresh=l(this.refresh,this),e.__super__.constructor.apply(this,arguments),this.user={},this.authenticated=!1}return c(e,t),e.browser="browser/controller/instagram",e.prototype.getToken=function(){return s.token},e.prototype.getUser=function(t){var e;return e=s.api_url+"/me",$.ajax({url:e,type:"GET",dataType:"json",headers:{"X-Token":t}})},e.prototype._auth=function(t){return null==t&&(t=!0),console.log("Editor Instagram Service _auth method:",t,s.token),null!=s.token&&this.getUser(s.token).then(function(t){return function(e){return console.log("Editor Instagram Service getUser result:",e),t.user=e,t.trigger("auth",t.authenticated=!0)}}(this)).catch(function(t){return function(){return console.log("Editor Instagram Service getUser error:",error),t.deauth()}}(this)),!this.authenticated&&t&&this.showAuthPopup()},e.prototype.showAuthPopup=function(){return window.instagramReady=function(t){return function(e,r){s.token=e;try{localStorage.setItem("instagramAuthToken",s.token=e)}catch(t){}return t.user=r,t.trigger("auth",t.authenticated=!0)}}(this),window.open(a,"Instagram connect","width=450,height=600")},e.prototype.refresh=function(t){return this.entry=t,this.trigger("refresh",[])},e.prototype.deauth=function(){this.authenticated=!1,s.token=null,this.trigger("auth",this.authenticated);try{return localStorage.removeItem("instagramAuthToken")}catch(t){}},e}(o),t.exports=i},function(t,e,r){var n,i,o,s,a,u,l,c,p,d=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty,g=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};s=r(8),n=r(9),c="https://widgetic.com/services/instagram/",i={client_id:"542808610040105",client_secret:"0a88504381f577dbbef400d4232a4258",redirect_uri:c+"auth_token",scope:"user_profile,user_media",response_type:"code",api_url:c,demo:"IGQVJVNUw5cHB5cUFiZATFxVmgyeWtSVFJjTDYyRmNnWDZAJZA3llVXREa1BsS1EtVGJ2UEdlbHJNbDV1UUQ2YkVSZA3YwS1dPWXJzYXFGQzdZAMlhBLTBWWWNkTVNHTGNDLW10dkdhNW0wMDVqMkhZAWEhqbgZDZD",token_storage:"redis",encodeToken:!1,redis_db:0,redis_prefix:"nstgrm:",port:8082},a=window.INSTAGRAM_SERVICE_CONFIG||i;try{a.token=localStorage.getItem("instagramAuthToken")}catch(t){}u="https://api.instagram.com/oauth/authorize/?client_id="+a.client_id+"&redirect_uri="+a.redirect_uri+"&response_type="+a.response_type+"&scope="+a.scope,p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],l={_cache:{},def:function(){return new $.Deferred},has:function(t){return null!=l._cache[t]},get:function(t){return l.def().resolve(l._cache[t]).promise()},set:function(t,e){return l._cache[t]=e,l}},o=function(t){function e(){this.listEntries=d(this.listEntries,this),this.makeFolders=d(this.makeFolders,this),this._onRespond=d(this._onRespond,this),this.fetchFotos=d(this.fetchFotos,this),this.refresh=d(this.refresh,this),e.__super__.constructor.apply(this,arguments),this.user={},this.authenticated=!1,this.ajaxReqs=[]}return h(e,t),e.prototype.getUser=function(t){var e;return e=a.api_url+"me",$.ajax({url:e,type:"GET",dataType:"json",headers:{"X-Token":t}})},e.prototype._auth=function(t){return null==t&&(t=!0),null!=a.token&&this.getUser(a.token).then(function(t){return function(e){return t.user=e,t.trigger("auth",t.authenticated=!0)}}(this)).catch(function(t){return function(e){return t.deauth()}}(this)),!this.authenticated&&t&&this.showAuthPopup()},e.prototype.showAuthPopup=function(){return window.instagramReady=function(t){return function(e,r){a.token=e;try{localStorage.setItem("instagramAuthToken",a.token=e)}catch(t){}return t.user=r,t.trigger("auth",t.authenticated=!0)}}(this),window.open(u,"Instagram connect","width=450,height=600")},e.prototype.deauth=function(){this.authenticated=!1,a.token=null,this.trigger("auth",this.authenticated);try{return localStorage.removeItem("instagramAuthToken")}catch(t){}},e.prototype.refresh=function(t){return this.entry=t,this.entry.children=[],this.children={},this.fetchFotos().done(this._onRespond)},e.prototype.fetchFotos=function(t){var e;return null==t&&(t=""),e=a.api_url+"?num=999&q="+this.user.id+"&max_id="+t,this.ajaxReqs[t]=$.ajax({url:e,type:"GET",dataType:"json",headers:{"X-Token":a.token},success:function(e){return function(e){return l.set(t,e)}}(),fail:function(t){return function(t){return console.log("Fetch photos failed:",t)}}()}),l.has(t)?l.get(t):this.ajaxReqs[t]},e.prototype._onRespond=function(t){var e,r,n;if(e=t.media.filter(function(t){return function(e){var r;return r=e.type=e.media_type.toLowerCase(),g.call(t.options.types,r)>=0}}(this)),e=this.listEntries(e),this.entry.children=this.entry.children.concat(e),this.trigger("refresh",e),r=null!=(n=t.pagination)?n.next_max_id:void 0)return this.fetchFotos(r).done(this._onRespond)},e.prototype.makeFolders=function(t){var e,r,i,o,s,a,u,l,c,d;for(s={},u=0,l=t.length;u<l;u++)a=t[u],e=new Date(a.timestamp),o=p[e.getMonth()]+" "+e.getFullYear(),function(){var t,e,n,i;for(n=this.entry.children,i=[],t=0,e=n.length;t<e;t++)r=n[t],r.name===o&&i.push(r);return i}.call(this).length||(s[o]=new n({service:this,name:o,path:"/"+o,type:"folder",year:e.getFullYear(),month:e.getMonth()}));d=[];for(c in s)i=s[c],d.push(i);return d},e.prototype.listEntries=function(t){var e,r,i,o,s;for(e=[],i=0,o=t.length;i<o;i++)r=t[i],s={id:r.id,type:r.type,media_url:r.media_url,thumbnail_url:r.thumbnail_url,caption:r.caption,images:{image:r.media_url,thumbnail:r.thumbnail_url}},null!=r.videos&&(s.videos=r.videos),s.path=this.entry.path+"/"+r.id,this.children[r.id]=new n(s),e.push(this.children[r.id]);return e},e.prototype.preview=function(t){return t.images.image||t.images.thumbnail},e.prototype.getURL=function(t,e){return e(t[t.type+"s"].image)},e}(s),t.exports=o},function(t,e,r){var n,i,o,s,a,u,l=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;o=r(8),n=r(9),u="https://widgetic.com/wservices/soundcloud/",i=r(171),a={api_url:"https://api.soundcloud.com",client_id:"aed0aa63baf747a83ad0b6b246acddca",redirect_uri:"https://widgetic.com/connect/soundcloud",tracks_url:u+"tracks/",grant_type:"refresh_token"},i.initialize(a),i.client_id=a.client_id,i.api_url=a.api_url,i.tracks_url=a.tracks_url;try{i.auth_token=localStorage.getItem("soundcloudAuthToken")}catch(t){}try{i.userId=localStorage.getItem("soundcloudUserId")}catch(t){}s=function(t){function e(){this.newEntry=l(this.newEntry,this),this.fetchTracks=l(this.fetchTracks,this),this.fetchPlaylists=l(this.fetchPlaylists,this),this.checkAuth=l(this.checkAuth,this),this.auth=l(this.auth,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.SCGet=function(t){var e;return e=""+i.api_url+t,$.ajax({url:e,type:"GET",dataType:"json",headers:{Authorization:"OAuth "+i.auth_token}})},e.prototype.auth=function(t){return!i.userId&&t?this.showAuthPopup():this.checkAuth()},e.prototype.showAuthPopup=function(){return i.connect().then(function(t){return function(e){i.auth_token=e.oauth_token;try{localStorage.setItem("soundcloudAuthToken",i.auth_token)}catch(t){}return t.SCGet("/me").then(function(e){i.userId=e.id;try{localStorage.setItem("soundcloudUserId",i.userId)}catch(t){}return t.checkAuth()}).catch(function(e){return console.log("Editor getUser error:",e),t.deauth()})}}(this)).catch(function(t){return function(e){return console.log("SC Connect Error: "+e.message),t.deauth()}}(this))},e.prototype.checkAuth=function(){return this.trigger("auth",null!==i.userId)},e.prototype.deauth=function(){i.auth_token=null;try{localStorage.removeItem("soundcloudAuthToken")}catch(t){}i.userId=null;try{localStorage.removeItem("soundcloudUserId")}catch(t){}return this.checkAuth()},e.prototype.refresh=function(t){return this.currentFolder=t,this.currentFolder.root?this.fetchPlaylists():this.fetchTracks(this.currentFolder.id)},e.prototype.fetchPlaylists=function(){return this.SCGet("/users/"+i.userId+"/playlists").then(function(t){return function(e){return t.trigger("refresh",e.map(t.newEntry.bind(t,"folder")),{root:!0}),t.fetchTracks(t.currentFolder.id)}}(this)).catch(function(t){return function(t){return console.log("Fetch Playlist error: "+t.message)}}())},e.prototype.fetchTracks=function(t){var e;return e=t?"/playlists/"+t:"/users/"+i.userId+"/tracks",e+="?access=playable",this.SCGet(e).then(function(e){return function(r){var n;return n=r,r.tracks&&(n=r.tracks),e.trigger("refresh",n.map(function(t){return e.newEntry("audio",t)}),{root:!t})}}(this)).catch(function(t){return function(t){return console.log("Fetch Tracks error: "+t.message)}}())},e.prototype.newEntry=function(t,e,r){var i,o,s,a,u,l,c;return r?u=r+"/":(u=this.currentFolder.path,this.currentFolder.root||(u+="/")),u+=e.id,"folder"===t&&(o=e.tracks),i=e.artwork_url,a=e.id,s=e.duration,c=e.title,l=e.stream_url,new n($.extend({},{service:this,type:t,path:u,artwork_url:i,id:a,children:o,duration:s/1e3,title:c,stream_url:l,name:e.title}))},e.prototype.getURL=function(t,e){return e(i.tracks_url+"?id="+t.id+"&atoken="+i.auth_token)},e}(o),t.exports=s},function(t,e,r){!function(e,r){t.exports=r()}(0,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){(function(e){"use strict";var n=r(4),i=r(8),o=r(3),s=r(9),a=r(2).Promise,u=r(16),l=r(17);t.exports=e.SC={initialize:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];o.set("oauth_token",t.oauth_token),o.set("client_id",t.client_id),o.set("redirect_uri",t.redirect_uri),o.set("baseURL",t.baseURL),o.set("connectURL",t.connectURL)},get:function(t,e){return n.request("GET",t,e)},post:function(t,e){return n.request("POST",t,e)},put:function(t,e){return n.request("PUT",t,e)},delete:function(t){return n.request("DELETE",t)},upload:function(t){return n.upload(t)},connect:function(t){return s(t)},isConnected:function(){return void 0!==o.get("oauth_token")},oEmbed:function(t,e){return n.oEmbed(t,e)},resolve:function(t){return n.resolve(t)},Recorder:u,Promise:a,stream:function(t,e){return l(t,e)},connectCallback:function(){i.notifyDialog(this.location)}}}).call(e,function(){return this}())},function(t,e){t.exports=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){t.exports={SCAudio:r(1),SCAudioControllerHTML5Player:r(3),SCAudioControllerHLSMSEPlayer:r(5),SCAudioPublicApiStreamURLRetriever:r(12),MaestroCore:r(2),MaestroLoaders:r(11)}},function(t,e,r){!function(e,n){t.exports=function(t){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=99)}([function(e,r){e.exports=t},function(t,e,r){"use strict";var n=r(5);t.exports=function(t){if(!n(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,r){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,r){"use strict";t.exports=r(55)()?Symbol:r(54)},function(t,e,r){"use strict";var n,i=r(11),o=r(18),s=r(59),a=r(17);n=t.exports=function(t,e){var r,n,s,u,l;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],null==t?(r=s=!0,n=!1):(r=a.call(t,"c"),n=a.call(t,"e"),s=a.call(t,"w")),l={value:e,configurable:r,enumerable:n,writable:s},u?i(o(u),l):l},n.gs=function(t,e,r){var n,u,l,c;return"string"!=typeof t?(l=r,r=e,e=t,t=null):l=arguments[3],null==e?e=void 0:s(e)?null==r?r=void 0:s(r)||(l=r,r=void 0):(l=e,e=r=void 0),null==t?(n=!0,u=!1):(n=a.call(t,"c"),u=a.call(t,"e")),c={get:e,set:r,configurable:n,enumerable:u},l?i(o(l),c):c}},function(t,e,r){"use strict";var n=r(22)();t.exports=function(t){return t!==n&&null!==t}},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=function(t){function e(e){return t.call(this,e||"There was no format available that a player was able to play.")||this}return n(e,t),e.prototype.getCode=function(){return"SCAUDIO.NOT_SUPPORTED_ERROR"},e}(i.errors.PlayerFatalError);e.NotSupportedError=o},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call("");t.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===i)||!1}},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call(function(){return arguments}());t.exports=function(t){return n.call(t)===i}},function(t,e,r){"use strict";t.exports=r(20)()?Object.setPrototypeOf:r(19)},function(t,e,r){"use strict";var n,i=r(23),o=r(11),s=r(2),a=r(1),u=r(4),l=r(47),c=r(3),p=Object.defineProperty,d=Object.defineProperties;t.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");d(this,{__list__:u("w",a(t)),__context__:u("w",e),__nextIndex__:u("w",0)}),e&&(s(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,d(n.prototype,o({_next:u(function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__<this.__list__.length?this.__nextIndex__++:void this._unBind()}),next:u(function(){return this._createResult(this._next())}),_createResult:u(function(t){return void 0===t?{done:!0,value:void 0}:{done:!1,value:this._resolve(t)}}),_resolve:u(function(t){return this.__list__[t]}),_unBind:u(function(){this.__list__=null,delete this.__redo__,this.__context__&&(this.__context__.off("_add",this._onAdd),this.__context__.off("_delete",this._onDelete),this.__context__.off("_clear",this._onClear),this.__context__=null)}),toString:u(function(){return"[object "+(this[c.toStringTag]||"Object")+"]"})},l({_onAdd:u(function(t){if(!(t>=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void p(this,"__redo__",u("c",[t]));this.__redo__.forEach(function(e,r){e>=t&&(this.__redo__[r]=++e)},this),this.__redo__.push(t)}}),_onDelete:u(function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(e=this.__redo__.indexOf(t),-1!==e&&this.__redo__.splice(e,1),this.__redo__.forEach(function(e,r){e>t&&(this.__redo__[r]=--e)},this)))}),_onClear:u(function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0})}))),p(n.prototype,c.iterator,u(function(){return this}))},function(t,e,r){"use strict";t.exports=r(64)()?Object.assign:r(63)},function(t,e,r){"use strict";function n(){switch(window.document.hidden){case!0:return"background";case!1:return"foreground";default:return}}Object.defineProperty(e,"__esModule",{value:!0}),e.getAppState=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(97),i=r(96),o=r(95),s=r(94),a=r(93),u=r(92),l=r(91),c=r(90),p=r(89),d=r(88);e.renditions={httpMp3:n.httpMp3,httpAACHQ:d.httpAACHQ,hlsMp3:i.hlsMp3,encryptedHlsMp3:o.encryptedHlsMp3,hlsOpus:c.hlsOpus,encryptedHlsOpus:p.encryptedHlsOpus,hlsAACHQ:s.hlsAACHQ,encryptedHlsAACHQ:a.encryptedHlsAACHQ,apiMobile:u.apiMobile,maestroChromecast:l.maestroChromecast},e.allRenditions=Object.keys(e.renditions).map(function(t){return e.renditions[t]})},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(6),o=function(t){function e(){return t.call(this,"Failed to retrieve stream url.")||this}return n(e,t),e.prototype.getCode=function(){return"SCAUDIO.FAILED_RETRIEVING_URL"},e}(i.NotSupportedError);e.FailedRetrievingUrlError=o},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(6),o=function(t){function e(){return t.call(this,"There were no stream URLs.")||this}return n(e,t),e.prototype.getCode=function(){return"SCAUDIO.NO_STREAMS"},e}(i.NotSupportedError);e.NoStreamsError=o},function(t,e,r){"use strict";var n=r(51);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},function(t,e,r){"use strict";t.exports=r(58)()?String.prototype.contains:r(57)},function(t,e,r){"use strict";var n=r(5),i=Array.prototype.forEach,o=Object.create,s=function(t,e){var r;for(r in t)e[r]=t[r]};t.exports=function(t){var e=o(null);return i.call(arguments,function(t){n(t)&&s(Object(t),e)}),e}},function(t,e,r){"use strict";var n,i=r(66),o=r(1),s=Object.prototype.isPrototypeOf,a=Object.defineProperty,u={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(t,e){if(o(t),null===e||i(e))return t;throw new TypeError("Prototype must be null or an object")},t.exports=function(t){var e,r;return t?(2===t.level?t.set?(r=t.set,e=function(t,e){return r.call(n(t,e),e),t}):e=function(t,e){return n(t,e).__proto__=e,t}:e=function t(e,r){var i;return n(e,r),i=s.call(t.nullPolyfill,e),i&&delete t.nullPolyfill.__proto__,null===r&&(r=t.nullPolyfill),e.__proto__=r,i&&a(t.nullPolyfill,"__proto__",u),e},Object.defineProperty(e,"level",{configurable:!1,enumerable:!1,writable:!1,value:t.level})):null}(function(){var t,e=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{t=n.set,t.call(e,r)}catch(t){}if(Object.getPrototypeOf(e)===r)return{set:t,level:2}}return e.__proto__=r,Object.getPrototypeOf(e)===r?{level:2}:(e={},e.__proto__=r,Object.getPrototypeOf(e)===r&&{level:1})}()),r(65)},function(t,e,r){"use strict";var n=Object.create,i=Object.getPrototypeOf,o={};t.exports=function(){var t=Object.setPrototypeOf,e=arguments[0]||n;return"function"==typeof t&&i(t(e(null),o))===o}},function(t,e,r){"use strict";var n=r(70),i=Math.max;t.exports=function(t){return i(0,n(t))}},function(t,e,r){"use strict";t.exports=function(){}},function(t,e,r){"use strict";var n=r(1);t.exports=function(){return n(this).length=0,this}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.notSupportedError=new Error("Not supported.");var n=function(){function t(){this.supportsVolumeAutomation=!0,this.syncConfig={}}return t}();e.BaseController=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t}();e.BaseStreamUrlRetriever=n},function(t,e,r){"use strict";function n(t){return new o({startPos:0,endPos:t,startLevel:0,endLevel:1,fromEnd:!1})}function i(t){return new o({startPos:t,endPos:0,startLevel:1,endLevel:0,fromEnd:!0})}Object.defineProperty(e,"__esModule",{value:!0}),e.buildFadeIn=n,e.buildFadeOut=i;var o=function(){function t(t){var e=t.startPos,r=t.endPos,n=t.startLevel,i=t.endLevel,o=t.fromEnd,s=void 0!==o&&o;if(e<0)throw new Error("startPos invalid.");if(r<0||!s&&r<e||s&&e<r)throw new Error("endPos invalid.");if(n<0||n>1)throw new Error("startLevel invalid.");if(i<0||i>1)throw new Error("endLevel invalid.");this._startPos=e,this._endPos=r,this._startLevel=n,this._endLevel=i,this._fromEnd=s}return t.prototype.calculate=function(t,e){var r=this._fromEnd?e-500-this._startPos:this._startPos,n=this._fromEnd?e-500-this._endPos:this._endPos;if(t<r)return{level:this._startLevel,nextCalculatePosition:r-t};if(t<=n){var i=(t-r)/(n-r),o=Math.cos(i*Math.PI)/-2+.5;return{level:this._startLevel+(this._endLevel-this._startLevel)*o,nextCalculatePosition:t}}return{level:this._endLevel,nextCalculatePosition:1/0}},t}();e.Fade=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(6),i=r(15),o=r(14);!function(t){t.NotSupportedError=n.NotSupportedError,t.NoStreamsError=i.NoStreamsError,t.FailedRetrievingUrlError=o.FailedRetrievingUrlError}(e.errors||(e.errors={}))},function(t,e,r){"use strict";function n(t){switch(t){case i.SQ:return i.SQ;case i.HQ:return i.HQ}return null}Object.defineProperty(e,"__esModule",{value:!0});var i;!function(t){t.SQ="sq",t.HQ="hq"}(i=e.Quality||(e.Quality={})),e.resolveQuality=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=function(){function t(t){var e=this;this._player=t,this._onConnectionRequired=new n.eventDispatcher.EventDispatcher,this._onConnectionRecovered=new n.eventDispatcher.EventDispatcher,this._connectionRequired=!1,this._connectionLossTimer=null,this.onConnectionRequired=this._onConnectionRequired.getHandle(),this.onConnectionRecovered=this._onConnectionRecovered.getHandle();var r=function(){return e._calculateIfConnectionRequired()};window.addEventListener("online",r),window.addEventListener("offline",r),this._calculateIfConnectionRequired(),t.onChange.subscribe(function(n){var i=n.loading;n.dead&&null!==e._connectionLossTimer&&(window.clearTimeout(e._connectionLossTimer),window.removeEventListener("online",r),window.removeEventListener("offline",r)),t.isDead()||void 0===i||e._calculateIfConnectionRequired()})}return t.prototype.isConnectionRequired=function(){return this._connectionRequired},t.prototype._calculateIfConnectionRequired=function(){var t=this;this._player.isLoading()&&"navigator"in window&&!window.navigator.onLine?null===this._connectionLossTimer&&(this._connectionLossTimer=window.setTimeout(function(){t._connectionLossTimer=null,t._connectionRequired=!0,t._onConnectionRequired.dispatch(void 0)},1500)):this._connectionRequired?(this._connectionRequired=!1,this._onConnectionRecovered.dispatch(void 0)):null!==this._connectionLossTimer&&(window.clearTimeout(this._connectionLossTimer),this._connectionLossTimer=null)},t}();e.ConnectionRequiredHelper=i},function(t,e,r){"use strict";function n(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="",r=0;r<20;r++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}Object.defineProperty(e,"__esModule",{value:!0}),e.generateLogId=n},function(t,e,r){"use strict";function n(t,e){return void 0!==t?t:e}function i(t){if(!(t.streamUrlRetriever instanceof o.BaseStreamUrlRetriever))throw new Error("StreamUrlRetriever invalid.");if(void 0!==t.duration&&("number"!=typeof t.duration||t.duration<0))throw new Error("duration invalid.");if(void 0!==t.getURLOpts&&"object"!=typeof t.getURLOpts)throw new Error("getURLOpts invalid.");if(void 0!==t.preloadingEnabled&&"boolean"!=typeof t.preloadingEnabled)throw new Error("preloadingEnabled invalid.");if(void 0!==t.fadeOnPauseAndPlay&&"boolean"!=typeof t.fadeOnPauseAndPlay)throw new Error("fadeOnPauseAndPlay invalid.");if(void 0!==t.fadeOnSeek&&"boolean"!=typeof t.fadeOnSeek)throw new Error("fadeOnSeek invalid.");if(void 0!==t.mediaSessionEnabled&&"boolean"!=typeof t.mediaSessionEnabled)throw new Error("mediaSessionEnabled invalid.");if(void 0!==t.pausedMaxBufferLength&&("number"!=typeof t.pausedMaxBufferLength||t.pausedMaxBufferLength<0))throw new Error("pausedMaxBufferLength invalid.");if(void 0!==t.playingMaxBufferLength&&("number"!=typeof t.playingMaxBufferLength||t.playingMaxBufferLength<0))throw new Error("playingMaxBufferLength invalid.");if(void 0!==t.logger&&"function"!=typeof t.logger&&"object"!=typeof t.logger)throw new Error("logger invalid.");if(void 0!==t.audioReporter&&"function"!=typeof t.audioReporter)throw new Error("audioReporter invalid.");if(void 0!==t.audioCheckpointInterval&&("number"!=typeof t.audioCheckpointInterval||t.audioCheckpointInterval<0))throw new Error("audioCheckpointInterval invalid.");if(void 0!==t.audioPerformanceReporter&&"function"!=typeof t.audioPerformanceReporter)throw new Error("audioPerformanceReporter invalid.");if(void 0!==t.errorReporter&&"function"!=typeof t.errorReporter)throw new Error("errorReporter invalid.");if(void 0!==t.urlProviderRetryDelayCalculator&&"function"!=typeof t.urlProviderRetryDelayCalculator)throw new Error("urlProviderRetryDelayCalculator invalid.");return{controllers:t.controllers,streamUrlRetriever:t.streamUrlRetriever,getURLOpts:n(t.getURLOpts,{}),preloadingEnabled:n(t.preloadingEnabled,!1),pausedMaxBufferLength:n(t.pausedMaxBufferLength,2e3),playingMaxBufferLength:n(t.playingMaxBufferLength,9e4),fadeOnPauseAndPlay:n(t.fadeOnPauseAndPlay,!1),fadeOnSeek:n(t.fadeOnSeek,!1),audioCheckpointInterval:n(t.audioCheckpointInterval,3e4),urlProviderRetryDelayCalculator:n(t.urlProviderRetryDelayCalculator,s.helpers.retry.buildExponentialDelayCalculator()),streamUrlsExpire:n(t.streamUrlsExpire,!0),fetchEnabled:n(t.fetchEnabled,!0),duration:t.duration,audioReporter:t.audioReporter,audioPerformanceReporter:t.audioPerformanceReporter,errorReporter:t.errorReporter}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(25),s=r(0);e.validatePlayerDependencies=i},function(t,e,r){"use strict";function n(t){var r=t.streamUrlRetriever,n=t.getURLOpts,s=t.logger,a=t.urlProviderRetryDelayCalculator;return new i.helpers.abortableJob.AbortableJob(function(){var t=i.helpers.deferred.buildDeferred(),u=i.helpers.retry.retry(a,function(e){var a=e.scheduleRetry,u=r.getUrl(n);return s.debug("Retrieving a URL..."),u.onCompletion(function(e){e?e.rendition&&o.allRenditions.indexOf(e.rendition)<0?(s.warn("Unknown rendition. Skipping...",e.rendition),r.excludeRendition(e.rendition),a()):!e.success&&e.error.isTransient()?(s.warn("Transient error retrieving url.",e.error),a()):t.resolve(e):(s.debug("No URL provided."),t.resolve(null))}),u.onError(function(e){e!==i.helpers.abortableJob.abortedError&&s.error("Error retrieving URL.",e),t.reject(e)}),{onCancel:function(){return u.abort()}}},{onNoMoreRetries:function(){return t.reject(e.NoMoreAttemptsError)}}).cancel;return{result:t.promise,abort:function(){return u()}}}).run()}Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=r(13);e.NoMoreAttemptsError=new Error("No more attempts to retrieve URL."),e.retrieveUrl=n},function(t,e,r){"use strict";function n(t,e){var r=t.getMemoryCacheController();r&&r.setMaxCacheSize(e)}Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=function(){function t(t,e){this._maxCacheSize=t,this._players=[],this._updateTimer=null,this._logger=i.logger.prefixLogger(e,"CacheManager"),this._logger.debug("Initialized with cache size "+t+" bytes.")}return t.prototype.setCacheSize=function(t){this._maxCacheSize!==t&&(this._logger.debug("Updating cache size to "+t+" bytes."),this._maxCacheSize=t,this._update())},t.prototype.addPlayer=function(t){var e=this;if(this._logger.debug("Adding player to cache manager."),t.isDead())return void this._logger.debug("Player was dead.");var r=this._players;t.onChange.subscribe(function(n){var i=n.playing;!0===n.dead?(e._logger.debug("Removing player that became dead."),r.splice(r.indexOf(t),1),e._update()):!0===i?(e._logger.debug("Updating because player started playing."),r.splice(r.indexOf(t),1),r.unshift(t),e._update()):!1===i&&(e._logger.debug("Updating because player became paused."),e._update())}),t.isPlaying()?r.unshift(t):r.push(t),this._update()},t.prototype._update=function(){var t=this;if(this._updateTimer&&(window.clearTimeout(this._updateTimer),this._updateTimer=null),0===this._players.length)return void this._logger.debug("There are no longer any players to manage.");var e=this._players.reduce(function(t,e){return e.isPlaying()?t.playingPlayers.push(e):t.pausedPlayers.push(e),t},{playingPlayers:[],pausedPlayers:[]}),r=e.playingPlayers,i=e.pausedPlayers,o=r.reduce(function(t,e){return t+(e.getMemoryCacheUsage()||0)},0),s=i.reduce(function(t,e){return t+(e.getMemoryCacheUsage()||0)},0);if(o>this._maxCacheSize){this._logger.debug("All playing players are using more than the max cache size. Cleaning...",o,this._maxCacheSize);var a=this._maxCacheSize/r.length;r.forEach(function(t){return n(t,a)}),i.forEach(function(t){return n(t,0)})}else this._logger.debug("Recalculating cache sizes...",o+s,this._maxCacheSize),r.concat(i).reduce(function(e,r){return n(r,Math.max(0,t._maxCacheSize-e)),e+(r.getMemoryCacheUsage()||0)},0);this._updateTimer=window.setTimeout(function(){return t._update()},2e4)},t}();e.CacheManager=o},function(t,e,r){"use strict";t.exports=function(){return"undefined"!=typeof Map&&"[object Map]"===Object.prototype.toString.call(new Map)}()},function(t,e,r){"use strict";var n=Array.prototype.forEach,i=Object.create;t.exports=function(t){var e=i(null);return n.call(arguments,function(t){e[t]=!0}),e}},function(t,e,r){"use strict";t.exports=r(35)("key","value","key+value")},function(t,e,r){"use strict";var n,i=r(9),o=r(4),s=r(10),a=r(3).toStringTag,u=r(36),l=Object.defineProperties,c=s.prototype._unBind;n=t.exports=function(t,e){return this instanceof n?(s.call(this,t.__mapKeysData__,t),e&&u[e]||(e="key+value"),void l(this,{__kind__:o("",e),__values__:o("w",t.__mapValuesData__)})):new n(t,e)},i&&i(n,s),n.prototype=Object.create(s.prototype,{constructor:o(n),_resolve:o(function(t){return"value"===this.__kind__?this.__values__[t]:"key"===this.__kind__?this.__list__[t]:[this.__list__[t],this.__values__[t]]}),_unBind:o(function(){this.__values__=null,c.call(this)}),toString:o(function(){return"[object Map Iterator]"})}),Object.defineProperty(n.prototype,a,o("c","Map Iterator"))},function(t,e,r){"use strict";var n,i=r(9),o=r(4),s=r(3),a=r(10),u=Object.defineProperty;n=t.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),a.call(this,t),u(this,"__length__",o("",t.length))},i&&i(n,a),delete n.prototype.constructor,n.prototype=Object.create(a.prototype,{_next:o(function(){if(this.__list__)return this.__nextIndex__<this.__length__?this.__nextIndex__++:void this._unBind()}),_resolve:o(function(t){var e,r=this.__list__[t];return this.__nextIndex__===this.__length__?r:(e=r.charCodeAt(0),e>=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,s.toStringTag,o("c","String Iterator"))},function(t,e,r){"use strict";var n=r(2),i=r(1),o=Function.prototype.bind,s=Function.prototype.call,a=Object.keys,u=Object.prototype.propertyIsEnumerable;t.exports=function(t,e){return function(r,l){var c,p=arguments[2],d=arguments[3];return r=Object(i(r)),n(l),c=a(r),d&&c.sort("function"==typeof d?o.call(d,r):void 0),"function"!=typeof t&&(t=c[t]),s.call(t,c,function(t,n){return u.call(r,t)?s.call(l,p,r[t],t,r,n):e})}}},function(t,e,r){"use strict";t.exports=r(39)("forEach")},function(t,e,r){"use strict";var n=r(2),i=r(40),o=Function.prototype.call;t.exports=function(t,e){var r={},s=arguments[2];return n(e),i(t,function(t,n,i,a){r[n]=o.call(e,s,t,n,i,a)}),r}},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call(r(22));t.exports=function(t){return"function"==typeof t&&n.call(t)===i}},function(t,e,r){"use strict";var n=r(3).iterator,i=r(8),o=r(42),s=r(21),a=r(2),u=r(1),l=r(5),c=r(7),p=Array.isArray,d=Function.prototype.call,h={configurable:!0,enumerable:!0,writable:!0,value:null},f=Object.defineProperty;t.exports=function(t){var e,r,g,_,y,v,m,b,w,E,P=arguments[1],S=arguments[2];if(t=Object(u(t)),l(P)&&a(P),this&&this!==Array&&o(this))e=this;else{if(!P){if(i(t))return y=t.length,1!==y?Array.apply(null,t):(_=new Array(1),_[0]=t[0],_);if(p(t)){for(_=new Array(y=t.length),r=0;r<y;++r)_[r]=t[r];return _}}_=[]}if(!p(t))if(void 0!==(w=t[n])){for(m=a(w).call(t),e&&(_=new e),b=m.next(),r=0;!b.done;)E=P?d.call(P,S,b.value,r):b.value,e?(h.value=E,f(_,r,h)):_[r]=E,b=m.next(),++r;y=r}else if(c(t)){for(y=t.length,e&&(_=new e),r=0,g=0;r<y;++r)E=t[r],r+1<y&&(v=E.charCodeAt(0))>=55296&&v<=56319&&(E+=t[++r]),E=P?d.call(P,S,E,g):E,e?(h.value=E,f(_,g,h)):_[g]=E,++g;y=g}if(void 0===y)for(y=s(t.length),e&&(_=new e(y)),r=0;r<y;++r)E=P?d.call(P,S,t[r],r):t[r],e?(h.value=E,f(_,r,h)):_[r]=E;return e&&(h.value=null,_.length=y),_}},function(t,e,r){"use strict";t.exports=function(){var t,e,r=Array.from;return"function"==typeof r&&(t=["raz","dwa"],e=r(t),Boolean(e&&e!==t&&"dwa"===e[1]))}},function(t,e,r){"use strict";t.exports=r(44)()?Array.from:r(43)},function(t,e,r){"use strict";var n=r(45),i=r(11),o=r(1);t.exports=function(t){var e=Object(o(t)),r=arguments[1],s=Object(arguments[2]);if(e!==t&&!r)return e;var a={};return r?n(r,function(e){(s.ensure||e in t)&&(a[e]=t[e])}):i(a,t),a}},function(t,e,r){"use strict";var n,i=r(46),o=r(18),s=r(2),a=r(41),u=r(2),l=r(1),c=Function.prototype.bind,p=Object.defineProperty,d=Object.prototype.hasOwnProperty;n=function(t,e,r){var n,o=l(e)&&u(e.value);return n=i(e),delete n.writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&d.call(this,t)?o:(e.value=c.call(o,r.resolveContext?r.resolveContext(this):this),p(this,t,e),this[t])},n},t.exports=function(t){var e=o(arguments[1]);return null!=e.resolveContext&&s(e.resolveContext),a(t,function(t,r){return n(r,t,e)})}},function(t,e,r){"use strict";var n,i=r(9),o=r(17),s=r(4),a=r(3),u=r(10),l=Object.defineProperty;n=t.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,t),e=e?o.call(e,"key+value")?"key+value":o.call(e,"key")?"key":"value":"value",l(this,"__kind__",s("",e))},i&&i(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:s(function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t})}),l(n.prototype,a.toStringTag,s("c","Array Iterator"))},function(t,e,r){"use strict";var n=r(8),i=r(7),o=r(48),s=r(38),a=r(16),u=r(3).iterator;t.exports=function(t){return"function"==typeof a(t)[u]?t[u]():n(t)?new o(t):i(t)?new s(t):new o(t)}},function(t,e,r){"use strict";var n=r(8),i=r(2),o=r(7),s=r(49),a=Array.isArray,u=Function.prototype.call,l=Array.prototype.some;t.exports=function(t,e){var r,c,p,d,h,f,g,_,y=arguments[2];if(a(t)||n(t)?r="array":o(t)?r="string":t=s(t),i(e),p=function(){d=!0},"array"===r)return void l.call(t,function(t){return u.call(e,y,t,p),d});if("string"!==r)for(c=t.next();!c.done;){if(u.call(e,y,c.value,p),d)return;c=t.next()}else for(f=t.length,h=0;h<f&&(g=t[h],h+1<f&&(_=g.charCodeAt(0))>=55296&&_<=56319&&(g+=t[++h]),u.call(e,y,g,p),!d);++h);}},function(t,e,r){"use strict";var n=r(8),i=r(5),o=r(7),s=r(3).iterator,a=Array.isArray;t.exports=function(t){return!(!i(t)||!a(t)&&!o(t)&&!n(t)&&"function"!=typeof t[s])}},function(t,e,r){"use strict";t.exports=function(t){return!!t&&("symbol"==typeof t||!!t.constructor&&"Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag])}},function(t,e,r){"use strict";var n=r(52);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not a symbol");return t}},function(t,e,r){"use strict";var n,i,o,s,a=r(4),u=r(53),l=Object.create,c=Object.defineProperties,p=Object.defineProperty,d=Object.prototype,h=l(null);if("function"==typeof Symbol){n=Symbol;try{String(n()),s=!0}catch(t){}}var f=function(){var t=l(null);return function(e){for(var r,n,i=0;t[e+(i||"")];)++i;return e+=i||"",t[e]=!0,r="@@"+e,p(d,r,a.gs(null,function(t){n||(n=!0,p(this,r,a(t)),n=!1)})),r}}();o=function(t){if(this instanceof o)throw new TypeError("Symbol is not a constructor");return i(t)},t.exports=i=function t(e){var r;if(this instanceof t)throw new TypeError("Symbol is not a constructor");return s?n(e):(r=l(o.prototype),e=void 0===e?"":String(e),c(r,{__description__:a("",e),__name__:a("",f(e))}))},c(i,{for:a(function(t){return h[t]?h[t]:h[t]=i(String(t))}),keyFor:a(function(t){var e;u(t);for(e in h)if(h[e]===t)return e}),hasInstance:a("",n&&n.hasInstance||i("hasInstance")),isConcatSpreadable:a("",n&&n.isConcatSpreadable||i("isConcatSpreadable")),iterator:a("",n&&n.iterator||i("iterator")),match:a("",n&&n.match||i("match")),replace:a("",n&&n.replace||i("replace")),search:a("",n&&n.search||i("search")),species:a("",n&&n.species||i("species")),split:a("",n&&n.split||i("split")),toPrimitive:a("",n&&n.toPrimitive||i("toPrimitive")),toStringTag:a("",n&&n.toStringTag||i("toStringTag")),unscopables:a("",n&&n.unscopables||i("unscopables"))}),c(o.prototype,{constructor:a(i),toString:a("",function(){return this.__name__})}),c(i.prototype,{toString:a(function(){return"Symbol ("+u(this).__description__+")"}),valueOf:a(function(){return u(this)})}),p(i.prototype,i.toPrimitive,a("",function(){var t=u(this);return"symbol"==typeof t?t:t.toString()})),p(i.prototype,i.toStringTag,a("c","Symbol")),p(o.prototype,i.toStringTag,a("c",i.prototype[i.toStringTag])),p(o.prototype,i.toPrimitive,a("c",i.prototype[i.toPrimitive]))},function(t,e,r){"use strict";var n={object:!0,symbol:!0};t.exports=function(){var t;if("function"!=typeof Symbol)return!1;t=Symbol("test symbol");try{String(t)}catch(t){return!1}return!!n[typeof Symbol.iterator]&&!!n[typeof Symbol.toPrimitive]&&!!n[typeof Symbol.toStringTag]}},function(t,e,r){"use strict";var n,i,o,s,a,u,l,c=r(4),p=r(2),d=Function.prototype.apply,h=Function.prototype.call,f=Object.create,g=Object.defineProperty,_=Object.defineProperties,y=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};n=function(t,e){var r;return p(e),y.call(this,"__ee__")?r=this.__ee__:(r=v.value=f(null),g(this,"__ee__",v),v.value=null),r[t]?"object"==typeof r[t]?r[t].push(e):r[t]=[r[t],e]:r[t]=e,this},i=function(t,e){var r,i;return p(e),i=this,n.call(this,t,r=function(){o.call(i,t,r),d.call(e,this,arguments)}),r.__eeOnceListener__=e,this},o=function(t,e){var r,n,i,o;if(p(e),!y.call(this,"__ee__"))return this;if(r=this.__ee__,!r[t])return this;if("object"==typeof(n=r[t]))for(o=0;i=n[o];++o)i!==e&&i.__eeOnceListener__!==e||(2===n.length?r[t]=n[o?0:1]:n.splice(o,1));else n!==e&&n.__eeOnceListener__!==e||delete r[t];return this},s=function(t){var e,r,n,i,o;if(y.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(r=arguments.length,o=new Array(r-1),e=1;e<r;++e)o[e-1]=arguments[e];for(i=i.slice(),e=0;n=i[e];++e)d.call(n,this,o)}else switch(arguments.length){case 1:h.call(i,this);break;case 2:h.call(i,this,arguments[1]);break;case 3:h.call(i,this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),e=1;e<r;++e)o[e-1]=arguments[e];d.call(i,this,o)}},a={on:n,once:i,off:o,emit:s},u={on:c(n),once:c(i),off:c(o),emit:c(s)},l=_({},u),t.exports=e=function(t){return null==t?f(l):_(Object(t),u)},e.methods=a},function(t,e,r){"use strict";var n=String.prototype.indexOf;t.exports=function(t){return n.call(this,t,arguments[1])>-1}},function(t,e,r){"use strict";var n="razdwatrzy";t.exports=function(){return"function"==typeof n.contains&&!0===n.contains("dwa")&&!1===n.contains("foo")}},function(t,e,r){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,r){"use strict";var n=r(5),i=Object.keys;t.exports=function(t){return i(n(t)?Object(t):t)}},function(t,e,r){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,r){"use strict";t.exports=r(61)()?Object.keys:r(60)},function(t,e,r){"use strict";var n=r(62),i=r(1),o=Math.max;t.exports=function(t,e){var r,s,a,u=o(arguments.length,2);for(t=Object(i(t)),a=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},s=1;s<u;++s)e=arguments[s],n(e).forEach(a);if(void 0!==r)throw r;return t}},function(t,e,r){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(t={foo:"raz"},e(t,{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,r){"use strict";var n,i=Object.create;r(20)()||(n=r(19)),t.exports=function(){var t,e,r;return n?1!==n.level?i:(t={},e={},r={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(t){return"__proto__"===t?void(e[t]={configurable:!0,enumerable:!1,writable:!0,value:void 0}):void(e[t]=r)}),Object.defineProperties(t,e),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:t}),function(e,r){return i(null===e?t:e,r)}):i}()},function(t,e,r){"use strict";var n=r(5),i={function:!0,object:!0};t.exports=function(t){return n(t)&&i[typeof t]||!1}},function(t,e,r){"use strict";t.exports=function(t){return t=Number(t),isNaN(t)||0===t?t:t>0?1:-1}},function(t,e,r){"use strict";t.exports=function(){var t=Math.sign;return"function"==typeof t&&1===t(10)&&-1===t(-20)}},function(t,e,r){"use strict";t.exports=r(68)()?Math.sign:r(67)},function(t,e,r){"use strict";var n=r(69),i=Math.abs,o=Math.floor;t.exports=function(t){return isNaN(t)?0:(t=Number(t),0!==t&&isFinite(t)?n(t)*o(i(t)):t)}},function(t,e,r){"use strict";t.exports=function(t){return t!==t}},function(t,e,r){"use strict";t.exports=function(){var t=Number.isNaN;return"function"==typeof t&&!t({})&&t(NaN)&&!t(34)}},function(t,e,r){"use strict";t.exports=r(72)()?Number.isNaN:r(71)},function(t,e,r){"use strict";var n=r(73),i=r(21),o=r(1),s=Array.prototype.indexOf,a=Object.prototype.hasOwnProperty,u=Math.abs,l=Math.floor;t.exports=function(t){var e,r,c,p;if(!n(t))return s.apply(this,arguments);for(r=i(o(this).length),c=arguments[1],c=isNaN(c)?0:c>=0?l(c):i(this.length)-l(u(c)),e=c;e<r;++e)if(a.call(this,e)&&(p=this[e],n(p)))return e;return-1}},function(t,e,r){"use strict";var n,i=r(23),o=r(74),s=r(9),a=r(2),u=r(1),l=r(4),c=r(56),p=r(3),d=r(16),h=r(50),f=r(37),g=r(34),_=Function.prototype.call,y=Object.defineProperties,v=Object.getPrototypeOf;t.exports=n=function(){var t,e,r,i=arguments[0];if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");return r=g&&s&&Map!==n?s(new Map,v(this)):this,null!=i&&d(i),y(r,{__mapKeysData__:l("c",t=[]),__mapValuesData__:l("c",e=[])}),i?(h(i,function(r){var n=u(r)[0];r=r[1],-1===o.call(t,n)&&(t.push(n),e.push(r))},r),r):r},g&&(s&&s(n,Map),n.prototype=Object.create(Map.prototype,{constructor:l(n)})),c(y(n.prototype,{clear:l(function(){this.__mapKeysData__.length&&(i.call(this.__mapKeysData__),i.call(this.__mapValuesData__),this.emit("_clear"))}),delete:l(function(t){var e=o.call(this.__mapKeysData__,t);return-1!==e&&(this.__mapKeysData__.splice(e,1),this.__mapValuesData__.splice(e,1),this.emit("_delete",e,t),!0)}),entries:l(function(){return new f(this,"key+value")}),forEach:l(function(t){var e,r,n=arguments[1];for(a(t),e=this.entries(),r=e._next();void 0!==r;)_.call(t,n,this.__mapValuesData__[r],this.__mapKeysData__[r],this),r=e._next()}),get:l(function(t){var e=o.call(this.__mapKeysData__,t);if(-1!==e)return this.__mapValuesData__[e]}),has:l(function(t){return-1!==o.call(this.__mapKeysData__,t)}),keys:l(function(){return new f(this,"key")}),set:l(function(t,e){var r,n=o.call(this.__mapKeysData__,t);return-1===n&&(n=this.__mapKeysData__.push(t)-1,r=!0),this.__mapValuesData__[n]=e,r&&this.emit("_add",n,t),this}),size:l.gs(function(){return this.__mapKeysData__.length}),values:l(function(){return new f(this,"value")}),toString:l(function(){return"[object Map]"})})),Object.defineProperty(n.prototype,p.iterator,l(function(){return this.entries()})),Object.defineProperty(n.prototype,p.toStringTag,l("c","Map"))},function(t,e,r){"use strict";t.exports=function(){var t,e,r;if("function"!=typeof Map)return!1;try{t=new Map([["raz","one"],["dwa","two"],["trzy","three"]])}catch(t){return!1}return"[object Map]"===String(t)&&3===t.size&&"function"==typeof t.clear&&"function"==typeof t.delete&&"function"==typeof t.entries&&"function"==typeof t.forEach&&"function"==typeof t.get&&"function"==typeof t.has&&"function"==typeof t.keys&&"function"==typeof t.set&&"function"==typeof t.values&&(e=t.entries(),r=e.next(),!1===r.done&&!!r.value&&"raz"===r.value[0]&&"one"===r.value[1])}},function(t,e,r){"use strict";t.exports=r(76)()?Map:r(75)},function(t,e,r){"use strict";function n(t){var e=t.split("//",2);return 1===e.length?e[0].split("/",1)[0]:e[1]?e[1].split("/",1)[0]:""}function i(t){var e=l.exec(t);return e&&e[0]||""}function o(t,e,r){return{name:e.name,preset:t.preset,bitrate:t.bitrate,protocol:t.rendition.scProtocol,host:n(r),url:i(r),format:t.rendition.scFormat,quality:t.quality}}Object.defineProperty(e,"__esModule",{value:!0});var s=r(77),a=r(0),u=r(24),l=/^[^?#]*/,c=function(){function t(t){var e=t.logger,r=t.controllers,n=t.playerId,i=t.streamUrlsExpire,o=t.fetchEnabled,u=t.fadeOnPauseAndPlay,l=t.fadeOnSeek,c=t.cacheManager,p=t.providePlayer,d=t.removePlayer,h=t.streamUrlRetriever,f=t.getURLOpts,g=t.errorEventGenerator,_=t.audioPerformanceEventGenerator;this._quality=null,this._onQualityChanged=new a.eventDispatcher.EventDispatcher,this._controllerIndexByRendition=new s,this._controlledPlayerWithRendition=null,this.onQualityChanged=this._onQualityChanged.getHandle(),this._logger=a.logger.prefixLogger(e,"ControllerManager"),this._controllers=r,this._playerId=n,this._streamUrlsExpire=i,this._fetchEnabled=o,this._fadeOnPauseAndPlay=u,this._fadeOnSeek=l,this._cacheManager=c,this._providePlayer=p,this._removePlayer=d,this._streamUrlRetriever=h,this._getURLOpts=f,this._errorEventGenerator=g||null,this._audioPerformanceEventGenerator=_||null}return t.prototype.buildNextController=function(t,e){var r=this;if(this._controlledPlayerWithRendition)throw new Error("A player is already being controlled.");this._logger.debug("Building next controller.");var n=this._controllerIndexByRendition.get(t.rendition)||0;if(n>=this._controllers.length)this._logger.debug("No more controllers for this rendition."),e({excludeRendition:!0,immediateRetry:!0});else{var i=!1,o=function(o){if(i)throw new Error("performNextAction() already called");i=!0,"MOVE_ON"!==o&&"MOVE_ON_SAME_RENDITION"!==o||(r._logger.debug("Controller will not be used again."),r._controllerIndexByRendition.set(t.rendition,n+1)),"MOVE_ON_SAME_RENDITION"===o?r.buildNextController(t,e):e({excludeRendition:!1,immediateRetry:"MOVE_ON"===o})};this._manageController(t,this._controllers[n],o)}},t.prototype.releaseCurrentController=function(t){var e=t.retry;if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");this._controlledPlayerWithRendition.releaseControl({retry:e})},t.prototype.getQuality=function(){return this._quality},t.prototype.getPlayerDetails=function(){if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");var t=this._controlledPlayerWithRendition;return o(t.initialUrlAndRendition,t.controller,t.controlledPlayer.getUrl())},t.prototype._manageController=function(t,e,r){var n=this,i=function(){n._removePlayer(),n._controlledPlayerWithRendition=null,s&&s.kill()};if(this._logger.debug("Preparing controller.",e.name),!e.isRenditionSupported(t.rendition,{streamUrlExpires:this._streamUrlsExpire}))return this._logger.debug("Skipping controller because rendition not supported."),void r("MOVE_ON_SAME_RENDITION");var s,l=!1,c=function(t){var e=t.retry;l||(l=!0,n._logger.debug("Releasing control."),i(),r(e?"RETRY":"MOVE_ON"))};try{this._logger.debug("Building player.");var p=e.buildPlayer({logger:a.logger.prefixLogger(this._logger,e.name+"-Controller"),playerId:this._playerId,urlAndRendition:t,streamUrlExpires:this._streamUrlsExpire,fetchEnabled:this._fetchEnabled,releaseControl:c,fadeOnPauseAndPlay:this._fadeOnPauseAndPlay,fadeOnSeek:this._fadeOnSeek,getNewUrl:function(){return n._getNewUrlWithSameRendition(t.rendition)},reportError:function(r){n._errorEventGenerator&&n._errorEventGenerator.reportManualEvent(r,o(t,e,p?p.getUrl():t.url))},reportPerformance:function(t){!l&&n._audioPerformanceEventGenerator&&n._audioPerformanceEventGenerator.reportManualEvent(t)}});if(s=p.getPlayer(),l)this._logger.warn("Player released during constrution."),s.kill();else if(s.isDead()){var d=s.getFatalError();d instanceof a.errors.NotSupportedError?this._logger.debug("Player not supported (during construction)."):this._logger.error("Error during construction.",d),r("MOVE_ON_SAME_RENDITION")}else{this._logger.debug("Player built."),s.onChange.subscribe(function(t){var e=t.dead,r=t.fatalError;e&&(r&&n._logger.error("Fatal player error occurred.",r),c({retry:!1}))}),this._cacheManager.addPlayer(s),this._controlledPlayerWithRendition={controller:e,controlledPlayer:p,initialUrlAndRendition:t,releaseControl:c},this._providePlayer(p.getPlayer(),e.syncConfig,e.supportsVolumeAutomation),this._logger.debug("Player provided to proxy.");var h=t.quality||null;this._quality!==h&&(this._logger.debug("Quality changed.",h),this._quality=h,this._onQualityChanged.dispatch(h))}}catch(t){t===u.notSupportedError?this._logger.debug("Player not supported. Not constructed."):this._logger.error("Error during construction.",t),i(),r("MOVE_ON_SAME_RENDITION")}},t.prototype._getNewUrlWithSameRendition=function(t){var e=this;return new a.helpers.abortableJob.AbortableJob(function(){var r=e._streamUrlRetriever.getUrl(e._getURLOpts);return{result:r.whenComplete().then(function(e){var r=null;return e&&e.success&&e.rendition===t&&(r=e.url),r}),abort:function(){return r.abort()}}}).run()},t}();e.ControllerManager=c},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(12),o=1e3,s=function(){function t(t,e,r,i,s){this._checkpointTimer=null,this._logger=n.logger.prefixLogger(i,"AudioEventGenerator"),this._player=t,this._eventReporter=e,this._checkpointInterval=Math.max(o,r),this._getPlayerDetails=s,this._startReporting()}return t.prototype._startReporting=function(){var t=this,e=this._player;e.onChange.subscribe(function(r){var n=r.actuallyPlaying,i=r.ended;!0===n&&!e.isEnded()||!1===i&&e.isActuallyPlaying()?(t._checkpointTimer||(t._checkpointTimer=window.setInterval(function(){t._reportEvent("checkpoint")},t._checkpointInterval)),t._reportEvent("play")):(!1===n&&!e.isEnded()||!0===i&&e.isActuallyPlaying())&&(t._checkpointTimer&&(window.clearInterval(t._checkpointTimer),t._checkpointTimer=null),t._reportEvent("pause"))})},t.prototype._reportEvent=function(t){var e=this._getPlayerDetails();if(!e)return void this._logger.warn("Cannot report event because there is no player.",t);var r=this._player.getDuration();if(null===r)throw new Error("Duration should exist now.");var n={type:t,position:this._player.getPosition(),duration:r,preset:e.preset,quality:e.quality,playerType:e.name,appState:i.getAppState()};this._logger.debug("Generated audio event.",n),this._eventReporter(n)},t}();e.AudioEventGenerator=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){this._delayFactor=0,this._lastRequestTime=0}return t.prototype.getDelay=function(t){var e=void 0===t?{}:t,r=e.maxDelay,n=void 0===r?3e4:r,i=e.numInstantRuns,o=void 0===i?5:i,s=Date.now()-this._lastRequestTime;this._lastRequestTime=Date.now(),this._delayFactor=Math.max(0,this._delayFactor-s/n),this._delayFactor++;var a=this._delayFactor-o;return a>0?Math.pow(2,a):0},t}();e.DecayingExponentialDelayCalculator=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(12),o=function(){function t(t,e,r,i,o,s){this._logger=n.logger.prefixLogger(s,"ErrorGenerator"),this._player=t,this._logCollector=e,this._logId=r,this._trackId=i,this._eventReporter=o,this._listenForProxyFatalError()}return t.prototype.reportManualEvent=function(t,e){"NOT_SUPPORTED_ERROR"!==t&&"HLS_MSE_PLAYER.NO_TRANSMUXER_ERROR"!==t&&(this._logger.debug("Reporting manual error event.",t),this._reportEvent(t,e))},t.prototype._listenForProxyFatalError=function(){var t=this;this._player.onError.subscribe(function(e){e instanceof n.errors.PlayerFatalError&&t._reportEvent(e.getCode())})},t.prototype._reportEvent=function(t,e){var r={errorCode:t,log:this._logCollector.getLog(),logId:this._logId,trackId:this._trackId,protocol:e&&e.protocol,playerType:e&&e.name?e.name:"MaestroUnknown",host:e&&e.host,bitrate:e&&e.bitrate,format:e&&e.format,preset:e&&e.preset,quality:e&&e.quality,url:e&&e.url,appState:i.getAppState()};this._logger.debug("Generated audio error event.",r),this._eventReporter(r)},t}();e.ErrorEventGenerator=o},function(t,e,r){"use strict";function n(t,e){var r=t.getBufferedTimeRanges();return r?o(r,function(t){return t.containsTime(e)})||new i.TimeRange(e,0):null}Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=i.helpers.find,s=function(){function t(t){var e=t.proxy,r=t.getPlayer;this._getPlayer=r;var i=this._position=e.getPosition(),o=this._initialActualPlayer=r();if(o){var s=n(o,i);this._initialBuffered=s?s.end-i:null}else this._initialBuffered=null}return t.prototype.getPreloaded=function(){var t=this._initialBuffered;return null!==t&&this._initialActualPlayer&&this._getPlayer()===this._initialActualPlayer?0===t?"no":t>=2e3?"yes":"partial":null},t}();e.PreloadingCalculator=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=n.helpers.time.now,o=function(){function t(){this._start=null,this._end=null}return t.prototype.start=function(){if(this.isComplete())throw new Error("Timer completed.");this._start=i()},t.prototype.isComplete=function(){return null!==this._end},t.prototype.stop=function(){if(null===this._start)throw new Error("Not started.");this._end=i()},t.prototype.getTime=function(){if(null===this._end)throw new Error("Not completed.");return this._end-this._start},t}();e.Timer=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(83),o=r(82),s=r(12),a=function(){function t(t,e,r,i,o){this._logger=n.logger.prefixLogger(i,"AudioPerformanceEventGenerator"),this._proxy=t,this._getPlayer=e,this._eventReporter=r,this._getPlayerDetails=o,this._measureGeneralEvents()}return t.prototype.reportManualEvent=function(t){this._logger.debug("Reporting manual audio performance event.",t),this._eventReporter(t)},t.prototype._measureGeneralEvents=function(){var t=this,e=this._proxy,r=null,n=null,s=null,a=null,u=null,l=null,c=null,p=!0;e.onChange.subscribe(function(d){var h=d.playing,f=d.actuallyPlaying,g=d.seek,_=d.seeking,y=d.stalled,v=d.ended;if(!0!==d.dead&&!1!==h||!a||(a.stop(),a.getTime()>=1e3&&t._reportEvent("rageSkip",a.getTime(),null),a=null),e.isDead())return void(c&&window.clearTimeout(c));var m=e.getSeekState();e.isActuallyPlaying()||a||!(!0===h||e.isPlaying()&&!0===y)||(a=new i.Timer,a.start()),!0===h&&(r||(r=new i.Timer,r.start(),n=new o.PreloadingCalculator({proxy:e,getPlayer:t._getPlayer}),c=window.setTimeout(function(){t._reportEvent("longInitialBuffering",0,null)},3e4),0===e.getPosition()&&(p=!1))),!1===h&&(c&&window.clearTimeout(c),r&&!r.isComplete()&&(r=null)),!0===f&&(a=null,r&&!r.isComplete()&&(r.stop(),c&&window.clearTimeout(c),t._reportEvent("play",r.getTime(),n.getPreloaded()))),g&&"IN_PROGRESS"===g.state&&e.isReady()&&(s=new i.Timer,s.start(),u=new o.PreloadingCalculator({proxy:e,getPlayer:t._getPlayer}),!0===_&&t._reportEvent("seekStart",0,null)),(g&&"COMPLETED"===g.state&&!e.isStalled()||!1===y&&m&&"COMPLETED"===m.state)&&s&&(s.stop(),t._reportEvent("seek",s.getTime(),u.getPreloaded()),s=null),!0!==y||!e.isPlaying()||m&&"IN_PROGRESS"===m.state||r&&r.isComplete()&&(l=new i.Timer,l.start(),t._reportEvent("rebufferingStart",e.getPosition(),null)),!1===y&&(r&&r.isComplete()&&(a=null),l&&(l.stop(),t._reportEvent("rebufferingEnd",l.getTime(),null),l=null)),!0!==v||p||(t._reportEvent("uninterruptedPlay",0,null),p=!0),!(m&&"IN_PROGRESS"===m.state)&&!0===y&&e.isActuallyPlaying()&&(p=!0)})},t.prototype._reportEvent=function(t,e,r){var n=this._getPlayerDetails();if(!n)return void this._logger.warn("Cannot report event because there is no player.",t,e);var i={type:t,latency:e,protocol:n.protocol,playerType:n.name,host:n.host,bitrate:n.bitrate,format:n.format,preset:n.preset,quality:n.quality,preloaded:r||void 0,appState:s.getAppState()};this._logger.debug("Generated audio performance event.",i),this._eventReporter(i)},t}();e.AudioPerformanceEventGenerator=a},function(t,e,r){"use strict";function n(t){return t.map(function(t){try{return JSON.stringify(t)}catch(t){return"<unavailable>"}})}var i=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t){void 0===t&&(t=200),this._bufferSize=t,this._log=[]}return t.prototype.getLog=function(){return this._log.map(function(t){return i({},t,{data:n(t.data)})})},t.prototype.debug=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this._push({level:"debug",msg:t,data:e,time:Date.now()})},t.prototype.info=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this._push({level:"info",msg:t,data:e,time:Date.now()})},t.prototype.warn=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this._push({level:"warn",msg:t,data:e,time:Date.now()})},t.prototype.error=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this._push({level:"error",msg:t,data:e,time:Date.now()})},t.prototype._push=function(t){this._log.push(t)>this._bufferSize&&this._log.shift()},t}();e.LogCollector=o},function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t){if("number"!=typeof t)throw new Error("level must be a number.");if(t<0||t>1)throw new Error("Invalid volume level.");I=t,M.forEach(function(e){return e.setVolume(t)})}function o(){return I}function s(t){if("boolean"!=typeof t)throw new Error("muteEnabled must be a boolean.");D=t,M.forEach(function(e){return e.setMuted(t)})}function a(){return D}function u(t){if("number"!=typeof t||t<0)throw new Error("Invalid size.");C.setCacheSize(t)}var l=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var c=r(0),p=r(26),d=r(85),h=r(84),f=r(81),g=r(80),_=r(79),y=r(78),v=r(33),m=r(32),b=r(6),w=r(15),E=r(31),P=r(30),S=r(29),x=r(14),k=r(13),A=c.eventDispatcher.EventDispatcher,O=c.helpers.Promise,T=c.helpers.deferred.buildDeferred,C=new v.CacheManager(15e7,c.logger.noOpLogger),R=-1,M=[],I=1,D=!1;e.setGlobalVolume=i,e.getGlobalVolume=o,e.setGlobalMuted=s,e.getGlobalMuted=a,e.setCacheSize=u;var L=function(t){function e(e){var r=t.call(this,e)||this;r._onPreloadingEnabled=new A,r._onPreloadingDisabled=new A,r._retryDelayCalculator=new g.DecayingExponentialDelayCalculator,r._errorEventGenerator=null,r._fadeOutVolumeAutomator=null,r._volumeAutomators=[],r._volumeScale=1,r._userVolume=1,r._volumeAutomationSupported=!1,r._timer=null,r._pauseFadeTimer=null,r._pauseFadeDeferred=null,r._pauseFade=null,r._executionState={state:"IDLE"},r._preloadingListeners=[],r._retrieveAndBuildTimer=null,r._hadAStreamUrl=!1;var n=r._config=E.validatePlayerDependencies(e);r._preloadingEnabled=n.preloadingEnabled,r._getURLOpts=n.getURLOpts,r._controllers=n.controllers;var i=r._connectionRequiredHelper=new S.ConnectionRequiredHelper(r);r.onPreloadingEnabled=r._onPreloadingEnabled.getHandle(),r.onPreloadingDisabled=r._onPreloadingDisabled.getHandle(),r.onConnectionRequired=i.onConnectionRequired,r.onConnectionRecovered=i.onConnectionRecovered,r.onChange.subscribe(function(t){r.isDead()||((!1===t.playing||t.positionJumped||t.stalled||t.ended)&&r._completePauseFade(),r._pauseFade&&(!1===t.actuallyPlaying||t.ended||!0===t.playing)&&(r._removeVolumeAutomator(r._pauseFade),r._pauseFade=null),(t.positionJumped||void 0!==t.actuallyPlaying||void 0!==t.stalled)&&r._updateVolume(),void 0!==t.playing&&r._updateMaxBufferLength())});var o="SCAudio-"+ ++R,s=n.streamUrlRetriever.getTrackId();null!==s&&(o+="-"+s);var a=new d.LogCollector,u=c.logger.cloneLogger(a,r._logger);r._logger=c.logger.prefixLogger(u,o);var l=P.generateLogId();r._logger.info("Building player...",{ua:navigator.userAgent,getURLOpts:r._getURLOpts,logId:l}),M.push(r),r.setVolume(I,D),r._updateFadeOut();var p=null,v=null;n.audioPerformanceReporter&&(p=new h.AudioPerformanceEventGenerator(r,function(){return r._getPlayer()},n.audioPerformanceReporter,r._logger,function(){return r._getActivePlayerDetails()})),n.audioReporter&&new _.AudioEventGenerator(r,n.audioReporter,n.audioCheckpointInterval,r._logger,function(){return r._getActivePlayerDetails()}),n.errorReporter&&(v=r._errorEventGenerator=new f.ErrorEventGenerator(r,a,l,s,n.errorReporter,r._logger)),r._excludeUnsupportedRenditions();var m=r._controllerManager=new y.ControllerManager({logger:r._logger,controllers:n.controllers,playerId:o,streamUrlsExpire:n.streamUrlsExpire,fetchEnabled:n.fetchEnabled,fadeOnPauseAndPlay:n.fadeOnPauseAndPlay,fadeOnSeek:n.fadeOnSeek,cacheManager:C,providePlayer:function(t,e,n){r._volumeAutomationSupported=n,r._providePlayer(t,e),r._updateMaxBufferLength()},removePlayer:function(){r._getPlayer()&&r._removePlayer()},streamUrlRetriever:r._config.streamUrlRetriever,getURLOpts:r._getURLOpts,errorEventGenerator:v||void 0,audioPerformanceEventGenerator:p||void 0});if(r.onQualityChanged=m.onQualityChanged,void 0!==n.duration&&(r._logger.debug("Setting initial duration.",n.duration),r._setInitialDuration(n.duration)),r._preloadingEnabled)r._logger.debug("Preloading is enabled, so performing retrieve immediately."),r._retrieveAndBuild();else{r._logger.debug("Preloading is disabled, so deferring retrieve until either a play intent or preloading is enabled.");var b=function(){r._removePreloadingListeners(),r._logger.debug("Preloading now enabled or received a play request. Peforming retrieve."),r._retrieveAndBuild()};r._preloadingListeners.push(r.onPreloadingEnabled.subscribe(b),r.onPlayIntent.subscribe(b))}return r}return l(e,t),e.prototype.reload=function(t){void 0===t&&(t={}),this._ensureNotDead(),this._reloadStreamUrls(t)},e.prototype.enablePreloading=function(){this.isDead()||this._preloadingEnabled||(this._preloadingEnabled=!0,this._updateMaxBufferLength(),this._onPreloadingEnabled.dispatch(void 0))},e.prototype.disablePreloading=function(){this.isDead()||this._preloadingEnabled&&(this._preloadingEnabled=!1,this._updateMaxBufferLength(),this._onPreloadingDisabled.dispatch(void 0))},e.prototype.isPreloadingEnabled=function(){return this._preloadingEnabled},e.prototype.pauseAfterFade=function(t){var e=this;if(this._ensureNotDead(),this._pauseFadeDeferred)return this._pauseFadeDeferred.promise;if(!this.isPlaying()||!this.isActuallyPlaying())return O.resolve(this.pause());var r=T();this._pauseFadeDeferred=r;var n=this.getPosition();if(this._pauseFade)throw new Error("Fade should not already be assigned.");return this._pauseFade=new p.Fade({startPos:n,endPos:n+t,startLevel:1,endLevel:0}),this._addVolumeAutomator(this._pauseFade),this._pauseFadeTimer=window.setTimeout(function(){e._pauseFadeDeferred=null,r.resolve(e.pause({fadeDuration:0}))},t+50),r.promise},e.prototype.isConnectionRequired=function(){return this._connectionRequiredHelper.isConnectionRequired()},e.prototype.getQuality=function(){return this._controllerManager.getQuality()},e.prototype.getVolume=function(){return this._volumeAutomationSupported?this._userVolume:t.prototype.getVolume.call(this)},e.prototype._handleFatalError=function(t){this._logger.warn("Fatal error from current player.",t)},e.prototype._handleVolumeChange=function(e,r){this._userVolume=e,t.prototype._notifyVolumeChange.call(this,e,r),this._calculateAndSetVolume()},e.prototype._notifyVolumeChange=function(){},e.prototype._kill=function(){t.prototype._kill.call(this),this._timer&&window.clearTimeout(this._timer),this._abortPauseFade(),this._removePreloadingListeners(),M.splice(M.indexOf(this),1),"RETRIEVING_URL"===this._executionState.state?this._executionState.retrieveJob.abort():"CONTROLLING_PLAYER"===this._executionState.state&&this._controllerManager.releaseCurrentController({retry:!1}),this._executionState={state:"DEAD"},this._retrieveAndBuildTimer&&window.clearTimeout(this._retrieveAndBuildTimer)},e.prototype._excludeUnsupportedRenditions=function(){var t=this,e={streamUrlExpires:this._config.streamUrlsExpire};k.allRenditions.filter(function(r){return!t._controllers.some(function(t){return t.isRenditionSupported(r,e)})}).forEach(function(e){t._config.streamUrlRetriever.excludeRendition(e)})},e.prototype._addVolumeAutomator=function(t){this._volumeAutomators.indexOf(t)<0&&(this._volumeAutomators.push(t),this._updateVolume())},e.prototype._removeVolumeAutomator=function(t){var e=this._volumeAutomators.indexOf(t);e>=0&&(this._volumeAutomators.splice(e,1),this._updateVolume())},e.prototype._removePreloadingListeners=function(){this._preloadingListeners.forEach(function(t){return t.remove()})},e.prototype._getActivePlayerDetails=function(){return"CONTROLLING_PLAYER"!==this._executionState.state?null:this._controllerManager.getPlayerDetails()},e.prototype._updateFadeOut=function(){this._fadeOutVolumeAutomator&&this._removeVolumeAutomator(this._fadeOutVolumeAutomator),this._getURLOpts.snippet&&(this._fadeOutVolumeAutomator=p.buildFadeOut(3e3),this._addVolumeAutomator(this._fadeOutVolumeAutomator))},e.prototype._handleUnexpectedError=function(t){try{t()}catch(t){this._logger.error("Unexpected error.",t),this._triggerError(new c.errors.PlayerFatalError("An unexpected error occurred.",t))}},e.prototype._retrieveAndBuild=function(){var t=this;this._handleUnexpectedError(function(){if(-1===["IDLE","WAITING_TO_RETRIEVE"].indexOf(t._executionState.state))throw new Error("Invalid state for retrieveAndBuild().");t._logger.debug("Retrieving URL...");var e=m.retrieveUrl({streamUrlRetriever:t._config.streamUrlRetriever,urlProviderRetryDelayCalculator:t._config.urlProviderRetryDelayCalculator,getURLOpts:t._getURLOpts,logger:t._logger});t._executionState={state:"RETRIEVING_URL",retrieveJob:e},e.onCompletion(function(e){if(t._logger.debug("Retrieved URL.",!!e),e&&e.success){t._hadAStreamUrl=!0;var r=!1,n=function(n){var i=n.excludeRendition,o=n.immediateRetry;t._handleUnexpectedError(function(){if(r)throw new Error("startOver called multiple times.");if(r=!0,i&&t._config.streamUrlRetriever.excludeRendition(e.rendition),t._executionState={state:"WAITING_TO_RETRIEVE"},t.isDead())return void t._logger.debug("Stopping execution because player is dead.");if(o)t._logger.debug("Moving on immediately."),t._retrieveAndBuild();else{var n=t._retryDelayCalculator.getDelay();t._logger.debug("Will move on in "+n+"ms."),n?t._retrieveAndBuildTimer=window.setTimeout(function(){return t._retrieveAndBuild()},n):t._retrieveAndBuild()}})};t._handleUnexpectedError(function(){t._executionState={state:"CONTROLLING_PLAYER"},t._logger.debug("Building controller..."),t._controllerManager.buildNextController(e,n),t._logger.debug("Built controller.")})}else if(e&&e.rendition){if(t._logger.warn("Error retrieving URL. Moving on.",e.error),t._errorEventGenerator){var i="SCAUDIO.URL_RETRIEVER_ERROR."+t._config.streamUrlRetriever.name+"."+e.error.getCode();t._errorEventGenerator.reportManualEvent(i,{preset:e.preset,quality:e.quality,bitrate:e.bitrate,format:e.rendition.scFormat,protocol:e.rendition.scProtocol})}t._config.streamUrlRetriever.excludeRendition(e.rendition),t._executionState={state:"WAITING_TO_RETRIEVE"},t._retrieveAndBuild()}else e&&e.rendition&&t._logger.warn("Error retrieving URL for any rendition.",e.error),t._logger.info("Ran out of streams.",t._hadAStreamUrl),t._triggerError(t._hadAStreamUrl?new b.NotSupportedError:new w.NoStreamsError)}),e.onError(function(e){e!==c.helpers.abortableJob.abortedError&&(e===m.NoMoreAttemptsError?t._logger.error("Ran out of retries to retrieve URL."):t._logger.error("Unexpected error when retrieving a URL.",e),t._triggerError(new x.FailedRetrievingUrlError))})})},e.prototype._reloadStreamUrls=function(t){this._getURLOpts=t,this._updateFadeOut(),this._logger.info("Reloading stream URL's...",this._getURLOpts),"RETRIEVING_URL"===this._executionState.state?(this._logger.debug("Aborting current URL retrieve."),this._executionState.retrieveJob.abort(),this._executionState={state:"WAITING_TO_RETRIEVE"},this._retrieveAndBuild()):"CONTROLLING_PLAYER"===this._executionState.state?(this._logger.debug("Releasing controller."),this._controllerManager.releaseCurrentController({retry:!0})):this._logger.debug("Nothing to do."),this._logger.info("Reloaded stream URL's.")},e.prototype._completePauseFade=function(){if(this._pauseFadeDeferred){this._pauseFadeTimer&&window.clearTimeout(this._pauseFadeTimer);var t=this._pauseFadeDeferred;this._pauseFadeDeferred=null,t.resolve(this.pause())}},e.prototype._abortPauseFade=function(){this._pauseFadeTimer&&(window.clearTimeout(this._pauseFadeTimer),this._pauseFadeTimer=null),this._pauseFadeDeferred&&(this._pauseFadeDeferred.reject(new Error("Player was killed.")),this._pauseFadeDeferred=null)},e.prototype._updateVolume=function(){var t=this;if(this._volumeAutomationSupported){this._ensureNotDead(),this._timer&&(window.clearTimeout(this._timer),this._timer=null);var e=this.getDuration();if(null!==e){var r=this._volumeAutomators,i=this.getPosition(),o=1/0,s=1;r.forEach(function(t){var r=t.calculate(i,e),a=r.nextCalculatePosition,u=r.level;s*=n(0,1,u),a<o&&(o=a)}),this._volumeScale!==s&&(this._volumeScale=s,this._calculateAndSetVolume()),o<1/0&&this.isActuallyPlaying()&&!this.isStalled()&&(this._timer=window.setTimeout(function(){t._timer=null,t._updateVolume()},n(100,5e3,o-this.getPosition())))}}},e.prototype._calculateAndSetVolume=function(){this._volumeAutomationSupported?t.prototype._handleVolumeChange.call(this,this._userVolume*this._volumeScale,this.getMuted()):t.prototype._handleVolumeChange.call(this,this._userVolume,this.getMuted())},e.prototype._updateMaxBufferLength=function(){var t=this._getPlayer(),e=t&&t.getBufferController();e&&(this.isPlaying()?e.setMaxBufferLength(this._config.playingMaxBufferLength):e.setMaxBufferLength(this._preloadingEnabled?this._config.pausedMaxBufferLength:0))},e}(c.ProxyPlayerBase);e.Player=L},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e,r){void 0===t&&(t="UNKNOWN"),void 0===e&&(e=!1),void 0===r&&(r=null),this._code=t,this._transient=e,this._cause=r}return t.prototype.isTransient=function(){return this._transient},t.prototype.getCode=function(){return this._code},t.prototype.getCause=function(){return this._cause},t}();e.UrlRetrieverError=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.httpAACHQ={scProtocol:"http",scFormat:"aac",maestroFormat:{mimeType:"audio/mp4",audioCodec:{id:"mp4a.40.2"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encryptedHlsOpus={scProtocol:"encrypted-hls",scFormat:"opus",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/ogg",audioCodec:{id:"opus"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hlsOpus={scProtocol:"hls",scFormat:"opus",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/ogg",audioCodec:{id:"opus"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.maestroChromecast={scProtocol:"maestro.chromecast",maestroFormat:{}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.apiMobile={scProtocol:"sc.api-mobile",maestroFormat:{}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encryptedHlsAACHQ={scProtocol:"encrypted-hls",scFormat:"aac",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mp4",audioCodec:{id:"mp4a.40.2"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hlsAACHQ={scProtocol:"hls",scFormat:"aac",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mp4",audioCodec:{id:"mp4a.40.2"}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encryptedHlsMp3={scProtocol:"encrypted-hls",scFormat:"mp3",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mpeg"}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hlsMp3={scProtocol:"hls",scFormat:"mp3",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mpeg"}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.httpMp3={scProtocol:"http",scFormat:"mp3",maestroFormat:{mimeType:"audio/mpeg"}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(26);!function(t){t.Fade=n.Fade,t.buildFadeIn=n.buildFadeIn,t.buildFadeOut=n.buildFadeOut}(e.volumeAutomation||(e.volumeAutomation={}))},function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),e.version="23.1.0",e.buildNumber=845;var i=r(98);e.volumeAutomation=i.volumeAutomation;var o=r(25);e.BaseStreamUrlRetriever=o.BaseStreamUrlRetriever,n(r(24));var s=r(13);e.renditions=s.renditions,e.allRenditions=s.allRenditions;var a=r(87);e.UrlRetrieverError=a.UrlRetrieverError;var u=r(86);e.Player=u.Player,e.setGlobalVolume=u.setGlobalVolume,e.setGlobalMuted=u.setGlobalMuted,e.getGlobalVolume=u.getGlobalVolume,e.getGlobalMuted=u.getGlobalMuted,e.setCacheSize=u.setCacheSize;var l=r(28);e.Quality=l.Quality,e.resolveQuality=l.resolveQuality,n(r(27))}])}(r(2))}(window)},function(t,e,r){!function(e,r){t.exports=function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=97)}([function(t,e,r){"use strict";var n=r(4);t.exports=function(t){if(!n(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,r){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,r){"use strict";t.exports=r(62)()?Symbol:r(61)},function(t,e,r){"use strict";function n(t){try{t()}catch(t){window.setTimeout(function(){throw t},0)}}Object.defineProperty(e,"__esModule",{value:!0}),e.deferException=n},function(t,e,r){"use strict";var n=r(24)();t.exports=function(t){return t!==n&&null!==t}},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(11),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.getCode=function(){return"PLAYER_FATAL_ERROR"},e}(i.PlayerError);e.PlayerFatalError=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(19),i=function(){function t(){this._listeners=[],this.dispatch=this.dispatch.bind(this)}return t.prototype.subscribe=function(t){var e=this,r={fn:t,payloads:[]};return this._listeners.push(r),{remove:function(){var t=e._listeners.indexOf(r);return t>=0&&(e._listeners.splice(t,1),!0)},retrieve:function(){return e._dispatchListenerPayloads(r)}}},t.prototype.dispatch=function(t,e){var r=this,i="number"==typeof e?{time:e}:e||{},o=void 0!==i.time?i.time:n.now(),s=this._listeners;s.forEach(function(e){return e.payloads.push({time:o,payload:t})});var a=!1;do{a=!s.some(function(t){var e=t.fn,n=t.payloads,i=n.shift();return!!i&&(r._callHandler(e,i),!0)})}while(!a)},t.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},t.prototype._dispatchListenerPayloads=function(t){for(var e=t.fn,r=t.payloads;;){var n=r.shift();if(!n)break;this._callHandler(e,n)}},t.prototype._callHandler=function(t,e){try{t(e.payload,e.time)}catch(t){window.setTimeout(function(){throw t},0)}},t}();e.EventDispatcher=i},function(t,e,r){"use strict";var n,i=r(14),o=r(23),s=r(66),a=r(22);n=t.exports=function(t,e){var r,n,s,u,l;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],null==t?(r=s=!0,n=!1):(r=a.call(t,"c"),n=a.call(t,"e"),s=a.call(t,"w")),l={value:e,configurable:r,enumerable:n,writable:s},u?i(o(u),l):l},n.gs=function(t,e,r){var n,u,l,c;return"string"!=typeof t?(l=r,r=e,e=t,t=null):l=arguments[3],null==e?e=void 0:s(e)?null==r?r=void 0:s(r)||(l=r,r=void 0):(l=e,e=r=void 0),null==t?(n=!0,u=!1):(n=a.call(t,"c"),u=a.call(t,"e")),c={get:e,set:r,configurable:n,enumerable:u},l?i(o(l),c):c}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(95);e.Promise=n.Promise},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call("");t.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===i)||!1}},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call(function(){return arguments}());t.exports=function(t){return n.call(t)===i}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._msg=t,this._cause=e}return t.prototype.getCode=function(){return"PLAYER_ERROR"},t.prototype.getMsg=function(){return this._msg},t.prototype.getCause=function(){return this._cause},t}();e.PlayerError=n},function(t,e,r){"use strict";function n(t,e){return{debug:function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return t.debug.apply(t,["["+e+"] "+r].concat(n))},error:function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return t.error.apply(t,["["+e+"] "+r].concat(n))},info:function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return t.info.apply(t,["["+e+"] "+r].concat(n))},warn:function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return t.warn.apply(t,["["+e+"] "+r].concat(n))}}}function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return{debug:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.forEach(function(t){return t.debug.apply(t,[e].concat(r))})},error:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.forEach(function(t){return t.error.apply(t,[e].concat(r))})},info:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.forEach(function(t){return t.info.apply(t,[e].concat(r))})},warn:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.forEach(function(t){return t.warn.apply(t,[e].concat(r))})}}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(36),s=o.isIE();e.noOpLogger={debug:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},error:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},info:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},warn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]}},e.consoleLogger={debug:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];s?console.log(t,e):(n=console.debug||console.log).call.apply(n,[console,t].concat(e));var n},error:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];s?console.log(t,e):(n=console.error||console.log).call.apply(n,[console,t].concat(e));var n},info:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];s?console.log(t,e):(n=console.info||console.log).call.apply(n,[console,t].concat(e));var n},warn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];s?console.log(t,e):(n=console.warn||console.log).call.apply(n,[console,t].concat(e));var n}},e.prefixLogger=n,e.cloneLogger=i},function(t,e,r){"use strict";function n(){var t,e,r=!1;return{promise:new i.Promise(function(r,n){t=r,e=n}),resolve:function(e){r||(r=!0,t(e))},reject:function(t){r||(r=!0,e(t))},isSettled:function(){return r}}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(8);e.buildDeferred=n},function(t,e,r){"use strict";t.exports=r(71)()?Object.assign:r(70)},function(t,e,r){"use strict";t.exports=r(27)()?Object.setPrototypeOf:r(26)},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(28),o=function(t){function e(e,r,n){return void 0===n&&(n="The player that the proxy was controlling had a fatal error."),t.call(this,e,r,n)||this}return n(e,t),e.prototype.getCode=function(){return"PROXY_PLAYER_PROVIDED_PLAYER_FATAL_ERROR"},e}(i.ProxyProvidedPlayerError);e.ProxyProvidedPlayerFatalError=o},function(t,e,r){"use strict";function n(t,e){var r=void 0;return t.some(function(t){return!!e(t)&&(r=t,!0)}),r}Object.defineProperty(e,"__esModule",{value:!0}),e.find=n},function(t,e,r){"use strict";function n(t,e){return t.then(e,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.always=n},function(t,e,r){"use strict";function n(){return"performance"in window&&window.performance.now?window.performance.now():Date.now()-i}Object.defineProperty(e,"__esModule",{value:!0});var i=Date.now();e.now=n},function(t,e,r){"use strict";var n,i=r(58),o=r(14),s=r(1),a=r(0),u=r(7),l=r(57),c=r(2),p=Object.defineProperty,d=Object.defineProperties;t.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");d(this,{__list__:u("w",a(t)),__context__:u("w",e),__nextIndex__:u("w",0)}),e&&(s(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,d(n.prototype,o({_next:u(function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__<this.__list__.length?this.__nextIndex__++:void this._unBind()}),next:u(function(){return this._createResult(this._next())}),_createResult:u(function(t){return void 0===t?{done:!0,value:void 0}:{done:!1,value:this._resolve(t)}}),_resolve:u(function(t){return this.__list__[t]}),_unBind:u(function(){this.__list__=null,delete this.__redo__,this.__context__&&(this.__context__.off("_add",this._onAdd),this.__context__.off("_delete",this._onDelete),this.__context__.off("_clear",this._onClear),this.__context__=null)}),toString:u(function(){return"[object "+(this[c.toStringTag]||"Object")+"]"})},l({_onAdd:u(function(t){if(!(t>=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void p(this,"__redo__",u("c",[t]));this.__redo__.forEach(function(e,r){e>=t&&(this.__redo__[r]=++e)},this),this.__redo__.push(t)}}),_onDelete:u(function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(e=this.__redo__.indexOf(t),-1!==e&&this.__redo__.splice(e,1),this.__redo__.forEach(function(e,r){e>t&&(this.__redo__[r]=--e)},this)))}),_onClear:u(function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0})}))),p(n.prototype,c.iterator,u(function(){return this}))},function(t,e,r){"use strict";var n=r(10),i=r(9),o=r(63),s=r(43),a=r(42),u=r(2).iterator;t.exports=function(t){return"function"==typeof a(t)[u]?t[u]():n(t)?new o(t):i(t)?new s(t):new o(t)}},function(t,e,r){"use strict";t.exports=r(65)()?String.prototype.contains:r(64)},function(t,e,r){"use strict";var n=r(4),i=Array.prototype.forEach,o=Object.create,s=function(t,e){var r;for(r in t)e[r]=t[r]};t.exports=function(t){var e=o(null);return i.call(arguments,function(t){n(t)&&s(Object(t),e)}),e}},function(t,e,r){"use strict";t.exports=function(){}},function(t,e,r){"use strict";var n=r(4),i={function:!0,object:!0};t.exports=function(t){return n(t)&&i[typeof t]||!1}},function(t,e,r){"use strict";var n,i=r(25),o=r(0),s=Object.prototype.isPrototypeOf,a=Object.defineProperty,u={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(t,e){if(o(t),null===e||i(e))return t;throw new TypeError("Prototype must be null or an object")},t.exports=function(t){var e,r;return t?(2===t.level?t.set?(r=t.set,e=function(t,e){return r.call(n(t,e),e),t}):e=function(t,e){return n(t,e).__proto__=e,t}:e=function t(e,r){var i;return n(e,r),i=s.call(t.nullPolyfill,e),i&&delete t.nullPolyfill.__proto__,null===r&&(r=t.nullPolyfill),e.__proto__=r,i&&a(t.nullPolyfill,"__proto__",u),e},Object.defineProperty(e,"level",{configurable:!1,enumerable:!1,writable:!1,value:t.level})):null}(function(){var t,e=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{t=n.set,t.call(e,r)}catch(t){}if(Object.getPrototypeOf(e)===r)return{set:t,level:2}}return e.__proto__=r,Object.getPrototypeOf(e)===r?{level:2}:(e={},e.__proto__=r,Object.getPrototypeOf(e)===r&&{level:1})}()),r(74)},function(t,e,r){"use strict";var n=Object.create,i=Object.getPrototypeOf,o={};t.exports=function(){var t=Object.setPrototypeOf,e=arguments[0]||n;return"function"==typeof t&&i(t(e(null),o))===o}},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(11),o=function(t){function e(e,r,n){void 0===n&&(n="The player that the proxy was controlling had an error.");var i=t.call(this,n)||this;return i._providedPlayerError=e,i._providedPlayer=r,i}return n(e,t),e.prototype.getCode=function(){return"PROXY_PLAYER_PROVIDED_PLAYER_ERROR"},e.prototype.getProvidedPlayerError=function(){return this._providedPlayerError},e.prototype.getProvidedPlayer=function(){return this._providedPlayer},e}(i.PlayerError);e.ProxyProvidedPlayerError=o},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),o=function(t){function e(e,r){return t.call(this,e,r)||this}return n(e,t),e.prototype.getCode=function(){return"IMPLEMENTATION_ERROR"},e}(i.PlayerFatalError);e.ImplementationError=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(3),i=function(){function t(t,e){this._inCallback=!1,this._onExit=t,this._onEnter=e||null}return t.prototype.enter=function(t){var e=this;if(this._inCallback)return t?t(this._onEnterResultRetriever):void 0;this._inCallback=!0;var r=[],i=!1;this._onEnter&&(this._onEnterResultRetriever={getResult:function(t){i?n.deferException(function(){return t(e._onEnterError,e._onEnterResult)}):r.push(t)}});try{var o=t?t(this._onEnterResultRetriever):void 0;if(this._onEnter){this._onEnterError=void 0,this._onEnterResult=void 0;try{this._onEnterResult=this._onEnter()}catch(t){this._onEnterError=t}i=!0,r.forEach(function(t){return n.deferException(function(){return t(e._onEnterError,e._onEnterResult)})})}return o}finally{this._inCallback=!1,n.deferException(function(){return e._onExit(e._onEnterError,e._onEnterResult)})}},t}();e.OnExit=i},function(t,e,r){"use strict";function n(t){var e=Object.create(null);return Object.keys(t).forEach(function(r){e[r]=t[r]}),e}Object.defineProperty(e,"__esModule",{value:!0});var i=r(30),o=r(3),s=function(){},a=function(){function t(t,e){void 0===e&&(e={});var r=this;this._subscribers=[],this._onExit=new i.OnExit(function(){return r._after()},function(){return r._onEnter()}),this._beforeUpdateError=void 0,this._inAfterUpdate=!1,this._dead=!1,this._officiallyDead=!1,this._errors=[],this._state=n(t),this._initialState=n(t),this._beforeUpdate=e.beforeUpdate||function(){},this._afterUpdate=e.afterUpdate||s,this._afterDispatches=e.afterDispatches||s}return t.prototype.subscribe=function(t,e){var r=this;if(void 0===e&&(e=!0),this._dead){var i=!1;return{retrieve:function(){},remove:function(){return!i&&(i=!0)}}}var o={callback:t,localState:e?n(this._state):this._initialState};return this._subscribers.push(o),e||this._updateSubscriber(o),{remove:function(){var e=r._subscribers.map(function(t){return t.callback}).indexOf(t);return e>=0&&(r._subscribers.splice(e,1),!0)},retrieve:function(){r._updateSubscriber(o)}}},t.prototype.subscribeIndividual=function(t,e,r){return this.subscribe(function(r){var n=r[t];void 0!==n&&e(n)},r)},t.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},t.prototype.getIndividualHandle=function(t){var e=this;return{subscribe:function(r){return e.subscribeIndividual(t,r)}}},t.prototype.update=function(t){var e=this;this._officiallyDead||(this._inAfterUpdate?t&&t(this._state,this._beforeUpdateError):this._onExit.enter(function(r){r.getResult(function(){try{t&&t(e._state,e._beforeUpdateError)}catch(t){e._errors.push(t)}})}))},t.prototype.getState=function(){return this._state},t.prototype.kill=function(){var t=this;this._dead||(this._dead=!0,window.setTimeout(function(){t._subscribers.splice(0),t._officiallyDead=!0},0))},t.prototype.isDead=function(){return this._dead},t.prototype._onEnter=function(){this._beforeUpdateError=void 0;try{this._beforeUpdate(this._state)}catch(t){this._beforeUpdateError=t}},t.prototype._after=function(){var t=this,e=this._errors;this._errors=[],o.deferException(function(){t._inAfterUpdate=!0;try{t._afterUpdate(t._state,{beforeUpdate:t._beforeUpdateError,update:e})}catch(e){throw t._inAfterUpdate=!1,e}t._inAfterUpdate=!1,t._subscribers.slice().forEach(function(e){return t._updateSubscriber(e)}),t._afterDispatches(t._state)})},t.prototype._updateSubscriber=function(t){var e=this._calculateDiff(t.localState);Object.keys(e).length&&(t.localState=n(this._state),o.deferException(function(){return t.callback(e,t.localState)}))},t.prototype._calculateDiff=function(t){var e=this,r=Object.create(null);return Object.keys(this._state).forEach(function(n){var i=e._state[n];i!==t[n]&&(r[n]=i)}),r},t}();e.StateManager=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t[t.LOADING=0]="LOADING",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.DEAD=3]="DEAD"}(e.State||(e.State={}))},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),o=function(t){function e(e){return t.call(this,e||"The player cannot play the provided descriptor.")||this}return n(e,t),e.prototype.getCode=function(){return"NOT_SUPPORTED_ERROR"},e}(i.PlayerFatalError);e.NotSupportedError=o},function(t,e,r){"use strict";function n(){return{ended:!1,loading:!1,playing:!1,actuallyPlaying:!1,volume:1,muted:!1,isFading:!1,fadeRate:null,isFadingForSeek:!1,playDeferred:null,pauseDeferred:null,ready:!1,seeking:!1,seek:null,positionJumped:null,stalled:!0,duration:null,dead:!1,state:p.State.PAUSED,fatalError:null,errorOccurred:null,position:0}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),o=r(33),s=r(6),a=r(13),u=r(17),l=r(19),c=r(8),p=r(32),d=r(12),h=r(31),f=r(29),g=r(3),_="undefined"!=typeof navigator&&"mediaSession"in navigator,y=150,v=25,m=35,b=1e3,w=_?navigator.mediaSession:null,E=function(){function t(t){var e=this;this._stateManager=new h.StateManager(n(),{afterUpdate:function(t,r){return e._afterUpdate(t,r)},afterDispatches:function(){return e._afterDispatches()},beforeUpdate:function(t){if(!t.dead&&(t.ready||!e._fatalErrorTriggered)){var r=e._getPosition(),n=t.duration;if(r<0)throw e._logger.error("Player provided invalid position.",r,n),e._triggerError(new f.ImplementationError("Player provided a position that was invalid.")),new Error("Player provided invalid position.");t.position=r,e._updateEndedInState(t)}}}),this._onError=new s.EventDispatcher,this._errors=[],this._fatalErrorTriggered=!1,this._loadingDelayTimer=null,this._stalled=!1,this._queuedDuration=null,this._readyDeferred=a.buildDeferred(),this._queuedSeekDeferreds=[],this._lastPlayError=null,this._lastPauseError=null,this._lastPlayedPosition=null,this._listenTimeBase=0,this._timePlaybackStarted=null,this._positionAfterLastUpdate=0,this._positionWhenStartedFadeOut=null,this._fadeStartAllowed=!1,this._seekFadeStartAllowed=!1,this._implementationIsFading=!1;var r=t.name;if(this._logger=d.prefixLogger(t.logger,"BasePlayer"+(r?"-"+r:"")),this._mediaSessionEnabled=!!t.mediaSessionEnabled,t.defaultFadeDuration&&t.defaultFadeDuration<0)throw new Error("defaultFadeDuration must be >= 0.");if(t.loadingDelay&&t.loadingDelay<0)throw new Error("loadingDelay must be >= 0.");this._defaultFadeDuration=void 0!==t.defaultFadeDuration?t.defaultFadeDuration:y,this._defaultSeekFadeOutDuration=void 0!==t.defaultSeekFadeOutDuration?t.defaultSeekFadeOutDuration:v,this._defaultSeekFadeInDuration=void 0!==t.defaultSeekFadeInDuration?t.defaultSeekFadeInDuration:m,this._loadingDelay=void 0!==t.loadingDelay?t.loadingDelay:b,this.onError=this._onError.getHandle(),this.whenReady=this._readyDeferred.promise,this._stateManager.subscribe(function(t,r){return e._onChange(t,r)}),this._stateManager.subscribe(function(t){var r=t.actuallyPlaying,n=t.seek;!0===r&&(e._fadeStartAllowed=!1),n&&"IN_PROGRESS"!==n.state&&(e._seekFadeStartAllowed=!1)}),this._stateManager.subscribe(function(t,r){var n=t.isFading;!r.dead&&!1===n&&e._implementationIsFading&&e._triggerError(new f.ImplementationError("Fade was still running when not allowed."))}),this._stateManager.subscribe(function(t,r){var n=t.playing,i=r.dead,o=r.fadeRate;if(!i&&void 0!==n)try{e._handlePlayPauseChange(n,{fadeRate:o||void 0}),n||(e._fadeStartAllowed=!1)}catch(t){e._triggerError(new f.ImplementationError("Exception occurred whilst handling play/pause change.",t))}}),this._stateManager.subscribe(function(t,r){var n=t.seek;if(!r.dead&&n&&"IN_PROGRESS"===n.state)try{e._seekFadeStartAllowed=!0,e._handleSeekChange(n.position,{fadeRate:{beforeSeek:n.fadeRate.beforeSeek||void 0,afterSeek:n.fadeRate.afterSeek||void 0}}),e._seekFadeStartAllowed=!1}catch(t){e._triggerError(new f.ImplementationError("Exception occurred whilst handling seek change.",t))}}),this.onChange=this._buildEventHandle(function(t,r){var n=r.ready;if(void 0!==n&&!0!==n)throw new Error("Ready state is invalid.");var i=r.duration;if(void 0!==i&&null===i)throw new Error("Duration state is invalid.");var o=r.dead;if(void 0!==o&&!0!==o)throw new Error("Dead state is invalid.");var s={ready:n,ended:r.ended,duration:i,volume:r.volume,muted:r.muted,playing:r.playing,actuallyPlaying:r.actuallyPlaying,stalled:r.stalled,loading:r.loading,fading:r.isFading,fadingForSeek:r.isFadingForSeek,playRejection:!1===r.playing?e._lastPlayError||void 0:void 0,pauseRejection:!0===r.playing?e._lastPauseError||void 0:void 0,seeking:r.seeking,seek:r.seek||void 0,positionJumped:void 0!==r.positionJumped||void 0,state:r.state,fatalError:r.fatalError||void 0,dead:o};Object.keys(s).some(function(t){return void 0!==s[t]})&&t(s)});var i=t.registerListeners;i&&g.deferException(function(){i({onChange:e.onChange,onError:e.onError})}),this._registerMediaSessionActionHandlers(),this._notifyMediaSessionPaused(),this.onDurationChange=this._buildEventHandle(function(t,e){var r=e.duration;void 0!==r&&null!==r&&t(r)}),this.onReady=this._buildEventHandle(function(t,e){!0===e.ready&&t(void 0)}),this.onStateChange=this._buildEventHandle(function(t,e){var r=e.state;void 0!==r&&t(r)}),this.onVolumeChange=this._buildEventHandle(function(t,e,r){var n=e.volume,i=e.muted,o=r.volume,s=r.muted;void 0===n&&void 0===i||t({volume:o,muted:s})}),this.onPlay=this._buildEventHandle(function(t,e){!0===e.actuallyPlaying&&t(void 0)}),this.onPlayIntent=this._buildEventHandle(function(t,e){!0===e.playing&&t(void 0)}),this.onPlayRejection=this._buildEventHandle(function(t,r){!1===r.playing&&e._lastPlayError&&t(e._lastPlayError)}),this.onPause=this._buildEventHandle(function(t,e){!1===e.actuallyPlaying&&t(void 0)}),this.onPauseIntent=this._buildEventHandle(function(t,e){!1===e.playing&&t(void 0)}),this.onPauseRejection=this._buildEventHandle(function(t,r){!0===r.playing&&e._lastPauseError&&t(e._lastPauseError)}),this.onSeek=this._buildEventHandle(function(t,e){var r=e.seek;r&&"COMPLETED"===r.state&&t(void 0)}),this.onSeekIntent=this._buildEventHandle(function(t,e){!0===e.seeking&&t(void 0)}),this.onSeekRejection=this._buildEventHandle(function(t,e){var r=e.seek;r&&"ERROR"===r.state&&t(r.error)}),this.onPositionJumped=this._buildEventHandle(function(t,e){void 0!==e.positionJumped&&t(void 0)}),this.onEnded=this._buildEventHandle(function(t,e){!0===e.ended&&t(void 0)}),this.onLeftEnded=this._buildEventHandle(function(t,e){!1===e.ended&&t(void 0)}),this.onStallStart=this._buildEventHandle(function(t,e){!0===e.stalled&&t(void 0)}),this.onStallEnd=this._buildEventHandle(function(t,e){!1===e.stalled&&t(void 0)}),this.onLoadStart=this._buildEventHandle(function(t,e){!0===e.loading&&t(void 0)}),this.onLoadEnd=this._buildEventHandle(function(t,e){!1===e.loading&&t(void 0)}),this.onFadeStart=this._buildEventHandle(function(t,e){!0===e.isFading&&t(void 0)}),this.onFadeEnd=this._buildEventHandle(function(t,e){!1===e.isFading&&t(void 0)}),this.onFadeForSeekStart=this._buildEventHandle(function(t,e){!0===e.isFadingForSeek&&t(void 0)}),this.onFadeForSeekEnd=this._buildEventHandle(function(t,e){!1===e.isFadingForSeek&&t(void 0)})}return t.prototype.isReady=function(){return this._stateManager.getState().ready},t.prototype.getPosition=function(){return this._getPositionOrPositionSeekingTo()},t.prototype.getLastPlayedPosition=function(){var t=this._stateManager.getState(),e=t.actuallyPlaying,r=t.stalled;return e&&!r?this.getPosition():this._lastPlayedPosition},t.prototype.getListenTime=function(){var t=this._stateManager.getState(),e=t.actuallyPlaying,r=t.ended,n=this._listenTimeBase;return e&&!r&&(n+=l.now()-this._timePlaybackStarted),n},t.prototype.isStalled=function(){return this._stateManager.getState().stalled},t.prototype.isLoading=function(){return this._stateManager.getState().loading},t.prototype.isFading=function(){return this._stateManager.getState().isFading},t.prototype.isFadingForSeek=function(){return this._stateManager.getState().isFadingForSeek},t.prototype.isPlaying=function(){return this._stateManager.getState().playing},t.prototype.isActuallyPlaying=function(){return this._stateManager.getState().actuallyPlaying},t.prototype.isEnded=function(){return this._stateManager.getState().ended},t.prototype.getState=function(){return this._stateManager.getState().state},t.prototype.getBufferController=function(){return null},t.prototype.getMemoryCacheMaxSize=function(){return null},t.prototype.getMemoryCacheUsage=function(){return null},t.prototype.getMemoryCacheController=function(){return null},t.prototype.getFatalError=function(){return this._stateManager.getState().fatalError},t.prototype.isDead=function(){return this._stateManager.getState().dead},t.prototype.getVolume=function(){return this._stateManager.getState().volume},t.prototype.getMuted=function(){return this._stateManager.getState().muted},t.prototype.getDuration=function(){var t=this._stateManager.getState(),e=t.ready,r=t.duration;return e?r:null},t.prototype.setVolume=function(t,e){if(t<0||t>1)throw new Error("Volume must be >= 0 and <= 1.");if(!this._stateManager.getState().dead){var r=this._stateManager.getState().muted;void 0===e&&(e=r);try{this._handleVolumeChange(t,e)}catch(t){throw this._triggerError(new f.ImplementationError("Exception occurred updating volume.",t)),t}}},t.prototype.setMuted=function(t){this.setVolume(this._stateManager.getState().volume,t)},t.prototype.getCurrentBufferedTimeRange=function(){var t=this.getBufferedTimeRanges();if(!t)return null;var e=this.getPosition();return u.find(t,function(t){return t.containsTime(e)})||null},t.prototype.play=function(t){var e=this;this._ensureNotDead(),this._logger.debug("play() called.",t);var r=a.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing)e._logger.debug("Intent is already to be playing.");else{e._logger.debug("Requesting play."),n.playing=!0;var i=e._extractFadeDuration(t);n.fadeRate=i?1/i:null,e._lastPlayError=null}n.playDeferred&&!n.playDeferred.isSettled()||(n.playDeferred=a.buildDeferred()),r.resolve(n.playDeferred.promise)}),r.promise}catch(t){return this._triggerError(new i.PlayerFatalError("Unexpected error when attempting to play.",t)),c.Promise.reject(t)}},t.prototype.pause=function(t){var e=this;this._ensureNotDead(),this._logger.debug("pause() called.",t);var r=a.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing){e._logger.debug("Requesting pause."),e._positionWhenStartedFadeOut=e._getPositionOrPositionSeekingTo(),n.playing=!1;var i=e._extractFadeDuration(t);n.fadeRate=i?1/i*-1:null,e._fadeStartAllowed=!0,e._lastPauseError=null}else e._logger.debug("Intent is already to be paused.");n.pauseDeferred&&!n.pauseDeferred.isSettled()||(n.pauseDeferred=a.buildDeferred()),r.resolve(n.pauseDeferred.promise)}),r.promise}catch(t){return this._triggerError(new i.PlayerFatalError("Unexpected error when attempting to pause.",t)),c.Promise.reject(t)}},t.prototype.seek=function(t,e){var r=this;this._ensureNotDead(),this._logger.debug("seek() called.",t);var n=a.buildDeferred();return this._stateManager.update(function(i){if(t<0)r._logger.warn("Rejecting seek immediately as the position was negative."),n.reject(new Error("You were attempting to seek to a negative time."));else if(null!==i.duration&&t>i.duration)r._logger.warn("Rejecting seek immediately as the duration is now known, and the requested positon was past it."),n.reject(new Error("You were attempting to seek past the end of the media."));else{i.stalled||!i.actuallyPlaying||i.seek&&"IN_PROGRESS"===i.seek.state||(r._lastPlayedPosition=r._getPositionOrPositionSeekingTo());var o=a.buildDeferred();if(i.seek&&"IN_PROGRESS"===i.seek.state&&i.seek.position===t)r._logger.debug("Seek already requested to the same position.",t);else{r._logger.debug("Requesting seek.",t),i.seeking=!0,r._positionWhenStartedFadeOut=null;var s=r._extractSeekFadeDurations(e,t),u=s.fadeOutDuration?1/s.fadeOutDuration*-1:null,l=s.fadeInDuration?1/s.fadeInDuration:null;i.seek={state:"IN_PROGRESS",position:t,fadeRate:{beforeSeek:u,afterSeek:l}},i.positionJumped=Object.create(null)}r._queuedSeekDeferreds.push({position:t,deferred:o}),n.resolve(o.promise)}}),n.promise},t.prototype.getSeekState=function(){return this._stateManager.getState().seek},t.prototype.kill=function(){var t=this;this._stateManager.update(function(e){e.dead||(t._logger.debug("kill() called."),e.dead=!0)})},t.prototype._update=function(t){this._stateManager.update(function(){return t&&t()})},t.prototype._ensureNotDead=function(){if(this._stateManager.getState().dead)throw new Error("Player is dead.")},t.prototype._notifyStalled=function(t){this._ensureNotDead(),this._stalled!==t&&(this._logger.debug("notifyStalled() called.",t),this._stalled=t,this._stateManager.update())},t.prototype._getQueuedSeekPosition=function(){var t=this.getSeekState();return t&&"IN_PROGRESS"===t.state?t.position:null},t.prototype._provideDuration=function(t){var e=this;this._ensureNotDead(),this._stateManager.update(function(r){if(r.duration!==t){var n=e._getPositionOrPositionSeekingTo();if(t<0||r.ready&&n>t)throw e._triggerError(new f.ImplementationError("Attempt to update duration to an invalid value.")),new Error("Duration cannot be less than the current position.");e._logger.debug("provideDuration() called.",t),r.ready?r.duration=t:e._queuedDuration=t}})},t.prototype._notifyVolumeChange=function(t,e){if(t<0||t>1)throw this._triggerError(new f.ImplementationError("Volume was out of range.",t)),new Error("Volume was out of range.");this._stateManager.update(function(r){r.volume=t,r.muted=e})},t.prototype._notifyPlaying=function(t){var e=this;this._ensureNotDead(),this._stateManager.update(function(r){if(!r.ready)throw e._triggerError(new f.ImplementationError("Attempt to register playback as started before ready.")),new Error("Player must be ready first.");t!==r.actuallyPlaying&&(e._logger.debug("notifyPlaying() called.",t),t||r.seeking||r.stalled||(e._lastPlayedPosition=e._getPositionOrPositionSeekingTo()),r.actuallyPlaying=r.playing=t,t?(e._lastPlayError=null,e._fadeStartAllowed=!0):(r.isFading=!1,e._fadeStartAllowed=!1,e._lastPauseError=null))})},t.prototype._notifyPlayRejection=function(t){var e=this;this._ensureNotDead(),t=t||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw e._triggerError(new f.ImplementationError("Attempt to reject a play request before player ready.")),new Error("Player must be ready first.");if(r.actuallyPlaying||!r.playing)throw e._triggerError(new f.ImplementationError("Attempt to reject a play request when not valid.")),new Error("Playing state is incorrect.");e._logger.debug("notifyPlayRejection() called.",t),r.playing=!1,e._lastPlayError=t})},t.prototype._notifyPauseRejection=function(t){var e=this;this._ensureNotDead(),t=t||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw e._triggerError(new f.ImplementationError("Attempt to reject pause request before player ready.")),new Error("Player must be ready first.");if(!r.actuallyPlaying||r.playing)throw e._triggerError(new f.ImplementationError("Attempt to reject pause request when not valid.")),new Error("Playing state is incorrect.");e._logger.debug("notifyPauseRejection() called.",t),r.playing=!0,r.fadeRate&&(r.fadeRate*=-1),e._lastPauseError=t})},t.prototype._notifySeekRejection=function(t){var e=this;this._ensureNotDead(),t=t||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw e._triggerError(new f.ImplementationError("Attempt to reject seek request before player ready.")),new Error("Player must be ready first.");if(!r.seek||"IN_PROGRESS"!==r.seek.state)throw e._triggerError(new f.ImplementationError("Attempt to reject seek request when none requested.")),new Error("A seek hasn't been requested.");if(null!==r.duration&&r.position>r.duration)throw e._triggerError(new f.ImplementationError("Attempt to reject seek request after duration changed below current position.")),new Error("Attempt to reject seek request after duration changed below current position.");e._logger.debug("notifySeekRejection() called.",t),r.seeking=!1,r.seek={state:"ERROR",error:t},r.positionJumped=Object.create(null)})},t.prototype._notifyFading=function(t){var e=this;if(this._ensureNotDead(),t&&!this._fadeStartAllowed){var r="Attempt to register fade as starting when not allowed.";throw this._triggerError(new f.ImplementationError(r)),new Error(r)}this._implementationIsFading=t,this._stateManager.update(function(r){r.isFading!==t&&(e._logger.debug("notifyFading() called",t),t||r.playing||null===e._positionWhenStartedFadeOut||e.seek(e._positionWhenStartedFadeOut,{fadeInDuration:0,fadeOutDuration:0}).catch(function(t){e._logger.warn("Seek back to position where fade out started failed.",t)}),r.isFading=t)})},t.prototype._notifyFadingForSeek=function(t){var e=this;if(this._ensureNotDead(),t&&!this._seekFadeStartAllowed){var r="Attempt to register fade as starting for seek when not allowed.";throw this._triggerError(new f.ImplementationError(r)),new Error(r)}this._stateManager.update(function(r){r.isFadingForSeek!==t&&(e._logger.debug("notifyFadingForSeek() called",t),r.isFadingForSeek=t)})},t.prototype._signalReady=function(){var t=this;this._ensureNotDead(),this._stateManager.update(function(e){if(e.ready)throw t._triggerError(new f.ImplementationError("Attempt to signal ready twice.")),new Error("Ready already signalled.");if(null===t._queuedDuration)throw t._triggerError(new f.ImplementationError("Attempt to signal ready when duration unknown.")),new Error("Duration is still unknown.");t._logger.debug("signalReady() called."),e.ready=!0,e.duration=t._queuedDuration,e.seek&&"IN_PROGRESS"===e.seek.state&&e.seek.position>e.duration&&(e.seeking=!1,e.seek={state:"ERROR",error:new Error("You were attempting to seek past the end of the media.")})})},t.prototype._signalSeekComplete=function(){var t=this;this._ensureNotDead(),this._stateManager.update(function(e){if(!e.ready)throw t._triggerError(new f.ImplementationError("Attempt to signal seek as complete before player ready.")),new Error("Player must be ready first.");if(!e.seek||"IN_PROGRESS"!==e.seek.state)throw t._triggerError(new f.ImplementationError("Attempt to signal seek as complete when none requested.")),new Error("There shouldn't be a seek in progress.");var r=e.duration;if(e.seek&&"IN_PROGRESS"===e.seek.state&&e.seek.position>r)throw new Error("Seek cannot have completed given it was to a time greater than the duration.");t._logger.debug("signalSeekComplete() called."),t._seekFadeStartAllowed=!0,e.seek={state:"COMPLETED",position:e.seek.position,fadeRate:e.seek.fadeRate},e.seeking=!1,e.position=e.seek.position})},t.prototype._triggerError=function(t){var e=this;t instanceof i.PlayerFatalError&&(this._fatalErrorTriggered=!0),this._stateManager.update(function(r){var n=!1;if(r.ready&&t instanceof o.NotSupportedError&&(t=new f.ImplementationError("Invalid NotSupportedError."),n=!0),t instanceof i.PlayerFatalError?(t instanceof o.NotSupportedError?e._logger.info("NotSupportedError occurred.",t):e._logger.error("Fatal error occurred.",t),r.fatalError?e._logger.warn("A fatal error already occurred.",r.fatalError):r.fatalError=t,e._errors.push(t),r.errorOccurred=Object.create(null),r.dead=!0):(e._logger.warn("Non-fatal error occurred.",t),e._errors.push(t),r.errorOccurred=Object.create(null)),n)throw new Error("Not supported errors are only valid before the player is ready.")})},t.prototype._buildEventHandle=function(t){var e=this;return{subscribe:function(r){var n=function(t){return r(t,l.now())};return e._stateManager.subscribe(function(e,r){t(n,e,r)})}}},t.prototype._finalizeState=function(t){this._updateEndedInState(t);var e=this._getPositionOrPositionSeekingTo();if(t.dead)this._lastPlayError=new Error("Player was killed."),t.loading=!1,this._clearLoadingDelay(),!t.playing&&t.isFading&&null!==this._positionWhenStartedFadeOut&&(this._logger.debug("Fade out was in progress. Pretending it completed."),t.isFading=!1,t.position=this._positionWhenStartedFadeOut),t.stalled=!0,t.actuallyPlaying=!1,t.isFadingForSeek=!1,t.playing=!1,t.state=p.State.DEAD;else{var r=!t.ended&&(!t.ready||this._stalled||!(!t.seek||"IN_PROGRESS"!==t.seek.state));r&&!t.stalled&&!t.seeking&&t.actuallyPlaying&&(this._lastPlayedPosition=e),t.stalled=r;!t.ended&&!t.isFading&&!t.isFadingForSeek&&(t.playing||t.actuallyPlaying)&&(t.stalled||t.playing!==t.actuallyPlaying)?this._loadingDelay?this._scheduleLoadingDelay():t.loading=!0:(t.loading=!1,this._clearLoadingDelay()),this._positionAfterLastUpdate!==e&&(this._positionAfterLastUpdate=e,t.playing||t.actuallyPlaying||(t.positionJumped=Object.create(null))),t.state=this._calculateState(t)}},t.prototype._updateEndedInState=function(t){t.ended=t.ready&&this._getPositionOrPositionSeekingTo()===t.duration},t.prototype._scheduleLoadingDelay=function(){var t=this;this._loadingDelayTimer||(this._loadingDelayTimer=window.setTimeout(function(){t._stateManager.update(function(t){return t.loading=!0})},this._loadingDelay))},t.prototype._clearLoadingDelay=function(){this._loadingDelayTimer&&(window.clearTimeout(this._loadingDelayTimer),this._loadingDelayTimer=null)},t.prototype._getPositionOrPositionSeekingTo=function(){this._stateManager.update();var t=this._stateManager.getState();return t.seek&&"IN_PROGRESS"===t.seek.state?t.seek.position:t.isFading&&!t.playing&&null!==this._positionWhenStartedFadeOut?this._positionWhenStartedFadeOut:t.ready&&null!==t.duration?t.position:0},t.prototype._calculateState=function(t){var e=t.dead,r=t.loading,n=t.playing,i=t.ended;return e?p.State.DEAD:r?p.State.LOADING:n&&!i?p.State.PLAYING:p.State.PAUSED},t.prototype._registerMediaSessionActionHandlers=function(){var t=this;this._mediaSessionEnabled&&w&&(w.setActionHandler("play",function(){t.isDead()||t.play()}),w.setActionHandler("pause",function(){t.isDead()||t.pause()}),w.setActionHandler("seekbackward",function(){t.isDead()||t.seek(Math.max(0,t.getPosition()-5e3))}),w.setActionHandler("seekforward",function(){t.isDead()||t.seek(Math.min(t.getDuration()||0,t.getPosition()+5e3))}))},t.prototype._notifyMediaSessionPlaying=function(){this._mediaSessionEnabled&&w&&(w.playbackState="playing")},t.prototype._notifyMediaSessionPaused=function(){this._mediaSessionEnabled&&w&&(w.playbackState="paused")},t.prototype._extractFadeDuration=function(t){return void 0===t&&(t={}),void 0===t.fadeDuration?!this._stateManager.getState().playing||this._getPositionOrPositionSeekingTo()>0?this._defaultFadeDuration:0:t.fadeDuration>0?t.fadeDuration:0},t.prototype._extractSeekFadeDurations=function(t,e){void 0===t&&(t={});var r;r=void 0!==t.fadeOutDuration?t.fadeOutDuration>0?t.fadeOutDuration:0:this._defaultSeekFadeOutDuration;var n;return n=void 0!==t.fadeInDuration?t.fadeInDuration>0?t.fadeInDuration:0:e>0?this._defaultSeekFadeInDuration:0,{fadeOutDuration:r,fadeInDuration:n}},t.prototype._afterUpdate=function(t,e){if(e.beforeUpdate||e.update.length>0)this._logger.error("Errors occurred during state update. Killing player.",e),this._triggerError(new i.PlayerFatalError("Errors occurred during state update.",e));else if(!t.dead&&t.ready){var r=t.duration;null!==r&&!t.seeking&&t.position>r&&(this._logger.error("Player provided invalid position.",t.position,r),this._triggerError(new f.ImplementationError("Player provided a position that was invalid.")))}this._finalizeState(t)},t.prototype._afterDispatches=function(){var t=this,e=this._errors;this._errors=[],e.forEach(function(e){return t._onError.dispatch(e)})},t.prototype._onChange=function(t,e){var r=this,n=t.ready,i=t.dead,o=t.fatalError,s=t.playing,a=t.actuallyPlaying,u=t.ended;if(!0===n&&(this._logger.debug("Resolving ready deferred."),this._readyDeferred.resolve(void 0)),!0===a&&this._registerMediaSessionActionHandlers(),!0===s?this._notifyMediaSessionPlaying():!1===s&&this._notifyMediaSessionPaused(),e.pauseDeferred&&!e.pauseDeferred.isSettled()&&e.playing){var c=this._lastPauseError||new Error("Pause request aborted.");this._logger.debug("Rejecting pause deferred.",c),e.pauseDeferred.reject(c)}if(e.playDeferred&&!e.playDeferred.isSettled()&&!e.playing){var c=this._lastPlayError||new Error("Play request aborted.");this._logger.debug("Rejecting play deferred.",c),e.playDeferred.reject(c)}if(e.playDeferred&&!e.playDeferred.isSettled()&&e.actuallyPlaying&&(this._logger.debug("Resolving play deferred."),e.playDeferred.resolve(void 0)),!e.pauseDeferred||e.pauseDeferred.isSettled()||e.actuallyPlaying||(this._logger.debug("Resolving pause deferred."),e.pauseDeferred.resolve(void 0)),!0===a&&!e.ended||!1===u&&e.actuallyPlaying?this._timePlaybackStarted=l.now():(!1===a&&!e.ended||!0===u&&e.actuallyPlaying)&&(this._listenTimeBase+=l.now()-this._timePlaybackStarted,this._timePlaybackStarted=null),this._queuedSeekDeferreds=this._queuedSeekDeferreds.filter(function(t){var n=t.position,i=t.deferred;if(e.seek)if("IN_PROGRESS"!==e.seek.state){if(!e.stalled||"ERROR"===e.seek.state)return"ERROR"!==e.seek.state?(r._logger.debug("Resolving seek()."),i.resolve(void 0)):(r._logger.debug("Rejecting seek().",e.seek.error),i.reject(e.seek.error)),!1}else if("IN_PROGRESS"!==e.seek.state||e.seek.position!==n)return r._logger.debug("Rejecting seek() because another seek was requested.",n),i.reject(new Error("Seek request aborted because another seek was requested to a different position.")),!1;return!0}),!0===i){this._logger.debug("Calling _kill() on player.");try{this._kill(),this._logger.info("Player killed.")}catch(t){this._triggerError(new f.ImplementationError("Exception occurred in _kill().",t)),this._logger.error("Exception when implementation was being killed.",t)}if(!e.ready){var c=o||new Error("Player was killed.");this._logger.debug("Rejecting whenReady."),this._readyDeferred.reject(c)}this._queuedSeekDeferreds.forEach(function(t){var e=t.position,n=t.deferred,i=o||new Error("Seek aborted as player killed.");r._logger.debug("Rejecting seek().",e),n.reject(i)}),this._stateManager.kill(),this._logger.debug("Player dead.")}},t}();e.BasePlayer=E},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};Object.defineProperty(e,"__esModule",{value:!0});var o=r(34),s=r(11),a=r(5),u=r(12),l=r(6),c=r(28),p=r(16),d=function(t){function e(e){var r=t.call(this,e)||this;return r._onProvidedPlayerError=new l.EventDispatcher,r._errorHandler=null,r._changeHandler=null,r._player=null,r._instanceLock=null,r._playConfig=void 0,r._pauseConfig=void 0,r._seekConfig=void 0,r._lastPlayerPosition=0,r._synced=!1,r._unsyncInProgress=!1,r._logger=u.prefixLogger(r._logger,"ProxyPlayerBase"),r.onProvidedPlayerError=r._onProvidedPlayerError.getHandle(),r}return n(e,t),e.prototype.play=function(e){return this._playConfig=e,t.prototype.play.call(this)},e.prototype.pause=function(e){return this._pauseConfig=e,t.prototype.pause.call(this)},e.prototype.seek=function(e,r){return this._seekConfig=r,t.prototype.seek.call(this,e)},e.prototype.getBufferedTimeRanges=function(){return this._player&&this._synced?this._player.getBufferedTimeRanges():null},e.prototype.getCurrentBufferedTimeRange=function(){return this._player&&this._synced?this._player.getCurrentBufferedTimeRange():null},e.prototype.getMaxBufferLength=function(){return this._player&&this._synced?this._player.getMaxBufferLength():null},e.prototype._providePlayer=function(t,e){if(void 0===e&&(e={}),e=i({syncPosition:!0,syncVolume:!0},e),this._ensureNotDead(),this._player)throw new Error("A player has already been provided.");this._logger.debug("providePlayer() called."),this._instanceLock=Object.create(null),this._player=t,this._sync(e)},e.prototype._removePlayer=function(){var t=this;if(this._ensureNotDead(),!this._player)throw new Error("There is no player to remove.");if(this._unsyncInProgress)throw new Error("Player is currently unsyncing.");this._logger.debug("removePlayer() called."),this._instanceLock=null,this._unsync(),this._player=null,this.isReady()&&!this.isDead()&&this._update(function(){var e=null!==t._getQueuedSeekPosition();t._notifyFading(!1),e||null===t._getQueuedSeekPosition()||t._signalSeekComplete(),t._notifyFadingForSeek(!1),t._notifyStalled(!0)})},e.prototype._setInitialDuration=function(t){var e=this;if(this._ensureNotDead(),t<0)throw new Error("Cannot set duration to a value < 0.");null===this.getDuration()&&this._update(function(){e._ensureBelowPosition(t),e._provideDuration(t),e.isReady()||(e._signalReady(),e._handleSkippedSeek())})},e.prototype._triggerError=function(e){t.prototype._triggerError.call(this,e)},e.prototype._getPlayer=function(){return this.isDead()?null:this._player},e.prototype._handleVolumeChange=function(t,e){this._synced&&this._player?this._player.setVolume(t,e):this._notifyVolumeChange(t,e)},e.prototype._handlePlayPauseChange=function(t){var e=this,r=this._player;r&&this._update(function(){t?e._playAndHandleAbort(r):(e._pauseAndHandleAbort(r),r.isFading()&&e._notifyFading(!0))})},e.prototype._handleSeekChange=function(t){var e=this._player;if(e&&this._synced){var r=this._seekConfig;this._seekConfig=void 0,e.seek(t,r),e.isFadingForSeek()&&this._notifyFadingForSeek(!0)}},e.prototype._getPosition=function(){if(this._player&&this._synced){if(!this._changeHandler)throw new Error("Handler should exist.");if(this._changeHandler.retrieve(),this._synced)return this._player.getPosition()}return this._lastPlayerPosition},e.prototype._kill=function(){this._player&&(this._unsync(),this._player.kill()),this._player=null},e.prototype._handleSkippedSeek=function(){if(this._player&&this._synced){var t=this.getSeekState(),e=this._player.getSeekState();!t||"IN_PROGRESS"!==t.state||e&&"IN_PROGRESS"===e.state||(this._logger.debug("Signalling seek as complete on proxy because provided player isn't seeking."),this._signalSeekComplete())}},e.prototype._ensureBelowPosition=function(t){this.getPosition()>t&&(this._logger.debug("Capping position.",t),this.seek(t),this.isReady()&&(this._lastPlayerPosition=t,this._signalSeekComplete()))},e.prototype._sync=function(t){var e=this,r=this._player;if(!r)throw new Error("Player should have become available by now.");if(this._logger.debug("Syncing...",this.isPlaying(),this.isActuallyPlaying()),r.isDead()){this._logger.debug("Provided player is dead.");var n=r.getFatalError();return void(n&&this._handleFatalError(n,r))}this._errorHandler=r.onError.subscribe(function(t){t instanceof a.PlayerFatalError?e._onProvidedPlayerError.dispatch(new p.ProxyProvidedPlayerFatalError(t,r)):(e._triggerError(t),e._onProvidedPlayerError.dispatch(new c.ProxyProvidedPlayerError(t,r)))}),this._changeHandler=r.onChange.subscribe(function(t){e._update(function(){if(e._logger.debug("Handling changes.",t),t.dead)return e._logger.debug("Player has gone to DEAD state."),e._unsync(),void(e.isDead()||t.fatalError&&e._handleFatalError(t.fatalError,r));if(void 0===t.volume&&void 0===t.muted||e._notifyVolumeChange(r.getVolume(),r.getMuted()),void 0!==t.duration&&(e._ensureBelowPosition(t.duration),e._provideDuration(t.duration),e.isReady()||(e._signalReady(),e._handleSkippedSeek(),e._notifyStalled(r.isStalled()))),t.seek){var n=e.getSeekState();n&&"IN_PROGRESS"===n.state||"IN_PROGRESS"!==t.seek.state?n&&"IN_PROGRESS"===n.state&&("COMPLETED"===t.seek.state&&n.position===t.seek.position?(e._signalSeekComplete(),r.isFadingForSeek()&&e._notifyFadingForSeek(!0)):"COMPLETED"===t.seek.state&&n.position!==t.seek.position?e._notifySeekRejection(new Error("Another seek occurred to a different position.")):"IN_PROGRESS"===t.seek.state&&n.position!==t.seek.position?e.seek(t.seek.position):"ERROR"===t.seek.state&&e._notifySeekRejection(t.seek.error)):e.seek(t.seek.position)}void 0!==t.stalled&&e._notifyStalled(t.stalled),!1===t.playing&&t.playRejection?e.isActuallyPlaying()?(e._triggerError(new s.PlayerError("Paused because a player was provided that refused to play.")),e._notifyPlaying(!1)):e._notifyPlayRejection(t.playRejection):!1===t.playing&&(r.isActuallyPlaying()?e.pause():void 0===t.actuallyPlaying&&e.isReady()&&e._notifyPlaying(!1)),!0===t.playing&&t.pauseRejection?e._notifyPauseRejection(t.pauseRejection):!0===t.playing&&e.play(),void 0!==t.actuallyPlaying&&t.actuallyPlaying!==e.isActuallyPlaying()&&(e._notifyPlaying(t.actuallyPlaying),t.actuallyPlaying&&r.isFading()&&e._notifyFading(!0)),!1===t.fading&&e._notifyFading(!1),!1===t.fadingForSeek&&e._notifyFadingForSeek(!1)})}),this._update(function(){var n=e._instanceLock;try{if(e._notifyStalled(r.isStalled()),r.isReady()){var i=r.getDuration();e._ensureBelowPosition(i),e._provideDuration(i),e.isReady()||(e._logger.debug("Provided player is already ready. Making proxy player ready."),e._signalReady())}if(t.syncVolume&&(r.setVolume(e.getVolume(),e.getMuted()),e._instanceLock!==n))return;var o=e.getSeekState();if(t.syncPosition){e._logger.debug("Seeking to match position.");var s=e.getPosition();r.getPosition()!==s?r.seek(s):(e._logger.debug("Skipping seek because already at same position."),e.isReady()&&o&&"IN_PROGRESS"===o.state&&e._signalSeekComplete())}else if(o&&"IN_PROGRESS"===o.state){e._logger.debug("Seeking to match position because a seek has been queued.");var u=e._seekConfig;e._seekConfig=void 0,r.seek(e.getPosition(),u)}else{var l=r.getSeekState();l&&"IN_PROGRESS"===l.state&&(e._logger.debug("Seeking on proxy to match seek that is in progress on provided player."),e.seek(l.position))}if(e._instanceLock!==n)return;if(r.isActuallyPlaying()?(e._logger.debug("Provided player is already playing."),e.isActuallyPlaying()||(e._notifyPlaying(!0),r.isFading()&&e._notifyFading(!0))):r.isPlaying()?(e._logger.debug("Provided player is preparing to play."),e.play()):e.isPlaying()?(e._logger.debug("Calling play() on provided player to match proxy."),e._playAndHandleAbort(r)):e.isReady()&&e.isActuallyPlaying()&&(e._logger.debug("Switching to paused state, as provided player and proxy intended state is paused."),e._notifyPlaying(!1)),e._instanceLock!==n)return;e._synced=!0,e._notifyVolumeChange(r.getVolume(),r.getMuted())}catch(t){e._triggerError(new a.PlayerFatalError("Unexpected error occurred whilst syncing.",t))}})},e.prototype._playAndHandleAbort=function(t){var e=this._instanceLock;this._logger.debug("Calling play() on provided player.");var r=this._playConfig;this._playConfig=this._pauseConfig=void 0,t.play(r),this._instanceLock===e&&!t.isPlaying()&&this.isPlaying()&&(this._logger.debug("Provided player was not playing after play() call completed."),this.isActuallyPlaying()?(this._triggerError(new s.PlayerError("Paused because a player was provided that refused to play.")),this._notifyPlaying(!1)):this.pause())},e.prototype._pauseAndHandleAbort=function(t){var e=this._instanceLock;this._logger.debug("Calling pause() on provided player.");var r=this._pauseConfig;this._playConfig=this._pauseConfig=void 0,t.pause(r),this._instanceLock===e&&t.isPlaying()&&!this.isPlaying()&&(this._logger.debug("Provided player was not paused after pause() call completed."),this.play())},e.prototype._unsync=function(){if(this._logger.debug("Unsyncing..."),this._changeHandler&&(this._changeHandler.remove(),this._changeHandler=null),this._errorHandler&&(this._errorHandler.remove(),this._errorHandler=null),!this._synced)return void this._logger.debug("Unsynced. (Sync never completed)");this._synced=!1,this._unsyncInProgress=!0;var t=this._player;if(t)try{this._lastPlayerPosition=t.getPosition()}catch(t){this._logger.error("Error whilst unsyncing.",t)}this._unsyncInProgress=!1,this._logger.debug("Unsynced.",this.isPlaying(),this.isActuallyPlaying())},e}(o.BasePlayer);e.ProxyPlayerBase=d},function(t,e,r){"use strict";function n(){return h}function i(){return y}function o(){return _}function s(){return f}function a(){return g}function u(){return p(v)}function l(){return p(m)}function c(){return p(b)}function p(t){var e=navigator.userAgent.match(t);if(e&&e.length>=3){var r=parseInt(e[1],10),n=parseInt(e[2],10);if(!isNaN(r)&&!isNaN(n))return{major:r,minor:n}}return null}Object.defineProperty(e,"__esModule",{value:!0});var d="undefined"!=typeof navigator?navigator.userAgent:"",h=!/chrome|opera/i.test(d)&&/safari/i.test(d),f=d.indexOf("MSIE ")>=0||d.indexOf("Trident/")>=0,g=d.indexOf("Edge/")>=0,_=/Chrom(?:e|ium)/.test(d),y=d.toLowerCase().indexOf("firefox")>=0,v=/version\/(\d+)\.(\d+)/i,m=/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)/,b=/Firefox\/(\d+)\.(\d+)/;e.isSafari=n,e.isFirefox=i,e.isChrome=o,e.isIE=s,e.isEdge=a,e.getSafariVersion=u,e.getChromeVersion=l,e.getFirefoxVersion=c},function(t,e,r){"use strict";function n(t,e){var r=e.convertResult,n=e.convertProgressUpdate,i=e.abortableJobOpts,s=e.passThroughAbort,a=void 0===s||s;return new l(function(){var e=t(),i=new u.EventDispatcher,s=!0,l=o.buildDeferred();return n&&e.onProgressUpdate(function(t){i.dispatch(n(t,s)),s=!1},{skipPast:!0}),e.onCompletion(function(t){try{l.resolve(r(t))}catch(t){l.reject(t)}}),e.onError(l.reject),{result:l.promise,progressUpdates:n?{onProgressUpdate:i,getProgressSoFar:function(){var t=e.getProgressSoFar();if(t){var r=n(t,s);return s=!1,r}return null}}:void 0,abort:function(){return a&&e.abort()}}},i)}Object.defineProperty(e,"__esModule",{value:!0});var i=r(8),o=r(13),s=r(18),a=r(3),u=r(6);e.abortedError=new Error("Job aborted."),e.map=n;var l=function(){function t(t,e){void 0===e&&(e={}),this._job=t,this._opts=e,this._counter=0,this._jobControl=null,this._promise=null,this._jobCompleted=!1}return t.prototype.run=function(){var t,r=this;if(this._jobControl)t=this._jobControl;else{try{t=this._jobControl=this._job()}catch(e){t=this._jobControl={result:i.Promise.reject(e)}}this._promise=t.result,s.always(this._promise,function(){r._jobCompleted=!0,r._opts.storeResult||(r._jobCompleted=!1,r._promise=null,r._jobControl=null)})}var n=this._promise;this._counter++;var u=o.buildDeferred(),l=!1,c=!1,p=void 0,d=!1,h=[],f=[],g=[],_=function(){d||(l=!0,r._counter--),h.forEach(function(t){return t.remove()})};return s.always(n,_),n.then(function(t){d||(p=t,f.forEach(function(e){return a.deferException(function(){return e(t)})}),f.splice(0),u.resolve(t))},function(t){d||(c=!0,p=t,g.forEach(function(e){return e(t)}),g.splice(0),u.reject(t))}),{whenComplete:function(){return u.promise},onProgressUpdate:function(e,r){if(void 0===r&&(r={}),t.progressUpdates){if(!d&&!l){var n=t.progressUpdates.onProgressUpdate.subscribe(function(t){return e(t)});h.push(n)}if(!r.skipPast){var i=t.progressUpdates.getProgressSoFar();i&&e(i)}}},getProgressSoFar:function(){return t.progressUpdates?t.progressUpdates.getProgressSoFar():null},onCompletion:function(t){l?!c&&a.deferException(function(){return t(p)}):f.push(t)},onError:function(t){d?a.deferException(function(){return t(e.abortedError)}):l?c&&a.deferException(function(){return t(p)}):g.push(t)},hasCompleted:function(){return l},hasErrored:function(){return c},isAborted:function(){return d},abort:function(){d||l||(d=!0,h.forEach(function(t){return t.remove()}),0==--r._counter&&!r._jobCompleted&&r._jobControl&&r._jobControl.abort&&(r._jobControl.abort(),r._promise=null,r._jobControl=null),g.forEach(function(t){return a.deferException(function(){return t(e.abortedError)})}),u.reject(e.abortedError))}}},t}();e.AbortableJob=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){if(this.start=t,this.duration=e,e<0)throw new RangeError("Duration must be >= 0.");this.end=t+e}return t.normalizeRawTimeRanges=function(t){return t.slice(0).sort(function(t,e){return t.start-e.start}).reduce(function(t,e,r){var n=t.length-1;return r>0&&t[n].end>=e.start?t[n].end=e.end:t.push(e),t},[])},t.normalize=function(e){return t.normalizeRawTimeRanges(e.map(function(t){return{start:t.start,end:t.end}})).map(function(e){return new t(e.start,e.end-e.start)})},t.getCoverage=function(e){if(0===e.length)return new t(0,0);var r=1/0,n=0;return e.forEach(function(t){t.start<r&&(r=t.start),t.end>n&&(n=t.end)}),new t(r,n-r)},t.rangesContainTime=function(t,e){return e.some(function(e){return e.containsTime(t)})},t.prototype.containsTime=function(t){return this.start<=t&&this.end>t},t}();e.TimeRange=n},function(t,e,r){"use strict";t.exports=function(){return"function"==typeof WeakMap&&"[object WeakMap]"===Object.prototype.toString.call(new WeakMap)}()},function(t,e,r){"use strict";var n=r(10),i=r(1),o=r(9),s=r(21),a=Array.isArray,u=Function.prototype.call,l=Array.prototype.some;t.exports=function(t,e){var r,c,p,d,h,f,g,_,y=arguments[2];if(a(t)||n(t)?r="array":o(t)?r="string":t=s(t),i(e),p=function(){d=!0},"array"===r)return void l.call(t,function(t){return u.call(e,y,t,p),d});if("string"!==r)for(c=t.next();!c.done;){if(u.call(e,y,c.value,p),d)return;c=t.next()}else for(f=t.length,h=0;h<f&&(g=t[h],h+1<f&&(_=g.charCodeAt(0))>=55296&&_<=56319&&(g+=t[++h]),u.call(e,y,g,p),!d);++h);}},function(t,e,r){"use strict";var n=r(10),i=r(4),o=r(9),s=r(2).iterator,a=Array.isArray;t.exports=function(t){return!(!i(t)||!a(t)&&!o(t)&&!n(t)&&"function"!=typeof t[s])}},function(t,e,r){"use strict";var n=r(41);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},function(t,e,r){"use strict";var n,i=r(15),o=r(7),s=r(2),a=r(20),u=Object.defineProperty;n=t.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),a.call(this,t),u(this,"__length__",o("",t.length))},i&&i(n,a),delete n.prototype.constructor,n.prototype=Object.create(a.prototype,{_next:o(function(){if(this.__list__)return this.__nextIndex__<this.__length__?this.__nextIndex__++:void this._unBind()}),_resolve:o(function(t){var e,r=this.__list__[t];return this.__nextIndex__===this.__length__?r:(e=r.charCodeAt(0),e>=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,s.toStringTag,o("c","String Iterator"))},function(t,e,r){"use strict";var n=r(1),i=r(0),o=Function.prototype.bind,s=Function.prototype.call,a=Object.keys,u=Object.prototype.propertyIsEnumerable;t.exports=function(t,e){return function(r,l){var c,p=arguments[2],d=arguments[3];return r=Object(i(r)),n(l),c=a(r),d&&c.sort("function"==typeof d?o.call(d,r):void 0),"function"!=typeof t&&(t=c[t]),s.call(t,c,function(t,n){return u.call(r,t)?s.call(l,p,r[t],t,r,n):e})}}},function(t,e,r){"use strict";t.exports=r(44)("forEach")},function(t,e,r){"use strict";var n=r(1),i=r(45),o=Function.prototype.call;t.exports=function(t,e){var r={},s=arguments[2];return n(e),i(t,function(t,n,i,a){r[n]=o.call(e,s,t,n,i,a)}),r}},function(t,e,r){"use strict";t.exports=function(t){return t=Number(t),isNaN(t)||0===t?t:t>0?1:-1}},function(t,e,r){"use strict";t.exports=function(){var t=Math.sign;return"function"==typeof t&&1===t(10)&&-1===t(-20)}},function(t,e,r){"use strict";t.exports=r(48)()?Math.sign:r(47)},function(t,e,r){"use strict";var n=r(49),i=Math.abs,o=Math.floor;t.exports=function(t){return isNaN(t)?0:(t=Number(t),0!==t&&isFinite(t)?n(t)*o(i(t)):t)}},function(t,e,r){"use strict";var n=r(50),i=Math.max;t.exports=function(t){return i(0,n(t))}},function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call(r(24));t.exports=function(t){return"function"==typeof t&&n.call(t)===i}},function(t,e,r){"use strict";var n=r(2).iterator,i=r(10),o=r(52),s=r(51),a=r(1),u=r(0),l=r(4),c=r(9),p=Array.isArray,d=Function.prototype.call,h={configurable:!0,enumerable:!0,writable:!0,value:null},f=Object.defineProperty;t.exports=function(t){var e,r,g,_,y,v,m,b,w,E,P=arguments[1],S=arguments[2];if(t=Object(u(t)),l(P)&&a(P),this&&this!==Array&&o(this))e=this;else{if(!P){if(i(t))return y=t.length,1!==y?Array.apply(null,t):(_=new Array(1),_[0]=t[0],_);if(p(t)){for(_=new Array(y=t.length),r=0;r<y;++r)_[r]=t[r];return _}}_=[]}if(!p(t))if(void 0!==(w=t[n])){for(m=a(w).call(t),e&&(_=new e),b=m.next(),r=0;!b.done;)E=P?d.call(P,S,b.value,r):b.value,e?(h.value=E,f(_,r,h)):_[r]=E,b=m.next(),++r;y=r}else if(c(t)){for(y=t.length,e&&(_=new e),r=0,g=0;r<y;++r)E=t[r],r+1<y&&(v=E.charCodeAt(0))>=55296&&v<=56319&&(E+=t[++r]),E=P?d.call(P,S,E,g):E,e?(h.value=E,f(_,g,h)):_[g]=E,++g;y=g}if(void 0===y)for(y=s(t.length),e&&(_=new e(y)),r=0;r<y;++r)E=P?d.call(P,S,t[r],r):t[r],e?(h.value=E,f(_,r,h)):_[r]=E;return e&&(h.value=null,_.length=y),_}},function(t,e,r){"use strict";t.exports=function(){var t,e,r=Array.from;return"function"==typeof r&&(t=["raz","dwa"],e=r(t),Boolean(e&&e!==t&&"dwa"===e[1]))}},function(t,e,r){"use strict";t.exports=r(54)()?Array.from:r(53)},function(t,e,r){"use strict";var n=r(55),i=r(14),o=r(0);t.exports=function(t){var e=Object(o(t)),r=arguments[1],s=Object(arguments[2]);if(e!==t&&!r)return e;var a={};return r?n(r,function(e){(s.ensure||e in t)&&(a[e]=t[e])}):i(a,t),a}},function(t,e,r){"use strict";var n,i=r(56),o=r(23),s=r(1),a=r(46),u=r(1),l=r(0),c=Function.prototype.bind,p=Object.defineProperty,d=Object.prototype.hasOwnProperty;n=function(t,e,r){var n,o=l(e)&&u(e.value);return n=i(e),delete n.writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&d.call(this,t)?o:(e.value=c.call(o,r.resolveContext?r.resolveContext(this):this),p(this,t,e),this[t])},n},t.exports=function(t){var e=o(arguments[1]);return null!=e.resolveContext&&s(e.resolveContext),a(t,function(t,r){return n(r,t,e)})}},function(t,e,r){"use strict";var n=r(0);t.exports=function(){return n(this).length=0,this}},function(t,e,r){"use strict";t.exports=function(t){return!!t&&("symbol"==typeof t||!!t.constructor&&"Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag])}},function(t,e,r){"use strict";var n=r(59);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not a symbol");return t}},function(t,e,r){"use strict";var n,i,o,s,a=r(7),u=r(60),l=Object.create,c=Object.defineProperties,p=Object.defineProperty,d=Object.prototype,h=l(null);if("function"==typeof Symbol){n=Symbol;try{String(n()),s=!0}catch(t){}}var f=function(){var t=l(null);return function(e){for(var r,n,i=0;t[e+(i||"")];)++i;return e+=i||"",t[e]=!0,r="@@"+e,p(d,r,a.gs(null,function(t){n||(n=!0,p(this,r,a(t)),n=!1)})),r}}();o=function(t){if(this instanceof o)throw new TypeError("Symbol is not a constructor");return i(t)},t.exports=i=function t(e){var r;if(this instanceof t)throw new TypeError("Symbol is not a constructor");return s?n(e):(r=l(o.prototype),e=void 0===e?"":String(e),c(r,{__description__:a("",e),__name__:a("",f(e))}))},c(i,{for:a(function(t){return h[t]?h[t]:h[t]=i(String(t))}),keyFor:a(function(t){var e;u(t);for(e in h)if(h[e]===t)return e}),hasInstance:a("",n&&n.hasInstance||i("hasInstance")),isConcatSpreadable:a("",n&&n.isConcatSpreadable||i("isConcatSpreadable")),iterator:a("",n&&n.iterator||i("iterator")),match:a("",n&&n.match||i("match")),replace:a("",n&&n.replace||i("replace")),search:a("",n&&n.search||i("search")),species:a("",n&&n.species||i("species")),split:a("",n&&n.split||i("split")),toPrimitive:a("",n&&n.toPrimitive||i("toPrimitive")),toStringTag:a("",n&&n.toStringTag||i("toStringTag")),unscopables:a("",n&&n.unscopables||i("unscopables"))}),c(o.prototype,{constructor:a(i),toString:a("",function(){return this.__name__})}),c(i.prototype,{toString:a(function(){return"Symbol ("+u(this).__description__+")"}),valueOf:a(function(){return u(this)})}),p(i.prototype,i.toPrimitive,a("",function(){var t=u(this);return"symbol"==typeof t?t:t.toString()})),p(i.prototype,i.toStringTag,a("c","Symbol")),p(o.prototype,i.toStringTag,a("c",i.prototype[i.toStringTag])),p(o.prototype,i.toPrimitive,a("c",i.prototype[i.toPrimitive]))},function(t,e,r){"use strict";var n={object:!0,symbol:!0};t.exports=function(){var t;if("function"!=typeof Symbol)return!1;t=Symbol("test symbol");try{String(t)}catch(t){return!1}return!!n[typeof Symbol.iterator]&&!!n[typeof Symbol.toPrimitive]&&!!n[typeof Symbol.toStringTag]}},function(t,e,r){"use strict";var n,i=r(15),o=r(22),s=r(7),a=r(2),u=r(20),l=Object.defineProperty;n=t.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,t),e=e?o.call(e,"key+value")?"key+value":o.call(e,"key")?"key":"value":"value",l(this,"__kind__",s("",e))},i&&i(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:s(function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t})}),l(n.prototype,a.toStringTag,s("c","Array Iterator"))},function(t,e,r){"use strict";var n=String.prototype.indexOf;t.exports=function(t){return n.call(this,t,arguments[1])>-1}},function(t,e,r){"use strict";var n="razdwatrzy";t.exports=function(){return"function"==typeof n.contains&&!0===n.contains("dwa")&&!1===n.contains("foo")}},function(t,e,r){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,r){"use strict";var n=r(4),i=Object.keys;t.exports=function(t){return i(n(t)?Object(t):t)}},function(t,e,r){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,r){"use strict";t.exports=r(68)()?Object.keys:r(67)},function(t,e,r){"use strict";var n=r(69),i=r(0),o=Math.max;t.exports=function(t,e){var r,s,a,u=o(arguments.length,2);for(t=Object(i(t)),a=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},s=1;s<u;++s)e=arguments[s],n(e).forEach(a);if(void 0!==r)throw r;return t}},function(t,e,r){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(t={foo:"raz"},e(t,{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,r){"use strict";var n=Object.create(null),i=Math.random;t.exports=function(){var t;do{t=i().toString(36).slice(2)}while(n[t]);return t}},function(t,e,r){"use strict";var n=r(25);t.exports=function(t){if(!n(t))throw new TypeError(t+" is not an Object");return t}},function(t,e,r){"use strict";var n,i=Object.create;r(27)()||(n=r(26)),t.exports=function(){var t,e,r;return n?1!==n.level?i:(t={},e={},r={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(t){return"__proto__"===t?void(e[t]={configurable:!0,enumerable:!1,writable:!0,value:void 0}):void(e[t]=r)}),Object.defineProperties(t,e),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:t}),function(e,r){return i(null===e?t:e,r)}):i}()},function(t,e,r){"use strict";var n,i=r(15),o=r(73),s=r(0),a=r(72),u=r(7),l=r(21),c=r(40),p=r(2).toStringTag,d=r(39),h=Array.isArray,f=Object.defineProperty,g=Object.prototype.hasOwnProperty,_=Object.getPrototypeOf;t.exports=n=function(){var t,e=arguments[0];if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");return t=d&&i&&WeakMap!==n?i(new WeakMap,_(this)):this,null!=e&&(h(e)||(e=l(e))),f(t,"__weakMapData__",u("c","$weakMap$"+a())),e?(c(e,function(e){s(e),t.set(e[0],e[1])}),t):t},d&&(i&&i(n,WeakMap),n.prototype=Object.create(WeakMap.prototype,{constructor:u(n)})),Object.defineProperties(n.prototype,{delete:u(function(t){return!!g.call(o(t),this.__weakMapData__)&&(delete t[this.__weakMapData__],!0)}),get:u(function(t){if(g.call(o(t),this.__weakMapData__))return t[this.__weakMapData__]}),has:u(function(t){return g.call(o(t),this.__weakMapData__)}),set:u(function(t,e){return f(o(t),this.__weakMapData__,u("c",e)),this}),toString:u(function(){return"[object WeakMap]"})}),f(n.prototype,p,u("c","WeakMap"))},function(t,e,r){"use strict";t.exports=function(){var t,e;if("function"!=typeof WeakMap)return!1;try{t=new WeakMap([[e={},"one"],[{},"two"],[{},"three"]])}catch(t){return!1}return"[object WeakMap]"===String(t)&&"function"==typeof t.set&&t.set({},1)===t&&"function"==typeof t.delete&&"function"==typeof t.has&&"one"===t.get(e)}},function(t,e,r){"use strict";t.exports=r(76)()?WeakMap:r(75)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(77),i=function(){function t(){this._map=new n}return t.prototype.get=function(t){return this._map.get(t)},t.prototype.set=function(t,e){this._map.set(t,e)},t.prototype.has=function(t){return this._map.has(t)},t.prototype.delete=function(t){return this._map.delete(t)},t}();e.SCWeakMap=i},function(t,e,r){!function(e){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/?#]*)(.*)$/,i=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=s.parseURL(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=s.normalizePath(i.path),s.buildURLFromParts(i)}var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return r.alwaysNormalize?(o.path=s.normalizePath(o.path),s.buildURLFromParts(o)):e;var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var u=n.exec(a.path);a.netLoc=u[1],a.path=u[2]}a.netLoc&&!a.path&&(a.path="/");var l={scheme:a.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(l.netLoc=a.netLoc,"/"!==o.path[0]))if(o.path){var c=a.path,p=c.substring(0,c.lastIndexOf("/")+1)+o.path;l.path=s.normalizePath(p)}else l.path=a.path,o.params||(l.params=a.params,o.query||(l.query=a.query));return null===l.path&&(l.path=r.alwaysNormalize?s.normalizePath(o.path):o.path),s.buildURLFromParts(l)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(i,"");t.length!==(t=t.replace(o,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}};t.exports=s}()},function(t,e,r){"use strict";function n(t){var e=s.exec(t);return e?e[1].toLowerCase():null}function i(t,e){return o.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}Object.defineProperty(e,"__esModule",{value:!0});var o=r(79),s=/^.*\.([^\.;\?#]*).*$/;e.getExtension=n,e.buildAbsoluteUrl=i},function(t,e,r){"use strict";function n(t){var e=new Uint8Array(t.reduce(function(t,e){return t+e.byteLength},0)),r=0;return t.forEach(function(t){e.set(t,r),r+=t.byteLength}),e}function i(t,e){if(Uint8Array.prototype.fill)t.fill(e);else for(var r=0;r<t.length;r++)t[r]=e}function o(t,e){if(Uint8Array.prototype.forEach)t.forEach(e);else for(var r=0;r<t.length;r++)e(t[r],r)}function s(t,e){if(void 0===e&&(e=!1),(t=Math.round(t))<0)throw new Error("Negative numbers not supported.");for(var r=Math.max(1,Math.ceil(Math.log(t+1)/Math.log(2)/8)),n=new Uint8Array(r),i=0;i<r;i++)n[e?i:r-1-i]=255&t,t>>>=8;return n}function a(t){if(t<0||t>Math.pow(2,53))throw new Error("Unrepresentable value: "+t);var e;for(e=1;e<=8&&!(t<Math.pow(2,7*e)-1);e++);for(var r=new Uint8Array(e),n=1;n<=e;n++){var i=255&t;r[e-n]=i,t-=i,t/=Math.pow(2,8)}return r[0]|=1<<8-e,r}Object.defineProperty(e,"__esModule",{value:!0}),e.combine=n,e.fill=i,e.forEach=o,e.numberToUint8Array=s,e.createVintBuffer=a},function(t,e,r){"use strict";function n(t){return t.filter(function(t){return null!=t})}Object.defineProperty(e,"__esModule",{value:!0}),e.compact=n},function(t,e,r){"use strict";function n(t,e,r){return void 0===r&&(r=new Error("Timed out.")),new i.Promise(function(n,i){var s=window.setTimeout(function(){i(r)},e);o.always(t,function(t){return window.clearTimeout(s),t}).then(n,i)})}Object.defineProperty(e,"__esModule",{value:!0});var i=r(8),o=r(18);e.promiseWithTimeout=n},function(t,e,r){"use strict";function n(){return o?new window.Map:new s}Object.defineProperty(e,"__esModule",{value:!0});var i=r(17),o="undefined"!=typeof window&&"Map"in window;e.buildCache=n;var s=function(){function t(){this._store=[]}return t.prototype.set=function(t,e){var r=i.find(this._store,function(e){return e.key===t});r?r.val=e:this._store.push({key:t,val:e})},t.prototype.get=function(t){var e=i.find(this._store,function(e){return e.key===t});if(e)return e.val},t}()},function(t,e,r){"use strict";function n(t,e,r){void 0===r&&(r={});var n=null,i=0,s=!1,a=null,u=function(){var l=!1,c=function(){if(l)throw new Error("scheduleRetry() already called.");if(l=!0,a=null,s)return!1;var e=t(++i);if(null===e){var c=r.onNoMoreRetries;return c&&o.deferException(function(){return c()}),!1}return n=window.setTimeout(u,e),!0};a=e({attemptNum:i,scheduleRetry:c})||null};return u(),{cancel:function(){s||(s=!0,n&&(window.clearTimeout(n),n=null),a&&a.onCancel())}}}function i(t){var e=void 0===t?{}:t,r=e.timeBase,n=void 0===r?500:r,i=e.threshold,o=void 0===i?3:i,s=e.delayCap,a=void 0===s?45e3:s,u=e.jitter,l=void 0===u?200:u,c=e.maxAttempts,p=void 0===c?null:c;if(n<=0)throw new Error("Time base must be > 0.");if(o<=0)throw new Error("Threshold must be > 0.");if(null!==a&&a<=0)throw new Error("Delay cap must be null or > 0.");if(null!==p&&p<1)throw new Error("Max attempts must be >= 1.");return function(t){if(null!==p&&t>=p)return null;var e=t>0?Math.pow(2,t/o-1):0;return Math.min(e*n,a||1/0)+Math.round(Math.random()*l)}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(3);e.retry=n,e.buildExponentialDelayCalculator=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(13),i=r(37),o=r(85),s=r(30),a=r(17),u=r(84),l=r(19),c=r(8),p=r(83),d=r(18),h=r(82),f=r(81),g=r(3),_=r(36),y=r(80),v=r(78);!function(t){t.OnExit=s.OnExit,t.find=a.find,t.Promise=c.Promise,t.promiseWithTimeout=p.promiseWithTimeout,t.always=d.always,t.compact=h.compact,t.deferException=g.deferException,t.SCWeakMap=v.SCWeakMap;!function(t){t.buildCache=u.buildCache}(t.cache||(t.cache={}));!function(t){t.buildDeferred=n.buildDeferred}(t.deferred||(t.deferred={}));!function(t){t.getExtension=y.getExtension,t.buildAbsoluteUrl=y.buildAbsoluteUrl}(t.url||(t.url={}));!function(t){t.AbortableJob=i.AbortableJob,t.map=i.map,t.abortedError=i.abortedError}(t.abortableJob||(t.abortableJob={}));!function(t){t.retry=o.retry,t.buildExponentialDelayCalculator=o.buildExponentialDelayCalculator}(t.retry||(t.retry={}));!function(t){t.isSafari=_.isSafari,t.getSafariVersion=_.getSafariVersion,t.isIE=_.isIE,t.isEdge=_.isEdge,t.isFirefox=_.isFirefox,t.isChrome=_.isChrome,t.getChromeVersion=_.getChromeVersion,t.getFirefoxVersion=_.getFirefoxVersion}(t.browser||(t.browser={}));!function(t){t.combine=f.combine,t.fill=f.fill,t.forEach=f.forEach,t.numberToUint8Array=f.numberToUint8Array,t.createVintBuffer=f.createVintBuffer}(t.arrayBuffer||(t.arrayBuffer={}));!function(t){t.now=l.now}(t.time||(t.time={}))}(e.helpers||(e.helpers={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._msg=t,this._cause=e}return t.prototype.getMsg=function(){return this._msg},t.prototype.getCause=function(){return this._cause},t}();e.LoaderError=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(87);!function(t){t.LoaderError=n.LoaderError}(e.loaderErrors||(e.loaderErrors={}))},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),o=function(t){function e(e,r){return t.call(this,e||"The URL update failed for some reason.",r)||this}return n(e,t),e.prototype.getCode=function(){return"URL_UPDATE_ERROR"},e}(i.PlayerFatalError);e.URLUpdateError=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(33),i=r(89),o=r(29),s=r(16),a=r(11),u=r(5);!function(t){t.PlayerError=a.PlayerError,t.PlayerFatalError=u.PlayerFatalError,t.NotSupportedError=n.NotSupportedError,t.URLUpdateError=i.URLUpdateError,t.ImplementationError=o.ImplementationError,t.ProxyProvidedPlayerFatalError=s.ProxyProvidedPlayerFatalError}(e.errors||(e.errors={}))},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(6),o=r(12),s=r(35),a=r(16),u=function(t){function e(e){var r=t.call(this,e)||this;return r._onPlayerProvided=new i.EventDispatcher,r._onPlayerRemoved=new i.EventDispatcher,r._shouldPassThroughFatalErrors=!!e.shouldPassThroughFatalErrors,r.onPlayerProvided=r._onPlayerProvided.getHandle(),r.onPlayerRemoved=r._onPlayerRemoved.getHandle(),r._logger=o.prefixLogger(r._logger,"ProxyPlayer"),r}return n(e,t),e.prototype.providePlayer=function(t,e){void 0===e&&(e={}),this._providePlayer(t,e),this._onPlayerProvided.dispatch(t)},e.prototype.removePlayer=function(){var t=this._getPlayer();if(!t)throw new Error("There is no player to remove.");this._removePlayer(),this._onPlayerRemoved.dispatch(t)},e.prototype.setInitialDuration=function(t){this._setInitialDuration(t)},e.prototype.getPlayer=function(){return this._getPlayer()},e.prototype._handleFatalError=function(t,e){this._shouldPassThroughFatalErrors?this._triggerError(t):this._triggerError(new a.ProxyProvidedPlayerFatalError(t,e))},e}(s.ProxyPlayerBase);e.ProxyPlayer=u},function(t,e){},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(t){if(c===setTimeout)return setTimeout(t,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function o(t){if(p===clearTimeout)return clearTimeout(t);if((p===n||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function s(){g&&h&&(g=!1,h.length?f=h.concat(f):_=-1,f.length&&a())}function a(){if(!g){var t=i(s);g=!0;for(var e=f.length;e;){for(h=f,f=[];++_<e;)h&&h[_].run();_=-1,e=f.length}h=null,g=!1,o(t)}}function u(t,e){this.fun=t,this.array=e}function l(){}var c,p,d=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(t){c=r}try{p="function"==typeof clearTimeout?clearTimeout:n}catch(t){p=n}}();var h,f=[],g=!1,_=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];f.push(new u(t,e)),1!==f.length||g||i(a)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.prependListener=l,d.prependOnceListener=l,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,r){(function(e,r){/*!
14
14
  * @overview es6-promise - a tiny implementation of Promises/A+.
15
15
  * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
16
16
  * @license Licensed under MIT license