var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,g,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");b!=Array.prototype&&b!=Object.prototype&&(b[g]=c.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(b,g,c,d){if(g){c=$jscomp.global;b=b.split(".");for(d=0;d<b.length-1;d++){var a=b[d];a in c||(c[a]={});c=c[a]}b=b[b.length-1];d=c[b];g=g(d);g!=d&&null!=g&&$jscomp.defineProperty(c,b,{configurable:!0,writable:!0,value:g})}};$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;
$jscomp.Symbol=function(b){return $jscomp.SYMBOL_PREFIX+(b||"")+$jscomp.symbolCounter_++};$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.iterator;b||(b=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[b]&&$jscomp.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};
$jscomp.arrayIterator=function(b){var g=0;return $jscomp.iteratorPrototype(function(){return g<b.length?{done:!1,value:b[g++]}:{done:!0}})};$jscomp.iteratorPrototype=function(b){$jscomp.initSymbolIterator();b={next:b};b[$jscomp.global.Symbol.iterator]=function(){return this};return b};$jscomp.array=$jscomp.array||{};
$jscomp.iteratorFromArray=function(b,g){$jscomp.initSymbolIterator();b instanceof String&&(b+="");var c=0,d={next:function(){if(c<b.length){var a=c++;return{value:g(a,b[a]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d};$jscomp.polyfill("Array.prototype.entries",function(b){return b?b:function(){return $jscomp.iteratorFromArray(this,function(g,c){return[g,c]})}},"es6-impl","es3");
$jscomp.polyfill("Math.trunc",function(b){return b?b:function(g){g=Number(g);if(isNaN(g)||Infinity===g||-Infinity===g||0===g)return g;var c=Math.floor(Math.abs(g));return 0>g?-c:c}},"es6-impl","es3");"undefined"==typeof _pio&&(_pio={});
(function(){_pio.channel=function(){};_pio.channel.prototype.call=function(b,g,c,d,a){var e="undefined"!=typeof PLAYERIO_API_HOST?PLAYERIO_API_HOST:(PlayerIO.useSecureApiRequests?"https":"http")+"://api.playerio.com/json/",f=new XMLHttpRequest;"withCredentials"in f?f.open("post",e,!0):"undefined"!=typeof XDomainRequest?(f=new XDomainRequest,f.open("post",e)):f=new _pio.flashWebRequest("post",e);var h=Error();null!=f?(f.send("["+b+"|"+(this.token||"")+"]"+JSON.stringify(g)),f.onload=function(){var e=
null;try{var g=f.response||f.responseText;if("["==g[0]){var b=g.indexOf("]");this.token=g.substring(1,b);g=g.substring(b+1)}e=JSON.parse(g)}catch(t){_pio.handleError(h,d,PlayerIOErrorCode.GeneralError,"Error decoding response from webservice: "+t);return}if("undefined"==typeof e.errorcode&&"undefined"==typeof e.message){g=e;if(a)try{g=a(e)}catch(t){_pio.handleError(h,d,PlayerIOErrorCode.GeneralError,t.message)}c&&c(g)}else _pio.handleError(h,d,e.errorcode,e.message)},f.onerror=function(a){_pio.handleError(h,
d,PlayerIOErrorCode.GeneralError,"Error talking to webservice: "+JSON.stringify(a))}):_pio.handleError(h,d,PlayerIOErrorCode.GeneralError,"Need to implement flash calling")};_pio.runCallback=function(b,g,c){try{b&&b(g)}catch(d){b="Unhandled error in callback: "+d.message,b=b+"\nStack:\n"+(d.stack||d.stacktrace||d.StackTrace),c&&(b=b+"\nCallsite stack:\n"+(c.stack||c.stacktrace||c.StackTrace)),console.log(b)}};_pio.handleError=function(b,g,c,d){c=_pio.error(c,d);b&&(b.stack&&(c.stack=b.stack),b.stacktrace&&
(c.stacktrace=b.stacktrace),b.StackTrace&&(c.StackTrace=b.StackTrace));g?_pio.runCallback(g,c,b):"undefined"!=typeof console?console.log("No error callback specified for: "+c.code+": "+c.message+"\n"+(c.stack||c.stacktrace||c.StackTrace)):alert("No error callback specified for: "+c.code+": "+c.message+"\n"+(c.stack||c.stacktrace||c.StackTrace))};_pio.error=function(b,g){1==arguments.length&&(g=b,b=PlayerIOErrorCode.GeneralError);"number"==typeof b&&(b=PlayerIOErrorCode.codes[b]);if("string"!=typeof b)throw console.log(b,
g,Error().stack),"Code must be a string!";var c=Error();return new PlayerIOError(b,g,c.stack||c.stacktrace||c.StackTrace)};_pio.debugLog=function(b){"undefined"!=typeof console&&console.log(b)};_pio.convertToKVArray=function(b){var g=[];if(b)for(var c in b)g.push({key:""+c,value:""+b[c]});return g};_pio.convertFromKVArray=function(b){var g={};if(b&&b.length)for(var c in b)g[b[c].key]=b[c].value;return g};_pio.convertToSegmentArray=function(b){var g=[];if(b)for(var c in b)g.push(c+":"+b[c]);return g}})();
PlayerIO={useSecureApiRequests:!1,authenticate:function(b,g,c,d,a,e){if("auto"==c.publishingnetworklogin)"undefined"==typeof window.PublishingNetwork?e(new PlayerIOError(PlayerIOErrorCode.GeneralError,"Could not find the PublishingNetwork object on the current page. Did you include the PublishingNetwork.js script?")):PublishingNetwork.dialog("login",{gameId:b,connectionId:g,__use_usertoken__:!0},function(c){c.error?e(new PlayerIOError(PlayerIOErrorCode.GeneralError,c.error)):"undefined"==typeof c.userToken?
e(new PlayerIOError(PlayerIOErrorCode.GeneralError,"Missing userToken value in result, but no error message given.")):PlayerIO.authenticate(b,g,{userToken:c.userToken},d,a,e)});else{var f=new _pio.channel;f.authenticate(b,g,_pio.convertToKVArray(c),_pio.convertToSegmentArray(d),"javascript",_pio.convertToKVArray({}),null,a,e,function(a){f.token=a.token;return new _pio.client(f,b,a.gamefsredirectmap,a.userid)})}},quickConnect:null,gameFS:function(b){return new _pio.gameFS(b)}};var JSON;
JSON||(JSON={});
(function(){function b(a){return 10>a?"0"+a:a}function g(c){a.lastIndex=0;return a.test(c)?'"'+c.replace(a,function(a){var c=h[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+c+'"'}function c(a,d){var b,h,k,m,v=e,r,n=d[a];n&&"object"===typeof n&&"function"===typeof n.toJSON&&(n=n.toJSON(a));"function"===typeof l&&(n=l.call(d,a,n));switch(typeof n){case "string":return g(n);case "number":return isFinite(n)?String(n):"null";case "boolean":case "null":return String(n);case "object":if(!n)return"null";
e+=f;r=[];if("[object Array]"===Object.prototype.toString.apply(n)){m=n.length;for(b=0;b<m;b+=1)r[b]=c(b,n)||"null";k=0===r.length?"[]":e?"[\n"+e+r.join(",\n"+e)+"\n"+v+"]":"["+r.join(",")+"]";e=v;return k}if(l&&"object"===typeof l)for(m=l.length,b=0;b<m;b+=1)"string"===typeof l[b]&&(h=l[b],(k=c(h,n))&&r.push(g(h)+(e?": ":":")+k));else for(h in n)Object.prototype.hasOwnProperty.call(n,h)&&(k=c(h,n))&&r.push(g(h)+(e?": ":":")+k);k=0===r.length?"{}":e?"{\n"+e+r.join(",\n"+e)+"\n"+v+"}":"{"+r.join(",")+
"}";e=v;return k}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+b(this.getUTCMonth()+1)+"-"+b(this.getUTCDate())+"T"+b(this.getUTCHours())+":"+b(this.getUTCMinutes())+":"+b(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var d=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
a=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e,f,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},l;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,d,b){var g;f=e="";if("number"===typeof b)for(g=0;g<b;g+=1)f+=" ";else"string"===typeof b&&(f=b);if((l=d)&&"function"!==typeof d&&("object"!==typeof d||"number"!==typeof d.length))throw Error("JSON.stringify");return c("",{"":a})});
"function"!==typeof JSON.parse&&(JSON.parse=function(a,c){function e(a,d){var f,b,g=a[d];if(g&&"object"===typeof g)for(f in g)Object.prototype.hasOwnProperty.call(g,f)&&(b=e(g,f),void 0!==b?g[f]=b:delete g[f]);return c.call(a,d,g)}var f;a=String(a);d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return f=eval("("+a+")"),"function"===typeof c?e({"":f},""):f;throw new SyntaxError("JSON.parse");})})();
(function(){function b(c){if(null!=a)c(a);else if(e)c(null);else if(null==f){f=[c];var d=setInterval(function(){var a=g();null!=a&&b(a)},50);setTimeout(function(){null==a&&b(null)},3E4);var b=function(c){a=c;e=null==c;clearInterval(d);for(var b=0;b!=f.length;b++)f[b](c)}}else f.push(c)}function g(){var a;a='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="10" height="10" style="$style$" id="$id$">\t<param name="movie" value="$src$" />\t<param name="allowNetworking" value="all" />\t<param name="allowScriptAccess" value="always" />\t\x3c!--[if !IE]>--\x3e\t<object type="application/x-shockwave-flash" data="$src$" width="10" height="10" style="$style$">\t\t<param name="allowNetworking" value="all" />\t\t<param name="allowScriptAccess" value="always" />\t</object>\t\x3c!--<![endif]--\x3e</object>'.replace(/\$id\$/gi,"__pio_flashfallback__");
a=a.replace(/\$src\$/gi,"http://192.168.30.154/html5client/FlashFallback/bin-debug/FlashFallback.swf");a=a.replace(/\$style\$/gi,"width:10px;height:10px");var c=document.getElementById("containerId");if(!c){var e=document.createElement("div");e.setAttribute("id",c);e.setAttribute("style","position:absolute;top:-20px;left:-20px");e.innerHTML=a;try{document.body.appendChild(e)}catch(m){}}a=function(a){a=document.getElementsByTagName(a);for(var c=0;c!=a.length;c++)if(a[c].ping&&"pong"==a[c].ping())return a[c]};
return a("embed")||a("object")}var c={},d=0;__pio_flashfallback_callback__=function(){var a=c[arguments[0]];if(a){for(var e=[],d=1;d!=arguments.length;d++)e[d-1]=arguments[d];a.apply(null,e)}};_pio.flashWebRequest=function(a,e){var f=this;this.response=null;this.onload=function(){};this.onerror=function(){};this.send=function(g){b(function(b){if(null==b)f.onerror("Browser does not support Cross-Origin (CORS) webrequest or Flash as a fallback method");else{var h="cb"+d++;c[h]=function(a,e){delete c[h];
if(a)f.response=e,f.onload();else f.onerror(e)};b.webrequest(h,a,e,g)}})}};_pio.flashSocketConnection=function(a,e,f,g,t){var h="cb"+d++,k=this,l=new _pio.messageSerializer,m=!1,r=!1,n=setTimeout(function(){m||(m=!0,f(!1,"Connect attempt timed out"))},e);this.disconnect=function(){console.log("... this shouldn't happen")};this.sendMessage=function(a){console.log("... send msg. this shouldn't happen")};b(function(e){null==e?(m=!0,f(!1,"Browser does not support WebSocket connections and the Flash fallback failed.")):
(c[h]=function(a,c){switch(a){case "onopen":m||(clearTimeout(n),r=m=!0,e.socketSend(h,[0]),f(r));break;case "onclose":k.disconnect();break;case "onerror":k.disconnect();break;case "onmessage":t(l.deserializeMessage(c,0,c.length))}},k.disconnect=function(){if(r){r=!1;g();try{e.socketClose(h)}catch(w){_pio.debugLog(w)}}},k.sendMessage=function(a){a=l.serializeMessage(a);e.socketSend(h,a)},e.socketConnection(h,a))})};_pio.isFlashFallbackEnabled=function(a){b(function(c){a(null!=c)})};var a=null,e=!1,
f=null})();
(function(){var b=_pio.channel.prototype;b.connect=function(b,c,d,a,e,f,h,l,k,m,t){this.call(10,{gameid:b,connectionid:c,userid:d,auth:a,partnerid:e,playerinsightsegments:f,clientapi:h,clientinfo:l},k,m,t)};_pio.ApiSecurityRule={RespectClientSetting:0,UseHttp:1,UseHttps:2};b.authenticate=function(b,c,d,a,e,f,h,l,k,m){this.call(13,{gameid:b,connectionid:c,authenticationarguments:d,playerinsightsegments:a,clientapi:e,clientinfo:f,playcodes:h},l,k,m)};b.createRoom=function(b,c,d,a,e,f,h,l){this.call(21,{roomid:b,
roomtype:c,visible:d,roomdata:a,isdevroom:e},f,h,l)};b.joinRoom=function(b,c,d,a,e,f,h){this.call(24,{roomid:b,joindata:c,isdevroom:d,serverdomainnameneeded:a},e,f,h)};b.createJoinRoom=function(b,c,d,a,e,f,h,l,k,m){this.call(27,{roomid:b,roomtype:c,visible:d,roomdata:a,joindata:e,isdevroom:f,serverdomainnameneeded:h},l,k,m)};b.listRooms=function(b,c,d,a,e,f,h,l){this.call(30,{roomtype:b,searchcriteria:c,resultlimit:d,resultoffset:a,onlydevrooms:e},f,h,l)};b.userLeftRoom=function(b,c,d,a,e,f){this.call(40,
{extendedroomid:b,newplayercount:c,closed:d},a,e,f)};b.writeError=function(b,c,d,a,e,f,h,l){this.call(50,{source:b,error:c,details:d,stacktrace:a,extradata:e},f,h,l)};b.updateRoom=function(b,c,d,a,e,f){this.call(53,{extendedroomid:b,visible:c,roomdata:d},a,e,f)};_pio.ValueType={String:0,Int:1,UInt:2,Long:3,Bool:4,Float:5,Double:6,ByteArray:7,DateTime:8,Array:9,Obj:10};b.createObjects=function(b,c,d,a,e){this.call(82,{objects:b,loadexisting:c},d,a,e)};b.loadObjects=function(b,c,d,a){this.call(85,{objectids:b},
c,d,a)};_pio.LockType={NoLocks:0,LockIndividual:1,LockAll:2};b.saveObjectChanges=function(b,c,d,a,e,f){this.call(88,{locktype:b,changesets:c,createifmissing:d},a,e,f)};b.deleteObjects=function(b,c,d,a){this.call(91,{objectids:b},c,d,a)};b.loadMatchingObjects=function(b,c,d,a,e,f,h){this.call(94,{table:b,index:c,indexvalue:d,limit:a},e,f,h)};b.loadIndexRange=function(b,c,d,a,e,f,h,l){this.call(97,{table:b,index:c,startindexvalue:d,stopindexvalue:a,limit:e},f,h,l)};b.deleteIndexRange=function(b,c,d,
a,e,f,h){this.call(100,{table:b,index:c,startindexvalue:d,stopindexvalue:a},e,f,h)};b.loadMyPlayerObject=function(b,c,d){this.call(103,{},b,c,d)};b.payVaultReadHistory=function(b,c,d,a,e,f){this.call(160,{page:b,pagesize:c,targetuserid:d},a,e,f)};b.payVaultRefresh=function(b,c,d,a,e){this.call(163,{lastversion:b,targetuserid:c},d,a,e)};b.payVaultConsume=function(b,c,d,a,e){this.call(166,{ids:b,targetuserid:c},d,a,e)};b.payVaultCredit=function(b,c,d,a,e,f){this.call(169,{amount:b,reason:c,targetuserid:d},
a,e,f)};b.payVaultDebit=function(b,c,d,a,e,f){this.call(172,{amount:b,reason:c,targetuserid:d},a,e,f)};b.payVaultBuy=function(b,c,d,a,e,f){this.call(175,{items:b,storeitems:c,targetuserid:d},a,e,f)};b.payVaultGive=function(b,c,d,a,e){this.call(178,{items:b,targetuserid:c},d,a,e)};b.payVaultPaymentInfo=function(b,c,d,a,e,f){this.call(181,{provider:b,purchasearguments:c,items:d},a,e,f)};b.payVaultUsePaymentInfo=function(b,c,d,a,e){this.call(184,{provider:b,providerarguments:c},d,a,e)};b.partnerPayTrigger=
function(b,c,d,a,e){this.call(200,{key:b,count:c},d,a,e)};b.partnerPaySetTag=function(b,c,d,a){this.call(203,{partnerid:b},c,d,a)};b.notificationsRefresh=function(b,c,d,a){this.call(213,{lastversion:b},c,d,a)};b.notificationsRegisterEndpoints=function(b,c,d,a,e){this.call(216,{lastversion:b,endpoints:c},d,a,e)};b.notificationsSend=function(b,c,d,a){this.call(219,{notifications:b},c,d,a)};b.notificationsToggleEndpoints=function(b,c,d,a,e,f){this.call(222,{lastversion:b,endpoints:c,enabled:d},a,e,f)};
b.notificationsDeleteEndpoints=function(b,c,d,a,e){this.call(225,{lastversion:b,endpoints:c},d,a,e)};b.gameRequestsSend=function(b,c,d,a,e,f){this.call(241,{requesttype:b,requestdata:c,requestrecipients:d},a,e,f)};b.gameRequestsRefresh=function(b,c,d,a){this.call(244,{playcodes:b},c,d,a)};b.gameRequestsDelete=function(b,c,d,a){this.call(247,{requestids:b},c,d,a)};b.achievementsRefresh=function(b,c,d,a){this.call(271,{lastversion:b},c,d,a)};b.achievementsLoad=function(b,c,d,a){this.call(274,{userids:b},
c,d,a)};b.achievementsProgressSet=function(b,c,d,a,e){this.call(277,{achievementid:b,progress:c},d,a,e)};b.achievementsProgressAdd=function(b,c,d,a,e){this.call(280,{achievementid:b,progressdelta:c},d,a,e)};b.achievementsProgressMax=function(b,c,d,a,e){this.call(283,{achievementid:b,progress:c},d,a,e)};b.achievementsProgressComplete=function(b,c,d,a){this.call(286,{achievementid:b},c,d,a)};b.playerInsightRefresh=function(b,c,d){this.call(301,{},b,c,d)};b.playerInsightSetSegments=function(b,c,d,a){this.call(304,
{segments:b},c,d,a)};b.playerInsightTrackInvitedBy=function(b,c,d,a,e){this.call(307,{invitinguserid:b,invitationchannel:c},d,a,e)};b.playerInsightTrackEvents=function(b,c,d,a){this.call(311,{events:b},c,d,a)};b.playerInsightTrackExternalPayment=function(b,c,d,a,e){this.call(314,{currency:b,amount:c},d,a,e)};b.playerInsightSessionKeepAlive=function(b,c,d){this.call(317,{},b,c,d)};b.playerInsightSessionStop=function(b,c,d){this.call(320,{},b,c,d)};b.oneScoreLoad=function(b,c,d,a){this.call(351,{userids:b},
c,d,a)};b.oneScoreSet=function(b,c,d,a){this.call(354,{score:b},c,d,a)};b.oneScoreAdd=function(b,c,d,a){this.call(357,{score:b},c,d,a)};b.oneScoreRefresh=function(b,c,d){this.call(360,{},b,c,d)};b.simpleConnect=function(b,c,d,a,e,f,h,l,k){this.call(400,{gameid:b,usernameoremail:c,password:d,playerinsightsegments:a,clientapi:e,clientinfo:f},h,l,k)};b.simpleRegister=function(b,c,d,a,e,f,h,l,k,m,t,q,p,u){this.call(403,{gameid:b,username:c,password:d,email:a,captchakey:e,captchavalue:f,extradata:h,partnerid:l,
playerinsightsegments:k,clientapi:m,clientinfo:t},q,p,u)};b.simpleRecoverPassword=function(b,c,d,a,e){this.call(406,{gameid:b,usernameoremail:c},d,a,e)};b.kongregateConnect=function(b,c,d,a,e,f,h,l,k){this.call(412,{gameid:b,userid:c,gameauthtoken:d,playerinsightsegments:a,clientapi:e,clientinfo:f},h,l,k)};b.simpleGetCaptcha=function(b,c,d,a,e,f){this.call(415,{gameid:b,width:c,height:d},a,e,f)};b.facebookOAuthConnect=function(b,c,d,a,e,f,h,l,k){this.call(418,{gameid:b,accesstoken:c,partnerid:d,playerinsightsegments:a,
clientapi:e,clientinfo:f},h,l,k)};b.steamConnect=function(b,c,d,a,e,f,h,l,k){this.call(421,{gameid:b,steamappid:c,steamsessionticket:d,playerinsightsegments:a,clientapi:e,clientinfo:f},h,l,k)};b.simpleUserGetSecureLoginInfo=function(b,c,d){this.call(424,{},b,c,d)};b.leaderboardsGet=function(b,c,d,a,e,f,h,l,k){this.call(431,{group:b,leaderboard:c,index:d,count:a,neighbouruserid:e,filteruserids:f},h,l,k)};b.leaderboardsSet=function(b,c,d,a,e,f){this.call(434,{group:b,leaderboard:c,score:d},a,e,f)};
b.leaderboardsCount=function(b,c,d,a,e){this.call(437,{group:b,leaderboard:c},d,a,e)};b.joinCluster=function(b,c,d,a,e,f,h,l,k,m,t,q,p,u,v,r,n){this.call(504,{clusteraccesskey:b,isdevelopmentserver:c,ports:d,machinename:a,version:e,machineid:f,os:h,cpu:l,cpucores:k,cpulogicalcores:m,cpuaddresswidth:t,cpumaxclockspeed:q,rammegabytes:p,ramspeed:u},v,r,n)};b.serverHeartbeat=function(b,c,d,a,e,f,h,l,k,m,t,q,p,u,v,r,n,x,w,y){this.call(510,{serverid:b,appdomains:c,servertypes:d,machinecpu:a,processcpu:e,
memoryusage:f,avaliablememory:h,freememory:l,runningrooms:k,usedresources:m,apirequests:t,apirequestserror:q,apirequestsfailed:p,apirequestsexecuting:u,apirequestsqueued:v,apirequeststime:r,serverunixtimeutc:n},x,w,y)};b.getGameAssemblyUrl=function(b,c,d,a,e,f){this.call(513,{clusteraccesskey:b,gamecodeid:c,machineid:d},a,e,f)};b.devServerLogin=function(b,c,d,a,e){this.call(524,{username:b,password:c},d,a,e)};b.webserviceOnlineTest=function(b,c,d){this.call(533,{},b,c,d)};b.getServerInfo=function(b,
c,d,a){this.call(540,{machineid:b},c,d,a)};b.socialRefresh=function(b,c,d){this.call(601,{},b,c,d)};b.socialLoadProfiles=function(b,c,d,a){this.call(604,{userids:b},c,d,a)}})();PlayerIOError=function(b,g,c){this.code=b;this.message=g;this.stack=c;this.stack||(c=Error(),this.stack=c.stack||c.stacktrace||c.StackTrace);this.toString=function(){return"PlayerIOError["+b+"]: "+g}};PlayerIOError.prototype=Error();
PlayerIOErrorCode={UnsupportedMethod:"UnsupportedMethod",GeneralError:"GeneralError",InternalError:"InternalError",AccessDenied:"AccessDenied",InvalidMessageFormat:"InvalidMessageFormat",MissingValue:"MissingValue",GameRequired:"GameRequired",ExternalError:"ExternalError",ArgumentOutOfRange:"ArgumentOutOfRange",GameDisabled:"GameDisabled",UnknownGame:"UnknownGame",UnknownConnection:"UnknownConnection",InvalidAuth:"InvalidAuth",NoServersAvailable:"NoServersAvailable",RoomDataTooLarge:"RoomDataTooLarge",
RoomAlreadyExists:"RoomAlreadyExists",UnknownRoomType:"UnknownRoomType",UnknownRoom:"UnknownRoom",MissingRoomId:"MissingRoomId",RoomIsFull:"RoomIsFull",NotASearchColumn:"NotASearchColumn",QuickConnectMethodNotEnabled:"QuickConnectMethodNotEnabled",UnknownUser:"UnknownUser",InvalidPassword:"InvalidPassword",InvalidRegistrationData:"InvalidRegistrationData",InvalidBigDBKey:"InvalidBigDBKey",BigDBObjectTooLarge:"BigDBObjectTooLarge",BigDBObjectDoesNotExist:"BigDBObjectDoesNotExist",UnknownTable:"UnknownTable",
UnknownIndex:"UnknownIndex",InvalidIndexValue:"InvalidIndexValue",NotObjectCreator:"NotObjectCreator",KeyAlreadyUsed:"KeyAlreadyUsed",StaleVersion:"StaleVersion",CircularReference:"CircularReference",HeartbeatFailed:"HeartbeatFailed",InvalidGameCode:"InvalidGameCode",VaultNotLoaded:"VaultNotLoaded",UnknownPayVaultProvider:"UnknownPayVaultProvider",DirectPurchaseNotSupportedByProvider:"DirectPurchaseNotSupportedByProvider",BuyingCoinsNotSupportedByProvider:"BuyingCoinsNotSupportedByProvider",NotEnoughCoins:"NotEnoughCoins",
ItemNotInVault:"ItemNotInVault",InvalidPurchaseArguments:"InvalidPurchaseArguments",InvalidPayVaultProviderSetup:"InvalidPayVaultProviderSetup",UnknownPartnerPayAction:"UnknownPartnerPayAction",InvalidType:"InvalidType",IndexOutOfBounds:"IndexOutOfBounds",InvalidIdentifier:"InvalidIdentifier",InvalidArgument:"InvalidArgument",LoggedOut:"LoggedOut",InvalidSegment:"InvalidSegment",GameRequestsNotLoaded:"GameRequestsNotLoaded",AchievementsNotLoaded:"AchievementsNotLoaded",UnknownAchievement:"UnknownAchievement",
NotificationsNotLoaded:"NotificationsNotLoaded",InvalidNotificationsEndpoint:"InvalidNotificationsEndpoint",NetworkIssue:"NetworkIssue",OneScoreNotLoaded:"OneScoreNotLoaded",PublishingNetworkNotAvailable:"PublishingNetworkNotAvailable",PublishingNetworkNotLoaded:"PublishingNetworkNotLoaded",DialogClosed:"DialogClosed",AdTrackCheckCookie:"AdTrackCheckCookie",codes:{0:"UnsupportedMethod",1:"GeneralError",2:"InternalError",3:"AccessDenied",4:"InvalidMessageFormat",5:"MissingValue",6:"GameRequired",7:"ExternalError",
8:"ArgumentOutOfRange",9:"GameDisabled",10:"UnknownGame",11:"UnknownConnection",12:"InvalidAuth",13:"NoServersAvailable",14:"RoomDataTooLarge",15:"RoomAlreadyExists",16:"UnknownRoomType",17:"UnknownRoom",18:"MissingRoomId",19:"RoomIsFull",20:"NotASearchColumn",21:"QuickConnectMethodNotEnabled",22:"UnknownUser",23:"InvalidPassword",24:"InvalidRegistrationData",25:"InvalidBigDBKey",26:"BigDBObjectTooLarge",27:"BigDBObjectDoesNotExist",28:"UnknownTable",29:"UnknownIndex",30:"InvalidIndexValue",31:"NotObjectCreator",
32:"KeyAlreadyUsed",33:"StaleVersion",34:"CircularReference",40:"HeartbeatFailed",41:"InvalidGameCode",50:"VaultNotLoaded",51:"UnknownPayVaultProvider",52:"DirectPurchaseNotSupportedByProvider",54:"BuyingCoinsNotSupportedByProvider",55:"NotEnoughCoins",56:"ItemNotInVault",57:"InvalidPurchaseArguments",58:"InvalidPayVaultProviderSetup",70:"UnknownPartnerPayAction",80:"InvalidType",81:"IndexOutOfBounds",82:"InvalidIdentifier",83:"InvalidArgument",84:"LoggedOut",90:"InvalidSegment",100:"GameRequestsNotLoaded",
110:"AchievementsNotLoaded",111:"UnknownAchievement",120:"NotificationsNotLoaded",121:"InvalidNotificationsEndpoint",130:"NetworkIssue",131:"OneScoreNotLoaded",200:"PublishingNetworkNotAvailable",201:"PublishingNetworkNotLoaded",301:"DialogClosed",302:"AdTrackCheckCookie"}};
(function(){_pio.client=function(b,g,c,d){this.connectUserId=d;this.gameId=g;this.gameFS=new _pio.gameFS(g,c);this.errorLog=new _pio.errorLog(b);this.payVault=new _pio.payVault(b);this.bigDB=new _pio.bigDB(b);this.multiplayer=new _pio.multiplayer(b);this.gameRequests=new _pio.gameRequests(b);this.achievements=new _pio.achievements(b);this.playerInsight=new _pio.playerInsight(b);this.oneScore=new _pio.oneScore(b);this.leaderboards=new _pio.leaderboards(b,this.connectUserId);this.notifications=new _pio.notifications(b);
this.publishingNetwork=new _pio.publishingNetwork(b,this.connectUserId)}})();
(function(){var b={};_pio.gameFS=function(g,c){if("string"==typeof c&&0<c.length){var d=(c||"").split("|");if(1<=d.length)for(var a=b[g.toLowerCase()]={},e=0;e!=d.length;e++){var f=d[e];"alltoredirect"==f||"cdnmap"==f?a.baseUrl=d[e+1]:"alltoredirectsecure"==f||"cdnmapsecure"==f?a.secureBaseUrl=d[e+1]:a["."+f]=d[e+1]}}this.getUrl=function(a,c){if("/"==!a[0])throw _pio.error("The path given to getUrl must start with a slash, like: '/myfile.swf' or '/folder/file.jpg'");var e=b[g];return e?(c?e.secureBaseUrl:
e.baseUrl)+(e["."+a]||a):(c?"https":"http")+"://r.playerio.com/r/"+g+a}}})();
(function(){_pio.gameRequests=function(b){function g(a){if(null==a||0==a.length)return[];for(var c=[],b=0;b!=a.length;b++){var d=a[b];c.push(new _pio.gameRequest(d.id,d.type,d.senderuserid,d.created,d.data))}return c}var c=[];this.waitingRequests="[ERROR: You tried to access gameRequests.waitingRequests before loading waiting requests. You have to call the refresh method first.]";var d=this;this.send=function(a,c,d,h,l){b.gameRequestsSend(a,_pio.convertToKVArray(c),d,h,l,function(a){})};this.refresh=
function(a,e){b.gameRequestsRefresh(c,a,e,function(a){d._playCodes=a.newplaycodes;d.waitingRequests=g(a.requests)})};this["delete"]=function(a,c,f){if("object"==typeof a||a.length){for(var e=[],l=0;l!=a.length;l++){var k=a[l].id;if(k)e.push(k);else{a=_pio.error("No GameRequest id found on item#"+l+". You have to use requests from the gameRequests.waitingRequests array. For instance: client.gameRequests.delete(client.gameRequests.waitingRequests, ...)");_pio.handleError(a,f,a.code,a.message);return}}b.gameRequestsDelete(e,
c,f,function(a){d.waitingRequests=g(a.requests)})}else a=_pio.error("The first argument to delete should be an array: client.gameRequests.delete([requests], ...)"),_pio.handleError(a,f,a.code,a.message)}};_pio.gameRequest=function(b,g,c,d,a){this.id=b;this.type=g;this.senderUserId=c;this.created=new Date(d);this.data=_pio.convertFromKVArray(a)}})();(function(){_pio.errorLog=function(b){this.writeError=function(g,c,d,a){b.writeError("Javascript",g,c,d,_pio.convertToKVArray(a))}}})();
(function(){_pio.quickConnect=function(){this.simpleGetCaptcha=function(b,g,c,d,a){(new _pio.channel).simpleGetCaptcha(b,g,c,d,a,function(a){return new _pio.simpleGetCaptchaOutput(a.captchakey,a.captchaimageurl)})};this.simpleRecoverPassword=function(b,g,c,d){(new _pio.channel).simpleRecoverPassword(b,g,c,d,function(a){})}};_pio.simpleGetCaptchaOutput=function(b,g){this.captchaKey=b;this.captchaImageUrl=g};PlayerIO.quickConnect=new _pio.quickConnect})();
(function(){_pio.payVault=function(b){function g(a){if(null!=a&&(c=a.version,d.coins=a.coins||0,d.items=[],a.items&&a.items.length))for(var b=0;b!=a.items.length;b++){var f=a.items[b],h=d.items[b]=new _pio.vaultItem(f.id,f.itemkey,(new Date).setTime(f.purchasedate));_pio.bigDBDeserialize(f.properties,h,!0)}}var c=null;this.coins="[ERROR: you tried to access payVault.coins before the vault was loaded. You have to refresh the vault before the .coins property is set to the right value]";this.items="[ERROR: you tried to access payVault.items before the vault was loaded. You have to refresh the vault before the .items property is set to the right value]";
this.has=function(a){if(null==c)throw new PlayerIOError(PlayerIOErrorCode.VaultNotLoaded,"Cannot access items before vault has been loaded. Please refresh the vault first");for(var b=0;b!=this.items.length;b++)if(this.items[b].itemKey==a)return!0;return!1};this.first=function(a){if(null==c)throw new PlayerIOError(PlayerIOErrorCode.VaultNotLoaded,"Cannot access items before vault has been loaded. Please refresh the vault first");for(var b=0;b!=this.items.length;b++)if(this.items[b].itemKey==a)return this.items[b];
return null};this.count=function(a){if(null==c)throw new PlayerIOError(PlayerIOErrorCode.VaultNotLoaded,"Cannot access items before vault has been loaded. Please refresh the vault first");for(var b=0,d=0;d!=this.items.length;d++)this.items[d].itemKey==a&&b++;return b};this.refresh=function(a,d){b.payVaultRefresh(c,null,a,d,function(a){g(a.vaultcontents)})};this.readHistory=function(a,c,d,h){b.payVaultReadHistory(a,c,null,d,h,function(a){for(var c=[],b=0;b!=a.entries.length;b++){var d=a.entries[b];
c.push(new _pio.payVaultHistoryEntry(d.type,d.amount,d.timestamp,d.itemkeys||[],d.reason,d.providertransactionid,d.providerprice))}return c})};this.credit=function(a,c,d,h){b.payVaultCredit(a,c,null,d,h,function(a){g(a.vaultcontents)})};this.debit=function(a,c,d,h){b.payVaultDebit(a,c,null,d,h,function(a){g(a.vaultcontents)})};this.consume=function(a,c,d){if("object"==typeof a||a.length){for(var e=[],f=0;f!=a.length;f++){var k=a[f].id;if(k)e.push(k);else{a=_pio.error("No PayVault item id found on item#"+
f+". You have to use items from the payVault.items array. For instance: client.payVault.consume([client.payVault.first('sportscar')], ...)");_pio.handleError(a,d,a.code,a.message);return}}b.payVaultConsume(e,null,c,d,function(a){g(a.vaultcontents)})}else a=_pio.error("The first argument to consume should be an array: client.payVault.consume([item], ...)"),_pio.handleError(a,d,a.code,a.message)};this.buy=function(a,c,d,h){b.payVaultBuy(_pio.convertBuyItems(a),c,null,d,h,function(a){g(a.vaultcontents)})};
this.give=function(a,c,d){b.payVaultGive(_pio.convertBuyItems(a),null,c,d,function(a){g(a.vaultcontents)})};this.getBuyCoinsInfo=function(a,c,d,h){b.payVaultPaymentInfo(a,_pio.convertToKVArray(c),null,d,h,function(a){return _pio.convertFromKVArray(a.providerarguments)})};this.getBuyDirectInfo=function(a,c,d,h,g){b.payVaultPaymentInfo(a,_pio.convertToKVArray(c),_pio.convertBuyItems(d),h,g,function(a){return _pio.convertFromKVArray(a.providerarguments)})};var d=this};_pio.convertBuyItems=function(b){if(null==
b)return[];for(var g=[],c=0;c!=b.length;c++){var d=b[c].itemkey;if(!d)throw _pio.error("You have to specify an itemkey for the payvault item. Example:  {itemkey:'car'}");g.push({itemkey:d,payload:_pio.compareForChanges({itemkey:d},b[c],!0,!0)})}return g};_pio.vaultItem=function(b,g,c){this.id=b;this.itemKey=g;this.purchaseDate=c};_pio.payVaultHistoryEntry=function(b,g,c,d,a,e,f){this.type=b;this.amount=g;this.timestamp=(new Date).setTime(c);this.itemKeys=d;this.reason=a;this.providerTransactionId=
e;this.providerPrice=f}})();
(function(){_pio.bigDB=function(b){function g(){for(var c=0;c<a.length;c++){var b=a[c],d=!0,g;for(g in b.objects)if(b.objects[g]._internal_("get-is-saving")){d=!1;break}if(d){for(g in b.objects)for(d=c+1;d<a.length;d++){futureSave=a[d];for(var k=0;k<futureSave.objects.length;k++)futureSave.objects[k]==b.objects[g]&&futureSave.fullOverwrite==b.fullOverwrite&&futureSave.useOptimisticLock==b.useOptimisticLock&&(b.changesets[g]=futureSave.changesets[k],b.futureSaves.push(futureSave))}a.splice(c,1);c--;
b.execute()}}}function c(a,c){null==a?a=[]:a instanceof Array||(a=[a]);null!=c&&(a=a.concat([c]));for(var b=[],d=0;d!=a.length;d++){var e=a[d];switch(typeof e){case "boolean":b.push({valuetype:_pio.ValueType.Bool,bool:e});break;case "string":b.push({valuetype:_pio.ValueType.String,string:e});break;case "number":0!=e%1?b.push({valuetype:_pio.ValueType.Double,"double":e}):-2147483648<e&&2147483647>e?b.push({valuetype:_pio.ValueType.Int,"int":e}):0<e&&4294967295>e?b.push({valuetype:_pio.ValueType.UInt,
uint:e}):b.push({valuetype:_pio.ValueType.Long,"long":e});break;case "object":if(e.getTime&&e.getMilliseconds)b.push({valuetype:_pio.ValueType.DateTime,datetime:e.getTime()});else throw Error("Don't know how to serialize type '"+typeof e+"' for BigDB");break;default:throw Error("Don't know how to serialize type '"+typeof e+"' for BigDB");}}return b}var d=this,a=[];this.createObject=function(a,c,h,g,k){var e=_pio.compareForChanges({},h||{},!0,!0);b.createObjects([{key:c,table:a,properties:e}],!1,g,
k,function(c){if(1==c.objects.length)return new _pio.databaseobject(d,a,c.objects[0].key,c.objects[0].version,!1,e);throw new PlayerIOError(PlayerIOErrorCode.GeneralError,"Error creating object");})};this.loadMyPlayerObject=function(a,c){b.loadMyPlayerObject(a,c,function(a){return new _pio.databaseobject(d,"PlayerObjects",a.playerobject.key,a.playerobject.version,!0,a.playerobject.properties)})};this.load=function(a,c,h,g){b.loadObjects([{table:a,keys:[c]}],h,g,function(c){if(1==c.objects.length)return null==
c.objects[0]?null:new _pio.databaseobject(d,a,c.objects[0].key,c.objects[0].version,!1,c.objects[0].properties);throw new PlayerIOError(PlayerIOErrorCode.GeneralError,"Error loading object");})};this.loadKeys=function(a,c,h,g){b.loadObjects([{table:a,keys:c}],h,g,function(c){for(var b=[],e=0;e!=c.objects.length;e++){var f=c.objects[e];b[e]=null==f?null:new _pio.databaseobject(d,a,f.key,f.version,!1,f.properties)}return b})};this.loadOrCreate=function(a,c,h,g){b.createObjects([{key:c,table:a,properties:[]}],
!0,h,g,function(c){if(1==c.objects.length)return new _pio.databaseobject(d,a,c.objects[0].key,c.objects[0].version,!1,c.objects[0].properties);throw new PlayerIOError(PlayerIOErrorCode.GeneralError,"Error creating object");})};this.deleteKeys=function(a,c,d,g){b.deleteObjects([{table:a,keys:c}],d,g,function(a){return null})};this.loadKeysOrCreate=function(a,c,h,g){for(var e=[],f=0;f!=c.length;f++)e.push({key:c[f],table:a,properties:[]});b.createObjects(e,!0,h,g,function(c){for(var b=[],e=0;e!=c.objects.length;e++){var f=
c.objects[e];b[e]=new _pio.databaseobject(d,a,f.key,f.version,!1,f.properties)}return b})};this.loadSingle=function(a,f,h,g,k){b.loadMatchingObjects(a,f,c(h),1,g,k,function(c){return 0==c.objects.length?null:new _pio.databaseobject(d,a,c.objects[0].key,c.objects[0].version,!1,c.objects[0].properties)})};this.loadRange=function(a,f,h,g,k,m,t,q){b.loadIndexRange(a,f,c(h,g),c(h,k),m,t,q,function(c){for(var b=[],e=0;e!=c.objects.length;e++){var f=c.objects[e];b[e]=null==f?null:new _pio.databaseobject(d,
a,f.key,f.version,!1,f.properties)}return b})};this.deleteRange=function(a,d,h,g,k,m,t){b.deleteIndexRange(a,d,c(h,g),c(h,k),m,t,function(){})};this.saveChanges=function(c,d,h,l,k,m){var e=1==m;m=[];for(var f in h){var p=h[f];if(!(p.existsInDatabase&&p.key&&p.table&&p._internal_&&p.save)){c=_pio.error("You can only save database objects that exist in the database");_pio.handleError(c,k,c.code,c.message);return}var u=_pio.compareForChanges(d?{}:p._internal_("get-dbCurrent"),p,!0,!0);(d||0<u.length)&&
m.push({key:p._internal_("get-key"),table:p._internal_("get-table"),fulloverwrite:d,onlyifversion:c?p._internal_("get-version"):null,changes:u})}a.push({objects:h,changesets:m,fullOverwrite:d,useOptimisticLock:c,futureSaves:[],setIsSavingOnAll:function(a){for(var c=0;c!=this.objects.length;c++)this.objects[c]._internal_("set-is-saving",a)},done:function(){this.setIsSavingOnAll(!1);g()},execute:function(){var a=this;a.setIsSavingOnAll(!0);0<a.changesets.length?b.saveObjectChanges(_pio.LockType.LockAll,
a.changesets,e,l,function(c){a.done();_pio.handleError(c,k,c.code,c.message)},function(c){for(var b=0;b!=a.objects.length;b++){var d=a.objects[b];d._internal_("set-version",c.versions[b]);d._internal_("change-dbCurrent",a.changesets[b].changes);for(var e=0;e!=a.futureSaves.length;e++)for(var f=a.futureSaves[e],h=0;h<f.objects.length;h++)f.objects[h]==d&&(f.changesets.splice(h,1),f.objects.splice(h,1),h--)}a.done()}):(a.done(),setTimeout(l,1))}});g()}};_pio.databaseobject=function(b,g,c,d,a,e){var f=
{},h=!1;_pio.bigDBDeserialize(e,f,!0);this.table=g;this.key=c;this.existsInDatabase=!0;this.save=function(c,d,e,f){b.saveChanges(c,d,[this],e,f,a)};this._internal_=function(a,b){switch(a){case "get-table":return g;case "get-key":return c;case "set-is-saving":h=b;case "get-is-saving":return h;case "get-version":return d;case "set-version":d=b;case "get-dbCurrent":return f;case "change-dbCurrent":_pio.bigDBDeserialize(b,f,!0)}};_pio.bigDBDeserialize(e,this,!0)};_pio.compareForChanges=function(b,g,c,
d){var a=[],e;for(e in g){var f=g[e],h=b?b[e]:null;switch(e){case "table":if(d)continue;case "key":if(d)continue;case "save":if(d)continue;case "existsInDatabase":if(d)continue;case "_internal_":if(d)continue;case "_circular_reference_finder_":continue}if(null!=f){var l=c?{name:e}:{index:parseInt(e)};switch(typeof f){case "boolean":f!=h&&(l.value={valuetype:_pio.ValueType.Bool,bool:f},a.push(l));break;case "number":f!=h&&(isFinite(f)&&Math.floor(f)===f?l.value=-2147483648<=f&&2147483647>=f?{valuetype:_pio.ValueType.Int,
"int":f}:0<f&&4294967295>=f?{valuetype:_pio.ValueType.UInt,uint:f}:-0x7ffffffffffffc00<=f&&0x7ffffffffffffc00>=f?{valuetype:_pio.ValueType.Long,"long":f}:0<f&&1.844674407370955E19>=f?{valuetype:_pio.ValueType.ULong,ulong:f}:{valuetype:_pio.ValueType.Double,"double":f}:l.value={valuetype:_pio.ValueType.Double,"double":f},a.push(l));break;case "string":f!=h&&(l.value={valuetype:_pio.ValueType.String,string:f},a.push(l));break;case "object":if(f.getTime&&f.getMilliseconds)f+""!=h+""&&(l.value={valuetype:_pio.ValueType.DateTime,
datetime:f.getTime()},a.push(l));else{if(f._circular_reference_finder_)throw new PlayerIOError(PlayerIOErrorCode.CircularReference,"The object you're trying to save contains a circular reference for "+(c?"a property named":"the array entry")+"): "+e);f._circular_reference_finder_=!0;var k=f instanceof Array;if(k&&f.bytearray){k=Array(f.length);for(h=0;h!=k.length;h++){var m=f[h];if(0<=m&&255>=m)k[h]=m;else throw new PlayerIOError(PlayerIOErrorCode.GeneralError,"The bytearray property '"+e+"' was supposed to only contain byte (0-255) values, but contained the value: "+
m);}l.value={valuetype:_pio.ValueType.ByteArray,bytearray:k}}else h=_pio.compareForChanges(h,f,!k,!1),l.value=k?{valuetype:_pio.ValueType.Array,arrayproperties:h}:{valuetype:_pio.ValueType.Obj,objectproperties:h};a.push(l);delete f._circular_reference_finder_}break;case "undefined":break;case "function":break;default:throw Error("Don't know how to serialize type '"+typeof f+"' for BigDB");}}}for(e in b)null!=g[e]&&"undefined"!=typeof g[e]||a.push(c?{name:e}:{index:parseInt(e)});return a};_pio.bigDBDeserialize=
function(b,g,c){for(var d in b){var a=b[d],e=c?a.name:a.index||0;if(a=a.value)switch(a.valuetype||0){case _pio.ValueType.String:g[e]=a.string||"";break;case _pio.ValueType.Int:g[e]=a["int"]||0;break;case _pio.ValueType.UInt:g[e]=a.uint||0;break;case _pio.ValueType.Long:g[e]=a["long"]||0;break;case _pio.ValueType.Bool:g[e]=a.bool||0;break;case _pio.ValueType.Float:g[e]=a["float"]||0;break;case _pio.ValueType.Double:g[e]=a["double"]||0;break;case _pio.ValueType.ByteArray:g[e]=a.bytearray;g[e].bytearray=
!0;break;case _pio.ValueType.DateTime:g[e]=new Date(a.datetime||0);break;case _pio.ValueType.Array:var f=g[e]instanceof Array?g[e]:[];_pio.bigDBDeserialize(a.arrayproperties,f,!1);g[e]=f;break;case _pio.ValueType.Obj:f="object"==typeof g[e]?g[e]:{},_pio.bigDBDeserialize(a.objectproperties,f,!0),g[e]=f}else delete g[e]}}})();
(function(){_pio.multiplayer=function(c){var b=this;this.developmentServer=null;this.useSecureConnections=!1;this.createRoom=function(a,d,f,h,g,k){c.createRoom(a,d,f,_pio.convertToKVArray(h),null!=b.developmentServer,g,k,function(a){return a.roomid})};this.joinRoom=function(a,d,f,h){clearTimeout(setTimeout(function(){f(new _pio.connection)},1E4));var e=Error();c.joinRoom(a,_pio.convertToKVArray(d),null!=b.developmentServer,b.useSecureConnections,function(){},h,function(a){return new _pio.connection(e,
b.developmentServer,b.useSecureConnections,a.endpoints,a.joinkey,d||{},f,h)})};this.createJoinRoom=function(a,d,f,h,g,k,m){clearTimeout(setTimeout(function(){k(new _pio.connection)},1E4));var e=Error();c.createJoinRoom(a,d,f,_pio.convertToKVArray(h),_pio.convertToKVArray(g),null!=b.developmentServer,b.useSecureConnections,function(){},m,function(a){return new _pio.connection(e,b.developmentServer,b.useSecureConnections,a.endpoints,a.joinkey,g||{},k,m)})};this.listRooms=function(a,d,f,h,g,k){c.listRooms(a,
_pio.convertToKVArray(d),f,h,null!=b.developmentServer,g,k,function(a){var c=[];if(a.rooms&&0<a.rooms.length)for(var b=0;b!=a.rooms.length;b++){var d=a.rooms[b];c.push(new _pio.roomInfo(d.id,d.roomtype,d.onlineusers,_pio.convertFromKVArray(d.roomdata)))}return c})}};_pio.websocketConnection=function(c,b,a,e,f,h,g){var d=this,m=!1,l=new _pio.messageSerializer,q=!1,p=null;b=(b?"wss://":"ws://")+a+"/";try{p="undefined"!=typeof MozWebSocket?new MozWebSocket(b):new WebSocket(b)}catch(v){f(!1,""+v);return}var u=
setTimeout(function(){m||(m=!0,f(!1,"Connect attempt timed out"))},e);p.onopen=function(){m||(clearTimeout(u),q=m=!0,f(q))};p.onclose=function(a){d.disconnect()};p.onerror=function(a){d.disconnect()};p.onmessage=function(a){if(q)if(c){var b=new FileReader;b.onloadend=function(){for(var a=new Uint8Array(b.result),c=Array(a.length),d=0;d!=a.length;d++)c[d]=a[d];g(l.deserializeMessage(c,0,c.length))};b.readAsArrayBuffer(a.data)}else a=_pio.base64decode(a.data),g(l.deserializeMessage(a,0,a.length))};
this.disconnect=function(){if(q){q=!1;h();try{p.close()}catch(v){_pio.debugLog(v)}}};this.sendMessage=function(a){a=l.serializeMessage(a);if(c){for(var b=new Uint8Array(a.length),d=0;d<a.length;d++)b[d]=a[d];p.send(b.buffer)}else a=_pio.base64encode(a),p.send(a)}};_pio.connection=function(c,b,a,e,f,h,g,k){function d(d){function m(){if(0<n.length){var b=n[0];n.splice(0,1);var e=d(a,b,4E3,function(a,c){if(a){r=e;l.connected=!0;var d=l.createMessage("join");d.addString(f);if(null!=h)for(var g in h)d.addString(g),
d.addString(""+h[g]);l.sendMessage(d)}else _pio.debugLog("Unable to connect to endpoint: "+b+'. reason: "'+c+(0<n.length?'". Trying next endpoint.':'". No more endpoints to try.')),m()},function(a){l.connected&&(l.connected=!1,setTimeout(function(){for(var a=0;a!=p.length;a++)_pio.runCallback(p[a].callback,l,p[a].stackSource)},100))},function(a){q?"playerio.joinresult"==a.type?(q=!1,a.getBoolean(0)?_pio.runCallback(g,l,null):_pio.handleError(c,k,a.getInt(1),a.getString(2))):_pio.handleError(c,k,PlayerIOErrorCode.GeneralError,
"The expected inital messagetype is: playerio.joinresult, received: "+joinResult.getType()):(t(a.type,a),t("*",a))})}else _pio.handleError(c,k,PlayerIOErrorCode.GeneralError,"Could not establish a socket connection to any of the given endpoints for the room")}function t(a,c){var b=u[a];if(b)for(var d=0;d<b.length;d++)_pio.runCallback(b[d].callback,c,b[d].stackSource)}var n=[];if(b)n.push(b);else for(var w=0;w!=e.length;w++)n.push(e[w].address+":"+e[w].port);m()}var l=this,q=!0,p=[],u={},v=[],r=null,
n=/(WebKit|Firefox|Trident)\/([0-9]+)/gi.exec(navigator.userAgent),x=n&&3<=n.length?n[1]:null,n=n&&3<=n.length?parseInt(n[2]):null;window.FileReader&&"WebKit"==x&&535<=n||"Firefox"==x&&11<=n||"Trident"==x&&6<=n?d(function(a,c,b,d,e,f){return new _pio.websocketConnection(!0,a,c,b,d,e,f)}):_pio.isFlashFallbackEnabled(function(a){a?d(function(a,c,b,d,e,f){return new _pio.flashSocketConnection(c,b,d,e,f)}):d(function(a,c,b,d,e,f){return new _pio.websocketConnection(!1,a,c,b,d,e,f)})});this.connected=
!1;this.addDisconnectCallback=function(a){p.push({callback:a,stackSourc:Error()})};this.addMessageCallback=function(a,c){null==a&&(a="*");var b=u[a];b||(u[a]=b=[]);b.push({callback:c,stackSource:Error()})};this.removeDisconnectCallback=function(a){for(var c=0;c<p.length;c++)p[c].callback==a&&(p.splice(c,1),c--)};this.removeMessageCallback=function(a){for(var c in u)for(var b=u[c],d=0;d<b.length;d++)b[d].callback==a&&(b.splice(d,1),d--)};this.createMessage=function(a){for(var c=new _pio.message(a),
b=1;b<arguments.length;b++)c.add(arguments[b]);return c};this.send=function(a){var c=this.createMessage.apply(this,arguments);this.sendMessage(c)};this.sendMessage=function(a){l.connected?r.sendMessage(a):v.push(a)};this.disconnect=function(){l.connected&&r.disconnect()}};_pio.message=function(c){function b(a,c,b,d){if(a)k.push(c),g.push(b),h.length=k.length;else throw _pio.error("The given value ("+c+") is not "+d);}function a(a,c){if(a>k.length)throw _pio.error("this message ("+h.type+") only has "+
k.length+" entries");if(g[a]==c)return k[a];throw _pio.error("Value at index:"+a+" is a "+e(g[a])+" and not a "+e(c)+" as requested. The value is: "+k[a]);}function e(a){return{0:"Integer",1:"Unsigned Integer",2:"Long",3:"Unsigned Long",4:"Double",5:"Float",6:"String",7:"ByteArray",8:"Boolean"}[a]}function f(a){var c="object"==typeof a&&"undefined"!=typeof a.length;if(c)for(var b=0;b!=a.length;b++)if(255<a[b]||0>a[b]){c=!1;break}return c}var h=this,g=[],k=[];this.type=c;this.length=0;this.add=function(){for(var a=
0;a<arguments.length;a++){var c=arguments[a];switch(typeof c){case "string":h.addString(c);break;case "boolean":h.addBoolean(c);break;case "number":if(isFinite(c)&&Math.floor(c)===c)if(-2147483648<=c&&2147483647>=c){h.addInt(c);break}else if(0<c&&4294967295>=c){h.addUInt(c);break}else if(-0x7ffffffffffffc00<=c&&0x7ffffffffffffc00>=c){h.addLong(c);break}else if(0<c&&1.844674407370955E19>=c){h.addULong(c);break}h.addDouble(c);break;case "object":if(f(c)){this.addByteArray(c);break}default:throw _pio.error("The type of the value ("+
c+") cannot be inferred");}}};this.addInt=function(a){b(-2147483648<=a&&2147483647>=a,Math.trunc(a),0,"an integer (32bit)")};this.addUInt=function(a){b(0<=a&&4294967295>=a,Math.trunc(a),1,"an unsigned integer (32bit)")};this.addLong=function(a){b(-0x7ffffffffffffc00<=a&&0x7ffffffffffffc00>=a,Math.trunc(a),2,"a long (64bit)")};this.addULong=function(a){b(0<=a&&1.844674407370955E19>=a,a,3,"an unsigned long (64bit)")};this.addBoolean=function(a){b(!0,a?!0:!1,8,"a boolean value")};this.addFloat=function(a){b(!0,
Number(a),5,"a floating point value (32bit)")};this.addDouble=function(a){b(!0,Number(a),4,"a double floating point value (64bit)")};this.addByteArray=function(a){b(f(a),a,7,"a bytearray")};this.addString=function(a){b(!0,a+"",6,"a string")};this.getInt=function(c){return a(c,0)};this.getUInt=function(c){return a(c,1)};this.getLong=function(c){return a(c,2)};this.getULong=function(c){return a(c,3)};this.getBoolean=function(c){return a(c,8)};this.getDouble=function(c){return a(c,4)};this.getFloat=
function(c){return a(c,5)};this.getByteArray=function(c){return a(c,7)};this.getString=function(c){return a(c,6)};this.toString=function(){for(var a="msg.Type = "+this.type+"",c=0;c!=this.length;c++)a+=", msg["+c+"] = "+k[c]+" ("+e(g[c])+")";return a};this._internal_=function(a,c){switch(a){case "get-objects":return k;case "get-types":return g}}};_pio.roomInfo=function(c,b,a,e){this.id=c;this.roomType=b;this.onlineUsers=a;this.roomData=e};_pio.byteWriter=function(){this.bytes=[];this.writeByte=function(c){if(0<=
c&&255>=c)this.bytes.push(c);else throw Error("This is not a byte value: "+c);};this.writeBytes=function(c){for(var b=0;b!=c.length;b++)this.writeByte(c[b])};this.writeTagWithLength=function(c,b,a){63<c||0>c?this.writeBottomPatternAndBytes(a,_pio.binaryserializer.bytesFromInt(c)):this.writeByte(b|c)};this.writeBottomPatternAndBytes=function(c,b){var a=0;0!=b[0]?a=3:0!=b[1]?a=2:0!=b[2]&&(a=1);this.writeByte(c|a);for(a=b.length-a-1;a!=b.length;a++)this.writeByte(b[a])};this.writeLongPattern=function(c,
b,a){for(var d=0,f=0;7!=f;f++)if(0!=a[f]){d=7-f;break}3<d?this.writeByte(b|d-4):this.writeByte(c|d);for(f=a.length-d-1;f!=a.length;f++)this.writeByte(a[f])}};_pio.messageSerializer=function(){this.serializeMessage=function(c){var b=new _pio.byteWriter;b.writeTagWithLength(c.length,128,4);var a=_pio.binaryserializer.bytesFromString(c.type);b.writeTagWithLength(a.length,192,12);b.writeBytes(a);for(var e=0;e!=c.length;e++)switch(a=c._internal_("get-objects")[e],c._internal_("get-types")[e]){case 6:a=
_pio.binaryserializer.bytesFromString(a);b.writeTagWithLength(a.length,192,12);b.writeBytes(a);break;case 0:b.writeTagWithLength(a,128,4);break;case 1:b.writeBottomPatternAndBytes(8,_pio.binaryserializer.bytesFromUInt(a));break;case 2:b.writeLongPattern(48,52,_pio.binaryserializer.bytesFromLong(a));break;case 3:b.writeLongPattern(56,60,_pio.binaryserializer.bytesFromULong(a));break;case 7:b.writeTagWithLength(a.length,64,16);b.writeBytes(a);break;case 4:b.writeByte(3);b.writeBytes(_pio.binaryserializer.bytesFromDouble(a));
break;case 5:b.writeByte(2);a=_pio.binaryserializer.bytesFromFloat(a);b.writeBytes(a);break;case 8:b.writeByte(a?1:0)}return b.bytes};this.deserializeMessage=function(c,b,a){var d=b;b+=a;a=null;for(var f=0;d<b;){var h=0,g=0,k=c[d];d++;var m=k&192;0==m&&(m=k&60,0==m&&(m=k));switch(m){case 12:case 16:h=(k&3)+1;if(d+h>b)throw Error("Unexpected: Unfinished message");k=h;h=_pio.binaryserializer.intFromBytes(c,d,h);d+=k;break;case 192:h=k&63;break;case 128:g=k&63;break;case 64:h=k&63;break;case 4:case 8:case 48:case 56:h=
(k&3)+1;break;case 52:case 60:h=(k&3)+5;break;case 3:h=8;break;case 2:h=4}if(d+h>b)throw Error("Unexpected: Unfinished message");switch(m){case 12:case 192:null==a?(a=new _pio.message(_pio.binaryserializer.stringFromBytes(c,d,h)),f++):a.addString(_pio.binaryserializer.stringFromBytes(c,d,h));break;case 4:g=_pio.binaryserializer.intFromBytes(c,d,h);case 128:0==f?f=g:a.addInt(g);break;case 16:case 64:a.addByteArray(c.slice(d,d+h));break;case 8:a.addUInt(_pio.binaryserializer.uintFromBytes(c,d,h));break;
case 48:case 52:a.addLong(_pio.binaryserializer.longFromBytes(c,d,h));break;case 56:case 60:a.addULong(_pio.binaryserializer.ulongFromBytes(c,d,h));break;case 3:a.addDouble(_pio.binaryserializer.doubleFromBytes(c,d,h));break;case 2:a.addFloat(_pio.binaryserializer.floatFromBytes(c,d,h));break;case 1:a.addBoolean(!0);break;case 0:a.addBoolean(!1)}d+=h;if(null!=a&&0==--f)return a}throw Error("Unexpected: Misaligned message");}};_pio.binaryserializer={pow2:function(c){return 0<=c&&31>c?1<<c:this.pow2[c]||
(this.pow2[c]=Math.pow(2,c))},_intEncode:function(c,b){var a;if(4==b)a=[c>>>24&255,c>>>16&255,c>>>8&255,c&255];else{if(0<=c){a=Math.floor(c/this.pow2(32));var d=c-a*this.pow2(32)}else a=Math.floor(c/this.pow2(32)),d=c-a*this.pow2(32),a+=this.pow2(32);a=[a>>>24&255,a>>>16&255,a>>>8&255,a&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255]}return a},_floatEncode:function(c,b,a){var d=0>c?1:0,f,h=~(-1<<a-1),g=1-h;0>c&&(c=-c);0===c?c=f=0:isNaN(c)?(f=2*h+1,c=1):Infinity===c?(f=2*h+1,c=0):(f=Math.floor(Math.log(c)/
Math.LN2),f>=g&&f<=h?(c=Math.floor((c*this.pow2(-f)-1)*this.pow2(b)),f+=h):(c=Math.floor(c/this.pow2(g-b)),f=0));for(h=[];8<=b;)h.push(c%256),c=Math.floor(c/256),b-=8;f=f<<b|c;for(a+=b;8<=a;)h.push(f&255),f>>>=8,a-=8;h.push(d<<a|f);h.reverse();return h},bytesFromString:function(c){for(var b=[],a=0;a<c.length;a++)if(127>=c.charCodeAt(a))b.push(c.charCodeAt(a));else for(var e=encodeURIComponent(c.charAt(a)).substr(1).split("%"),f=0;f<e.length;f++)b.push(parseInt(e[f],16));return b},bytesFromInt:function(c){return this._intEncode(c,
4)},bytesFromUInt:function(c){return this._intEncode(c,4)},bytesFromLong:function(c){return this._intEncode(c,8)},bytesFromULong:function(c){return this._intEncode(c,8)},bytesFromFloat:function(c){return this._floatEncode(c,23,8)},bytesFromDouble:function(c){return this._floatEncode(c,52,11)},_intDecode:function(c,b,a,e,f){var d=b+a-1;b=f&&a==e&&c[b]&128;e=0;f=1;for(var g=0;g<a;g++){var k=c[d-g];b&&(k=(k^255)+f,f=k>>8,k&=255);e+=k*this.pow2(8*g)}return b?-e:e},_float32Decode:function(c,b){var a=c.slice(b,
b+4).reverse(),d=1-2*(a[3]>>7),f=(a[3]<<1&255|a[2]>>7)-127,a=(a[2]&127)<<16|a[1]<<8|a[0];return 128===f?0!==a?NaN:Infinity*d:-127===f?d*a*this.pow2(-149):d*(1+a*this.pow2(-23))*this.pow2(f)},_float64Decode:function(c,b){var a=c.slice(b,b+8).reverse(),d=1-2*(a[7]>>7),f=((a[7]<<1&255)<<3|a[6]>>4)-1023,a=(a[6]&15)*this.pow2(48)+a[5]*this.pow2(40)+a[4]*this.pow2(32)+a[3]*this.pow2(24)+a[2]*this.pow2(16)+a[1]*this.pow2(8)+a[0];return 1024===f?0!==a?NaN:Infinity*d:-1023===f?d*a*this.pow2(-1074):d*(1+a*
this.pow2(-52))*this.pow2(f)},stringFromBytes:function(c,b,a){for(var d="",f=b;f<b+a;f++)d+=127>=c[f]?37===c[f]?"%25":String.fromCharCode(c[f]):"%"+c[f].toString(16).toUpperCase();return decodeURIComponent(d)},intFromBytes:function(c,b,a){return this._intDecode(c,b,a,4,!0)},uintFromBytes:function(c,b,a){return this._intDecode(c,b,a,4,!1)},longFromBytes:function(b,d,a){return this._intDecode(b,d,a,8,!0)},ulongFromBytes:function(b,d,a){return this._intDecode(b,d,a,8,!1)},floatFromBytes:function(b,d,
a){return 4==a?this._float32Decode(b,d):NaN},doubleFromBytes:function(b,d,a){return 8==a?this._float64Decode(b,d):NaN}};for(var b=[],g=0;65!=g;g++)b["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(g)]=g;_pio.base64encode=function(b){for(var c=[],a=0;a<b.length;a++){var e=b[a],f=++a<=b.length?b[a]:NaN,g=++a<=b.length?b[a]:NaN,l=e>>2,e=(e&3)<<4|f>>4,k=(f&15)<<2|g>>6,m=g&63;isNaN(f)?k=m=64:isNaN(g)&&(m=64);c.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l));
c.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e));c.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k));c.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(m))}return c.join("")};_pio.base64decode=function(c){for(var d=[],a=0;a<c.length;a++){var e=b[c.charCodeAt(a)],f=++a<c.length?b[c.charCodeAt(a)]:64,g=++a<c.length?b[c.charCodeAt(a)]:64,l=++a<c.length?b[c.charCodeAt(a)]:64,k=(f&15)<<4|g>>2,m=(g&3)<<
6|l;d.push(e<<2|f>>4);64!=g&&(d.push(k),64!=l&&d.push(m))}return d}})();
(function(){_pio.achievements=function(b){function g(a,b){var c=new _pio.achievement(a.identifier,a.title,a.description,a.imageurl,a.progress,a.progressgoal,a.lastupdated);if("string"!==typeof d.myAchievements)for(var e=0;e<d.myAchievements.length;e++)d.myAchievements[e].id==c.id&&(d.myAchievements[e]=c,d.currentVersion=null);if(b)for(e=0;e<d.onCompleteHandlers.length;e++)(0,d.onCompleteHandlers[e])(c);return c}var c=null;this.myAchievements="[ERROR: You tried to access achievements.myAchievements before loading them. You have to call the refresh method first.]";
this.onCompleteHandlers=[];var d=this;this.addOnComplete=function(a){if("function"===typeof a&&1==a.length)d.onCompleteHandlers.push(a);else throw new PlayerIOError(PlayerIOErrorCode.InvalidArgument,"Expects argument to be a function that takes an achievement as an argument.");};this.get=function(a){if("string"===typeof d.myAchievements)return null;for(var b=0;b<d.myAchievements.length;b++)if(d.myAchievements[b].id==a)return d.myAchievements[b];return null};this.refresh=function(a,e){b.achievementsRefresh(c,
a,e,function(a){if(c!=a.version)if(c=a.version,null==a.achievements||0==a.achievements.length)d.myAchievements=[];else{for(var b=[],e=0;e<a.achievements.length;e++){var f=a.achievements[e];b.push(new _pio.achievement(f.identifier,f.title,f.description,f.imageurl,f.progress,f.progressgoal,f.lastupdated))}d.myAchievements=b}})};this.load=function(a,c,d){"object"==typeof a||requests.length?b.achievementsLoad(a,c,d,function(a){if(null==a||0==a.length)return{};for(var b={},c=0;c<a.userachievements.length;c++){for(var d=
a.userachievements[c],e=[],f=0;f<d.achievements.length;f++){var g=d.achievements[f];e.push(new _pio.achievement(g.identifier,g.title,g.description,g.imageurl,g.progress,g.progressgoal,g.lastupdated))}b[d.userid]=e}return b}):(a=_pio.error("The first argument to load should be an array: client.achievements.load(['user1', 'user2', ...], ...)"),_pio.handleError(a,d,a.code,a.message))};this.progressSet=function(a,c,d,h){b.achievementsProgressSet(a,c,d,h,function(a){return g(a.achievement,a.completednow)})};
this.progressAdd=function(a,c,d,h){b.achievementsProgressAdd(a,c,d,h,function(a){return g(a.achievement,a.completednow)})};this.progressMax=function(a,c,d,h){b.achievementsProgressMax(a,c,d,h,function(a){return g(a.achievement,a.completednow)})};this.progressComplete=function(a,c,d){b.achievementsProgressComplete(a,c,d,function(a){return g(a.achievement,a.completednow)})}};_pio.achievement=function(b,g,c,d,a,e,f){this.id=b;this.title=g;this.description=c;this.imageUrl=d;this.progress="undefined"===
typeof a?0:a;this.progressGoal=e;this.lastUpdated=new Date(1E3*f);this.progressRatio=this.progress/this.progressGoal;this.completed=this.progress==this.progressGoal}})();
(function(){_pio.playerInsight=function(b){function g(b){c.playersOnline=-1==b.playersonline?"[ERROR: The current connection does not have the rights required to read the playersonline variable.]":b.playersonline;c.segments=_pio.convertFromKVArray(b.segments)}this.playersOnline="[ERROR: You tried to access playerInsight.playersOnline before loading it. You have to call the refresh method first.]";this.segments={};var c=this;this.refresh=function(c,a){b.playerInsightRefresh(c,a,function(a){g(a.state)})};
this.setSegments=function(c,a,e){b.playerInsightSetSegments(_pio.convertToSegmentArray(c),a,e,function(a){g(a.state)})};this.trackInvitedBy=function(c,a,e,f){b.playerInsightTrackInvitedBy(c,a,e,f,function(a){})};this.trackEvent=function(c,a,e,f){b.playerInsightTrackEvents([{eventtype:c,value:a}],e,f,function(a){})};this.trackExternalPayment=function(c,a,e,f){b.playerInsightTrackExternalPayment(c,a,e,f,function(a){})};this.sessionKeepAlive=function(c,a){b.playerInsightSessionKeepAlive(c,a,function(a){})}}})();
(function(){_pio.leaderboards=function(b,g){this.set=function(c,d,a,e,f){b.leaderboardsSet(c,d,a,e,f,function(a){return new _pio.leaderboardEntry(a.leaderboardentry.userid,a.leaderboardentry.rank,a.leaderboardentry.score)})};this.count=function(c,d,a,e){b.leaderboardsCount(c,d,a,e,function(a){return a.count})};this.getTop=function(c,d,a,e,f,g,l){b.leaderboardsGet(c,d,a,e,null,f,g,l,function(a){if(null==a||null==a.leaderboardentry||0==a.leaderboardentry.length)return[];for(var b=[],c=0;c<a.leaderboardentry.length;c++)b.push(new _pio.leaderboardEntry(a.leaderboardentry[c].userid,
a.leaderboardentry[c].rank,a.leaderboardentry[c].score));return b})};this.getNeighbourhood=function(c,d,a,e,f,h,l){b.leaderboardsGet(c,d,a,e,g,f,h,l,function(a){if(null==a||null==a.leaderboardentry||0==a.leaderboardentry.length)return[];for(var b=[],c=0;c<a.leaderboardentry.length;c++)b.push(new _pio.leaderboardEntry(a.leaderboardentry[c].userid,a.leaderboardentry[c].rank,a.leaderboardentry[c].score));return b})}};_pio.leaderboardEntry=function(b,g,c){this.userId=b;this.rank=g;this.score=c}})();
(function(){_pio.oneScore=function(b){this.percentile="[ERROR: You tried to access oneScore.percentile before loading the OneScore. You have to call the refresh method first.]";this.score="[ERROR: You tried to access oneScore.score before loading the OneScore. You have to call the refresh method first.]";this.topRank="[ERROR: You tried to access oneScore.topRank before loading the OneScore. You have to call the refresh method first.]";var g=this;this.refresh=function(c,d){b.oneScoreRefresh(c,d,function(a){a=
new _pio.oneScoreValue(a.onescore.percentile,a.onescore.score,a.onescore.toprank);g.percentile=a.percentile;g.score=a.score;g.topRank=a.toprank})};this.set=function(c,d,a){b.oneScoreSet(c,d,a,function(a){a=new _pio.oneScoreValue(a.onescore.percentile,a.onescore.score,a.onescore.toprank);g.percentile=a.percentile;g.score=a.score;g.topRank=a.toprank;return a})};this.add=function(c,d,a){b.oneScoreAdd(c,d,a,function(a){a=new _pio.oneScoreValue(a.onescore.percentile,a.onescore.score,a.onescore.toprank);
g.percentile=a.percentile;g.score=a.score;g.topRank=a.toprank;return a})};this.load=function(c,d,a){if("object"==typeof c||requests.length)b.oneScoreLoad(c,d,a,function(a){if(null==a||null==a.onescores||0==a.onescores.length)return[];for(var b=[],d=0,e=0;e<c.length;e++){var g=a.onescores[d];g&&c[e]==g.userid?(b.push(new _pio.oneScoreValue(g.percentile,g.score,g.toprank)),d++):b.push(null)}return b});else d=_pio.error("The first argument to load should be an array: client.oneScore.load(['user1', 'user2', ...], ...)"),
_pio.handleError(d,a,d.code,d.message)}};_pio.oneScoreValue=function(b,g,c){this.percentile="undefined"===typeof b?0:b;this.score="undefined"===typeof g?0:g;this.topRank="undefined"===typeof c?0:c}})();
(function(){_pio.notifications=function(b){function g(b){if(b.version!=a){var c=[];if(b.endpoints)for(var e=0;e!=b.endpoints.length;e++){var g=b.endpoints[e];c[e]=new _pio.notificationEndpoint(g.type,g.identifier,_pio.convertFromKVArray(g.configuration),g.enabled?!0:!1)}a=b.version;d.myEndpoints=c}}function c(a){var b=[];if(a&&0<a.length)for(var c=0;c!=a.length;c++){var d=a[c];d.type&&d.identifier&&b.push({type:d.type,identifier:d.identifier})}return b}this.myEndpoints="[ERROR: You tried to access notifications.myEndpoints before calling refresh.]";
var d=this,a="";this.refresh=function(c,d){b.notificationsRefresh(a,c,d,g)};this.registerEndpoint=function(c,f,h,l,k,m){var e;a:{if(""!=a)for(e=0;e!=d.myEndpoints.length;e++){var q=d.myEndpoints[e];if(q.type==c&&q.identifier==f){e=q;break a}}e=null}(q=null==e||e.enabled!=l)||(q=JSON.stringify(e.configuration)!=JSON.stringify(h));q?b.notificationsRegisterEndpoints(a,[{type:c,identifier:f,configuration:_pio.convertToKVArray(h),enabled:l}],k,m,g):k&&k()};this.toggleEndpoints=function(d,f,h,l){d=c(d);
0<d.length?b.notificationsToggleEndpoints(a,d,f?!0:!1,h,l,g):h&&h()};this.deleteEndpoints=function(d,f,h){d=c(d);0<d.length?b.notificationsDeleteEndpoints(a,d,f,h,g):f&&f()};this.send=function(a,c,d){for(var e=[],f=0;f!=a.length;f++){var g=a[f],h={recipient:g.recipientUserId,endpointtype:g.endpointType,data:{}};0!=(h.recipient+"").length&&0!=(h.endpointtype+"").length||console.log("error");for(var q in g)"recipientUserId"!=q&&"endpointType"!=q&&(h.data[q]=g[q]);e[f]=h}0<e.length?b.notificationsSend(e,
c,d,null):c&&c()}};_pio.notificationEndpoint=function(b,g,c,d){this.type=b;this.identifier=g;this.configuration=c;this.enabled=d}})();
(function(){_pio.publishingNetwork=function(b,g){var c=this;this.profiles=new _pio.publishingNetworkProfiles(b);this.payments=new _pio.publishingNetworkPayments(b);this.relations=new _pio.publishingNetworkRelations(b,g,this);this.userToken="[ERROR: you tried to access publishingNetwork.userToken before calling publishingNetwork.refresh(callback)]";this.refresh=function(d,a){b.socialRefresh(d,a,function(a){c.userToken=a.myprofile.usertoken;c.profiles.myProfile=new _pio.publishingNetworkProfile(a.myprofile);
"undefined"==typeof _pio.friendLookup&&(_pio.friendLookup={},_pio.blockedLookup={});var b=_pio.friendLookup[c.profiles.myProfile.userId],d=_pio.blockedLookup[c.profiles.myProfile.userId];b||d||(b=_pio.friendLookup[c.profiles.myProfile.userId]={},d=_pio.blockedLookup[c.profiles.myProfile.userId]={});c.relations.friends=[];for(var e=0;e!=a.friends.length;e++){var g=new _pio.publishingNetworkProfile(a.friends[e]);c.relations.friends.push(g);b[g.userId]=!0}for(e=0;e!=a.blocked.length;e++)d[a.blocked[e]]=
!0})}};_pio.showDialog=function(b,g,c,d){if("undefined"==typeof window.PublishingNetwork)throw new PlayerIOError(PlayerIOErrorCode.PublishingNetworkNotAvailable,"PublishingNetwork.js was not found on the current page. You have to include the 'piocdn.com/publishingnetwork.js' on the containing page to show dialogs. See http://playerio.com/documentation/ for more information.");c.__apitoken__=g.token;window.PublishingNetwork.dialog(b,c,d)}})();
(function(){_pio.publishingNetworkPayments=function(b){this.showBuyCoinsDialog=function(g,c,d,a){c||(c={});c.coinamount=g;b.payVaultPaymentInfo("publishingnetwork",_pio.convertToKVArray(c),null,function(c){_pio.showDialog("buy",b,c,function(b){b.error?a(new PlayerIOError(PlayerIOErrorCode.GeneralError,b.error)):d(b)})},a,function(a){return _pio.convertFromKVArray(a.providerarguments)})};this.showBuyItemsDialog=function(g,c,d,a){b.payVaultPaymentInfo("publishingnetwork",_pio.convertToKVArray(c||{}),
_pio.convertBuyItems(g),function(c){_pio.showDialog("buy",b,c,function(b){b.error?a(new PlayerIOError(PlayerIOErrorCode.GeneralError,b.error)):d(b)})},a,function(a){return _pio.convertFromKVArray(a.providerarguments)})}}})();
(function(){_pio.publishingNetworkProfiles=function(b){this.myProfile="[ERROR: you tried to access publishingNetworkProfiles.myProfile before calling publishingNetwork.refresh(callback)]";this.showProfile=function(g,c){_pio.showDialog("profile",b,{userId:g},c)};this.loadProfiles=function(g,c,d){b.socialLoadProfiles(g,c,d,function(a){for(var b=[],c=0;c!=g.length;c++){var d=g[c];b[c]=null;for(var l=0;l!=a.profiles.length;l++){var k=a.profiles[l];if(k&&k.userid==d){b[c]=new _pio.publishingNetworkProfile(a.profiles[l]);
break}}}return b})}};_pio.publishingNetworkProfile=function(b){this.userId=b.userid;this.displayName=b.displayname;this.avatarUrl=b.avatarurl;this.lastOnline=new Date(b.lastonline);this.countryCode=b.countrycode}})();
(function(){_pio.publishingNetworkRelations=function(b,g,c){this.friends="[ERROR: you tried to access publishingNetworkRelations.friends before calling publishingNetwork.refresh(callback)]";this.isFriend=function(b){if("undefined"!=typeof _pio.friendLookup&&"undefined"!=typeof _pio.friendLookup[g])return _pio.friendLookup[g][b]||!1;throw new PlayerIOError(PlayerIOErrorCode.PublishingNetworkNotLoaded,"Cannot access profile, friends, ignored before Publishing Network has been loaded. Please refresh Publishing Network first");
};this.isBlocked=function(b){if("undefined"!=typeof _pio.blockedLookup&&"undefined"!=typeof _pio.blockedLookup[g])return _pio.blockedLookup[g][b]||!1;throw new PlayerIOError(PlayerIOErrorCode.PublishingNetworkNotLoaded,"Cannot access profile, friends, ignored before Publishing Network has been loaded. Please refresh Publishing Network first");};this.showRequestFriendshipDialog=function(c,a){_pio.showDialog("requestfriendship",b,{userId:c},a)};this.showRequestBlockUserDialog=function(d,a){_pio.showDialog("requestblockuser",
b,{userId:d},function(){c.refresh(function(){a&&a()},function(){a&&a()})})};this.showFriendsManager=function(d){_pio.showDialog("friendsmanager",b,{},function(a){a.updated?c.refresh(function(){d&&d()},function(){d&&d()}):d&&d()})};this.showBlockedUsersManager=function(d){_pio.showDialog("blockedusersmanager",b,{},function(a){a.updated?c.refresh(function(){d&&d()},function(){d&&d()}):d&&d()})}}})();
