var Kongregate=Kongregate||{};function KongregateAPI(){this._initialize()}Kongregate.Utils=Kongregate.Utils||{},Kongregate.Utils.catchErrors=function(e,t,n){return function(){try{return e.apply(t,arguments)}catch(e){return Kongregate.Log.error("catchErrors caught unhandled exception",e),n}}},function(){function e(e,t,n){Kongregate.Log[e]=function(){try{"undefined"!=typeof active_user&&void 0===Kongregate.Log.debugLevel&&(Kongregate.Log.debugLevel=active_user.debugLevel()),Kongregate.Log.debugLevel>=t&&(console[n]?Function.prototype.apply.call(console[n],console,arguments):console.log(arguments))}catch(e){}}}Kongregate.Log={},e("spam",5,"log"),e("debug",4,"log"),e("info",3,"info"),e("warn",2,"warn"),e("error",1,"error")}(),KonduitEvent={INIT:"init",CONNECT:"connect",CONNECTED:"connected",DISCONNECT:"disconnect",LOGIN:"login",SWITCH_USER:"switch_user",JOIN_ROOM:"join_room",LEAVE_ROOM:"leave_room",USER_JOIN:"user_join",USER_DEPARTURE:"user_departure",USER_CHANGED:"user_changed",ROOM_MESSAGE:"room_message",SYSTEM_MESSAGE:"system_message",PRIVATE_MESSAGE:"private_message",ADMIN_MESSAGE:"admin_message",MESSAGE_ERROR:"message_error",SET_PRESENCE:"set_presence",GUEST_COUNT:"guest_count",ROOM_NOT_FOUND:"room_not_found",ROOM_FULL:"room_full",REQUEST_CHAT_ROOM:"request_chat_room",CREATE_PRIVATE_ROOM:"create_private_room",DESTROY_PRIVATE_ROOM:"destroy_private_room",PRIVATE_ROOM_INVITATION:"private_room_invitation",PRIVATE_ROOM_KICK:"private_room_kick",PRIVATE_ROOM_INVITATION_SENT:"private_room_invitation_sent",JOIN_GUILD_ROOM:"join_guild_room",SILENCED:"silenced",PARTICIPATE:"participate",AMNESTY:"amnesty",API_INITIALIZED:"api_initialized",ADD_STATISTICS:"add_statistics",STATISTIC_UPDATED:"statistic_updated",STATISTIC_SUBMISSION:"statistic_submission",STATISTICS_FLUSH:"statistics_flush",SET_ACCOMPLISHMENT_PROGRESS:"set_accomplishment_progress",NEW_HIGH_SCORE:"new_high_score",DISPLAY_SHOUT_BOX:"display_shout_box",DISPLAY_INVITATION_BOX:"display_invitation_box",SEND_PRIVATE_MESSAGE:"send_private_message",DISPLAY_FEED_POST_BOX:"display_feed_post_box",DISPLAY_SIGN_IN_LIGHTBOX:"display_sign_in_lightbox",DISPLAY_REGISTRATION_LIGHTBOX:"display_registration_lightbox",RESIZE_GAME:"resize_game",HANDLE_ITEM_CHECKOUT_REQUEST:"handle_item_checkout_request",KONDUIT_MESSAGE:"konduit_message",ANALYTICS_PAYLOAD:"analytics_payload",OP_EXTERNAL_MESSAGE:"ext.msg",OP_CONNECTED:"connected",OP_HELLO:"hello",OP_USER_INFO:"user.info",OP_SIGN_IN:"sign_in",PARAM_USER:"user",PARAM_USER_ID:"user_id",PARAM_GAME_AUTH_TOKEN:"auth_token",PURCHASE_RESULT:"purchase_result",PARAM_LOCALCONNECTION_ONLY:"localconnection_only",CUSTOM_TAB_MESSAGE:"custom_tab_message",CUSTOM_TAB_SHOW:"custom_tab_show",CUSTOM_TAB_CLOSE:"custom_tab_close",CUSTOM_TAB_SHOWN:"custom_tab_shown",CUSTOM_TAB_CLEAR_MESSAGES:"custom_tab_clear_messages",OP_CHAT_TAB:"chat.tab",OP_CHAT_CLEAR_DIALOG:"chat.dlg.clear",OP_CHAT_DISPLAY:"chat.disp",OP_CHAT_MSG:"chat.msg",OP_CHAT_CANVAS_ELEMENT:"chat.elm",OP_CHAT_PRIVATE_MESSAGE:"chat.privateMessage",OP_CHAT_RESIZE_GAME:"chat.resizeGame",OP_CHAT_DISPLAY_INVITATION_BOX:"chat.invite",OP_CHAT_DISPLAY_FEED_POST_BOX:"chat.feedpost",OP_CHAT_DISPLAY_REGISTRATION:"chat.registration",OP_CHAT_DISPLAY_SHOUT_BOX:"chat.shoutbox",PARAM_SHOUT_MESSAGE:"shout_message",PARAM_CANVAS_SIZE:"chat.canvas.size",PARAM_RESIZE_GAME_WIDTH:"chat.resizeGame.width",PARAM_RESIZE_GAME_HEIGHT:"chat.resizeGame.height",PARAM_INVITATION_MESSAGE:"invitation_message",PARAM_FRIEND_FILTER:"filter",PARAM_IMAGE_URI:"image_uri",PARAM_KV_PARAMS:"kv_params",PARAM_NAME:"name",PARAM_DESCRIPTION:"desc",PARAM_DATA:"data",OP_SHOUT_CALLBACK:"ext.shout_callback",PARAM_MESSAGE_TYPE:"ext.message_type",PARAM_MESSAGE_RECIPIENTS:"ext.message_recipients",PARAM_ERROR:"error",PARAM_SUCCESS:"success",PARAM_REQUEST_ID:"req.id",OP_STATS_SUBMIT:"stat.submit",ITEM_LIST:"mtx.item_list",ITEM_CHECKOUT:"mtx.checkout",PURCHASE_KREDS:"mtx.kred_purchase",ITEM_INSTANCES:"mtx.item_instances",USE_ITEM_INSTANCE:"mtx.use_item_instance",PARAM_PURCHASE_METHOD:"purchase_method",PARAM_ITEM_TAGS:"item_tags",PARAM_ITEMS:"items",PARAM_ORDER_INFO:"order_info",PARAM_ID:"id",ADS_INITIALIZE:"ads.initialize",ADS_AVAILABLE:"ads.available",ADS_UNAVAILABLE:"ads.unavailable",ADS_SHOW_INCENTIVIZED:"ads.show_incentivized",AD_OPENED:"ads.ad_opened",AD_COMPLETED:"ads.ad_completed",AD_ABANDONED:"ads.ad_abandoned",PROCESSING_SAVE_SHARED_CONTENT:"processing_save_shared_content",SAVE_SHARED_CONTENT:"save_shared_content",SAVE_SHARED_CONTENT_COMPLETE:"shared_content_save_complete",LOAD_SHARED_CONTENT:"load_shared_content",BROWSE_SHARED_CONTENT:"browse_shared_content",OP_SAVE_SHARED_CONTENT:"save_shared_content",OP_BROWSE_SHARED_CONTENT:"browse_shared_content",OP_LOAD_SHARED_CONTENT:"load_shared_content",OP_SHARED_CONTENT_SAVE_COMPLETE:"shared_content_save_complete",PARAM_CONTENT_TYPE:"content_type",PARAM_LABEL:"label",PARAM_IMAGE:"image",OP_IMAGE_AVATAR_SUBMIT:"avatar.submit",OP_IMAGE_AVATAR_FINISHED:"avatar.finished",IMAGE_AVATAR_SUBMIT:"image_avatar_submit",IMAGE_AVATAR_COMPLETE:"image_avatar_complete",OP_ANALYTICS_PAYLOAD:"analytics.payload",HOLODECK_DATA:"holodeck_data",PARAM_HOLODECK_TYPE:"holodeck_type",FETCH_HISTORY:"fetch_history",HISTORY_RECEIVED:"history_received",FAYE_DISCONNECT:"faye_disconnect"},KonduitChatErrorMessage={MESSAGE_TOO_LONG:"error_msg_too_long",RATE_LIMITED:"error_msg_rate_limit"},KonduitPresenceType={CHAT:"chat",AWAY:"away"},Kongregate.polyfillJSON=function(){var a,b,c,d,e;window.JSON||(window.JSON={parse:function(a){return eval("("+a+")")},stringify:(a=Object.prototype.toString,b=Array.isArray||function(e){return"[object Array]"===a.call(e)},c={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},d=function(e){return c[e]||"\\u"+(e.charCodeAt(0)+65536).toString(16).substr(1)},e=/[\\"\u0000-\u001F\u2028\u2029]/g,function t(n){if(null==n)return"null";if("number"==typeof n)return isFinite(n)?n.toString():"null";if("boolean"==typeof n)return n.toString();if("object"==typeof n){if("function"==typeof n.toJSON)return t(n.toJSON());if(b(n)){for(var s="[",i=0;iKongregate.Utils.indexOf(t,e)&&(t.push(e),t.sort(),this._savedData[S]=t.join(","),this._flushPersistentStore(),Kongregate.Log.info("Filter type added: "+e))):Kongregate.Log.warn("Invalid filterType: "+e+", must be alpha_numeric")}},setCommonPropsCallback:function(e){this._enabled&&(this._commonPropsCallback=e,this.updateCommonProperties())},setCommonProperties:function(e){e=this._objectify(e),this.setCommonPropsCallback((function(){return e}))},updateCommonProperties:function(){try{"function"==typeof this._commonPropsCallback&&(this._commonProperties=this._objectify(this._commonPropsCallback()),this._savedData[ke]=this._commonProperties,this._commonProperties[q]&&!this._savedData[P]&&(this._savedData[P]=this._commonProperties[q]))}catch(e){Kongregate.Log.error("Error updating common properties: "+e)}},getAutoLongProperty:function(e){return this.getAutoIntProperty(e)},getAutoLongLongProperty:function(e){return this.getAutoLongProperty(e)},getAutoStringProperty:function(e){if(!this._enabled)return null;var t=this._getKongAutomaticVariables();return"string"==typeof t[e]?t[e]:(Kongregate.Log.warn("Property is not a string: "+e),null)},getAutoBoolProperty:function(e){return!!this._enabled&&!!this._getKongAutomaticVariables()[e]},getAutoDoubleProperty:function(e){if(!this._enabled)return NaN;var t=this._getKongAutomaticVariables();return Number(t[e])},getAutoIntProperty:function(e){return this._enabled?Math.floor(this.getAutoDoubleProperty(e)):NaN},getAutoUTCProperty:function(e){return this.getAutoStringProperty(e)},getAutoPropertiesJSON:function(){return this._enabled?(this._buildKongAutomaticVariables(),"function"==typeof JSON.stringify?JSON.stringify(this._automaticVars):"{}"):"{}"},startPurchase:function(e,t){if(!this._autoAnalyticsDisabled()){var n=this._getProductId(e);n?(this._priceUSD=this._getUSDPrice(n,t),this._iapID&&Kongregate.Log.warn("startPurchase: invoked before active transaction finished. iap_ids may mismatch."),Kongregate.Log.debug("IAP FLOW STEP: startPurchase(): "+n),this._iapID=this._uuid(),this._productId=n,this._addIAPEvent(null,this._objectify(t),Ee)):Kongregate.Log.warn("startPurchase: Can't start purchase with null productId, param was: "+e)}},finishPurchase:function(e,t,n){this._autoAnalyticsDisabled()||(Kongregate.Log.debug("IAP FLOW STEP: finishPurchase(): "+this._productId+", transactionId: "+t+", resultCode: "+e),Pe===e?(this._numPurchases++,this._totalSpentUSD+=this._priceUSD,this._addIAPEvent(t,this._objectify(n),fe)):this._addIAPFailEvent(t,this._objectify(n)))},setAutomaticVariablesListener:function(e){this._enabled&&(this._automaticVarsListener=e,this._getKongAutomaticVariables())},start:function(){},_setup:function(){if(!this._savedData){var t=this._services.isKongregate();if(this._mode=t?this._kongVars.kongregate_analytics_mode:null,this._enabled=null!==this._mode&&void 0!==this._mode&&this._checkBrowserSupport(),Kongregate.Log.debug("Initializing Analytics API, mode: "+this._mode),this._enabled){this._enablePersistence&&this._hasLocalStorage()&&this._loadPersistentStore(),this._clientVersion=t?this._kongVars.kongregate_game_version:"1",this._pendingEvents=this._persistentStore.pending_events=this._persistentStore.pending_events||[],this._persistentStore.event_queues=this._persistentStore.event_queues||{swrve:[]},this._eventQueue=this._persistentStore.event_queues.swrve=this._persistentStore.event_queues.swrve||[],this._savedData=this._persistentStore.saved_data=this._persistentStore.saved_data||{},this._items=this._persistentStore.items=this._persistentStore.items||[],this._commonProperties=this._savedData.common_properties=this._savedData.common_properties||{},this._bundleId=this._savedData[r],this._autoAnalyticsDisabled()?Kongregate.Log.debug("Auto analytics disabled"):this._autoAnalyticsExcludesServer()?Kongregate.Log.debug("Game has a server, only tracking a subset of analytics automatically"):Kongregate.Log.debug("Automatic analytics enabled"),t&&this._requestItems();t=this._getDate();var n=!this._savedData[y];this._setInitialSavedData(y,this._toW3CDTF(t)),this._setInitialSavedData(b,e),this._setInitialSavedData(I,this._clientVersion),this._setInitialSavedData(T,this._timeZoneOffset()),n&&(Kongregate.Log.debug("Analytics: First play"),this._installEvent()),this._startSession(),this._buildKongStaticVars()}else Kongregate.Log.debug("Analytics API not enabled")}},_enqueueEvent:function(e,t){return!this._initialized&&(this._autoAnalyticsDisabled()&&t[ne]||(Kongregate.Log.debug("Queueing pending event: "+e),this._pendingEvents.push({name:e,event:t})),!0)},_addEventInternal:function(e,t,n){var s=0===e.indexOf("swrve.");if(!s&&!t[te]&&(t=this._merge(this._buildEventSpecificVariables(),t)),!this._enqueueEvent(e,t)&&this._enabled){Ke===e&&this._refreshPlayerInfoFields(t);var i=this._getKongAutomaticVariables(),a={};s?a=t:(this._merge(a,this._objectify(this._commonProperties)),t[ne]?(this._merge(a,i),this._merge(a,t)):(this._merge(a,t),this._merge(a,i))),Kongregate.SwrveClient.SWRVE_SESSION_START_IDENTIFIER===e&&(n=!0),Kongregate.Log.debug("Adding event: "+e+", flush="+n),this._eventQueue.push({name:e,event:a}),this._flushQueue(),n&&this._flushPersistentStore()}},_flushQueue:function(){if(this._swrveClient){var e=this;this._eventQueue.length&&!this._submitLock&&(Kongregate.Log.debug("Flushing swrve event queue"),this._submitLock=!0,this._swrveClient.sendEvents(this._eventQueue,(function(t){e._submitLock=!1,e._flushPersistentStore(),e._flushQueueDelayed(t.success?1e3:1e4)})))}},_flushQueueDelayed:function(e){var t=this;setTimeout((function(){t._flushQueue()}),e)},_persistentStoreName:function(){return Kongregate.AnalyticsServices.persistentStoreName(this._kongVars.kongregate_game_id)},_loadPersistentStore:function(){var e;try{var t=localStorage.getItem(this._persistentStoreName())||"{}";e=JSON.parse(t)}catch(e){Kongregate.Log.warn("Error loading persistent store: "+e)}this._persistentStore=e||{}},_flushPersistentStore:function(){try{var e=JSON.stringify(this._persistentStore);localStorage.setItem(this._persistentStoreName(),e)}catch(e){Kongregate.Log.warn("Error flushing persistent store: "+e)}},_destroyPersistentStore:function(){localStorage.removeItem(this._persistentStoreName())},_buildEventSpecificVariables:function(){var e={};return e[te]=0,this._autoAnalyticsDisabled()||(e[f]=this._uuid(),e[m]=this._toW3CDTF(this._getDate()),e[Q]=this._timeZoneOffset()),e},_refreshPlayerInfoFields:function(e){e[Me]=this._savedData[Me],e[Oe]=this._savedData[Oe];for(var t=0;tt?(Kongregate.Log.debug("Terminating previous session ("+this._previousSession.id+"), inactiveFor="+n+", length="+s),(n={})[z]=this._previousSession.id,n[F]=this._numSessions(),n[oe]=this._toW3CDTF(this._previousSession.active),n[re]=s,n[_e]=!1,this._addAutoEvent(ae,n)):this._previousSession&&(this._session=this._previousSession,Kongregate.Log.debug("Reopening previous session ("+this._previousSession.id+"), inactiveFor="+n+", length="+s)),this._session||(this._session={id:this._uuid(),start:e.getTime(),active:e.getTime()},this._savedData.current_session=this._session,e=this._savedData[F]?this._numSessions()+1:1,this._savedData[F]=e,Kongregate.Log.debug("Created new session: "+this._session.id)),this._session!=this._previousSession&&(this.addEvent(Kongregate.SwrveClient.SWRVE_SESSION_START_IDENTIFIER,{}),(e={})[ie]=!1,this._addAutoEvent(se,e))},_installEvent:function(){if(this._autoAnalyticsAllEnabled()){var e={};e[ge]=null,e[ue]=null,e[he]=null,e[de]=null,e[le]=null,e[ve]=null,this._addAutoEvent(ce,e)}else Kongregate.Log.debug("Not firing installs event since analytics mode is not all")},_parseOS:function(e){var t="Unknown",n="Unknown";try{var s=e.split(" ");if(2>s.length)throw Error("Not enough segments in OS string");"OS"===(t=s.shift())&&(t="MacOS",s.shift()),n=s.join(" ")}catch(t){Kongregate.Log.error("Error parsing OS version ("+e+"): "+t.toString())}return{type:t,version:n}},_numSessions:function(){return this._savedData[F]||1},_timeZoneOffset:function(){return this._getDate().getTimezoneOffset()/-60},_daysRetained:function(){var e=this._getDate(),t=this._timeZoneOffset(),n=this._staticVars[y];return n&&(null===(e=this._parseW3CDTF(n,null))&&(Kongregate.Log.warn("Failed to parse first play date: "+n+", resetting"),e=this._getDate(),this._savedData[y]=this._toW3CDTF(e),this._flushPersistentStore())),this._staticVars[T]&&(t=this._staticVars[T]),this._daysSince(e,t)},_dayOfEra:function(e,t){return Math.floor((e+3600*t)/86400)},_daysSince:function(e,t){var n=Math.floor(this._getDate()/1e3),s=Math.floor(e.getTime()/1e3);return this._dayOfEra(n,this._timeZoneOffset())-this._dayOfEra(s,t)},_objectify:function(e){if("string"==typeof e){if(0===e.length||"function"!=typeof JSON.parse)return{};try{return JSON.parse(e)||{}}catch(t){return Kongregate.Log.warn("Failed to parse JSON: "+e+", error: "+t),{}}}return e},_toW3CDTF:function(e){return Kongregate.Utils.toW3CDTF(e)},_parseW3CDTF:function(e,t){return Kongregate.Utils.parseW3CDTF(e,t)},_uuid:function(){var e=this._getDate().getTime();return window.performance&&"function"==typeof window.performance.now&&(e+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)}))},_merge:function(e,t){return Kongregate.Utils.merge(e,t)},_getDate:function(){return new Date}};var e="2.0.0",t=300,n="none",s="all",i="cloud",a="ad_tracking",r="bundle_id",o="browser",_="browser_version",c="carrier",g="client_os_type",u="client_os_version",h="client_version",d="country_code",l="data_connection_type",v="days_retained",E="dev_client_version",f="device_event_id",p="device_type",m="event_time",A="external_ip_address",S="filter_type",I="first_client_version",T="first_play_time_offset",y="first_play_time",b="first_sdk_version",P="first_server_version",C="gamecenter_id",K="gamecenter_alias",O="pur_tier",M="idfa",R="idfv",L="imei",D="android_id",N="ip_address",w="is_valid",k="kong_user_id",V="kong_username",U="kong_plus",H="lang_code",x="last_skew_refresh_time",G="num_purchases",F="num_sessions",B="mac_address",j="player_id",W="sdk_version",q="server_version",z="session_id",Y="time_skew",J="total_spent_in_usd",Q="event_time_offset",Z="site_visitor_id",$="usd_spent_on_kreds",X="platform",ee="pkg_src",te="retry_count",ne="auto_event",se="session_starts",ie="is_from_background",ae="session_ends",re="session_length_seconds",oe="session_end_time",_e="did_crash",ce="installs",ge="stub_field",ue="utm_source",he="utm_medium",de="utm_term",le="utm_content",ve="utm_campaign",Ee="iap_attempts",fe="iap_transactions",pe="iap_fails",me="usd_cost",Ae="product_id",Se="iap_id",Ie="fail_reason",Te="receipt_id",ye="local_currency_type",be="local_currency_cost",Pe="SUCCESS",Ce="none",Ke="player_info",Oe="kong_join_date",Me="pur_link_date",Re=[ce,se,ae,"foreground_visits","background_visits",Ee,pe,fe,"invalid_states"],Le=["twitter_id","fb_user_id","fb_username","fb_email","email"],De=[J,y,F,v,p,g,u,d,V,z,M,R,h],Ne="swrve.heartbeat",we=[.99,1.99,2.99,3.99,4.99,5.99,6.99,7.99,8.99,9.99,10.99,11.99,12.99,13.99,14.99,15.99,16.99,17.99,18.99,19.99,20.99,21.99,22.99,23.99,24.99,25.99,26.99,27.99,28.99,29.99,30.99,31.99,32.99,33.99,34.99,35.99,36.99,37.99,38.99,39.99,40.99,41.99,42.99,43.99,44.99,45.99,46.99,47.99,48.99,49.99,54.99,59.99,64.99,69.99,74.99,79.99,84.99,89.99,94.99,99.99,109.99,119.99,124.99,129.99,139.99,149.99,159.99,169.99,174.99,179.99,189.99,199.99,209.99,219.99,229.99,239.99,249.99,299.99,349.99,399.99,449.99,499.99,599.99,699.99,799.99,899.99,999.99],ke="common_properties";Kongregate.AnalyticsServices.KONG_ANALYTICS_EVENT_TIME=m,Kongregate.AnalyticsServices.persistentStoreName=function(e){return"kong-game-analytics-"+e}}(),Kongregate.ApiServices=function(e){this.initialize(e)},Kongregate.ApiServices.prototype={initialize:function(e){this._kongVars=e.kongregate_variables||{},this._messageConnection=e.message_connection,this._eventListeners={},this._requestHandlers={},this._messageQueue=[],this._requestId=0,this._initializeKongVars(this._kongVars),this.initializeEventListeners()},initializeEventListeners:function(){var e=this;this._messageConnection.addMessageListener((function(t,n){e._onIncomingMessage(t,n)}))},_initializeKongVars:function(e){e=e||{},this._kongregate="true"===String(e.kongregate),this._username=e.kongregate_username||"Guest",this._authToken=e.kongregate_game_auth_token,this._userId=parseInt(e.kongregate_user_id,10)||0,this._gameId=parseInt(e.kongregate_game_id,10)||0},addEventListener:function(e,t){this._eventListeners[e]||(this._eventListeners[e]=[]),this._eventListeners[e].push(t)},_dispatchEvent:function(e,t){for(var n=this._eventListeners[e]||[],s=0;s",s.innerHTML=n},_setGameSwf:function(e){var t=this.flashVarsObject(),n=this,s=this._findSwf(e);s?(this._gameSwf=s,this.messageConnection=this.messageConnection||this._createMessageConnection(t),this.messageConnection.isSupported()?setTimeout((function(){n._gameSwf.setConnectionObject("kongregateAPI.messageConnection")?n.messageConnection.connect():Kongregate.Log.warn("setConnectionObject returned false, not connecting")}),1):(Kongregate.Log.debug("MessageConnection isSupported was false"),setTimeout((function(){n._gameSwf.setConnectionObject(null)}),1))):Kongregate.Log.debug("Kongregate game SWF element does not appear to be a swf: "+e)},_isSwf:function(e){return e&&void 0!==e.Play&&void 0!==e.setConnectionObject},_findSwf:function(e){var t=document.getElementById(e),n=this,s=function(e){for(var s=0;s>>a)+n<<0}function s(e){a(0,0,0,0,e),h[0]=E[0]+1732584193<<0,h[1]=E[1]-271733879<<0,h[2]=E[2]-1732584194<<0,h[3]=E[3]+271733878<<0}function i(e){a(h[0],h[1],h[2],h[3],e),h[0]=E[0]+h[0]<<0,h[1]=E[1]+h[1]<<0,h[2]=E[2]+h[2]<<0,h[3]=E[3]+h[3]<<0}function a(e,t,s,i,a){var r;d?(e=n((s^i)&t^i,e,t,a[0],7,25,-680876936),i=n((t^s)&e^s,i,e,a[1],12,20,-389564586),s=n((e^t)&i^t,s,i,a[2],17,15,606105819),t=n((i^e)&s^e,t,s,a[3],22,10,-1044525330)):(e=((e=a[0]-680876937)<<7|e>>>25)-271733879<<0,i=((i=a[1]-117830708+(2004318071&e^-1732584194))<<12|i>>>20)+e<<0,s=((s=a[2]-1126478375+((-271733879^e)&i^-271733879))<<17|s>>>15)+i<<0,t=((t=a[3]-1316259209+((i^e)&s^e))<<22|t>>>10)+s<<0),e=n((s^i)&t^i,e,t,a[4],7,25,-176418897),i=n((t^s)&e^s,i,e,a[5],12,20,1200080426),s=n((e^t)&i^t,s,i,a[6],17,15,-1473231341),t=n((i^e)&s^e,t,s,a[7],22,10,-45705983),e=n((s^i)&t^i,e,t,a[8],7,25,1770035416),i=n((t^s)&e^s,i,e,a[9],12,20,-1958414417),s=n((e^t)&i^t,s,i,a[10],17,15,-42063),t=n((i^e)&s^e,t,s,a[11],22,10,-1990404162),e=n((s^i)&t^i,e,t,a[12],7,25,1804603682),i=n((t^s)&e^s,i,e,a[13],12,20,-40341101),s=n((e^t)&i^t,s,i,a[14],17,15,-1502002290),t=n((i^e)&s^e,t,s,a[15],22,10,1236535329),e=n((t^s)&i^s,e,t,a[1],5,27,-165796510),i=n((e^t)&s^t,i,e,a[6],9,23,-1069501632),s=n((i^e)&t^e,s,i,a[11],14,18,643717713),t=n((s^i)&e^i,t,s,a[0],20,12,-373897302),e=n((t^s)&i^s,e,t,a[5],5,27,-701558691),i=n((e^t)&s^t,i,e,a[10],9,23,38016083),s=n((i^e)&t^e,s,i,a[15],14,18,-660478335),t=n((s^i)&e^i,t,s,a[4],20,12,-405537848),e=n((t^s)&i^s,e,t,a[9],5,27,568446438),i=n((e^t)&s^t,i,e,a[14],9,23,-1019803690),s=n((i^e)&t^e,s,i,a[3],14,18,-187363961),t=n((s^i)&e^i,t,s,a[8],20,12,1163531501),e=n((t^s)&i^s,e,t,a[13],5,27,-1444681467),i=n((e^t)&s^t,i,e,a[2],9,23,-51403784),s=n((i^e)&t^e,s,i,a[7],14,18,1735328473),t=n((s^i)&e^i,t,s,a[12],20,12,-1926607734),e=n((r=t^s)^i,e,t,a[5],4,28,-378558),i=n(r^e,i,e,a[8],11,21,-2022574463),s=n((r=i^e)^t,s,i,a[11],16,16,1839030562),t=n(r^s,t,s,a[14],23,9,-35309556),e=n((r=t^s)^i,e,t,a[1],4,28,-1530992060),i=n(r^e,i,e,a[4],11,21,1272893353),s=n((r=i^e)^t,s,i,a[7],16,16,-155497632),t=n(r^s,t,s,a[10],23,9,-1094730640),e=n((r=t^s)^i,e,t,a[13],4,28,681279174),i=n(r^e,i,e,a[0],11,21,-358537222),s=n((r=i^e)^t,s,i,a[3],16,16,-722521979),t=n(r^s,t,s,a[6],23,9,76029189),e=n((r=t^s)^i,e,t,a[9],4,28,-640364487),i=n(r^e,i,e,a[12],11,21,-421815835),s=n((r=i^e)^t,s,i,a[15],16,16,530742520),t=n(r^s,t,s,a[2],23,9,-995338651),e=n(s^(t|~i),e,t,a[0],6,26,-198630844),i=n(t^(e|~s),i,e,a[7],10,22,1126891415),s=n(e^(i|~t),s,i,a[14],15,17,-1416354905),t=n(i^(s|~e),t,s,a[5],21,11,-57434055),e=n(s^(t|~i),e,t,a[12],6,26,1700485571),i=n(t^(e|~s),i,e,a[3],10,22,-1894986606),s=n(e^(i|~t),s,i,a[10],15,17,-1051523),t=n(i^(s|~e),t,s,a[1],21,11,-2054922799),e=n(s^(t|~i),e,t,a[8],6,26,1873313359),i=n(t^(e|~s),i,e,a[15],10,22,-30611744),s=n(e^(i|~t),s,i,a[6],15,17,-1560198380),t=n(i^(s|~e),t,s,a[13],21,11,1309151649),e=n(s^(t|~i),e,t,a[4],6,26,-145523070),i=n(t^(e|~s),i,e,a[11],10,22,-1120210379),s=n(e^(i|~t),s,i,a[2],15,17,718787259),t=n(i^(s|~e),t,s,a[9],21,11,-343485551),E[0]=e,E[1]=t,E[2]=s,E[3]=i}var r=[],o=[],_=[],c=[],g="0123456789abcdef".split(""),u=[],h=[],d=!1,l=0,v=0,E=[];if(e.Int32Array)o=new Int32Array(16),_=new Int32Array(16),c=new Int32Array(4),u=new Int32Array(4),h=new Int32Array(4),E=new Int32Array(4);else{for(e=0;16>e;e++)o[e]=_[e]=0;for(e=0;4>e;e++)c[e]=u[e]=h[e]=E[e]=0}c[0]=128,c[1]=32768,c[2]=8388608,c[3]=-2147483648,u[0]=0,u[1]=8,u[2]=16,u[3]=24,Kongregate.Utils.md5=function(e,n,a){if(!n){for(var E=n="",f=0,p=0,m=0,A=e.length;m(E=e.charCodeAt(m))?p++:(E=2048>E?String.fromCharCode(E>>6|192,63&E|128):String.fromCharCode(E>>12|224,E>>6&63|128,63&E|128),p>f&&(n+=e.slice(f,p)),n+=E,f=p=m+1);p>f&&(n+=e.slice(f,A)),e=n}if(d=!1,l=v=(e+="").length,63>2]=0===f?e.charCodeAt(n):o[n>>2]|e.charCodeAt(n)<>2]|=c[3&n],55>=4)],r[3]=g[15&(e>>=4)],r[2]=g[15&(e>>=4)],r[5]=g[15&(e>>=4)],r[4]=g[15&(e>>=4)],r[7]=g[15&(e>>=4)],r[6]=g[e>>4&15],e=h[1],r[9]=g[15&e],r[8]=g[15&(e>>=4)],r[11]=g[15&(e>>=4)],r[10]=g[15&(e>>=4)],r[13]=g[15&(e>>=4)],r[12]=g[15&(e>>=4)],r[15]=g[15&(e>>=4)],r[14]=g[e>>4&15],e=h[2],r[17]=g[15&e],r[16]=g[15&(e>>=4)],r[19]=g[15&(e>>=4)],r[18]=g[15&(e>>=4)],r[21]=g[15&(e>>=4)],r[20]=g[15&(e>>=4)],r[23]=g[15&(e>>=4)],r[22]=g[e>>4&15],e=h[3],r[25]=g[15&e],r[24]=g[15&(e>>=4)],r[27]=g[15&(e>>=4)],r[26]=g[15&(e>>=4)],r[29]=g[15&(e>>=4)],r[28]=g[15&(e>>=4)],r[31]=g[15&(e>>=4)],r[30]=g[e>>4&15],a?r:r.join("")}}("undefined"==typeof global?window:global),Kongregate.MicrotransactionServices=function(e){this.initialize(e)},Kongregate.MicrotransactionServices.prototype={initialize:function(e){var t=this;this._services=e.services,this._services.addEventListener(KonduitEvent.KONDUIT_MESSAGE,(function(e){t._onIncomingMessage(e.opcode,e.params)})),this._adCallbacks=[]},requestItemList:function(e,t){Kongregate.Log.info("MicrotransactionServices.requestItemList("+e+")");var n={};e&&0Kongregate.SharedContentServices.CONTENT_TYPE_LIMIT)n&&n({success:!1});else{var a={};a[KonduitEvent.PARAM_CONTENT_TYPE]=e,a[KonduitEvent.PARAM_LABEL]=i,a[KonduitEvent.PARAM_DATA]=t,a[KonduitEvent.PARAM_IMAGE]=s,this._services.sendMessage({opcode:KonduitEvent.OP_SAVE_SHARED_CONTENT,params:a}),this._saving=!0,this._saveCallback=n}},addLoadListener:function(e,t){this._loadListeners[e]||(this._loadListeners[e]=[]),this._loadListeners[e].push(t)},_onIncomingMessage:function(e,t){switch(e){case KonduitEvent.OP_SHARED_CONTENT_SAVE_COMPLETE:this._onSaveContentComplete(t);break;case KonduitEvent.OP_LOAD_SHARED_CONTENT:this._onLoadSharedContent(t)}},_onSaveContentComplete:function(e){this._saving=!1,this._saveCallback&&(this._saveCallback(e),this._saveCallback=null)},_onLoadSharedContent:function(e){var t=e.contentType;e={id:e.id,name:e.name,permalink:e.permalink,content:e.content,label:e.label},Kongregate.Log.info({loadContent:e});t=this._loadListeners[t]||[];for(var n=0;nthis._maxRetries()&&(Kongregate.Log.debug("Event "+e[t].name+" is over max retry count, deleting it"),e.splice(t,1));t=this._maxBacklogSize(),e&&e.length>t&&e.splice(0,e.length-t)},_removeTransientProperties:function(e){for(var n=0;ne?"0"+e:e}return e instanceof Date?e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"-00:00":""},Kongregate.Utils.parseW3CDTF=function(t,n){var s;try{var i,a=0,r=[1,4,5,6,7,10,11];if(i=e.exec(t)){for(var o,_=0;o=r[_];++_)i[o]=+i[o]||0;i[2]=(+i[2]||1)-1,i[3]=+i[3]||1,"Z"!==i[8]&&void 0!==i[9]&&(a=60*i[10]+i[11],"+"===i[9]&&(a=0-a)),s=new Date(Date.UTC(i[1],i[2],i[3],i[4],i[5]+a,i[6],i[7]))}if(!s||"Invalid Date"===s.toString())throw Error("This date does not conform to W3CDTF.")}catch(e){return s="Unable to parse the string ["+t+"] into a date. The internal error was: "+e.toString(),Kongregate.Log.error(s),n}return s},Kongregate.Utils.indexOf=function(e,t){if(!e)return-1;if("function"==typeof e.indexOf)return e.indexOf(t);for(var n=0;n