catlab-remote-client 1.0.20
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/LICENSE.md +2 -0
- package/README.md +15 -0
- package/dist/assets/smileys/1f0cf.png +0 -0
- package/dist/assets/smileys/1f31a.png +0 -0
- package/dist/assets/smileys/1f31e.png +0 -0
- package/dist/assets/smileys/1f32d.png +0 -0
- package/dist/assets/smileys/1f32e.png +0 -0
- package/dist/assets/smileys/1f332.png +0 -0
- package/dist/assets/smileys/1f333.png +0 -0
- package/dist/assets/smileys/1f334.png +0 -0
- package/dist/assets/smileys/1f335.png +0 -0
- package/dist/assets/smileys/1f336.png +0 -0
- package/dist/assets/smileys/1f338.png +0 -0
- package/dist/assets/smileys/1f339.png +0 -0
- package/dist/assets/smileys/1f341.png +0 -0
- package/dist/assets/smileys/1f344.png +0 -0
- package/dist/assets/smileys/1f346.png +0 -0
- package/dist/assets/smileys/1f349.png +0 -0
- package/dist/assets/smileys/1f34b.png +0 -0
- package/dist/assets/smileys/1f34c.png +0 -0
- package/dist/assets/smileys/1f34d.png +0 -0
- package/dist/assets/smileys/1f34e.png +0 -0
- package/dist/assets/smileys/1f354.png +0 -0
- package/dist/assets/smileys/1f355.png +0 -0
- package/dist/assets/smileys/1f363.png +0 -0
- package/dist/assets/smileys/1f367.png +0 -0
- package/dist/assets/smileys/1f369.png +0 -0
- package/dist/assets/smileys/1f36a.png +0 -0
- package/dist/assets/smileys/1f36c.png +0 -0
- package/dist/assets/smileys/1f36d.png +0 -0
- package/dist/assets/smileys/1f373.png +0 -0
- package/dist/assets/smileys/1f377.png +0 -0
- package/dist/assets/smileys/1f378.png +0 -0
- package/dist/assets/smileys/1f379.png +0 -0
- package/dist/assets/smileys/1f37a.png +0 -0
- package/dist/assets/smileys/1f37c.png +0 -0
- package/dist/assets/smileys/1f37f.png +0 -0
- package/dist/assets/smileys/1f383.png +0 -0
- package/dist/assets/smileys/1f388.png +0 -0
- package/dist/assets/smileys/1f3a9.png +0 -0
- package/dist/assets/smileys/1f3b1.png +0 -0
- package/dist/assets/smileys/1f3b5.png +0 -0
- package/dist/assets/smileys/1f3b7.png +0 -0
- package/dist/assets/smileys/1f3ba.png +0 -0
- package/dist/assets/smileys/1f3f3-1f308.png +0 -0
- package/dist/assets/smileys/1f40a.png +0 -0
- package/dist/assets/smileys/1f40b.png +0 -0
- package/dist/assets/smileys/1f40c.png +0 -0
- package/dist/assets/smileys/1f40d.png +0 -0
- package/dist/assets/smileys/1f414.png +0 -0
- package/dist/assets/smileys/1f417.png +0 -0
- package/dist/assets/smileys/1f419.png +0 -0
- package/dist/assets/smileys/1f41a.png +0 -0
- package/dist/assets/smileys/1f41b.png +0 -0
- package/dist/assets/smileys/1f41c.png +0 -0
- package/dist/assets/smileys/1f41d.png +0 -0
- package/dist/assets/smileys/1f41e.png +0 -0
- package/dist/assets/smileys/1f41f.png +0 -0
- package/dist/assets/smileys/1f420.png +0 -0
- package/dist/assets/smileys/1f421.png +0 -0
- package/dist/assets/smileys/1f425.png +0 -0
- package/dist/assets/smileys/1f427.png +0 -0
- package/dist/assets/smileys/1f428.png +0 -0
- package/dist/assets/smileys/1f42b.png +0 -0
- package/dist/assets/smileys/1f42c.png +0 -0
- package/dist/assets/smileys/1f42d.png +0 -0
- package/dist/assets/smileys/1f42e.png +0 -0
- package/dist/assets/smileys/1f42f.png +0 -0
- package/dist/assets/smileys/1f430.png +0 -0
- package/dist/assets/smileys/1f431.png +0 -0
- package/dist/assets/smileys/1f433.png +0 -0
- package/dist/assets/smileys/1f435.png +0 -0
- package/dist/assets/smileys/1f436.png +0 -0
- package/dist/assets/smileys/1f437.png +0 -0
- package/dist/assets/smileys/1f438.png +0 -0
- package/dist/assets/smileys/1f439.png +0 -0
- package/dist/assets/smileys/1f43a.png +0 -0
- package/dist/assets/smileys/1f43b.png +0 -0
- package/dist/assets/smileys/1f43c.png +0 -0
- package/dist/assets/smileys/1f43d.png +0 -0
- package/dist/assets/smileys/1f43f.png +0 -0
- package/dist/assets/smileys/1f47a.png +0 -0
- package/dist/assets/smileys/1f47b.png +0 -0
- package/dist/assets/smileys/1f47d.png +0 -0
- package/dist/assets/smileys/1f47e.png +0 -0
- package/dist/assets/smileys/1f4a3.png +0 -0
- package/dist/assets/smileys/1f4a8.png +0 -0
- package/dist/assets/smileys/1f4a9.png +0 -0
- package/dist/assets/smileys/1f579.png +0 -0
- package/dist/assets/smileys/1f57a.png +0 -0
- package/dist/assets/smileys/1f596.png +0 -0
- package/dist/assets/smileys/1f601.png +0 -0
- package/dist/assets/smileys/1f608.png +0 -0
- package/dist/assets/smileys/1f60a.png +0 -0
- package/dist/assets/smileys/1f60d.png +0 -0
- package/dist/assets/smileys/1f60e.png +0 -0
- package/dist/assets/smileys/1f60f.png +0 -0
- package/dist/assets/smileys/1f612.png +0 -0
- package/dist/assets/smileys/1f617.png +0 -0
- package/dist/assets/smileys/1f61a.png +0 -0
- package/dist/assets/smileys/1f61b.png +0 -0
- package/dist/assets/smileys/1f61c.png +0 -0
- package/dist/assets/smileys/1f61d.png +0 -0
- package/dist/assets/smileys/1f621.png +0 -0
- package/dist/assets/smileys/1f628.png +0 -0
- package/dist/assets/smileys/1f62c.png +0 -0
- package/dist/assets/smileys/1f635.png +0 -0
- package/dist/assets/smileys/1f638.png +0 -0
- package/dist/assets/smileys/1f63a.png +0 -0
- package/dist/assets/smileys/1f63b.png +0 -0
- package/dist/assets/smileys/1f63c.png +0 -0
- package/dist/assets/smileys/1f63d.png +0 -0
- package/dist/assets/smileys/1f641.png +0 -0
- package/dist/assets/smileys/1f64a.png +0 -0
- package/dist/assets/smileys/1f680.png +0 -0
- package/dist/assets/smileys/1f910.png +0 -0
- package/dist/assets/smileys/1f911.png +0 -0
- package/dist/assets/smileys/1f913.png +0 -0
- package/dist/assets/smileys/1f917.png +0 -0
- package/dist/assets/smileys/1f918.png +0 -0
- package/dist/assets/smileys/1f919.png +0 -0
- package/dist/assets/smileys/1f91e.png +0 -0
- package/dist/assets/smileys/1f91f.png +0 -0
- package/dist/assets/smileys/1f920.png +0 -0
- package/dist/assets/smileys/1f921.png +0 -0
- package/dist/assets/smileys/1f922.png +0 -0
- package/dist/assets/smileys/1f924.png +0 -0
- package/dist/assets/smileys/1f925.png +0 -0
- package/dist/assets/smileys/1f929.png +0 -0
- package/dist/assets/smileys/1f92a.png +0 -0
- package/dist/assets/smileys/1f92e.png +0 -0
- package/dist/assets/smileys/1f951.png +0 -0
- package/dist/assets/smileys/1f95d.png +0 -0
- package/dist/assets/smileys/1f96a.png +0 -0
- package/dist/assets/smileys/1f983.png +0 -0
- package/dist/assets/smileys/1f984.png +0 -0
- package/dist/assets/smileys/1f986.png +0 -0
- package/dist/assets/smileys/1f987.png +0 -0
- package/dist/assets/smileys/1f989.png +0 -0
- package/dist/assets/smileys/1f98a.png +0 -0
- package/dist/assets/smileys/1f98b.png +0 -0
- package/dist/assets/smileys/1f98c.png +0 -0
- package/dist/assets/smileys/1f98d.png +0 -0
- package/dist/assets/smileys/1f98e.png +0 -0
- package/dist/assets/smileys/1f98f.png +0 -0
- package/dist/assets/smileys/1f994.png +0 -0
- package/dist/assets/smileys/1f996.png +0 -0
- package/dist/assets/smileys/1f997.png +0 -0
- package/dist/assets/smileys/1f9c0.png +0 -0
- package/dist/assets/smileys/1f9d0.png +0 -0
- package/dist/assets/smileys/1f9dd-2640.png +0 -0
- package/dist/assets/smileys/1f9df.png +0 -0
- package/dist/assets/smileys/2602.png +0 -0
- package/dist/assets/smileys/2618.png +0 -0
- package/dist/assets/smileys/2623.png +0 -0
- package/dist/assets/smileys/2660.png +0 -0
- package/dist/assets/smileys/2663.png +0 -0
- package/dist/assets/smileys/2665.png +0 -0
- package/dist/assets/smileys/2666.png +0 -0
- package/dist/assets/smileys/26c4.png +0 -0
- package/dist/assets/smileys/270b.png +0 -0
- package/dist/assets/smileys/270c.png +0 -0
- package/dist/assets/smileys/LICENSE.md +12 -0
- package/dist/css/style.css +489 -0
- package/dist/scripts/catlabremote.js +1 -0
- package/dist/scripts/main.js +79 -0
- package/dist/scripts/providermain.js +1 -0
- package/dist/scripts/webcontrol.js +1 -0
- package/dist/scripts/webremote.js +1 -0
- package/dist/themes/createjs/createjsassets.html +30 -0
- package/dist/themes/createjs/createjsassets.js +215 -0
- package/dist/themes/default/default.css +454 -0
- package/dist/themes/default/default.styl +144 -0
- package/dist/themes/default/reset.css +313 -0
- package/dist/themes/default/reset.styl +294 -0
- package/dist/themes/font-awesome/css/font-awesome.css +1338 -0
- package/dist/themes/font-awesome/css/font-awesome.min.css +4 -0
- package/dist/themes/font-awesome/fonts/FontAwesome.otf +0 -0
- package/dist/themes/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/dist/themes/font-awesome/fonts/fontawesome-webfont.svg +414 -0
- package/dist/themes/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/dist/themes/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/dist/themes/font-awesome/less/bordered-pulled.less +16 -0
- package/dist/themes/font-awesome/less/core.less +12 -0
- package/dist/themes/font-awesome/less/fixed-width.less +6 -0
- package/dist/themes/font-awesome/less/font-awesome.less +17 -0
- package/dist/themes/font-awesome/less/icons.less +412 -0
- package/dist/themes/font-awesome/less/larger.less +13 -0
- package/dist/themes/font-awesome/less/list.less +19 -0
- package/dist/themes/font-awesome/less/mixins.less +20 -0
- package/dist/themes/font-awesome/less/path.less +14 -0
- package/dist/themes/font-awesome/less/rotated-flipped.less +9 -0
- package/dist/themes/font-awesome/less/spinning.less +30 -0
- package/dist/themes/font-awesome/less/stacked.less +20 -0
- package/dist/themes/font-awesome/less/variables.less +381 -0
- package/dist/themes/font-awesome/scss/_bordered-pulled.scss +16 -0
- package/dist/themes/font-awesome/scss/_core.scss +12 -0
- package/dist/themes/font-awesome/scss/_fixed-width.scss +6 -0
- package/dist/themes/font-awesome/scss/_icons.scss +412 -0
- package/dist/themes/font-awesome/scss/_larger.scss +13 -0
- package/dist/themes/font-awesome/scss/_list.scss +19 -0
- package/dist/themes/font-awesome/scss/_mixins.scss +20 -0
- package/dist/themes/font-awesome/scss/_path.scss +14 -0
- package/dist/themes/font-awesome/scss/_rotated-flipped.scss +9 -0
- package/dist/themes/font-awesome/scss/_spinning.scss +30 -0
- package/dist/themes/font-awesome/scss/_stacked.scss +20 -0
- package/dist/themes/font-awesome/scss/_variables.scss +381 -0
- package/dist/themes/font-awesome/scss/font-awesome.scss +17 -0
- package/dist/themes/metro/metro.css +514 -0
- package/dist/themes/metro/metro.styl +193 -0
- package/dist/themes/metro/reset.css +316 -0
- package/dist/themes/metro/reset.styl +299 -0
- package/dist/themes/quizwitz/images/BG_3.jpg +0 -0
- package/dist/themes/quizwitz/images/HD_background_02.jpg +0 -0
- package/dist/themes/quizwitz/images/Playersaccount_V_20.jpg +0 -0
- package/dist/themes/quizwitz/images/remote_atlas_.png +0 -0
- package/dist/themes/quizwitz/remote.html +69 -0
- package/dist/themes/quizwitz/remote.js +1276 -0
- package/package.json +37 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var io,s,t,e,A,i,h,a;define("CatLab/Webremote/Tools/Net",[],function(){"use strict";return{loadJSON:function(e,t,i){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&200===n.status&&t&&t(JSON.parse(n.responseText))},n.onerror=function(e){e&&i(n,e)},n.open("GET",e,!0),n.send()}}}),define("CatLab/Webremote/Tools/Deferred",[],function(){function l(e){return"[object Array]"===Object.prototype.toString.call(e)}function c(e,t){if(l(e))for(var i=0;i<e.length;i++)t(e[i]);else t(e)}function u(e){var n="pending",s=[],o=[],r=[],a=null,i={done:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(l(arguments[e]))for(var t=arguments[e],i=0;i<t.length;i++)"resolved"===n&&t[i].apply(this,a),s.push(t[i]);else"resolved"===n&&arguments[e].apply(this,a),s.push(arguments[e]);return this},fail:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(l(arguments[e]))for(var t=arguments[e],i=0;i<t.length;i++)"rejected"===n&&t[i].apply(this,a),o.push(t[i]);else"rejected"===n&&arguments[e].apply(this,a),o.push(arguments[e]);return this},always:function(){return this.done.apply(this,arguments).fail.apply(this,arguments)},progress:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(l(arguments[e]))for(var t=arguments[e],i=0;i<t.length;i++)"pending"===n&&r.push(t[i]);else"pending"===n&&r.push(arguments[e]);return this},then:function(){1<arguments.length&&arguments[1]&&this.fail(arguments[1]),0<arguments.length&&arguments[0]&&this.done(arguments[0]),2<arguments.length&&arguments[2]&&this.progress(arguments[2])},promise:function(e){if(null==e)return i;for(var t in i)e[t]=i[t];return e},state:function(){return n},debug:function(){console.log("[debug]",s,o,n)},isRejected:function(){return"rejected"===n},isResolved:function(){return"resolved"===n},pipe:function(e,t,i){return u(function(i){c(e,function(t){"function"==typeof t?h.done(function(){var e=t.apply(this,arguments);e&&"function"==typeof e?e.promise().then(i.resolve,i.reject,i.notify):i.resolve(e)}):h.done(i.resolve)}),c(t,function(t){"function"==typeof t?h.fail(function(){var e=t.apply(this,arguments);e&&"function"==typeof e?e.promise().then(i.resolve,i.reject,i.notify):i.reject(e)}):h.fail(i.reject)})}).promise()}},h={resolveWith:function(e){if("pending"===n){n="resolved";for(var t=a=1<arguments.length?arguments[1]:[],i=0;i<s.length;i++)s[i].apply(e,t)}return this},rejectWith:function(e){if("pending"===n){n="rejected";for(var t=a=1<arguments.length?arguments[1]:[],i=0;i<o.length;i++)o[i].apply(e,t)}return this},notifyWith:function(e){if("pending"===n)for(var t=a=1<arguments.length?arguments[1]:[],i=0;i<r.length;i++)r[i].apply(e,t);return this},resolve:function(){return this.resolveWith(this,arguments)},reject:function(){return this.rejectWith(this,arguments)},notify:function(){return this.notifyWith(this,arguments)}},t=i.promise(h);return e&&e.apply(t,[t]),t}return u.when=function(){var e;if(arguments.length<2)return((e=arguments.length?arguments[0]:void 0)&&"function"==typeof e.isResolved&&"function"==typeof e.isRejected?e:u().resolve(e)).promise();for(var i=arguments,n=u(),s=i.length,o=0,r=new Array(s),t=0;t<i.length;t++)!function(e){var t;i[e].done?i[e].done(function(){r[e]=arguments.length<2?arguments[0]:arguments,++o==s&&n.resolve.apply(n,r)}).fail(function(){n.reject(arguments)}):(t=i[e],i[e]=new Deferred,i[e].done(function(){r[e]=arguments.length<2?arguments[0]:arguments,++o==s&&n.resolve.apply(n,r)}).fail(function(){n.reject(arguments)}).resolve(t))}(t);return n.promise()},u}),define("CatLab/Webremote/Collections/ServerList",["CatLab/Webremote/Tools/Deferred"],function(s){"use strict";function e(e,t){this.defaultId=e.default,this.servers=e.servers,this.connectUrl=e.connectUrl,this.selectedServerId=null,this.preferredServer=t,this.assetsUrl=e.assetsUrl}var t=e.prototype;return t.getFromToken=function(e){if(e.length<8)return{host:this.getDefault().host,token:e};var t=e.substr(0,2);if(t){t=this.getFromId(t);if(t)return{host:t.host,token:e.substr(2)}}throw new Error("Code does not correspondent to any servers.")},t.getSelectedServer=function(){var t=new s;return this.selectedServerId?t.resolve(this.getFromId(this.selectedServerId).host):this.selectBestServer().then(function(e){this.selectedServerId||(this.selectServer(e.id),t.resolve(e.host))}.bind(this)),t.promise()},t.selectBestServer=function(){var i=new s;if(this.preferredServer)for(var e=0;e<this.servers.length;e++)if(this.servers[e].id==this.preferredServer)return i.resolve(this.servers[e]),i.promise();var n=!1;return this.servers.forEach(function(t){t.discoverable&&this.measureRequestSpeed("https://"+t.host+"/info").then(function(e){console.log("[ServerList] "+t.host+" took "+e+"ms"),n||(n=!0,i.resolve(t))}.bind(this))}.bind(this)),i.promise()},t.selectServer=function(e){this.selectedServerId=e},t.measureRequestSpeed=function(e){var t=new Date,i=new s,n=new XMLHttpRequest;return n.onreadystatechange=function(){var e;4==this.readyState&&200==this.status&&(e=(new Date).getTime()-t.getTime(),i.resolve(e))},n.open("GET",e),n.send(),i.promise()},t.getConnectURL=function(){if(this.selectedServerId){var e=this.getFromId(this.selectedServerId);if(e.connectUrl)return e.connectUrl}return this.connectUrl},t.getAssetURL=function(){var e;return this.assetsUrl||((e=this.getConnectURL())?("http"!==e.substring(0,4)&&(e="https://"+e),this.assetsUrl=e+"/assets/",this.assetsUrl):void 0)},t.getConnectToken=function(e){return this.getFromId(this.selectedServerId).connectUrl?e:this.selectedServerId+e},t.getFromId=function(e){for(var t=0;t<this.servers.length;t++)if(this.servers[t].id==e)return this.servers[t];return null},t.getDefault=function(){return this.getFromId(this.defaultId)},t.serialize=function(){return{server:this.selectedServerId}},t.unserialize=function(e){this.selectServer(e.server)},e}),define("CatLab/Webremote/Config",["CatLab/Webremote/Tools/Net","CatLab/Webremote/Collections/ServerList"],function(i,e){"use strict";var t="http";return{_options:{host:"www.catlab.tv",serverlist:null,preferredServer:null,protocol:t="undefined"!=typeof window&&void 0!==window.location&&void 0!==window.location.protocol?window.location.protocol.substr(0,window.location.protocol.length-1):t,debug:!1,proxy:"",imageproxy:"",smileys:!0,assetsUrl:null,vendorPath:"/vendor/",audioSync:!1,allowAuthentication:!0},_initialized:!1,audioSyncConfig:{alphabet:"qwertyuiop",length:5,freqMin:524,freqMax:1593,freqError:25,debug:!1},set:function(e){void 0!==e&&(e.host,this._options.host=e.host,void 0!==e.protocol&&(this._options.protocol=e.protocol),void 0!==e.debug&&(this._options.debug=e.debug),void 0!==e.imageproxy&&(this._options.imageproxy=e.imageproxy),void 0!==e.proxy&&(this._options.proxy=e.proxy),void 0!==e.smileys&&(this._options.smileys=e.smileys),void 0!==e.assetsUrl&&(this._options.assetsUrl=e.assetsUrl),void 0!==e.vendorPath&&(this._options.vendorPath=e.vendorPath),void 0!==e.audioSync&&(this._options.audioSync=e.audioSync),void 0!==e.serverlist&&(this._options.serverlist=e.serverlist),void 0!==e.preferredServer&&(this._options.preferredServer=e.preferredServer),void 0!==e.allowAuthentication&&(this._options.allowAuthentication=e.allowAuthentication),void 0!==e.audioSyncConfig)&&(this.audioSyncConfig=e.audioSyncConfig)},getAll:function(){return this._options},initialize:function(t){var e;this._initialized?t():null===this._options.serverlist||"http"!==this._options.serverlist.substring(0,4)?(this._initialized=!0,t()):"json"===this._options.serverlist.substring(this._options.serverlist.length-4)?i.loadJSON(this._options.serverlist,function(e){this._initialized=!0,this._options.serverlist=e,t()}.bind(this),function(e,t){alert("Failed to connect to "+this._options.serverlist+". Game cannot start."),console.log(t)}.bind(this)):((e=document.createElement("script")).onload=function(){this._initialized=!0,this._options.serverlist=getCatLabRemoteServers(),t()}.bind(this),e.onerror=function(){alert("Failed to connect to "+this._options.serverlist+". Game cannot start.")}.bind(this),e.src=this._options.serverlist,document.head.appendChild(e))},getProtocol:function(e){var t=this._options.protocol;switch(t=void 0!==e&&e&&""===t?"http":t){case"http":case"https":break;default:t="https"}return t},getSocketURL:function(e){return this._options.host?((e=this.getProtocol(e))&&(e+=":"),e+"//"+this._options.host):"undefined"!=typeof window&&void 0!==window.location?window.location.protocol+"//"+window.location.hostname:""},getAssetsURL:function(e){var t;return this._options.assetsUrl||((t=this.getServerList())?t.getAssetURL():this.getSocketURL(e)+"/assets/")},debug:function(){return this._options.debug},getProxiedImage:function(e){return this._options.imageproxy?this._options.imageproxy+encodeURIComponent(e):e},getProxy:function(){return this._options.proxy},useSmileys:function(){return this._options.smileys},useAudioSync:function(){return this._options.audioSync},all:function(){return this._options},getAudioSyncConfig:function(){return this.audioSyncConfig},getProviderConfig:function(){var e={smileys:this.useSmileys(),audioSync:this.useAudioSync()};return this.useAudioSync()&&(e.audioSyncConfig=this.audioSyncConfig),e},getServerList:function(){return this._options.serverlist?(this.serverCollection||(this.serverCollection=new e(this._options.serverlist,this._options.preferredServer)),this.serverCollection):null},getVendorPath:function(){return this._options.vendorPath},supportsAuthentication:function(){return this._options.allowAuthentication}}}),define("CatLab/Webremote/Polyfills",[],function(){"use strict";"function"!=typeof Object.assign&&(Object.assign=function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),n=1;n<arguments.length;n++){var s=arguments[n];if(null!=s)for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(i[o]=s[o])}return i})}),define("CatLab/Webremote/Tools/Tracker",[],function(){var s=function(e,t,i,n){},t=function(e){s("Page",e,"-",0)};return{setTracker:function(e){s=e},setPageMethod:function(e){t=e},track:function(e,t,i,n){s(e,t,i,n)},page:function(e){t(e)}}}),define("CatLab/Webremote/Tools/Tools",[],function(){var s,o;return{popup:function(e,t){var i=this,n=(t=t||!1,document.createElement("iframe"));n.style.margin=0,n.style.padding=0,n.style.border=0,n.style.position="absolute",n.style.width="100%",n.style.height="100%",n.style.left=0,n.style.top=0,n.src=e,(o=document.createElement("div")).style.margin=0,o.style.padding=0,o.style.border=0,o.style.position="absolute",o.style.width="100%",o.style.height="100%",o.style.left=0,o.style.top=0,o.style.zIndex=9999,o.onclick=function(){i.closePopup()},(s=document.createElement("div")).appendChild(n),s.style.margin=0,s.style.padding=0,s.style.border=0,s.style.position="absolute",s.style.zIndex=1e4,s.style.overflow="auto",s.style.background="white",s.style.boxSizing="border-box",t?(s.style.border="0 none black",s.style.left="0",s.style.top="0",s.style.width="100%",s.style.height="100%"):(s.style.border="5px solid black",s.style.left="10%",s.style.top="10%",s.style.width="80%",s.style.height="80%"),document.body.appendChild(o),document.body.appendChild(s)},oauth2PopupMethod:function(e,t){return window.open(e)},oauth2Popup:function(e,t){return this.oauth2PopupMethod(e,t)},closePopup:function(){s&&s.parentNode.removeChild(s),o&&o.parentNode.removeChild(o)},setOauth2Popup:function(e){return this.oauth2PopupMethod=e,this},sanitize:function(e){var t;return null==e?null:(t={"&":"&","<":"<",">":">",'"':""","'":"'"},String(e).replace(/[&<>"']/g,function(e){return t[e]}))},nl2br:function(e,t){return null==e?"":(e+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+(t||void 0===t?"<br />":"<br>")+"$2")},shuffle:function(e){for(var t,i,n=e.length-1;0<n;n--)t=Math.floor(Math.random()*(n+1)),i=e[n],e[n]=e[t],e[t]=i},getUuid:function(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)},findIndex:function(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i;return-1},getConnectTokenForDisplay:function(e){return null===e?null:e.length%4==0?this.injectFillerInString(e,4," "):(e.length,this.injectFillerInString(e,3," "))},injectFillerInString:function(e,t,i){return e.match(new RegExp(".{1,"+t+"}","g")).join(i)}}}),define("CatLab/Webremote/Tools/Cookies",[],function(){var t={setCookie:function(e,t,i){return this.setItem(e,t,i)},getCookie:function(e){return this.getItem(e)},eraseCookie:function(e){return this.removeItem(e)},getItem:function(e){if("undefined"!=typeof document)return e&&this.hasOwnProperty(e)?unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"),"$1")):null},key:function(e){if("undefined"!=typeof document)return unescape(document.cookie.replace(/\s*\=(?:.(?!;))*$/,"").split(/\s*\=(?:[^;](?!;))*[^;]?;\s*/)[e])},setItem:function(e,t,i){var n,s;e&&"undefined"!=typeof document&&(n="",i&&((s=new Date).setTime(s.getTime()+Math.round(24*i*60*60*1e3)),n="; expires="+s.toUTCString()),document.cookie=escape(e)+"="+escape(t)+"; expires="+n+"; path=/; SameSite=Strict;",this.updateLength())},length:0,removeItem:function(e){e&&this.hasOwnProperty(e)&&"undefined"!=typeof document&&(document.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; SameSite=Strict;",this.length--)},hasOwnProperty:function(e){if("undefined"!=typeof document)return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},updateLength:function(){var e;"undefined"!=typeof document&&document.cookie&&(e=document.cookie.match(/\=/g),t.length=e?e.length:0)}};return t.updateLength(),t}),define("CatLab/Webremote/Tools/Smileys",["CatLab/Webremote/Config","CatLab/Webremote/Tools/Tools"],function(i,n){function e(e){this.provider=e,this.smileyKeys=["1f98d","1f61c","1f3b7","1f32e","1f621","1f61b","1f98f","1f34c","1f596","1f34d","2660","1f61a","2602","2665","1f0cf","1f427","1f918","1f98b","1f9df","1f344","1f983","1f338","2618","1f36a","1f383","270c","1f913","1f40d","1f910","1f57a","1f641","1f36c","1f579","1f333","1f40b","1f617","1f42b","1f60d","1f42c","1f339","1f414","1f42d","1f349","1f92e","1f437","1f367","1f62c","1f428","1f994","1f911","1f369","1f9d0","1f378","1f9dd-2640","1f34e","2666","1f47d","1f60a","1f60f","1f43b","1f47b","1f425","1f919","1f346","1f4a8","1f43f","1f37a","1f40c","1f334","1f4a3","1f42e","1f379","1f42f","1f417","1f9c0","1f601","1f41a","1f61d","1f997","26c4","1f34b","1f430","1f47a","1f37c","1f3b1","1f95d","1f433","1f41b","1f37f","1f36d","1f60e","1f354","1f63b","1f680","1f996","1f924","1f341","1f43a","1f922","1f436","1f43c","1f332","1f31a","1f335","1f336","2623","1f31e","1f63d","1f421","1f438","1f63a","1f32d","1f986","1f388","1f41e","1f98c","1f91e","1f64a","1f638","1f3b5","1f43d","1f363","1f373","1f435","1f628","1f635","1f377","1f47e","1f984","1f3a9","1f439","1f925","1f929","1f951","1f4a9","1f921","1f92a","1f96a","1f41f","1f419","1f420","2663","1f40a","1f989","1f91f","1f63c","1f3f3-1f308","1f98a","1f431","1f920","1f41d","1f608","1f612","1f987","1f3ba","1f355","270b","1f98e","1f41c","1f917"],this.taken={},this.takenAmount=0,this.images={},this.playerKnowsAboutNonUniqueSmileys={},this.randomSmileys=this.smileyKeys.slice(0),n.shuffle(this.randomSmileys)}var t=e.prototype;return t.shouldHaveUniqueSmileys=function(){return this.takenAmount<this.smileyKeys.length/3},t.setTakenSmileys=function(e){this.taken=e},t.getTakenSmileys=function(e){if(!this.shouldHaveUniqueSmileys())return{};e=this.identifierToText(e);var t,i={};for(t in this.taken)this.taken.hasOwnProperty(t)&&this.taken[t]!==e&&(i[t]=this.taken[t]);return i},t.getRandom=function(e){for(var t=null;null===t&&this.randomSmileys;)if(t=this.randomSmileys.shift(),this.reserve(t,e)||(t=null),0===this.randomSmileys.length)return this.randomSmileys=this.smileyKeys.slice(0),n.shuffle(this.randomSmileys),this.randomSmileys.shift();return t},t.reserve=function(e,t){return this.isExternalSmiley(e)?(this.unreserve(t),!0):(t=this.identifierToText(t),void 0!==this.taken[e]&&this.taken[e]===t?(this.taken[e]=t,!0):!!this.isAvailable(e)&&(this.unreserve(t),this.taken[e]=t,this.takenAmount++,!0))},t.unreserve=function(e){for(var t in e=this.identifierToText(e),this.taken)this.taken.hasOwnProperty(t)&&this.taken[t]===e&&(this.taken[t]=null,delete this.taken[t],this.takenAmount--)},t.isAvailable=function(e){return!this.shouldHaveUniqueSmileys()||!!this.isExternalSmiley(e)||void 0===this.taken[e]||null===this.taken[e]},t.identifierToText=function(e){return JSON.stringify(e)},t.isExternalSmiley=function(e){return"http"===e.substr(0,4)},t.getUrl=function(e){return null===e?null:this.isExternalSmiley(e)?e:i.getAssetsURL()+"smileys/"+e+".png"},t.getHtml=function(e){return null===e?null:'<span class="smiley" style="width: 64px; height: 64px; display: block; background-image: url(\''+this.getUrl(e)+"');\"></span>"},t.getElement=function(e){var t;return null===e?null:((t=document.createElement("div")).innerHTML=this.getHtml(e),t.firstChild)},t.getImage=function(e){var t;return null===e?null:(void 0===this.images[e]&&((t=new Image).crossOrigin="anonymous",t.src=i.getProxiedImage(this.getUrl(e)),this.images[e]=t),this.images[e])},t.refreshTakenSmileys=function(e){this.shouldHaveUniqueSmileys()?e.emit("smileys:taken",{smileys:this.getTakenSmileys(e.getIdentifier())}):this.playerKnowsAboutNonUniqueSmileys[this.getStringIdentifier(e)]},t.getStringIdentifier=function(e){return e.type+":"+e.id},e}),define("CatLab/Webremote/Tools/Preloader",["../Config","CatLab/Webremote/Tools/Deferred"],function(t,o){function i(e){this.provider=e,this.provider.on("file:preload",function(e){e&&e.url&&this.preloadClientFile(e.url)}.bind(this)),this.urlMap={}}var e=i.prototype;return e.preload=function(t){if(Array.isArray(t)){for(var e=new o,i=[],n=0;n<t.length;n++)i.push(this.preload(t[n]));return o.when.apply(o,i).then(function(){e.resolve(Array.prototype.slice.call(arguments))}),e.promise()}var s=new o;return this.provider.emit("file:preload",{url:t},function(e){this.urlMap[t]=e.url,s.resolve(e)}.bind(this)),s.promise()},e.getPreloadedUrl=function(e){return this.urlMap[e]},e.preloadClientFile=function(e){void 0===this.urlMap[e]&&(e.toLowerCase().indexOf("http")<0&&(e=t.getProtocol()+":"+e),this.urlMap[e]=document.createElement("img"),this.urlMap[e].src=e)},e.serialize=function(){return{urlMap:this.urlMap}},i.unserialize=function(e,t){e=new i(e);return void 0!==t&&void 0!==t.urlMap&&(e.urlMap=t.urlMap),e},i}),define("CatLab/Webremote/Tools/Eventable",["CatLab/Webremote/Tools/Tools"],function(n){"use strict";function e(){}var s=0,t=e.prototype;return t.initializeEventable=function(){this._eventableEvents=[]},t.trigger=function(e){this.eventableTrigger.apply(this,arguments)},t.eventableTrigger=function(e){if("string"!=typeof e)throw new Error("eventableTrigger must be a string");if(void 0!==this._eventableEvents){var t,i=Array.prototype.slice.call(arguments);for(t in i.push(i.shift()),this._eventableEvents)this._eventableEvents.hasOwnProperty(t)&&this.eventMatches(e,t)&&this._eventableEvents[t].slice().forEach(function(e){try{e.method.apply(e.scope,i)}catch(e){console.error(e)}}.bind(this))}},t.eventMatches=function(e,t){return"*"===t||e===t},t.on=function(e,t,i){void 0===this._eventableEvents&&(this._eventableEvents={}),void 0===this._eventableEvents[e]&&(this._eventableEvents[e]=[]),s++,this._eventableEvents[e].push({id:s,method:t,scope:void 0!==i?i:this});var n=[e,s];return{id:n,name:e,method:t,unbind:function(){this.off(null,{id:n,name:e})}.bind(this)}},t.once=function(e,t,i){var n=this.on(e,function(){n.unbind(),t.apply(i,arguments)});return n},t.off=function(e,t){if(void 0!==e||void 0!==t)if(void 0===e||void 0!==t){if(e=t.name,t=t.id,void 0===this._eventableEvents[e])return null;var i=n.findIndex(this._eventableEvents[e],function(e){return e.id=t});0<=i&&(this._eventableEvents[e]=this._eventableEvents[e].splice(i,1))}else this._eventableEvents[e]=[];else this._eventableEvents=[]},t.clearEvents=function(){this.clearEventableEvents()},t.clearEventableEvents=function(){this._eventableEvents={}},e}),define("CatLab/Webremote/Models/User",["jquery","CatLab/Webremote/Config"],function(e,i){return function(e){this.accessToken=e,this.name=null,this.avatar=null,this.id=null,this.image=null,this.imageCallbacks=[],this.imageLoaded=!1,this.getAccessToken=function(){return this.accessToken},this.setId=function(e){this.id=e},this.getId=function(){return this.id},this.setName=function(e){this.name=e},this.getName=function(){return this.name},this.setAvatar=function(e){var t=this;this.avatar=e,this.imageLoaded=!1,this.image=new Image,this.image.crossOrigin="anonymous",this.image.onload=function(){t.afterImageLoad()},this.image.src=i.getProxiedImage(this.avatar)},this.getAvatar=function(){return this.avatar},this.getAvatarSmiley=function(e){var t=this.getAvatar();return t?(t=t.split("?")[0],t+="?shape=circle&size=64&borderWidth=4",e&&(t+="&borderColor="+e.substr(1)),t):null},this.afterImageLoad=function(){this.imageLoaded=!0;for(var e=0;e<this.imageCallbacks.length;e++)this.imageCallbacks[e](this.image);this.imageCallbacks=[]},this.getImage=function(e){this.imageLoaded?e(this.image):this.imageCallbacks.push(e)}}}),define("CatLab/Webremote/Tools/Storage",["CatLab/Webremote/Tools/Cookies"],function(e){var t={clean:function(){if(this.isSupported())for(var e=Object.keys(window.localStorage),t=0;t<e.length;t++)this.get(e)},get:function(e,t){if(void 0===t&&(t=function(){}),this.isSupported())try{var i,n=window.localStorage.getItem(e);n?void 0!==(n=JSON.parse(n)).expires?(i=Date.now(),n.expires<i?(this.delete(e),t(null)):t(n.content)):t(n):t(null)}catch(e){t(null),console.log(e)}else t(null)},add:function(t,i,n,s){var o=this;n=n||function(){},this.isSupported()?this.get(t,function(e){(e=null!=e&&""!==e?e:[]).push(i),o.set(t,e,n,s)}):n(null)},set:function(e,t,i,n){if(void 0===i&&(i=function(){}),this.isSupported()){void 0===n&&(n=31536e6);try{var s=Date.now();s+=n,window.localStorage.setItem(e,JSON.stringify({expires:s,content:t}))}catch(e){console.log(e)}i()}else i(null)},delete:function(e){this.isSupported()&&window.localStorage.removeItem(e)},remove:function(n,s){var o;this.isSupported()&&(o=this).get(n,function(e){null!=e&&""!=e||(e=[]);for(var t=JSON.stringify(s),i=0;i<e.length;i++)if(t===JSON.stringify(e[i]))return e.splice(i,1),void o.set(n,e)})},isSupported:function(){if("undefined"==typeof window)return!1;try{if(void 0===window.localStorage)return!1}catch(e){return console.log(e),!1}return!0}};try{t.clean()}catch(e){console.error(e)}return t}),define("CatLab/Webremote/Collections/AuthenticatedUsers",["CatLab/Webremote/Models/User","CatLab/Webremote/Tools/Storage","CatLab/Webremote/Tools/Eventable"],function(i,s,e){function t(){this.initializeEventable()}var o,r,n=[],e=t.prototype=new e;return e.initialize=function(e,t){o=t,r=e;var n=this;s.get("users",function(i){null!==i&&s.get("currentuser",function(t){for(var e=0;e<i.length;e++)n.addFromAccessToken(i[e].access_token,function(e){e&&t&&e.getAccessToken()===t&&void 0!==r.setUser&&r.setUser(e)})})})},e.addFromAccessToken=function(t,i){i=i||function(){};var n=this;o.profile(t,function(e){e?(e=n.add(t,e.user),i(e)):s.remove("users",{access_token:t})})},e.add=function(e,t){e=new i(e);return e.setId(t.id),e.setName(t.username),e.setAvatar(t.avatar),function(e){for(var t=0;t<n.length;t++)if(n[t].getId()==e.getId())return n[t]=e;n.push(e)}(e),this.trigger("update"),e},e.remove=function(e){for(var t=0;t<n.length;t++)if(n[t].getId()==e.getId())return void n.splice(t,1)},e.getFromId=function(e){for(var t=0;t<n.length;t++)if(n[t].getId()==e)return n[t];return null},e.getAll=function(){return n},new t}),define("CatLab/Webremote/Controllers/OAuth2",["jquery","CatLab/Webremote/Tools/Tools","CatLab/Webremote/Tools/Deferred","CatLab/Webremote/Tools/Eventable","CatLab/Webremote/Collections/AuthenticatedUsers","CatLab/Webremote/Tools/Storage"],function($,Tools,Deferred,Eventable,Users,Storage){var url,client_id,authorization,profile_url,avatar_url,callbacks=[],initialized=!1,afterInit=[],redirect,events=[],etPhoneHome=null;function OAuth2(){this.initializeEventable()}var p=OAuth2.prototype=new Eventable;return p.initialize=function(e){url=(e=e||{}).authorization||"https://quizted.catlab.eu/oauth2/authorize",client_id=e.client_id||"none",authorization=e.authorization||"default",redirect=e.redirect||"",profile_url=e.profile||"",avatar_url=e.profile+"/avatar",initialized=!0;var t=this;if("undefined"!=typeof window){function i(e){t.onMessage(e)}var n;if(window.addEventListener){for(;n=events.pop();)removeEventListener("message",n);addEventListener("message",i,!1)}else{for(;n=events.pop();)detachEvent("onmessage",n);attachEvent("onmessage",i)}events.push(i)}},p.setRedirectUrl=function(e,t){this.redirectHost=e,this.redirectUrl=e+t},p.getAuthorizeURL=function(){var e=url+"?client_id="+encodeURIComponent(client_id)+"&authorization="+encodeURIComponent(authorization)+"&response_type=token&redirect_uri="+encodeURIComponent(redirect)+"&reset=1&state=login";return void 0!==this.redirectUrl?this.redirectUrl+"?url="+encodeURIComponent(e):e},p.onMessage=function(e){"I must've called a thousand times"!=e.data&&(e="string"==typeof e.data?JSON.parse(e.data):e.data)&&e.catlabremote&&"user:authenticated"==e.event&&this.addAccessToken(e.access_token)},p.addAccessToken=function(n){var e=function(e){var t,i=Users.add(n,e.user);for(Storage.add("users",{access_token:n}),Tools.closePopup();t=callbacks.shift();)t(i);this.trigger("update")}.bind(this);this.call(profile_url,n,e)},p.call=function(url,accessToken,callback){var parsedurl=url+"?access_token="+accessToken,xmlhttp;"undefined"!=typeof window&&(xmlhttp=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),xmlhttp.onreadystatechange=function(){4==xmlhttp.readyState&&200!=xmlhttp.status&&callback(null),4==xmlhttp.readyState&&200==xmlhttp.status&&callback(eval("("+xmlhttp.responseText+")"))},xmlhttp.open("GET",parsedurl,!0),xmlhttp.send())},p.profile=function(e,t){this.call(profile_url,e,t)},p.changeAvatar=function(t,e){var i;if(t.getAccessToken())return(i=new FormData).append("avatar",e.files[0]),$.ajax({type:"POST",url:avatar_url,data:i,contentType:!1,processData:!1,headers:{Authorization:"Bearer "+t.getAccessToken()},success:function(e){t.setAvatar(e.url)}})},p.link=function(t){var i=new Deferred,e={},e=("object"==typeof(t=void 0===t?{}:t)&&(t=(e=t).callback||function(){}),e.fullscreen||!1),n=(etPhoneHome&&clearInterval(etPhoneHome),this.getAuthorizeURL()),s=Tools.oauth2Popup(n,e);return s&&(etPhoneHome=setInterval(function(){s.postMessage("Hello from the other side","*")}.bind(this),1e3)),callbacks.push(function(e){t(e),i.resolve(e)}),i.promise()},p.onInit=function(e){afterInit.push(e)},p.onAdds=function(){for(var e=0;e<afterInit.length;e++)afterInit[e]()},p.getParamsFromHash=function(e){if("undefined"!=typeof window)return e=(e=e||window.location.hash).slice(1),(e=decodeURIComponent(e)).split("&").reduce(function(e,t){return e[(t=t.split("="))[0]]=t[1],e},{})},p.finish=function(){var e='{"catlabremote":1,"event":"user:authenticated","access_token":"'+this.getParamsFromHash().access_token+'"}';console.log(e),setTimeout(function(){window.opener&&window.opener.postMessage(e,"*"),window.parent&&window.parent.postMessage(e,"*"),void 0!==window.dialogArguments&&window.dialogArguments.opener&&window.dialogArguments.opener.postMessage(e,"*"),setTimeout(function(){etPhoneHome&&clearInterval(etPhoneHome),window.close()},1)},1)},new OAuth2}),define("CatLab/Webremote/Views/Popups/BasePopup",["jquery"],function(n){function e(){this.scrollable=!1}var t=e.prototype;return t.render=function(e){this.popupContainer=document.createElement("div"),this.popupContainer.className="catlab-popup-container";var t=document.createElement("div"),t=(t.className="overlay",this.popupContainer.appendChild(t),this.container=document.createElement("div"),this.container.className="popup",this.popupContainer.appendChild(this.container),n(this.container).click(function(e){e.stopPropagation()}),this.content=document.createElement("div"),this.container.appendChild(this.content),document.createElement("p")),i=(t.className="close",document.createElement("a"));i.href="javascript:void(0)",i.innerHTML="<span>Close</span>",i.onclick=function(){this.close()}.bind(this),t.appendChild(i),this.container.appendChild(t),e.appendChild(this.popupContainer),this.scrollable&&n(this.content).addClass("scrollable"),this.renderContent(this.content)},t.renderContent=function(){},t.close=function(){this.popupContainer.parentNode.removeChild(this.popupContainer)},e}),define("CatLab/Webremote/Views/User",["CatLab/Webremote/Controllers/OAuth2","jquery"],function(i,n){return function(d){this.render=function(e,t,i){t=t||[];var n,s=d.getName(),o=document.createElement("div"),r=(o.className="catlab-user",document.createElement("div")),r=((this.avatardiv=r).className="catlab-avatar",o.appendChild(r),this.renderAvatar(),void 0!==i&&(r.onclick=i),document.createElement("div")),a=(r.className="catlab-info",o.appendChild(r),document.createElement("p"));void 0!==i?((n=document.createElement("a")).innerHTML=s,n.onclick=i,a.appendChild(n)):(a.innerHTML=s,r.appendChild(a)),r.appendChild(a);var h,l,c=document.createElement("ul");c.className="catlab-actions";for(var u=0;u<t.length;u++)(h=document.createElement("li")).className=t[u].token,c.appendChild(h),(l=document.createElement("a")).onclick=t[u].click,l.innerHTML=t[u].text,l.href="javascript:void(0)",h.appendChild(l);r.appendChild(c),e.innerHTML="",e.appendChild(o);i=document.createElement("div");i.className="clearer",o.appendChild(i)},this.renderAvatar=function(){var e=d.getAvatar(),t=document.createElement("img");t.src=e,t.alt="User avatar",n(this.avatardiv).html(t)},this.enableAvatarUpload=function(e){var t=document.createElement("input");t.type="file",t.accept="image/*",this.avatarFileInput=t,n(t).on("change",function(){n(this.avatardiv).addClass("loading"),n.when(i.changeAvatar(d,t)).then(function(){n(this.avatardiv).removeClass("loading"),this.renderAvatar(),e.setUser(d)}.bind(this))}.bind(this)),n(this.avatardiv).click(function(){t.click()})},this.uploadAvatar=function(){this.avatarFileInput&&this.avatarFileInput.click()}}}),define("CatLab/Webremote/Views/Popups/AuthenticationPopup",["CatLab/Webremote/Views/Popups/BasePopup","CatLab/Webremote/Controllers/OAuth2","CatLab/Webremote/Collections/AuthenticatedUsers","CatLab/Webremote/Views/User","CatLab/Webremote/Tools/Storage","CatLab/Webremote/Tools/Tracker"],function(e,h,l,c,u,d){return function(t){function e(){h.link(function(e){s.updateUsers(),s.selectUser(e)})}h.on("update",function(){this.updateUsers()}.bind(this));var s=this,i=document.createElement("div"),n=(i.className="catlab-popup-container",document.createElement("div")),n=(n.className="overlay",i.appendChild(n),document.createElement("div")),o=(n.className="popup",i.appendChild(n),n.innerHTML="<h2>Select account</h2>",document.createElement("ul")),r=(o.className="userlist",n.appendChild(o),document.createElement("div")),r=(r.className="clearer",n.appendChild(r),document.createElement("p")),a=(r.className="connect",document.createElement("a")),r=(a.href="javascript:void(0)",a.innerHTML='<span class="new-user">Connect new user</span>',a.onclick=function(){e()},r.appendChild(a),n.appendChild(a),document.createElement("p")),a=(r.className="close",document.createElement("a"));a.href="javascript:void(0)",a.innerHTML="<span>Close</span>",a.onclick=function(){s.close()},r.appendChild(a),n.appendChild(r),this.selectUser=function(e){t.setUser(e),s.close(),d.track("Click","Select user","AuthenticationPopup")},this.updateUsers=function(){o.innerHTML="";for(var e=l.getAll(),t=0;t<e.length;t++)!function(e,t){var i=document.createElement("li"),n=[{token:"select",text:"select",click:function(){s.selectUser(t)}},{token:"logout",text:"logout",click:function(){l.remove(t),u.remove("users",{access_token:t.getAccessToken()}),s.updateUsers(),d.track("Click","Logout","AuthenticationPopup")}}];new c(t).render(i,n,function(){s.selectUser(t)}),e.appendChild(i)}(o,e[t])},this.close=function(){i.parentNode.removeChild(i),d.track("Click","Close popup","AuthenticationPopup")},this.connect=function(){d.track("Click","Connect new","AuthenticationPopup"),e()},this.render=function(e){e.appendChild(i),this.updateUsers()},this.setLoginUrl=function(e){console.log(e)}}}),define("CatLab/Webremote/Views/Popups/SelectSmileyPopup",["CatLab/Webremote/Views/Popups/BasePopup"],function(e){function t(e){this.Webremote=e,this.scrollable=!0}e=t.prototype=new e;return e.renderContent=function(e){$(e).addClass("smileys-popup");var t,i=$('<ul class="smileys"></ul>'),n=($(e).append(i),this.Webremote.smileys.smileyKeys.slice());this.Webremote.getUser()&&this.Webremote.getUser().getAvatar()&&(t=this.Webremote.getUser().getAvatarSmiley(this.Webremote.color))&&n.unshift(t);for(var s=0;s<n.length;s++)this.renderSmiley(i,n[s]);$(e).append('<div class="clearer"></div>')},e.renderSmiley=function(e,t){var i=$("<li>");i.append(this.Webremote.smileys.getElement(t)),this.Webremote.smileys.isAvailable(t)||i.addClass("unavailable"),this.Webremote.getSmiley()===t&&i.addClass("selected"),i.click(function(){this.selectSmiley(t),e.find(".selected").removeClass("selected"),i.addClass("selected"),this.close()}.bind(this)),e.append(i)},e.selectSmiley=function(e){this.Webremote.selectSmiley(e)},t}),define("CatLab/Webremote/Views/Blocks/CurrentUser",["CatLab/Webremote/Views/User","CatLab/Webremote/Collections/AuthenticatedUsers","CatLab/Webremote/Tools/Storage","CatLab/Webremote/Tools/Tracker"],function(o,r,a,h){return function(s){this.render=function(e){var t,i,n;e.innerHTML="",s.canAuthenticate()&&(n=s.getUser(),(t=document.createElement("div")).className="overlay player-color-background",e.appendChild(t),(t=document.createElement("div")).className="content",t.className+=" player-color-border",e.appendChild(t),n?(e=[{token:"switch",text:"Switch account",click:function(){s.showAuthenticationPopup(),h.track("Click","Switch account","CurrentUser")}},{token:"upload",text:"Upload photo",click:function(){i.uploadAvatar()}},{token:"logout",text:"Logout",click:function(){var e=s.getUser();r.remove(e),s.setUser(null),a.remove("users",{access_token:e.getAccessToken()}),h.track("Click","Logout","CurrentUser")}}],(i=new o(n)).render(t,e),i.enableAvatarUpload(s)):((n=document.createElement("p")).className="catlab-not-loggedin",(e=document.createElement("a")).href="javascript:void(0);",e.innerHTML="Login",e.onclick=function(){s.showAuthenticationPopup(0===r.getAll().length),h.track("Click","Login","CurrentUser")},n.appendChild(e),t.appendChild(n)))}}}),!function(){"use strict";var f={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function g(e){for(var t,i,n,s,o,r,a,h=function(e){if(m[e])return m[e];for(var t,i=e,n=[],s=0;i;){if(null!==(t=f.text.exec(i)))n.push(t[0]);else if(null!==(t=f.modulo.exec(i)))n.push("%");else{if(null===(t=f.placeholder.exec(i)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){s|=1;var o=[],r=t[2],a=[];if(null===(a=f.key.exec(r)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(a[1]);""!==(r=r.substring(a[0].length));){if(null===(a=f.key_access.exec(r))&&null===(a=f.index_access.exec(r)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(a[1])}t[2]=o}else s|=2;if(3===s)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}i=i.substring(t[0].length)}return m[e]=n}(e),l=arguments,c=1,u=h.length,d="",p=0;p<u;p++)if("string"==typeof h[p])d+=h[p];else if("object"==typeof h[p]){if((n=h[p]).keys)for(t=l[c],i=0;i<n.keys.length;i++){if(null==t)throw new Error(g('[sprintf] Cannot access property "%s" of undefined value "%s"',n.keys[i],n.keys[i-1]));t=t[n.keys[i]]}else t=n.param_no?l[n.param_no]:l[c++];if(f.not_type.test(n.type)&&f.not_primitive.test(n.type)&&t instanceof Function&&(t=t()),f.numeric_arg.test(n.type)&&"number"!=typeof t&&isNaN(t))throw new TypeError(g("[sprintf] expecting number but found %T",t));switch(f.number.test(n.type)&&(r=0<=t),n.type){case"b":t=parseInt(t,10).toString(2);break;case"c":t=String.fromCharCode(parseInt(t,10));break;case"d":case"i":t=parseInt(t,10);break;case"j":t=JSON.stringify(t,null,n.width?parseInt(n.width):0);break;case"e":t=n.precision?parseFloat(t).toExponential(n.precision):parseFloat(t).toExponential();break;case"f":t=n.precision?parseFloat(t).toFixed(n.precision):parseFloat(t);break;case"g":t=n.precision?String(Number(t.toPrecision(n.precision))):parseFloat(t);break;case"o":t=(parseInt(t,10)>>>0).toString(8);break;case"s":t=String(t),t=n.precision?t.substring(0,n.precision):t;break;case"t":t=String(!!t),t=n.precision?t.substring(0,n.precision):t;break;case"T":t=Object.prototype.toString.call(t).slice(8,-1).toLowerCase(),t=n.precision?t.substring(0,n.precision):t;break;case"u":t=parseInt(t,10)>>>0;break;case"v":t=t.valueOf(),t=n.precision?t.substring(0,n.precision):t;break;case"x":t=(parseInt(t,10)>>>0).toString(16);break;case"X":t=(parseInt(t,10)>>>0).toString(16).toUpperCase()}f.json.test(n.type)?d+=t:(!f.number.test(n.type)||r&&!n.sign?a="":(a=r?"+":"-",t=t.toString().replace(f.sign,"")),s=n.pad_char?"0"===n.pad_char?"0":n.pad_char.charAt(1):" ",o=n.width-(a+t).length,o=n.width&&0<o?s.repeat(o):"",d+=n.align?a+t+o:"0"===s?a+o+t:o+a+t)}return d}function e(e,t){return g.apply(null,[e].concat(t||[]))}var m=Object.create(null);"undefined"!=typeof exports&&(exports.sprintf=g,exports.vsprintf=e),"undefined"!=typeof window&&(window.sprintf=g,window.vsprintf=e,"function"==typeof define)&&define.amd&&define("sprintf",[],function(){return{sprintf:g,vsprintf:e}})}(),define("CatLab/Webremote/Tools/Translator",["sprintf"],function(t){function e(){this.translator=null}var i,n,s=e.prototype;return s.setTranslator=function(e){this.translatorScope=this,"function"==typeof e?this.translator=e:("function"==typeof e.t?this.translator=e.t:(e._,this.translator=e._),this.translatorScope=e)},s.t=function(e){if(this.translator)return this.translator.apply(this.translatorScope,arguments);for(i=[],n=1;n<arguments.length;n++)i.push(arguments[n]);return t.vsprintf(e,i)},new e}),define("CatLab/Webremote/Views/Blocks/CurrentSmiley",["jquery","CatLab/Webremote/Tools/Translator","CatLab/Webremote/Tools/Deferred"],function(t,i,e){"use strict";function n(e,t,i){this.Webremote=e,this.canSwitch=void 0!==t&&!!t,this.canDrag=void 0!==i&&!!i}n.initialize=function(){return n.isInitialized||(n.isInitialized=new e,require(["jquery-ui","jquery-ui-touch-punch"],function(e,t){n.isInitialized.resolve()})),n.isInitialized.promise()}.bind(this);var s=n.prototype;return s.setSmiley=function(e){n.initialize().then(function(){if(this.selector&&(this.selector.html(this.Webremote.smileys.getElement(e)),this.canSwitch&&this.selector.append('<p class="switch"><a href="javascript:void(0)">'+i.t("Switch")+"</a></p>"),this.canDrag))try{var s=null;t(this.container).find(".smiley").css({zIndex:10}).draggable({start:function(e,t){s=t.position,this.originalOffset=$(t.helper).offset()}.bind(this),stop:function(e,t){var i=t.position,n=this.getDistance(s,i);10<n?(i=this.getAngle(s,i),this.slingshot(i,n,t.helper)):this.Webremote.showSmileyPopup()}.bind(this)})}catch(e){console.log(e)}}.bind(this))},s.getMaxDistance=function(){return this.selector?$(window).height()-this.selector.offset().top:200},s.getDistance=function(e,t){var i=e.left-t.left,e=e.top-t.top;return Math.sqrt(i*i+e*e)},s.getAngle=function(e,t){return Math.atan2(t.top-e.top,t.left-e.top)},s.slingshot=function(e,t,i){var n=Math.min(1,t/this.getMaxDistance());0<Math.sin(e-Math.PI)?i.animate({left:0,top:0,opacity:1},1e3):(t=1.5*Math.max(this.originalOffset.left,this.originalOffset.top),i.animate({left:Math.cos(e-Math.PI)*t,top:Math.sin(e-Math.PI)*t},1e3,"swing",function(){setTimeout(function(){i.css({left:-1*parseInt(i.css("left"))}),i.animate({left:0,top:0},1e3)}.bind(this),3e3*n)}.bind(this)),setTimeout(function(){this.Webremote.emit("smileys:slingshot",{angle:e,speed:n})}.bind(this),800))},s.render=function(e){n.initialize().then(function(){this.container=$(e),this.canSwitch||this.canDrag?this.selector=$('<div class="smiley-selector"></div>'):this.selector=$('<div class="smiley-view"></div>'),this.selector.html('<div class="placeholder"></div>'),this.container.html(this.selector),this.canSwitch&&($(this.container).off("click"),$(this.container).click(function(){this.Webremote.showSmileyPopup()}.bind(this)))}.bind(this))},n}),define("CatLab/Webremote/Tools/HashParser",[],function(){return{getParameters:function(){function e(e){return decodeURIComponent(e.replace(n," "))}for(var t,i={},n=/\+/g,s=/([^&;=]+)=?([^&;]*)/g,o=window.location.hash.substring(1);t=s.exec(o);)i[e(t[1])]=e(t[2]);return i},getParameter:function(e){var t=this.getParameters();return void 0!==t[e]?t[e]:null},clear:function(){history.pushState("",document.title,window.location.pathname+window.location.search)}}}),define("CatLab/Webremote/Views/Alert",[],function(){return function(e,t){t=t||function(){},alert(e),t()}}),define("CatLab/Webremote/Views/Welcome",["CatLab/Webremote/Controllers/OAuth2","CatLab/Webremote/Views/User","CatLab/Webremote/Tools/Storage","CatLab/Webremote/Tools/Tracker"],function(e,t,i,o){return function(e){var t=this,i=document.createElement("div"),n=(i.className="catlab-popup-container",document.createElement("div")),n=(n.className="overlay",i.appendChild(n),document.createElement("div")),e=(n.className="popup thanks",i.appendChild(n),n.innerHTML=e,document.createElement("a")),s=(e.innerHTML="Start playing",e.onclick=function(){t.close()},e.href="javascript:void(0)",document.createElement("p"));s.appendChild(e),s.className="playnow",n.appendChild(s),this.close=function(){i.parentNode.removeChild(i),o.track("Click","Close popup","WelcomePopup")},this.render=function(e){e.appendChild(i)}}}),define("CatLab/Webremote/Views/ConnectionTrouble",["CatLab/Webremote/Tools/Translator"],function(e){function t(){this.visible=!1,this.div=null,this.timeoutTillShow=3e3,this.showTimeout=null,this.message=null}var i=t.prototype;return i.show=function(){this.visible||(this.visible=!0,this.div)||(this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),setTimeout(function(){this.div||this.visible&&(this.showTimeout=null,this.div=document.createElement("div"),document.body.appendChild(this.div),this.div.style.position="absolute",this.div.style.right="10px",this.div.style.top="10px",this.div.style.width="350px",this.div.style.padding="10px",this.div.style.border="1px solid red",this.div.style.background="black",this.div.style.zIndex="100000",this.div.style.textAlign="center",this.div.style.color="white",this.div.style.font="Sans-serif",this.div.style.fontSize="15px",this.message?this.text(this.message):this.text(e.t("Connection lost")))}.bind(this),this.timeoutTillShow))},i.text=function(e){this.message=e,this.div&&(this.div.innerHTML="<p>"+e+"</p>")},i.hide=function(){this.visible=!1,this.div&&this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.showTimeout&&clearTimeout(this.showTimeout),this.message=null,this.div=null,this.showTimeout=null},t}),define("CatLab/Webremote/Views/GamePaused",["CatLab/Webremote/Tools/Translator"],function(e){function t(){this.visible=!1,this.div=null,this.timeoutTillShow=1,this.showTimeout=null,this.message=null}var i=t.prototype;return i.show=function(){this.visible||(this.visible=!0,this.div)||(this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),setTimeout(function(){this.div||this.visible&&(this.showTimeout=null,this.div=document.createElement("div"),document.body.appendChild(this.div),this.div.style.position="fixed",this.div.style.right="0",this.div.style.top="0",this.div.style.width="100%",this.div.style.height="100%",this.div.style.padding="0",this.div.style.background="black",this.div.style.zIndex="100000",this.div.style.textAlign="center",this.div.style.color="white",this.div.style.font="Sans-serif",this.div.style.fontSize="2em",this.div.style.opacity=.9,this.message?this.text(this.message):this.text(e.t("Please wait, the game is paused.")))}.bind(this),this.timeoutTillShow))},i.text=function(e){this.message=e,this.div&&(this.div.innerHTML='<p style="height: 100%; padding: 20% 0">'+e+"</p>")},i.hide=function(){this.visible=!1,this.div&&this.div.parentNode.removeChild(this.div),this.showTimeout&&clearTimeout(this.showTimeout),this.message=null,this.div=null,this.showTimeout=null},t}),define("CatLab/Webremote/Synchronization/ClientRemoteView",["jquery"],function(n){"use strict";function e(e,t,i,n,s,o){this.controller=e,this.html="<p>Loading</p>",this.context={},this.viewId=t,this.name=i,this.groupId=void 0!==n?n:null,this.synchronizedData=s,this.createdAt=new Date,this.iframe=o,this.currentValues=[],this.buttons=[]}var s={},t=e.prototype;return t.render=function(e){var t;this.iframe?(t=document.createElement("iframe"),$(t).css({width:"100%",height:"100%",border:"none",margin:0,padding:0,position:"absolute",left:0,top:0}),$(e).html(t),this.element=t.contentDocument.body):this.element=e,this.el=e,this.$el=n(e),this.element.innerHTML=this.html,this.update(),this.controller.components.attach(this,n("body")),this.updateEvents(),setTimeout(function(){this.updateEvents(),window.scrollTo(0,1)}.bind(this),10),setTimeout(function(){this.updateEvents()}.bind(this),100),setTimeout(function(){this.updateEvents()}.bind(this),1e3)},t.updateEvents=function(){var l=this;function e(n,t,s){var o,r,a,h;l.shouldSetEvents(n,"touch")&&(h=!1,n.addEventListener("touchstart",function(e){return o=new Date,r={x:e.touches[0].pageX,y:e.touches[0].pageY},a={x:e.touches[0].pageX,y:e.touches[0].pageY},h=!0,t.apply(l,[n])}),n.addEventListener("touchmove",function(e){a={x:e.touches[0].pageX,y:e.touches[0].pageY}}),n.addEventListener("touchend",function(e){var t,i;if(r)return i=Math.abs(a.x-r.x),t=Math.abs(a.y-r.y),r=null,i=(new Date).getTime()-o.getTime()<300&&i<20&&t<20,setTimeout(function(){h=!1},100),s.apply(l,[n,i])}),n.addEventListener("mousedown",function(e){if(e.preventDefault(),!h)return t.apply(l,[n])}),n.addEventListener("mouseup",function(e){if(e.preventDefault(),!h)return s.apply(l,[n,!0])}))}for(var t=this.element.querySelectorAll("[data-button-id]"),i=0;i<t.length;i++)e(t[i],l.buttonDown,l.buttonUp),this.buttons.push(t[i]);for(t=this.element.querySelectorAll("[data-authentication-button]"),i=0;i<t.length;i++)e(t[i],function(){},l.authenticate);for(t=this.element.querySelectorAll("[data-value-id]"),i=0;i<t.length;i++)!function(t){var i,e;l.shouldSetEvents(t,"change")&&(i=t.getAttribute("data-value-id"),l.currentValues[i]=l.getDataValue(t),t.addEventListener("change",function(e){s[i]=new Date,l.syncValue(t)}),e=null,t.addEventListener("keyup",function(){e&&clearTimeout(e),e=setTimeout(function(){s[i]=new Date,l.syncValue(t)},1e3)}))}(t[i])},t.getDataValue=function(e){return"checkbox"===e.type?e.checked?1:0:e.value},t.syncValues=function(){for(var e=this.element.querySelectorAll("[data-value-id]"),t=0;t<e.length;t++)this.syncValue(e[t])},t.syncValue=function(e){var t=this.getDataValue(e),i=e.getAttribute("data-value-id");void 0!==this.currentValues[i]&&this.currentValues[i]===t||(this.currentValues[i]=t,this.controller.syncValue(i,this.getDataValue(e),this.viewId))},t.update=function(){for(var e=this.element.querySelectorAll("[data-button-decorator]"),t=0;t<e.length;t++)void 0===e[t].dataset.initialClasses&&(e[t].dataset.initialClasses=e[t].className);this.updateBigTextSizes()},t.updateBigTextSizes=function(){var i=$(this.element),e=i.find(".bigtext"),n={};e.each(function(){var e=$(this).attr("data-bigtext-group"),t=e?(void 0===n[e]&&(n[e]=0,i.find('.bigtext[data-bigtext-group="'+e+'"]').each(function(){n[e]=Math.max(n[e],$(this).text().length)})),n[e]):$(this).text().length;$(this).attr("data-bigtext-length",t)})},t.shouldSetEvents=function(e,t){return void 0===e["hasCatlabEventsAlready"+t]&&(e["hasCatlabEventsAlready"+t]=!0)},t.buttonDown=function(e){try{this.syncValues()}catch(e){console.error(e)}return this.controller.buttonDown(e.getAttribute("data-button-id"),this.viewId),!1},t.buttonUp=function(e,t){return this.controller.buttonUp(e.getAttribute("data-button-id"),this.viewId,t),!1},t.setLabel=function(e,t){for(var i=this.element.querySelectorAll("[data-button-label="+e+"]"),n=0;n<i.length;n++)i[n].innerHTML=t;this.update()},t.setClass=function(e,t){for(var i=this.element.querySelectorAll("[data-button-decorator="+e+"]"),n=0;n<i.length;n++){var s=i[n];s.className=s.dataset.initialClasses+" "+t}this.update()},t.domAppend=function(e,t){var i=document.getElementById(e);if(i){for(var n=[],s=this.stringToDom(t).childNodes,o=0;o<s.length;o++){var r=s[o],r=i.appendChild(r);n.push(r)}try{for(o=0;o<n.length;o++)this.controller.components.attach(this._currentView,n[o],!1)}catch(e){console.log(e)}5e3<(new Date).getTime()-this.createdAt.getTime()&&0<n.length&&void 0!==n[0].scrollIntoView&&n[0].scrollIntoView(),this.update(),this.updateEvents()}},t.domReplace=function(e,t){e=document.getElementById(e);e&&(e.innerHTML=t,this.controller.components.attach(this._currentView,e,!1),this.update(),this.updateEvents())},t.domAttribute=function(e,t,i){n(e).attr(t,i)},t.changeValue=function(e){if(void 0!==s[e.id]){if((t=Math.abs(s[e.id].getTime()-(new Date).getTime()))<5)return}else var t=9999999999999;for(var i=this.element.querySelectorAll("[data-value-id="+e.id+"]"),n=0;n<i.length;n++)document.activeElement==i[n]&&t<5e3||(this.currentValues[e.id]=e.value,i[n].value=e.value)},t.vibrate=function(e){void 0!==window.navigator.vibrate&&void 0!==e.pattern&&Array.isArray(e.pattern)&&window.navigator.vibrate(e.pattern)},t.stringToDom=function(e){var t;return(t=0<=e.toLowerCase().indexOf("<tr")?document.createElement("tbody"):document.createElement("div")).innerHTML=e,t},t.stringInterpolateDataElements=function(e,s){return e.replace(/{{(.+?)}}/g,function(e,t,i,n){t=this.controller.resolveDataAttribute(t.trim());return t=s?s(t):t}.bind(this))},t.destroy=function(){this.syncValues(),void 0!==this.synchronizedData&&this.synchronizedData.destroy()},e}),define("CatLab/Webremote/Synchronization/DataItem",[],function(){function i(e,t,i){this.key=e,this.shared=t,this.side=i}var e=i.prototype;return e.setValue=function(e){this.value=e},e.canWrite=function(e){return!!this.shared||this.side===e},e.serialize=function(){return{key:this.key,shared:this.shared,side:this.side,value:this.value}},i.unserialize=function(e){var t=new i(e.key,e.shared,e.side);return t.setValue(e.value),t},i}),define("CatLab/Webremote/Synchronization/SynchronizedData",["CatLab/Webremote/Tools/Eventable","CatLab/Webremote/Synchronization/DataItem"],function(e,s){function t(e,t,i){this.initializeEventable(),this.id=e,this.synchronizer=t,this.side=i,this.data={}}e=t.prototype=new e;return e.set=function(e,t,i){if(void 0===this.data[e])this.data[e]=new s(e,i,this.side);else if(!this.data[e].canWrite(this.side))throw"Trying to overwrite a non shared data attribute: "+e;this.data[e].setValue(t),this.emit(this.data[e])},e.processMessage=function(e){var t=e.key,i=e.side,n=e.value,e=e.shared;if(void 0===this.data[t])this.data[t]=new s(t,e,i);else if(!this.data[t].canWrite(i))throw"Trying to overwrite a non shared data attribute: "+t;this.data[t].setValue(n)},e.get=function(e){return void 0===this.data[e]?null:this.data[e].value},e.emit=function(e,t){void 0===t&&(t=this.synchronizer.emit);e=e.serialize();e.namespace=this.synchronizer.namespace,e.container=this.id,t("data:set",e)},e.refreshTarget=function(e){for(var t in this.data)this.data.hasOwnProperty(t)&&this.emit(this.data[t],e)},e.destroy=function(){this.synchronizer.destroy(this)},e.serialize=function(){var e,t={};for(e in this.data)this.data.hasOwnProperty(e)&&(t[e]=this.data[e].serialize());return t},e.unserialize=function(e){for(var t in this.data={},e)e.hasOwnProperty(t)&&(this.data[t]=s.unserialize(e[t]))},t}),define("CatLab/Webremote/Synchronization/DataSynchronizer",["CatLab/Webremote/Synchronization/SynchronizedData"],function(t){function e(e,t,i){this.namespace=e,this.emit=t,this.dataModels={},this.side=i}e.eventsToListenFor=["data:set"];var i=e.prototype;return i.checkNamespace=function(e){return void 0!==e.namespace&&e.namespace===this.namespace},i.processMessage=function(e,t){void 0!==t.container&&this.getFromIdentifier(t.container).processMessage(t)},i.getFromIdentifier=function(e){return void 0===this.dataModels[e]&&(this.dataModels[e]=new t(e,this,this.side)),this.dataModels[e]},i.destroy=function(e){e=e.id;void 0===this.dataModels[e]&&delete this.dataModels[e]},i.refreshTarget=function(e){for(var t in this.dataModels)this.dataModels.hasOwnProperty(t)&&this.dataModels[t].refreshTarget(e)},i.serialize=function(){var e,t={};for(e in this.dataModels)this.dataModels.hasOwnProperty(e)&&(t[e]=this.dataModels[e].serialize());return{dataModels:t}},i.unserialize=function(e){for(var t in e.dataModels)e.dataModels.hasOwnProperty(t)&&this.getFromIdentifier(t).unserialize(e.dataModels[t])},e}),define("CatLab/Webremote/Synchronization/EventHandler",["CatLab/Webremote/Tools/Eventable"],function(e){function t(e,t){this.initializeEventable(),this.namespace=e,this.emit=t}t.eventsToListenFor=["event:trigger"];e=t.prototype=new e;return e.checkNamespace=function(e){return void 0!==e.namespace&&e.namespace===this.namespace},e.processMessage=function(e,t){if("event:trigger"===e)return this.processTriggerEvent(t)},e.processTriggerEvent=function(e){void 0!==e.event&&this.eventableTrigger(e.event,void 0===e.parameters?{}:e.parameters)},e.trigger=function(e,t){this.emit("event:trigger",{namespace:this.namespace,event:e,parameters:t})},e.refreshTarget=function(e){},e.serialize=function(){return{}},e.unserialize=function(e){},t}),define("CatLab/Webremote/Synchronization/CombinedEventHandler",["CatLab/Webremote/Tools/Eventable"],function(e){function t(e,t){this.initializeEventable(),this.handlers=[]}return(t.prototype=new e).addHandler=function(e){this.handlers.push(e),e.on("*",function(e,t){this.trigger(t,e)}.bind(this))},t}),define("CatLab/Webremote/Synchronization/MessageQueue",[],function(){"use strict";function e(){this.queue=[]}var t=e.prototype;return t.add=function(e,t,i){this.queue.push({action:e,data:t,ack:i})},t.flush=function(){var e=this.queue;return this.queue=[],e},t.compactFlush=function(){var n,s,o,r,a=[],e=this.flush();return 0===e.length?e:(s={user:{},group:{}},o=0,r={},e.forEach(function(e){if(o++,this.canCompact(e)){var t=null;void 0!==e.data.user?t="user":void 0!==e.data.group&&(t="group"),void 0===s[t][e.action]&&(s[t][e.action]=[]);for(var i=0;i<s[t][e.action].length;i++)if(n=s[t][e.action][i],this.isSimilarMessage(n.event,e)&&(void 0===r[e.data[t]]||r[e.data[t]]<n.index))return r[e.data[t]]=n.index,n.event.data[t].push(e.data[t]),void n.event.data._d.push(this.getDifference(n.event,e));Array.isArray(e.data[t])||(e.data[t]=[e.data[t]]),e.data._d=[{}],r[e.data[t]]=o,s[t][e.action].push({event:e,index:o})}a.push(e)}.bind(this)),a)},t.moveToEnd=function(e,t){e.push(e.splice(e.indexOf(t),1)[0])},t.isSimilarMessage=function(e,t){return e.action===t.action&&this.getCompareDataString(e)===this.getCompareDataString(t)},t.getDifference=function(e,t){var i,n={};for(i in t.data)if(t.data.hasOwnProperty(i)){switch(i){case"user":case"group":case"_d":case"_i":continue}void 0!==e.data[i]&&e.data[i]===t.data[i]||(n[i]=t.data[i])}return n},t.getCompareDataString=function(e){e=Object.assign({},e.data);return delete e.user,delete e.group,delete e.viewId,delete e._d,delete e._i,JSON.stringify(e)},t.canCompact=function(e){return!(void 0!==e.ack&&null!==e.ack||void 0===e.data||void 0===e.data.user&&void 0===e.data.group)},e.unpack=function(e,t){if(void 0===e[t])return[e];var i=Array.isArray(e[t])?e[t]:[e[t]],n=[];void 0!==e._d&&(n=Array.isArray(e._d)?e._d:[e._d]);for(var s=[],o=0;o<i.length;o++){(r={})[t]=i[o];var r=Object.assign({},e,r,void 0!==n[o]?n[o]:{});delete r._d,s.push(r)}return s},Object.defineProperty(t,"length",{get:function(){return this.queue.length}}),e}),define("CatLab/Webremote/Tools/Proxy",["CatLab/Webremote/Config","CatLab/Webremote/Tools/Deferred"],function(o,r){function e(){}var a=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];return e.prototype.get=function(e){o.getProxy()&&(e=o.getProxy()+encodeURIComponent(e)),console.log(e);var t,i,n,s=new r;return e=e,t=function(e){s.resolve(e.responseText)},(n=function(){for(var e=!1,t=0;t<a.length;t++){try{e=a[t]()}catch(e){continue}break}return e}())&&(n.open(i?"POST":"GET",e,!0),i&&n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&(200==n.status||304==n.status?t(n):console.error("CatLab Remote HTTP error "+n.status))},4!=n.readyState)&&n.send(i),s.promise()},new e}),define("CatLab/Webremote/Providers/Provider",["CatLab/Webremote/Synchronization/MessageQueue","CatLab/Webremote/Tools/Proxy","CatLab/Webremote/Tools/Deferred"],function(e,i,n){"use strict";function t(){this.initializeProvider()}var s=t.prototype;return s.initializeProvider=function(){this.queue=new e,this.postInitializeQueue=[],this.scheduled=!1,this.initialized=!1,this.sendBurstDelay=10,this.maxQueueSize=2500,this.messageCounter=null,this.events={}},s.getProviderSettings=function(){var e=new n;return e.resolve({}),e.promise()},s.setMessageCounter=function(e){this.messageCounter=e},s.initMaster=function(e){this.master=e},s.initPlayer=function(e){this.master=e},s.connect=function(){var e=new n;return e.resolve(),e.promise()},s.disconnect=function(){this.off()},s.setOAuthSettings=function(e){this.emit("oauth:set",e)},s.loadViews=function(e,t){(t=void 0===t?!1:t)?i.get(e).then(function(e){this.emit("view:load",{xml:e})}.bind(this)):this.emit("view:load",{url:e})},s.toMaster=function(e,t,i){this.emit(e,t,i)},s.toPlayers=function(e,t,i){this.emit(e,t,i)},s.toPlayer=function(e,t,i,n){i.user=e.getId(),this.emit(t,i,n)},s.toGroup=function(e,t,i,n){i.group=e.getId(),this.emit(t,i,n)},s.emit=function(e,t,i){this.initialized?this.queue?(this.queue.add(e,t,i),this.queue.length>this.maxQueueSize?(clearTimeout(this.scheduled),this.scheduled=null,this.executeQueue()):this.scheduled||(this.scheduled=setTimeout(function(){this.scheduled=null,this.executeQueue()}.bind(this),this.sendBurstDelay))):this.emitOne(e,t,i):this.postInitializeQueue.push({action:e,data:t,ack:i})},s.createGroup=function(e,t,i,n){this.emit("group:create",{externalId:e,globalViews:t,shareColor:i,tags:n=void 0===n?[]:n})},s.executeQueue=function(){this.initialized&&this.emitAll()},s.setInitialized=function(){var e;for(this.initialized=!0;e=this.postInitializeQueue.shift();)this.emit(e.action,e.data,e.ack)},s.setup=function(e){this.emit("master:setup",e)},s.reset=function(e){this.emit("master:reset",null,function(){e()})},s.getStaticUrl=function(e){return e},s.reconnect=function(e,t,i,n){this.emit("master:reconnect",{token:e,accessToken:t,gameConfig:i},function(){n()}.bind(this))},s.off=function(){this.events={}},s.on=function(e,t){this._addEvent(e,t,!1),this._touchEvent(e)},s.once=function(e,t){this._addEvent(e,t,!0),this._touchEvent(e)},s._addEvent=function(e,t,i){void 0===this.events[e]&&(this.events[e]=[]),this.events[e].push({callback:t,once:i})},s._touchEvents=function(){for(var e in this.events)this.events.hasOwnProperty(e)&&this._touchEvent(e)},s._touchEvent=function(e){},s._trigger=function(e,i){var n;void 0!==this.events[e]&&(n=[],this.events[e].forEach(function(e){var t=e.callback;e.once&&n.push(e);try{t.apply(this,[i])}catch(e){console.error(e)}}),0<n.length)&&(n.unshift(this.events),function(e){for(var t,i,n=arguments,s=n.length;1<s&&e.length;)for(t=n[--s];-1!==(i=e.indexOf(t));)e.splice(i,1);return e}.apply(this,n))},s.getConnectURL=function(e){return null},s.getConnectToken=function(e){return null},s.tokenConnect=function(e){var t=new n;return t.resolve(),t.promise()},s.noTokenConnect=function(){var e=new n;return e.resolve(),e.promise()},s.restoreProviderSettings=function(e){},s.serializeProviderSettings=function(){return{}},t}),define("CatLab/Webremote/Providers/SocketIO",["CatLab/Webremote/Providers/Provider","CatLab/Webremote/Config","CatLab/Webremote/Tools/Deferred","CatLab/Webremote/Tools/Tools"],function(e,r,a,t){function i(){this.initializeProvider(),this.userId=null,this.randomToken=t.getUuid(),this.loadBalancerSessionToken="connid",this.socket=null,this._registeredEvents={}}var h=null,e=i.prototype=new e;return e.getProviderSettings=function(){var t=new a;return r.getServerList()?r.getServerList().getSelectedServer().then(function(e){t.resolve({host:e})}.bind(this)):t.resolve({}),t.promise()},e.connect=function(n,s){var t,o=new a;return this.log("Loading socket.io"),t=function(){this.log("Connecting to socket.io");var e,t=r.getSocketURL(),i=(void 0!==s.host&&s.host&&(t=(e=r.getProtocol())?e+"://"+s.host:"//"+s.host),this.socket=h(t+"/"+n+"?"+this.loadBalancerSessionToken+"="+this.randomToken,{withCredentials:!1,reconnection:!0}),!1);this.socket.on("connect_error",function(e){i?this._trigger("disconnect"):(this.socket.off(),this.socket.disconnect(),this.socket=null,o.reject())}.bind(this)),this.socket.once("connect",function(){i||(i=!0,this.setInitialized(),this.socket.io.on("reconnect",function(e){this._trigger("reconnect")}.bind(this)),this._touchEvents(),o.resolve())}.bind(this))}.bind(this),require(["socket.io-client"],function(e){h=e,t()}),o.promise()},e.disconnect=function(e){void 0===e&&(e=!0),this.initialized=!1,this.socket&&((e?this:(this._registeredEvents={},this.socket)).off(),this.socket.disconnect(),this.socket=null)},e.off=function(){this._registeredEvents={},this.events={},this.socket.off()},e.setUserId=function(e){return this.userId=e,this},e.emitAll=function(){var e,t=this.queue.compactFlush();if(t.length)for(;e=t.shift();)this.emitOne(e.action,e.data,e.ack)},e.emitOne=function(e,t,i){this.socket.emit(e,t,i),this.messageCounter&&this.messageCounter.outgoing()},e.log=function(){this.master.log.apply(arguments)},e.getStaticUrl=function(e){return e.indexOf("?")<0?e+="?":e+="&",e+(this.loadBalancerSessionToken+"="+this.randomToken)},e._detachEvents=function(e){this.socket&&this.socket.off(e)},e._touchEvent=function(t){this.socket&&void 0===this._registeredEvents[t]&&(this.socket.on(t,function(e){this._trigger(t,e)}.bind(this)),this._registeredEvents[t]=!0)},e._handleSocketIoEvent=function(e,t){switch(e){case"connect":case"disconnect":break;default:return this._trigger(e,t)}},e.getConnectURL=function(e){return r.getServerList()?r.getServerList().getConnectURL():e},e.getConnectToken=function(e){return r.getServerList()?r.getServerList().getConnectToken(e):e},e.tokenConnect=function(e){var t=new a,i={};if(r.getServerList())try{var n=r.getServerList().getFromToken(e);i.host=n.host,e=n.token}catch(e){return t.reject(),t.promise()}return this.connect("remote",i).fail(function(){t.reject()}).then(function(){t.resolve(e)}),t.promise()},e.restoreProviderSettings=function(e){void 0!==e.serverlist&&r.getServerList()&&r.getServerList().unserialize(e.serverlist)},e.serializeProviderSettings=function(){var e={};return r.getServerList()&&(e.serverlist=r.getServerList().serialize()),e},i}),define("CatLab/Webremote/SonicSync/Library/ring-buffer",[],function(){function t(e){this.array=[],this.maxLength=e}return t.prototype.get=function(e){return e>=this.array.length?null:this.array[e]},t.prototype.last=function(){return 0==this.array.length?null:this.array[this.array.length-1]},t.prototype.add=function(e){this.array.push(e),this.array.length>=this.maxLength&&this.array.splice(0,1)},t.prototype.length=function(){return this.array.length},t.prototype.clear=function(){this.array=[]},t.prototype.copy=function(){var e=new t(this.maxLength);return e.array=this.array.slice(0),e},t.prototype.remove=function(e,t){this.array.splice(e,t)},t}),define("CatLab/Webremote/SonicSync/Library/sonic-coder",[],function(){function e(e){this.freqMin=(e=e||{}).freqMin||18500,this.freqMax=e.freqMax||19500,this.freqError=e.freqError||50,this.alphabetString=e.alphabet||"\n abcdefghijklmnopqrstuvwxyz0123456789,.!?@*",this.startChar=e.startChar||"^",this.endChar=e.endChar||"$",this.alphabet=this.startChar+this.alphabetString+this.endChar}return e.prototype.charToFreq=function(e){var t=this.alphabet.indexOf(e),e=(-1==t&&(console.error(e,"is an invalid character."),t=this.alphabet.length-1),this.freqMax-this.freqMin),t=t/this.alphabet.length,e=Math.round(e*t);return this.freqMin+e},e.prototype.freqToChar=function(e){if(!(this.freqMin<e&&e<this.freqMax))if(this.freqMin-e<this.freqError)e=this.freqMin;else{if(!(e-this.freqMax<this.freqError))return console.error(e,"is out of range."),null;e=this.freqMax}var t=this.freqMax-this.freqMin,e=(e-this.freqMin)/t,t=Math.round(this.alphabet.length*e);return this.alphabet[t]},e}),define("CatLab/Webremote/SonicSync/Library/sonic-server",["./ring-buffer","./sonic-coder"],function(t,i){function e(e){this.peakThreshold=(e=e||{}).peakThreshold||-65,this.minRunLength=e.minRunLength||2,this.coder=e.coder||new i(e),this.timeout=e.timeout||300,this.debug=!!e.debug,this.peakHistory=new t(16),this.peakTimes=new t(16),this.callbacks={},this.buffer="",this.state=n,this.isRunning=!1,this.iteration=0}var n=1,s=2;return e.prototype.start=function(){try{navigator.mediaDevices||console.log("No mediadevices found"),navigator.mediaDevices.getUserMedia({audio:{optional:[{echoCancellation:!1}]}}).then(this.onStream_.bind(this)).catch(this.onStreamError_.bind(this))}catch(e){console.log(e)}},e.prototype.stop=function(){this.isRunning=!1,this.track.stop()},e.prototype.on=function(e,t){"message"==e&&(this.callbacks.message=t),"character"==e&&(this.callbacks.character=t)},e.prototype.setDebug=function(e){this.debug=e;e=document.querySelector("canvas");e&&e.parentElement.removeChild(e)},e.prototype.fire_=function(e,t){"function"==typeof e&&e(t)},e.prototype.onStream_=function(e){var t;void 0!==e.getTracks()[0]?(this.track=e.getTracks()[0],t=new AudioContext,e=(this.audioContext=t).createMediaStreamSource(e),t=t.createAnalyser(),e.connect(t),this.freqs=new Float32Array(t.frequencyBinCount),this.analyser=t,this.isRunning=!0,this.raf_(this.loop.bind(this))):console.log("No microphone found.")},e.prototype.onStreamError_=function(e){console.error("Audio input error:",e)},e.prototype.getPeakFrequency=function(){for(var e=-1/0,t=-1,i=this.freqToIndex(this.coder.freqMin);i<this.freqs.length;i++)this.freqs[i]>e&&(e=this.freqs[i],t=i);return e>this.peakThreshold?this.indexToFreq(t):null},e.prototype.loop=function(){this.analyser.getFloatFrequencyData(this.freqs),(this.iteration+1)%300==0&&this.restartServerIfSanityCheckFails();var e=this.getPeakFrequency();e?(e=this.coder.freqToChar(e),this.debug&&console.log("Transcribed char: "+e),this.peakHistory.add(e),this.peakTimes.add(new Date)):(e=this.peakTimes.last())&&new Date-e>this.timeout&&(this.state=n,this.debug&&console.log("Token",this.buffer,"timed out"),this.peakTimes.clear()),this.analysePeaks(),this.debug&&this.debugDraw_(),this.isRunning&&this.raf_(this.loop.bind(this)),this.iteration+=1},e.prototype.indexToFreq=function(e){return this.audioContext.sampleRate/2/this.freqs.length*e},e.prototype.freqToIndex=function(e){var t=this.audioContext.sampleRate/2;return Math.round(e/t*this.freqs.length)},e.prototype.analysePeaks=function(){var e=this.getLastRun();e&&(this.state==n?e==this.coder.startChar&&(this.buffer="",this.state=s):this.state==s&&(e!=this.lastChar&&e!=this.coder.startChar&&e!=this.coder.endChar&&(this.buffer+=e,this.lastChar=e,this.fire_(this.callbacks.character,e)),e==this.coder.endChar)&&(this.state=n,this.fire_(this.callbacks.message,this.buffer),this.buffer=""))},e.prototype.getLastRun=function(){for(var e=this.peakHistory.last(),t=0,i=this.peakHistory.length()-2;0<=i&&this.peakHistory.get(i)==e;i--)t+=1;return t>this.minRunLength?(this.peakHistory.remove(i+1,t+1),e):null},e.prototype.debugDraw_=function(){var e=document.querySelector("canvas");e||(e=document.createElement("canvas"),document.body.appendChild(e)),e.width=document.body.offsetWidth,e.height=480,drawContext=e.getContext("2d");for(var t=0;t<this.freqs.length;t++){var i=this.freqs[t]+400,i=e.height-i-1,n=e.width/this.freqs.length;drawContext.fillStyle="black",drawContext.fillRect(t*n,i,1,1)}},e.prototype.raf_=function(e){"undefined"==typeof window||window.chrome&&chrome.extension?setTimeout(e,1e3/60):requestAnimationFrame(e)},e.prototype.restartServerIfSanityCheckFails=function(){if(this.freqs[0]<-300)console.error("freqs[0] < -300. Restarting."),this.restart();else{for(var e=!0,t=0;t<10;t++)-100==this.freqs[t]&&(e=!1);e||(console.error("freqs[0:10] == -100. Restarting."),this.restart())}},e.prototype.restart=function(){},e}),define("CatLab/Webremote/SonicSync/Library/sonic-socket",["./sonic-coder"],function(t){var i=!1;function e(e){this.coder=(e=e||{}).coder||new t,this.charDuration=e.charDuration||.5,this.coder=e.coder||new t(e),this.rampDuration=e.rampDuration||.001,this.audioContext=new i}return"undefined"!=typeof window&&(i=window.AudioContext||window.webkitAudioContext||!1),e.prototype.send=function(e,t){e=this.coder.startChar+e+this.coder.endChar;for(var i,n=0;n<e.length;n++){var s=e[n],s=this.coder.charToFreq(s),o=this.audioContext.currentTime+this.charDuration*n;this.scheduleToneAt(s,o,this.charDuration)}t&&(i=this.charDuration*e.length,setTimeout(t,1e3*i))},e.prototype.scheduleToneAt=function(e,t,i){var n=this.audioContext.createGain(),i=(n.gain.value=0,n.gain.setValueAtTime(0,t),n.gain.linearRampToValueAtTime(1,t+this.rampDuration),n.gain.setValueAtTime(1,t+i-this.rampDuration),n.gain.linearRampToValueAtTime(0,t+i),n.connect(this.audioContext.destination),this.audioContext.createOscillator());i.frequency.value=e,i.connect(n),i.start(t)},e}),define("CatLab/Webremote/SonicSync/Client",["CatLab/Webremote/Config","CatLab/Webremote/SonicSync/Library/ring-buffer","CatLab/Webremote/SonicSync/Library/sonic-coder","CatLab/Webremote/SonicSync/Library/sonic-server","CatLab/Webremote/SonicSync/Library/sonic-socket","CatLab/Webremote/Tools/Deferred"],function(t,e,i,n,s,o){function r(e){this.options=t.getAudioSyncConfig(),this.alphabet=this.options.alphabet.split(""),this.controller=e}var a=r.prototype;return a.startListener=function(){this.stop();var e=new n(this.options);e.start(),e.on("message",this.onIncomingMessage.bind(this)),this.sonicServer=e},a.startSender=function(){this.sonicSocket=new s(this.options)},a.stop=function(){this.sonicServer&&this.sonicServer.stop()},a.sync=function(){var e=new o,t=this.generateRandomSequence(this.options.length);return this.sonicSocket.send(t+this.getParityLetter(t),function(){this.controller.trigger("sync:audio",{secret:t})}.bind(this)),e.promise()},a.generateRandomSequence=function(e){for(var t,i="",n="",s=0;s<e;s++){for(;t=Math.floor(Math.random()*this.alphabet.length),(n=this.alphabet[t])===i.substr(i.length-1,1););i+=n}return i},a.getParityLetter=function(e){for(var t=0,i=e.split(""),n=0;n<i.length;n++)t+=this.alphabet.indexOf(i[n]);e=t%this.alphabet.length;return i[i.length-1]===this.alphabet[e]&&(e=(e+1)%this.alphabet.length),this.alphabet[e]},a.onIncomingMessage=function(e){var t=e.substr(0,e.length-1),i=this.getParityLetter(t);i===e[e.length-1]?this.onMessage(t):console.log("Parity check failed, expected "+i+", ignoring message")},a.onMessage=function(e){this.controller.emit("sync:audio",{secret:e})},a.generateAlphabet=function(e){for(var t="",i=0;i<Math.min(e.length,9);i++)t+=i.toString();return t},r}),define("CatLab/Webremote/Tools/ClientSniffer",[],function(){"use strict";function e(){this._canPlayWebM=null}var t=e.prototype;return t.isMobileBrowser=function(){var e,t;return!this.isCordova()&&(e=!1,t=navigator.userAgent||navigator.vendor||window.opera,!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))||e)},t.isCordova=function(){return"undefined"!=typeof cordova},t.isInternetExplorer=function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");return 0<t?parseInt(e.substring(t+5,e.indexOf(".",t)),10):0<e.indexOf("Trident/")?(t=e.indexOf("rv:"),parseInt(e.substring(t+3,e.indexOf(".",t)),10)):0<(t=e.indexOf("Edge/"))&&parseInt(e.substring(t+5,e.indexOf(".",t)),10)},t.supportsLocalStorage=function(){try{if(window.localStorage)return!0}catch(e){return!1}},t.canPlayWebM=function(){if(null===this._canPlayWebM){this._canPlayWebM=!1;try{var e=document.createElement("video");e.canPlayType&&(this._canPlayWebM=e.canPlayType('video/webm; codecs="vp8, vorbis"'))}catch(e){console.error(e)}}return this._canPlayWebM},new e}),define("CatLab/Webremote/Components/ImagePositionInputComponent",["jquery","CatLab/Webremote/Tools/ClientSniffer"],function(h,s){function e(e,t){this.element=t,this.remotePlayerView=e,this.position=null,this.canvas=null,this.isLoaded=!1,this.isRotated=!1,this.submitButton=null,this.draw()}var t=e.prototype;return t.draw=function(){h(this.element).html(""),this.submitButton=null,this.circleRadius=this.element.attr("circleRadius")||2,this.circleStroke=this.element.attr("circleStroke")||Math.max(.5,this.circleRadius/5),this.circleStrokeColor=this.element.attr("circleStrokeColor")||"red",this.circleFillColor=this.element.attr("circleFillColor")||"rgb(255,255,0,0.3)",this.image=this.element.attr("src"),this.image&&(this.element.html('<div class="image"><img src="'+this.image+'" /></div>'),this.imageElement=h(this.element).find("img"),this.imageElement.click(function(e){this.imageClick(e)}.bind(this)),this.imageElement.on("load",function(){this.isLoaded=!0,this.resizeImage()}.bind(this)),this.imageElement.on("dragstart",function(e){e.preventDefault()}),this.svg=h('<svg><circle stroke="red" fill="none" /></svg>'),this.circle=h(this.svg).find("circle"),this.svg.css({position:"absolute",display:"none"}),this.element.find(".image").append(this.svg))},t.resizeImage=function(){var e,t,i,n;this.isLoaded&&(e=this.element.width(),t=this.element.height(),i=this.imageElement.get(0).naturalWidth,n=this.imageElement.get(0).naturalHeight,s.isMobileBrowser()?this.isRotated=e/t<1!=i/n<1:this.isRotated=!1,this.element.toggleClass("rotated",this.isRotated),this.isRotated?(this.generateCanvas(),this.rotatedImageElement.show(),this.imageElement.hide()):(this.rotatedImageElement&&this.rotatedImageElement.hide(),this.imageElement.show()))},t.generateCanvas=function(){var e,t,i,n,s,o,r,a;this.rotatedImageElement||(s=this.imageElement[0],e=this.imageElement.get(0).naturalWidth,t=this.imageElement.get(0).naturalHeight,(i=document.createElement("canvas")).width=t,i.height=e,n=i.getContext("2d"),s=s,o=i.width/2,r=i.height/2,a=0-Math.PI/2,n.setTransform(1,0,0,1,o,r),n.rotate(a),n.drawImage(s,-e/2,-t/2),this.rotatedImageElement=h(i),this.rotatedImageElement.click(function(e){this.canvasClick(e)}.bind(this)),this.element.find("div.image").append(this.rotatedImageElement))},t.imageClick=function(e){var t=e.offsetX/this.imageElement.width(),e=e.offsetY/this.imageElement.height();this.selectPosition(t,e)},t.canvasClick=function(e){var t=e.offsetX/this.rotatedImageElement.width(),e=e.offsetY/this.rotatedImageElement.height();this.selectPosition(1-e,t)},t.selectPosition=function(e,t){this.position={x:e,y:t},this.drawCircle(),this.shouldConfirmPosition()?this.showSubmitButton():this.submit()},t.shouldConfirmPosition=function(){return"1"==this.element.attr("confirm-position")},t.showSubmitButton=function(){this.submitButton?this.positionSubmitButton():(this.submitButton=h('<button class="imagemap-button pulsating"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 22"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z"/></svg></button>'),this.element.append(this.submitButton),this.positionSubmitButton(),this.submitButton.click(function(){this.submit()}.bind(this)))},t.positionSubmitButton=function(){.5<this.position.x?(this.submitButton.addClass("left"),this.submitButton.removeClass("right")):(this.submitButton.addClass("right"),this.submitButton.removeClass("left"))},t.submit=function(){this.remotePlayerView.controller.syncValue("position",this.position,this.remotePlayerView.viewId)},t.cancelSelection=function(){},t.drawCircle=function(){var e,t,i,n;this.position?(e={x:this.position.x,y:this.position.y},t=this.imageElement,this.isRotated&&this.rotatedImageElement&&(t=this.rotatedImageElement,i=e.x,e.x=e.y,e.y=1-i),i=this.imageElement.width()/100*this.circleRadius,n=Math.max(1,this.imageElement.width()/100*this.circleStroke),this.circle.attr({cx:i+n,cy:i+n,r:i,"stroke-width":n,stroke:this.circleStrokeColor,fill:this.circleFillColor}),this.svg.attr({width:2*(i+n),height:2*(i+n)}),this.svg.css({left:t.position().left+e.x*t.width()-(i+n),top:t.position().top+e.y*t.height()-(i+n),display:"block"})):this.svg.css({display:"none"})},t.resize=function(){this.resizeImage(),this.drawCircle()},t.update=function(){this.draw()},t.destroy=function(){},e.css=" image-position-input { height: 80vh; width: 100vw; display: block; } image-position-input .image { width: 100%; height: 100%; text-align: center; display: inline-block; transform-origin: 0 0; } image-position-input .image img { max-width: 95%; max-height: 95%; display: inline; } image-position-input .image canvas { max-width: 95%; max-height: 95%; display: inline; } image-position-input button.imagemap-button svg { height: 48px; width: 48px; } image-position-input button.imagemap-button { position: absolute; right: 10px; bottom: 10px; z-index: 10; } image-position-input button.imagemap-button.left { left: 10px; right: auto; } image-position-input.rotated button.imagemap-button { transform: rotate(-90deg); top: 10px; right: 10px; bottom: auto; left: auto; } image-position-input.rotated button.imagemap-button.left { bottom: 10px; top: auto; } ",e.selector="image-position-input",e}),define("CatLab/Webremote/Components/FullscreenButtonComponent",["jquery","screenfull"],function(e,t){function i(e,t,i){this.element=t,this.remotePlayerView=e,this.position=null,this.componentContainer=i,this.draw()}var n=i.prototype;return n.draw=function(){t&&t.isEnabled&&!t.isFullscreen?(e(this.element).html('<svg xmlns="http://www.w3.org/2000/svg" style="display: block" width="100%" height="100%" viewBox="0 0 24 24"><path d="M6.426 10.668l-3.547-3.547-2.879 2.879v-10h10l-2.879 2.879 3.547 3.547-4.242 4.242zm11.148 2.664l3.547 3.547 2.879-2.879v10h-10l2.879-2.879-3.547-3.547 4.242-4.242zm-6.906 4.242l-3.547 3.547 2.879 2.879h-10v-10l2.879 2.879 3.547-3.547 4.242 4.242zm2.664-11.148l3.547-3.547-2.879-2.879h10v10l-2.879-2.879-3.547 3.547-4.242-4.242z"/></svg>'),e(this.element).click(function(){t.request(null,{navigationUI:"hide"})}.bind(this))):e(this.element).html("")},n.resize=function(){this.draw()},n.update=function(){this.draw()},n.destroy=function(){},i.css=" ",i.selector="fullscreen-button",i}),define("CatLab/Webremote/Components/ViewDefinedComponent",["jquery"],function(t){function e(e,t){this.element=t,this.remotePlayerView=e,this.position=null,this.draw()}var i=e.prototype;return i.draw=function(){if(this.element){t(this.element).html("");for(var e=0;e<this.content.childNodes.length;e++)t(this.element).append(this.content.childNodes[e].cloneNode(!0));this.componentContainer.attachComponents(this.remotePlayerView,this.element)}},i.update=function(){this.draw()},i.resize=function(){this.draw()},i.destroy=function(){},e.css=" ",e.selector="view-defined-component",e.content="",e}),define("CatLab/Webremote/Views/Popups/IframePopup",["CatLab/Webremote/Views/Popups/BasePopup"],function(e){function t(e){this.url=e}return(t.prototype=new e).renderContent=function(e){this.container.className+=" iframe";var t=$('<iframe src="'+this.url+'"></iframe>');$(t).css({height:"99%",width:"100%","border-width":0}),$(e).append(t),$(e).css({position:"relative",height:"100%",width:"100%","box-sizing":"border-box",overflow:"auto","-webkit-overflow-scrolling":"touch"})},t}),define("CatLab/Webremote/Components/ModalIframeLink",["jquery","CatLab/Webremote/Views/Popups/IframePopup"],function(t,i){function e(e,t,i){this.element=t,this.remotePlayerView=e,this.position=null,this.componentContainer=i,this.draw()}var n=e.prototype;return n.draw=function(){t(this.element).off("click"),t(this.element).on("click",function(){var e=t(this.element).attr("href"),e=this.remotePlayerView.stringInterpolateDataElements(e,encodeURIComponent);new i(e).render(document.body)}.bind(this))},n.resize=function(){this.draw()},n.update=function(){this.draw()},n.destroy=function(){},e.css=" ",e.selector="modal-iframe-link",e}),define("CatLab/Webremote/Views/Popups/TextPopup",["CatLab/Webremote/Views/Popups/BasePopup"],function(e){function t(e){this.message=e}return(t.prototype=new e).renderContent=function(e){var t=(t=this.message).replace(/(?:\r\n|\r|\n)/g,"<br>");e.innerHTML=t},t}),define("CatLab/Webremote/Components/TooltipComponent",["jquery","CatLab/Webremote/Views/Popups/TextPopup"],function(e,t){function i(e,t,i){this.element=t,this.remotePlayerView=e,this.position=null,this.componentContainer=i,this.draw()}var n=i.prototype;return n.draw=function(){e(this.element).off("click"),e(this.element).on("click",function(){new t(this.element.attr("data-tooltip")).render(document.body)}.bind(this))},n.resize=function(){},n.update=function(){},n.destroy=function(){},i.css=" ",i.selector="[data-tooltip]",i}),define("CatLab/Webremote/Components/VirtualKeyboardComponent",["jquery","SimpleKeyboard","CatLab/Webremote/Config"],function(t,i,n){"use strict";var s,o=null,e=0;function r(){t(".simple-keyboard").addClass("hidden"),o=null}function a(e,t,i){this.element=t,this.remotePlayerView=e,this.position=null,this.componentContainer=i,this.inputType=t.attr("type")?t.attr("type").toLowerCase():"text",this.draw()}var h=a.prototype;return h.draw=function(){(function(){var e=t.Deferred();t("<link>").appendTo("head").attr({type:"text/css",rel:"stylesheet",href:n.getVendorPath()+"simple-keyboard/build/css/index.css"}),t('<div class="simple-keyboard"></div>').appendTo("body"),s=new i.default({onChange:function(e){o&&o.onKeyboardChange(e)}.bind(this),onKeyPress:function(e){switch(e){case"{shift}":case"{lock}":t="default"===s.options.layoutName?"shift":"default",s.setOptions({layoutName:t});break;case"{numbers}":case"{abc}":t="numbers"!==s.options.layoutName?"numbers":"default",s.setOptions({layoutName:t});break;case"{ent}":r();break;case"{arrowup}":o.increaseValue(1);break;case"{arrowdown}":o.increaseValue(-1)}var t}.bind(this),layoutName:"default",layout:{default:["q w e r t y u i o p","a s d f g h j k l","{shift} z x c v b n m {backspace}","{numbers} {space} {ent}"],shift:["Q W E R T Y U I O P","A S D F G H J K L","{shift} Z X C V B N M {backspace}","{numbers} {space} {ent}"],numbers:["1 2 3","4 5 6","7 8 9","{abc} 0 {backspace}"]},physicalKeyboardHighlight:!0,disableCaretPositioning:!1,mergeDisplay:!0,display:{"{numbers}":"123","{ent}":"⇩","{escape}":"esc ⎋","{tab}":"tab ⇥","{backspace}":"⌫","{capslock}":"caps lock ⇪","{shift}":"⇧","{controlleft}":"ctrl ⌃","{controlright}":"ctrl ⌃","{altleft}":"alt ⌥","{altright}":"alt ⌥","{metaleft}":"cmd ⌘","{metaright}":"cmd ⌘","{abc}":"ABC"}}),t(".simple-keyboard").addClass("hidden"),e.promise()})(),this.element.attr("id")||this.element.attr("id","input_"+ ++e),this.element.prop("type","text"),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&this.element.prop("readonly",!0),this.element.on("input",this.onInputChange.bind(this)),this.element.on("focus",this.onInputFocus.bind(this)),this.element.hasClass("visible")&&this.onInputFocus()},h.hideKeyboard=function(){r()},h.showKeyboard=function(){var e;"number"===(e=this).inputType?s.setOptions({inputName:e.element.attr("id"),layoutName:"numbers",layout:{default:["q w e r t y u i o p","a s d f g h j k l","{shift} z x c v b n m {backspace}","{numbers} {space} {ent}"],numbers:["1 2 3 {arrowup}","4 5 6 {arrowdown}","7 8 9 "+1.1.toLocaleString().substring(1,2),"{backspace} 0 {ent}"]}}):s.setOptions({inputName:e.element.attr("id"),layoutName:"default",layout:{default:["q w e r t y u i o p","a s d f g h j k l","{shift} z x c v b n m {backspace}","{numbers} {space} {ent}"],shift:["Q W E R T Y U I O P","A S D F G H J K L","{shift} Z X C V B N M {backspace}","{numbers} {space} {ent}"],numbers:["1 2 3","4 5 6","7 8 9","{abc} 0 {backspace}"]}}),t(".simple-keyboard").removeClass("hidden"),o=e,s.setInput(e.element.val(),e.element.attr("id"))},h.onKeyboardChange=function(e){var t;this.element.val(e),this.element.trigger("change"),this.element.attr("data-value-realtime")&&(t=this.element.attr("data-value-id"))&&this.remotePlayerView.controller.syncValue(t,e,this.remotePlayerView.viewId)},h.onInputChange=function(){s.setInput(this.element.val(),this.element.attr("id"))},h.onInputFocus=function(){this.showKeyboard()},h.setInputCaretPosition=function(e){this.element[0].setSelectionRange&&(this.element[0].focus(),this.element[0].setSelectionRange(e,e))},h.increaseValue=function(e){var t;"number"===this.inputType&&(t=(t=parseFloat(this.element.val()))||0,this.element.val(t+e))},h.submit=function(){this.hideKeyboard()},h.resize=function(){this.draw()},h.update=function(){this.draw()},h.destroy=function(){this.hideKeyboard()},a.css=" .simple-keyboard { position: fixed; bottom: 0; display: block; } .simple-keyboard.hidden { display: none; } ",a.selector="input.virtual",a}),define("CatLab/Webremote/Components/TimerComponent",["jquery"],function(t){function e(e,t){this.element=t,this.remotePlayerView=e,this.draw(),this.countdownInterval=setInterval(function(){this.tick()}.bind(this),100),this.startDate=Date.now(),this.targetDate=null,this.counterHtml=null,this.progessBar=null}var i=e.prototype;return i.draw=function(){var e;t(this.element).html(""),this.targetDate=this.element.attr("to"),this.targetDate&&(this.element.attr("start")&&(this.startDate=this.element.attr("start")),e=t('<div class="timer-container"></div>'),this.counterHtml=t('<div class="countdown"></div>'),e.append(this.counterHtml),this.progessBar=t('<div class="progress-bar"> </div>'),e.append(this.progessBar),t(this.element).append(e))},i.tick=function(){var e,t;this.targetDate&&this.counterHtml&&this.progessBar&&((e=this.targetDate-Date.now())<0?this.counterHtml.html("0"):(t=(Date.now()-this.startDate)/(this.targetDate-this.startDate)*100,this.counterHtml.html(Math.ceil(e/1e3)),this.progessBar.css("width",t+"%")))},i.resize=function(){},i.update=function(){this.draw()},i.clearInterval=function(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)},i.destroy=function(){this.clearInterval()},e.css=" timer-countdown { position: fixed; bottom: 0px; left: 0px; width: 100%; color: white; z-index: 1000; } timer-countdown .progress-bar { position:absolute; height: 3px; bottom: 0; background: #eca93b; } timer-countdown .countdown { display: none; } ",e.selector="timer-countdown",e}),define("CatLab/Webremote/Components/Components",["jquery","./ImagePositionInputComponent","./FullscreenButtonComponent","./ViewDefinedComponent","./ModalIframeLink","./TooltipComponent","./VirtualKeyboardComponent","./TimerComponent"],function(s,t,i,o,n,r,a,h){function e(e){this.components=[t,i,n,r,a,h],this.Webremote=e,this.viewDefinedComponents=[],this.existingComponents=[]}var l=e.prototype;return l.initialize=function(){for(var e=0;e<this.components.length;e++)this.initializeComponent(this.components[e])},l.initializeComponent=function(e){e.css;var t=document.createElement("style");t.attributes.type="text/css",t.innerHTML=e.css,document.head.appendChild(t)},l.resetViewDefinedComponents=function(){for(var e=0;e<this.viewDefinedComponents.length;e++)this.removeComponent(this.viewDefinedComponents[e])},l.removeComponent=function(e){for(var t=0;t<this.components.length;t++)if(this.components[t].selector===e)return void this.components.splice(t,1)},l.addComponent=function(e){0<=this.components.indexOf(e)||(this.components.push(e),this.initializeComponent(e))},l.addViewDefinedComponent=function(e,n){for(var t=0;t<this.components.length;t++)if(this.components[t].selector===e)return;function i(e,t,i){this.element=t,this.remotePlayerView=e,this.position=null,this.content=n,this.componentContainer=i,this.draw()}this.viewDefinedComponents.push(e),i.prototype=new o,i.selector=e,i.content=n,this.components.push(i)},l.attach=function(e,t,i){(i=void 0===i?!0:i)&&(this.existingComponents.forEach(function(e){e.destroy()}.bind(this)),this.existingComponents=[]),this.attachComponents(e,t)},l.resize=function(){this.existingComponents.forEach(function(e){e.resize()}.bind(this))},l.update=function(){this.existingComponents.forEach(function(e){e.update()}.bind(this))},l.attachComponents=function(e,t){for(var i=0;i<this.components.length;i++)try{this.attachComponent(e,t,this.components[i])}catch(e){console.log(e)}},l.attachComponent=function(i,e,n){s(e).find(n.selector).each(function(e,t){t=new n(i,s(t),this);this.existingComponents.push(t)}.bind(this))},e}),!function(){!function(e,t){"use strict";"function"==typeof define&&define.amd?define("viewport-units-buggyfill",[],t):"object"==typeof exports?module.exports=t():e.viewportUnitsBuggyfill=t()}(this,function(){"use strict";var a,h,l,i,e,n=!1,t=window.navigator.userAgent,c=/([+-]?[0-9.]+)(vh|vw|vmin|vmax)/g,s=/(https?:)?\/\//,u=[].forEach,d=/MSIE [0-9]\./i.test(t),p=/MSIE [0-8]\./i.test(t),f=-1<t.indexOf("Opera Mini"),g=/(iPhone|iPod|iPad).+AppleWebKit/i.test(t)&&(e=t.match(/OS (\d)/))&&1<e.length&&parseInt(e[1])<10,m=-1<t.indexOf(" Android ")&&-1<t.indexOf("Version/")&&parseFloat((t.match("Android ([0-9.]+)")||[])[1])<=4.4,d=d||!!navigator.userAgent.match(/MSIE 10\.|Trident.*rv[ :]*1[01]\.| Edge\/1\d\./);try{new A("test")}catch(a){var A=function(e,t){var i;return t=t||{bubbles:!1,cancelable:!1,detail:void 0},(i=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i};A.prototype=window.Event.prototype,window.CustomEvent=A}function v(){n&&(o(),setTimeout(function(){i.textContent=b(),i.parentNode.appendChild(i),window.dispatchEvent(new A("viewport-units-buggyfill-style"))},1))}function o(){return l=[],u.call(document.styleSheets,function(e){var t=function(e){try{if(!e.cssRules)return}catch(e){if("SecurityError"!==e.name)throw e;return}for(var t=[],i=0;i<e.cssRules.length;i++){var n=e.cssRules[i];t.push(n)}return t}(e);!t||"patched-viewport"===e.ownerNode.id||"ignore"===e.ownerNode.getAttribute("data-viewport-units-buggyfill")||e.media&&e.media.mediaText&&window.matchMedia&&!window.matchMedia(e.media.mediaText).matches||u.call(t,r)}),l}function r(i){if(7===i.type){var e;try{e=i.cssText}catch(e){return}c.lastIndex=0,c.test(e)&&!s.test(e)&&(l.push([i,null,e]),a.hacks)&&a.hacks.findDeclarations(l,i,null,e)}else i.style?u.call(i.style,function(e){var t=i.style.getPropertyValue(e);i.style.getPropertyPriority(e)&&(t+=" !important"),c.lastIndex=0,c.test(t)&&(l.push([i,e,t]),a.hacks)&&a.hacks.findDeclarations(l,i,e,t)}):i.cssRules&&u.call(i.cssRules,function(e){r(e)})}function b(){var e=window.innerHeight,t=window.innerWidth;h={vh:e,vw:t,vmax:Math.max(t,e),vmin:Math.min(t,e)};var n,s,o=[],r=[];return l.forEach(function(e){var e=function(e,t,i){var n=[];i=i.replace(c,w),a.hacks&&(i=a.hacks.overwriteDeclaration(e,t,i)),t&&(n.push(e.selectorText),i=t+": "+i+";");for(var s=e.parentRule;s;)s.media?n.unshift("@media "+s.media.mediaText):s.conditionText&&n.unshift("@supports "+s.conditionText),s=s.parentRule;return{selector:n,content:i}}.apply(null,e),t=e.selector.length?e.selector.join(" {\n")+" {\n":"",i=new Array(e.selector.length+1).join("\n}");t&&t===n?(t&&!n&&(n=t,s=i),r.push(e.content)):(r.length&&(o.push(n+r.join("\n")+s),r.length=0),t?(n=t,s=i,r.push(e.content)):(o.push(e.content),s=n=null))}),r.length&&o.push(n+r.join("\n")+s),f&&o.push("* { content: normal !important; }"),o.join("\n\n")}function w(e,t,i){i=h[i];return parseFloat(t)/100*i+"px"}function y(e){return e.slice(0,e.indexOf("/",e.indexOf("://")+3))}return{version:"0.6.1",findProperties:o,getCss:b,init:function(e){if(!n){if((a=(e=!0===e?{force:!0}:e)||{}).isMobileSafari=g,a.isBadStockAndroid=m,!a.ignoreVmax||a.force||p||(d=!1),p||!a.force&&!g&&!d&&!m&&!f&&(!a.hacks||!a.hacks.required(a)))return window.console&&p&&console.info("viewport-units-buggyfill requires a proper CSSOM and basic viewport unit support, which are not available in IE8 and below"),{init:function(){}};var t,o,r;window.dispatchEvent(new A("viewport-units-buggyfill-init")),a.hacks&&a.hacks.initialize(a),n=!0,(i=document.createElement("style")).id="patched-viewport",document[a.appendToBody?"body":"head"].appendChild(i),t=function(){function e(){var e=this,t=arguments;clearTimeout(s),s=setTimeout(function(){i.apply(e,t)},n)}var i,n,s;i=v,n=a.refreshDebounceWait||100;window.addEventListener("orientationchange",e,!0),window.addEventListener("pageshow",e,!0),(a.force||d||function(){try{return window.self!==window.top}catch(e){return 1}}())&&(window.addEventListener("resize",e,!0),a._listeningToResize=!0),a.hacks&&a.hacks.initializeEvents(a,v,e),v()},o=0,r=function(){--o||t()},u.call(document.styleSheets,function(e){if(e.href&&y(e.href)!==y(location.href)&&"ignore"!==e.ownerNode.getAttribute("data-viewport-units-buggyfill")){o++;var t=e.ownerNode,i=r,e=t.href,n=i,s=new XMLHttpRequest;if("withCredentials"in s)s.open("GET",e,!0);else{if("undefined"==typeof XDomainRequest)throw new Error("cross-domain XHR not supported");(s=new XDomainRequest).open("GET",e)}s.onload=function(){var e=document.createElement("style");e.media=t.media,e.setAttribute("data-href",t.href),e.textContent=this.responseText,t.parentNode.replaceChild(e,t),i()},s.onerror=n,s.send()}}),o||t()}},refresh:v}})}(),!function(){!function(e,t){"use strict";"function"==typeof define&&define.amd?define("viewport-units-buggyfill.hacks",[],t):"object"==typeof exports?module.exports=t():e.viewportUnitsBuggyfillHacks=t()}(this,function(){"use strict";var r=/calc\(/g,a=/["']/g,e=window.navigator.userAgent,n=(n=/MSIE [0-9]\./i.test(e))||!!navigator.userAgent.match(/MSIE 10\.|Trident.*rv[ :]*1[01]\.| Edge\/1\d\./);return{required:function(e){return e.isMobileSafari||n},initialize:function(){},initializeEvents:function(e,t,i){e.force||n&&!e._listeningToResize&&(window.addEventListener("resize",i,!0),e._listeningToResize=!0)},findDeclarations:function(e,t,i,n){var s,o;null!==i&&(s=e,o=t,e=n,"content"===i)&&-1<e.indexOf("viewport-units-buggyfill")&&e.replace(a,"").split(";").forEach(function(e){var t,e=e.split(":");2===e.length&&"viewport-units-buggyfill"!==(t=e[0].trim())&&(e=e[1].trim(),s.push([o,t,e]),r.test(e))&&(e=e.replace(r,"-webkit-calc("),s.push([o,t,e]))})},overwriteDeclaration:function(e,t,i){return i=n&&"filter"===t?i.replace(/px/g,""):i}}})}(),define("CatLab/Webremote/Controllers/Webremote",["CatLab/Webremote/Config","CatLab/Webremote/Tools/Tracker","CatLab/Webremote/Tools/Cookies","CatLab/Webremote/Tools/Tools","CatLab/Webremote/Tools/Deferred","CatLab/Webremote/Tools/Smileys","CatLab/Webremote/Tools/Preloader","CatLab/Webremote/Controllers/OAuth2","CatLab/Webremote/Views/Popups/AuthenticationPopup","CatLab/Webremote/Views/Popups/SelectSmileyPopup","CatLab/Webremote/Views/Blocks/CurrentUser","CatLab/Webremote/Views/Blocks/CurrentSmiley","CatLab/Webremote/Collections/AuthenticatedUsers","CatLab/Webremote/Tools/Storage","CatLab/Webremote/Tools/Translator","CatLab/Webremote/Tools/HashParser","CatLab/Webremote/Views/Alert","CatLab/Webremote/Views/Welcome","CatLab/Webremote/Views/ConnectionTrouble","CatLab/Webremote/Views/GamePaused","CatLab/Webremote/Synchronization/ClientRemoteView","CatLab/Webremote/Synchronization/DataSynchronizer","CatLab/Webremote/Synchronization/EventHandler","CatLab/Webremote/Synchronization/CombinedEventHandler","CatLab/Webremote/Providers/SocketIO","CatLab/Webremote/SonicSync/Client","CatLab/Webremote/Components/Components","viewport-units-buggyfill","viewport-units-buggyfill.hacks","screenfull"],function(Config,Tracker,Cookies,Tools,Deferred,Smileys,Preloader,OAuth2,AuthenticationPopup,SelectSmileyPopup,CurrentUser,CurrentSmiley,UsersCollection,Storage,i18n,HashParser,AlertPopup,WelcomePopup,ConnectionTroubleView,GamePausedView,ClientRemoteView,DataSynchronizer,EventHandler,CombinedEventHandler,SocketIOProvider,SonicSyncClient,Components,ViewportUnitsBuggyFill,ViewportUnitsBuggyFillHacks,screenfull){"use strict";var domelement=null,user,dynamicStylesheet,triggers=[];function addEvent(e,t,i){e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent?e.attachEvent("on"+t,i):e["on"+t]=i}var Webremote=function(){};function getParameterByName(e,t){t=t||window.location.href,e=e.replace(/[\[\]]/g,"\\$&");e=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return e?e[2]?decodeURIComponent(e[2].replace(/\+/g," ")):"":null}return Webremote.prototype={provider:null,element:null,gamedata:null,stylesheets:[],links:[],scripts:[],views:{},userData:null,userEvents:null,groupData:null,groupEvents:null,smiley:null,isOauth2Set:!1,color:null,_currentSmileyViews:[],_currentViewId:null,_currentViewViewId:null,_currentViewGroupId:null,_currentView:null,_connectingDfd:null,_connectedToken:null,_headless:!1,_allowAuthentication:!0,initialize:function(e,t){void 0!==t.token?this.token=t.token:this.token=getParameterByName("token"),void 0===t&&(t={}),this.setContainer(e),this.showLoading(),this.sonicSync=null,this.components=new Components(this),this.components.initialize(),this._initialize(t).then(function(){setTimeout(function(){void 0===this.provider.showTokenForm||this.provider.showTokenForm?(this.showTokenForm(),this.trigger("remote:initialized")):this.provider.noTokenConnect()}.bind(this),2),ViewportUnitsBuggyFill.init({hacks:ViewportUnitsBuggyFillHacks})}.bind(this)),this.setPlayerColor("#000000"),this.setOrientation(),addEvent(window,"resize",this.setOrientation.bind(this))},headless:function(e){return(e=void 0===e?{}:e).headless=!0,this._initialize(e)},_initialize:function(t){var i=new Deferred;return Config.set(t),Config.initialize(function(){Tracker.track("App","Initialize"),void 0===t.provider&&(t.provider=new SocketIOProvider),void 0!==t.headless&&(this._headless=!!t.headless),this.provider=t.provider,this.smileys=new Smileys(this.provider),this.provider.initPlayer(this),this.provider.on("disconnect",function(e){var t=this.getConnectionIssuesView();console.log("Connection lost... reconnecting"),t.show(),t.text(i18n.t("Connection lost... reconnecting"))}.bind(this)),this.provider.on("reconnect",function(e){this.provider.emit("user:reconnect",{id:this.gamedata.id,accessToken:this.gamedata.accessToken}),this.getConnectionIssuesView().hide()}.bind(this)),this.provider.on("user:error",function(e){var t;this._connectingDfd&&(t=this._connectingDfd,this._connectingDfd=null,t.reject(e.message))}.bind(this)),this.provider.on("user:initialize",function(e){this.gamedata=e,this.provider.setUserId(e.id),this._storeGameData(e),this._connectingDfd&&(e=this._connectingDfd,this._connectingDfd=null,e.resolve())}.bind(this)),this.provider.on("view:load",function(e){this.loadViewsXML(e.xml)}.bind(this)),this.provider.on("view:reset",function(e){this.resetViews()}.bind(this)),this.provider.on("config:set",function(e){if(Config.set(e),this.sonicSync&&this.sonicSync.stop(),Config.useAudioSync())try{this.sonicSync=new SonicSyncClient(this),this.sonicSync.startListener()}catch(e){console.error(e)}}.bind(this)),this.provider.on("view:set",function(e){this.showView(e.id,e.viewId,e.group),this.handleCombinedMessages(e)}.bind(this)),this.provider.on("button:label",function(e){this.setLabel(e)}.bind(this)),this.provider.on("button:decorate",function(e){this.setClass(e)}.bind(this)),this.provider.on("oauth:set",function(e){Config.supportsAuthentication()&&(OAuth2.initialize(e),this.isOauth2Set=!0,UsersCollection.initialize(this,OAuth2),HashParser.getParameter("access_token"))&&(e=HashParser.getParameter("access_token"),UsersCollection.addFromAccessToken(e,function(e){e&&this.setUser(e)}.bind(this)),HashParser.clear())}.bind(this)),this.provider.on("color:set",function(e){this.setPlayerColor(e.color)}.bind(this)),this.provider.on("user:smiley",function(e){this.setSmiley(e.smiley)}.bind(this)),this.provider.on("smileys:taken",function(e){this.smileys.setTakenSmileys(e.smileys)}.bind(this)),this.provider.on("game:disconnect",function(e){AlertPopup(i18n.t("You have been disconnected from the game."),function(){window.location.reload()})}.bind(this)),this.provider.on("dom:append",function(e){this.domAppend(e)}.bind(this)),this.provider.on("dom:replace",function(e){this.domReplace(e)}.bind(this)),this.provider.on("dom:attribute",function(e){this.domAttribute(e)}.bind(this)),this.provider.on("dom:alert",function(e){AlertPopup(e.message)}),this.provider.on("dom:open",function(e){void 0!==e.url&&window.open(e.url)}),this.provider.on("value:change",function(e){this.changeValue(e)}.bind(this)),this.provider.on("device:vibrate",function(e){this.vibrate(e)}.bind(this)),this.provider.on("game:pause",function(e){this.pause(e)}.bind(this)),this.provider.on("game:unpause",function(e){this.unpause(e)}.bind(this)),this.preloader=new Preloader(this.provider),this.userData=new DataSynchronizer("user",this.emit.bind(this),"client"),this.groupData=new DataSynchronizer("group",this.emit.bind(this),"client"),this.userEvents=new EventHandler("user",this.emit.bind(this)),this.groupEvents=new EventHandler("group",this.emit.bind(this));var e=[this.userData,this.groupData],n=[this.userEvents,this.groupEvents];DataSynchronizer.eventsToListenFor.forEach(function(i){this.provider.on(i,function(t){e.forEach(function(e){e.checkNamespace(t)&&e.processMessage(i,t)})}.bind(this))}.bind(this)),EventHandler.eventsToListenFor.forEach(function(i){this.provider.on(i,function(t){n.forEach(function(e){e.checkNamespace(t)&&e.processMessage(i,t)})}.bind(this))}.bind(this)),this.events=new CombinedEventHandler,this.events.addHandler(this.userEvents),this.events.addHandler(this.groupEvents),i.resolve()}.bind(this)),i.promise()},reconnect:function(e){this.gamedata?(this.provider.emit("user:reconnect",{id:this.gamedata.id,accessToken:this.gamedata.accessToken}),this.provider.once("user:reconnect",function(){e()})):e()},connectProvider:function(e){return this.provider.tokenConnect(e)},_storeGameData:function(){var e=new Deferred,t=this._connectedToken;return Storage.set("gamestate_"+t,this.gamedata,function(){e.resolve()},864e5),e.promise()},_restoreGameData:function(){var t=new Deferred,e=this._connectedToken;return Storage.get("gamestate_"+e,function(e){e?(this.gamedata=e,t.resolve(!0)):t.resolve(!1)}.bind(this)),t.promise()},handleCombinedMessages:function(e){for(var t=[{name:"button:label",method:this.setLabel.bind(this)},{name:"button:decorate",method:this.setClass.bind(this)}],i=0;i<t.length;i++){var n=t[i].name,s=t[i].method;if(void 0!==e[n])for(var o=0;o<e[n].length;o++)s(e[n][o])}},emit:function(e,t){this.provider.toMaster(e,t)},getConnectionIssuesView:function(){return void 0===this.connectionTrouble&&(this.connectionTrouble=new ConnectionTroubleView),this.connectionTrouble},setGamePausedView:function(e){this.gamePaused=e},getGamePausedView:function(){return void 0===this.gamePaused?new GamePausedView:this.gamePaused},setContainer:function(e){domelement=e,this.element=e,dynamicStylesheet=document.createElement("style"),document.body.appendChild(dynamicStylesheet),document.body.className="catlab-remote"},on:function(e,t){void 0===triggers[e]&&(triggers[e]=[]),triggers[e].push(t)},trigger:function(e){var t=[].slice.apply(arguments);if(t.shift(),void 0!==triggers[e])for(var i=0;i<triggers[e].length;i++)triggers[e][i].apply(this,t)},loadViews:function(e,t){var i;t=t||function(){},this._headless?t():((i=new XMLHttpRequest).open("GET",Config.getProxy()+e,!0),i.onreadystatechange=function(){4==i.readyState&&200==i.status&&(this.loadViewsXML(i.responseText),t())}.bind(this),i.send())},resetViews:function(){this.views={},this.components.resetViewDefinedComponents();for(var e=0;e<this.stylesheets.length;e++)try{var t=this.stylesheets[e];t.parentNode&&t.parentNode.removeChild(t)}catch(e){console.error(e)}for(e=0;e<this.links.length;e++)try{var i=this.links[e];i.parentNode&&i.parentNode.removeChild(i)}catch(e){console.error(e)}this.stylesheets=[]},loadViewsXML:function(e,t){if(t=t||function(){},!this._headless){var i;if(Tracker.track("App","Load Views"),window.DOMParser?i=(new DOMParser).parseFromString(e,"text/xml"):((i=new ActiveXObject("Microsoft.XMLDOM")).async=!1,i.loadXML(e)),0===i.getElementsByTagName("views").length)return!1;for(var n=i.getElementsByTagName("views").item(0).getElementsByTagName("component"),s=0;s<n.length;s++)this.loadComponent(n.item(s));for(var o=i.getElementsByTagName("views").item(0).getElementsByTagName("view"),s=0;s<o.length;s++)this.loadView(o.item(s));var r=i.getElementsByTagName("views").item(0).getElementsByTagName("stylesheet");for(s=0;s<r.length;s++){var a=r.item(s),h=document.createElement("style");this.stylesheets.push(h),h.innerHTML=a.textContent,document.body.appendChild(h)}var l=i.getElementsByTagName("views").item(0).getElementsByTagName("link");for(s=0;s<l.length;s++){var c=l.item(s).getAttribute("href"),u=document.createElement("link");u.rel="stylesheet",u.type="text/css",u.media="all",u.href=c,this.links.push(u),document.getElementsByTagName("head")[0].appendChild(u)}for(r=i.getElementsByTagName("views").item(0).getElementsByTagName("style"),s=0;s<r.length;s++)this.stylesheets.push(r.item(s)),document.body.appendChild(r.item(s));var d=i.getElementsByTagName("views").item(0).getElementsByTagName("script");for(s=0;s<d.length;s++)this.scripts.push(d.item(s)),this.evalScript(d.item(s));return ViewportUnitsBuggyFill.refresh(),t(),!0}t()},evalScript:function(xml){var aWebremote=Webremote;!function(){try{var Webremote=aWebremote;eval(xml.textContent)}catch(e){console.error(e)}}.bind(window)()},loadView:function(e){var t=e.getAttribute("id"),i=document.createElement("div"),n=!1;e.getAttribute("iframe")&&"false"!==e.getAttribute("iframe").toLowerCase()&&(n=!0);for(var s=0;s<e.childNodes.length;s++)i.appendChild(e.childNodes[s].cloneNode(!0));i.id=t,i.className="view "+e.className,this.views[t]={iframe:n,html:(new XMLSerializer).serializeToString(i)},this._currentViewId===t&&this.showView(this._currentViewId,this._currentViewViewId,this._currentViewGroupId)},loadComponent:function(e){for(var t=e.getAttribute("id"),i=document.createElement("div"),n=0;n<e.childNodes.length;n++)i.appendChild(e.childNodes[n].cloneNode(!0));this.components.addViewDefinedComponent(t,i)},showView:function(e,t,i){var n,s;this._headless||(this._currentView&&this._currentView.destroy(),"remote:authenticate"!==e?(this._currentViewId=e,this._currentViewViewId=t,this._currentViewGroupId=i,void 0!==this.views[e]?(n=(i?this.groupData:this.userData).getFromIdentifier("view:"+t),s=this.views[e],this._currentView=new ClientRemoteView(this,t,e,i,n,s.iframe),this._currentView.html=s.html,this._currentView.render(this.element),this.updateUser(),Tracker.track("App","Show View",e),this.trigger("remote:view:show",{id:e,view:this._currentView}),this.trigger("view:set",this._currentView)):this.element.innerHTML='<div class="loading"><p>Please wait, loading...</p><p>(Loading view: '+e+")</div></p>"):this.showAuthenticationView())},updateUser:function(){Tracker.track("App","Set user");var e=document.getElementById("authentication");e&&new CurrentUser(this).render(e),this._currentSmileyViews=[],Config.useSmileys()?(this.setSmileySelectViews(),this.setSmileyViews()):this.removeSmileyViews()},setSmileySelectViews:function(){for(var e=document.getElementsByTagName("smiley-select"),t=0;t<e.length;t++){var i=!e[t].hasAttribute("flingable")||"false"!==e[t].getAttribute("flingable"),i=new CurrentSmiley(this,!0,i);i.render(e[t]),this.smiley&&i.setSmiley(this.smiley),this._currentSmileyViews.push(i)}},setSmileyViews:function(){for(var e=document.getElementsByTagName("smiley"),t=0;t<e.length;t++){var i=e[t].hasAttribute("changeable")&&"false"!==e[t].getAttribute("changeable"),n=e[t].hasAttribute("flingable")&&"false"!==e[t].getAttribute("flingable"),i=new CurrentSmiley(this,i,n);i.render(e[t]),this.smiley&&i.setSmiley(this.smiley),this._currentSmileyViews.push(i)}},removeSmileyViews:function(){for(var e=document.getElementsByTagName("smiley-select"),t=0;t<e.length;t++)e[t].parentNode.removeChild(e[t]);for(e=document.getElementsByTagName("smiley"),t=0;t<e.length;t++)e[t].parentNode.removeChild(e[t]);for(var i=document.getElementsByClassName("if-config-smileys"),t=0;t<i.length;t++)i[t].parentNode.removeChild(i[t])},popup:function(e){new WelcomePopup(e).render(domelement)},showAuthenticationPopup:function(e){e=e||!1;var t=new AuthenticationPopup(this);t.render(domelement),e&&t.connect()},showSmileyPopup:function(){new SelectSmileyPopup(this).render(domelement)},showAuthenticationView:function(){this.element&&(this.element.innerHTML='<p id="catlab-message">Please login.</p>',OAuth2.link({fullscreen:!0}).then(function(e){e?(this.setUser(e),this.element.innerHTML='<p id="catlab-message">Welcome! You may now close this screen.</p>',window.close()):this.showAuthenticationView()}.bind(this)))},buttonDown:function(e,t){this.provider.toMaster("button:down",{id:e})},buttonUp:function(e,t,i){this.provider.toMaster("button:up",{id:e,click:i=void 0!==i&&i}),this.trigger("user:interaction")},syncValue:function(e,t,i){return this.provider.toMaster("value:change",{id:e,value:t,viewId:i}),!1},showLoading:function(){this.element&&(this.element.innerHTML='<p id="catlab-loading">Connecting...</p>')},showTokenForm:function(){function t(e){var t=i.connect(e);e!==Cookies.getItem("last_token")&&Cookies.removeItem("last_token"),t.then(function(){Cookies.setItem("last_token",e,.25)}.bind(this)),t.fail(function(e){i.showTokenForm(),screenfull.enabled&&screenfull.isFullscreen&&screenfull.exit(),AlertPopup(e)}),i.showLoading(),i.trigger("remote:token:submit"),i.trigger("user:interaction")}var e=document.createElement("form"),i=this,n="undefined"!=typeof CONFIG_TOKEN?CONFIG_TOKEN:null,s=(n||(n=this.token,this.token=null),!1),o=(n&&(s=!0),Cookies.getItem("last_token")),o=(!n&&o&&(n=o),document.createElement("div")),r=(o.id="catlab-token-form",e.innerHTML="",e.appendChild(o),document.createElement("input")),r=(r.type="tel",r.pattern="[0-9 ]{6,10}",r.name="token",r.id="token",r.value=n||"",r.placeholder=i18n.t("Enter code"),r.addEventListener("click",function(){this.setSelectionRange(0,this.value.length)}),o.appendChild(r),document.createElement("button"));r.innerHTML=i18n.t("Connect"),o.appendChild(r);s&&t(n),e.onsubmit=function(e){e.preventDefault();e=document.getElementById("token").value;return t(e),!1},this.element.innerHTML="",this.element.appendChild(e)},requestFullScreen:function(){screenfull.enabled&&!screenfull.isFullscreen&&screenfull.request()},connect:function(e){return e=e.replace(" ",""),null!==this._connectingDfd&&(this._connectingDfd.reject(),this._connectingDfd=null),this._connectingDfd=new Deferred,this._connectedToken=e,this._connectingDfd.fail(function(){this.provider.disconnect(!1)}.bind(this)),this.connectProvider(e).fail(function(){setTimeout(function(){this._connectingDfd.reject(i18n.t("Game not found. Please check your token."))}.bind(this),1)}.bind(this)).then(function(t){var i=!0;"0"===getParameterByName("reconnect")&&(i=!1),this._restoreGameData().then(function(e){e&&i?this.reconnect(function(){this._connectingDfd.resolve()}.bind(this)):this.provider.emit("user:join",{token:t})}.bind(this))}.bind(this)),this._connectingDfd.promise()},setLabel:function(e){this._currentView&&this._currentView.setLabel(e.id,Tools.nl2br(Tools.sanitize(e.label)))},setClass:function(e){this._currentView&&this._currentView.setClass(e.id,e.styles)},setPlayerColor:function(e){if(this.color=e,void 0!==dynamicStylesheet&&dynamicStylesheet){var t,i,n="",s=(dynamicStylesheet.innerHTML=(n+=".player-color-border { border-color:"+e+"; }")+(".player-color-background { background-color: "+e+"; }")+(".player-color { color: "+e+"; }"),{"theme-color":e,"msapplication-navbutton-color":e,"apple-mobile-web-app-status-bar-style":e});for(t in s)s.hasOwnProperty(t)&&((i=document.createElement("meta")).httpEquiv=t,i.content=s[t],document.getElementsByTagName("head")[0].appendChild(i))}},setSmiley:function(t){this.smiley=t,this._currentSmileyViews.forEach(function(e){e.setSmiley(t)})},getSmiley:function(){return this.smiley},selectSmiley:function(e){this.provider.toMaster("user:smiley",{smiley:e})},setUser:function(e){user=e,this.updateUser(),user?(this.provider.toMaster("user:login",{access_token:user.getAccessToken()}),Storage.set("currentuser",user.getAccessToken()),this.getSmiley()&&(e=user.getAvatarSmiley())&&this.selectSmiley(e)):(this.provider.toMaster("user:logout"),Storage.set("currentuser",null))},getUser:function(){return user},listViews:function(){var e,t=[];for(e in this.views)this.views.hasOwnProperty(e)&&t.push({name:e});return t},getRandomText:function(e,t){var i="abcdefghijklmnopqrstuvwyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";void 0===t&&(t=40);for(var n="",s=(e=void 0===e?10:e)+Math.random()*t,o=0;o<s;o++)n+=i.charAt(Math.floor(Math.random()*i.length)),.8<Math.random()&&(o++,n+=" ");return n},randomLabels:function(e,t){for(var i=domelement.querySelectorAll("[data-button-label]"),n=0;n<i.length;n++)i[n].innerHTML=this.getRandomText(e,t);this.update()},setOrientation:function(){if(window.innerHeight>=window.innerWidth)try{document.body.classList.remove("landscape"),document.body.classList.add("portrait")}catch(e){document.body.className="portrait"}else try{document.body.classList.add("landscape"),document.body.classList.remove("portrait")}catch(e){document.body.className="landscape"}this.components.resize()},domAppend:function(e){this._currentView&&(this._currentView.domAppend(e.id,e.html),this.components.update())},domReplace:function(e){this._currentView&&(this._currentView.domReplace(e.id,e.html),this.components.update())},domAttribute:function(e){this._currentView&&(this._currentView.domAttribute(e.id,e.name,e.value),this.components.update())},changeValue:function(e){this._currentView&&this._currentView.changeValue(e)},vibrate:function(e){this._currentView&&this._currentView.vibrate(e)},pause:function(e){void 0===this._gamePausedView&&(this._gamePausedView=this.getGamePausedView()),this._gamePausedView.show()},unpause:function(e){void 0!==this._gamePausedView&&this._gamePausedView.hide()},log:function(e){Config.debug()&&console.log(e)},canAuthenticate:function(){return this.isOauth2Set},getGroupIds:function(){return void 0===this.gamedata.groups?[]:this.gamedata.groups},resolveDataAttribute:function(e){if("token"===e)return this._connectedToken;var i,e=(e="data."===e.substring(0,5)?e.substring(5):e).split("."),t=(2!==e.length&&e.unshift("any"),e.shift()),e=e.shift();if(t===user)return this.userData.getFromIdentifier("user").get(e);if("group"===t.substring(0,5)){var n,s=this.getGroupIds();if(0===s.length)return null;if("group"===t)return this.groupData.getFromIdentifier("group:"+s[0]).get(e);if("]"===t.substring(t.length,1))return void 0===s[n=t.substr(t.substring(6,t.length-1))]?null:this.groupData.getFromIdentifier("group:"+s[n]).get(e)}return"any"===t&&(i=["user."+e],this.getGroupIds().forEach(function(e,t){i.push("group["+t+"]")}.bind(this))),null}},Webremote}),define("CatLab/Webremote/Tools/ParseXML",[],function(){function e(){}var t=null;"undefined"!=typeof window&&(void 0!==window.DOMParser?t=function(e){return(new window.DOMParser).parseFromString(e,"text/xml")}:void 0!==window.ActiveXObject&&new window.ActiveXObject("Microsoft.XMLDOM")&&(t=function(e){var t=new window.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}));return e.prototype.parse=function(e){if(t)return t(e);throw new Error("No XML parser found")},new e}),define("CatLab/Webremote/Providers/Airconsole",["CatLab/Webremote/Providers/Provider","CatLab/Webremote/Config","CatLab/Webremote/Tools/Deferred","CatLab/Webremote/Tools/Proxy","CatLab/Webremote/Tools/ParseXML","CatLab/Webremote/Synchronization/MessageQueue","CatLab/Webremote/Models/User"],function(e,t,i,n,s,o,r){function a(e){e&&(this.airconsole=e),this.showTokenForm=!1,this.oauth={},this.views=[],this.knownUsers={},this.started=!1,this.userId=null,this.sendBurstDelay=50,this.connectCode=null}e=a.prototype=new e;return e.connect=function(e){return this.log("Airconsole connecting"),this.setInitialized(),this.path=e,this._trigger("connect",null),this.readyState.promise()},e.noTokenConnect=function(){return this.connect("remote")},e.setUserId=function(e){return this.userId=e,this},e.initMaster=function(e){this.master=e,this.airconsole||(this.airconsole=new AirConsole),this.airconsole.onMessage=this.onMessage.bind(this),this.airconsole.onConnect=function(e){this.emitAirConsole(e,"airconsole:well-hello-there",{user:e})}.bind(this),this.readyState=new i,this.airconsole.onReady=function(e){this.connectCode=e,this.readyState.resolve()}.bind(this),this.airconsole.onDeviceProfileChange=function(e){this.updateDeviceProfile(e)}.bind(this),this.on("player:join",function(e){this.onPlayerConnect(e.user)}.bind(this)),this.once("connect",function(){setTimeout(function(){this.started=!0}.bind(this),1)}.bind(this))},e.initPlayer=function(e){this.master=e,this.airconsole=new AirConsole,this.airconsole.onMessage=this.onMessage.bind(this),this.readyState=new i,this.readyState.resolve(),this.once("airconsole:well-hello-there",function(e){this.emitAirConsole(0,"player:join",{})}.bind(this))},e.onMessage=function(t,e){var i;void 0!==(e="string"==typeof e?JSON.parse(e):e).b&&Array.isArray(e.b)?(i=0,e.b.forEach(function(e){setTimeout(function(){this.processMessage(t,e)}.bind(this),i++)}.bind(this))):this.processMessage(t,e)},e.processMessage=function(e,t){var i;t&&t[0]&&(i=t[0],t=t[1],this.isMaster()&&(0<e&&"player:join"!==i&&void 0===this.knownUsers[e]&&this.onPlayerConnect(e),0<e)&&(t.user=e),o.unpack(t,"user").forEach(function(e){this.isRemote()&&void 0!==e.user&&e.user!==this.airconsole.getDeviceId()||this._trigger(i,e)}.bind(this)))},e.onPlayerConnect=function(e){this.log("Welcoming our newest player "+e),this.knownUsers[e]=!0;for(var t=0;t<this.views.length;t++)this.emitAirConsole(e,"view:load",{xml:this.views[t]}),this.emitAirConsole(e,"view:set",{id:"loading"});this._trigger("user:join",{id:e}),this.updateDeviceProfile(e)},e.updateDeviceProfile=function(e){var t,i,n=this.master._userlibrary.getFromId(e);n&&(t={username:this.airconsole.getNickname(e)},(i=this.airconsole.getProfilePicture(e))&&(t.avatar=i),this.airconsole.getMasterControllerDeviceId()===e&&n.setMaster(!0),n.setProfiledata(t))},e.emitAll=function(){this.isMaster()&&this.emitMaster(),this.isRemote()&&this.emitClient()},e.isMaster=function(){return"control"===this.path},e.isRemote=function(){return"remote"===this.path},e.emitClient=function(){this.queue.flush().forEach(function(e){this.emitAirConsole(0,e.action,e.data)}.bind(this))},e.emitMaster=function(){var t,i,e=this.queue.compactFlush();e.length&&(t=5<e.length,i=[],e.forEach(function(e){t||void 0===e.data.user||Array.isArray(e.data.user)&&1<e.data.user.length?i.push(e):this.emitAirConsole(e.user,e.action,e.data)}.bind(this)),0<i.length)&&this.broadcastAirconsole(i)},e.emitAirConsole=function(e,t,i){t=[t,i],delete t[1].action,i=JSON.stringify(t);this.airconsole.message(e,i)},e.broadcastAirconsole=function(e){var t=[],e=(e.forEach(function(e){t.push([e.action,e.data])}),JSON.stringify({b:t}));this.airconsole.broadcast(e)},e.setOAuthSettings=function(e){this.oauth=e,this.toPlayers("oauth:set",e)},e.loadViews=function(e){n.get(e).then(function(e){this.views.push(e),this.toPlayers("view:load",{xml:e})}.bind(this))},e.log=function(){this.master.log.apply(arguments)},e.setup=function(e){this._trigger("master:initialize",{})},e.toMaster=function(e,t){t.user=0,this.emit(e,t)},e.log=function(e){var t=[],i=(Array.prototype.push.apply(t,arguments),"["+this.path+"]");"remote"===this.path&&(i="["+this.path+":"+this.airconsole.getDeviceId()+"]"),t.unshift(i),console.log.apply(console,t)},e.getConnectInstructions=function(){return["Open the Airconsole app on your smartphone and connect with code %s.",this.connectCode]},e.getStartAndLoginInstructions=function(){return["Use the onscreen button to start the game."]},a}),define("CatLab/Webremote/FrontWebremote",["CatLab/Webremote/Config","CatLab/Webremote/Polyfills","CatLab/Webremote/Tools/Tracker","CatLab/Webremote/Tools/Tools","CatLab/Webremote/Controllers/Webremote","CatLab/Webremote/Controllers/OAuth2","CatLab/Webremote/Tools/Smileys","CatLab/Webremote/Providers/SocketIO","CatLab/Webremote/Providers/Airconsole"],function(t,e,i,n,s,o,r,a,h){return{Config:function(e){t.set(e)},Tracker:i,Tools:n,Webremote:new s,OAuth2:o,Controllers:{Webremote:s},Providers:{SocketIO:a,Airconsole:h},Smileys:r}}),define("webremote",["CatLab/Webremote/FrontWebremote"],function(e){return e}),s=i=i||{},h=h||{},t=a=a||{},void 0!==t.Container&&(s.properties={width:720,height:480,fps:24,color:"#FFFFFF",manifest:[]},(s.UserIcon=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#592230").s().p("Al2F2IAArsILsAAIAALsg"),this.shape.setTransform(37.5,37.5),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(0,0,75,75),e.frameBounds=[A],(s.TextPlaceholderBackground=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#FF00FF").s().p("AnzHzIAAvmIPmAAIAAPmg"),this.shape.setTransform(50,50),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(0,0,100,100),e.frameBounds=[A],(s.Marker=function(){this.initialize()}).prototype=e=new t.Container,e.nominalBounds=A=null,e.frameBounds=[A],(s.PointerInactive=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#320B1F").s().p("AjQiRIENALICfCGIiTCHIkkALg"),this.shape.setTransform(-22,0),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(-44,-14.7,44.1,29.4),e.frameBounds=[A],(s.PointerActive=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#006633").s().p("AjQiRIENALICfCGIiTCHIkkALg"),this.shape.setTransform(-22,.1),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(-44,-14.6,44.1,29.4),e.frameBounds=[A],(s.Checkbox=function(e,i,n){this.initialize(e,i,n=null==n?!1:n,{Up:0,Over:1,Down:2,Hit:3}),this.frame_0=function(){this.stop()},this.frame_1=function(){this.stop()},this.frame_2=function(){this.stop()},this.frame_3=function(){this.stop()},this.timeline.addTween(t.Tween.get(this).call(this.frame_0).wait(1).call(this.frame_1).wait(1).call(this.frame_2).wait(1).call(this.frame_3).wait(1)),this.shape=new t.Shape,this.shape.graphics.f("#FF873C").s().p("AizAVQgagpgVgoIgXgsIADgQIADgEQAFgEAJgCQAKAZATAkQANAYASAdQAxBQAOAeQALg8CFhhIAIgGQCGhhA7AVIAGgCQAEACABAPQgmAPg/ApQgpAcgpAiQhQBChRBfQgngxguhPg"),this.shape.setTransform(25,23),this.shape._off=!0,this.timeline.addTween(t.Tween.get(this.shape).wait(2).to({_off:!1},0).wait(2)),this.shape_1=new t.Shape,this.shape_1.graphics.f().s("#8B504F").ss(5).p("ABfheIAAC9Ii9AAIAAi9g"),this.shape_1.setTransform(19.2,19.2,2.023,2.023),this.shape_2=new t.Shape,this.shape_2.graphics.f("#592230").s().p("AheBeIAAi8IC9AAIAAC8g"),this.shape_2.setTransform(19.2,19.2,2.023,2.023),this.shape_3=new t.Shape,this.shape_3.graphics.f("#FFC39F").s().p("AheBeIAAi8IC9AAIAAC8g"),this.shape_3.setTransform(19.2,19.2,2.023,2.023),this.shape_4=new t.Shape,this.shape_4.graphics.f().s("#8B504F").ss(5).p("ADAi/IAAF/Il/AAIAAl/g"),this.shape_4.setTransform(-13.2,12.3,1,1,0,0,0,-32.4,-6.9),this.timeline.addTween(t.Tween.get({}).to({state:[{t:this.shape_2},{t:this.shape_1,p:{x:19.2,y:19.2}}]}).to({state:[{t:this.shape_3,p:{x:19.2,y:19.2}},{t:this.shape_1,p:{x:19.2,y:19.2}}]},1).to({state:[{t:this.shape_2},{t:this.shape_1,p:{x:19.2,y:19.2}}]},1).to({state:[{t:this.shape_4},{t:this.shape_3,p:{x:19.4,y:18.9}},{t:this.shape_1,p:{x:19.4,y:18.9}}]},1).wait(1))}).prototype=e=new t.MovieClip,e.nominalBounds=A=new t.Rectangle(-2.5,-2.5,43.5,43.4),e.frameBounds=[A,A,new t.Rectangle(-2.5,-2.5,52.5,43.4),new t.Rectangle(-2.5,-2.8,52.5,43.7)],(s.CogVector=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#282A1F").s().p("Ag/MAQgehhgLhlQgbgEgvgOIgkgNQgUgIgOgIQhLBKhXA3QgsgbgwgqQAkhoAvhQQgdgegUgdQgKgLgLgUIgUghQhpAQhlgGQgVg1gNg5QBOg4BhgtQgCgPgBgXIgCglQABgxAEgZQhggzhMg/QAIgiAchLQBoABBhAVQAZgtAQgTQAUgdAdgeQgshWgdhrQA9gwAhgTQBQA8BGBMQAOgIAUgIIAkgNQAvgNAbgFQAShsAlhbQAwgEBBAFQAeBhALBlQAbAFAvANIAkANQAUAIAOAIQBLhKBXg3QAsAbAwAqQgkBogvBQQAdAeAUAdQAQATAZAtQBpgQBlAGQAWA5AMA1QhOA4hhAtQAEAZABAxIgCAlQgBAXgCAPQBgAzBMA/QgHAigdBLQhogBhhgVQgZAtgQATQgUAdgdAeQAsBWAdBrQg9AwghATQhQg8hGhMQgOAIgUAIIgkANQgvAOgbAEQgSBsglBbQgXACgaAAQgdAAgjgDgAhtlTQg3ASgtAhQgvAiggAtQhDBagCB3QACB4BDBaQAgAtAvAiQAtAhA3ASQA1ASA4AAQA5AAA1gSQA3gSAtghQAvgiAggtQBDhaACh4QgCh3hDhaQgggtgvgiQgtghg3gSQg1gRg5AAQg4AAg1ARg"),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(-75,-77.1,150.1,154.3),e.frameBounds=[A],(s.ListUsers=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#00CCFF").s().p("A5DK/IAA19MAyHAAAIAAV9g"),this.shape.setTransform(158.5,71),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(-2,.6,320.9,140.7),e.frameBounds=[A],(s.lstUsers=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#0066CC").s().p("A5YGoIAAtQMAywAAAIAANQg"),this.shape.setTransform(162.5,42.5),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(0,0,325,85),e.frameBounds=[A],(s.SmartphoneIcon=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#FFFFFF").s().p("AhNCvQgJAAgHgIQgHgGAAgKIAAksQAAgLAHgGQAHgIAJAAICaAAQAKAAAHAIQAHAGAAALIAAEsQAAAKgHAGQgHAIgKAAgAgHCPQgEADAAAFQAAAFAEADQAEAEADAAQAEAAAEgEQADgDAAgFQAAgFgDgDQgEgDgEAAQgDAAgEADgAhUCDICoAAIAAkLIioAAgAgaiaQAAABAAABQAAAAAAABQABAAAAAAQABABABAAIAwAAQAAAAABgBQAAAAAAAAQABgBAAAAQAAgBAAgBQAAAAAAgBQAAAAgBAAQAAgBAAAAQgBAAAAAAIgwAAQgBAAgBAAQAAAAgBABQAAAAAAAAQAAABAAAAg"),this.shape.setTransform(42.9,42,1.857,1.857),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(24.1,9.5,37.7,65),e.frameBounds=[A],(s.TabletIcon=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#FFFFFF").s().p("AhvCeQgKAAgHgHQgGgHAAgJIAAkNQAAgKAGgGQAHgHAKAAIDfAAQAKAAAGAHQAHAHAAAJIAAENQAAAJgHAHQgGAHgKAAgAgeCLIA8AAIAAgHIg8AAgAhvBuIDfAAIAAjvIjfAAg"),this.shape.setTransform(43,43,1.642,1.642),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(20.8,17,44.6,52.1),e.frameBounds=[A],(s.JoystickIcon=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#FFFFFF").s().p("AA1BaQgYgagdABQgdgBgYAaQgYAZgNAAQgMAAgIgMQgIgMgBgUQABgqAVggQAUgeAVAAQANAAANAIQAOAJAIACQACgXALgPQASgVAlgBQAYAAALgOQAEgHAAgJQAAgKALAAQADABADACQAEAEAAADQAAASgNAOQgQASgfABQgsAAgGAmQAGgBAQgJQAMgJANABQAUAAAUAeQAXAgAAAqQgBAVgIAMQgJALgMAAQgMAAgZgZgAAzAuQgEAEAAAFQAAAFADAEQAEADAGAAQAFABADgEQAEgEAAgFQAAgFgEgEQgEgEgEgBQgFABgEAEgAhZAtIAVAAIAAAUIAUAAIAAgUIATAAIAAgUIgTAAIAAgVIgUAAIAAAVIgVAAgABGAaQgDADAAAGQAAAFADAEQAFADAEAAQAFAAAEgDQAEgFAAgEQAAgGgEgDQgEgFgFAAQgEAAgFAFgAAeAaQgEADAAAGQAAAFAEAEQAEADAFAAQAGAAADgDQAEgEAAgFQAAgGgDgDQgFgFgEAAQgFAAgFAFgAAyAFQgDAFAAAEQAAAGAEAEQAEAEAFAAQAEAAAEgEQAEgEAAgGQAAgEgEgFQgEgEgEAAQgGAAgEAEg"),this.shape.setTransform(42,42,2.476,2.476),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(12.3,13.5,59.5,57),e.frameBounds=[A],(s.KeyboardIcon=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f("#FFFFFF").s().p("AkMEzQgiAAgXgWQgYgXAAgjIAAjYQAAggAYgXQAXgXAiAAID3AAQAAhLAkgeQAWgTA0gHQApgFAOgLQAUgRAAg1QAAgWAXAAQAXAAABAWQAABOgoAeQgWASg1AHQgpAGgOAKQgUAQAAA0ID2AAQAjAAAWAXQAZAXAAAgIAADYQAAAjgZAXQgWAWgjAAgADWDjIA1AAIAAg1Ig1AAgAi8DjIF3AAIAAg1Il3AAgAkMDjIA1AAIAAg1Ig1AAgACgCTIA2AAIAAg4Ig2AAgABQCTIA1AAIAAg4Ig1AAgAAACTIA1AAIAAg4Ig1AAgAhRCTIA2AAIAAg4Ig2AAgAihCTIA1AAIAAg4Ig1AAgAjyCTIA2AAIAAg4Ig2AAgADWBBIA1AAIAAg2Ig1AAgACFBBIA2AAIAAg2Ig2AAgAA1BBIA1AAIAAg2Ig1AAgAgbBBIA1AAIAAg2Ig1AAgAhsBBIA2AAIAAg2Ig2AAgAi8BBIA2AAIAAg2Ig2AAgAkMBBIA1AAIAAg2Ig1AAg"),this.shape.setTransform(42,41.8,.773,.773),this.addChild(this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(15,18,54.1,47.6),e.frameBounds=[A],(s.CloseButton=function(){this.initialize(),this.shape=new t.Shape,this.shape.graphics.f().s("#000000").ss(1,1,1).p("AAPABQAjgvAAgXQAhhJAIgLAhjiQIByCRAiICaIBLAAQAjhXAgg2QAFgGAEgGIB6CZ"),this.shape.setTransform(10,19.5),this.shape_1=new t.Shape,this.shape_1.graphics.f("#666666").s().p("Ai+C/IAAl9IF9AAIAAF9g"),this.shape_1.setTransform(12.6,19.4),this.addChild(this.shape_1,this.shape)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(-6.6,.3,38.3,38.3),e.frameBounds=[A],(s.btnLink=function(){this.initialize(),this.text=new t.Text("Link a new account","20px 'Times New Roman'","#FF0033"),this.text.lineHeight=22,this.text.lineWidth=235,this.text.setTransform(2.3,-1.7),this.shape=new t.Shape,this.shape.graphics.f("#666666").s("#FFFFFF").ss(1,1,1).dr(-83.5,-13,167,26),this.shape.setTransform(83.5,13),this.addChild(this.shape,this.text)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(-1,-1.7,242.5,28.7),e.frameBounds=[A],(s.Placeholder=function(){this.initialize(),this.instance=new s.TextPlaceholderBackground,this.addChild(this.instance)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(0,0,100,100),e.frameBounds=[A],(s.Pointer=function(e,i,n){this.initialize(e,i,n=null==n?!1:n,{Up:0,Over:1,Down:2,Out:3}),this.instance=new s.PointerInactive("synched",0,!1),this.instance.setTransform(3,5,.639,.774,90,0,0,7.8,-3.9),this.instance_1=new s.PointerActive("synched",0),this.instance_1.setTransform(3,5,.639,.774,90,0,0,7.8,-3.9),this.timeline.addTween(t.Tween.get({}).to({state:[{t:this.instance}]}).to({state:[{t:this.instance_1,p:{x:3,y:5}}]},1).to({state:[{t:this.instance_1,p:{x:3,y:5}}]},1).to({state:[{t:this.instance_1,p:{x:3.1,y:5.1}}]},1).wait(1))}).prototype=e=new t.MovieClip,e.nominalBounds=A=new t.Rectangle(-11.4,-28.1,22.8,28.2),e.frameBounds=[A,A,A,new t.Rectangle(-11.4,-28,22.8,28.2)],(s.Button=function(e,i,n){this.initialize(e,i,n=null==n?!1:n,{Over:1,"Over-NoAnim":6,Up:7,"Up-NoAnim":11,Down:12,Hit:13}),this.frame_0=function(){this.stop()},this.frame_6=function(){this.stop()},this.frame_11=function(){this.stop()},this.frame_12=function(){this.stop()},this.frame_13=function(){this.stop()},this.timeline.addTween(t.Tween.get(this).call(this.frame_0).wait(6).call(this.frame_6).wait(5).call(this.frame_11).wait(1).call(this.frame_12).wait(1).call(this.frame_13).wait(1)),this.text=new s.Placeholder,this.text.setTransform(13.7,13.7,1.739,.494,0,.4,.5,.1,.8),this.timeline.addTween(t.Tween.get(this.text).wait(1).to({scaleX:1.89,rotation:.4,skewX:0,skewY:0,x:5.7},0).to({scaleY:.57,rotation:5.4,x:8.7,y:1.7},5).to({scaleY:.54,rotation:5.2,x:8.4,y:2},1).to({scaleY:.49,rotation:.4,x:5.7,y:13.7},4).wait(1).to({rotation:.4},0).wait(2)),this.shape=new t.Shape,this.shape.graphics.f("#0F0609").s().p("A42D+Ii+oDMA3pgAIIkyIbg"),this.shape.setTransform(103.3,39.2,.566,1),this.shape_1=new t.Shape,this.shape_1.graphics.f("#0F0609").s().p("AxBE1IiBp0MAmGgAKIjSKTg"),this.shape_1.setTransform(103.4,39.1,.821,.821),this.shape_2=new t.Shape,this.shape_2.graphics.f("#0F0609").s().p("AuwDkIhboZMAgWABDIjGIog"),this.shape_2.setTransform(104.2,39.3),this.shape_3=new t.Shape,this.shape_3.graphics.f("#0F0609").s().p("AvXDTIhOoqMAhLAB9IjaIyg"),this.shape_3.setTransform(104.8,39),this.shape_4=new t.Shape,this.shape_4.graphics.f("#0F0609").s().p("AvzDHIhFo2MAhxACmIjpI5g"),this.shape_4.setTransform(105.2,38.9),this.shape_5=new t.Shape,this.shape_5.graphics.f("#0F0609").s().p("AwEDAIhAo+MAiJADAIjyI9g"),this.shape_5.setTransform(105.5,38.7),this.shape_6=new t.Shape,this.shape_6.graphics.f("#0F0507").s().p("AvmDNIhKoxMAhhACUIjiI1g"),this.shape_6.setTransform(105,38.9),this.shape_7=new t.Shape,this.shape_7.graphics.f("#0F0305").s().p("AvDDbIhVohMAgxABgIjRItg"),this.shape_7.setTransform(104.5,39.2),this.shape_8=new t.Shape,this.shape_8.graphics.f("#0F0202").s().p("AugDrIhgoTMAgBAAsIi+Ikg"),this.shape_8.setTransform(103.9,39.4),this.shape_9=new t.Shape,this.shape_9.graphics.f("#0F0000").s().p("At9D+IhroDIfRgIIisIbg"),this.shape_9.setTransform(103.4,39.2),this.shape_10=new t.Shape,this.shape_10.graphics.f("#990000").s().p("AxBE1IiBp0MAmGgAKIjSKTg"),this.shape_10.setTransform(103.4,39.1,.821,.821),this.shape_11=new t.Shape,this.shape_11.graphics.f("#0F51B8").s().p("AxBE1IiBp0MAmGgAKIjSKTg"),this.shape_11.setTransform(103.4,39.1,.821,.821),this.timeline.addTween(t.Tween.get({}).to({state:[{t:this.shape}]}).to({state:[{t:this.shape_1,p:{scaleX:.821,scaleY:.821,rotation:0,x:103.4,y:39.1}}]},1).to({state:[{t:this.shape_2}]},1).to({state:[{t:this.shape_3}]},1).to({state:[{t:this.shape_4}]},1).to({state:[{t:this.shape_5}]},1).to({state:[{t:this.shape_1,p:{scaleX:.903,scaleY:.903,rotation:5.4,x:102.8,y:39.2}}]},1).to({state:[{t:this.shape_1,p:{scaleX:.903,scaleY:.903,rotation:5.4,x:102.8,y:39.2}}]},1).to({state:[{t:this.shape_6}]},1).to({state:[{t:this.shape_7}]},1).to({state:[{t:this.shape_8}]},1).to({state:[{t:this.shape_9}]},1).to({state:[{t:this.shape_10}]},1).to({state:[{t:this.shape_11}]},1).wait(1)),this.shape_12=new t.Shape,this.shape_12.graphics.f().s("#0F0609").ss(2).p("ATyluMgnlAAPIB4LOMAi0gAUg"),this.shape_12.setTransform(103.9,39.4,.826,.821,0,0,0,-.2,0),this.shape_13=new t.Shape,this.shape_13.graphics.f().s("#0A6006").ss(2).p("Aw0kaMAhpgAsIiVJgI9lAtg"),this.shape_13.setTransform(103.5,39.3,1,1,0,0,0,.1,0),this.shape_14=new t.Shape,this.shape_14.graphics.f().s("#05A503").ss(2).p("AxSkVMAikgBFIiSJyI+ZBDg"),this.shape_14.setTransform(103.1,39.2,1,1,0,0,0,.1,0),this.shape_15=new t.Shape,this.shape_15.graphics.f().s("#02D701").ss(2).p("AxmkRMAjNgBYIiQKAI+9BTg"),this.shape_15.setTransform(102.7,39.2,1,1,0,0,0,.1,0),this.shape_16=new t.Shape,this.shape_16.graphics.f().s("#01F500").ss(2).p("AxykPMAjlgBiIiOKHI/UBdg"),this.shape_16.setTransform(102.5,39.1,1,1,0,0,0,.1,0),this.shape_17=new t.Shape,this.shape_17.graphics.f().s("#00FF00").ss(2).p("ATyluMgnlAAPIB4LOMAi0gAUg"),this.shape_17.setTransform(103.4,39.4,.903,.903,-2.2,0,0,-.2,0),this.shape_18=new t.Shape,this.shape_18.graphics.f().s("#0FFF00").ss(2).p("ATyluMgnlAAPIB4LOMAi0gAUg"),this.shape_18.setTransform(103.4,39.4,.903,.903,-2.2,0,0,-.2,0),this.shape_19=new t.Shape,this.shape_19.graphics.f().s("#0FC102").ss(2).p("AxdkTMAi6gBPIiQJ6I+uBMg"),this.shape_19.setTransform(102.9,39.2,1,1,0,0,0,.1,0),this.shape_20=new t.Shape,this.shape_20.graphics.f().s("#0F8305").ss(2).p("AxDkXMAiGgA5IiTJpI9/A4g"),this.shape_20.setTransform(103.3,39.3,1,1,0,0,0,.1,0),this.shape_21=new t.Shape,this.shape_21.graphics.f().s("#0F4407").ss(2).p("AwpkbMAhSgAjIiVJZI9SAkg"),this.shape_21.setTransform(103.7,39.3,1,1,0,0,0,.1,0),this.timeline.addTween(t.Tween.get({}).to({state:[{t:this.shape_12}]}).to({state:[{t:this.shape_12}]},1).to({state:[{t:this.shape_13}]},1).to({state:[{t:this.shape_14}]},1).to({state:[{t:this.shape_15}]},1).to({state:[{t:this.shape_16}]},1).to({state:[{t:this.shape_17}]},1).to({state:[{t:this.shape_18}]},1).to({state:[{t:this.shape_19}]},1).to({state:[{t:this.shape_20}]},1).to({state:[{t:this.shape_21}]},1).to({state:[{t:this.shape_12}]},1).to({state:[{t:this.shape_12}]},1).to({state:[{t:this.shape_12}]},1).wait(1)),this.timeline.addTween(t.Tween.get(this.shape_12).wait(1).to({scaleX:.82},0).to({_off:!0},1).wait(9).to({_off:!1},0).wait(3)),this.shape_22=new t.Shape,this.shape_22.graphics.f("#592230").s().p("A0sFHIAysmMAonACoIloMXg"),this.shape_22.setTransform(109.6,39.4,.826,.821),this.shape_23=new t.Shape,this.shape_23.graphics.f("#592230").s().p("AxqECIA4qsMAidAC7Ik/Kag"),this.shape_23.setTransform(109.5,39.1),this.shape_24=new t.Shape,this.shape_24.graphics.f("#592230").s().p("AyMD5IBDq8MAjXADgIlTKng"),this.shape_24.setTransform(109.6,38.9),this.shape_25=new t.Shape,this.shape_25.graphics.f("#592230").s().p("AylD0IBMrKMAj/AD8IlfKxg"),this.shape_25.setTransform(109.5,38.8),this.shape_26=new t.Shape,this.shape_26.graphics.f("#592230").s().p("Ay0DwIBRrRMAkYAEMIlnK3g"),this.shape_26.setTransform(109.5,38.7),this.shape_27=new t.Shape,this.shape_27.graphics.f("#592230").s().p("AyaD2IBIrEMAjtADwIlZKsg"),this.shape_27.setTransform(109.6,38.9),this.shape_28=new t.Shape,this.shape_28.graphics.f("#592230").s().p("Ax7D9IA9q0MAi7ADOIlKKhg"),this.shape_28.setTransform(109.6,39.1),this.shape_29=new t.Shape,this.shape_29.graphics.f("#592230").s().p("AxdEFIA0qlMAiGACsIk3KVg"),this.shape_29.setTransform(109.6,39.2),this.timeline.addTween(t.Tween.get({}).to({state:[{t:this.shape_22}]}).to({state:[{t:this.shape_22}]},1).to({state:[{t:this.shape_23}]},1).to({state:[{t:this.shape_24}]},1).to({state:[{t:this.shape_25}]},1).to({state:[{t:this.shape_26}]},1).to({state:[{t:this.shape_22}]},1).to({state:[{t:this.shape_22}]},1).to({state:[{t:this.shape_27}]},1).to({state:[{t:this.shape_28}]},1).to({state:[{t:this.shape_29}]},1).to({state:[{t:this.shape_22}]},1).to({state:[{t:this.shape_22}]},1).to({state:[{t:this.shape_22}]},1).wait(1)),this.timeline.addTween(t.Tween.get(this.shape_22).wait(1).to({scaleX:.82,x:109.5},0).to({_off:!0},1).wait(4).to({_off:!1,scaleX:.9,scaleY:.9,rotation:3,x:109.6},0).wait(1).to({_off:!0},1).wait(3).to({_off:!1,scaleX:.82,scaleY:.82,rotation:0,x:109.5},0).wait(3))}).prototype=e=new t.MovieClip,e.nominalBounds=A=new t.Rectangle(-1.8,0,220.9,78.8),e.frameBounds=[A,new t.Rectangle(-1.1,0,219.5,78.8),new t.Rectangle(-5.5,-3.6,228.3,85.4),new t.Rectangle(-8.9,-6.3,235.1,90.6),new t.Rectangle(-11.3,-8.3,240,94.3),new t.Rectangle(-12.8,-9.5,242.9,96.5),A=new t.Rectangle(-13.3,-9.9,243.9,97.2),A,new t.Rectangle(-10.2,-7.4,237.8,92.6),new t.Rectangle(-7.2,-4.9,231.7,88),new t.Rectangle(-4.1,-2.5,225.5,83.4),A=new t.Rectangle(-1.1,0,219.5,78.8),A,A],(s.Cog=function(e,i,n){this.initialize(e,i,n=null==n?!1:n,{}),this.frame_14=function(){this.gotoAndPlay(1)},this.timeline.addTween(t.Tween.get(this).wait(14).call(this.frame_14).wait(1)),this.instance=new s.CogVector("synched",0),this.instance.setTransform(75.1,77.1),this.timeline.addTween(t.Tween.get(this.instance).to({rotation:36},14).wait(1))}).prototype=e=new t.MovieClip,e.nominalBounds=A=new t.Rectangle(0,0,150.2,154.3),e.frameBounds=[A,new t.Rectangle(-.6,.1,151.6,154.2),new t.Rectangle(-1.2,.1,152.7,154.1),new t.Rectangle(-1.6,.3,153.5,153.8),new t.Rectangle(-1.9,.6,154,153.1),new t.Rectangle(-2,1.1,154.1,152.1),new t.Rectangle(-2,1.7,154.1,151),new t.Rectangle(-2,2.2,154.1,149.9),new t.Rectangle(-2,1.5,154.1,151.3),new t.Rectangle(-2,1,154.1,152.4),new t.Rectangle(-1.8,.6,153.8,153.3),new t.Rectangle(-1.4,.2,153,153.8),new t.Rectangle(-1,.2,152.2,154),new t.Rectangle(-.4,.2,150.9,154),new t.Rectangle(0,.1,150.2,154.1)],(s.Signin=function(){this.initialize(),this.close=new s.CloseButton,this.close.setTransform(526.3,132.5,1,1,0,0,0,10,19.5),this.users=new s.ListUsers,this.users.setTransform(206.7,159.2);var e=new t.Shape;e._off=!0,e.graphics.p("A4tIoIAAsrMAypAAAIAAMrg"),e.setTransform(166.1,55.3),this.btnLinkAccount=new s.btnLink,this.btnLinkAccount.setTransform(367.6,325.3,1,1,0,0,0,83.5,13),this.title=new t.Text("Select your profile","20px 'Times New Roman'","#FFFFFF"),this.title.name="title",this.title.lineHeight=22,this.title.lineWidth=217,this.title.setTransform(202.8,116.1),this.shape=new t.Shape,this.shape.graphics.f("#999999").s().p("A68SPMAAAgkdMA15AAAMAAAAkdg"),this.shape.setTransform(367.5,229.7),this.shape_1=new t.Shape,this.shape_1.graphics.f("rgba(0,0,0,0.498)").s().p("Eg4TAlfMAAAhK9MBwnAAAMAAABK9g"),this.shape_1.setTransform(359.5,240),this.addChild(this.shape_1,this.shape,this.title,this.btnLinkAccount,this.users,this.close)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(-1,0,721,480),e.frameBounds=[A],(s.PortalView=function(){this.initialize(),this.ListActiveUsers=new s.lstUsers,this.ListActiveUsers.setTransform(523.3,139.8,1,1,0,0,0,162.2,42),this.ListConnectedDevices=new s.lstUsers,this.ListConnectedDevices.setTransform(190.3,139.8,1,1,0,0,0,163.3,42),this.shape=new t.Shape,this.shape.graphics.f().s("rgba(255,255,255,0)").ss(.1,1,1).p("AvJkmIeTAAIAAJNI+TAAg"),this.shape.setTransform(327,308.5),this.text=new t.Text("Active users","30px 'Times New Roman'","#FFFFFF"),this.text.lineHeight=32,this.text.lineWidth=284,this.text.setTransform(374,25.3),this.text_1=new t.Text("Connected users","30px 'Times New Roman'","#FFFFFF"),this.text_1.lineHeight=32,this.text_1.lineWidth=284,this.text_1.setTransform(27,25.3),this.shape_1=new t.Shape,this.shape_1.graphics.f().s("#666666").ss(1,1,1).p("EgzYAAAMBmyAAA"),this.shape_1.setTransform(357.1,65),this.shape_2=new t.Shape,this.shape_2.graphics.rf(["#333333","#000000","#000000"],[0,.6,1],0,0,0,0,0,432.7).s().p("Eg4PAlfMAAAhK+MBwfAAAMAAABK+gEAy8gbVMhmyAAAg"),this.shape_2.setTransform(360,240),this.addChild(this.shape_2,this.shape_1,this.text_1,this.text,this.shape,this.ListConnectedDevices,this.ListActiveUsers)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(0,0,720,480),e.frameBounds=[A],(s.User=function(){this.initialize(),this.boundary=new s.Marker,this.boundary.setTransform(79.4,118.4),this.picture=new s.Placeholder,this.picture.setTransform(37.5,37.5,.75,.75,0,0,0,50,50),this.name=new t.Text("User","15px 'Times New Roman'"),this.name.name="name",this.name.lineHeight=17,this.name.lineWidth=71,this.name.setTransform(0,75),this.shape=new t.Shape,this.shape.graphics.f("rgba(0,0,0,0.498)").s().p("Al2F2IAArsILsAAIAALsg"),this.shape.setTransform(37.5,37.5),this.addChild(this.shape,this.name,this.picture,this.boundary)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(0,0,75,114.2),e.frameBounds=[A],(s.Slider=function(e,i,n){this.initialize(e,i,n=null==n?!1:n,{Up:0,Over:1,Down:2,Hit:3}),this.frame_0=function(){this.pointer.gotoAndStop("Up"),this.stop()},this.frame_1=function(){this.stop(),this.pointer.gotoAndStop("Over")},this.frame_2=function(){this.stop(),this.pointer.gotoAndStop("Down")},this.frame_3=function(){this.stop(),this.pointer.gotoAndStop("Out")},this.timeline.addTween(t.Tween.get(this).call(this.frame_0).wait(1).call(this.frame_1).wait(1).call(this.frame_2).wait(1).call(this.frame_3).wait(1)),this.pointer=new s.Pointer,this.pointer.setTransform(35,41.1,1,1,0,0,0,0,2),this.maximum=new s.Marker,this.maximum.setTransform(342,35),this.minimum=new s.Marker,this.minimum.setTransform(35,41),this.timeline.addTween(t.Tween.get({}).to({state:[{t:this.minimum},{t:this.maximum},{t:this.pointer}]}).wait(4)),this.shape=new t.Shape,this.shape.graphics.f().s("#320B1F").ss(4).p("AgY4mMAAxAxN"),this.shape.setTransform(186,26.5,1.113,1.111,-90,0,0,.1,0),this.shape_1=new t.Shape,this.shape_1.graphics.f("#320B1F").s().p("AgnAoQgQgRAAgXQAAgWAQgRQARgQAWAAQAXAAARAQQAQARAAAWQAAAXgQARQgRAQgXAAQgWAAgRgQg"),this.shape_1.setTransform(9.6,31.4,1.694,1.694,-90),this.shape_2=new t.Shape,this.shape_2.graphics.f("#320B1F").s().p("AgkAlQgQgPAAgWQAAgUAQgQQAPgQAVAAQAVAAAQAQQAQAQAAAUQAAAWgQAPQgQAQgVAAQgVAAgPgQg"),this.shape_2.setTransform(370.1,24,1.694,1.694,-90),this.timeline.addTween(t.Tween.get({}).to({state:[{t:this.shape_2},{t:this.shape_1},{t:this.shape}]}).to({state:[{t:this.shape_2},{t:this.shape_1},{t:this.shape}]},1).to({state:[{t:this.shape_2},{t:this.shape_1},{t:this.shape}]},1).to({state:[{t:this.shape_2},{t:this.shape_1},{t:this.shape}]},1).wait(1))}).prototype=e=new t.MovieClip,e.nominalBounds=A=new t.Rectangle(0,10.9,379.1,30.1),e.frameBounds=[A,A,A,A],(s.portal=function(){this.initialize(),this.instance=new s.Signin,this.instance.setTransform(172.5,116.7,1,1,0,0,0,172.5,116.7),this.addChild(this.instance)}).prototype=e=new t.Container,e.nominalBounds=A=new t.Rectangle(359,240,721,480),e.frameBounds=[A]),define("CatLab/Webremote/assets/createjsassets",function(e){return function(){return e.ctlbrmtassets}}(this)),define("CatLab/Webremote/CreateJS/LayerContainer",["easeljs","easelbone"],function(n,s){"use strict";function e(e,t){if(!s)throw console.log("When using the createjs module of the remote, you need to have the easelbone module loaded."),console.log("Check https://github.com/catlabinteractive/easelbone"),new Error("easelbone could not be loaded.");this.width=e,this.height=t,this.initialize(),this.easelboneLayer=new s.Views.Layer({container:this});var i=this;this.easelboneLayer.on("all",function(e){e=new n.Event(e);i.dispatchEvent(e)})}var t=e.prototype=new n.Container;return t.Container_initialize=t.initialize,t.initialize=function(){this.Container_initialize(),this.setBounds(0,0,this.width,this.height),this.on("click",function(e){e.stopPropagation()})},t.loading=function(){},t.render=function(){this.easelboneLayer.render()},e}),define("CatLab/Webremote/CreateJS/Views/PortalView",["easeljs","easelbone","CatLab/Webremote/Tools/Translator"],function(e,n,i){"use strict";return n.Views.Navigatable.extend({initialize:function(e){this.initializeNavigatable({orientation:this.ORIENTATION.HORIZONTAL});var t=this;this.assets=e.assets,e.showInactivePlayers?this.setScreen(new e.assets.PortalView):this.setScreen(new e.assets.PortalViewNoInactive),this.showInactivePlayers=e.showInactivePlayers||!1,this.portalController=e.controller,this.showInactivePlayers&&(this.connectedUsersContainer=new n.EaselJS.Placeholder(this.getScreen().connectedUsers),this.connectedUsers=new n.Controls.FloatContainer(function(e){return t.getUserIcon(e)},6),this.connectedUsersContainer.addChild(this.connectedUsers)),this.activeUsersContainer=new n.EaselJS.Placeholder(this.getScreen().activeUsers),this.activeUsers=new n.Controls.FloatContainer(function(e){return t.getUserIcon(e)},e.showInactivePlayers?6:12),this.activeUsersContainer.addChild(this.activeUsers),void 0!==this.getScreen().start&&(this.start=new n.Controls.Button(this.getScreen().start),this.start.setText(i.t("Start")),this.start.on("click",function(){t.portalController.startGame()}),this.addControl(this.start)),void 0!==this.getScreen().back&&(this.back=new n.Controls.Button(this.getScreen().back),this.back.setText(i.t("Back")),this.back.on("click",function(){t.portalController.back()}),this.addControl(this.back)),this.portalController.on("users:update",function(){this.refreshUsers()}.bind(this)),this.portalController.on("options:change",function(){this.showCurrentAndMaxUsers()}.bind(this)),this.findPlaceholders("instructionHeader").forEach(function(e){e.addChild(new n.EaselJS.BigText(i.t("Instructions")))}),this.findPlaceholders("activePlayersHeader").forEach(function(e){e.addChild(new n.EaselJS.BigText(i.t("Active devices")))}),this.findPlaceholders("connectedPlayersHeader").forEach(function(e){e.addChild(new n.EaselJS.BigText(i.t("Connected devices")))}),this.instructionTexts=[],this.findPlaceholders("instructionText").forEach(function(e){var t=new n.EaselJS.BigText(this.getInstructionText());this.instructionTexts.push(t),e.addChild(t)}.bind(this)),this.activePlayerTexts=[],this.findPlaceholders("activePlayers").forEach(function(e){var t=new n.EaselJS.BigText(this.getActiveUsersText());this.activePlayerTexts.push(t),e.addChild(t)}.bind(this))},getActiveUsersText:function(){return this.portalController.countActiveUsers()+"/"+this.portalController.options.maxPlayers},getInstructionText:function(){return this.portalController.getConnectInstructions()+"\n"+this.portalController.getStartAndLoginInstructions()},getUserIcon:function(e){var t,i;return e?e.hasUser()?(t=new this.assets.UserIconAuthenticated,this.addControllerIcon(t,e)):t=this.getControllerIcon(e):t=this.getControllerIcon(),e&&(i=t.PlayerColor)&&new n.EaselJS.Placeholder(i).addChild(new n.EaselJS.Fill(e.getColor())),e&&this.setUserDetails(t,e),t},addControllerIcon:function(e,t){var i;e.ControllerIcon&&(e=new n.EaselJS.Placeholder(e.ControllerIcon),i=this.getControllerIcon(t),e.addChild(i),i.scaleX=i.scaleY=.5,t)&&(e=i.PlayerColor)&&new n.EaselJS.Placeholder(e).addChild(new n.EaselJS.Fill(t.getColor()))},getControllerIcon:function(e){if(e)switch(e.getType()){case"keyboard":return new this.assets.UserIconKeyboard;case"tablet":return new this.assets.UserIconTablet;case"phone":return new this.assets.UserIconPhone;case"gamepad":return new this.assets.UserIconGamepad}return new this.assets.UserIcon},loading:function(){},alert:function(e){alert(e)},refreshUsers:function(){this.showCurrentAndMaxUsers(),this.showInformation(),this.reloadUserIcons(this.portalController.getUsers())},showCurrentAndMaxUsers:function(){this.getScreen().playercount&&(this.getScreen().playercount.text=this.portalController.countActiveUsers()+"/"+this.portalController.options.maxPlayers),this.activePlayerTexts.forEach(function(e){e.setText(this.portalController.countActiveUsers()+"/"+this.portalController.options.maxPlayers)}.bind(this)),this.getScreen().login&&(this.getScreen().login.text=this.portalController.getStartAndLoginInstructions())},showInformation:function(){var e=this.portalController.getConnectInstructions();this.getScreen().login?this.getScreen().login.text=this.portalController.getStartAndLoginInstructions():e+="\n "+this.portalController.getStartAndLoginInstructions(),this.getScreen().token&&(this.getScreen().token.text=e),this.instructionTexts.forEach(function(e){e.setText(this.getInstructionText())}.bind(this))},removeAllUserIcons:function(){this.showInactivePlayers&&this.connectedUsers.removeAllChildren(),this.activeUsers.removeAllChildren()},reloadUserIcons:function(e){var t=24,i=24;this.showInactivePlayers||(i=48),this.removeAllUserIcons(),e.forEach(function(e){e.isActive()?i<=0||(i--,this.activeUsers.createElement(e)):!this.showInactivePlayers||t<=0||(t--,this.connectedUsers.createElement(e))}.bind(this))},setUserDetails:function(e,t){var i;t.hasUser()&&e.userimage&&(i=new n.EaselJS.Placeholder(e.userimage),t.getUser().getImage(function(e){i.addChild(new n.EaselJS.Fill(e))}))},addAuthenticationView:function(e){this.el.addChild(e);var t=this;e.on("view:close",function(){t.el.removeChild(e)})},render:function(){this.el.addChild(this.getScreen()),this.refreshUsers()}})}),define("CatLab/Webremote/CreateJS/Views/AuthenticationView",["easelbone","CatLab/Webremote/Tools/Translator"],function(s,i){"use strict";return s.Views.Base.extend({initialize:function(e){var t=this,e=(this.assets=e.assets,this.screen=new e.assets.Signin,this.controller=e.controller,this.screen.close.on("click",function(){t.controller.close()}),this.linkAccount=new s.Controls.Button(this.screen.linkAccount),this.titlePlaceholder=null,this.explanationPlaceholder=null,s.Helpers.MovieClipHelper.findFromNames(["title"],[this.screen]).forEach(function(e){this.titlePlaceholder=new s.EaselJS.Placeholder(e)}.bind(this)),s.Helpers.MovieClipHelper.findFromNames(["explanation"],[this.screen]).forEach(function(e){this.explanationPlaceholder=new s.EaselJS.Placeholder(e)}.bind(this)),this.titlePlaceholder&&(e=new s.EaselJS.BigText(i.t("Select your profile"),null,null,"left"),this.titlePlaceholder.addChild(e)),this.setLoginUrlText(),this.linkAccount.on("click",function(){t.controller.link()}),new s.Controls.ScrollArea(this.screen.accounts));this.users=new s.Controls.FloatContainer(function(e){return t.getUserObject(e)},4),e.content.addChild(this.users),this.controller.on("users:update",this.updateUsers,this),this.updateUsers(),this.on("removed",function(){this.trigger("close")}.bind(this))},updateUsers:function(){var e=this.controller.getUsers().getAll();this.users.removeAllChildren();for(var t=0;t<e.length;t++)this.users.createElement(e[t])},getUserObject:function(e){var t,i=this,n=new this.assets.UserModel;return e&&(n.namePlaceholder?new s.EaselJS.Placeholder(n.namePlaceholder).addChild(new s.EaselJS.BigText(e.getName())):n.name&&(n.name.text=e.getName()),t=new s.EaselJS.Placeholder(n.picture),e.getImage(function(e){t.addChild(new s.EaselJS.Fill(e))}),n.on("click",function(){i.controller.selectUser(e)})),n},close:function(){this.trigger("close")},render:function(){this.el.addChild(this.screen)},setLoginUrl:function(e){this.loginUrl=e,this.setLoginUrlText()},setLoginUrlText:function(){var e;this.linkAccount&&(this.linkAccount.setText(i.t("Login to add profile")),this.explanationPlaceholder)&&(e=new s.EaselJS.BigText(i.t("Or surf to %s to login from your phone.",this.loginUrl)),this.explanationPlaceholder.removeAllChildren(),this.explanationPlaceholder.addChild(e))}})}),define("CatLab/EaselHacks/AlphaMaskFilter",[],function(e){function t(e){var n=this;this.createjs=e,Object.defineProperty(e.DisplayObject.prototype,"mask",{get:function(){return this.forceMask},set:function(e){var t,i=this;e?(i.originalMask=e,t=n.getFilterFromMask(e,i),i.filters=[t],i.cache(0,0,500,500)):null!==e&&(i.filters=null,i.cache(0,0,500,500))}}),e.DisplayObject.prototype.setMask=function(e){this.forceMask=e}}return t.prototype.getFilterFromMask=function(e,t){var i=this.createjs,n=e.graphics.getInstructions(),s=new i.Graphics;s.beginFill("#000000"),s.beginStroke("#000000");for(var o=0;o<n.length;o++)s.append(n[o]);e.graphics=s;var r=new i.Container,e=(r.addChild(e),r.scaleX=1/t.scaleX,r.scaleY=1/t.scaleY,r.y=-t.y,r.x=-t.x,new i.Container);return e.addChild(r),e.cache(0,0,1e3,1e3),new i.AlphaMaskFilter(e.cacheCanvas)},t}),define("CatLab/EaselHacks/FrontController",["CatLab/EaselHacks/AlphaMaskFilter"],function(e){return{AlphaMaskFilter:e}}),define("easelhacks",["CatLab/EaselHacks/FrontController"],function(e){return e}),define("CatLab/Webremote/Hacks",["easelhacks","easeljs"],function(e,t){new e.AlphaMaskFilter(t)});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>createjsassets</title>
|
|
6
|
+
|
|
7
|
+
<script src="libs/easeljs-0.7.1.min.js"></script>
|
|
8
|
+
<script src="createjsassets.js"></script>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
var canvas, stage, exportRoot;
|
|
12
|
+
|
|
13
|
+
function init() {
|
|
14
|
+
canvas = document.getElementById("canvas");
|
|
15
|
+
exportRoot = new ctlbrmtassets.portal();
|
|
16
|
+
|
|
17
|
+
stage = new createjs.Stage(canvas);
|
|
18
|
+
stage.addChild(exportRoot);
|
|
19
|
+
stage.update();
|
|
20
|
+
|
|
21
|
+
createjs.Ticker.setFPS(ctlbrmtassets.properties.fps);
|
|
22
|
+
//createjs.Ticker.addEventListener("tick", stage);
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
</head>
|
|
26
|
+
|
|
27
|
+
<body onload="init();" style="background-color:#D4D4D4">
|
|
28
|
+
<canvas id="canvas" width="720" height="480" style="background-color:#FFFFFF"></canvas>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|