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,79 @@
|
|
|
1
|
+
require.config ({
|
|
2
|
+
'paths' : {
|
|
3
|
+
|
|
4
|
+
'viewport-units-buggyfill' : '../vendor/viewport-units-buggyfill/viewport-units-buggyfill',
|
|
5
|
+
'viewport-units-buggyfill.hacks' : '../vendor/viewport-units-buggyfill/viewport-units-buggyfill.hacks',
|
|
6
|
+
|
|
7
|
+
'easelbone' : '../vendor/easelbone/dist/scripts/easelbone',
|
|
8
|
+
'easelhacks' : '../vendor/easelhacks/dist/scripts/easelhacks',
|
|
9
|
+
|
|
10
|
+
'easeljs': "../vendor/EaselJS/lib/easeljs",
|
|
11
|
+
'preloadjs': "../vendor/PreloadJS/lib/preloadjs",
|
|
12
|
+
'soundjs': "../vendor/SoundJS/lib/soundjs",
|
|
13
|
+
'tweenjs': "../vendor/TweenJS/lib/tweenjs",
|
|
14
|
+
|
|
15
|
+
'underscore': "../vendor/underscore/underscore",
|
|
16
|
+
'backbone': "../vendor/backbone/backbone",
|
|
17
|
+
|
|
18
|
+
'jquery': "../vendor/jquery/dist/jquery",
|
|
19
|
+
'jquery-ui' : "../vendor/jquery-ui-dist/jquery-ui",
|
|
20
|
+
'jquery-ui-touch-punch' : "../vendor/jquery-ui-touch-punch/jquery.ui.touch-punch",
|
|
21
|
+
|
|
22
|
+
'sprintf' : '../vendor/sprintf-js/dist/sprintf.min',
|
|
23
|
+
'rivets' : '../vendor/rivets/dist/rivets.min',
|
|
24
|
+
'sightglass' : '../vendor/sightglass/index',
|
|
25
|
+
|
|
26
|
+
'createjsassets' : '../themes/quizwitz/remote',
|
|
27
|
+
'emojione' : '../vendor/emojione/lib/js/emojione',
|
|
28
|
+
'screenfull' : '../vendor/screenfull/dist/screenfull',
|
|
29
|
+
|
|
30
|
+
'simple-keyboard' : '../vendor/simple-keyboard/build/index',
|
|
31
|
+
'SimpleKeyboard' : '../vendor/simple-keyboard/build/index',
|
|
32
|
+
'socket.io-client' : '../vendor/socket.io-client/dist/socket.io',
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
aliases: {
|
|
36
|
+
'simple-keyboard': 'SimpleKeyboard' // maps to 'math' import
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
shim : {
|
|
40
|
+
easeljs: {
|
|
41
|
+
deps: [
|
|
42
|
+
|
|
43
|
+
],
|
|
44
|
+
exports: "createjs"
|
|
45
|
+
},
|
|
46
|
+
preloadjs: {
|
|
47
|
+
deps: [
|
|
48
|
+
"easeljs"
|
|
49
|
+
],
|
|
50
|
+
exports: "createjs"
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
catlabremote : {
|
|
54
|
+
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
createjsassets : {
|
|
58
|
+
exports : 'quizwitzremote'
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
emojione : {
|
|
62
|
+
exports: 'emojione'
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
screenfull: {
|
|
66
|
+
exports: 'screenfull'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
define (
|
|
72
|
+
[
|
|
73
|
+
'catlabremote'
|
|
74
|
+
],
|
|
75
|
+
function (catlabremote) {
|
|
76
|
+
|
|
77
|
+
return catlabremote;
|
|
78
|
+
}
|
|
79
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require.config({paths:{easelbone:"../../node_modules/easelbone/dist/scripts/easelbone",easelhacks:"../../node_modules/easelhacks/dist/scripts/easelhacks",EaselJS:"../../node_modules/EaselJS/lib/easeljs",PreloadJS:"../../node_modules/PreloadJS/lib/preloadjs",SoundJS:"../../node_modules/SoundJS/lib/soundjs",TweenJS:"../../node_modules/TweenJS/lib/tweenjs",underscore:"../../node_modules/underscore/underscore",backbone:"../../node_modules/backbone/backbone",jquery:"../../node_modules/jquery/dist/jquery",sprintf:"../../node_modules/sprintf-js/dist/sprintf.min",rivets:"../../node_modules/rivets/dist/rivets.min",sightglass:"../../node_modules/sightglass/index",createjsassets:"../themes/quizwitz/remote",emojione:"../../node_modules/emojione/lib/js/emojione",screenfull:"../../node_modules/screenfull/dist/screenfull"},shim:{EaselJS:{deps:[],exports:"createjs"},PreloadJS:{deps:["EaselJS"],exports:"createjs"},catlabremote:{},createjsassets:{exports:"quizwitzremote"},emojione:{exports:"emojione"},screenfull:{exports:"screenfull"}}}),define(["catlabremote"],(function(e){return e}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s,t,e,A,i,h,a;define("CatLab/Webremote/Tools/Net",[],function(){"use strict";return{loadJSON:function(t,e,i){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&200===n.status&&e&&e(JSON.parse(n.responseText))},n.onerror=function(t){t&&i(n,t)},n.open("GET",t,!0),n.send()}}}),define("CatLab/Webremote/Tools/Deferred",[],function(){function l(t){return"[object Array]"===Object.prototype.toString.call(t)}function c(t,e){if(l(t))for(var i=0;i<t.length;i++)e(t[i]);else e(t)}function u(t){var n="pending",s=[],o=[],r=[],a=null,i={done:function(){for(var t=0;t<arguments.length;t++)if(arguments[t])if(l(arguments[t]))for(var e=arguments[t],i=0;i<e.length;i++)"resolved"===n&&e[i].apply(this,a),s.push(e[i]);else"resolved"===n&&arguments[t].apply(this,a),s.push(arguments[t]);return this},fail:function(){for(var t=0;t<arguments.length;t++)if(arguments[t])if(l(arguments[t]))for(var e=arguments[t],i=0;i<e.length;i++)"rejected"===n&&e[i].apply(this,a),o.push(e[i]);else"rejected"===n&&arguments[t].apply(this,a),o.push(arguments[t]);return this},always:function(){return this.done.apply(this,arguments).fail.apply(this,arguments)},progress:function(){for(var t=0;t<arguments.length;t++)if(arguments[t])if(l(arguments[t]))for(var e=arguments[t],i=0;i<e.length;i++)"pending"===n&&r.push(e[i]);else"pending"===n&&r.push(arguments[t]);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(t){if(null==t)return i;for(var e in i)t[e]=i[e];return t},state:function(){return n},debug:function(){console.log("[debug]",s,o,n)},isRejected:function(){return"rejected"===n},isResolved:function(){return"resolved"===n},pipe:function(t,e,i){return u(function(i){c(t,function(e){"function"==typeof e?h.done(function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(i.resolve,i.reject,i.notify):i.resolve(t)}):h.done(i.resolve)}),c(e,function(e){"function"==typeof e?h.fail(function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(i.resolve,i.reject,i.notify):i.reject(t)}):h.fail(i.reject)})}).promise()}},h={resolveWith:function(t){if("pending"===n){n="resolved";for(var e=a=1<arguments.length?arguments[1]:[],i=0;i<s.length;i++)s[i].apply(t,e)}return this},rejectWith:function(t){if("pending"===n){n="rejected";for(var e=a=1<arguments.length?arguments[1]:[],i=0;i<o.length;i++)o[i].apply(t,e)}return this},notifyWith:function(t){if("pending"===n)for(var e=a=1<arguments.length?arguments[1]:[],i=0;i<r.length;i++)r[i].apply(t,e);return this},resolve:function(){return this.resolveWith(this,arguments)},reject:function(){return this.rejectWith(this,arguments)},notify:function(){return this.notifyWith(this,arguments)}},e=i.promise(h);return t&&t.apply(e,[e]),e}return u.when=function(){var t;if(arguments.length<2)return((t=arguments.length?arguments[0]:void 0)&&"function"==typeof t.isResolved&&"function"==typeof t.isRejected?t:u().resolve(t)).promise();for(var i=arguments,n=u(),s=i.length,o=0,r=new Array(s),e=0;e<i.length;e++)!function(t){var e;i[t].done?i[t].done(function(){r[t]=arguments.length<2?arguments[0]:arguments,++o==s&&n.resolve.apply(n,r)}).fail(function(){n.reject(arguments)}):(e=i[t],i[t]=new Deferred,i[t].done(function(){r[t]=arguments.length<2?arguments[0]:arguments,++o==s&&n.resolve.apply(n,r)}).fail(function(){n.reject(arguments)}).resolve(e))}(e);return n.promise()},u}),define("CatLab/Webremote/Collections/ServerList",["CatLab/Webremote/Tools/Deferred"],function(s){"use strict";function t(t,e){this.defaultId=t.default,this.servers=t.servers,this.connectUrl=t.connectUrl,this.selectedServerId=null,this.preferredServer=e,this.assetsUrl=t.assetsUrl}var e=t.prototype;return e.getFromToken=function(t){if(t.length<8)return{host:this.getDefault().host,token:t};var e=t.substr(0,2);if(e){e=this.getFromId(e);if(e)return{host:e.host,token:t.substr(2)}}throw new Error("Code does not correspondent to any servers.")},e.getSelectedServer=function(){var e=new s;return this.selectedServerId?e.resolve(this.getFromId(this.selectedServerId).host):this.selectBestServer().then(function(t){this.selectedServerId||(this.selectServer(t.id),e.resolve(t.host))}.bind(this)),e.promise()},e.selectBestServer=function(){var i=new s;if(this.preferredServer)for(var t=0;t<this.servers.length;t++)if(this.servers[t].id==this.preferredServer)return i.resolve(this.servers[t]),i.promise();var n=!1;return this.servers.forEach(function(e){e.discoverable&&this.measureRequestSpeed("https://"+e.host+"/info").then(function(t){console.log("[ServerList] "+e.host+" took "+t+"ms"),n||(n=!0,i.resolve(e))}.bind(this))}.bind(this)),i.promise()},e.selectServer=function(t){this.selectedServerId=t},e.measureRequestSpeed=function(t){var e=new Date,i=new s,n=new XMLHttpRequest;return n.onreadystatechange=function(){var t;4==this.readyState&&200==this.status&&(t=(new Date).getTime()-e.getTime(),i.resolve(t))},n.open("GET",t),n.send(),i.promise()},e.getConnectURL=function(){if(this.selectedServerId){var t=this.getFromId(this.selectedServerId);if(t.connectUrl)return t.connectUrl}return this.connectUrl},e.getAssetURL=function(){var t;return this.assetsUrl||((t=this.getConnectURL())?("http"!==t.substring(0,4)&&(t="https://"+t),this.assetsUrl=t+"/assets/",this.assetsUrl):void 0)},e.getConnectToken=function(t){return this.getFromId(this.selectedServerId).connectUrl?t:this.selectedServerId+t},e.getFromId=function(t){for(var e=0;e<this.servers.length;e++)if(this.servers[e].id==t)return this.servers[e];return null},e.getDefault=function(){return this.getFromId(this.defaultId)},e.serialize=function(){return{server:this.selectedServerId}},e.unserialize=function(t){this.selectServer(t.server)},t}),define("CatLab/Webremote/Config",["CatLab/Webremote/Tools/Net","CatLab/Webremote/Collections/ServerList"],function(i,t){"use strict";var e="http";return{_options:{host:"www.catlab.tv",serverlist:null,preferredServer:null,protocol:e="undefined"!=typeof window&&void 0!==window.location&&void 0!==window.location.protocol?window.location.protocol.substr(0,window.location.protocol.length-1):e,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(t){void 0!==t&&(t.host,this._options.host=t.host,void 0!==t.protocol&&(this._options.protocol=t.protocol),void 0!==t.debug&&(this._options.debug=t.debug),void 0!==t.imageproxy&&(this._options.imageproxy=t.imageproxy),void 0!==t.proxy&&(this._options.proxy=t.proxy),void 0!==t.smileys&&(this._options.smileys=t.smileys),void 0!==t.assetsUrl&&(this._options.assetsUrl=t.assetsUrl),void 0!==t.vendorPath&&(this._options.vendorPath=t.vendorPath),void 0!==t.audioSync&&(this._options.audioSync=t.audioSync),void 0!==t.serverlist&&(this._options.serverlist=t.serverlist),void 0!==t.preferredServer&&(this._options.preferredServer=t.preferredServer),void 0!==t.allowAuthentication&&(this._options.allowAuthentication=t.allowAuthentication),void 0!==t.audioSyncConfig)&&(this.audioSyncConfig=t.audioSyncConfig)},getAll:function(){return this._options},initialize:function(e){var t;this._initialized?e():null===this._options.serverlist||"http"!==this._options.serverlist.substring(0,4)?(this._initialized=!0,e()):"json"===this._options.serverlist.substring(this._options.serverlist.length-4)?i.loadJSON(this._options.serverlist,function(t){this._initialized=!0,this._options.serverlist=t,e()}.bind(this),function(t,e){alert("Failed to connect to "+this._options.serverlist+". Game cannot start."),console.log(e)}.bind(this)):((t=document.createElement("script")).onload=function(){this._initialized=!0,this._options.serverlist=getCatLabRemoteServers(),e()}.bind(this),t.onerror=function(){alert("Failed to connect to "+this._options.serverlist+". Game cannot start.")}.bind(this),t.src=this._options.serverlist,document.head.appendChild(t))},getProtocol:function(t){var e=this._options.protocol;switch(e=void 0!==t&&t&&""===e?"http":e){case"http":case"https":break;default:e="https"}return e},getSocketURL:function(t){return this._options.host?((t=this.getProtocol(t))&&(t+=":"),t+"//"+this._options.host):"undefined"!=typeof window&&void 0!==window.location?window.location.protocol+"//"+window.location.hostname:""},getAssetsURL:function(t){var e;return this._options.assetsUrl||((e=this.getServerList())?e.getAssetURL():this.getSocketURL(t)+"/assets/")},debug:function(){return this._options.debug},getProxiedImage:function(t){return this._options.imageproxy?this._options.imageproxy+encodeURIComponent(t):t},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 t={smileys:this.useSmileys(),audioSync:this.useAudioSync()};return this.useAudioSync()&&(t.audioSyncConfig=this.audioSyncConfig),t},getServerList:function(){return this._options.serverlist?(this.serverCollection||(this.serverCollection=new t(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(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(t),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(t,e,i,n){},e=function(t){s("Page",t,"-",0)};return{setTracker:function(t){s=t},setPageMethod:function(t){e=t},track:function(t,e,i,n){s(t,e,i,n)},page:function(t){e(t)}}}),define("CatLab/Webremote/Tools/Tools",[],function(){var s,o;return{popup:function(t,e){var i=this,n=(e=e||!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=t,(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",e?(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(t,e){return window.open(t)},oauth2Popup:function(t,e){return this.oauth2PopupMethod(t,e)},closePopup:function(){s&&s.parentNode.removeChild(s),o&&o.parentNode.removeChild(o)},setOauth2Popup:function(t){return this.oauth2PopupMethod=t,this},sanitize:function(t){var e;return null==t?null:(e={"&":"&","<":"<",">":">",'"':""","'":"'"},String(t).replace(/[&<>"']/g,function(t){return e[t]}))},nl2br:function(t,e){return null==t?"":(t+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+(e||void 0===e?"<br />":"<br>")+"$2")},shuffle:function(t){for(var e,i,n=t.length-1;0<n;n--)e=Math.floor(Math.random()*(n+1)),i=t[n],t[n]=t[e],t[e]=i},getUuid:function(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)},findIndex:function(t,e){for(var i=0;i<t.length;i++)if(e(t[i]))return i;return-1},getConnectTokenForDisplay:function(t){return null===t?null:t.length%4==0?this.injectFillerInString(t,4," "):(t.length,this.injectFillerInString(t,3," "))},injectFillerInString:function(t,e,i){return t.match(new RegExp(".{1,"+e+"}","g")).join(i)}}}),define("CatLab/Webremote/Tools/Eventable",["CatLab/Webremote/Tools/Tools"],function(n){"use strict";function t(){}var s=0,e=t.prototype;return e.initializeEventable=function(){this._eventableEvents=[]},e.trigger=function(t){this.eventableTrigger.apply(this,arguments)},e.eventableTrigger=function(t){if("string"!=typeof t)throw new Error("eventableTrigger must be a string");if(void 0!==this._eventableEvents){var e,i=Array.prototype.slice.call(arguments);for(e in i.push(i.shift()),this._eventableEvents)this._eventableEvents.hasOwnProperty(e)&&this.eventMatches(t,e)&&this._eventableEvents[e].slice().forEach(function(t){try{t.method.apply(t.scope,i)}catch(t){console.error(t)}}.bind(this))}},e.eventMatches=function(t,e){return"*"===e||t===e},e.on=function(t,e,i){void 0===this._eventableEvents&&(this._eventableEvents={}),void 0===this._eventableEvents[t]&&(this._eventableEvents[t]=[]),s++,this._eventableEvents[t].push({id:s,method:e,scope:void 0!==i?i:this});var n=[t,s];return{id:n,name:t,method:e,unbind:function(){this.off(null,{id:n,name:t})}.bind(this)}},e.once=function(t,e,i){var n=this.on(t,function(){n.unbind(),e.apply(i,arguments)});return n},e.off=function(t,e){if(void 0!==t||void 0!==e)if(void 0===t||void 0!==e){if(t=e.name,e=e.id,void 0===this._eventableEvents[t])return null;var i=n.findIndex(this._eventableEvents[t],function(t){return t.id=e});0<=i&&(this._eventableEvents[t]=this._eventableEvents[t].splice(i,1))}else this._eventableEvents[t]=[];else this._eventableEvents=[]},e.clearEvents=function(){this.clearEventableEvents()},e.clearEventableEvents=function(){this._eventableEvents={}},t}),define("CatLab/Webremote/Models/User",["jquery","CatLab/Webremote/Config"],function(t,i){return function(t){this.accessToken=t,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(t){this.id=t},this.getId=function(){return this.id},this.setName=function(t){this.name=t},this.getName=function(){return this.name},this.setAvatar=function(t){var e=this;this.avatar=t,this.imageLoaded=!1,this.image=new Image,this.image.crossOrigin="anonymous",this.image.onload=function(){e.afterImageLoad()},this.image.src=i.getProxiedImage(this.avatar)},this.getAvatar=function(){return this.avatar},this.getAvatarSmiley=function(t){var e=this.getAvatar();return e?(e=e.split("?")[0],e+="?shape=circle&size=64&borderWidth=4",t&&(e+="&borderColor="+t.substr(1)),e):null},this.afterImageLoad=function(){this.imageLoaded=!0;for(var t=0;t<this.imageCallbacks.length;t++)this.imageCallbacks[t](this.image);this.imageCallbacks=[]},this.getImage=function(t){this.imageLoaded?t(this.image):this.imageCallbacks.push(t)}}}),define("CatLab/Webremote/Tools/Cookies",[],function(){var e={setCookie:function(t,e,i){return this.setItem(t,e,i)},getCookie:function(t){return this.getItem(t)},eraseCookie:function(t){return this.removeItem(t)},getItem:function(t){if("undefined"!=typeof document)return t&&this.hasOwnProperty(t)?unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"),"$1")):null},key:function(t){if("undefined"!=typeof document)return unescape(document.cookie.replace(/\s*\=(?:.(?!;))*$/,"").split(/\s*\=(?:[^;](?!;))*[^;]?;\s*/)[t])},setItem:function(t,e,i){var n,s;t&&"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(t)+"="+escape(e)+"; expires="+n+"; path=/; SameSite=Strict;",this.updateLength())},length:0,removeItem:function(t){t&&this.hasOwnProperty(t)&&"undefined"!=typeof document&&(document.cookie=escape(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; SameSite=Strict;",this.length--)},hasOwnProperty:function(t){if("undefined"!=typeof document)return new RegExp("(?:^|;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},updateLength:function(){var t;"undefined"!=typeof document&&document.cookie&&(t=document.cookie.match(/\=/g),e.length=t?t.length:0)}};return e.updateLength(),e}),define("CatLab/Webremote/Tools/Storage",["CatLab/Webremote/Tools/Cookies"],function(t){var e={clean:function(){if(this.isSupported())for(var t=Object.keys(window.localStorage),e=0;e<t.length;e++)this.get(t)},get:function(t,e){if(void 0===e&&(e=function(){}),this.isSupported())try{var i,n=window.localStorage.getItem(t);n?void 0!==(n=JSON.parse(n)).expires?(i=Date.now(),n.expires<i?(this.delete(t),e(null)):e(n.content)):e(n):e(null)}catch(t){e(null),console.log(t)}else e(null)},add:function(e,i,n,s){var o=this;n=n||function(){},this.isSupported()?this.get(e,function(t){(t=null!=t&&""!==t?t:[]).push(i),o.set(e,t,n,s)}):n(null)},set:function(t,e,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(t,JSON.stringify({expires:s,content:e}))}catch(t){console.log(t)}i()}else i(null)},delete:function(t){this.isSupported()&&window.localStorage.removeItem(t)},remove:function(n,s){var o;this.isSupported()&&(o=this).get(n,function(t){null!=t&&""!=t||(t=[]);for(var e=JSON.stringify(s),i=0;i<t.length;i++)if(e===JSON.stringify(t[i]))return t.splice(i,1),void o.set(n,t)})},isSupported:function(){if("undefined"==typeof window)return!1;try{if(void 0===window.localStorage)return!1}catch(t){return console.log(t),!1}return!0}};try{e.clean()}catch(t){console.error(t)}return e}),define("CatLab/Webremote/Collections/AuthenticatedUsers",["CatLab/Webremote/Models/User","CatLab/Webremote/Tools/Storage","CatLab/Webremote/Tools/Eventable"],function(i,s,t){function e(){this.initializeEventable()}var o,r,n=[],t=e.prototype=new t;return t.initialize=function(t,e){o=e,r=t;var n=this;s.get("users",function(i){null!==i&&s.get("currentuser",function(e){for(var t=0;t<i.length;t++)n.addFromAccessToken(i[t].access_token,function(t){t&&e&&t.getAccessToken()===e&&void 0!==r.setUser&&r.setUser(t)})})})},t.addFromAccessToken=function(e,i){i=i||function(){};var n=this;o.profile(e,function(t){t?(t=n.add(e,t.user),i(t)):s.remove("users",{access_token:e})})},t.add=function(t,e){t=new i(t);return t.setId(e.id),t.setName(e.username),t.setAvatar(e.avatar),function(t){for(var e=0;e<n.length;e++)if(n[e].getId()==t.getId())return n[e]=t;n.push(t)}(t),this.trigger("update"),t},t.remove=function(t){for(var e=0;e<n.length;e++)if(n[e].getId()==t.getId())return void n.splice(e,1)},t.getFromId=function(t){for(var e=0;e<n.length;e++)if(n[e].getId()==t)return n[e];return null},t.getAll=function(){return n},new e}),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(t){url=(t=t||{}).authorization||"https://quizted.catlab.eu/oauth2/authorize",client_id=t.client_id||"none",authorization=t.authorization||"default",redirect=t.redirect||"",profile_url=t.profile||"",avatar_url=t.profile+"/avatar",initialized=!0;var e=this;if("undefined"!=typeof window){function i(t){e.onMessage(t)}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(t,e){this.redirectHost=t,this.redirectUrl=t+e},p.getAuthorizeURL=function(){var t=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(t):t},p.onMessage=function(t){"I must've called a thousand times"!=t.data&&(t="string"==typeof t.data?JSON.parse(t.data):t.data)&&t.catlabremote&&"user:authenticated"==t.event&&this.addAccessToken(t.access_token)},p.addAccessToken=function(n){var t=function(t){var e,i=Users.add(n,t.user);for(Storage.add("users",{access_token:n}),Tools.closePopup();e=callbacks.shift();)e(i);this.trigger("update")}.bind(this);this.call(profile_url,n,t)},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(t,e){this.call(profile_url,t,e)},p.changeAvatar=function(e,t){var i;if(e.getAccessToken())return(i=new FormData).append("avatar",t.files[0]),$.ajax({type:"POST",url:avatar_url,data:i,contentType:!1,processData:!1,headers:{Authorization:"Bearer "+e.getAccessToken()},success:function(t){e.setAvatar(t.url)}})},p.link=function(e){var i=new Deferred,t={},t=("object"==typeof(e=void 0===e?{}:e)&&(e=(t=e).callback||function(){}),t.fullscreen||!1),n=(etPhoneHome&&clearInterval(etPhoneHome),this.getAuthorizeURL()),s=Tools.oauth2Popup(n,t);return s&&(etPhoneHome=setInterval(function(){s.postMessage("Hello from the other side","*")}.bind(this),1e3)),callbacks.push(function(t){e(t),i.resolve(t)}),i.promise()},p.onInit=function(t){afterInit.push(t)},p.onAdds=function(){for(var t=0;t<afterInit.length;t++)afterInit[t]()},p.getParamsFromHash=function(t){if("undefined"!=typeof window)return t=(t=t||window.location.hash).slice(1),(t=decodeURIComponent(t)).split("&").reduce(function(t,e){return t[(e=e.split("="))[0]]=e[1],t},{})},p.finish=function(){var t='{"catlabremote":1,"event":"user:authenticated","access_token":"'+this.getParamsFromHash().access_token+'"}';console.log(t),setTimeout(function(){window.opener&&window.opener.postMessage(t,"*"),window.parent&&window.parent.postMessage(t,"*"),void 0!==window.dialogArguments&&window.dialogArguments.opener&&window.dialogArguments.opener.postMessage(t,"*"),setTimeout(function(){etPhoneHome&&clearInterval(etPhoneHome),window.close()},1)},1)},new OAuth2}),define("CatLab/Webremote/Tools/Colorwheel",[],function(){var t={index:0,colors:[{color:"#d84a38",name:"red"},{color:"#4d90fe",name:"blue"},{color:"#35aa47",name:"green"},{color:"#ffb848",name:"yellow"},{color:"#852b99",name:"purple"},{color:"#555555",name:"brown"},{color:"#F87217",name:"orange"},{color:"#FBBBB9",name:"pink"}],initialize:function(){this.index=Math.floor(Math.random()*this.colors.length)},next:function(){var t=this.colors[this.index%this.colors.length];return this.index++,t}};return t.initialize(),t}),define("CatLab/Webremote/Collections/Users",["CatLab/Webremote/Tools/Colorwheel"],function(i){"use strict";return function(){this.users=[],this.userMap={},this.add=function(t){var e;t.isColorSet()||(e=i.next(),t.setColor(e.color,e.name)),t.hasPlayerId()||t.setPlayerId(this.count()+1),this.users.push(t),this.userMap[t.getId()]=t},this.clear=function(){this.users=[],this.userMap={}},this.remove=function(t){this.users.splice(users.indexOf(t),1),void 0!==this.users[t.getId()]&&delete this.users[t.getId()]},this.getFromId=function(t){return void 0!==this.userMap[t]?this.userMap[t]:null},this.getAll=function(){return this.users},this.count=function(){return this.users.length},this.each=function(t){for(var e=0;e<this.users.length;e++)t(this.users[e])},this.not=function(i){var n=[];return this.each(function(t){for(var e=0;e<i.length;e++)if(i[e].getId()===t.getId())return void n.push(i[e])}),n}}}),define("CatLab/Webremote/Collections/Groups",["CatLab/Webremote/Tools/Colorwheel"],function(i){"use strict";return function(){var e;this.groups=[],this.groupMap={},this.add=function(t){var e;t.colorSet||(e=i.next(),t.setColor(e.color,e.name)),this.groupMap[t.getId()]=t,this.groups.push(t)},this.clear=function(){this.groups=[],this.groupMap=[]},this.addUser=function(t){for(var e,i=t.groupIds,n=!1,s=0;s<i.length;s++)(e=this.getFromId(i[s]))&&(n=!0,e.addUser(t),e.isShareColor())&&t.setColor(e.getColor(),e.getColorName());return n},this.remove=function(t){this.groups.splice(this.groups.indexOf(t),1),delete this.groupMap[t.getId()]},this.getFromId=function(t){return void 0!==this.groupMap[t]?this.groupMap[t]:null},this.getAll=function(){return this.groups},this.each=function(t){for(e=0;e<this.groups.length;e++)t(this.groups[e])}}}),define("CatLab/Webremote/Models/Control",[],function(){return function(i,n,t){var s,o,r=0,a={},h=i,l=[];this.id=i,this.decoration="",this.label="",this.isGlobal=t,this.pushed=function(){return 0===r},this.scale=function(){return r},this.update=function(t,e){0<r&&0===t?((e=void 0===e?!0:e)&&this.trigger("click"),this.trigger("up")):0===r&&0<t&&this.trigger("down"),r=t},this.getLabel=function(t){return(t=void 0===t?!0:t)?'<span class="control-label '+o+'">'+h+"</span>":h},this.setStaticLabel=function(t,e){return h=t,o=e,this},this.setLabel=function(t,e){return this.label=t,n.emit("button:label",{id:i,label:t}),this},this.decorate=function(t){return this.decoration=t,n.emit("button:decorate",{id:i,styles:t}),this},this.click=function(t){return this.on("click",t),this},this.on=function(t,e){return this.log("Setting trigger "+t),void 0===a[t]&&(a[t]=[]),a[t].push(e),this},this.trigger=function(t){this.log("Triggering "+t);var e=[];if(void 0!==a[t])for(this.log("Found "+a[t].length+" events"),s=0;s<a[t].length;s++)e.push(a[t][s]);for(s=0;s<e.length;s++)e[s]();return this},this.off=function(t){return(a=void 0===t?{}:a)[t]=[],this},this.clear=function(){return this.clearEvents(),this.decoration=null,this.label=null,this},this.clearEvents=function(){return a={},this},this.addDomElement=function(t){var e=this,i=[];return i.push(t.addEventListener("click",function(){e.trigger("click")})),l.push({element:t,listeners:i}),this},this.clearDomElements=function(){for(var t=0;t<l.length;t++)for(var e=0;e<l[t].listeners.length;e++)l[t].element.removeEventListener("click",l[t].listeners[e]);return l=[],this},this.isLocalAuthentication=function(){return!1},this.refreshTarget=function(t){this.decoration&&t.emit("button:decorate",{id:i,styles:this.decoration}),this.label&&t.emit("button:label",{id:i,label:this.label})},this.log=function(t){n.log("["+this.id+"] "+t)}}}),define("CatLab/Webremote/Synchronization/MultipleTargetControl",[],function(){function t(t,e){this.id=t,this.remoteView=e,this.label=null,this.decoration=null}var e=t.prototype;return e.pushed=function(){var e=[];return this.remoteView.targets.forEach(function(t){e=e||t.control(this.id).pushed()}.bind(this)),e},e.scale=function(){var e,i=0;return this.remoteView.targets.forEach(function(t){(e=t.scale())>i&&(i=e)}.bind(this)),pushed},e.update=function(e){this.remoteView.targets.forEach(function(t){t.control(this.id).update(e)}.bind(this))},e.getLabel=function(){return this.label},e.setLabel=function(e){return this.label=e,this.remoteView.targets.forEach(function(t){t.control(this.id).setLabel(e)}.bind(this)),this},e.decorate=function(e){return this.decoration=e,this.remoteView.targets.forEach(function(t){t.control(this.id).decorate(e)}.bind(this)),this},e.click=function(t){return this.on("click",t),this},e.on=function(e,i){return this.remoteView.targets.forEach(function(t){t.control(this.id).on(e,i)}.bind(this)),this},e.off=function(e){return this.remoteView.targets.forEach(function(t){t.control(this.id).off(e)}.bind(this)),this},e.refreshTarget=function(e){return this.remoteView.targets.forEach(function(t){t.control(this.id).refreshTarget(e)}.bind(this)),this},t}),define("CatLab/Webremote/Synchronization/DataItem",[],function(){function i(t,e,i){this.key=t,this.shared=e,this.side=i}var t=i.prototype;return t.setValue=function(t){this.value=t},t.canWrite=function(t){return!!this.shared||this.side===t},t.serialize=function(){return{key:this.key,shared:this.shared,side:this.side,value:this.value}},i.unserialize=function(t){var e=new i(t.key,t.shared,t.side);return e.setValue(t.value),e},i}),define("CatLab/Webremote/Synchronization/SynchronizedData",["CatLab/Webremote/Tools/Eventable","CatLab/Webremote/Synchronization/DataItem"],function(t,s){function e(t,e,i){this.initializeEventable(),this.id=t,this.synchronizer=e,this.side=i,this.data={}}t=e.prototype=new t;return t.set=function(t,e,i){if(void 0===this.data[t])this.data[t]=new s(t,i,this.side);else if(!this.data[t].canWrite(this.side))throw"Trying to overwrite a non shared data attribute: "+t;this.data[t].setValue(e),this.emit(this.data[t])},t.processMessage=function(t){var e=t.key,i=t.side,n=t.value,t=t.shared;if(void 0===this.data[e])this.data[e]=new s(e,t,i);else if(!this.data[e].canWrite(i))throw"Trying to overwrite a non shared data attribute: "+e;this.data[e].setValue(n)},t.get=function(t){return void 0===this.data[t]?null:this.data[t].value},t.emit=function(t,e){void 0===e&&(e=this.synchronizer.emit);t=t.serialize();t.namespace=this.synchronizer.namespace,t.container=this.id,e("data:set",t)},t.refreshTarget=function(t){for(var e in this.data)this.data.hasOwnProperty(e)&&this.emit(this.data[e],t)},t.destroy=function(){this.synchronizer.destroy(this)},t.serialize=function(){var t,e={};for(t in this.data)this.data.hasOwnProperty(t)&&(e[t]=this.data[t].serialize());return e},t.unserialize=function(t){for(var e in this.data={},t)t.hasOwnProperty(e)&&(this.data[e]=s.unserialize(t[e]))},e}),define("CatLab/Webremote/Synchronization/DataSynchronizer",["CatLab/Webremote/Synchronization/SynchronizedData"],function(e){function t(t,e,i){this.namespace=t,this.emit=e,this.dataModels={},this.side=i}t.eventsToListenFor=["data:set"];var i=t.prototype;return i.checkNamespace=function(t){return void 0!==t.namespace&&t.namespace===this.namespace},i.processMessage=function(t,e){void 0!==e.container&&this.getFromIdentifier(e.container).processMessage(e)},i.getFromIdentifier=function(t){return void 0===this.dataModels[t]&&(this.dataModels[t]=new e(t,this,this.side)),this.dataModels[t]},i.destroy=function(t){t=t.id;void 0===this.dataModels[t]&&delete this.dataModels[t]},i.refreshTarget=function(t){for(var e in this.dataModels)this.dataModels.hasOwnProperty(e)&&this.dataModels[e].refreshTarget(t)},i.serialize=function(){var t,e={};for(t in this.dataModels)this.dataModels.hasOwnProperty(t)&&(e[t]=this.dataModels[t].serialize());return{dataModels:e}},i.unserialize=function(t){for(var e in t.dataModels)t.dataModels.hasOwnProperty(e)&&this.getFromIdentifier(e).unserialize(t.dataModels[e])},t}),define("CatLab/Webremote/Synchronization/RemoteView",["CatLab/Webremote/Models/Control","CatLab/Webremote/Tools/Eventable","CatLab/Webremote/Synchronization/MultipleTargetControl","CatLab/Webremote/Synchronization/DataSynchronizer"],function(t,e,i,n){function s(t,e,i,n,s){this.initializeEventable(),this.id=e,this.viewId=t,this.targets=[],this.Webcontrol=n,this.groupId=void 0!==s?s:null,this.controls={},this.valueMap={},this.newUserStack=[],this.factory=null,this.listeners=[],i.map(function(t){this.addTarget(t)}.bind(this))}e=s.prototype=new e;return e.clearValues=function(){this.valueMap={}},e.addTarget=function(t){this.targets.push(t),this.refreshTarget(t)},e.refreshTarget=function(e){var t,i={id:this.id,viewId:this.viewId};for(this.tmpid in this.groupId&&(i.group=this.groupId),e.emit("view:set",i),this.newUserStack.map(function(t){e.emit(t.action,t.data)}.bind(this)),e.controls)e.controls.hasOwnProperty(this.tmpid)&&e.controls[this.tmpid].isGlobal&&e.controls[this.tmpid].refreshTarget(e);for(this.tmpid in this.controls)this.controls.hasOwnProperty(this.tmpid)&&(void 0!==this.controls[this.tmpid].refreshTarget?this.controls[this.tmpid].refreshTarget(e):console.error("Unexpected control:",this.controls[this.tmpid]));for(t in this.valueMap)this.valueMap.hasOwnProperty(t)&&e.emit("value:change",{id:t,value:this.valueMap[t]})},e.emit=function(e,i){this.targets.map(function(t){t.emit(e,i)})},e.clearControls=function(){for(var t=this.Webcontrol.getViewLabels(this.currentView),e=0;e<t.length;e++)this.control(t[e].id).setStaticLabel(t[e].label,"mobile")},e.control=function(t){return void 0===this.controls[t]&&(this.controls[t]=new i(t,this)),this.controls[t]},e.trigger=function(t,e){"value:change"==t&&this.changeValue(e.id,e.value)},e.changeValue=function(t,e){this.valueMap[t]=e,this.emit("value:change",{id:t,value:e}),this.eventableTrigger("value:change",t,e)},e.refreshControls=function(){for(this.tmpid in this.controls)this.controls.hasOwnProperty(this.tmpid)&&this.controls[this.tmpid].refreshControl()},e.getValues=function(){return this.valueMap},e.log=function(t){console.log(t)},e.domAppend=function(t,e){this._stackAndEmit("dom:append",{id:t,html:e})},e.domReplace=function(t,e){this._stackAndEmit("dom:replace",{id:t,html:e})},e.domAttribute=function(t,e,i){this._stackAndEmit("dom:attribute",{id:t,name:e,value:i})},e.vibrate=function(t){Array.isArray(t)?this.emit("device:vibrate",{pattern:t}):console.error("Vibrate pattern must be an array.")},e.listenTo=function(t,e,i){this.listeners.push(t.on(e,i))},e.stopListening=function(){this.listeners.forEach(function(t){t.unbind()})},e._stackAndEmit=function(t,e){this.newUserStack.push({action:t,data:e}),this.emit(t,e)},e.destroy=function(){this.stopListening(),this.factory.destroy(this)},s}),define("CatLab/Webremote/Synchronization/RemoteViewFactory",["CatLab/Webremote/Synchronization/RemoteView"],function(s){function t(){this.viewCounter=0,this.views={}}var e=t.prototype;return e.create=function(t,e,i,n){return this.viewCounter++,this.views[this.viewCounter]=new s(this.viewCounter,t,e,i,n),(this.views[this.viewCounter].factory=this).views[this.viewCounter]},e.createDummy=function(t,e){return this.create(t,[],e)},e.getFromId=function(t){return this.views[t]},e.destroy=function(t){t=t.id;delete this.views[t]},new t}),!function(){"use strict";var g={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 p(t){for(var e,i,n,s,o,r,a,h=function(t){if(m[t])return m[t];for(var e,i=t,n=[],s=0;i;){if(null!==(e=g.text.exec(i)))n.push(e[0]);else if(null!==(e=g.modulo.exec(i)))n.push("%");else{if(null===(e=g.placeholder.exec(i)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){s|=1;var o=[],r=e[2],a=[];if(null===(a=g.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=g.key_access.exec(r))&&null===(a=g.index_access.exec(r)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(a[1])}e[2]=o}else s|=2;if(3===s)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:e[0],param_no:e[1],keys:e[2],sign:e[3],pad_char:e[4],align:e[5],width:e[6],precision:e[7],type:e[8]})}i=i.substring(e[0].length)}return m[t]=n}(t),l=arguments,c=1,u=h.length,d="",f=0;f<u;f++)if("string"==typeof h[f])d+=h[f];else if("object"==typeof h[f]){if((n=h[f]).keys)for(e=l[c],i=0;i<n.keys.length;i++){if(null==e)throw new Error(p('[sprintf] Cannot access property "%s" of undefined value "%s"',n.keys[i],n.keys[i-1]));e=e[n.keys[i]]}else e=n.param_no?l[n.param_no]:l[c++];if(g.not_type.test(n.type)&&g.not_primitive.test(n.type)&&e instanceof Function&&(e=e()),g.numeric_arg.test(n.type)&&"number"!=typeof e&&isNaN(e))throw new TypeError(p("[sprintf] expecting number but found %T",e));switch(g.number.test(n.type)&&(r=0<=e),n.type){case"b":e=parseInt(e,10).toString(2);break;case"c":e=String.fromCharCode(parseInt(e,10));break;case"d":case"i":e=parseInt(e,10);break;case"j":e=JSON.stringify(e,null,n.width?parseInt(n.width):0);break;case"e":e=n.precision?parseFloat(e).toExponential(n.precision):parseFloat(e).toExponential();break;case"f":e=n.precision?parseFloat(e).toFixed(n.precision):parseFloat(e);break;case"g":e=n.precision?String(Number(e.toPrecision(n.precision))):parseFloat(e);break;case"o":e=(parseInt(e,10)>>>0).toString(8);break;case"s":e=String(e),e=n.precision?e.substring(0,n.precision):e;break;case"t":e=String(!!e),e=n.precision?e.substring(0,n.precision):e;break;case"T":e=Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),e=n.precision?e.substring(0,n.precision):e;break;case"u":e=parseInt(e,10)>>>0;break;case"v":e=e.valueOf(),e=n.precision?e.substring(0,n.precision):e;break;case"x":e=(parseInt(e,10)>>>0).toString(16);break;case"X":e=(parseInt(e,10)>>>0).toString(16).toUpperCase()}g.json.test(n.type)?d+=e:(!g.number.test(n.type)||r&&!n.sign?a="":(a=r?"+":"-",e=e.toString().replace(g.sign,"")),s=n.pad_char?"0"===n.pad_char?"0":n.pad_char.charAt(1):" ",o=n.width-(a+e).length,o=n.width&&0<o?s.repeat(o):"",d+=n.align?a+e+o:"0"===s?a+o+e:o+a+e)}return d}function t(t,e){return p.apply(null,[t].concat(e||[]))}var m=Object.create(null);"undefined"!=typeof exports&&(exports.sprintf=p,exports.vsprintf=t),"undefined"!=typeof window&&(window.sprintf=p,window.vsprintf=t,"function"==typeof define)&&define.amd&&define("sprintf",[],function(){return{sprintf:p,vsprintf:t}})}(),define("CatLab/Webremote/Tools/Translator",["sprintf"],function(e){function t(){this.translator=null}var i,n,s=t.prototype;return s.setTranslator=function(t){this.translatorScope=this,"function"==typeof t?this.translator=t:("function"==typeof t.t?this.translator=t.t:(t._,this.translator=t._),this.translatorScope=t)},s.t=function(t){if(this.translator)return this.translator.apply(this.translatorScope,arguments);for(i=[],n=1;n<arguments.length;n++)i.push(arguments[n]);return e.vsprintf(t,i)},new t}),define("CatLab/Webremote/Synchronization/EventHandler",["CatLab/Webremote/Tools/Eventable"],function(t){function e(t,e){this.initializeEventable(),this.namespace=t,this.emit=e}e.eventsToListenFor=["event:trigger"];t=e.prototype=new t;return t.checkNamespace=function(t){return void 0!==t.namespace&&t.namespace===this.namespace},t.processMessage=function(t,e){if("event:trigger"===t)return this.processTriggerEvent(e)},t.processTriggerEvent=function(t){void 0!==t.event&&this.eventableTrigger(t.event,void 0===t.parameters?{}:t.parameters)},t.trigger=function(t,e){this.emit("event:trigger",{namespace:this.namespace,event:t,parameters:e})},t.refreshTarget=function(t){},t.serialize=function(){return{}},t.unserialize=function(t){},e}),define("CatLab/Webremote/Models/Users/ControlUser",["CatLab/Webremote/Models/User","CatLab/Webremote/Models/Control","CatLab/Webremote/Synchronization/RemoteViewFactory","CatLab/Webremote/Tools/Eventable","CatLab/Webremote/Tools/Translator","CatLab/Webremote/Synchronization/DataSynchronizer","CatLab/Webremote/Synchronization/EventHandler","CatLab/Webremote/Collections/Users"],function(e,i,n,t,s,o,r,a){function h(t,e){this.initializeEventable(),(e=void 0===e?{}:e).id=t,e.playerId=null,this.initialize(e)}t=h.prototype=new t;return t.hasPlayerId=function(){return 0<this.playerId},t.setPlayerId=function(t){return this.playerId=t,this},t.control=function(t,e){return void 0===e&&(e=!1),void 0===this.controls[t]&&(this.controls[t]=new i(t,this,e)),this.controls[t]},t.getAvailableControls=function(){return["a","b","x","y","up","down","right","left","start","back"]},t.hasControl=function(t){return!0},t.setWebcontrol=function(t){this.Webcontrol=t},t.initialize=function(t){this.id=t.id,t.playerId&&(this.playerId=t.playerId),this.groups=[],this.currentView=null,this.color="orange",this.colorName="orange",this.colorSet=!1,this.tmpid=null,this.active=!1,this.smiley=null,this.email=null,this.nickname=null,this.userdata=t,this.profiledata={},this.access_token=null,this.user=null,this.master=!1,this.authenticated=!1,void 0!==t&&void 0!==t.groups?this.groupIds=t.groups:this.groupIds=[],this.controls={},this.dataSynchronizer=new o("user",this.emit.bind(this),"master"),this.data=this.dataSynchronizer.getFromIdentifier("user"),this.events=new r("user",this.emit.bind(this)),this.settings={}},t.setSettings=function(t){return this.settings=t,this},t.trigger=function(e,i){0<=o.eventsToListenFor.indexOf(e)?(this.dataSynchronizer.checkNamespace(i)&&this.dataSynchronizer.processMessage(e,i),this.getGroups().forEach(function(t){t.dataSynchronizer.checkNamespace(i)&&t.dataSynchronizer.processMessage(e,i)}.bind(this))):0<=r.eventsToListenFor.indexOf(e)?(this.events.checkNamespace(i)&&this.events.processMessage(e,i),this.getGroups().forEach(function(t){t.events.checkNamespace(i)&&t.events.processMessage(e,i)}.bind(this))):"button:down"===e?this.control(i.id).update(1):"button:up"===e?this.control(i.id).update(0,i.click):"user:login"===e?this.login(i):"user:logout"===e?this.logout(i):"user:smiley"===e?this.setSmiley(i.smiley):"sync:audio"===e&&this.eventableTrigger("sync:audio",i)},t.setSmiley=function(e){this.smiley=e;var i=null;this.getGroups().forEach(function(t){i=!0,t.setSmiley(e,this)}.bind(this)),i||this.Webcontrol.smileys.reserve(e,this.getIdentifier())?this.emit("user:smiley",{smiley:e}):this.emit("dom:alert",{message:s.t("Smiley is already taken. Please select a different smiley.")})},t.setNickname=function(t){return this.nickname=t,this},t.getNickname=function(){return this.nickname||(this.getData().username?this.getData().username:this.playerId?"Player "+this.playerId:"Player "+this.id)},t.clearSmiley=function(){this.smiley=null,this.getGroups().forEach(function(t){t.clearSmiley(this)}.bind(this)),this.emit("user:smiley",{smiley:null})},t.getSmiley=function(){return this.smiley},t.getSmileyImage=function(){return this.Webcontrol.smileys.getImage(this.getSmiley())},t.getSmileyHtml=function(){return this.Webcontrol.smileys.getHtml(this.getSmiley())},t.getSmileyUrl=function(){return this.Webcontrol.smileys.getUrl(this.getSmiley())},t.login=function(t){},t.logout=function(t){},t.clearControls=function(){for(this.tmpid in null!==this.currentView&&this.currentView.clearControls(),this.controls)!this.controls.hasOwnProperty(this.tmpid)||this.controls[this.tmpid].isGlobal||this.controls[this.tmpid].clear()},t.clearEvents=function(){this.clearControls(),this.clearEventableEvents()},t.emit=function(t,e,i){return this.Webcontrol.provider.toPlayer(this,t,e,i),!0},t.getId=function(){return this.id},t.getName=function(){return"User "+this.getId()},t.getType=function(){return"mobile"},t.getEntityType=function(){return"user"},t.getIcon=function(){return"fa fa-mobile-phone"},t.loginFromAuthUser=function(t,e){t={access_token:t.getAccessToken()};this.login(t,e)},t.login=function(e,i){var n=this;this.Webcontrol.getOAuthClient(function(t){t&&(this.setAccessToken(e.access_token),t.profile(n.access_token,function(t){n.authenticated=!0,this.setProfiledata(t.user),void 0!==i&&i()}.bind(this)))}.bind(this))},t.setAccessToken=function(t){this.access_token=t},t.getAccessToken=function(){return this.access_token},t.setProfiledata=function(t){t=void 0!==(this.profiledata=t).accessToken?t.accessToken:null,t=new e(t);void 0!==this.profiledata.id&&t.setId(this.profiledata.id),void 0!==this.profiledata.username&&t.setName(this.profiledata.username),void 0!==this.profiledata.avatar&&t.setAvatar(this.profiledata.avatar),this.setUser(t),this.eventableTrigger("login",this)},t.isAuthenticated=function(){return this.authenticated},t.getData=function(){return this.profiledata},t.logout=function(t){this.profiledata=null,this.access_token=null,this.authenticated=!1},t.setColor=function(t,e){this.colorSet=!0,this.color=t,this.colorName=e,this.emit("color:set",{color:t,name:e})},t.isColorSet=function(){return this.colorSet},t.getColor=function(){return this.color},t.getColorName=function(){return this.colorName},t.isActive=function(){return this.active},t.toggleActive=function(){this.setActive(!this.active),this.setJoinLabel()},t.setJoinLabel=function(){!0===this.active?this.control("a").setLabel("LEAVE"):this.control("a").setLabel("JOIN")},t.setActive=function(t,e){this.active=t,this.eventableTrigger("active:change",t),this.active&&this.eventableTrigger("active:activate"),void 0!==e&&e&&this.setJoinLabel()},t.setView=function(t){return this.clearView(),this.currentView=n.create(t,[this],this.Webcontrol),this.currentView},t.clearView=function(t){var e;this.currentView&&(e=this.currentView,this.currentView=null,this.clearControls(),void 0!==t?setTimeout(function(){e.destroy()},t):e.destroy())},t.refreshView=function(){this.currentView&&this.currentView.refreshTarget(this)},t.getValues=function(){return this.currentView?this.currentView.getValues():null},t.clearValues=function(){this.currentView&&this.currentView.clearValues()},t.setUser=function(t){return this.usermodel=t,this},t.hasUser=function(){return void 0!==this.usermodel&&this.usermodel},t.getUser=function(){return this.usermodel},t.isLocalAuthentication=function(){return!0},t.log=function(t){this.Webcontrol?this.Webcontrol.log("[u:"+this.getId()+"] "+t):console.log(t)},t.getGroups=function(){return this.groups},t.hasDisplay=function(){return!0},t.hasKeyboardInput=function(){return!0},t.hasTouchInput=function(){return!0},t.getIdentifier=function(){return{id:this.getId(),type:this.getEntityType()}},t.represents=function(t){if(void 0===t.id||void 0===t.type)throw"Attribute is not an identifier.";var e=this.getIdentifier();return e.type===t.type&&e.id===t.id},t.getPortalControls=function(){return{start:"start",back:"back",toggleActive:"up",authenticate:"y",left:"left",right:"right"}},t.isMainGroup=function(){if(0===this.groups.length)return!0;for(var t=0;t<this.groups.length;t++)if(this.groups[t].isMainGroup())return!0;return!1},t.isMaster=function(){return this.master},t.setMaster=function(t){var e=this.master!==(t=!!(t=void 0===t?!0:t));return this.master=t,e&&this.eventableTrigger("master:change"),this},t.resetViews=function(t){this.emit("view:reset",{},t=void 0===t?function(){}:t)},t.replaceViews=function(t,e){this.resetViews(function(){this.loadViews(t,e)}.bind(this))},t.loadViews=function(t,e){void 0===e&&(e=function(){}),this.log("Loading views for group "+t),this.emit("view:load",{url:t},e)},t.getConnectToken=function(){return this.Webcontrol.getConnectToken()},t.getConnectTokenForDisplay=function(){return this.Webcontrol.getConnectTokenForDisplay()},t.serialize=function(){return{id:this.getId(),playerId:this.playerId,userdata:this.userdata,profiledata:this.profiledata,email:this.email,nickname:this.nickname,access_token:this.access_token,color:this.color,colorName:this.colorName,smiley:this.smiley,data:this.dataSynchronizer.serialize(),events:this.events.serialize()}},t.unserialize=function(t){void 0!==t.profiledata&&this.setProfiledata(t.profiledata),void 0!==t.playerId&&(this.playerId=t.playerId),void 0!==t.access_token&&this.setAccessToken(t.access_token),void 0!==t.color&&(this.color=t.color),void 0!==t.colorName&&(this.colorName=t.colorName),void 0!==t.nickname&&(this.nickname=t.nickname),void 0!==t.email&&(this.email=t.email),void 0!==t.smiley&&(this.smiley=t.smiley),void 0!==t.data&&this.dataSynchronizer.unserialize(t.data),void 0!==t.events&&this.events.unserialize(t.events)},h}),define("CatLab/Webremote/Models/GroupControl",[],function(){return function(t,i,e){var n,s,o,r,a,h,l=t,c={};this.label=null,this.decoration="",this.group=i,this.isGlobal=e,this.pushed=function(){for(o=i.getUsers(),n=0;n<o.length;n++)if(o[n].control(l,this.isGlobal).pushed())return!0;return!1},this.scale=function(){for(o=i.getUsers(),n=r=0;n<o.length;n++)(a=o[n].control(l,this.isGlobal)).value>r&&(r=a.value);return r},this.getLabel=function(t){return o=i.getUsers(),(n=0)<o.length?(a=o[n].control(l,this.isGlobal)).getLabel(t):null},this.setStaticLabel=function(t,e){for(o=i.getUsers(),n=0;n<o.length;n++)o[n].control(l).setStaticLabel(t,e);return null},this.setLabel=function(t,e){return this.label=t,i.emit("button:label",{id:l,label:t}),this},this.decorate=function(t){return this.decoration=t,i.emit("button:decorate",{id:l,styles:t}),this},this.click=function(t){return this.on("click",t),this},this.on=function(t,e){for(void 0===c[t]&&(c[t]=[]),c[t].push(e),this.log("Setting group trigger "+t),o=i.getUsers(),n=0;n<o.length;n++)o[n].control(l,this.isGlobal).on(t,e);return this},this.off=function(t){for(delete c[t],o=i.getUsers(),n=0;n<o.length;n++)o[n].control(l,this.isGlobal).off(t);return this},this.clearEvents=function(){for(c={},o=i.getUsers(),n=0;n<o.length;n++)o[n].control(l,this.isGlobal).clearEvents();return this},this.clear=function(){for(c={},this.decoration=null,this.label=null,o=i.getUsers(),n=0;n<o.length;n++)o[n].control(l,this.isGlobal).clear();return this},this.isLocalAuthentication=function(){return!1},this.refreshControl=function(){for(o=i.getUsers(),n=0;n<o.length;n++){for(h in o[n].control(l,this.isGlobal).clearEvents(),c)if(c.hasOwnProperty(h))for(s=0;s<c[h].length;s++)o[n].control(l,this.isGlobal).on(h,c[h][s]);this.label&&o[n].control(l,this.isGlobal).setLabel(this.label)}return this},this.refreshTarget=function(t){this.decoration&&t.emit("button:decorate",{id:l,styles:this.decoration}),this.label&&t.emit("button:label",{id:l,label:this.label})},this.log=function(t){i.log("["+l+"] "+t)}}}),define("CatLab/Webremote/Models/ControlGroup",["CatLab/Webremote/Config","CatLab/Webremote/Models/User","CatLab/Webremote/Models/Control","CatLab/Webremote/Models/GroupControl","CatLab/Webremote/Tools/Translator","CatLab/Webremote/Synchronization/RemoteViewFactory","CatLab/Webremote/Tools/Eventable","CatLab/Webremote/Synchronization/DataSynchronizer","CatLab/Webremote/Synchronization/EventHandler","CatLab/Webremote/Tools/Tools"],function(t,e,i,n,s,o,r,a,h,l){function c(t,e){this.initializeEventable(),this.id=t,this.initialize(e)}r=c.prototype=new r;return r.setWebcontrol=function(t){this.Webcontrol=t},r.initialize=function(t){this.token=t.token,this.connectURL=t.connectURL,this.currentView=null,this.color="orange",this.colorName="orange",this.colorSet=!1,this.shareColor=!1,this.tmpid=null,this.active=!1,this.smiley=null,this.email=null,this.userdata=t,this.profiledata={},this.access_token=null,this.master=!1,this.users=[],this.controls=[],this.dataSynchronizer=new a("group",this.emit.bind(this),"master"),this.data=this.dataSynchronizer.getFromIdentifier("group:"+this.getId()),this.events=new h("group",this.emit.bind(this)),this.options={}},r.setOptions=function(t){return this.options=t,this},r.getOption=function(t){return void 0!==this.options[t]?this.options[t]:null},r.hasControl=function(t){return!0},r.setAccessToken=function(t){this.access_token=t},r.setProfiledata=function(t){this.profiledata=t},r.clearControls=function(){for(this.tmpid in null!=this.currentView&&this.currentView.clearControls(),this.controls)!this.controls.hasOwnProperty(this.tmpid)||this.controls[this.tmpid].isGlobal||this.controls[this.tmpid].clear()},r.clearEvents=function(){this.clearControls(),this.clearEventableEvents()},r.isMainGroup=function(){return this.Webcontrol.getConnectToken()===this.getConnectToken()},r.emit=function(t,e,i){return this.Webcontrol.provider.toGroup(this,t,e,i),!0},r.getId=function(){return this.id},r.getName=function(){return"Group "+this.getId()},r.setNickname=function(t){return this.nickname=t,this},r.getNickname=function(){return this.nickname||(this.getData().username?this.getData().username:"Group "+this.getId())},r.getType=function(){return"mobile"},r.getEntityType=function(){return"group"},r.getIcon=function(){return"fa fa-mobile-phone"},r.getData=function(){return this.profiledata},r.setColor=function(t,e,i){void 0===i&&(i=this.shareColor),this.colorSet=!0,this.color=t,this.colorName=e,this.shareColor=i,this.emit("color:set",{color:t,name:e,shareColor:i})},r.getColor=function(){return this.color},r.setShareColor=function(t){this.shareColor=t},r.isShareColor=function(){return this.shareColor},r.getColorName=function(){return this.colorName},r.setView=function(t){return this.clearView(),this.currentView=o.create(t,[this],this.Webcontrol,this.getId()),this.currentView},r.clearView=function(e){var t;this.currentView&&(t=this.currentView,this.currentView=null,this.clearControls(),void 0!==e?setTimeout(function(){t.destroy()},e):t.destroy(),this.users.forEach(function(t){t.clearView(e)}))},r.resetViews=function(t){this.emit("view:reset",{},t=void 0===t?function(){}:t)},r.replaceViews=function(t,e){this.resetViews(function(){this.loadViews(t,e)}.bind(this))},r.loadViews=function(t,e){void 0===e&&(e=function(){}),this.log("Loading views for group "+t),this.emit("view:load",{url:t},e)},r.isAuthenticated=function(){return!1},r.isLocalAuthentication=function(){return!0},r.log=function(t){this.Webcontrol.log("[g:"+this.getId()+"] "+t)},r.getConnectToken=function(){return this.Webcontrol.provider.getConnectToken(this.token)},r.getConnectTokenForDisplay=function(){return l.getConnectTokenForDisplay(this.getConnectToken())},r.getConnectURL=function(){return this.Webcontrol.provider.getConnectURL(this.connectURL)},r.addUser=function(e){for(this.tmpid in l.findIndex(this.users,function(t){return t.id===e.id})<0&&this.users.push(e),l.findIndex(e.groups,function(t){return t.id===this.id})<0&&e.groups.push(this),this.currentView&&(this.currentView.refreshTarget(e),e.currentView=this.currentView),this.controls)this.controls.hasOwnProperty(this.tmpid)&&this.controls[this.tmpid].refreshControl();this.events.refreshTarget(e.emit.bind(e)),this.dataSynchronizer.refreshTarget(e.emit.bind(e)),this.smiley&&(e.emit("user:smiley",{smiley:this.smiley}),e.smiley=this.smiley),this.trigger("user:join",e)},r.removeUser=function(e){var t=l.findIndex(this.users,function(t){return t.id===e.id});0<=t&&this.users.splice(t,1)},r.getUsers=function(){return this.users},r.getIdentifier=function(){return{id:this.getId(),type:this.getEntityType()}},r.represents=function(t){if(void 0===t.id||void 0===t.type)throw"Attribute is not an identifier.";var e=this.getIdentifier();return e.type==t.type&&e.id==t.id},r.getValues=function(){return this.currentView?this.currentView.getValues():null},r.clearValues=function(){this.currentView&&this.currentView.clearValues()},r.control=function(t,e){return void 0===e&&(e=!1),void 0===this.controls[t]&&(this.controls[t]=new n(t,this,e)),this.controls[t]},r.isMaster=function(){return this.master},r.setMaster=function(t){return this.master=t=void 0===t?!0:t,this},r.hasDisplay=function(){return!0},r.hasKeyboardInput=function(){return!0},r.hasTouchInput=function(){return!0},r.getPortalControls=function(){return{start:"start",back:"back",toggleActive:"up",authenticate:"y",left:"left",right:"right"}},r.setOAuthSettings=function(t){this.emit("oauth:set",t)},r.setSmiley=function(t,e){this.Webcontrol.smileys.reserve(t,this.getIdentifier())?(this.emit("user:smiley",{smiley:t}),this.smiley=t):e.emit("dom:alert",{message:s.t("Smiley is already taken. Please select a different smiley.")})},r.clearSmiley=function(t){this.Webcontrol.smileys.unreserve(this.getIdentifier()),this.emit("user:smiley",{smiley:null}),this.smiley=null},r.getSmiley=function(){return this.smiley},r.getSmileyImage=function(){return this.Webcontrol.smileys.getImage(this.getSmiley())},r.getSmileyHtml=function(){return this.Webcontrol.smileys.getHtml(this.getSmiley())},r.getSmileyUrl=function(){return this.Webcontrol.smileys.getUrl(this.getSmiley())},r.setMaxUsers=function(t){this.emit("config:set",{maxUsers:t})},r.isActive=function(){return this.active},r.toggleActive=function(){this.active=!this.active,this.setJoinLabel()},r.setJoinLabel=function(){!0===this.active?this.control("a").setLabel("LEAVE"):this.control("a").setLabel("JOIN")},r.setActive=function(t,e){this.active=t,this.eventableTrigger("active:change",t),this.active&&this.eventableTrigger("active:activate")},r.serialize=function(){return{id:this.getId(),token:this.token,userdata:this.userdata,nickname:this.nickname,profiledata:this.profiledata,email:this.email,access_token:this.access_token,shareColor:this.shareColor,color:this.color,colorName:this.colorName,smiley:this.smiley,data:this.dataSynchronizer.serialize(),events:this.events.serialize()}},r.unserialize=function(t){void 0!==t.profiledata&&this.setProfiledata(t.profiledata),void 0!==t.access_token&&this.setAccessToken(t.access_token),void 0!==t.token&&(this.token=t.token),void 0!==t.shareColor&&(this.shareColor=t.shareColor),void 0!==t.color&&(this.color=t.color),void 0!==t.colorName&&(this.colorName=t.colorName),void 0!==t.nickname&&(this.nickname=t.nickname),void 0!==t.email&&(this.email=t.email),void 0!==t.smiley&&(this.smiley=t.smiley,this.emit("user:smiley",{smiley:this.smiley})),void 0!==t.data&&this.dataSynchronizer.unserialize(t.data),void 0!==t.events&&this.events.unserialize(t.events)},c}),define("CatLab/Webremote/Tools/Preloader",["../Config","CatLab/Webremote/Tools/Deferred"],function(e,o){function i(t){this.provider=t,this.provider.on("file:preload",function(t){t&&t.url&&this.preloadClientFile(t.url)}.bind(this)),this.urlMap={}}var t=i.prototype;return t.preload=function(e){if(Array.isArray(e)){for(var t=new o,i=[],n=0;n<e.length;n++)i.push(this.preload(e[n]));return o.when.apply(o,i).then(function(){t.resolve(Array.prototype.slice.call(arguments))}),t.promise()}var s=new o;return this.provider.emit("file:preload",{url:e},function(t){this.urlMap[e]=t.url,s.resolve(t)}.bind(this)),s.promise()},t.getPreloadedUrl=function(t){return this.urlMap[t]},t.preloadClientFile=function(t){void 0===this.urlMap[t]&&(t.toLowerCase().indexOf("http")<0&&(t=e.getProtocol()+":"+t),this.urlMap[t]=document.createElement("img"),this.urlMap[t].src=t)},t.serialize=function(){return{urlMap:this.urlMap}},i.unserialize=function(t,e){t=new i(t);return void 0!==e&&void 0!==e.urlMap&&(t.urlMap=e.urlMap),t},i}),define("CatLab/Webremote/Models/State",["CatLab/Webremote/Config","CatLab/Webremote/Tools/Preloader"],function(i,n){function t(t){this.Webcontrol=t}var e=t.prototype;return e.reconnect=function(t,e){void 0!==t.provider&&this.Webcontrol.provider.restoreProviderSettings(t.provider),this.Webcontrol.disconnect(),setTimeout(function(){this.Webcontrol.initialize(i.getAll()).then(function(){this.Webcontrol._reconnect(t.token,t.accessToken,function(){this._setCollectionDetails(t.groups,this.Webcontrol._grouplibrary),this._setCollectionDetails(t.users,this.Webcontrol._userlibrary),this.Webcontrol.preloader=n.unserialize(this.Webcontrol.provider,t.preloader),e()}.bind(this))}.bind(this))}.bind(this),1)},e._setCollectionDetails=function(t,e){var i,n;if(void 0!==t)for(i=0;i<t.length;i++)(n=e.getFromId(t[i].id))?n.unserialize(t[i]):(console.log("Trying to set data for non existing user/group."),console.log(t[i]))},e.getData=function(){var e=[],i=(this.Webcontrol._grouplibrary.each(function(t){e.push(t.serialize())}.bind(this)),[]),t=(this.Webcontrol._userlibrary.each(function(t){i.push(t.serialize())}),{users:i,groups:e,token:this.Webcontrol._gamedata.token,accessToken:this.Webcontrol._gamedata.accessToken,preloader:this.Webcontrol.preloader.serialize()});return t.provider=this.Webcontrol.provider.serializeProviderSettings(),t},e.serialize=function(){var t=this.getData();return JSON.stringify(t)},e.unserialize=function(t){t=JSON.parse(t);this.reconnect(t)},t}),define("CatLab/Webremote/Controllers/Portal",["CatLab/Webremote/Config","CatLab/Webremote/Tools/Eventable","CatLab/Webremote/Tools/Translator","CatLab/Webremote/Tools/Tools","CatLab/Webremote/Tools/Deferred"],function(s,t,i,e,o){"use strict";function n(t,e,i){this.initializeEventable(),this.Webcontrol=e,this.options=i,this.controlDisabled=!1,this.users=[],this.ensureOption("allowChangeNickname",!0),this.ensureOption("customFunctions",{}),this.ensureOption("minPlayers",1),this.ensureOption("maxPlayers",4),this.ensureOption("activePlayersPanel",!1),this.ensureOption("customViews",!1),this.ensureOption("authentication",e.AUTH_NOT_REQUIRED),this.ensureOption("localAuthenticable",!1),this.ensureOption("start",function(){alert("This is where the game would start, if one would have set a 'start' option.")});var n={controller:this,assets:e.assets,showInactivePlayers:this.supportInactivePlayers()};void 0!==i.element&&(n.element=i.element),this.view=t.portal(n),this.view.loading(),this.useCatLabViews()&&e.loadViews(s.getSocketURL(!0)+"/webremote/views/default.xml"),this.container=t.getContainer(),this.container.easelboneLayer.setView(this.view),this.view.render(),this.eventListeners=[],this.initialize()}t=n.prototype=new t;return t.initialize=function(){var t=this.Webcontrol.on("user:join",function(t){this.userConnect(t),this.eventListeners.push(t.on("login",function(){this.trigger("users:update")}.bind(this)))}.bind(this));this.eventListeners.push(t),this.Webcontrol.getUsers().forEach(function(t){this.userConnect(t)}.bind(this))},t.ensureOption=function(t,e){void 0===this.options[t]&&(this.options[t]=e)},t.useCatLabViews=function(){return!1===this.options.customViews},t.getToggleView=function(t){var e="",e=this.supportInactivePlayers()?"catlab-portal-toggle":"catlab-portal";return this.isMaster(t)||(e+="-nostart"),e},t.addUser=function(t){t.clearEvents(),this.users.push(t),this.supportInactivePlayers()||this.forceToggleableUser(t)||this.activateUser(t),this.trigger("users:update")},t.activateUser=function(t){this.trigger("user:activate",t),t.setActive(!0,this.supportInactivePlayers())},t.deactivateUser=function(t){this.trigger("user:deactivate",t),t.setActive(!1,this.supportInactivePlayers())},t.toggleActive=function(t){(this.supportInactivePlayers()||this.forceToggleableUser(t))&&(t.isActive()?this.deactivateUser(t):this.activateUser(t),this.trigger("users:update"))},t.forceToggleableUser=function(t){return!t.hasDisplay()},t.hasUsersWithoutDisplay=function(){for(var t=0;t<this.users.length;t++)if(!this.users[t].hasDisplay())return!0;return!1},t.countActiveUsers=function(){return this.getActiveUsers().length},t.getActiveUsers=function(){for(var t=[],e=0;e<this.users.length;e++)this.users[e].isActive()&&t.push(this.users[e]);return t},t.userConnect=function(t){this.eventListeners.push(t.on("master:change",function(){this.updateUserView(t)},this)),this.addUser(t),this.updateUserView(t),this.trigger("user:connect",t)},t.updateUserView=function(t){var e=t.setView(this.getToggleView(t));this.controlDisabled||this.enableControls(t,e),this.enableDefaultPlayerControls(t,e)},t.disableControls=function(){this.controlDisabled=!0;for(var t=0;t<this.users.length;t++)this.users[t].clearEvents()},t.enableControls=function(t,e){var i;void 0!==t?(i=t.getPortalControls(),e.control(i.toggleActive).click(function(){this.toggleActive(t)}.bind(this)),e.control(i.start).click(function(){this.startGame()}.bind(this)),e.control(i.back).click(function(){this.back()}.bind(this)),this.supportsLocalAuthentication()&&e.control(i.authenticate).click(function(){t.isLocalAuthentication()||this.authenticate(t)}.bind(this)),this.view.setWebremoteControlsInView(e)):(this.controlDisabled=!1,this.users.forEach(function(t){this.updateUserView(t)}.bind(this)))},t.enableDefaultPlayerControls=function(i,n){if(n.control("name").setLabel(i.getNickname()),n.listenTo(i,"login",function(){n.control("name").setLabel(i.getNickname())}),this.options.allowChangeNickname&&n.control("change-nickname").click(function(){this.changeNickname(i).then(function(){this.updateUserView(i)}.bind(this))}.bind(this)),this.options.customFunctions)for(var t in this.options.customFunctions)this.options.customFunctions.hasOwnProperty(t)&&function(t,e){n.control(t).click(function(){e(i).then(function(){this.updateUserView(i)}.bind(this))}.bind(this))}.bind(this)(t,this.options.customFunctions[t])},t.changeNickname=function(e){var i=new o,n=e.setView("catlab-nickname");return n.changeValue("name",e.getNickname()),n.control("a").click(function(){var t=n.getValues().name;!t||32<t.length||(e.setNickname(t),i.resolve())}),i.promise()},t.supportInactivePlayers=function(){return this.options.activePlayersPanel},t.supportsLocalAuthentication=function(){return this.options.localAuthenticable&&this.Webcontrol.canAuthenticate()},t.isMaster=function(t){return t.isMaster()},t.getPortalLabels=function(){var s={start:[],back:[],toggleActive:[],authenticate:[]};return this.Webcontrol._userlibrary.each(function(t){var e,i=t.getPortalControls();for(e in i)if(i.hasOwnProperty(e)){var n=t.control(i[e]).getLabel(!1);if(!n)continue;n="["+n.toUpperCase()+"]",void 0===s[e]&&(s[e]=[]),-1===s[e].indexOf(n)&&s[e].push(n)}}.bind(this)),s},t.authenticate=function(t){var e=this,t=(this.disableControls(),this.Webcontrol.authentication(t).view);this.view.addAuthenticationView(t),t.on("view:close",function(){e.enableControls(),e.trigger("users:update")})},t.countAuthenticated=function(t){void 0===t&&(t=!0);for(var e=0,i=0;i<this.users.length;i++)!this.users[i].isAuthenticated()||t&&!this.users[i].isActive()||e++;return e},t.checkAuthentication=function(){var t=this.countAuthenticated();switch(this.options.authentication){case this.Webcontrol.AUTH_REQUIRED_ALL:return t===this.countActiveUsers();case this.Webcontrol.AUTH_REQUIRED_ONE:return 0<t;case this.Webcontrol.AUTH_REQUIRED_ONE_INACTIVE:return 0<this.countAuthenticated(!1);case this.Webcontrol.AUTH_NOT_REQUIRED:return!0;default:throw"Authentication requirement "+this.options.authentication+" not found."}},t.startGame=function(){var t=this.countActiveUsers();if(t<this.options.minPlayers)this.view.alert("You need "+this.options.minPlayers+" players to start playing");else if(t>this.options.maxPlayers)this.view.alert("Your license is limited to "+this.options.maxPlayers+" players");else if(this.checkAuthentication())this.Webcontrol.setView("catlab-game-already-started",this.Webcontrol._userlibrary.not(this.getActiveUsers())),this.Webcontrol.setView("catlab-game-starting",this.getActiveUsers()),this.destroy(),this.options.start(this.getActiveUsers());else switch(this.options.authentication){case this.Webcontrol.AUTH_REQUIRED_ALL:this.view.alert("All active players must be authenticated.");break;case this.Webcontrol.AUTH_REQUIRED_ONE:case this.Webcontrol.AUTH_REQUIRED_ONE_INACTIVE:this.view.alert("At least one player must be authenticated.")}},t.back=function(){void 0!==this.options.back&&(this.destroy(),this.options.back())},t.getConnectURL=function(){return this.Webcontrol.getConnectURL()},t.getConnectToken=function(){return this.Webcontrol.getConnectTokenForDisplay()},t.getUsers=function(){return this.users},t.setMinPlayers=function(t){return this.options.minPlayers=t,this.trigger("options:change"),this},t.setMaxPlayers=function(t){return this.options.maxPlayers=t,this.trigger("options:change"),this},t.getContainer=function(){return this.container},t.getConnectInstructions=function(){return void 0!==this.Webcontrol.provider.getConnectInstructions?i.t.apply(this,this.Webcontrol.provider.getConnectInstructions()):i.t("Use your tablet or smartphone to surf to %s and enter code %s.",this.getConnectURL(),this.getConnectToken())},t.getStartAndLoginInstructions=function(){var t;return void 0!==this.Webcontrol.provider.getStartAndLoginInstructions?i.t.apply(this,this.Webcontrol.provider.getStartAndLoginInstructions()):(t=this.getPortalLabels(),this.supportsLocalAuthentication()&&(this.showInactivePlayers||this.hasUsersWithoutDisplay())?i.t("Press %s to join, %s to login and %s to start.",e(t.toggleActive),e(t.authenticate),e(t.start)):this.supportsLocalAuthentication()?i.t("Press %s to login and %s to start.",e(t.authenticate),e(t.start)):this.showInactivePlayers||this.hasUsersWithoutDisplay()?i.t("Press %s to join and %s to start.",e(t.toggleActive),e(t.start)):i.t("Press %s to start.",e(t.start)));function e(t){return t.join(" "+i.t("or")+" ")}},t.destroy=function(){this.eventListeners&&this.eventListeners.forEach(function(t){t.unbind()})},n}),define("CatLab/Webremote/Controllers/RemoteAuthentication",["CatLab/Webremote/Controllers/OAuth2"],function(e){return function(t){t.setView("remote:authenticate"),t.on("user:join",function(t){t.on("login",function(t){e.addAccessToken(t.getAccessToken())}.bind(this))}.bind(this))}}),define("CatLab/Webremote/Controllers/Authentication",["CatLab/Webremote/Controllers/OAuth2","CatLab/Webremote/Controllers/RemoteAuthentication","CatLab/Webremote/Collections/AuthenticatedUsers","CatLab/Webremote/Tools/Eventable","CatLab/Webremote/Tools/Deferred","CatLab/Webremote/Tools/Cookies"],function(s,n,o,t,r,i){function e(t,e,i,n){this.initializeEventable(),this.view=t.authentication({controller:this,assets:e.assets}),this.Webcontrol=e,this.user=i,o.on("update",this.updateUsers,this),s.on("update",function(){this.view.updateUsers()},this),this.getLoginUrl().then(function(t){this.loginUrl=t,this.view.setLoginUrl(t)}.bind(this)),this.container=t.getContainer(),this.container.easelboneLayer.setView(this.view),this.view.render()}var a=null,h=null,t=e.prototype=new t;return t.link=function(){s.link(function(t){this.selectUser(t)}.bind(this))},t.updateUsers=function(){this.trigger("users:update")},t.selectUser=function(t){var e=this;this.user.loginFromAuthUser(t,function(){i.setCookie("ctlb_ps_"+this.user.id,t.id),e.close()}.bind(this))},t.getUsers=function(){return o},t.close=function(){this.view.close()},t.getLoginUrl=function(){var e,t,i=new r;return e=this.Webcontrol,(null!==a?((t=new r).resolve(a),t):(null===h&&(h=new r,e.newGroup().then(function(t){new n(a=t),t.setOAuthSettings(e.getOAuthSettings()),h.resolve(t)})),h)).promise().then(function(t){i.resolve(t.getConnectURL()+"/"+t.getConnectToken())}),i.promise()},t.getContainer=function(){return this.container},t.attemptLastLogin=function(){var t=i.getCookie("ctlb_ps_"+this.user.id);if(t){t=o.getFromId(t);if(t)return this.selectUser(t),!0}return!1},e}),define("CatLab/Webremote/Tools/Smileys",["CatLab/Webremote/Config","CatLab/Webremote/Tools/Tools"],function(i,n){function t(t){this.provider=t,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 e=t.prototype;return e.shouldHaveUniqueSmileys=function(){return this.takenAmount<this.smileyKeys.length/3},e.setTakenSmileys=function(t){this.taken=t},e.getTakenSmileys=function(t){if(!this.shouldHaveUniqueSmileys())return{};t=this.identifierToText(t);var e,i={};for(e in this.taken)this.taken.hasOwnProperty(e)&&this.taken[e]!==t&&(i[e]=this.taken[e]);return i},e.getRandom=function(t){for(var e=null;null===e&&this.randomSmileys;)if(e=this.randomSmileys.shift(),this.reserve(e,t)||(e=null),0===this.randomSmileys.length)return this.randomSmileys=this.smileyKeys.slice(0),n.shuffle(this.randomSmileys),this.randomSmileys.shift();return e},e.reserve=function(t,e){return this.isExternalSmiley(t)?(this.unreserve(e),!0):(e=this.identifierToText(e),void 0!==this.taken[t]&&this.taken[t]===e?(this.taken[t]=e,!0):!!this.isAvailable(t)&&(this.unreserve(e),this.taken[t]=e,this.takenAmount++,!0))},e.unreserve=function(t){for(var e in t=this.identifierToText(t),this.taken)this.taken.hasOwnProperty(e)&&this.taken[e]===t&&(this.taken[e]=null,delete this.taken[e],this.takenAmount--)},e.isAvailable=function(t){return!this.shouldHaveUniqueSmileys()||!!this.isExternalSmiley(t)||void 0===this.taken[t]||null===this.taken[t]},e.identifierToText=function(t){return JSON.stringify(t)},e.isExternalSmiley=function(t){return"http"===t.substr(0,4)},e.getUrl=function(t){return null===t?null:this.isExternalSmiley(t)?t:i.getAssetsURL()+"smileys/"+t+".png"},e.getHtml=function(t){return null===t?null:'<span class="smiley" style="width: 64px; height: 64px; display: block; background-image: url(\''+this.getUrl(t)+"');\"></span>"},e.getElement=function(t){var e;return null===t?null:((e=document.createElement("div")).innerHTML=this.getHtml(t),e.firstChild)},e.getImage=function(t){var e;return null===t?null:(void 0===this.images[t]&&((e=new Image).crossOrigin="anonymous",e.src=i.getProxiedImage(this.getUrl(t)),this.images[t]=e),this.images[t])},e.refreshTakenSmileys=function(t){this.shouldHaveUniqueSmileys()?t.emit("smileys:taken",{smileys:this.getTakenSmileys(t.getIdentifier())}):this.playerKnowsAboutNonUniqueSmileys[this.getStringIdentifier(t)]},e.getStringIdentifier=function(t){return t.type+":"+t.id},t}),define("CatLab/Webremote/Tools/MessageCounter",["CatLab/Webremote/Tools/Eventable"],function(t){"use strict";function e(t){this.interval=t||1e3,this.initializeEventable(),this.countIncoming=0,this.countOutgoing=0;var e,i,n=(new Date).getTime();setInterval(function(){e=(new Date).getTime(),i=e-n,n=e,this.trigger("tick",{in:this.countIncoming,out:this.countOutgoing,dt:i}),this.countIncoming=0,this.countOutgoing=0}.bind(this),this.interval)}t=e.prototype=new t;return t.incoming=function(){this.countIncoming++},t.outgoing=function(){this.countOutgoing++},e}),define("CatLab/Webremote/Views/Portal",["CatLab/Webremote/Config"],function(D,t){return function(t){var s=t.element||document.body,e=s,i=t.countdown||5e3,n=t.done||function(){alert("Game should start now... yet it doesn't.")},o=t["min-players"]||1,r=(o<1&&(o=1),t["max-players"]||1e3);r<o&&(r=o);var a,h,l,c,u,d,f,g,p,m,A,v=!t.customViews,b=[],y=!1,w=!1,C=null,k=this;function _(s){s.setView("catlab-portal-toggle"),s.control("join-game").click(function(){!function(t){if(W(t)){t.control("join-game").setLabel("JOIN");for(var e=t,i=0;i<b.length;i++)if(b[i].getId()==e.getId())return b.splice(i,1)}else t.control("join-game").setLabel("LEAVE"),b.push(t)}(s),x(),U(),P()}),s.control("start-game").click(function(){var t;y?P():b.length<o?F(o+" players are required to start the game. Please gather more friends."):b.length>r?F("This game can have only "+r+" players."):(t=i,P(),y=!0,(f=new Date).setTime((new Date).getTime()+t),u.show(),d=setInterval(Q,100))}),s.control("down").click(function(){I(s)}),s.control("right").click(function(){I(s)}),s.control("left").click(function(){T(s)}),s.control("up").click(function(){T(s)}),s.control("a").click(function(){var t,i,e,n;t=s,w&&S(t)?(n=A.find(".available-accounts").find("li.selected"))&&(n=WebcontrolOAuthClient.getFromToken(n.attr("data-accessToken")))&&(e=n.access_token,n=n.user,C.setUserData(e,n),L()):(y&&P(),w||(i=t,Webcontrol.getOAuthClient(function(e){e.onInit(function(){E(e)}),WebcontrolAccessKeyLibrary.init(function(){w=!0,C=i,m.show(),A.show();var t=$('<a href="javascript:void(0);">Link new account</a>');t.click(function(){e.getNewAccessToken(function(){E(e)})}),A.find(".link-new-account").html(t)}),E(e)})))}),s.control("b").click(function(){w&&S(s)&&(C.setUserData(!1),L())}),M(),U()}function T(t){w&&S(t)&&(t=A.find(".available-accounts").find("li.selected"),A.find(".available-accounts").find("li").removeClass("selected").addClass("unselected"),(t.length&&t.prev().length?t.prev():A.find(".available-accounts").find("li").last()).addClass("selected").removeClass("unselected"))}function I(t){w&&S(t)&&(t=A.find(".available-accounts").find("li.selected"),A.find(".available-accounts").find("li").removeClass("selected").addClass("unselected"),(t.length&&t.next().length?t.next():A.find(".available-accounts").find("li").first()).addClass("selected").removeClass("unselected"))}function S(t){return C&&t.getId()==C.getId()}function L(){m.hide(),A.hide(),w=!1,C=null}function E(t){A.find(".available-accounts").html("");for(var e=t.listUsers(),i=0;i<e.length;i++){var n=$("<li>"+e[i].user.username+"</li>");n.addClass("unselected"),n.attr("data-accessToken",e[i].access_token),A.find(".available-accounts").append(n)}}function U(){0<Webcontrol.getControlLabels("join-game").length?($(".buttoninstructions.join-game").show().find(".labels").html(Webcontrol.getControlLabels("join-game").join(", ")),$(".buttoninstructions.start-game").show().find(".labels").html(Webcontrol.getControlLabels("start-game").join(", "))):($(".buttoninstructions.join-game").hide(),c.hide())}function W(t){for(var e=0;e<b.length;e++)if(b[e].getId()==t.getId())return 1}function M(){var t=Webcontrol.getUsers();a.html("");for(var e=[],i=0;i<t.length;i++)W(t[i])||e.push(t[i]);for(0==e.length&&a.append('<li class="empty"><span>More players? Add devices!</span></li>'),i=0;i<e.length;i++)a.append('<li class="user '+e[i].getType()+'" style="background-color: '+e[i].getColor()+'"><i class="'+e[i].getIcon()+'"></i><span>'+e[i].getName()+"</span></li>")}function x(){h.html(""),0==b.length&&h.append('<li class="empty"><span class="buttoninstructions join-game">Press <span class="labels"></span> to join the game.</span></li>');for(var t=0;t<b.length;t++)h.append('<li class="user '+b[t].getType()+'" style="background-color: '+b[t].getColor()+'"><i class="'+b[t].getIcon()+'"></i><span>'+b[t].getName()+"</span></li>");M()}function Q(){g=Math.ceil((f.getTime()-(new Date).getTime())/1e3),u.find(".counter").html(g),g<0&&(void 0!==e&&(void 0!==e.hide?e.hide():void 0!==e.style&&(e.style.display="none")),P(),n(b))}function P(){y=!1,d&&(F("Countdown stopped!"),u.hide(),clearInterval(d),d=null)}function F(t){var e=jQuery("<p></p>").html(t).appendTo(p);setTimeout(function(){e.fadeOut(1e3,function(){e.remove()})},3e3)}this.loginInformation="Login into your account and get access to more game features now!",0<s.length?s.addClass("webremote-portal"):s.className=s.className+" webremote-portal",void 0!==t.theme&&(t=D.getSocketURL()+"/webremote/themes/"+t.theme+"/"+t.theme+".css",Webcontrol._loadCSS(t),Webcontrol._loadCSS(D.getSocketURL()+"/webremote/themes/font-awesome/css/font-awesome.min.css")),s.innerHTML='<div class="loading"><p>Please wait, loading socket.io.</p></div>',Webcontrol.initialize(function(){s.innerHTML='<div class="loading"><p>Please wait, loading jQuery.</p></div>',s.innerHTML="";var t=s,t=(s=jQuery('<div class="webremote-portal-inner"></div>').appendTo(t),(s=jQuery(s)).html('<div class="loading"><p>Please wait, connecting to server.</p></div>'),v&&Webcontrol.loadViews(D.getSocketURL(!0)+"/webremote/views/default.xml"),s.html("<h1>Player lobby</h1>"),m=$("<div></div>"),A=$('<div><h2>Select account</h2><div class="information"><p>'+k.loginInformation+'</p></div><ul class="available-accounts"></ul><p class="link-new-account"></p></div>'),m.addClass("accounts-overlay"),A.addClass("accounts"),m.hide(),A.hide(),s.append(m),s.append(A),jQuery('<div class="connected-users"><div class="inner"><h2>Connected devices</h2></div></div>')),e=(a=jQuery('<ul class="connected-users"></ul>').appendTo(t.find(".inner")),jQuery('<div class="active-users"><div class="inner"><h2>Active users</h2></div></div>'));h=jQuery('<ul class="active-users"></ul>').appendTo(e.find(".inner")),s.append(t),s.append(e),(t=jQuery('<div class="connection-information"><div class="inner"><h2>Instructions</h2><p>Take your smartphone, navigate to <span class="url"></span> and use token <span class="token"></span></p></div></div>')).find(".token").html(Webcontrol.getConnectToken()),t.find(".url").html(Webcontrol.getConnectURL()),l=jQuery('<p class="buttoninstructions join-game">Press <span class="labels"></span> to join the game.</p>'),c=jQuery('<p class="buttoninstructions start-game">Press <span class="labels"></span> to start the game.</p>'),p=jQuery('<div class="errors"></div>').appendTo(s),t.append(l),t.append(c),s.append(t),u=jQuery('<div class="countdown-background"></div><div class="countdown"><p>Game will start in <span class="counter">5</span></p></div>').hide().appendTo(s),Webcontrol.on("user:join",function(t){_(t)});for(var i=Webcontrol.getUsers(),n=0;n<i.length;n++)_(i[n]);Webcontrol.on("user:leave",M),M(),x(),U()})}}),define("CatLab/Webremote/ViewFactory/ViewFactory",["CatLab/Webremote/Views/Portal"],function(e){"use strict";function t(){}return t.prototype.getPortal=function(t){return new e(t)},t}),define("CatLab/Webremote/Views/ConnectionTrouble",["CatLab/Webremote/Tools/Translator"],function(t){function e(){this.visible=!1,this.div=null,this.timeoutTillShow=3e3,this.showTimeout=null,this.message=null}var i=e.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(t.t("Connection lost")))}.bind(this),this.timeoutTillShow))},i.text=function(t){this.message=t,this.div&&(this.div.innerHTML="<p>"+t+"</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},e}),define("CatLab/Webremote/Synchronization/MessageQueue",[],function(){"use strict";function t(){this.queue=[]}var e=t.prototype;return e.add=function(t,e,i){this.queue.push({action:t,data:e,ack:i})},e.flush=function(){var t=this.queue;return this.queue=[],t},e.compactFlush=function(){var n,s,o,r,a=[],t=this.flush();return 0===t.length?t:(s={user:{},group:{}},o=0,r={},t.forEach(function(t){if(o++,this.canCompact(t)){var e=null;void 0!==t.data.user?e="user":void 0!==t.data.group&&(e="group"),void 0===s[e][t.action]&&(s[e][t.action]=[]);for(var i=0;i<s[e][t.action].length;i++)if(n=s[e][t.action][i],this.isSimilarMessage(n.event,t)&&(void 0===r[t.data[e]]||r[t.data[e]]<n.index))return r[t.data[e]]=n.index,n.event.data[e].push(t.data[e]),void n.event.data._d.push(this.getDifference(n.event,t));Array.isArray(t.data[e])||(t.data[e]=[t.data[e]]),t.data._d=[{}],r[t.data[e]]=o,s[e][t.action].push({event:t,index:o})}a.push(t)}.bind(this)),a)},e.moveToEnd=function(t,e){t.push(t.splice(t.indexOf(e),1)[0])},e.isSimilarMessage=function(t,e){return t.action===e.action&&this.getCompareDataString(t)===this.getCompareDataString(e)},e.getDifference=function(t,e){var i,n={};for(i in e.data)if(e.data.hasOwnProperty(i)){switch(i){case"user":case"group":case"_d":case"_i":continue}void 0!==t.data[i]&&t.data[i]===e.data[i]||(n[i]=e.data[i])}return n},e.getCompareDataString=function(t){t=Object.assign({},t.data);return delete t.user,delete t.group,delete t.viewId,delete t._d,delete t._i,JSON.stringify(t)},e.canCompact=function(t){return!(void 0!==t.ack&&null!==t.ack||void 0===t.data||void 0===t.data.user&&void 0===t.data.group)},t.unpack=function(t,e){if(void 0===t[e])return[t];var i=Array.isArray(t[e])?t[e]:[t[e]],n=[];void 0!==t._d&&(n=Array.isArray(t._d)?t._d:[t._d]);for(var s=[],o=0;o<i.length;o++){(r={})[e]=i[o];var r=Object.assign({},t,r,void 0!==n[o]?n[o]:{});delete r._d,s.push(r)}return s},Object.defineProperty(e,"length",{get:function(){return this.queue.length}}),t}),define("CatLab/Webremote/Tools/Proxy",["CatLab/Webremote/Config","CatLab/Webremote/Tools/Deferred"],function(o,r){function t(){}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 t.prototype.get=function(t){o.getProxy()&&(t=o.getProxy()+encodeURIComponent(t)),console.log(t);var e,i,n,s=new r;return t=t,e=function(t){s.resolve(t.responseText)},(n=function(){for(var t=!1,e=0;e<a.length;e++){try{t=a[e]()}catch(t){continue}break}return t}())&&(n.open(i?"POST":"GET",t,!0),i&&n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&(200==n.status||304==n.status?e(n):console.error("CatLab Remote HTTP error "+n.status))},4!=n.readyState)&&n.send(i),s.promise()},new t}),define("CatLab/Webremote/Providers/Provider",["CatLab/Webremote/Synchronization/MessageQueue","CatLab/Webremote/Tools/Proxy","CatLab/Webremote/Tools/Deferred"],function(t,i,n){"use strict";function e(){this.initializeProvider()}var s=e.prototype;return s.initializeProvider=function(){this.queue=new t,this.postInitializeQueue=[],this.scheduled=!1,this.initialized=!1,this.sendBurstDelay=10,this.maxQueueSize=2500,this.messageCounter=null,this.events={}},s.getProviderSettings=function(){var t=new n;return t.resolve({}),t.promise()},s.setMessageCounter=function(t){this.messageCounter=t},s.initMaster=function(t){this.master=t},s.initPlayer=function(t){this.master=t},s.connect=function(){var t=new n;return t.resolve(),t.promise()},s.disconnect=function(){this.off()},s.setOAuthSettings=function(t){this.emit("oauth:set",t)},s.loadViews=function(t,e){(e=void 0===e?!1:e)?i.get(t).then(function(t){this.emit("view:load",{xml:t})}.bind(this)):this.emit("view:load",{url:t})},s.toMaster=function(t,e,i){this.emit(t,e,i)},s.toPlayers=function(t,e,i){this.emit(t,e,i)},s.toPlayer=function(t,e,i,n){i.user=t.getId(),this.emit(e,i,n)},s.toGroup=function(t,e,i,n){i.group=t.getId(),this.emit(e,i,n)},s.emit=function(t,e,i){this.initialized?this.queue?(this.queue.add(t,e,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(t,e,i):this.postInitializeQueue.push({action:t,data:e,ack:i})},s.createGroup=function(t,e,i,n){this.emit("group:create",{externalId:t,globalViews:e,shareColor:i,tags:n=void 0===n?[]:n})},s.executeQueue=function(){this.initialized&&this.emitAll()},s.setInitialized=function(){var t;for(this.initialized=!0;t=this.postInitializeQueue.shift();)this.emit(t.action,t.data,t.ack)},s.setup=function(t){this.emit("master:setup",t)},s.reset=function(t){this.emit("master:reset",null,function(){t()})},s.getStaticUrl=function(t){return t},s.reconnect=function(t,e,i,n){this.emit("master:reconnect",{token:t,accessToken:e,gameConfig:i},function(){n()}.bind(this))},s.off=function(){this.events={}},s.on=function(t,e){this._addEvent(t,e,!1),this._touchEvent(t)},s.once=function(t,e){this._addEvent(t,e,!0),this._touchEvent(t)},s._addEvent=function(t,e,i){void 0===this.events[t]&&(this.events[t]=[]),this.events[t].push({callback:e,once:i})},s._touchEvents=function(){for(var t in this.events)this.events.hasOwnProperty(t)&&this._touchEvent(t)},s._touchEvent=function(t){},s._trigger=function(t,i){var n;void 0!==this.events[t]&&(n=[],this.events[t].forEach(function(t){var e=t.callback;t.once&&n.push(t);try{e.apply(this,[i])}catch(t){console.error(t)}}),0<n.length)&&(n.unshift(this.events),function(t){for(var e,i,n=arguments,s=n.length;1<s&&t.length;)for(e=n[--s];-1!==(i=t.indexOf(e));)t.splice(i,1);return t}.apply(this,n))},s.getConnectURL=function(t){return null},s.getConnectToken=function(t){return null},s.tokenConnect=function(t){var e=new n;return e.resolve(),e.promise()},s.noTokenConnect=function(){var t=new n;return t.resolve(),t.promise()},s.restoreProviderSettings=function(t){},s.serializeProviderSettings=function(){return{}},e}),define("CatLab/Webremote/Providers/SocketIO",["CatLab/Webremote/Providers/Provider","CatLab/Webremote/Config","CatLab/Webremote/Tools/Deferred","CatLab/Webremote/Tools/Tools"],function(t,r,a,e){function i(){this.initializeProvider(),this.userId=null,this.randomToken=e.getUuid(),this.loadBalancerSessionToken="connid",this.socket=null,this._registeredEvents={}}var h=null,t=i.prototype=new t;return t.getProviderSettings=function(){var e=new a;return r.getServerList()?r.getServerList().getSelectedServer().then(function(t){e.resolve({host:t})}.bind(this)):e.resolve({}),e.promise()},t.connect=function(n,s){var e,o=new a;return this.log("Loading socket.io"),e=function(){this.log("Connecting to socket.io");var t,e=r.getSocketURL(),i=(void 0!==s.host&&s.host&&(e=(t=r.getProtocol())?t+"://"+s.host:"//"+s.host),this.socket=h(e+"/"+n+"?"+this.loadBalancerSessionToken+"="+this.randomToken,{withCredentials:!1,reconnection:!0}),!1);this.socket.on("connect_error",function(t){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(t){this._trigger("reconnect")}.bind(this)),this._touchEvents(),o.resolve())}.bind(this))}.bind(this),require(["socket.io-client"],function(t){h=t,e()}),o.promise()},t.disconnect=function(t){void 0===t&&(t=!0),this.initialized=!1,this.socket&&((t?this:(this._registeredEvents={},this.socket)).off(),this.socket.disconnect(),this.socket=null)},t.off=function(){this._registeredEvents={},this.events={},this.socket.off()},t.setUserId=function(t){return this.userId=t,this},t.emitAll=function(){var t,e=this.queue.compactFlush();if(e.length)for(;t=e.shift();)this.emitOne(t.action,t.data,t.ack)},t.emitOne=function(t,e,i){this.socket.emit(t,e,i),this.messageCounter&&this.messageCounter.outgoing()},t.log=function(){this.master.log.apply(arguments)},t.getStaticUrl=function(t){return t.indexOf("?")<0?t+="?":t+="&",t+(this.loadBalancerSessionToken+"="+this.randomToken)},t._detachEvents=function(t){this.socket&&this.socket.off(t)},t._touchEvent=function(e){this.socket&&void 0===this._registeredEvents[e]&&(this.socket.on(e,function(t){this._trigger(e,t)}.bind(this)),this._registeredEvents[e]=!0)},t._handleSocketIoEvent=function(t,e){switch(t){case"connect":case"disconnect":break;default:return this._trigger(t,e)}},t.getConnectURL=function(t){return r.getServerList()?r.getServerList().getConnectURL():t},t.getConnectToken=function(t){return r.getServerList()?r.getServerList().getConnectToken(t):t},t.tokenConnect=function(t){var e=new a,i={};if(r.getServerList())try{var n=r.getServerList().getFromToken(t);i.host=n.host,t=n.token}catch(t){return e.reject(),e.promise()}return this.connect("remote",i).fail(function(){e.reject()}).then(function(){e.resolve(t)}),e.promise()},t.restoreProviderSettings=function(t){void 0!==t.serverlist&&r.getServerList()&&r.getServerList().unserialize(t.serverlist)},t.serializeProviderSettings=function(){var t={};return r.getServerList()&&(t.serverlist=r.getServerList().serialize()),t},i}),define("CatLab/Webremote/Models/Users/GamepadUser",["CatLab/Webremote/Models/Users/ControlUser"],function(t){function e(t){t=t.id||"1",this.initialize({id:"gamepad_"+t}),this.clearControls()}var i={DPAD_UP:{id:"up",label:"↑",key:""},DPAD_DOWN:{id:"down",label:"↓",key:"DPAD_DOWN"},DPAD_RIGHT:{id:"right",label:"→",key:"DPAD_RIGHT"},DPAD_LEFT:{id:"left",label:"←",key:"DPAD_LEFT"},FACE_1:{id:"a",label:"A",key:"FACE_1"},FACE_2:{id:"b",label:"B",key:"FACE_2"},FACE_3:{id:"x",label:"X",key:"FACE_3"},FACE_4:{id:"y",label:"Y",key:"FACE_4"},SELECT_BACK:{id:"back",label:"SELECT",key:"SELECT_BACK"},START_FORWARD:{id:"start",label:"START",key:"START_FORWARD"}},t=e.prototype=new t;return t.getType=function(){return"gamepad"},t.getIcon=function(){return"fa fa-gamepad"},t.emit=function(){return!1},t.isLocalAuthentication=function(){return!1},t.controlFromKey=function(t){return this.control(i[t].id)},t.hasDisplay=function(){return!1},t.hasKeyboardInput=function(){return!1},t.hasTouchInput=function(){return!1},e}),define("CatLab/Webremote/Gamepads/GamepadAPI",["CatLab/Webremote/Models/Users/GamepadUser"],function(i){function t(){this.gamepads={},this.initialized=!1,this.Webcontrol=null}var n,e,s={12:"DPAD_UP",13:"DPAD_DOWN",15:"DPAD_RIGHT",14:"DPAD_LEFT",0:"FACE_1",1:"FACE_2",2:"FACE_3",3:"FACE_4",8:"SELECT_BACK",9:"START_FORWARD"},o=t.prototype;return o.initialize=function(t){var e;this.Webcontrol=t,this.initialized||(this.initialized=!0,t=function(){var t=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads||[];for(n=0;n<t.length;n++)if(t[n]){for(n=0;n<t.length;n++)t[n]&&this.onConnect(t[n]);this.startGamepadPolling(),clearInterval(e)}}.bind(this),"undefined"!=typeof window&&("ongamepadconnected"in window?(window.addEventListener("gamepadconnected",function(t){this.onConnect(t.gamepad)}.bind(this)),window.addEventListener("gamepaddisconnected",function(t){this.onDisconnect(t.gamepad)}.bind(this))):e=setInterval(t,1e3)))},o.startGamepadPolling=function(){setInterval(this.poll.bind(this),50)},o.poll=function(){var t=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads||[];for(n=0;n<t.length;n++)if(t[n])for(e=0;e<t[n].buttons.length;e++)this.gamepads[t[n].index].user&&void 0!==s[e]&&this.gamepads[t[n].index].user.controlFromKey(s[e]).update(t[n].buttons[e].pressed?1:0)},o.onConnect=function(t){var e=new i({id:t.id});this.gamepads[t.index]={user:e},this.Webcontrol.addCustomControl(e),this.startGamepadPolling()},o.onDisconnect=function(t){},new t}),define("CatLab/Webremote/SonicSync/Library/ring-buffer",[],function(){function e(t){this.array=[],this.maxLength=t}return e.prototype.get=function(t){return t>=this.array.length?null:this.array[t]},e.prototype.last=function(){return 0==this.array.length?null:this.array[this.array.length-1]},e.prototype.add=function(t){this.array.push(t),this.array.length>=this.maxLength&&this.array.splice(0,1)},e.prototype.length=function(){return this.array.length},e.prototype.clear=function(){this.array=[]},e.prototype.copy=function(){var t=new e(this.maxLength);return t.array=this.array.slice(0),t},e.prototype.remove=function(t,e){this.array.splice(t,e)},e}),define("CatLab/Webremote/SonicSync/Library/sonic-coder",[],function(){function t(t){this.freqMin=(t=t||{}).freqMin||18500,this.freqMax=t.freqMax||19500,this.freqError=t.freqError||50,this.alphabetString=t.alphabet||"\n abcdefghijklmnopqrstuvwxyz0123456789,.!?@*",this.startChar=t.startChar||"^",this.endChar=t.endChar||"$",this.alphabet=this.startChar+this.alphabetString+this.endChar}return t.prototype.charToFreq=function(t){var e=this.alphabet.indexOf(t),t=(-1==e&&(console.error(t,"is an invalid character."),e=this.alphabet.length-1),this.freqMax-this.freqMin),e=e/this.alphabet.length,t=Math.round(t*e);return this.freqMin+t},t.prototype.freqToChar=function(t){if(!(this.freqMin<t&&t<this.freqMax))if(this.freqMin-t<this.freqError)t=this.freqMin;else{if(!(t-this.freqMax<this.freqError))return console.error(t,"is out of range."),null;t=this.freqMax}var e=this.freqMax-this.freqMin,t=(t-this.freqMin)/e,e=Math.round(this.alphabet.length*t);return this.alphabet[e]},t}),define("CatLab/Webremote/SonicSync/Library/sonic-server",["./ring-buffer","./sonic-coder"],function(e,i){function t(t){this.peakThreshold=(t=t||{}).peakThreshold||-65,this.minRunLength=t.minRunLength||2,this.coder=t.coder||new i(t),this.timeout=t.timeout||300,this.debug=!!t.debug,this.peakHistory=new e(16),this.peakTimes=new e(16),this.callbacks={},this.buffer="",this.state=n,this.isRunning=!1,this.iteration=0}var n=1,s=2;return t.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(t){console.log(t)}},t.prototype.stop=function(){this.isRunning=!1,this.track.stop()},t.prototype.on=function(t,e){"message"==t&&(this.callbacks.message=e),"character"==t&&(this.callbacks.character=e)},t.prototype.setDebug=function(t){this.debug=t;t=document.querySelector("canvas");t&&t.parentElement.removeChild(t)},t.prototype.fire_=function(t,e){"function"==typeof t&&t(e)},t.prototype.onStream_=function(t){var e;void 0!==t.getTracks()[0]?(this.track=t.getTracks()[0],e=new AudioContext,t=(this.audioContext=e).createMediaStreamSource(t),e=e.createAnalyser(),t.connect(e),this.freqs=new Float32Array(e.frequencyBinCount),this.analyser=e,this.isRunning=!0,this.raf_(this.loop.bind(this))):console.log("No microphone found.")},t.prototype.onStreamError_=function(t){console.error("Audio input error:",t)},t.prototype.getPeakFrequency=function(){for(var t=-1/0,e=-1,i=this.freqToIndex(this.coder.freqMin);i<this.freqs.length;i++)this.freqs[i]>t&&(t=this.freqs[i],e=i);return t>this.peakThreshold?this.indexToFreq(e):null},t.prototype.loop=function(){this.analyser.getFloatFrequencyData(this.freqs),(this.iteration+1)%300==0&&this.restartServerIfSanityCheckFails();var t=this.getPeakFrequency();t?(t=this.coder.freqToChar(t),this.debug&&console.log("Transcribed char: "+t),this.peakHistory.add(t),this.peakTimes.add(new Date)):(t=this.peakTimes.last())&&new Date-t>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},t.prototype.indexToFreq=function(t){return this.audioContext.sampleRate/2/this.freqs.length*t},t.prototype.freqToIndex=function(t){var e=this.audioContext.sampleRate/2;return Math.round(t/e*this.freqs.length)},t.prototype.analysePeaks=function(){var t=this.getLastRun();t&&(this.state==n?t==this.coder.startChar&&(this.buffer="",this.state=s):this.state==s&&(t!=this.lastChar&&t!=this.coder.startChar&&t!=this.coder.endChar&&(this.buffer+=t,this.lastChar=t,this.fire_(this.callbacks.character,t)),t==this.coder.endChar)&&(this.state=n,this.fire_(this.callbacks.message,this.buffer),this.buffer=""))},t.prototype.getLastRun=function(){for(var t=this.peakHistory.last(),e=0,i=this.peakHistory.length()-2;0<=i&&this.peakHistory.get(i)==t;i--)e+=1;return e>this.minRunLength?(this.peakHistory.remove(i+1,e+1),t):null},t.prototype.debugDraw_=function(){var t=document.querySelector("canvas");t||(t=document.createElement("canvas"),document.body.appendChild(t)),t.width=document.body.offsetWidth,t.height=480,drawContext=t.getContext("2d");for(var e=0;e<this.freqs.length;e++){var i=this.freqs[e]+400,i=t.height-i-1,n=t.width/this.freqs.length;drawContext.fillStyle="black",drawContext.fillRect(e*n,i,1,1)}},t.prototype.raf_=function(t){"undefined"==typeof window||window.chrome&&chrome.extension?setTimeout(t,1e3/60):requestAnimationFrame(t)},t.prototype.restartServerIfSanityCheckFails=function(){if(this.freqs[0]<-300)console.error("freqs[0] < -300. Restarting."),this.restart();else{for(var t=!0,e=0;e<10;e++)-100==this.freqs[e]&&(t=!1);t||(console.error("freqs[0:10] == -100. Restarting."),this.restart())}},t.prototype.restart=function(){},t}),define("CatLab/Webremote/SonicSync/Library/sonic-socket",["./sonic-coder"],function(e){var i=!1;function t(t){this.coder=(t=t||{}).coder||new e,this.charDuration=t.charDuration||.5,this.coder=t.coder||new e(t),this.rampDuration=t.rampDuration||.001,this.audioContext=new i}return"undefined"!=typeof window&&(i=window.AudioContext||window.webkitAudioContext||!1),t.prototype.send=function(t,e){t=this.coder.startChar+t+this.coder.endChar;for(var i,n=0;n<t.length;n++){var s=t[n],s=this.coder.charToFreq(s),o=this.audioContext.currentTime+this.charDuration*n;this.scheduleToneAt(s,o,this.charDuration)}e&&(i=this.charDuration*t.length,setTimeout(e,1e3*i))},t.prototype.scheduleToneAt=function(t,e,i){var n=this.audioContext.createGain(),i=(n.gain.value=0,n.gain.setValueAtTime(0,e),n.gain.linearRampToValueAtTime(1,e+this.rampDuration),n.gain.setValueAtTime(1,e+i-this.rampDuration),n.gain.linearRampToValueAtTime(0,e+i),n.connect(this.audioContext.destination),this.audioContext.createOscillator());i.frequency.value=t,i.connect(n),i.start(e)},t}),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(e,t,i,n,s,o){function r(t){this.options=e.getAudioSyncConfig(),this.alphabet=this.options.alphabet.split(""),this.controller=t}var a=r.prototype;return a.startListener=function(){this.stop();var t=new n(this.options);t.start(),t.on("message",this.onIncomingMessage.bind(this)),this.sonicServer=t},a.startSender=function(){this.sonicSocket=new s(this.options)},a.stop=function(){this.sonicServer&&this.sonicServer.stop()},a.sync=function(){var t=new o,e=this.generateRandomSequence(this.options.length);return this.sonicSocket.send(e+this.getParityLetter(e),function(){this.controller.trigger("sync:audio",{secret:e})}.bind(this)),t.promise()},a.generateRandomSequence=function(t){for(var e,i="",n="",s=0;s<t;s++){for(;e=Math.floor(Math.random()*this.alphabet.length),(n=this.alphabet[e])===i.substr(i.length-1,1););i+=n}return i},a.getParityLetter=function(t){for(var e=0,i=t.split(""),n=0;n<i.length;n++)e+=this.alphabet.indexOf(i[n]);t=e%this.alphabet.length;return i[i.length-1]===this.alphabet[t]&&(t=(t+1)%this.alphabet.length),this.alphabet[t]},a.onIncomingMessage=function(t){var e=t.substr(0,t.length-1),i=this.getParityLetter(e);i===t[t.length-1]?this.onMessage(e):console.log("Parity check failed, expected "+i+", ignoring message")},a.onMessage=function(t){this.controller.emit("sync:audio",{secret:t})},a.generateAlphabet=function(t){for(var e="",i=0;i<Math.min(t.length,9);i++)e+=i.toString();return e},r}),define("CatLab/Webremote/Controllers/Webcontrol",["CatLab/Webremote/Config","CatLab/Webremote/Collections/Users","CatLab/Webremote/Collections/Groups","CatLab/Webremote/Collections/AuthenticatedUsers","CatLab/Webremote/Models/Users/ControlUser","CatLab/Webremote/Models/ControlGroup","CatLab/Webremote/Models/State","CatLab/Webremote/Controllers/OAuth2","CatLab/Webremote/Controllers/Portal","CatLab/Webremote/Controllers/Authentication","CatLab/Webremote/Tools/Colorwheel","CatLab/Webremote/Tools/Deferred","CatLab/Webremote/Tools/Translator","CatLab/Webremote/Tools/Preloader","CatLab/Webremote/Tools/Smileys","CatLab/Webremote/Tools/Eventable","CatLab/Webremote/Tools/MessageCounter","CatLab/Webremote/Tools/Tools","CatLab/Webremote/Synchronization/RemoteViewFactory","CatLab/Webremote/Synchronization/DataSynchronizer","CatLab/Webremote/Synchronization/EventHandler","CatLab/Webremote/ViewFactory/ViewFactory","CatLab/Webremote/Views/ConnectionTrouble","CatLab/Webremote/Providers/SocketIO","CatLab/Webremote/Gamepads/GamepadAPI","CatLab/Webremote/SonicSync/Client"],function(a,t,e,i,n,s,h,o,r,l,c,u,d,f,g,p,m,A,v,b,y,w,C,k,_,T){"use strict";function I(){this.initializeEventable(),this.provider=null,this._events={},this._gamedata=null,this._userlibrary=null,this._grouplibrary=null,this._cssloads=[],this._labeldata={},this._initialized=!1,this._oauthsettings=!1,this._oauthClient=null,this._authentication=!1,this._viewCounter=null,this._lastView=null,this._options={},this._groupCallbacks={id:1},this._viewFactory=null,this.state=null,this.connected=!1,this._userlibrary=new t,this._grouplibrary=new e}p=I.prototype=new p;return Object.assign(p,{AUTH_REQUIRED_ALL:"ALL",AUTH_REQUIRED_ONE:"ONE",AUTH_REQUIRED_ONE_INACTIVE:"ONE-INACTIVE",AUTH_NOT_REQUIRED:"NONE",initialize:function(t){function e(){s.resolve(),n()}var i,n=function(){},s=(void 0!==(t=void 0===(t="function"==typeof t?{callback:t}:t)?{}:t).callback&&(n=t.callback),new u);return this._initialized?e():(this.sonicSyncClient=null,delete t.callback,t.headless,(i=!!t.headless)||void 0===t.assets||this.setAssets(t.assets),a.set(t),a.initialize(function(){null===this.provider&&(void 0===t.provider&&(t.provider=new k),this.provider=t.provider),this.smileys=new g(this.provider),void 0!==t.translator&&d.setTranslator(t.translator),this._initialize(i,e)}.bind(this))),s.promise()},disconnect:function(){this._initialized=!1,this.provider.disconnect()},_initialize:function(s,t){var o,r=new u;return(t&&r.then(t),this._initialized)?r.resolve(this.connected):(setTimeout(function(){r.resolve(!1)},3e4),this.state=new h(this),this._initialized=!0,(o=this).provider.initMaster(this),this.getProviderSettings().then(function(t){this.provider.connect("control",t).then(function(){this.connected=!0,this.provider.on("disconnect",function(){var t=this.getConnectionIssuesView();t.show(),t.text(d.t("Connection lost... reconnecting"))}.bind(this)),this.provider.on("reconnect",function(){this.recover(function(){this.getConnectionIssuesView().hide()}.bind(this))}.bind(this)),this.provider.on("master:initialize",function(t){this.log("Initializing"),this._gamedata=t,this.log("Game initialize; URL "+this.getConnectURL()+", token "+this.getConnectToken()),r.resolve(this.connected)}.bind(this)),this.provider.on("master:error",function(t){alert(t.message)}.bind(this)),this.provider.on("user:join",function(t){this._playerJoin(t)}.bind(this)),this.provider.on("user:reconnect",function(t){this._playerReconnect(t)}.bind(this)),this.provider.on("user:leave",function(t){this._playerLeave(t)}.bind(this)),this.provider.on("view:labels",function(t){this._setViewLabels(t)}.bind(this)),this.provider.on("group:create",function(t){this._onNewGroup(t)}.bind(this)),this.provider.on("user:smiley",function(t){this._playerTrigger("user:smiley",t),this._userlibrary.each(function(t){this.smileys.refreshTakenSmileys(t)}.bind(this))}.bind(this)),this.provider.on("smileys:slingshot",function(t){var e=this._userlibrary.getFromId(t.user);e?(e.trigger("smileys:slingshot",t),t.user=e,this.trigger("smileys:slingshot",t)):console.log("User not found: "+t.user)}.bind(this));for(var t=(t=(t=["user:login","user:logout","button:down","button:up","sync:audio"]).concat(b.eventsToListenFor)).concat(y.eventsToListenFor),e=0;e<t.length;e++)!function(e){o.provider.on(e,function(t){o._playerTrigger(e,t)})}(t[e]);var i=["value:change"];for(var n=0;n<i.length;n++)!function(e){o.provider.on(e,function(t){o._viewTrigger(e,t)})}(i[n]);this._oauthsettings&&this.provider.setOAuthSettings(this._oauthsettings),this.provider.setup(a.getProviderConfig()),this.preloader=new f(this.provider),!s&&a.useAudioSync()&&(this.sonicSyncClient=new T(this),this.sonicSyncClient.startSender())}.bind(this))}.bind(this))),r.promise()},setLogger:function(t){var e;"string"==typeof t?(e=document.getElementById(t),this.log=this.getDomLogger(e)):this.log=t},getProviderSettings:function(){return this.provider.getProviderSettings()},setMessageCounter:function(t){t=new m(t);return this.provider.setMessageCounter(t),t},setName:function(t){this.provider.toMaster("master:name",{name:t})},setMaxUsers:function(t){this.provider.toMaster("config:set",{maxUsers:t})},setViewFactory:function(t){return this._viewFactory=t,this._viewFactory.initialize()},getViewFactory:function(){return"undefined"===this._viewFactory&&(this._viewFactory=new w),this._viewFactory},getDomLogger:function(e){return function(t){e.innerHTML=t+"\n"+e.innerHTML}},oAuth:function(t,e){void 0===e&&(e=!1),this._authentication=!0,this._oauthsettings=t,this.provider&&!e&&this.provider.setOAuthSettings(this._oauthsettings),o.initialize(t),i.initialize(this,o)},getOAuthClient:function(t){this._oauthsettings?(null===this._oauthClient&&(this._oauthClient=o,this._oauthClient.initialize(this._oauthsettings)),t(this._oauthClient)):t(null)},getOAuthSettings:function(){return this._oauthsettings},clearEvents:function(t){if(void 0===t&&(t=!1),this._events={},t)for(var e=this._userlibrary.getAll(),i=0;i<e.length;i++)e[i].clearEvents()},getConnectURL:function(){return this.provider.getConnectURL(this._gamedata.connectURL)},getConnectToken:function(){return this.provider.getConnectToken(this._gamedata.token)},getConnectTokenForDisplay:function(){return A.getConnectTokenForDisplay(this.getConnectToken())},loadViews:function(t,e){this.provider.loadViews(t,e)},getUsers:function(){return this._userlibrary.getAll()},portal:function(t){var e,i;if(this._initialized)return i=this.getViewFactory(),e=new u,i=new r(i,this,t),e.resolve(i),{view:i.getContainer(),promise:e};throw new Error("Please initialize Webcontrol first.")},authentication:function(t,e){var i,n;if(this._initialized)return n=this.getViewFactory(),i=new u,n=new l(n,this,t,e),i.resolve(n),{view:n.getContainer(),promise:i.promise()};throw new Error("Please initialize Webcontrol first.")},getConnectionIssuesView:function(){return void 0===this.connectionTrouble&&(this.connectionTrouble=new C),this.connectionTrouble},setView:function(t,e){var i;return void 0===e?(i=v.create(t,[this],this),this._lastView=i):i=v.create(t,e,this),i},beacon:function(t,e){this.provider.toMaster("master:beacon",{beacon:t,token:e})},emit:function(t,e){this.provider.toPlayers(t,e)},getControlLabels:function(t,e){for(var i=[],n={},s=this.getUsers(),o=0;o<s.length;o++){var r=s[o].control(t).getLabel(e);void 0===n[r]&&i.push(n[r]=r)}return i},addCustomControl:function(t){this.log("adding "+t.getType()),t.setWebcontrol(this),this._userlibrary.add(t),this._initializeSmiley(t,{}),this.trigger("user:join",t)},enableGamepads:function(){_.initialize(this)},newGroup:function(t){var e=new u,i={},n=(void 0===t?t={}:"function"==typeof t&&(t={callback:t}),void 0===t.callback&&(t.callback=function(){}),!0),s=(void 0!==t.globalViews&&(n=t.globalViews),!0),o=(void 0!==t.shareColor&&(s=t.shareColor),[]),r=(void 0!==t.tags&&(o=t.tags),!0),r=(void 0!==t.smiley&&(r=!!t.smiley),i.smiley=r,this._groupCallbacks.id);return this._groupCallbacks.id++,this._groupCallbacks[r]={id:r,callback:t.callback,deferred:e,options:i},this.provider.createGroup(r,n,s,o),e.promise()},preload:function(t){return this.preloader.preload(t)},getPreloadedUrl:function(t){return this.preloader.getPreloadedUrl(t)},_reset:function(){this._userlibrary.clear(),this._grouplibrary.clear()},reset:function(){var t=new u;return this._initialized=!1,this.provider.reset(function(){t.resolve()}.bind(this)),t.promise()},_playerJoin:function(t){var e;this._userlibrary.getFromId(t.id)||((e=new n(t.id,t)).setWebcontrol(this),void 0!==t.color&&e.setColor(t.color.color,t.color.name),this._grouplibrary.addUser(e)||(this._lastView&&this._lastView.addTarget(e),this._initializeSmiley(e,t)),this._userlibrary.add(e),this.log(e),e&&this.trigger("user:join",e))},_playerReconnect:function(t){var e=this._userlibrary.getFromId(t.id);e?(e.getSmiley()&&e.emit("user:smiley",{smiley:e.getSmiley()}),this._grouplibrary.addUser(e)||this._lastView&&this._lastView.addTarget(e),e.refreshView(),this.trigger("user:rejoin",e),e.eventableTrigger("rejoined"),this.smileys.refreshTakenSmileys(e)):this._playerJoin(t)},_playerLeave:function(t){t=this._userlibrary.getFromId(t.id);t&&(this.trigger("user:leave",t),t.eventableTrigger("left"))},_onNewGroup:function(t){var e,i=new s(t.id,t),n=(i.setWebcontrol(this),!1);void 0!==t.shareColor&&(n=t.shareColor),void 0!==t.color?i.setColor(t.color.color,t.color.name):i.setShareColor(n),this._grouplibrary.getFromId(t.id)||(n=function(){},void 0!==(e=t.externalId)&&void 0!==this._groupCallbacks[e]&&(i.setOptions(this._groupCallbacks[e].options),n=function(){this._groupCallbacks[e].callback(i),this._groupCallbacks[e].deferred.resolve(i)}.bind(this)),this._grouplibrary.add(i),i.getOption("smiley")&&this._initializeSmiley(i,t),this.trigger("group:create",i),this.log("New group "+i.getId()+"; URL "+i.getConnectURL()+", token "+i.getConnectToken()),n())},_initializeSmiley:function(t,e){var i;a.useSmileys()?void 0===e.smiley?null!==(i=this.smileys.getRandom(t.getIdentifier()))&&t.setSmiley(i):t.setSmiley(e.smiley):t.clearSmiley(),this.smileys.refreshTakenSmileys(t)},_playerTrigger:function(t,e){var i=this._userlibrary.getFromId(e.user);i?i.trigger(t,e):console.log("User not found: "+e.user)},_viewTrigger:function(t,e){var i=v.getFromId(e.viewId);i&&i.trigger(t,e)},_loadCSS:function(t){for(var e=0;e<this._cssloads.length;e++)if(this._cssloads[e]==t)return;this._cssloads.push(t);var i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",t),document.body.appendChild(i)},_setViewLabels:function(t){this._labeldata[t.id]=t.labels;for(var e=this.getUsers(),i=0;i<e.length;i++)for(var n=0;n<t.labels.length;n++)e[i].control(t.id).setStaticLabel(t.labels[n].label,"mobile")},getViewLabels:function(t){return void 0!==this._labeldata[t]?this._labeldata[t]:[]},getFromIdentifier:function(t){switch(t.type){case"user":return this._userlibrary.getFromId(t.id);case"group":return this._grouplibrary.getFromId(t.id)}return null},log:function(t){a.debug()&&console.log(t)},canAuthenticate:function(){return this._authentication},pause:function(){this._initialized&&this.provider.toPlayers("master:pause",{})},unpause:function(){this._initialized&&this.provider.toPlayers("master:unpause",{})},audioSync:function(){if(this.sonicSyncClient)return this.sonicSyncClient.sync()},recover:function(t){var e=this.state.getData();this._reconnect(e.token,e.accessToken,t)},_reconnect:function(t,e,i){this.provider.reconnect(t,e,a.getProviderConfig(),i)},getIceCredentials:function(){var e=new u;return this.provider.toMaster("webrct:stun+turn",{},function(t){void 0===t.error?e.resolve(t):e.fail(t.error)}),e.promise()}}),I}),define("CatLab/Webremote/Models/Users/KeyboardUser",["CatLab/Webremote/Models/Users/ControlUser"],function(t){"use strict";function e(t){var e="keyboard"+ ++i;this.initializeKeyboardUser({id:e,keys:t})}var i=0,t=((e.prototype=Object.create(t.prototype)).constructor=e).prototype;return t.initializeKeyboardUser=function(t){this.initialize({id:t.id}),void 0===t.keys&&(t.keys=this.getDefaultKeys()),this.keys=t.keys,this.attachKeyboardEvents(),document&&document.addEventListener("fullscreenchange",this.attachKeyboardEvents.bind(this)),this.clearControls=function(){for(var t,e=0;e<this.keys.length;e++)this.control(this.keys[e].id).setStaticLabel(this.keys[e].label,"keyboard");for(t in this.controls)!this.controls.hasOwnProperty(t)||this.controls[t].isGlobal||this.controls[t].clear()},this.on("view:set",function(t){this.clearControls()}.bind(this)),this.getType=function(){return"keyboard"},this.getIcon=function(){return"fa fa-keyboard-o"},this.emit=function(t,e){return!1},this.isLocalAuthentication=function(){return!1},this.clearControls()},t.getAvailableControls=function(){for(var t=[],e=0;e<this.keys.length;e++)t.push(this.keys[e].id);return t},t.getDefaultKeys=function(){return[{id:"up",label:"↑",code:"ArrowUp"},{id:"down",label:"↓",code:"ArrowDown"},{id:"right",label:"→",code:"ArrowRight"},{id:"left",label:"←",code:"ArrowLeft"},{id:"a",label:"A",code:["KeyA","Enter","NumpadEnter"]},{id:"b",label:"B",code:"KeyB"},{id:"x",label:"X",code:"KeyX"},{id:"y",label:"Y",code:"KeyY"},{id:"back",label:"Escape",code:"Escape"},{id:"start",label:"S",code:["KeyS"]}]},t.hasControl=function(t){return-1!==this.getAvailableControls().indexOf(t)},t.hasDisplay=function(){return!1},t.hasKeyboardInput=function(){return!0},t.hasTouchInput=function(){return!0},t.attachKeyboardEvents=function(){try{window.document.removeEventListener("keydown",this._keyDown),window.document.removeEventListener("keyup",this._keyUp),window.removeEventListener("message",this._onMessage),window.parent&&window.parent.document&&window.parent.document.removeEventListener("keyup",this._keyUp)}catch(t){}try{var t=window.document;if(!document.fullscreenElement&&window.parent&&!(t=window.parent.document))throw new Error("Unaccessible");t.addEventListener("keydown",this._keyDown.bind(this)),t.addEventListener("keyup",this._keyUp.bind(this))}catch(t){try{window.addEventListener("message",this._onMessage.bind(this),!1)}catch(t){console.error(t)}}},t.getConfigFromKey=function(t){for(var e=0;e<this.keys.length;e++){if(void 0!==this.keys[e].code&&this._keyMatches(this.keys[e].code,t.code))return this.keys[e];if(void 0!==this.keys[e].key&&this._keyMatches(this.keys[e].key,t.key))return this.keys[e];if(void 0!==this.keys[e].keyCode&&this._keyMatches(this.keys[e].keyCode,t.keyCode))return this.keys[e]}return null},t._keyMatches=function(t,e){return!!(Array.isArray(t)&&-1<t.indexOf(e))||t==e},t._onMessage=function(t){var e=t.data;if("object"==typeof e&&void 0!==e.type&&"catlab:keyboard"===e.type&&void 0!==e.code&&void 0!==e.action)switch(e.action){case"down":return void this._keyDown(t.data);case"up":return void this._keyUp(t.data)}},t._keyDown=function(t){var e=this.getConfigFromKey(t);e&&(this.control(e.id).update(1),void 0!==e.preventDefault)&&e.preventDefault&&t.preventDefault()},t._keyUp=function(t){var e=this.getConfigFromKey(t);e&&(this.control(e.id).update(0),void 0!==e.preventDefault)&&e.preventDefault&&t.preventDefault()},e}),define("CatLab/Webremote/Models/Users/CordovaUser",["CatLab/Webremote/Models/Users/KeyboardUser"],function(t){function e(t){this.initializeKeyboardUser({id:"cordova",keys:t});var i=new Date;document.addEventListener("backbutton",function(t){var e=new Date;e.getTime()-i.getTime()<500?navigator.app.exitApp():(i=e,t.preventDefault(),this.control("back").update(1),setTimeout(function(){this.control("back").update(0)}.bind(this),1))}.bind(this),!1)}t=((e.prototype=Object.create(t.prototype)).constructor=e).prototype;return t.getDefaultKeys=function(){return[{id:"up",label:"↑",key:38},{id:"down",label:"↓",key:40},{id:"right",label:"→",key:39},{id:"left",label:"←",key:37},{id:"start",label:"ENTER",key:13},{id:"back",label:"BACK",key:null}]},t.hasDisplay=function(){return!1},t.hasKeyboardInput=function(){return!0},t.hasTouchInput=function(){return!0},e}),define("CatLab/Webremote/Models/Users/AndroidRemoteUser",["CatLab/Webremote/Models/Users/KeyboardUser"],function(t){function e(t){this.initializeKeyboardUser({id:"cordova",keys:t});var i=new Date;document.addEventListener("backbutton",function(t){var e=new Date;e.getTime()-i.getTime()<500?navigator.app.exitApp():(i=e,t.preventDefault(),this.control("back").update(1),setTimeout(function(){this.control("back").update(0)}.bind(this),1))}.bind(this),!1)}t=((e.prototype=Object.create(t.prototype)).constructor=e).prototype;return t.getDefaultKeys=function(){return[{id:"up",label:"↑",keyCode:38,preventDefault:!0},{id:"down",label:"↓",keyCode:40,preventDefault:!0},{id:"right",label:"→",keyCode:39,preventDefault:!0},{id:"left",label:"←",keyCode:37,preventDefault:!0},{id:"a",label:"ENTER",keyCode:13,preventDefault:!0},{id:"back",label:"BACK",keyCode:null},{id:"start",label:"⏯",keyCode:179},{id:"fastforward",label:"⏩",keyCode:228},{id:"fastforward",label:"⏪",keyCode:227}]},t.getPortalControls=function(){return{start:"start",back:"back",toggleActive:"up",authenticate:"menu",left:"left",right:"right"}},t.hasDisplay=function(){return!1},t.hasKeyboardInput=function(){return!1},t.hasTouchInput=function(){return!1},this.getType=function(){return"android-keyboard"},e}),define("CatLab/Webremote/Models/Users/DummyUser",["CatLab/Webremote/Models/Users/ControlUser"],function(t){function e(t){this.initialize({id:t}),this.clearControls=function(){},this.getType=function(){return"dummy"},this.getIcon=function(){return"fa fa-keyboard-o"},this.emit=function(t,e){return!1},this.isLocalAuthentication=function(){return!1},this.log=function(t){console.log(t)},this.hasDisplay=function(){return!1},this.hasKeyboardInput=function(){return!0},this.hasTouchInput=function(){return!0},this.clearControls()}return(e.prototype=Object.create(t.prototype)).constructor=e}),define("CatLab/Webremote/Tools/ParseXML",[],function(){function t(){}var e=null;"undefined"!=typeof window&&(void 0!==window.DOMParser?e=function(t){return(new window.DOMParser).parseFromString(t,"text/xml")}:void 0!==window.ActiveXObject&&new window.ActiveXObject("Microsoft.XMLDOM")&&(e=function(t){var e=new window.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}));return t.prototype.parse=function(t){if(e)return e(t);throw new Error("No XML parser found")},new t}),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(t,e,i,n,s,o,r){function a(t){t&&(this.airconsole=t),this.showTokenForm=!1,this.oauth={},this.views=[],this.knownUsers={},this.started=!1,this.userId=null,this.sendBurstDelay=50,this.connectCode=null}t=a.prototype=new t;return t.connect=function(t){return this.log("Airconsole connecting"),this.setInitialized(),this.path=t,this._trigger("connect",null),this.readyState.promise()},t.noTokenConnect=function(){return this.connect("remote")},t.setUserId=function(t){return this.userId=t,this},t.initMaster=function(t){this.master=t,this.airconsole||(this.airconsole=new AirConsole),this.airconsole.onMessage=this.onMessage.bind(this),this.airconsole.onConnect=function(t){this.emitAirConsole(t,"airconsole:well-hello-there",{user:t})}.bind(this),this.readyState=new i,this.airconsole.onReady=function(t){this.connectCode=t,this.readyState.resolve()}.bind(this),this.airconsole.onDeviceProfileChange=function(t){this.updateDeviceProfile(t)}.bind(this),this.on("player:join",function(t){this.onPlayerConnect(t.user)}.bind(this)),this.once("connect",function(){setTimeout(function(){this.started=!0}.bind(this),1)}.bind(this))},t.initPlayer=function(t){this.master=t,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(t){this.emitAirConsole(0,"player:join",{})}.bind(this))},t.onMessage=function(e,t){var i;void 0!==(t="string"==typeof t?JSON.parse(t):t).b&&Array.isArray(t.b)?(i=0,t.b.forEach(function(t){setTimeout(function(){this.processMessage(e,t)}.bind(this),i++)}.bind(this))):this.processMessage(e,t)},t.processMessage=function(t,e){var i;e&&e[0]&&(i=e[0],e=e[1],this.isMaster()&&(0<t&&"player:join"!==i&&void 0===this.knownUsers[t]&&this.onPlayerConnect(t),0<t)&&(e.user=t),o.unpack(e,"user").forEach(function(t){this.isRemote()&&void 0!==t.user&&t.user!==this.airconsole.getDeviceId()||this._trigger(i,t)}.bind(this)))},t.onPlayerConnect=function(t){this.log("Welcoming our newest player "+t),this.knownUsers[t]=!0;for(var e=0;e<this.views.length;e++)this.emitAirConsole(t,"view:load",{xml:this.views[e]}),this.emitAirConsole(t,"view:set",{id:"loading"});this._trigger("user:join",{id:t}),this.updateDeviceProfile(t)},t.updateDeviceProfile=function(t){var e,i,n=this.master._userlibrary.getFromId(t);n&&(e={username:this.airconsole.getNickname(t)},(i=this.airconsole.getProfilePicture(t))&&(e.avatar=i),this.airconsole.getMasterControllerDeviceId()===t&&n.setMaster(!0),n.setProfiledata(e))},t.emitAll=function(){this.isMaster()&&this.emitMaster(),this.isRemote()&&this.emitClient()},t.isMaster=function(){return"control"===this.path},t.isRemote=function(){return"remote"===this.path},t.emitClient=function(){this.queue.flush().forEach(function(t){this.emitAirConsole(0,t.action,t.data)}.bind(this))},t.emitMaster=function(){var e,i,t=this.queue.compactFlush();t.length&&(e=5<t.length,i=[],t.forEach(function(t){e||void 0===t.data.user||Array.isArray(t.data.user)&&1<t.data.user.length?i.push(t):this.emitAirConsole(t.user,t.action,t.data)}.bind(this)),0<i.length)&&this.broadcastAirconsole(i)},t.emitAirConsole=function(t,e,i){e=[e,i],delete e[1].action,i=JSON.stringify(e);this.airconsole.message(t,i)},t.broadcastAirconsole=function(t){var e=[],t=(t.forEach(function(t){e.push([t.action,t.data])}),JSON.stringify({b:e}));this.airconsole.broadcast(t)},t.setOAuthSettings=function(t){this.oauth=t,this.toPlayers("oauth:set",t)},t.loadViews=function(t){n.get(t).then(function(t){this.views.push(t),this.toPlayers("view:load",{xml:t})}.bind(this))},t.log=function(){this.master.log.apply(arguments)},t.setup=function(t){this._trigger("master:initialize",{})},t.toMaster=function(t,e){e.user=0,this.emit(t,e)},t.log=function(t){var e=[],i=(Array.prototype.push.apply(e,arguments),"["+this.path+"]");"remote"===this.path&&(i="["+this.path+":"+this.airconsole.getDeviceId()+"]"),e.unshift(i),console.log.apply(console,e)},t.getConnectInstructions=function(){return["Open the Airconsole app on your smartphone and connect with code %s.",this.connectCode]},t.getStartAndLoginInstructions=function(){return["Use the onscreen button to start the game."]},a}),define("CatLab/Webremote/CreateJS/LayerContainer",["easeljs","easelbone"],function(n,s){"use strict";function t(t,e){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=t,this.height=e,this.initialize(),this.easelboneLayer=new s.Views.Layer({container:this});var i=this;this.easelboneLayer.on("all",function(t){t=new n.Event(t);i.dispatchEvent(t)})}var e=t.prototype=new n.Container;return e.Container_initialize=e.initialize,e.initialize=function(){this.Container_initialize(),this.setBounds(0,0,this.width,this.height),this.on("click",function(t){t.stopPropagation()})},e.loading=function(){},e.render=function(){this.easelboneLayer.render()},t}),define("CatLab/Webremote/CreateJS/Views/PortalView",["easeljs","easelbone","CatLab/Webremote/Tools/Translator"],function(t,n,i){"use strict";return n.Views.Navigatable.extend({initialize:function(t){this.initializeNavigatable({orientation:this.ORIENTATION.HORIZONTAL});var e=this;this.assets=t.assets,t.showInactivePlayers?this.setScreen(new t.assets.PortalView):this.setScreen(new t.assets.PortalViewNoInactive),this.showInactivePlayers=t.showInactivePlayers||!1,this.portalController=t.controller,this.showInactivePlayers&&(this.connectedUsersContainer=new n.EaselJS.Placeholder(this.getScreen().connectedUsers),this.connectedUsers=new n.Controls.FloatContainer(function(t){return e.getUserIcon(t)},6),this.connectedUsersContainer.addChild(this.connectedUsers)),this.activeUsersContainer=new n.EaselJS.Placeholder(this.getScreen().activeUsers),this.activeUsers=new n.Controls.FloatContainer(function(t){return e.getUserIcon(t)},t.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(){e.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(){e.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(t){t.addChild(new n.EaselJS.BigText(i.t("Instructions")))}),this.findPlaceholders("activePlayersHeader").forEach(function(t){t.addChild(new n.EaselJS.BigText(i.t("Active devices")))}),this.findPlaceholders("connectedPlayersHeader").forEach(function(t){t.addChild(new n.EaselJS.BigText(i.t("Connected devices")))}),this.instructionTexts=[],this.findPlaceholders("instructionText").forEach(function(t){var e=new n.EaselJS.BigText(this.getInstructionText());this.instructionTexts.push(e),t.addChild(e)}.bind(this)),this.activePlayerTexts=[],this.findPlaceholders("activePlayers").forEach(function(t){var e=new n.EaselJS.BigText(this.getActiveUsersText());this.activePlayerTexts.push(e),t.addChild(e)}.bind(this))},getActiveUsersText:function(){return this.portalController.countActiveUsers()+"/"+this.portalController.options.maxPlayers},getInstructionText:function(){return this.portalController.getConnectInstructions()+"\n"+this.portalController.getStartAndLoginInstructions()},getUserIcon:function(t){var e,i;return t?t.hasUser()?(e=new this.assets.UserIconAuthenticated,this.addControllerIcon(e,t)):e=this.getControllerIcon(t):e=this.getControllerIcon(),t&&(i=e.PlayerColor)&&new n.EaselJS.Placeholder(i).addChild(new n.EaselJS.Fill(t.getColor())),t&&this.setUserDetails(e,t),e},addControllerIcon:function(t,e){var i;t.ControllerIcon&&(t=new n.EaselJS.Placeholder(t.ControllerIcon),i=this.getControllerIcon(e),t.addChild(i),i.scaleX=i.scaleY=.5,e)&&(t=i.PlayerColor)&&new n.EaselJS.Placeholder(t).addChild(new n.EaselJS.Fill(e.getColor()))},getControllerIcon:function(t){if(t)switch(t.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(t){alert(t)},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(t){t.setText(this.portalController.countActiveUsers()+"/"+this.portalController.options.maxPlayers)}.bind(this)),this.getScreen().login&&(this.getScreen().login.text=this.portalController.getStartAndLoginInstructions())},showInformation:function(){var t=this.portalController.getConnectInstructions();this.getScreen().login?this.getScreen().login.text=this.portalController.getStartAndLoginInstructions():t+="\n "+this.portalController.getStartAndLoginInstructions(),this.getScreen().token&&(this.getScreen().token.text=t),this.instructionTexts.forEach(function(t){t.setText(this.getInstructionText())}.bind(this))},removeAllUserIcons:function(){this.showInactivePlayers&&this.connectedUsers.removeAllChildren(),this.activeUsers.removeAllChildren()},reloadUserIcons:function(t){var e=24,i=24;this.showInactivePlayers||(i=48),this.removeAllUserIcons(),t.forEach(function(t){t.isActive()?i<=0||(i--,this.activeUsers.createElement(t)):!this.showInactivePlayers||e<=0||(e--,this.connectedUsers.createElement(t))}.bind(this))},setUserDetails:function(t,e){var i;e.hasUser()&&t.userimage&&(i=new n.EaselJS.Placeholder(t.userimage),e.getUser().getImage(function(t){i.addChild(new n.EaselJS.Fill(t))}))},addAuthenticationView:function(t){this.el.addChild(t);var e=this;t.on("view:close",function(){e.el.removeChild(t)})},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(t){var e=this,t=(this.assets=t.assets,this.screen=new t.assets.Signin,this.controller=t.controller,this.screen.close.on("click",function(){e.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(t){this.titlePlaceholder=new s.EaselJS.Placeholder(t)}.bind(this)),s.Helpers.MovieClipHelper.findFromNames(["explanation"],[this.screen]).forEach(function(t){this.explanationPlaceholder=new s.EaselJS.Placeholder(t)}.bind(this)),this.titlePlaceholder&&(t=new s.EaselJS.BigText(i.t("Select your profile"),null,null,"left"),this.titlePlaceholder.addChild(t)),this.setLoginUrlText(),this.linkAccount.on("click",function(){e.controller.link()}),new s.Controls.ScrollArea(this.screen.accounts));this.users=new s.Controls.FloatContainer(function(t){return e.getUserObject(t)},4),t.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 t=this.controller.getUsers().getAll();this.users.removeAllChildren();for(var e=0;e<t.length;e++)this.users.createElement(t[e])},getUserObject:function(t){var e,i=this,n=new this.assets.UserModel;return t&&(n.namePlaceholder?new s.EaselJS.Placeholder(n.namePlaceholder).addChild(new s.EaselJS.BigText(t.getName())):n.name&&(n.name.text=t.getName()),e=new s.EaselJS.Placeholder(n.picture),t.getImage(function(t){e.addChild(new s.EaselJS.Fill(t))}),n.on("click",function(){i.controller.selectUser(t)})),n},close:function(){this.trigger("close")},render:function(){this.el.addChild(this.screen)},setLoginUrl:function(t){this.loginUrl=t,this.setLoginUrlText()},setLoginUrlText:function(){var t;this.linkAccount&&(this.linkAccount.setText(i.t("Login to add profile")),this.explanationPlaceholder)&&(t=new s.EaselJS.BigText(i.t("Or surf to %s to login from your phone.",this.loginUrl)),this.explanationPlaceholder.removeAllChildren(),this.explanationPlaceholder.addChild(t))}})}),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(t){return function(){return t.ctlbrmtassets}}(this)),define("CatLab/Webremote/ViewFactory/CreatejsViewFactory",["CatLab/Webremote/Tools/Deferred"],function(e){"use strict";function t(t){void 0!==t&&this.setAssets(t)}var o,r,a,i=t.prototype;return i.initialize=function(){var t=new e;return this.loadAssets().then(function(){this.setAssets(this.assets),t.resolve()}.bind(this)),t},i.loadAssets=function(){var s=new e;return require(["CatLab/Webremote/CreateJS/LayerContainer","CatLab/Webremote/CreateJS/Views/PortalView","CatLab/Webremote/CreateJS/Views/AuthenticationView","CatLab/Webremote/assets/createjsassets"],function(t,e,i,n){o=t,r=e,a=i,s.resolve()}.bind(this)),s.promise()},i.portal=function(t){return t.assets=this.assets,new r(t)},i.authentication=function(t){return t.assets=this.assets,new a(t)},i.setAssets=function(t){void 0!==t&&(this.assets=t)},i.getContainer=function(){var t=new o;return t.setBounds(0,0,this.assets.properties.width,this.assets.properties.height),t.loading(),t},t}),define("CatLab/Webremote/FrontWebcontrol",["CatLab/Webremote/Config","CatLab/Webremote/Polyfills","CatLab/Webremote/Tools/Tracker","CatLab/Webremote/Tools/Tools","CatLab/Webremote/Controllers/OAuth2","CatLab/Webremote/Controllers/Webcontrol","CatLab/Webremote/Tools/Smileys","CatLab/Webremote/Models/Users/KeyboardUser","CatLab/Webremote/Models/Users/CordovaUser","CatLab/Webremote/Models/Users/AndroidRemoteUser","CatLab/Webremote/Models/Users/DummyUser","CatLab/Webremote/Providers/SocketIO","CatLab/Webremote/Providers/Airconsole","CatLab/Webremote/ViewFactory/ViewFactory","CatLab/Webremote/ViewFactory/CreatejsViewFactory"],function(e,t,i,n,s,o,r,a,h,l,c,u,d,f,g){return{Config:function(t){e.set(t)},Tracker:i,Tools:n,Webcontrol:new o,OAuth2:s,Controls:{Keyboard:a,Cordova:h,AndroidRemote:l,Dummy:c},Controllers:{Webcontrol:o},Models:{User:c},Providers:{SocketIO:u,Airconsole:d},ViewFactories:{HtmlViewFactory:f,CreatejsViewFactory:g},Smileys:r}}),define("webcontrol",["CatLab/Webremote/FrontWebcontrol"],function(t){return t}),define("CatLab/EaselHacks/AlphaMaskFilter",[],function(t){function e(t){var n=this;this.createjs=t,Object.defineProperty(t.DisplayObject.prototype,"mask",{get:function(){return this.forceMask},set:function(t){var e,i=this;t?(i.originalMask=t,e=n.getFilterFromMask(t,i),i.filters=[e],i.cache(0,0,500,500)):null!==t&&(i.filters=null,i.cache(0,0,500,500))}}),t.DisplayObject.prototype.setMask=function(t){this.forceMask=t}}return e.prototype.getFilterFromMask=function(t,e){var i=this.createjs,n=t.graphics.getInstructions(),s=new i.Graphics;s.beginFill("#000000"),s.beginStroke("#000000");for(var o=0;o<n.length;o++)s.append(n[o]);t.graphics=s;var r=new i.Container,t=(r.addChild(t),r.scaleX=1/e.scaleX,r.scaleY=1/e.scaleY,r.y=-e.y,r.x=-e.x,new i.Container);return t.addChild(r),t.cache(0,0,1e3,1e3),new i.AlphaMaskFilter(t.cacheCanvas)},e}),define("CatLab/EaselHacks/FrontController",["CatLab/EaselHacks/AlphaMaskFilter"],function(t){return{AlphaMaskFilter:t}}),define("easelhacks",["CatLab/EaselHacks/FrontController"],function(t){return t}),define("CatLab/Webremote/Hacks",["easelhacks","easeljs"],function(t,e){new t.AlphaMaskFilter(e)});
|