!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.h5branding=t.h5branding||{})}(this,function(h){"use strict";var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e,o;t(function(t,e){t.exports=function(){function h(t){return"function"==typeof t}var i=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=0,e=void 0,o=void 0,r=function(t,e){u[s]=t,u[s+1]=e,2===(s+=2)&&(o?o(d):v())},t="undefined"!=typeof window?window:void 0,n=t||{},a=n.MutationObserver||n.WebKitMutationObserver,l="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),c="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(d,1)}}var u=new Array(1e3);function d(){for(var t=0;t=t.length-1)return!1;var i=t.lastIndexOf(".",e-1);if(i<=0||e-1<=i)return!1;var s=o[t.slice(e+1)];return!!s&&0<=s.indexOf(" "+t.slice(i+1,e)+" ")},t.is=function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;if(0<=t.lastIndexOf(".",e-1))return!1;var i=o[t.slice(e+1)];return!!i&&0<=i.indexOf(" "+t.slice(0,e)+" ")},t.get=function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return null;var i=t.lastIndexOf(".",e-1);if(i<=0||e-1<=i)return null;var s=o[t.slice(e+1)];return s?s.indexOf(" "+t.slice(i+1,e)+" ")<0?null:t.slice(i+1):null},t}(),n=function(){function t(){}return t.setList=function(t){o=t||{}},t.getDomain=function(t){if(!o)return null;var e=t.match(/\./g);if(e&&e.length<2)return t;var i=this.getTld(t);if(!i)return null;var s=t.length-i.length-1;return s=t.lastIndexOf(".",s-1)+1,t.substring(s)||""},t.getTld=function(t){if(!o)return"";var e=t.lastIndexOf("."),i=t.substring(e+1);return o[i.toLowerCase()]&&s.get(t)||i},t.KEY="Domains",t}(),a=function(){function t(){this.cache={}}return Object.defineProperty(t,"instance",{get:function(){return void 0===t.classInstance&&(t.classInstance=new t),t.classInstance},enumerable:!1,configurable:!0}),t.prototype.load=function(e,t,i){var s=this;return this.contains(e)?Promise.reject("Already in cache."):(this.cache[e]={url:t,data:null},this.requestXhr(t,i).then(function(t){return s.loadComplete(e,t)}).catch(function(t){return s.remove(e),Promise.reject(t)}))},t.prototype.loadComplete=function(t,e){if(!this.contains(t))return Promise.reject("Item was removed from cache before loading was complete.");try{var i=JSON.parse(e);return this.cache[t].data=i,Promise.resolve(i)}catch(t){return Promise.reject("There was an error parsing JSON file.")}},t.prototype.remove=function(t){this.contains(t)&&delete this.cache[t]},t.prototype.get=function(t){return this.contains(t)?this.cache[t].data:null},t.prototype.contains=function(t){return this.cache.hasOwnProperty(t)},t.prototype.isLoading=function(t){return this.contains(t)&&null===this.cache[t].data},t.prototype.isLoaded=function(t){return this.contains(t)&&null!==this.cache[t].data},t.prototype.loadScript=function(s,t,o){return void 0===t&&(t=!0),new Promise(function(t,e){var i=document.createElement("script");i.src=s,i.async=!1,i.onload=function(){"function"==typeof o&&o(),t()},document.head.appendChild(i)})},t.prototype.requestXhr=function(i,s){var o;return void 0===s&&(s="application/json"),window.XMLHttpRequest?(o=new XMLHttpRequest,new Promise(function(t,e){o.onreadystatechange=function(){4===o.readyState&&(200===o.status?(t(o.responseText),o.onreadystatechange=null):0>>2]|=(i[o>>>2]>>>24-o%4*8&255)<<24-(s+o)%4*8;else if(65535>>2]=i[o>>>2];else e.push.apply(e,i);return this.sigBytes+=t,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=r.ceil(e/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],i=0;i>>2]>>>24-s%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,i=[],s=0;s>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new h.init(i,e/2)}},l=n.Latin1={stringify:function(t){var e=t.words;t=t.sigBytes;for(var i=[],s=0;s>>2]>>>24-s%4*8&255));return i.join("")},parse:function(t){for(var e=t.length,i=[],s=0;s>>2]|=(255&t.charCodeAt(s))<<24-s%4*8;return new h.init(i,e)}},c=n.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},p=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,i=e.words,s=e.sigBytes,o=this.blockSize,n=s/(4*o);if(t=(n=t?r.ceil(n):r.max((0|n)-this._minBufferSize,0))*o,s=r.min(4*t,s),t){for(var a=0;a>>7)^(u<<14|u>>>18)^u>>>3)+g[p-7]+((d<<15|d>>>17)^(d<<13|d>>>19)^d>>>10)+g[p-16]}u=c+((r<<26|r>>>6)^(r<<21|r>>>11)^(r<<7|r>>>25))+(r&h^~r&l)+y[p]+g[p],d=((s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22))+(s&o^s&n^o&n),c=l,l=h,h=r,r=a+u|0,a=n,n=o,o=s,s=u+d|0}i[0]=i[0]+s|0,i[1]=i[1]+o|0,i[2]=i[2]+n|0,i[3]=i[3]+a|0,i[4]=i[4]+r|0,i[5]=i[5]+h|0,i[6]=i[6]+l|0,i[7]=i[7]+c|0},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,s=8*t.sigBytes;return e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=o.floor(i/4294967296),e[15+(s+64>>>9<<4)]=i,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});t.SHA256=i._createHelper(s),t.HmacSHA256=i._createHmacHelper(s)}(Math),c=(l=k).enc.Utf8,l.algo.HMAC=l.lib.Base.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=c.parse(e));var i=t.blockSize,s=4*i;e.sigBytes>s&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),n=this._iKey=e.clone(),a=o.words,r=n.words,h=0;h>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));if(e=s.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var e=t.length,i=this._map;(s=i.charAt(64))&&-1!=(s=t.indexOf(s))&&(e=s);for(var s=[],o=0,n=0;n>>6-n%4*2;s[o>>>2]|=(a|r)<<24-o%4*8,o++}return d.create(s,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},y=Dt||(Dt={}),(g=y.EGAErrorSeverity||(y.EGAErrorSeverity={}))[g.Undefined=0]="Undefined",g[g.Debug=1]="Debug",g[g.Info=2]="Info",g[g.Warning=3]="Warning",g[g.Error=4]="Error",g[g.Critical=5]="Critical",(f=y.EGAGender||(y.EGAGender={}))[f.Undefined=0]="Undefined",f[f.Male=1]="Male",f[f.Female=2]="Female",(m=y.EGAProgressionStatus||(y.EGAProgressionStatus={}))[m.Undefined=0]="Undefined",m[m.Start=1]="Start",m[m.Complete=2]="Complete",m[m.Fail=3]="Fail",(v=y.EGAResourceFlowType||(y.EGAResourceFlowType={}))[v.Undefined=0]="Undefined",v[v.Source=1]="Source",v[v.Sink=2]="Sink",x=y.http||(y.http={}),(b=x.EGASdkErrorType||(x.EGASdkErrorType={}))[b.Undefined=0]="Undefined",b[b.Rejected=1]="Rejected",(w=x.EGAHTTPApiResponse||(x.EGAHTTPApiResponse={}))[w.NoResponse=0]="NoResponse",w[w.BadResponse=1]="BadResponse",w[w.RequestTimeout=2]="RequestTimeout",w[w.JsonEncodeFailed=3]="JsonEncodeFailed",w[w.JsonDecodeFailed=4]="JsonDecodeFailed",w[w.InternalServerError=5]="InternalServerError",w[w.BadRequest=6]="BadRequest",w[w.Unauthorized=7]="Unauthorized",w[w.UnknownResponseCode=8]="UnknownResponseCode",w[w.Ok=9]="Ok";var A,B,C,E,I,O,M,L,D,R,F,G,N,V,H,z,X,j,W,q,Y,K,J,Q,Z,$,tt,et,it,st,ot,nt,at,rt,ht,lt,ct,pt,ut,dt,yt,gt,ft,mt,vt,xt,bt,wt,Pt,_t,St,Tt,kt,At,Bt,Ct,Et,It,Ot,Mt,Lt,Dt,Rt,Ft,Gt,Ut,Nt,Vt,Ht,zt,Xt,jt,Wt,qt;Dt.EGAErrorSeverity,Dt.EGAGender,Dt.EGAProgressionStatus,Dt.EGAResourceFlowType;(function(t){var s,e;(e=s||(s={}))[e.Error=0]="Error",e[e.Warning=1]="Warning",e[e.Info=2]="Info",e[e.Debug=3]="Debug";var i=function(){function i(){i.debugEnabled=!1}return i.setInfoLog=function(t){i.instance.infoLogEnabled=t},i.setVerboseLog=function(t){i.instance.infoLogVerboseEnabled=t},i.i=function(t){if(i.instance.infoLogEnabled){var e="Info/"+i.Tag+": "+t;i.instance.sendNotificationMessage(e,s.Info)}},i.w=function(t){var e="Warning/"+i.Tag+": "+t;i.instance.sendNotificationMessage(e,s.Warning)},i.e=function(t){var e="Error/"+i.Tag+": "+t;i.instance.sendNotificationMessage(e,s.Error)},i.ii=function(t){if(i.instance.infoLogVerboseEnabled){var e="Verbose/"+i.Tag+": "+t;i.instance.sendNotificationMessage(e,s.Info)}},i.d=function(t){if(i.debugEnabled){var e="Debug/"+i.Tag+": "+t;i.instance.sendNotificationMessage(e,s.Debug)}},i.prototype.sendNotificationMessage=function(t,e){switch(e){case s.Error:case s.Warning:break;case s.Debug:console.debug;break;case s.Info:}},i.instance=new i,i.Tag="GameAnalytics",i}();t.GALogger=i})((A=Dt||(Dt={})).logging||(A.logging={})),B=Dt||(Dt={}),C=B.utilities||(B.utilities={}),E=B.logging.GALogger,I=function(){function c(){}return c.getHmac=function(t,e){var i=k.HmacSHA256(e,t);return k.enc.Base64.stringify(i)},c.stringMatch=function(t,e){return!(!t||!e)&&e.test(t)},c.joinStringArray=function(t,e){for(var i="",s=0,o=t.length;s>2,o=(3&e)<<4|(i=t.charCodeAt(l++))>>4,n=(15&i)<<2|(r=t.charCodeAt(l++))>>6,h=63&r,isNaN(i)?n=h=64:isNaN(r)&&(h=64),a=a+c.keyStr.charAt(s)+c.keyStr.charAt(o)+c.keyStr.charAt(n)+c.keyStr.charAt(h),e=i=r=0,s=o=n=h=0,lt)return L.w(n+" validation failed: array cannot exceed "+t+" values. It has "+o.length+" values."),!1;for(var a=0;ap.MaxNumberOfEntries},p.select=function(t,e,i,s){void 0===e&&(e=[]),void 0===i&&(i=!1),void 0===s&&(s=0);var o=p.getStore(t);if(!o)return null;for(var n=[],a=0;as&&(n=n.slice(0,s+1)),n},p.update=function(t,e,i){void 0===i&&(i=[]);var s=p.getStore(t);if(!s)return!1;for(var o=0;o=a.MaxCount)){var o=nt.getHmac(s,i),n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(!n.responseText)return;if(200!=n.status)return void at.w("sdk error failed. response code not 200. status code: "+n.status+", description: "+n.statusText+", body: "+n.responseText);a.countMap[e]=a.countMap[e]+1}},n.open("POST",t,!0),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("Authorization",o);try{n.send(i)}catch(t){}}},a.MaxCount=10,a.countMap={},a}(),ot.SdkErrorTask=rt,ht=Dt||(Dt={}),lt=ht.http||(ht.http={}),ct=ht.state.GAState,pt=ht.logging.GALogger,ut=ht.utilities.GAUtilities,dt=ht.validators.GAValidator,yt=ht.tasks.SdkErrorTask,gt=function(){function c(){this.protocol="https",this.hostName=window.location.host,this.version="v2",this.baseUrl=this.protocol+"://"+this.hostName+"/"+this.version,this.initializeUrlPath="init",this.eventsUrlPath="events",this.useGzip=!1}return c.prototype.requestInit=function(t){var e=ct.getGameKey(),i=(this.baseUrl,this.initializeUrlPath);i=`https://${window.location.host}/v2/command_center?game_key=`+e+"&interval_seconds=1000000";var s=ct.getInitAnnotations(),o=JSON.stringify(s);if(o){var n=this.createPayloadData(o,this.useGzip),a=[];a.push(o),c.sendRequest(i,n,a,this.useGzip,c.initRequestCallback,t)}else t(lt.EGAHTTPApiResponse.JsonEncodeFailed,null)},c.prototype.sendEventsInArray=function(t,e,i){if(0!=t.length){var s=ct.getGameKey(),o=this.baseUrl+"/"+s+"/"+this.eventsUrlPath,n=JSON.stringify(t);if(n){var a=this.createPayloadData(n,this.useGzip),r=[];r.push(n),r.push(e),r.push(t.length.toString()),c.sendRequest(o,a,r,this.useGzip,c.sendEventInArrayRequestCallback,i)}else i(lt.EGAHTTPApiResponse.JsonEncodeFailed,null,e,t.length)}},c.prototype.sendSdkErrorEvent=function(t){if(ct.isEventSubmissionEnabled()){var e=ct.getGameKey(),i=ct.getGameSecret();if(dt.validateSdkErrorEvent(e,i,t)){var s,o=this.baseUrl+"/"+e+"/"+this.eventsUrlPath,n=ct.getSdkErrorEventAnnotations(),a=c.sdkErrorTypeToString(t);n.type=a;var r=[];r.push(n),(s=JSON.stringify(r))?yt.execute(o,t,s,i):pt.w("sendSdkErrorEvent: JSON encoding failed.")}}},c.sendEventInArrayRequestCallback=function(t,e,i,s){void 0===s&&(s=null),s[0],s[1];var o,n,a=s[2],r=parseInt(s[3]);o=t.responseText,n=t.status;var h=c.instance.processRequestResponse(n,t.statusText,o,"Events");if(h==lt.EGAHTTPApiResponse.Ok||h==lt.EGAHTTPApiResponse.BadRequest){var l=o?JSON.parse(o):{};null!=l?(lt.EGAHTTPApiResponse.BadRequest,i(h,l,a,r)):i(lt.EGAHTTPApiResponse.JsonDecodeFailed,null,a,r)}else i(h,null,a,r)},c.sendRequest=function(t,e,i,s,o,n){var a=new XMLHttpRequest,r=ct.getGameSecret(),h=ut.getHmac(r,e),l=[];for(var c in l.push(h),i)l.push(i[c]);if(a.onreadystatechange=function(){4===a.readyState&&o(a,t,n,l)},a.open("POST",t,!0),a.setRequestHeader("Content-Type","text/plain"),a.setRequestHeader("Authorization",h),s)throw new Error("gzip not supported");try{a.send(e)}catch(t){}},c.initRequestCallback=function(t,e,i,s){var o,n;void 0===s&&(s=null),s[0],s[1],o=t.responseText,n=t.status;var a=o?JSON.parse(o):{},r=c.instance.processRequestResponse(n,t.statusText,o,"Init");if(r==lt.EGAHTTPApiResponse.Ok||r==lt.EGAHTTPApiResponse.BadRequest)if(null!=a)if(r!==lt.EGAHTTPApiResponse.BadRequest){var h=dt.validateAndCleanInitRequestResponse(a);h?i(lt.EGAHTTPApiResponse.Ok,h,"",0):i(lt.EGAHTTPApiResponse.BadResponse,null,"",0)}else i(r,null,"",0);else i(lt.EGAHTTPApiResponse.JsonDecodeFailed,null,"",0);else i(r,null,"",0)},c.prototype.createPayloadData=function(t,e){if(e)throw new Error("gzip not supported");return t},c.prototype.processRequestResponse=function(t,e,i,s){return i?200===t?lt.EGAHTTPApiResponse.Ok:0===t||401===t?lt.EGAHTTPApiResponse.Unauthorized:400===t?lt.EGAHTTPApiResponse.BadRequest:500===t?lt.EGAHTTPApiResponse.InternalServerError:lt.EGAHTTPApiResponse.UnknownResponseCode:lt.EGAHTTPApiResponse.NoResponse},c.sdkErrorTypeToString=function(t){switch(t){case lt.EGASdkErrorType.Rejected:return"rejected";default:return""}},c.instance=new c,c}(),lt.GAHTTPApi=gt,ft=Dt||(Dt={}),mt=ft.events||(ft.events={}),vt=ft.store.GAStore,xt=ft.store.EGAStore,bt=ft.store.EGAStoreArgsOperator,wt=ft.state.GAState,Pt=ft.logging.GALogger,_t=ft.utilities.GAUtilities,St=ft.http.EGAHTTPApiResponse,Tt=ft.http.GAHTTPApi,kt=ft.validators.GAValidator,At=ft.http.EGASdkErrorType,Bt=function(){function u(){}return u.addSessionStartEvent=function(){if(wt.isEventSubmissionEnabled()){var t={};t.category=u.CategorySessionStart,wt.incrementSessionNum(),vt.setItem(wt.SessionNumKey,wt.getSessionNum().toString()),u.addDimensionsToEvent(t),u.addEventToStore(t),Pt.i("Add SESSION START event"),u.processEvents(u.CategorySessionStart,!1)}},u.addSessionEndEvent=function(){if(wt.isEventSubmissionEnabled()){var t=wt.getSessionStart(),e=wt.getClientTsAdjusted()-t;e<0&&(Pt.w("Session length was calculated to be less then 0. Should not be possible. Resetting to 0."),e=0);var i={};i.category=u.CategorySessionEnd,i.length=e,u.addDimensionsToEvent(i),u.addEventToStore(i),Pt.i("Add SESSION END event."),u.processEvents("",!1)}},u.addBusinessEvent=function(t,e,i,s,o,n){if(void 0===o&&(o=null),wt.isEventSubmissionEnabled())if(kt.validateBusinessEvent(t,e,o,i,s)){var a={};wt.incrementTransactionNum(),vt.setItem(wt.TransactionNumKey,wt.getTransactionNum().toString()),a.event_id=i+":"+s,a.category=u.CategoryBusiness,a.currency=t,a.amount=e,a[wt.TransactionNumKey]=wt.getTransactionNum(),o&&(a.cart_type=o),u.addDimensionsToEvent(a),u.addFieldsToEvent(a,wt.validateAndCleanCustomFields(n)),Pt.i("Add BUSINESS event: {currency:"+t+", amount:"+e+", itemType:"+i+", itemId:"+s+", cartType:"+o+"}"),u.addEventToStore(a)}else Tt.instance.sendSdkErrorEvent(At.Rejected)},u.addResourceEvent=function(t,e,i,s,o,n){if(wt.isEventSubmissionEnabled())if(kt.validateResourceEvent(t,e,i,s,o,wt.getAvailableResourceCurrencies(),wt.getAvailableResourceItemTypes())){t===ft.EGAResourceFlowType.Sink&&(i*=-1);var a={},r=u.resourceFlowTypeToString(t);a.event_id=r+":"+e+":"+s+":"+o,a.category=u.CategoryResource,a.amount=i,u.addDimensionsToEvent(a),u.addFieldsToEvent(a,wt.validateAndCleanCustomFields(n)),Pt.i("Add RESOURCE event: {currency:"+e+", amount:"+i+", itemType:"+s+", itemId:"+o+"}"),u.addEventToStore(a)}else Tt.instance.sendSdkErrorEvent(At.Rejected)},u.addProgressionEvent=function(t,e,i,s,o,n,a){if(wt.isEventSubmissionEnabled()){var r=u.progressionStatusToString(t);if(kt.validateProgressionEvent(t,e,i,s)){var h,l={};h=i?s?e+":"+i+":"+s:e+":"+i:e,l.category=u.CategoryProgression,l.event_id=r+":"+h;var c=0;n&&t!=ft.EGAProgressionStatus.Start&&(l.score=o),t===ft.EGAProgressionStatus.Fail&&wt.incrementProgressionTries(h),t===ft.EGAProgressionStatus.Complete&&(wt.incrementProgressionTries(h),c=wt.getProgressionTries(h),l.attempt_num=c,wt.clearProgressionTries(h)),u.addDimensionsToEvent(l),u.addFieldsToEvent(l,wt.validateAndCleanCustomFields(a)),Pt.i("Add PROGRESSION event: {status:"+r+", progression01:"+e+", progression02:"+i+", progression03:"+s+", score:"+o+", attempt:"+c+"}"),u.addEventToStore(l)}else Tt.instance.sendSdkErrorEvent(At.Rejected)}},u.addDesignEvent=function(t,e,i,s){if(wt.isEventSubmissionEnabled())if(kt.validateDesignEvent(t,e)){var o={};o.category=u.CategoryDesign,o.event_id=t,i&&(o.value=e),u.addDimensionsToEvent(o),u.addFieldsToEvent(o,wt.validateAndCleanCustomFields(s)),Pt.i("Add DESIGN event: {eventId:"+t+", value:"+e+"}"),u.addEventToStore(o)}else Tt.instance.sendSdkErrorEvent(At.Rejected)},u.addErrorEvent=function(t,e,i){if(wt.isEventSubmissionEnabled()){var s=u.errorSeverityToString(t);if(kt.validateErrorEvent(t,e)){var o={};o.category=u.CategoryError,o.severity=s,o.message=e,u.addDimensionsToEvent(o),u.addFieldsToEvent(o,wt.validateAndCleanCustomFields(i)),Pt.i("Add ERROR event: {severity:"+s+", message:"+e+"}"),u.addEventToStore(o)}else Tt.instance.sendSdkErrorEvent(At.Rejected)}},u.processEvents=function(t,e){if(wt.isEventSubmissionEnabled())try{var i=_t.createGuid();e&&(u.cleanupEvents(),u.fixMissingSessionEndEvents());var s=[];s.push(["status",bt.Equal,"new"]);var o=[];o.push(["status",bt.Equal,"new"]),t&&(s.push(["category",bt.Equal,t]),o.push(["category",bt.Equal,t]));var n=[];n.push(["status",i]);var a=vt.select(xt.Events,s);if(!a||0==a.length)return Pt.i("Event queue: No events to send"),void u.updateSessionStore();if(a.length>u.MaxEventCount){if(!(a=vt.select(xt.Events,s,!0,u.MaxEventCount)))return;var r=a[a.length-1].client_ts;if(s.push(["client_ts",bt.LessOrEqual,r]),!(a=vt.select(xt.Events,s)))return;o.push(["client_ts",bt.LessOrEqual,r])}if(Pt.i("Event queue: Sending "+a.length+" events."),!vt.update(xt.Events,n,o))return;for(var h=[],l=0;la[0]&&e[1]t.strokeWidth&&(e=t.trailWidth);var i=50-e/2;return o.render(this._pathTemplate,{radius:i,"2radius":2*i})},n.prototype._trailString=function(t){return this._pathString(t)},e.exports=n},{"./shape":7,"./utils":9}],3:[function(t,e,i){var s=t("./shape"),o=t("./utils"),n=function(t,e){this._pathTemplate="M 0,{center} L 100,{center}",s.apply(this,arguments)};((n.prototype=new s).constructor=n).prototype._initializeSvg=function(t,e){t.setAttribute("viewBox","0 0 100 "+e.strokeWidth),t.setAttribute("preserveAspectRatio","none")},n.prototype._pathString=function(t){return o.render(this._pathTemplate,{center:t.strokeWidth/2})},n.prototype._trailString=function(t){return this._pathString(t)},e.exports=n},{"./shape":7,"./utils":9}],4:[function(t,e,i){e.exports={Line:t("./line"),Circle:t("./circle"),SemiCircle:t("./semicircle"),Square:t("./square"),Path:t("./path"),Shape:t("./shape"),utils:t("./utils")}},{"./circle":2,"./line":3,"./path":5,"./semicircle":6,"./shape":7,"./square":8,"./utils":9}],5:[function(t,e,i){var c=t("shifty"),p=t("./utils"),s={easeIn:"easeInCubic",easeOut:"easeOutCubic",easeInOut:"easeInOutCubic"},o=function t(e,i){if(!(this instanceof t))throw new Error("Constructor was called without new keyword");var s;i=p.extend({duration:800,easing:"linear",from:{},to:{},step:function(){}},i),s=p.isString(e)?document.querySelector(e):e,this.path=s,this._opts=i,this._tweenable=null;var o=this.path.getTotalLength();this.path.style.strokeDasharray=o+" "+o,this.set(0)};o.prototype.value=function(){var t=this._getComputedDashOffset(),e=this.path.getTotalLength(),i=1-t/e;return parseFloat(i.toFixed(6),10)},o.prototype.set=function(t){this.stop(),this.path.style.strokeDashoffset=this._progressToOffset(t);var e=this._opts.step;if(p.isFunction(e)){var i=this._easing(this._opts.easing),s=this._calculateTo(t,i),o=this._opts.shape||this;e(s,o,this._opts.attachment)}},o.prototype.stop=function(){this._stopTween(),this.path.style.strokeDashoffset=this._getComputedDashOffset()},o.prototype.animate=function(t,i,e){i=i||{},p.isFunction(i)&&(e=i,i={});var s=p.extend({},i),o=p.extend({},this._opts);i=p.extend(o,i);var n=this._easing(i.easing),a=this._resolveFromAndTo(t,n,s);this.stop(),this.path.getBoundingClientRect();var r=this._getComputedDashOffset(),h=this._progressToOffset(t),l=this;this._tweenable=new c,this._tweenable.tween({from:p.extend({offset:r},a.from),to:p.extend({offset:h},a.to),duration:i.duration,easing:n,step:function(t){l.path.style.strokeDashoffset=t.offset;var e=i.shape||l;i.step(t,e,i.attachment)},finish:function(t){p.isFunction(e)&&e()}})},o.prototype._getComputedDashOffset=function(){var t=window.getComputedStyle(this.path,null);return parseFloat(t.getPropertyValue("stroke-dashoffset"),10)},o.prototype._progressToOffset=function(t){var e=this.path.getTotalLength();return e-t*e},o.prototype._resolveFromAndTo=function(t,e,i){return i.from&&i.to?{from:i.from,to:i.to}:{from:this._calculateFrom(e),to:this._calculateTo(t,e)}},o.prototype._calculateFrom=function(t){return c.interpolate(this._opts.from,this._opts.to,this.value(),t)},o.prototype._calculateTo=function(t,e){return c.interpolate(this._opts.from,this._opts.to,t,e)},o.prototype._stopTween=function(){null!==this._tweenable&&(this._tweenable.stop(),this._tweenable=null)},o.prototype._easing=function(t){return s.hasOwnProperty(t)?s[t]:t},e.exports=o},{"./utils":9,shifty:1}],6:[function(t,e,i){var s=t("./shape"),o=t("./circle"),n=t("./utils"),a=function(t,e){this._pathTemplate="M 50,50 m -{radius},0 a {radius},{radius} 0 1 1 {2radius},0",this.containerAspectRatio=2,s.apply(this,arguments)};((a.prototype=new s).constructor=a).prototype._initializeSvg=function(t,e){t.setAttribute("viewBox","0 0 100 50")},a.prototype._initializeTextContainer=function(t,e,i){t.text.style&&(i.style.top="auto",i.style.bottom="0",t.text.alignToBottom?n.setStyle(i,"transform","translate(-50%, 0)"):n.setStyle(i,"transform","translate(-50%, 50%)"))},a.prototype._pathString=o.prototype._pathString,a.prototype._trailString=o.prototype._trailString,e.exports=a},{"./circle":2,"./shape":7,"./utils":9}],7:[function(t,e,i){var a=t("./path"),r=t("./utils"),s="Object is destroyed",o=function t(e,i){if(!(this instanceof t))throw new Error("Constructor was called without new keyword");if(0!==arguments.length){this._opts=r.extend({color:"#555",strokeWidth:1,trailColor:null,trailWidth:null,fill:null,text:{style:{color:null,position:"absolute",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0,value:null,className:"progressbar-text"},svgStyle:{display:"block",width:"100%"},warnings:!1},i,!0),r.isObject(i)&&void 0!==i.svgStyle&&(this._opts.svgStyle=i.svgStyle),r.isObject(i)&&r.isObject(i.text)&&void 0!==i.text.style&&(this._opts.text.style=i.text.style);var s,o=this._createSvgView(this._opts);if(!(s=r.isString(e)?document.querySelector(e):e))throw new Error("Container does not exist: "+e);this._container=s,this._container.appendChild(o.svg),this._opts.warnings&&this._warnContainerAspectRatio(this._container),this._opts.svgStyle&&r.setStyles(o.svg,this._opts.svgStyle),this.svg=o.svg,this.path=o.path,this.trail=o.trail,this.text=null;var n=r.extend({attachment:void 0,shape:this},this._opts);this._progressPath=new a(o.path,n),r.isObject(this._opts.text)&&null!==this._opts.text.value&&this.setText(this._opts.text.value)}};o.prototype.animate=function(t,e,i){if(null===this._progressPath)throw new Error(s);this._progressPath.animate(t,e,i)},o.prototype.stop=function(){if(null===this._progressPath)throw new Error(s);void 0!==this._progressPath&&this._progressPath.stop()},o.prototype.destroy=function(){if(null===this._progressPath)throw new Error(s);this.stop(),this.svg.parentNode.removeChild(this.svg),this.svg=null,this.path=null,this.trail=null,(this._progressPath=null)!==this.text&&(this.text.parentNode.removeChild(this.text),this.text=null)},o.prototype.set=function(t){if(null===this._progressPath)throw new Error(s);this._progressPath.set(t)},o.prototype.value=function(){if(null===this._progressPath)throw new Error(s);return void 0===this._progressPath?0:this._progressPath.value()},o.prototype.setText=function(t){if(null===this._progressPath)throw new Error(s);null===this.text&&(this.text=this._createTextContainer(this._opts,this._container),this._container.appendChild(this.text)),r.isObject(t)?(r.removeChildren(this.text),this.text.appendChild(t)):this.text.innerHTML=t},o.prototype._createSvgView=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");this._initializeSvg(e,t);var i=null;(t.trailColor||t.trailWidth)&&(i=this._createTrail(t),e.appendChild(i));var s=this._createPath(t);return e.appendChild(s),{svg:e,path:s,trail:i}},o.prototype._initializeSvg=function(t,e){t.setAttribute("viewBox","0 0 100 100")},o.prototype._createPath=function(t){var e=this._pathString(t);return this._createPathElement(e,t)},o.prototype._createTrail=function(t){var e=this._trailString(t),i=r.extend({},t);return i.trailColor||(i.trailColor="#eee"),i.trailWidth||(i.trailWidth=i.strokeWidth),i.color=i.trailColor,i.strokeWidth=i.trailWidth,i.fill=null,this._createPathElement(e,i)},o.prototype._createPathElement=function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",t),i.setAttribute("stroke",e.color),i.setAttribute("stroke-width",e.strokeWidth),e.fill?i.setAttribute("fill",e.fill):i.setAttribute("fill-opacity","0"),i},o.prototype._createTextContainer=function(t,e){var i=document.createElement("div");i.className=t.text.className;var s=t.text.style;return s&&(t.text.autoStyleContainer&&(e.style.position="relative"),r.setStyles(i,s),s.color||(i.style.color=t.color)),this._initializeTextContainer(t,e,i),i},o.prototype._initializeTextContainer=function(t,e,i){},o.prototype._pathString=function(t){throw new Error("Override this function for each progress bar")},o.prototype._trailString=function(t){throw new Error("Override this function for each progress bar")},o.prototype._warnContainerAspectRatio=function(t){if(this.containerAspectRatio){var e=window.getComputedStyle(t,null),i=parseFloat(e.getPropertyValue("width"),10),s=parseFloat(e.getPropertyValue("height"),10);r.floatEquals(this.containerAspectRatio,i/s)}},e.exports=o},{"./path":5,"./utils":9}],8:[function(t,e,i){var s=t("./shape"),o=t("./utils"),n=function(t,e){this._pathTemplate="M 0,{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{strokeWidth}",this._trailTemplate="M {startMargin},{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{halfOfStrokeWidth}",s.apply(this,arguments)};((n.prototype=new s).constructor=n).prototype._pathString=function(t){var e=100-t.strokeWidth/2;return o.render(this._pathTemplate,{width:e,strokeWidth:t.strokeWidth,halfOfStrokeWidth:t.strokeWidth/2})},n.prototype._trailString=function(t){var e=100-t.strokeWidth/2;return o.render(this._trailTemplate,{width:e,strokeWidth:t.strokeWidth,halfOfStrokeWidth:t.strokeWidth/2,startMargin:t.strokeWidth/2-t.trailWidth/2})},e.exports=n},{"./shape":7,"./utils":9}],9:[function(t,e,i){var a="Webkit Moz O ms".split(" ");function s(t,e,i){for(var s=t.style,o=0;o\n \n
\n
\n
\n \n
\n \n
\n
\n
'+i+"
\n ",n=document.head||document.getElementsByTagName("head")[0],(a=document.createElement("style")).type="text/css",a.styleSheet?a.styleSheet.cssText=s:a.appendChild(document.createTextNode(s)),n.appendChild(a),(r=document.createElement("div")).innerHTML=o,r.id="h5branding-container",(h=document.body||document.getElementsByTagName("body")[0]).insertBefore(r,h.firstChild),this.circleLoader=new Zt.Circle("#h5branding-bar",{strokeWidth:3,color:this.options.barColor}),[4,Promise.all([this.loadBranding(),this.loadLibs(),T.preload()])];case 1:return t.sent(),this.loaded=!0,[2]}var e,i})})},e.prototype.loadBranding=function(){return Jt(this,void 0,void 0,function(){var e,i,s;return Qt(this,function(t){switch(t.label){case 0:return[4,_.preload(Date.now().toString())];case 1:return t.sent(),(e=document.getElementById("h5branding-background"))&&(e.style.backgroundImage="url("+this.getGameLogoUrl(this.options.gameId)+")",e.style.backgroundColor=_.brandingBackgroundColor),(i=document.getElementById("h5branding-logo"))&&S.getBrandingDomain()!==h.BrandingDomain.Neutral&&((s=document.createElement("img")).src=_.brandingLogoUrl.replace("_small",""),i.appendChild(s)),[2]}})})},e.prototype.loadLibs=function(){var i=this,s=this.options.libs.map(function(t,e){return a.instance.loadScript(t,!0,function(){i.setScriptloadProgress(s.length,e+1)})});return Promise.all(s)},Object.defineProperty(e.prototype,"bannerAllowed",{get:function(){var t=document.body.clientWidth,e=document.body.clientHeight;return this.progress<100&&!(et.vertices.length)throw new Error("lol2");if(e<0)throw new Error("lol3");for(var s=e;se[t][0])&&(t=i);P.left(this.at(t-1),this.at(t),this.at(t+1))||this.reverse()},_.prototype.reverse=function(){for(var t=[],e=0,i=this.vertices.length;e!==i;e++)t.push(this.vertices.pop());this.vertices=t},_.prototype.isReflex=function(t){return P.right(this.at(t-1),this.at(t),this.at(t+1))};var h=[],l=[];function S(t,e,i,s,o){o=o||0;var n=e[1]-t[1],a=t[0]-e[0],r=n*t[0]+a*t[1],h=s[1]-i[1],l=i[0]-s[0],c=h*i[0]+l*i[1],p=n*l-h*a;return u.eq(p,0,o)?[0,0]:[(l*r-a*c)/p,(n*c-h*r)/p]}_.prototype.canSee=function(t,e){var i,s,o=h,n=l;if(P.leftOn(this.at(t+1),this.at(t),this.at(e))&&P.rightOn(this.at(t-1),this.at(t),this.at(e)))return!1;s=P.sqdist(this.at(t),this.at(e));for(var a=0;a!==this.vertices.length;++a)if((a+1)%this.vertices.length!==t&&a!==t&&P.leftOn(this.at(t),this.at(e),this.at(a+1))&&P.rightOn(this.at(t),this.at(e),this.at(a))&&(o[0]=this.at(t),o[1]=this.at(e),n[0]=this.at(a),n[1]=this.at(a+1),i=r.lineInt(o,n),P.sqdist(this.at(t),i) (http://steffe.se)",keywords:["p2.js","p2","physics","engine","2d"],main:"./src/p2.js",engines:{node:"*"},repository:{type:"git",url:"https://github.com/schteppe/p2.js.git"},bugs:{url:"https://github.com/schteppe/p2.js/issues"},licenses:[{type:"MIT"}],devDependencies:{grunt:"^0.4.5","grunt-contrib-jshint":"^0.11.2","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-uglify":"~0.4.0","grunt-contrib-watch":"~0.5.0","grunt-browserify":"~2.0.1","grunt-contrib-concat":"^0.4.0"},dependencies:{"poly-decomp":"0.1.0"}}},{}],7:[function(t,e,i){var d=t("../math/vec2");t("../utils/Utils");function s(t){this.lowerBound=d.create(),t&&t.lowerBound&&d.copy(this.lowerBound,t.lowerBound),this.upperBound=d.create(),t&&t.upperBound&&d.copy(this.upperBound,t.upperBound)}e.exports=s;var y=d.create();s.prototype.setFromPoints=function(t,e,i,s){var o=this.lowerBound,n=this.upperBound;"number"!=typeof i&&(i=0),0!==i?d.rotate(o,t[0],i):d.copy(o,t[0]),d.copy(n,o);for(var a=Math.cos(i),r=Math.sin(i),h=1;hn[u]&&(n[u]=l[u]),l[u]i&&(this.lowerBound[e]=i);var s=t.upperBound[e];this.upperBound[e]Math.pow(u,2))return 0;if(h)return!0;var d=this.createContactEquation(t,o,e,n);return H(d.normalA,a,i),V.normalize(d.normalA,d.normalA),V.scale(d.contactPointA,d.normalA,l),V.scale(d.contactPointB,d.normalA,-c),z(d.contactPointA,d.contactPointA,i),H(d.contactPointA,d.contactPointA,t.position),z(d.contactPointB,d.contactPointB,a),H(d.contactPointB,d.contactPointB,o.position),this.contactEquations.push(d),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(d)),1},$.prototype[l.PLANE|l.CONVEX]=$.prototype[l.PLANE|l.BOX]=$.prototype.planeConvex=function(t,e,i,s,o,n,a,r,h){var l=j,c=W,p=q,u=0;V.rotate(c,S,s);for(var d=0;d!==n.vertices.length;d++){var y=n.vertices[d];if(V.rotate(l,y,r),z(l,l,a),H(p,l,i),X(p,c)<=0){if(h)return!0;u++;var g=this.createContactEquation(t,o,e,n);H(p,l,i),V.copy(g.normalA,c);var f=X(p,g.normalA);V.scale(p,g.normalA,f),H(g.contactPointB,l,o.position),H(g.contactPointA,l,p),H(g.contactPointA,g.contactPointA,t.position),this.contactEquations.push(g),this.enableFrictionReduction||this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(g))}}return this.enableFrictionReduction&&this.enableFriction&&u&&this.frictionEquations.push(this.createFrictionFromAverage(u)),u},$.prototype[l.PARTICLE|l.PLANE]=$.prototype.particlePlane=function(t,e,i,s,o,n,a,r,h){var l=j,c=W;r=r||0,H(l,i,a),V.rotate(c,S,r);var p=X(l,c);if(0Math.pow(e.radius,2))return 0;if(h)return!0;var c=this.createContactEquation(t,o,e,n);return V.copy(c.normalA,l),V.normalize(c.normalA,c.normalA),V.scale(c.contactPointA,c.normalA,e.radius),z(c.contactPointA,c.contactPointA,i),H(c.contactPointA,c.contactPointA,t.position),H(c.contactPointB,a,o.position),this.contactEquations.push(c),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(c)),1};var T=new r({radius:1}),k=V.create(),A=V.create();V.create();$.prototype[l.PLANE|l.CAPSULE]=$.prototype.planeCapsule=function(t,e,i,s,o,n,a,r,h){var l,c=k,p=A,u=T;V.set(c,-n.length/2,0),V.rotate(c,c,r),z(c,c,a),V.set(p,n.length/2,0),V.rotate(p,p,r),z(p,p,a),u.radius=n.radius,this.enableFrictionReduction&&(l=this.enableFriction,this.enableFriction=!1);var d=this.circlePlane(o,u,c,0,t,e,i,s,h),y=this.circlePlane(o,u,p,0,t,e,i,s,h);if(this.enableFrictionReduction&&(this.enableFriction=l),h)return d||y;var g=d+y;return this.enableFrictionReduction&&g&&this.frictionEquations.push(this.createFrictionFromAverage(g)),g},$.prototype[l.CIRCLE|l.PLANE]=$.prototype.circlePlane=function(t,e,i,s,o,n,a,r,h){var l=t,c=e,p=i,u=o,d=a,y=r;y=y||0;var g=j,f=W,m=q;H(g,p,d),V.rotate(f,S,y);var v=X(f,g);if(v>c.radius)return 0;if(h)return!0;var x=this.createContactEquation(u,l,n,e);return V.copy(x.normalA,f),V.scale(x.contactPointB,x.normalA,-c.radius),z(x.contactPointB,x.contactPointB,p),H(x.contactPointB,x.contactPointB,l.position),V.scale(m,x.normalA,v),H(x.contactPointA,g,m),z(x.contactPointA,x.contactPointA,d),H(x.contactPointA,x.contactPointA,u.position),this.contactEquations.push(x),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(x)),1},$.prototype[l.CONVEX]=$.prototype[l.CONVEX|l.BOX]=$.prototype[l.BOX]=$.prototype.convexConvex=function(t,e,i,s,o,n,a,r,h,l){var c=j,p=W,u=q,d=Y,y=K,g=J,f=Q,m=Z,v=0;l="number"==typeof l?l:0;if(!$.findSeparatingAxis(e,i,s,n,a,r,c))return 0;H(f,a,i),0g[0]&&(w=y,b=g,!0),h=(P=w[0]-b[1])<=0,(null===r||rg[0]&&(w=y,b=g,!0),h=(P=w[0]-b[1])<=0,(null===r||r=c.length&&(b=c.length-1);for(var w=c[x],P=c[b],_=x;_w&&(w=c[_]);if(i[1]-l>w)return!h&&0;var S=!1;for(_=x;_=m[0]&&d[0]=l.length&&(f=l.length-1);for(var m=l[g],v=l[f],x=g;xm&&(m=l[x]);if(t.aabb.lowerBound[1]>m)return!h&&0;var b=0;for(x=g;xe.boundingRadius*e.boundingRadius||(this._currentBody=o,(this._currentShape=e).raycast(t,this,s,i),this._currentBody=this._currentShape=null)},a.prototype.getAABB=function(t){var e=this.to,i=this.from;h.set(t.lowerBound,Math.min(e[0],i[0]),Math.min(e[1],i[1])),h.set(t.upperBound,Math.max(e[0],i[0]),Math.max(e[1],i[1]))};h.create();a.prototype.reportIntersection=function(t,e,i,s){this.from,this.to;var o=this._currentShape,n=this._currentBody;if(!(this.skipBackfaces&&0this.upperLimit&&(n.maxForce=0,n.minForce=-this.maxForce,this.distance=this.upperLimit,r=!0),this.lowerLimitEnabled&&this.position>1;if(e<3)return[];for(var i=[],s=[],o=0;o3*n)break}return i.push(s[0],s[1],s[2]),i},_PointInTriangle:function(t,e,i,s,o,n,a,r){var h=a-i,l=r-s,c=o-i,p=n-s,u=t-i,d=e-s,y=h*h+l*l,g=h*c+l*p,f=h*u+l*d,m=c*c+p*p,v=c*u+p*d,x=1/(y*m-g*g),b=(m*f-g*v)*x,w=(y*v-g*f)*x;return 0<=b&&0<=w&&b+w<1},_convex:function(t,e,i,s,o,n){return 0<=(e-s)*(o-i)+(i-t)*(n-s)}};e.exports=v},{}],30:[function(t,e,i){var a=e.exports={},s=t("../utils/Utils");a.crossLength=function(t,e){return t[0]*e[1]-t[1]*e[0]},a.crossVZ=function(t,e,i){return a.rotate(t,e,-Math.PI/2),a.scale(t,t,i),t},a.crossZV=function(t,e,i){return a.rotate(t,i,Math.PI/2),a.scale(t,t,e),t},a.rotate=function(t,e,i){if(0!==i){var s=Math.cos(i),o=Math.sin(i),n=e[0],a=e[1];t[0]=s*n-o*a,t[1]=o*n+s*a}else t[0]=e[0],t[1]=e[1]},a.rotate90cw=function(t,e){var i=e[0],s=e[1];t[0]=s,t[1]=-i},a.toLocalFrame=function(t,e,i,s){a.copy(t,e),a.sub(t,t,i),a.rotate(t,t,-s)},a.toGlobalFrame=function(t,e,i,s){a.copy(t,e),a.rotate(t,t,s),a.add(t,t,i)},a.vectorToLocalFrame=function(t,e,i){a.rotate(t,e,-i)},a.vectorToGlobalFrame=function(t,e,i){a.rotate(t,e,i)},a.centroid=function(t,e,i,s){return a.add(t,e,i),a.add(t,t,s),a.scale(t,t,1/3),t},a.create=function(){var t=new s.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},a.clone=function(t){var e=new s.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},a.fromValues=function(t,e){var i=new s.ARRAY_TYPE(2);return i[0]=t,i[1]=e,i},a.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},a.set=function(t,e,i){return t[0]=e,t[1]=i,t},a.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},a.subtract=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t},a.sub=a.subtract,a.multiply=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t},a.mul=a.multiply,a.divide=function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t},a.div=a.divide,a.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},a.distance=function(t,e){var i=e[0]-t[0],s=e[1]-t[1];return Math.sqrt(i*i+s*s)},a.dist=a.distance,a.squaredDistance=function(t,e){var i=e[0]-t[0],s=e[1]-t[1];return i*i+s*s},a.sqrDist=a.squaredDistance,a.length=function(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)},a.len=a.length,a.squaredLength=function(t){var e=t[0],i=t[1];return e*e+i*i},a.sqrLen=a.squaredLength,a.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},a.normalize=function(t,e){var i=e[0],s=e[1],o=i*i+s*s;return 0this.sleepTimeLimit&&(e?this.wantsToSleep=!0:this.sleep())}},r.prototype.overlaps=function(t){return this.world.overlapKeeper.bodiesAreOverlapping(this,t)};var _=p.create(),S=p.create();r.prototype.integrate=function(t){var e=this.invMass,i=this.force,s=this.position,o=this.velocity;p.copy(this.previousPosition,this.position),this.previousAngle=this.angle,this.fixedRotation||(this.angularVelocity+=this.angularForce*this.invInertia*t),p.scale(_,i,t*e),p.multiply(_,this.massMultiplier,_),p.add(o,_,o),this.integrateToTimeOfImpact(t)||(p.scale(S,o,t),p.add(s,s,S),this.fixedRotation||(this.angle+=this.angularVelocity*t)),this.aabbNeedsUpdate=!0};var T=new s,k=new o({mode:o.ALL}),A=p.create(),B=p.create(),C=p.create(),E=p.create();r.prototype.integrateToTimeOfImpact=function(t){if(this.ccdSpeedThreshold<0||p.squaredLength(this.velocity)d&&(P.sub(r,a,h),P.normalize(r,r),e.reportIntersection(t,y,r,-1),t.shouldStop(e)))return}else{var v=Math.sqrt(y),x=1/(2*g),b=(-f-v)*x,w=(-f+v)*x;if(0<=b&&b<=1&&(P.lerp(a,o,n,b),P.squaredDistance(a,i)>d&&(P.sub(r,a,h),P.normalize(r,r),e.reportIntersection(t,b,r,-1),t.shouldStop(e))))return;if(0<=w&&w<=1&&(P.lerp(a,o,n,w),P.squaredDistance(a,i)>d&&(P.sub(r,a,h),P.normalize(r,r),e.reportIntersection(t,w,r,-1),t.shouldStop(e))))return}}}},{"../math/vec2":30,"./Shape":45}],39:[function(t,e,i){var s=t("./Shape"),m=t("../math/vec2");function o(t){"number"==typeof t&&(t={radius:t}),t=t||{},this.radius=t.radius||1,t.type=s.CIRCLE,s.call(this,t)}(((e.exports=o).prototype=new s).constructor=o).prototype.computeMomentOfInertia=function(t){var e=this.radius;return t*e*e/2},o.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius},o.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius},o.prototype.computeAABB=function(t,e,i){var s=this.radius;m.set(t.upperBound,s,s),m.set(t.lowerBound,-s,-s),e&&(m.add(t.lowerBound,t.lowerBound,e),m.add(t.upperBound,t.upperBound,e))};var v=m.create(),x=m.create();o.prototype.raycast=function(t,e,i,s){var o=e.from,n=e.to,a=this.radius,r=Math.pow(n[0]-o[0],2)+Math.pow(n[1]-o[1],2),h=2*((n[0]-o[0])*(o[0]-i[0])+(n[1]-o[1])*(o[1]-i[1])),l=Math.pow(o[0]-i[0],2)+Math.pow(o[1]-i[1],2)-Math.pow(a,2),c=Math.pow(h,2)-4*r*l,p=v,u=x;if(!(c<0))if(0===c)m.lerp(p,o,n,c),m.sub(u,p,i),m.normalize(u,u),e.reportIntersection(t,c,u,-1);else{var d=Math.sqrt(c),y=1/(2*r),g=(-h-d)*y,f=(-h+d)*y;if(0<=g&&g<=1&&(m.lerp(p,o,n,g),m.sub(u,p,i),m.normalize(u,u),e.reportIntersection(t,g,u,-1),t.shouldStop(e)))return;0<=f&&f<=1&&(m.lerp(p,o,n,f),m.sub(u,p,i),m.normalize(u,u),e.reportIntersection(t,f,u,-1))}}},{"../math/vec2":30,"./Shape":45}],40:[function(t,e,i){var h=t("./Shape"),d=t("../math/vec2"),r=t("../math/polyk");t("poly-decomp");function u(t){Array.isArray(t)&&(t={vertices:t,axes:arguments[1]}),t=t||{},this.vertices=[];for(var e=void 0!==t.vertices?t.vertices:[],i=0;it;)e.pop();for(;e.length=t&&s=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},L.DisplayObjectContainer.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},L.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);if(-1!==e)return this.removeChildAt(e)},L.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e&&(e.parent=void 0,this.children.splice(t,1)),e},L.DisplayObjectContainer.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var i=e-t;if(0>16&255)/255,(t>>8&255)/255,(255&t)/255]},L.rgb2hex=function(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]},L.canUseNewCanvasBlendModes=function(){if(void 0===document)return!1;var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",e="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",i=new Image;i.src=t+"AP804Oa6"+e;var s=new Image;s.src=t+"/wCKxvRF"+e;var o=L.CanvasPool.create(this,6,1).getContext("2d");if(o.globalCompositeOperation="multiply",o.drawImage(i,0,0),o.drawImage(s,2,0),!o.getImageData(2,0,1,1))return!1;var n=o.getImageData(2,0,1,1).data;return L.CanvasPool.remove(this),255===n[0]&&0===n[1]&&0===n[2]},L.getNextPowerOfTwo=function(t){if(0=this.size&&(this.flush(),this.currentBaseTexture=i.baseTexture);var o=i._uvs;if(o){var n,a,r,h,l=t.anchor.x,c=t.anchor.y;if(i.trim){var p=i.trim;n=(a=p.x-l*p.width)+i.crop.width,r=(h=p.y-c*p.height)+i.crop.height}else n=i.frame.width*(1-l),a=i.frame.width*-l,r=i.frame.height*(1-c),h=i.frame.height*-c;var u=4*this.currentBatchSize*this.vertSize,d=i.baseTexture.resolution,y=s.a/d,g=s.b/d,f=s.c/d,m=s.d/d,v=s.tx,x=s.ty,b=this.colors,w=this.positions;this.renderSession.roundPixels?(w[u]=y*a+f*h+v|0,w[u+1]=m*h+g*a+x|0,w[u+5]=y*n+f*h+v|0,w[u+6]=m*h+g*n+x|0,w[u+10]=y*n+f*r+v|0,w[u+11]=m*r+g*n+x|0,w[u+15]=y*a+f*r+v|0,w[u+16]=m*r+g*a+x|0):(w[u]=y*a+f*h+v,w[u+1]=m*h+g*a+x,w[u+5]=y*n+f*h+v,w[u+6]=m*h+g*n+x,w[u+10]=y*n+f*r+v,w[u+11]=m*r+g*n+x,w[u+15]=y*a+f*r+v,w[u+16]=m*r+g*a+x),w[u+2]=o.x0,w[u+3]=o.y0,w[u+7]=o.x1,w[u+8]=o.y1,w[u+12]=o.x2,w[u+13]=o.y2,w[u+17]=o.x3,w[u+18]=o.y3;var P=t.tint;b[u+4]=b[u+9]=b[u+14]=b[u+19]=(P>>16)+(65280&P)+((255&P)<<16)+(255*t.worldAlpha<<24),this.sprites[this.currentBatchSize++]=t}},L.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var e=t.tilingTexture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture),t._uvs||(t._uvs=new L.TextureUvs);var i=t._uvs,s=e.baseTexture.width,o=e.baseTexture.height;t.tilePosition.x%=s*t.tileScaleOffset.x,t.tilePosition.y%=o*t.tileScaleOffset.y;var n=t.tilePosition.x/(s*t.tileScaleOffset.x),a=t.tilePosition.y/(o*t.tileScaleOffset.y),r=t.width/s/(t.tileScale.x*t.tileScaleOffset.x),h=t.height/o/(t.tileScale.y*t.tileScaleOffset.y);i.x0=0-n,i.y0=0-a,i.x1=1*r-n,i.y1=0-a,i.x2=1*r-n,i.y2=1*h-a,i.x3=0-n,i.y3=1*h-a;var l=t.tint,c=(l>>16)+(65280&l)+((255&l)<<16)+(255*t.worldAlpha<<24),p=this.positions,u=this.colors,d=t.width,y=t.height,g=t.anchor.x,f=t.anchor.y,m=d*(1-g),v=d*-g,x=y*(1-f),b=y*-f,w=4*this.currentBatchSize*this.vertSize,P=e.baseTexture.resolution,_=t.worldTransform,S=_.a/P,T=_.b/P,k=_.c/P,A=_.d/P,B=_.tx,C=_.ty;p[w++]=S*v+k*b+B,p[w++]=A*b+T*v+C,p[w++]=i.x0,p[w++]=i.y0,u[w++]=c,p[w++]=S*m+k*b+B,p[w++]=A*b+T*m+C,p[w++]=i.x1,p[w++]=i.y1,u[w++]=c,p[w++]=S*m+k*x+B,p[w++]=A*x+T*m+C,p[w++]=i.x2,p[w++]=i.y2,u[w++]=c,p[w++]=S*v+k*x+B,p[w++]=A*x+T*v+C,p[w++]=i.x3,p[w++]=i.y3,u[w++]=c,this.sprites[this.currentBatchSize++]=t},L.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,e,i,s,o=this.gl;if(this.dirty){this.dirty=!1,o.activeTexture(o.TEXTURE0),o.bindBuffer(o.ARRAY_BUFFER,this.vertexBuffer),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t=this.defaultShader.shaders[o.id];var n=4*this.vertSize;o.vertexAttribPointer(t.aVertexPosition,2,o.FLOAT,!1,n,0),o.vertexAttribPointer(t.aTextureCoord,2,o.FLOAT,!1,n,8),o.vertexAttribPointer(t.colorAttribute,4,o.UNSIGNED_BYTE,!0,n,16)}if(this.currentBatchSize>.5*this.size)o.bufferSubData(o.ARRAY_BUFFER,0,this.vertices);else{var a=this.positions.subarray(0,4*this.currentBatchSize*this.vertSize);o.bufferSubData(o.ARRAY_BUFFER,0,a)}for(var r,h=0,l=0,c=null,p=this.renderSession.blendModeManager.currentBlendMode,u=null,d=!1,y=!1,g=0,f=this.currentBatchSize;g=this.size&&this.flush()}},L.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]||this.renderSession.renderer.updateTexture(this.currentBaseTexture,t),t.bindTexture(t.TEXTURE_2D,this.currentBaseTexture._glTextures[t.id]),this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},L.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},L.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36)},L.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},L.WebGLFilterManager.prototype.constructor=L.WebGLFilterManager,L.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},L.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},L.WebGLFilterManager.prototype.pushFilter=function(t){var e=this.gl,i=this.renderSession.projection,s=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),t._previous_stencil_mgr=this.renderSession.stencilManager,this.renderSession.stencilManager=new L.WebGLStencilManager,this.renderSession.stencilManager.setContext(e),e.disable(e.STENCIL_TEST),this.filterStack.push(t);var o=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var n=this.texturePool.pop();n?n.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution):n=new L.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),e.bindTexture(e.TEXTURE_2D,n.texture);var a=t._filterArea,r=o.padding;a.x-=r,a.y-=r,a.width+=2*r,a.height+=2*r,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),e.bindFramebuffer(e.FRAMEBUFFER,n.frameBuffer),e.viewport(0,0,a.width*this.renderSession.resolution,a.height*this.renderSession.resolution),i.x=a.width/2,i.y=-a.height/2,s.x=-a.x,s.y=-a.y,e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),t._glFilterTexture=n},L.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,e=this.filterStack.pop(),i=e._filterArea,s=e._glFilterTexture,o=this.renderSession.projection,n=this.renderSession.offset;if(1this.baseTexture.width||t.y+t.height>this.baseTexture.height))this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs();else{if(!L.TextureSilentFail)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=!1}},L.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new L.TextureUvs);var t=this.crop,e=this.baseTexture.width,i=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/i,this._uvs.x1=(t.x+t.width)/e,this._uvs.y1=t.y/i,this._uvs.x2=(t.x+t.width)/e,this._uvs.y2=(t.y+t.height)/i,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.height)/i},L.Texture.fromCanvas=function(t,e){var i=L.BaseTexture.fromCanvas(t,e);return new L.Texture(i)},L.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},L.RenderTexture=function(t,e,i,s,o){if(this.width=t||100,this.height=e||100,this.resolution=o||1,this.frame=new L.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.crop=new L.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.baseTexture=new L.BaseTexture,this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution,this.baseTexture._glTextures=[],this.baseTexture.resolution=this.resolution,this.baseTexture.scaleMode=s||L.scaleModes.DEFAULT,this.baseTexture.hasLoaded=!0,L.Texture.call(this,this.baseTexture,new L.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution)),this.renderer=i||L.defaultRenderer,this.renderer.type===L.WEBGL_RENDERER){var n=this.renderer.gl;this.baseTexture._dirty[n.id]=!1,this.textureBuffer=new L.FilterTexture(n,this.width,this.height,this.baseTexture.scaleMode),this.baseTexture._glTextures[n.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new L.Point(.5*this.width,.5*-this.height)}else this.render=this.renderCanvas,this.textureBuffer=new L.CanvasBuffer(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this.tempMatrix=new Phaser.Matrix,this._updateUvs()},L.RenderTexture.prototype=Object.create(L.Texture.prototype),L.RenderTexture.prototype.constructor=L.RenderTexture,L.RenderTexture.prototype.resize=function(t,e,i){t===this.width&&e===this.height||(this.valid=0>>0;if("function"!=typeof t)throw new TypeError;for(var s=2<=arguments.length?arguments[1]:void 0,o=0;o=(t=t.toString()).length)switch(s){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var n=Math.ceil((o=e-t.length)/2);t=new Array(o-n+1).join(i)+t+new Array(n+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t},isPlainObject:function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},extend:function(){var t,e,i,s,o,n,a=arguments[0]||{},r=1,h=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[1]||{},r=2),h===r&&(a=this,--r);rthis.x?(this._radius=0,this._diameter=0):this.radius=this.x-t}}),Object.defineProperty(H.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(t){tthis.y?(this._radius=0,this._diameter=0):this.radius=this.y-t}}),Object.defineProperty(H.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(t){t=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius},H.Circle.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.diameter===e.diameter},H.Circle.intersects=function(t,e){return H.Math.distance(t.x,t.y,e.x,e.y)<=t.radius+e.radius},H.Circle.circumferencePoint=function(t,e,i,s){return void 0===i&&(i=!1),void 0===s&&(s=new H.Point),!0===i&&(e=H.Math.degToRad(e)),s.x=t.x+t.radius*Math.cos(e),s.y=t.y+t.radius*Math.sin(e),s},H.Circle.intersectsRectangle=function(t,e){var i=Math.abs(t.x-e.x-e.halfWidth);if(e.halfWidth+t.radius=this.right?this.width=0:this.width=this.right-t,this.x=t}}),Object.defineProperty(H.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}}),Object.defineProperty(H.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}}),Object.defineProperty(H.Rectangle.prototype,"perimeter",{get:function(){return 2*this.width+2*this.height}}),Object.defineProperty(H.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(t){this.x=t-this.halfWidth}}),Object.defineProperty(H.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(t){this.y=t-this.halfHeight}}),Object.defineProperty(H.Rectangle.prototype,"randomX",{get:function(){return this.x+Math.random()*this.width}}),Object.defineProperty(H.Rectangle.prototype,"randomY",{get:function(){return this.y+Math.random()*this.height}}),Object.defineProperty(H.Rectangle.prototype,"top",{get:function(){return this.y},set:function(t){t>=this.bottom?(this.height=0,this.y=t):this.height=this.bottom-t}}),Object.defineProperty(H.Rectangle.prototype,"topLeft",{get:function(){return new H.Point(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}}),Object.defineProperty(H.Rectangle.prototype,"topRight",{get:function(){return new H.Point(this.x+this.width,this.y)},set:function(t){this.right=t.x,this.y=t.y}}),Object.defineProperty(H.Rectangle.prototype,"empty",{get:function(){return!this.width||!this.height},set:function(t){!0===t&&this.setTo(0,0,0,0)}}),H.Rectangle.prototype.constructor=H.Rectangle,H.Rectangle.inflate=function(t,e,i){return t.x-=e,t.width+=2*e,t.y-=i,t.height+=2*i,t},H.Rectangle.inflatePoint=function(t,e){return H.Rectangle.inflate(t,e.x,e.y)},H.Rectangle.size=function(t,e){return null==e?e=new H.Point(t.width,t.height):e.setTo(t.width,t.height),e},H.Rectangle.clone=function(t,e){return null==e?e=new H.Rectangle(t.x,t.y,t.width,t.height):e.setTo(t.x,t.y,t.width,t.height),e},H.Rectangle.contains=function(t,e,i){return!(t.width<=0||t.height<=0)&&(e>=t.x&&e=t.y&&ie.volume)&&(t.x>=e.x&&t.y>=e.y&&t.righte.right||t.y>e.bottom)},H.Rectangle.intersectsRaw=function(t,e,i,s,o,n){return void 0===n&&(n=0),!(e>t.right+n||it.bottom+n||oi&&(i=t.x),t.xo&&(o=t.y),t.ythis.deadzone.right&&(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.deadzone.right,this.lerp.x)),this._edge=this._targetPosition.y-this.view.y,this._edgethis.deadzone.bottom&&(this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.deadzone.bottom,this.lerp.y))):(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.view.halfWidth,this.lerp.x),this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.view.halfHeight,this.lerp.y)),this.bounds&&this.checkBounds(),this.roundPx&&this.view.floor(),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},setBoundsToWorld:function(){this.bounds&&this.bounds.copyFrom(this.game.world.bounds)},checkBounds:function(){this.atLimit.x=!1,this.atLimit.y=!1;var t=this.view.x+this._shake.x,e=this.view.right+this._shake.x,i=this.view.y+this._shake.y,s=this.view.bottom+this._shake.y;t<=this.bounds.x*this.scale.x&&(this.atLimit.x=!0,this.view.x=this.bounds.x*this.scale.x,this._shake.shakeBounds||(this._shake.x=0)),e>=this.bounds.right*this.scale.x&&(this.atLimit.x=!0,this.view.x=this.bounds.right*this.scale.x-this.width,this._shake.shakeBounds||(this._shake.x=0)),i<=this.bounds.top*this.scale.y&&(this.atLimit.y=!0,this.view.y=this.bounds.top*this.scale.y,this._shake.shakeBounds||(this._shake.y=0)),s>=this.bounds.bottom*this.scale.y&&(this.atLimit.y=!0,this.view.y=this.bounds.bottom*this.scale.y-this.height,this._shake.shakeBounds||(this._shake.y=0))},setPosition:function(t,e){this.view.x=t,this.view.y=e,this.bounds&&this.checkBounds()},setSize:function(t,e){this.view.width=t,this.view.height=e},reset:function(){this.target=null,this.view.x=0,this.view.y=0,this._shake.duration=0,this.resetFX()},resetFX:function(){this.fx&&(this.fx.clear(),this.fx.alpha=0,this._fxDuration=0)}},H.Camera.prototype.constructor=H.Camera,Object.defineProperty(H.Camera.prototype,"x",{get:function(){return this.view.x},set:function(t){this.view.x=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(H.Camera.prototype,"y",{get:function(){return this.view.y},set:function(t){this.view.y=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(H.Camera.prototype,"position",{get:function(){return this._position.set(this.view.x,this.view.y),this._position},set:function(t){void 0!==t.x&&(this.view.x=t.x),void 0!==t.y&&(this.view.y=t.y),this.bounds&&this.checkBounds()}}),Object.defineProperty(H.Camera.prototype,"width",{get:function(){return this.view.width},set:function(t){this.view.width=t}}),Object.defineProperty(H.Camera.prototype,"height",{get:function(){return this.view.height},set:function(t){this.view.height=t}}),Object.defineProperty(H.Camera.prototype,"shakeIntensity",{get:function(){return this._shake.intensity},set:function(t){this._shake.intensity=t}}),H.State=function(){this.game=null,this.key="",this.add=null,this.make=null,this.camera=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.sound=null,this.scale=null,this.stage=null,this.state=null,this.time=null,this.tweens=null,this.world=null,this.particles=null,this.physics=null,this.rnd=null},H.State.prototype={init:function(){},preload:function(){},loadUpdate:function(){},loadRender:function(){},create:function(){},update:function(){},preRender:function(){},render:function(){},resize:function(){},paused:function(){},resumed:function(){},pauseUpdate:function(){},shutdown:function(){}},H.State.prototype.constructor=H.State,H.StateManager=function(t,e){this.game=t,this.states={},(this._pendingState=null)!=e&&(this._pendingState=e),this._clearWorld=!1,this._clearCache=!1,this._created=!1,this._args=[],this.current="",this.onStateChange=new H.Signal,this.onInitCallback=null,this.onPreloadCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPreRenderCallback=null,this.onLoadUpdateCallback=null,this.onLoadRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null,this.onShutDownCallback=null},H.StateManager.prototype={boot:function(){this.game.onPause.add(this.pause,this),this.game.onResume.add(this.resume,this),null!==this._pendingState&&"string"!=typeof this._pendingState&&this.add("default",this._pendingState,!0)},add:function(t,e,i){var s;return void 0===i&&(i=!1),e instanceof H.State?s=e:"object"==typeof e?(s=e).game=this.game:"function"==typeof e&&(s=new e(this.game)),this.states[t]=s,i&&(this.game.isBooted?this.start(t):this._pendingState=t),s},remove:function(t){this.current===t&&(this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onPreRenderCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null),delete this.states[t]},start:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1),this.checkState(t)&&(this._pendingState=t,this._clearWorld=e,this._clearCache=i,3=this.children.length?-1:this.getChildAt(t)},H.Group.prototype.create=function(t,e,i,s,o,n){void 0===o&&(o=!0);var a=new this.classType(this.game,t,e,i,s);return a.exists=o,a.visible=o,a.alive=o,this.add(a,!1,n)},H.Group.prototype.createMultiple=function(s,t,e,o){void 0===e&&(e=0),void 0===o&&(o=!1),Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);var n=this,a=[];return t.forEach(function(i){e.forEach(function(t){for(var e=0;ethis.children.length||-1===t&&-1===e)return!1;for(var a=new H.Rectangle(0,0,i,s),r=t*i,h=e*s,l=n;lthis.children.length-1&&(t=0),this.cursor)return this.cursorIndex=t,this.cursor=this.children[this.cursorIndex],this.cursor},H.Group.prototype.next=function(){if(this.cursor)return this.cursorIndex>=this.children.length-1?this.cursorIndex=0:this.cursorIndex++,this.cursor=this.children[this.cursorIndex],this.cursor},H.Group.prototype.previous=function(){if(this.cursor)return 0===this.cursorIndex?this.cursorIndex=this.children.length-1:this.cursorIndex--,this.cursor=this.children[this.cursorIndex],this.cursor},H.Group.prototype.swap=function(t,e){this.swapChildren(t,e),this.updateZ()},H.Group.prototype.bringToTop=function(t){return t.parent===this&&this.getIndex(t)this.children.length)return-1;this.getChildAt(t).x=e,this.getChildAt(t).y=i},H.Group.prototype.reverse=function(){this.children.reverse(),this.updateZ()},H.Group.prototype.getIndex=function(t){return this.children.indexOf(t)},H.Group.prototype.getByName=function(t){for(var e=0;ee[this._sortProperty]?1:t.ze[this._sortProperty]?-1:0},H.Group.prototype.iterate=function(t,e,i,s,o,n){if(0===this.children.length){if(i===H.Group.RETURN_TOTAL)return 0;if(i===H.Group.RETURN_ALL)return[]}var a=0;if(i===H.Group.RETURN_ALL)var r=[];for(var h=0;hthis.children.length)return!1;for(var o=e;t<=o;){!s&&this.children[o].events&&this.children[o].events.onRemovedFromGroup$dispatch(this.children[o],this);var n=this.removeChild(this.children[o]);this.removeFromHash(n),i&&n&&n.destroy(!0),this.cursor===this.children[o]&&(this.cursor=null),o--}this.updateZ()}},H.Group.prototype.destroy=function(t,e){null===this.game||this.ignoreDestroy||(void 0===t&&(t=!0),void 0===e&&(e=!1),this.onDestroy.dispatch(this,t,e),this.removeAll(t),this.cursor=null,this.filters=null,this.pendingDestroy=!1,e||(this.parent&&this.parent.removeChild(this),this.game=null,this.exists=!1))},Object.defineProperty(H.Group.prototype,"total",{get:function(){return this.iterate("exists",!0,H.Group.RETURN_TOTAL)}}),Object.defineProperty(H.Group.prototype,"length",{get:function(){return this.children.length}}),Object.defineProperty(H.Group.prototype,"angle",{get:function(){return H.Math.radToDeg(this.rotation)},set:function(t){this.rotation=H.Math.degToRad(t)}}),Object.defineProperty(H.Group.prototype,"centerX",{get:function(){return this.getBounds(this.parent).centerX},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i-e.halfWidth}}),Object.defineProperty(H.Group.prototype,"centerY",{get:function(){return this.getBounds(this.parent).centerY},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i-e.halfHeight}}),Object.defineProperty(H.Group.prototype,"left",{get:function(){return this.getBounds(this.parent).left},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i}}),Object.defineProperty(H.Group.prototype,"right",{get:function(){return this.getBounds(this.parent).right},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i-e.width}}),Object.defineProperty(H.Group.prototype,"top",{get:function(){return this.getBounds(this.parent).top},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i}}),Object.defineProperty(H.Group.prototype,"bottom",{get:function(){return this.getBounds(this.parent).bottom},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i-e.height}}),H.World=function(t){H.Group.call(this,t,null,"__world",!1),this.bounds=new H.Rectangle(0,0,t.width,t.height),this.camera=null,this._definedSize=!1,this._width=t.width,this._height=t.height,this.game.state.onStateChange.add(this.stateChange,this)},H.World.prototype=Object.create(H.Group.prototype),H.World.prototype.constructor=H.World,H.World.prototype.boot=function(){this.camera=new H.Camera(this.game,0,0,0,this.game.width,this.game.height),this.game.stage.addChild(this),this.camera.boot()},H.World.prototype.stateChange=function(){this.x=0,this.y=0,this.camera.reset()},H.World.prototype.setBounds=function(t,e,i,s){this._definedSize=!0,this._width=i,this._height=s,this.bounds.setTo(t,e,i,s),this.x=t,this.y=e,this.camera.bounds&&this.camera.bounds.setTo(t,e,Math.max(i,this.game.width),Math.max(s,this.game.height)),this.game.physics.setBoundsToWorld()},H.World.prototype.resize=function(t,e){this._definedSize&&(tthis.bounds.right&&(t.x=this.bounds.left)),o&&(t.y+t._currentBounds.heightthis.bounds.bottom&&(t.y=this.bounds.top))):(s&&t.x+ethis.bounds.right&&(t.x=this.bounds.left-e),o&&t.y+ethis.bounds.bottom&&(t.y=this.bounds.top-e))},Object.defineProperty(H.World.prototype,"width",{get:function(){return this.bounds.width},set:function(t){tthis._nextFpsNotification&&(this._nextFpsNotification=this.time.time+1e4,this.fpsProblemNotifier.dispatch()),this._deltaTime=0,this._spiraling=0,this.updateRender(this.time.slowMotion*this.time.desiredFps);else{var e=1e3*this.time.slowMotion/this.time.desiredFps;this._deltaTime+=Math.max(Math.min(3*e,this.time.elapsed),0);var i=0;for(this.updatesThisFrame=Math.floor(this._deltaTime/e),this.forceSingleUpdate&&(this.updatesThisFrame=Math.min(1,this.updatesThisFrame));this._deltaTime>=e&&(this._deltaTime-=e,this.currentUpdateID=i,this.updateLogic(this.time.desiredFpsMult),i++,!this.forceSingleUpdate||1!==i);)this.time.refresh();i>this._lastCount?this._spiraling++:i=H.Input.MAX_POINTERS)return null;var t=this.pointers.length+1,e=new H.Pointer(this.game,t,H.PointerMode.TOUCH);return this.pointers.push(e),this["pointer"+t]=e},update:function(){if(this.keyboard&&this.keyboard.update(),0=this.maxPointers)return null;if(!this.pointer1.active)return this.pointer1.start(t);if(!this.pointer2.active)return this.pointer2.start(t);for(var e=2;e=n&&this._localPoint.x=a&&this._localPoint.y=n&&this._localPoint.x=a&&this._localPoint.ythis.game.time.time},justReleased:function(t){return t=t||250,this.isUp&&this.timeUp+t>this.game.time.time},reset:function(){this.isDown=!1,this.isUp=!0,this.timeDown=this.game.time.time,this.repeats=0,this.altKey=!1,this.shiftKey=!1,this.ctrlKey=!1},destroy:function(){this.onDown.dispose(),this.onUp.dispose(),this.onFloat.dispose(),this.parent=null,this.game=null}},H.DeviceButton.prototype.constructor=H.DeviceButton,Object.defineProperty(H.DeviceButton.prototype,"duration",{get:function(){return this.isUp?-1:this.game.time.time-this.timeDown}}),H.Pointer=function(t,e,i){this.game=t,this.id=e,this.type=H.POINTER,this.exists=!0,this.identifier=0,this.pointerId=null,this.pointerMode=i||H.PointerMode.CURSOR|H.PointerMode.CONTACT,this.target=null,this.button=null,this.leftButton=new H.DeviceButton(this,H.Pointer.LEFT_BUTTON),this.middleButton=new H.DeviceButton(this,H.Pointer.MIDDLE_BUTTON),this.rightButton=new H.DeviceButton(this,H.Pointer.RIGHT_BUTTON),this.backButton=new H.DeviceButton(this,H.Pointer.BACK_BUTTON),this.forwardButton=new H.DeviceButton(this,H.Pointer.FORWARD_BUTTON),this.eraserButton=new H.DeviceButton(this,H.Pointer.ERASER_BUTTON),this._holdSent=!1,this._history=[],this._nextDrop=0,this._stateReset=!1,this.withinGame=!1,this.clientX=-1,this.clientY=-1,this.pageX=-1,this.pageY=-1,this.screenX=-1,this.screenY=-1,this.rawMovementX=0,this.rawMovementY=0,this.movementX=0,this.movementY=0,this.x=-1,this.y=-1,this.isMouse=0===e,this.isDown=!1,this.isUp=!0,this.timeDown=0,this.timeUp=0,this.previousTapTime=0,this.totalTouches=0,this.msSinceLastClick=Number.MAX_VALUE,this.targetObject=null,this.interactiveCandidates=[],this.active=!1,this.dirty=!1,this.position=new H.Point,this.positionDown=new H.Point,this.positionUp=new H.Point,this.circle=new H.Circle(0,0,44),this._clickTrampolines=null,this._trampolineTargetObject=null},H.Pointer.NO_BUTTON=0,H.Pointer.LEFT_BUTTON=1,H.Pointer.RIGHT_BUTTON=2,H.Pointer.MIDDLE_BUTTON=4,H.Pointer.BACK_BUTTON=8,H.Pointer.FORWARD_BUTTON=16,H.Pointer.ERASER_BUTTON=32,H.Pointer.prototype={resetButtons:function(){this.isDown=!1,this.isUp=!0,this.isMouse&&(this.leftButton.reset(),this.middleButton.reset(),this.rightButton.reset(),this.backButton.reset(),this.forwardButton.reset(),this.eraserButton.reset())},processButtonsDown:function(t,e){H.Pointer.LEFT_BUTTON&t&&this.leftButton.start(e),H.Pointer.RIGHT_BUTTON&t&&this.rightButton.start(e),H.Pointer.MIDDLE_BUTTON&t&&this.middleButton.start(e),H.Pointer.BACK_BUTTON&t&&this.backButton.start(e),H.Pointer.FORWARD_BUTTON&t&&this.forwardButton.start(e),H.Pointer.ERASER_BUTTON&t&&this.eraserButton.start(e)},processButtonsUp:function(t,e){t===H.Mouse.LEFT_BUTTON&&this.leftButton.stop(e),t===H.Mouse.RIGHT_BUTTON&&this.rightButton.stop(e),t===H.Mouse.MIDDLE_BUTTON&&this.middleButton.stop(e),t===H.Mouse.BACK_BUTTON&&this.backButton.stop(e),t===H.Mouse.FORWARD_BUTTON&&this.forwardButton.stop(e),5===t&&this.eraserButton.stop(e)},updateButtons:function(t){this.button=t.button;var e="down"===t.type.toLowerCase().substr(-4);void 0!==t.buttons?e?this.processButtonsDown(t.buttons,t):this.processButtonsUp(t.button,t):e?this.leftButton.start(t):(this.leftButton.stop(t),this.rightButton.stop(t)),1===t.buttons&&t.ctrlKey&&this.leftButton.isDown&&(this.leftButton.stop(t),this.rightButton.start(t)),this.isUp=!0,this.isDown=!1,(this.leftButton.isDown||this.rightButton.isDown||this.middleButton.isDown||this.backButton.isDown||this.forwardButton.isDown||this.eraserButton.isDown)&&(this.isUp=!1,this.isDown=!0)},start:function(t){var e=this.game.input;return t.pointerId&&(this.pointerId=t.pointerId),this.identifier=t.identifier,this.target=t.target,this.isMouse?this.updateButtons(t):(this.isDown=!0,this.isUp=!1),this.active=!0,this.withinGame=!0,this.dirty=!1,this._history=[],this._clickTrampolines=null,this._trampolineTargetObject=null,this.msSinceLastClick=this.game.time.time-this.timeDown,this.timeDown=this.game.time.time,this._holdSent=!1,this.move(t,!0),this.positionDown.setTo(this.x,this.y),(e.multiInputOverride===H.Input.MOUSE_OVERRIDES_TOUCH||e.multiInputOverride===H.Input.MOUSE_TOUCH_COMBINE||e.multiInputOverride===H.Input.TOUCH_OVERRIDES_MOUSE&&0===e.totalActivePointers)&&(e.x=this.x,e.y=this.y,e.position.setTo(this.x,this.y),e.onDown.dispatch(this,t),e.resetSpeed(this.x,this.y)),this._stateReset=!1,this.totalTouches++,null!==this.targetObject&&this.targetObject._touchedHandler(this),this},update:function(){var t=this.game.input;this.active&&(this.dirty&&(0=t.holdRate&&((t.multiInputOverride===H.Input.MOUSE_OVERRIDES_TOUCH||t.multiInputOverride===H.Input.MOUSE_TOUCH_COMBINE||t.multiInputOverride===H.Input.TOUCH_OVERRIDES_MOUSE&&0===t.totalActivePointers)&&t.onHold.dispatch(this),this._holdSent=!0),t.recordPointerHistory&&this.game.time.time>=this._nextDrop&&(this._nextDrop=this.game.time.time+t.recordRate,this._history.push({x:this.position.x,y:this.position.y}),this._history.length>t.recordLimit&&this._history.shift()))},move:function(t,e){var i=this.game.input;if(!i.pollLocked){void 0===e&&(e=!1),void 0!==t.button&&(this.button=t.button),e&&this.isMouse&&this.updateButtons(t),this.clientX=t.clientX,this.clientY=t.clientY,this.pageX=t.pageX,this.pageY=t.pageY,this.screenX=t.screenX,this.screenY=t.screenY,this.isMouse&&i.mouse.locked&&!e&&(this.rawMovementX=t.movementX||t.mozMovementX||t.webkitMovementX||0,this.rawMovementY=t.movementY||t.mozMovementY||t.webkitMovementY||0,this.movementX+=this.rawMovementX,this.movementY+=this.rawMovementY),this.x=(this.pageX-this.game.scale.offset.x)*i.scale.x,this.y=(this.pageY-this.game.scale.offset.y)*i.scale.y,this.position.setTo(this.x,this.y),this.circle.x=this.x,this.circle.y=this.y,(i.multiInputOverride===H.Input.MOUSE_OVERRIDES_TOUCH||i.multiInputOverride===H.Input.MOUSE_TOUCH_COMBINE||i.multiInputOverride===H.Input.TOUCH_OVERRIDES_MOUSE&&0===i.totalActivePointers)&&(i.activePointer=this,i.x=this.x,i.y=this.y,i.position.setTo(i.x,i.y),i.circle.x=i.x,i.circle.y=i.y),this.withinGame=this.game.scale.bounds.contains(this.pageX,this.pageY);for(var s=i.moveCallbacks.length;s--;)i.moveCallbacks[s].callback.call(i.moveCallbacks[s].context,this,this.x,this.y,e);return null!==this.targetObject&&!0===this.targetObject.isDragged?!1===this.targetObject.update(this)&&(this.targetObject=null):0this.game.time.time},justReleased:function(t){return t=t||this.game.input.justReleasedRate,this.isUp&&this.timeUp+t>this.game.time.time},addClickTrampoline:function(t,e,i,s){if(this.isDown){for(var o=this._clickTrampolines=this._clickTrampolines||[],n=0;nt||this.priorityID===t&&this.sprite.renderOrderID>e))},isPixelPerfect:function(){return this.pixelPerfectClick||this.pixelPerfectOver},pointerX:function(t){return t=t||0,this._pointerData[t].x},pointerY:function(t){return t=t||0,this._pointerData[t].y},pointerDown:function(t){return t=t||0,this._pointerData[t].isDown},pointerUp:function(t){return t=t||0,this._pointerData[t].isUp},pointerTimeDown:function(t){return t=t||0,this._pointerData[t].timeDown},pointerTimeUp:function(t){return t=t||0,this._pointerData[t].timeUp},pointerOver:function(t){if(!this.enabled)return!1;if(void 0!==t)return this._pointerData[t].isOver;for(var e=0;e<10;e++)if(this._pointerData[e].isOver)return!0;return!1},pointerOut:function(t){if(!this.enabled)return!1;if(void 0!==t)return this._pointerData[t].isOut;for(var e=0;e<10;e++)if(this._pointerData[e].isOut)return!0},pointerTimeOver:function(t){return t=t||0,this._pointerData[t].timeOver},pointerTimeOut:function(t){return t=t||0,this._pointerData[t].timeOut},pointerDragged:function(t){return t=t||0,this._pointerData[t].isDragged},checkPointerDown:function(t,e){return!!(t.isDown&&this.enabled&&this.sprite&&this.sprite.parent&&this.sprite.visible&&this.sprite.parent.visible&&0!==this.sprite.worldScale.x&&0!==this.sprite.worldScale.y)&&(!!this.game.input.hitTest(this.sprite,t,this._tempPoint)&&(void 0===e&&(e=!1),!(!e&&this.pixelPerfectClick)||this.checkPixel(this._tempPoint.x,this._tempPoint.y)))},checkPointerOver:function(t,e){return!!(this.enabled&&this.sprite&&this.sprite.parent&&this.sprite.visible&&this.sprite.parent.visible&&0!==this.sprite.worldScale.x&&0!==this.sprite.worldScale.y)&&(!!this.game.input.hitTest(this.sprite,t,this._tempPoint)&&(void 0===e&&(e=!1),!(!e&&this.pixelPerfectOver)||this.checkPixel(this._tempPoint.x,this._tempPoint.y)))},checkPixel:function(t,e,i){if(this.sprite.texture.baseTexture.source){if(null===t&&null===e){this.game.input.getLocalPosition(this.sprite,i,this._tempPoint);t=this._tempPoint.x,e=this._tempPoint.y}if(0!==this.sprite.anchor.x&&(t-=-this.sprite.texture.frame.width*this.sprite.anchor.x),0!==this.sprite.anchor.y&&(e-=-this.sprite.texture.frame.height*this.sprite.anchor.y),t+=this.sprite.texture.frame.x,e+=this.sprite.texture.frame.y,this.sprite.texture.trim&&(t-=this.sprite.texture.trim.x,e-=this.sprite.texture.trim.y,tthis.sprite.texture.crop.right||ethis.sprite.texture.crop.bottom))return this._dx=t,this._dy=e,!1;if(this._dx=t,this._dy=e,this.game.input.hitContext.clearRect(0,0,1,1),this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source,t,e,1,1,0,0,1,1),this.game.input.hitContext.getImageData(0,0,1,1).data[3]>=this.pixelPerfectAlpha)return!0}return!1},update:function(t){if(null!==this.sprite&&void 0!==this.sprite.parent)return this.enabled&&this.sprite.visible&&this.sprite.parent.visible?this._pendingDrag?(this._dragDistancePass||(this._dragDistancePass=H.Math.distance(t.x,t.y,this.downPoint.x,this.downPoint.y)>=this.dragDistanceThreshold),this._dragDistancePass&&this._dragTimePass&&this.startDrag(t),!0):this.draggable&&this._draggedPointerID===t.id?this.updateDrag(t,!1):this._pointerData[t.id].isOver?this.checkPointerOver(t)?(this._pointerData[t.id].x=t.x-this.sprite.x,this._pointerData[t.id].y=t.y-this.sprite.y,!0):(this._pointerOutHandler(t),!1):void 0:(this._pointerOutHandler(t),!1)},_pointerOverHandler:function(t,e){if(null!==this.sprite){var i=this._pointerData[t.id];if(!1===i.isOver||t.dirty){var s=!1===i.isOver;i.isOver=!0,i.isOut=!1,i.timeOver=this.game.time.time,i.x=t.x-this.sprite.x,i.y=t.y-this.sprite.y,this.useHandCursor&&!1===i.isDragged&&(this.game.canvas.style.cursor="pointer",this._setHandCursor=!0),!e&&s&&this.sprite&&this.sprite.events&&this.sprite.events.onInputOver$dispatch(this.sprite,t),this.sprite.parent&&this.sprite.parent.type===H.GROUP&&this.sprite.parent.onChildInputOver.dispatch(this.sprite,t)}}},_pointerOutHandler:function(t,e){if(null!==this.sprite){var i=this._pointerData[t.id];i.isOver=!1,i.isOut=!0,i.timeOut=this.game.time.time,this.useHandCursor&&!1===i.isDragged&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),!e&&this.sprite&&this.sprite.events&&(this.sprite.events.onInputOut$dispatch(this.sprite,t),this.sprite&&this.sprite.parent&&this.sprite.parent.type===H.GROUP&&this.sprite.parent.onChildInputOut.dispatch(this.sprite,t))}},_touchedHandler:function(t){if(null!==this.sprite){var e=this._pointerData[t.id];if(!e.isDown&&e.isOver){if(this.pixelPerfectClick&&!this.checkPixel(null,null,t))return;if(e.isDown=!0,e.isUp=!1,e.timeDown=this.game.time.time,this.downPoint.set(t.x,t.y),t.dirty=!0,this.sprite&&this.sprite.events&&(this.sprite.events.onInputDown$dispatch(this.sprite,t),this.sprite&&this.sprite.parent&&this.sprite.parent.type===H.GROUP&&this.sprite.parent.onChildInputDown.dispatch(this.sprite,t),null===this.sprite))return;this.draggable&&!1===this.isDragged&&(0===this.dragTimeThreshold&&0===this.dragDistanceThreshold?this.startDrag(t):(this._pendingDrag=!0,this._dragDistancePass=0===this.dragDistanceThreshold,0this.boundsRect.right&&(this.sprite.cameraOffset.x=this.boundsRect.right-this.sprite.width),this.sprite.cameraOffset.ythis.boundsRect.bottom&&(this.sprite.cameraOffset.y=this.boundsRect.bottom-this.sprite.height)):(this.sprite.leftthis.boundsRect.right&&(this.sprite.x=this.boundsRect.right-(this.sprite.width-this.sprite.offsetX)),this.sprite.topthis.boundsRect.bottom&&(this.sprite.y=this.boundsRect.bottom-(this.sprite.height-this.sprite.offsetY)))},checkBoundsSprite:function(){this.sprite.fixedToCamera&&this.boundsSprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsSprite.cameraOffset.x+this.boundsSprite.width&&(this.sprite.cameraOffset.x=this.boundsSprite.cameraOffset.x+this.boundsSprite.width-this.sprite.width),this.sprite.cameraOffset.ythis.boundsSprite.cameraOffset.y+this.boundsSprite.height&&(this.sprite.cameraOffset.y=this.boundsSprite.cameraOffset.y+this.boundsSprite.height-this.sprite.height)):(this.sprite.leftthis.boundsSprite.right&&(this.sprite.x=this.boundsSprite.right-(this.sprite.width-this.sprite.offsetX)),this.sprite.topthis.boundsSprite.bottom&&(this.sprite.y=this.boundsSprite.bottom-(this.sprite.height-this.sprite.offsetY)))}},H.InputHandler.prototype.constructor=H.InputHandler,H.Gamepad=function(t){this.game=t,this._gamepadIndexMap={},this._rawPads=[],this._active=!1,this.enabled=!0,this._gamepadSupportAvailable=!!navigator.webkitGetGamepads||!!navigator.webkitGamepads||-1!==navigator.userAgent.indexOf("Firefox/")||!!navigator.getGamepads,this._prevRawGamepadTypes=[],this._prevTimestamps=[],(this.callbackContext=this).onConnectCallback=null,this.onDisconnectCallback=null,this.onDownCallback=null,this.onUpCallback=null,this.onAxisCallback=null,this.onFloatCallback=null,this._ongamepadconnected=null,this._gamepaddisconnected=null,this._gamepads=[new H.SinglePad(t,this),new H.SinglePad(t,this),new H.SinglePad(t,this),new H.SinglePad(t,this)]},H.Gamepad.prototype={addCallbacks:function(t,e){void 0!==e&&(this.onConnectCallback="function"==typeof e.onConnect?e.onConnect:this.onConnectCallback,this.onDisconnectCallback="function"==typeof e.onDisconnect?e.onDisconnect:this.onDisconnectCallback,this.onDownCallback="function"==typeof e.onDown?e.onDown:this.onDownCallback,this.onUpCallback="function"==typeof e.onUp?e.onUp:this.onUpCallback,this.onAxisCallback="function"==typeof e.onAxis?e.onAxis:this.onAxisCallback,this.onFloatCallback="function"==typeof e.onFloat?e.onFloat:this.onFloatCallback,this.callbackContext=t)},start:function(){if(!this._active){this._active=!0;var e=this;this._onGamepadConnected=function(t){return e.onGamepadConnected(t)},this._onGamepadDisconnected=function(t){return e.onGamepadDisconnected(t)},window.addEventListener("gamepadconnected",this._onGamepadConnected,!1),window.addEventListener("gamepaddisconnected",this._onGamepadDisconnected,!1)}},onGamepadConnected:function(t){var e=t.gamepad;this._rawPads.push(e),this._gamepads[e.index].connect(e)},onGamepadDisconnected:function(t){var e=t.gamepad;for(var i in this._rawPads)this._rawPads[i].index===e.index&&this._rawPads.splice(i,1);this._gamepads[e.index].disconnect()},update:function(){this._pollGamepads(),this.pad1.pollStatus(),this.pad2.pollStatus(),this.pad3.pollStatus(),this.pad4.pollStatus()},_pollGamepads:function(){if(this._active){if(navigator.getGamepads)var t=navigator.getGamepads();else if(navigator.webkitGetGamepads)t=navigator.webkitGetGamepads();else if(navigator.webkitGamepads)t=navigator.webkitGamepads();if(t){for(var e=!(this._rawPads=[]),i=0;ithis.deadZone||s<0&&s<-this.deadZone?this.processAxisChange(i,s):this.processAxisChange(i,0)}this._prevTimestamp=this._rawPad.timestamp}},connect:function(t){var e=!this.connected;this.connected=!0,this.index=t.index,this._rawPad=t,this._buttons=[],this._buttonsLen=t.buttons.length,this._axes=[],this._axesLen=t.axes.length;for(var i=0;ithis.maxHealth&&(this.health=this.maxHealth),this},heal:function(t){return this.alive&&(this.health+=t,this.health>this.maxHealth&&(this.health=this.maxHealth)),this}},H.Component.InCamera=function(){},H.Component.InCamera.prototype={inCamera:{get:function(){return this.game.world.camera.view.intersects(this._bounds)}}},H.Component.InputEnabled=function(){},H.Component.InputEnabled.prototype={input:null,inputEnabled:{get:function(){return this.input&&this.input.enabled},set:function(t){t?null===this.input?(this.input=new H.InputHandler(this),this.input.start()):this.input&&!this.input.enabled&&this.input.start():this.input&&this.input.enabled&&this.input.stop()}}},H.Component.InWorld=function(){},H.Component.InWorld.preUpdate=function(){if(this.autoCull||this.checkWorldBounds){if(this._bounds.copyFrom(this.getBounds()),this._bounds.x+=this.game.camera.view.x,this._bounds.y+=this.game.camera.view.y,this.autoCull)if(this.game.world.camera.view.intersects(this._bounds))this.renderable=!0,this.game.world.camera.totalInView++;else if(this.renderable=!1,this.outOfCameraBoundsKill)return this.kill(),!1;if(this.checkWorldBounds)if(this._outOfBoundsFired&&this.game.world.bounds.intersects(this._bounds))this._outOfBoundsFired=!1,this.events.onEnterBounds$dispatch(this);else if(!this._outOfBoundsFired&&!this.game.world.bounds.intersects(this._bounds)&&(this._outOfBoundsFired=!0,this.events.onOutOfBounds$dispatch(this),this.outOfBoundsKill))return this.kill(),!1}return!0},H.Component.InWorld.prototype={checkWorldBounds:!1,outOfBoundsKill:!1,outOfCameraBoundsKill:!1,_outOfBoundsFired:!1,inWorld:{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}},H.Component.LifeSpan=function(){},H.Component.LifeSpan.preUpdate=function(){return!(0this.scaleMax.x&&(t.a=this.scaleMax.x),t.d>this.scaleMax.y&&(t.d=this.scaleMax.y))},setScaleMinMax:function(t,e,i,s){void 0===e?e=i=s=t:void 0===i&&(i=s=e,e=t),null===t?this.scaleMin=null:this.scaleMin?this.scaleMin.set(t,e):this.scaleMin=new H.Point(t,e),null===i?this.scaleMax=null:this.scaleMax?this.scaleMax.set(i,s):this.scaleMax=new H.Point(i,s),null===this.scaleMin?this.transformCallback=null:(this.transformCallback=this.checkTransform,this.transformCallbackContext=this)}},H.Component.Smoothed=function(){},H.Component.Smoothed.prototype={smoothed:{get:function(){return!this.texture.baseTexture.scaleMode},set:function(t){t?this.texture&&(this.texture.baseTexture.scaleMode=0):this.texture&&(this.texture.baseTexture.scaleMode=1)}}},H.GameObjectFactory=function(t){this.game=t,this.world=this.game.world},H.GameObjectFactory.prototype={existing:function(t){return this.world.add(t)},weapon:function(t,e,i,s){var o=this.game.plugins.add(H.Weapon);return o.createBullets(t,e,i,s),o},image:function(t,e,i,s,o){return void 0===o&&(o=this.world),o.add(new H.Image(this.game,t,e,i,s))},sprite:function(t,e,i,s,o){return void 0===o&&(o=this.world),o.create(t,e,i,s)},creature:function(t,e,i,s,o){void 0===o&&(o=this.world);var n=new H.Creature(this.game,t,e,i,s);return o.add(n),n},tween:function(t){return this.game.tweens.create(t)},group:function(t,e,i,s,o){return new H.Group(this.game,t,e,i,s,o)},physicsGroup:function(t,e,i,s){return new H.Group(this.game,e,i,s,!0,t)},spriteBatch:function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e="group"),void 0===i&&(i=!1),new H.SpriteBatch(this.game,t,e,i)},audio:function(t,e,i,s){return this.game.sound.add(t,e,i,s)},sound:function(t,e,i,s){return this.game.sound.add(t,e,i,s)},audioSprite:function(t){return this.game.sound.addSprite(t)},tileSprite:function(t,e,i,s,o,n,a){return void 0===a&&(a=this.world),a.add(new H.TileSprite(this.game,t,e,i,s,o,n))},rope:function(t,e,i,s,o,n){return void 0===n&&(n=this.world),n.add(new H.Rope(this.game,t,e,i,s,o))},text:function(t,e,i,s,o){return void 0===o&&(o=this.world),o.add(new H.Text(this.game,t,e,i,s))},button:function(t,e,i,s,o,n,a,r,h,l){return void 0===l&&(l=this.world),l.add(new H.Button(this.game,t,e,i,s,o,n,a,r,h))},graphics:function(t,e,i){return void 0===i&&(i=this.world),i.add(new H.Graphics(this.game,t,e))},emitter:function(t,e,i){return this.game.particles.add(new H.Particles.Arcade.Emitter(this.game,t,e,i))},retroFont:function(t,e,i,s,o,n,a,r,h){return new H.RetroFont(this.game,t,e,i,s,o,n,a,r,h)},bitmapText:function(t,e,i,s,o,n){return void 0===n&&(n=this.world),n.add(new H.BitmapText(this.game,t,e,i,s,o))},tilemap:function(t,e,i,s,o){return new H.Tilemap(this.game,t,e,i,s,o)},renderTexture:function(t,e,i,s){void 0!==i&&""!==i||(i=this.game.rnd.uuid()),void 0===s&&(s=!1);var o=new H.RenderTexture(this.game,t,e,i);return s&&this.game.cache.addRenderTexture(i,o),o},video:function(t,e){return new H.Video(this.game,t,e)},bitmapData:function(t,e,i,s){void 0===s&&(s=!1),void 0!==i&&""!==i||(i=this.game.rnd.uuid());var o=new H.BitmapData(this.game,i,t,e);return s&&this.game.cache.addBitmapData(i,o),o},filter:function(t){var e=Array.prototype.slice.call(arguments,1);return(t=new H.Filter[t](this.game)).init.apply(t,e),t},plugin:function(t){return this.game.plugins.add(t)}},H.GameObjectFactory.prototype.constructor=H.GameObjectFactory,H.GameObjectCreator=function(t){this.game=t,this.world=this.game.world},H.GameObjectCreator.prototype={image:function(t,e,i,s){return new H.Image(this.game,t,e,i,s)},sprite:function(t,e,i,s){return new H.Sprite(this.game,t,e,i,s)},tween:function(t){return new H.Tween(t,this.game,this.game.tweens)},group:function(t,e,i,s,o){return new H.Group(this.game,t,e,i,s,o)},spriteBatch:function(t,e,i){return void 0===e&&(e="group"),void 0===i&&(i=!1),new H.SpriteBatch(this.game,t,e,i)},audio:function(t,e,i,s){return this.game.sound.add(t,e,i,s)},audioSprite:function(t){return this.game.sound.addSprite(t)},sound:function(t,e,i,s){return this.game.sound.add(t,e,i,s)},tileSprite:function(t,e,i,s,o,n){return new H.TileSprite(this.game,t,e,i,s,o,n)},rope:function(t,e,i,s,o){return new H.Rope(this.game,t,e,i,s,o)},text:function(t,e,i,s){return new H.Text(this.game,t,e,i,s)},button:function(t,e,i,s,o,n,a,r,h){return new H.Button(this.game,t,e,i,s,o,n,a,r,h)},graphics:function(t,e){return new H.Graphics(this.game,t,e)},emitter:function(t,e,i){return new H.Particles.Arcade.Emitter(this.game,t,e,i)},retroFont:function(t,e,i,s,o,n,a,r,h){return new H.RetroFont(this.game,t,e,i,s,o,n,a,r,h)},bitmapText:function(t,e,i,s,o,n){return new H.BitmapText(this.game,t,e,i,s,o,n)},tilemap:function(t,e,i,s,o){return new H.Tilemap(this.game,t,e,i,s,o)},renderTexture:function(t,e,i,s){void 0!==i&&""!==i||(i=this.game.rnd.uuid()),void 0===s&&(s=!1);var o=new H.RenderTexture(this.game,t,e,i);return s&&this.game.cache.addRenderTexture(i,o),o},bitmapData:function(t,e,i,s){void 0===s&&(s=!1),void 0!==i&&""!==i||(i=this.game.rnd.uuid());var o=new H.BitmapData(this.game,i,t,e);return s&&this.game.cache.addBitmapData(i,o),o},filter:function(t){var e=Array.prototype.slice.call(arguments,1);return(t=new H.Filter[t](this.game)).init.apply(t,e),t}},H.GameObjectCreator.prototype.constructor=H.GameObjectCreator,H.Sprite=function(t,e,i,s,o){e=e||0,i=i||0,s=s||null,o=o||null,this.type=H.SPRITE,this.physicsType=H.SPRITE,PIXI.Sprite.call(this,H.Cache.DEFAULT),H.Component.Core.init.call(this,t,e,i,s,o)},H.Sprite.prototype=Object.create(PIXI.Sprite.prototype),H.Sprite.prototype.constructor=H.Sprite,H.Component.Core.install.call(H.Sprite.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Delta","Destroy","FixedToCamera","Health","InCamera","InputEnabled","InWorld","LifeSpan","LoadTexture","Overlap","PhysicsBody","Reset","ScaleMinMax","Smoothed"]),H.Sprite.prototype.preUpdatePhysics=H.Component.PhysicsBody.preUpdate,H.Sprite.prototype.preUpdateLifeSpan=H.Component.LifeSpan.preUpdate,H.Sprite.prototype.preUpdateInWorld=H.Component.InWorld.preUpdate,H.Sprite.prototype.preUpdateCore=H.Component.Core.preUpdate,H.Sprite.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},H.Image=function(t,e,i,s,o){e=e||0,i=i||0,s=s||null,o=o||null,this.type=H.IMAGE,PIXI.Sprite.call(this,H.Cache.DEFAULT),H.Component.Core.init.call(this,t,e,i,s,o)},H.Image.prototype=Object.create(PIXI.Sprite.prototype),H.Image.prototype.constructor=H.Image,H.Component.Core.install.call(H.Image.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Destroy","FixedToCamera","InputEnabled","LifeSpan","LoadTexture","Overlap","Reset","ScaleMinMax","Smoothed"]),H.Image.prototype.preUpdateInWorld=H.Component.InWorld.preUpdate,H.Image.prototype.preUpdateCore=H.Component.Core.preUpdate,H.Image.prototype.preUpdate=function(){return!!this.preUpdateInWorld()&&this.preUpdateCore()},H.Button=function(t,e,i,s,o,n,a,r,h,l){e=e||0,i=i||0,s=s||null,o=o||null,n=n||this,H.Image.call(this,t,e,i,s,r),this.type=H.BUTTON,this.physicsType=H.SPRITE,this._onOverFrame=null,this._onOutFrame=null,this._onDownFrame=null,this._onUpFrame=null,this.onOverSound=null,this.onOutSound=null,this.onDownSound=null,this.onUpSound=null,this.onOverSoundMarker="",this.onOutSoundMarker="",this.onDownSoundMarker="",this.onUpSoundMarker="",this.onInputOver=new H.Signal,this.onInputOut=new H.Signal,this.onInputDown=new H.Signal,this.onInputUp=new H.Signal,this.onOverMouseOnly=!0,this.justReleasedPreventsOver=H.PointerMode.TOUCH,this.freezeFrames=!1,this.forceOut=!1,this.inputEnabled=!0,this.input.start(0,!0),this.input.useHandCursor=!0,this.setFrames(a,r,h,l),null!==o&&this.onInputUp.add(o,n),this.events.onInputOver.add(this.onInputOverHandler,this),this.events.onInputOut.add(this.onInputOutHandler,this),this.events.onInputDown.add(this.onInputDownHandler,this),this.events.onInputUp.add(this.onInputUpHandler,this),this.events.onRemovedFromWorld.add(this.removedFromWorld,this)},H.Button.prototype=Object.create(H.Image.prototype),H.Button.prototype.constructor=H.Button;var h="Over",l="Out",c="Down";H.Button.prototype.clearFrames=function(){this.setFrames(null,null,null,null)},H.Button.prototype.removedFromWorld=function(){this.inputEnabled=!1},H.Button.prototype.setStateFrame=function(t,e,i){var s="_on"+t+"Frame";null!==e?(this[s]=e,i&&this.changeStateFrame(t)):this[s]=null},H.Button.prototype.changeStateFrame=function(t){if(this.freezeFrames)return!1;var e=this["_on"+t+"Frame"];return"string"==typeof e?(this.frameName=e,!0):"number"==typeof e&&(this.frame=e,!0)},H.Button.prototype.setFrames=function(t,e,i,s){this.setStateFrame(h,t,this.input.pointerOver()),this.setStateFrame(l,e,!this.input.pointerOver()),this.setStateFrame(c,i,this.input.pointerDown()),this.setStateFrame("Up",s,this.input.pointerUp())},H.Button.prototype.setStateSound=function(t,e,i){var s="on"+t+"Sound",o="on"+t+"SoundMarker";e instanceof H.Sound||e instanceof H.AudioSprite?(this[s]=e,this[o]="string"==typeof i?i:""):(this[s]=null,this[o]="")},H.Button.prototype.playStateSound=function(t){var e=this["on"+t+"Sound"];if(e){var i=this["on"+t+"SoundMarker"];return e.play(i),!0}return!1},H.Button.prototype.setSounds=function(t,e,i,s,o,n,a,r){this.setStateSound(h,t,e),this.setStateSound(l,o,n),this.setStateSound(c,i,s),this.setStateSound("Up",a,r)},H.Button.prototype.setOverSound=function(t,e){this.setStateSound(h,t,e)},H.Button.prototype.setOutSound=function(t,e){this.setStateSound(l,t,e)},H.Button.prototype.setDownSound=function(t,e){this.setStateSound(c,t,e)},H.Button.prototype.setUpSound=function(t,e){this.setStateSound("Up",t,e)},H.Button.prototype.onInputOverHandler=function(t,e){e.justReleased()&&(this.justReleasedPreventsOver&e.pointerMode)===e.pointerMode||(this.changeStateFrame(h),this.onOverMouseOnly&&!e.isMouse||(this.playStateSound(h),this.onInputOver&&this.onInputOver.dispatch(this,e)))},H.Button.prototype.onInputOutHandler=function(t,e){this.changeStateFrame(l),this.playStateSound(l),this.onInputOut&&this.onInputOut.dispatch(this,e)},H.Button.prototype.onInputDownHandler=function(t,e){this.changeStateFrame(c),this.playStateSound(c),this.onInputDown&&this.onInputDown.dispatch(this,e)},H.Button.prototype.onInputUpHandler=function(t,e,i){(this.playStateSound("Up"),this.onInputUp&&this.onInputUp.dispatch(this,e,i),this.freezeFrames)||(!0===this.forceOut||(this.forceOut&e.pointerMode)===e.pointerMode?this.changeStateFrame(l):this.changeStateFrame("Up")||(i?this.changeStateFrame(h):this.changeStateFrame(l)))},H.SpriteBatch=function(t,e,i,s){null==e&&(e=t.world),PIXI.SpriteBatch.call(this),H.Group.call(this,t,e,i,s),this.type=H.SPRITEBATCH},H.SpriteBatch.prototype=H.Utils.extend(!0,H.SpriteBatch.prototype,PIXI.SpriteBatch.prototype,H.Group.prototype),H.SpriteBatch.prototype.constructor=H.SpriteBatch,H.BitmapData=function(t,e,i,s,o){void 0!==i&&0!==i||(i=256),void 0!==s&&0!==s||(s=256),void 0===o&&(o=!1),this.game=t,this.key=e,this.width=i,this.height=s,this.canvas=H.Canvas.create(this,i,s,null,o),this.context=this.canvas.getContext("2d",{alpha:!0}),this.ctx=this.context,this.smoothProperty=t.renderType===H.CANVAS?t.renderer.renderSession.smoothProperty:H.Canvas.getSmoothingPrefix(this.context),this.imageData=this.context.getImageData(0,0,i,s),this.data=null,this.imageData&&(this.data=this.imageData.data),this.pixels=null,this.data&&(this.imageData.data.buffer?(this.buffer=this.imageData.data.buffer,this.pixels=new Uint32Array(this.buffer)):window.ArrayBuffer?(this.buffer=new ArrayBuffer(this.imageData.data.length),this.pixels=new Uint32Array(this.buffer)):this.pixels=this.imageData.data),this.baseTexture=new PIXI.BaseTexture(this.canvas),this.texture=new PIXI.Texture(this.baseTexture),this.frameData=new H.FrameData,this.textureFrame=this.frameData.addFrame(new H.Frame(0,0,0,i,s,"bitmapData")),this.texture.frame=this.textureFrame,this.type=H.BITMAPDATA,this.disableTextureUpload=!1,this.dirty=!1,this.cls=this.clear,this._image=null,this._pos=new H.Point,this._size=new H.Point,this._scale=new H.Point,this._rotate=0,this._alpha={prev:1,current:1},this._anchor=new H.Point,this._tempR=0,this._tempG=0,this._tempB=0,this._circle=new H.Circle,this._swapCanvas=void 0},H.BitmapData.prototype={move:function(t,e,i){return 0!==t&&this.moveH(t,i),0!==e&&this.moveV(e,i),this},moveH:function(t,e){void 0===e&&(e=!0),void 0===this._swapCanvas&&(this._swapCanvas=PIXI.CanvasPool.create(this,this.width,this.height));var i=this._swapCanvas.getContext("2d"),s=this.height,o=this.canvas;if(i.clearRect(0,0,this.width,this.height),t<0){t=Math.abs(t);var n=this.width-t;e&&i.drawImage(o,0,0,t,s,n,0,t,s),i.drawImage(o,t,0,n,s,0,0,n,s)}else{n=this.width-t;e&&i.drawImage(o,n,0,t,s,0,0,t,s),i.drawImage(o,0,0,n,s,t,0,n,s)}return this.clear(),this.copy(this._swapCanvas)},moveV:function(t,e){void 0===e&&(e=!0),void 0===this._swapCanvas&&(this._swapCanvas=PIXI.CanvasPool.create(this,this.width,this.height));var i=this._swapCanvas.getContext("2d"),s=this.width,o=this.canvas;if(i.clearRect(0,0,this.width,this.height),t<0){t=Math.abs(t);var n=this.height-t;e&&i.drawImage(o,0,0,s,t,0,n,s,t),i.drawImage(o,0,t,s,n,0,0,s,n)}else{n=this.height-t;e&&i.drawImage(o,0,n,s,t,0,0,s,t),i.drawImage(o,0,0,s,n,0,t,s,n)}return this.clear(),this.copy(this._swapCanvas)},add:function(t){if(Array.isArray(t))for(var e=0;e=this.height||s<=0)&&(n=!0)):2!==t&&3!==t||++s===this.height&&(s=0,((i+=o)>=this.width||i<=0)&&(n=!0)),0===e.a&&!n;);return e.x=i,e.y=s,e},getBounds:function(t){return void 0===t&&(t=new H.Rectangle),t.x=this.getFirstPixel(2).x,t.x===this.width?t.setTo(0,0,0,0):(t.y=this.getFirstPixel(0).y,t.width=this.getFirstPixel(3).x-t.x+1,t.height=this.getFirstPixel(1).y-t.y+1,t)},addToWorld:function(t,e,i,s,o,n){o=o||1,n=n||1;var a=this.game.add.image(t,e,this);return a.anchor.set(i,s),a.scale.set(o,n),a},copy:function(t,e,i,s,o,n,a,r,h,l,c,p,u,d,y,g,f){if(null==t&&(t=this),(t instanceof H.RenderTexture||t instanceof PIXI.RenderTexture)&&(t=t.getCanvas()),(this._image=t)instanceof H.Sprite||t instanceof H.Image||t instanceof H.Text||t instanceof PIXI.Sprite)this._pos.set(t.texture.crop.x,t.texture.crop.y),this._size.set(t.texture.crop.width,t.texture.crop.height),this._scale.set(t.scale.x,t.scale.y),this._anchor.set(t.anchor.x,t.anchor.y),this._rotate=t.rotation,this._alpha.current=t.alpha,t.texture instanceof H.RenderTexture||t.texture instanceof PIXI.RenderTexture?this._image=t.texture.getCanvas():this._image=t.texture.baseTexture.source,null==n&&(n=t.x),null==a&&(a=t.y),t.texture.trim&&(n+=t.texture.trim.x-t.anchor.x*t.texture.trim.width,a+=t.texture.trim.y-t.anchor.y*t.texture.trim.height),16777215!==t.tint&&(t.cachedTint!==t.tint&&(t.cachedTint=t.tint,t.tintedTexture=PIXI.CanvasTinter.getTintedTexture(t,t.tint)),this._image=t.tintedTexture,this._pos.set(0));else{if(this._pos.set(0),this._scale.set(1),this._anchor.set(0),this._rotate=0,this._alpha.current=1,t instanceof H.BitmapData)this._image=t.canvas;else if("string"==typeof t){if(null===(t=this.game.cache.getImage(t)))return;this._image=t}this._size.set(this._image.width,this._image.height)}if(null==e&&(e=0),null==i&&(i=0),s&&(this._size.x=s),o&&(this._size.y=o),null==n&&(n=e),null==a&&(a=i),null==r&&(r=this._size.x),null==h&&(h=this._size.y),"number"==typeof l&&(this._rotate=l),"number"==typeof c&&(this._anchor.x=c),"number"==typeof p&&(this._anchor.y=p),"number"==typeof u&&(this._scale.x=u),"number"==typeof d&&(this._scale.y=d),"number"==typeof y&&(this._alpha.current=y),void 0===g&&(g=null),void 0===f&&(f=!1),!(this._alpha.current<=0||0===this._scale.x||0===this._scale.y||0===this._size.x||0===this._size.y)){var m=this.context;return this._alpha.prev=m.globalAlpha,m.save(),m.globalAlpha=this._alpha.current,g&&(this.op=g),f&&(n|=0,a|=0),m.translate(n,a),m.scale(this._scale.x,this._scale.y),m.rotate(this._rotate),m.drawImage(this._image,this._pos.x+e,this._pos.y+i,this._size.x,this._size.y,-r*this._anchor.x,-h*this._anchor.y,r,h),m.restore(),m.globalAlpha=this._alpha.prev,this.dirty=!0,this}},copyTransform:function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=!1),!t.hasOwnProperty("worldTransform")||!t.worldVisible||0===t.worldAlpha)return this;var s=t.worldTransform;if(this._pos.set(t.texture.crop.x,t.texture.crop.y),this._size.set(t.texture.crop.width,t.texture.crop.height),0===s.a||0===s.d||0===this._size.x||0===this._size.y)return this;t.texture instanceof H.RenderTexture||t.texture instanceof PIXI.RenderTexture?this._image=t.texture.getCanvas():this._image=t.texture.baseTexture.source;var o=s.tx,n=s.ty;t.texture.trim&&(o+=t.texture.trim.x-t.anchor.x*t.texture.trim.width,n+=t.texture.trim.y-t.anchor.y*t.texture.trim.height),16777215!==t.tint&&(t.cachedTint!==t.tint&&(t.cachedTint=t.tint,t.tintedTexture=PIXI.CanvasTinter.getTintedTexture(t,t.tint)),this._image=t.tintedTexture,this._pos.set(0)),i&&(o|=0,n|=0);var a=this.context;return this._alpha.prev=a.globalAlpha,a.save(),a.globalAlpha=this._alpha.current,e&&(this.op=e),a[this.smoothProperty]=t.texture.baseTexture.scaleMode===PIXI.scaleModes.LINEAR,a.setTransform(s.a,s.b,s.c,s.d,o,n),a.drawImage(this._image,this._pos.x,this._pos.y,this._size.x,this._size.y,-this._size.x*t.anchor.x,-this._size.y*t.anchor.y,this._size.x,this._size.y),a.restore(),a.globalAlpha=this._alpha.prev,this.dirty=!0,this},copyRect:function(t,e,i,s,o,n,a){return this.copy(t,e.x,e.y,e.width,e.height,i,s,e.width,e.height,0,0,0,1,1,o,n,a)},draw:function(t,e,i,s,o,n,a){return this.copy(t,null,null,null,null,e,i,s,o,null,null,null,null,null,null,n,a)},drawGroup:function(t,e,i){return 0e.width&&(s=e.width);var o=this.context;return o.fillStyle=o.createPattern(e,i),this._circle=new H.Circle(t.start.x,t.start.y,e.height),this._circle.circumferencePoint(t.angle-1.5707963267948966,!1,this._pos),o.save(),o.translate(this._pos.x,this._pos.y),o.rotate(t.angle),o.fillRect(0,0,s,e.height),o.restore(),this.dirty=!0,this}},render:function(){return!this.disableTextureUpload&&this.dirty&&(this.baseTexture.dirty(),this.dirty=!1),this},destroy:function(){this.frameData.destroy(),this.texture.destroy(!0),PIXI.CanvasPool.remove(this)},blendReset:function(){return this.op="source-over",this},blendSourceOver:function(){return this.op="source-over",this},blendSourceIn:function(){return this.op="source-in",this},blendSourceOut:function(){return this.op="source-out",this},blendSourceAtop:function(){return this.op="source-atop",this},blendDestinationOver:function(){return this.op="destination-over",this},blendDestinationIn:function(){return this.op="destination-in",this},blendDestinationOut:function(){return this.op="destination-out",this},blendDestinationAtop:function(){return this.op="destination-atop",this},blendXor:function(){return this.op="xor",this},blendAdd:function(){return this.op="lighter",this},blendMultiply:function(){return this.op="multiply",this},blendScreen:function(){return this.op="screen",this},blendOverlay:function(){return this.op="overlay",this},blendDarken:function(){return this.op="darken",this},blendLighten:function(){return this.op="lighten",this},blendColorDodge:function(){return this.op="color-dodge",this},blendColorBurn:function(){return this.op="color-burn",this},blendHardLight:function(){return this.op="hard-light",this},blendSoftLight:function(){return this.op="soft-light",this},blendDifference:function(){return this.op="difference",this},blendExclusion:function(){return this.op="exclusion",this},blendHue:function(){return this.op="hue",this},blendSaturation:function(){return this.op="saturation",this},blendColor:function(){return this.op="color",this},blendLuminosity:function(){return this.op="luminosity",this}},Object.defineProperty(H.BitmapData.prototype,"smoothed",{get:function(){H.Canvas.getSmoothingEnabled(this.context)},set:function(t){H.Canvas.setSmoothingEnabled(this.context,t)}}),Object.defineProperty(H.BitmapData.prototype,"op",{get:function(){return this.context.globalCompositeOperation},set:function(t){this.context.globalCompositeOperation=t}}),H.BitmapData.getTransform=function(t,e,i,s,o,n){return"number"!=typeof t&&(t=0),"number"!=typeof e&&(e=0),"number"!=typeof i&&(i=1),"number"!=typeof s&&(s=1),"number"!=typeof o&&(o=0),"number"!=typeof n&&(n=0),{sx:i,sy:s,scaleX:i,scaleY:s,skewX:o,skewY:n,translateX:t,translateY:e,tx:t,ty:e}},H.BitmapData.prototype.constructor=H.BitmapData,PIXI.Graphics=function(){PIXI.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=PIXI.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new PIXI.Rectangle(0,0,1,1),this.dirty=!0,this._boundsDirty=!1,this.webGLDirty=!1,this.cachedSpriteDirty=!1},PIXI.Graphics.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),PIXI.Graphics.prototype.constructor=PIXI.Graphics,PIXI.Graphics.prototype.lineStyle=function(t,e,i){return this.lineWidth=t||0,this.lineColor=e||0,this.lineAlpha=void 0===i?1:i,this.currentPath&&(this.currentPath.shape.points.length?this.drawShape(new PIXI.Polygon(this.currentPath.shape.points.slice(-2))):(this.currentPath.lineWidth=this.lineWidth,this.currentPath.lineColor=this.lineColor,this.currentPath.lineAlpha=this.lineAlpha)),this},PIXI.Graphics.prototype.moveTo=function(t,e){return this.drawShape(new PIXI.Polygon([t,e])),this},PIXI.Graphics.prototype.lineTo=function(t,e){return this.currentPath||this.moveTo(0,0),this.currentPath.shape.points.push(t,e),this.dirty=!0,this._boundsDirty=!0,this},PIXI.Graphics.prototype.quadraticCurveTo=function(t,e,i,s){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);var o,n,a=this.currentPath.shape.points;0===a.length&&this.moveTo(0,0);for(var r=a[a.length-2],h=a[a.length-1],l=0,c=1;c<=20;++c)o=r+(t-r)*(l=c/20),n=h+(e-h)*l,a.push(o+(t+(i-t)*l-o)*l,n+(e+(s-e)*l-n)*l);return this.dirty=!0,this._boundsDirty=!0,this},PIXI.Graphics.prototype.bezierCurveTo=function(t,e,i,s,o,n){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);for(var a,r,h,l,c,p=this.currentPath.shape.points,u=p[p.length-2],d=p[p.length-1],y=0,g=1;g<=20;++g)h=(r=(a=1-(y=g/20))*a)*a,c=(l=y*y)*y,p.push(h*u+3*r*y*t+3*a*l*i+c*o,h*d+3*r*y*e+3*a*l*s+c*n);return this.dirty=!0,this._boundsDirty=!0,this},PIXI.Graphics.prototype.arcTo=function(t,e,i,s,o){this.currentPath?0===this.currentPath.shape.points.length&&this.currentPath.shape.points.push(t,e):this.moveTo(t,e);var n=this.currentPath.shape.points,a=n[n.length-2],r=n[n.length-1]-e,h=a-t,l=s-e,c=i-t,p=Math.abs(r*c-h*l);if(p<1e-8||0===o)n[n.length-2]===t&&n[n.length-1]===e||n.push(t,e);else{var u=r*r+h*h,d=l*l+c*c,y=r*l+h*c,g=o*Math.sqrt(u)/p,f=o*Math.sqrt(d)/p,m=g*y/u,v=f*y/d,x=g*c+f*h,b=g*l+f*r,w=h*(f+m),P=r*(f+m),_=c*(g+v),S=l*(g+v),T=Math.atan2(P-b,w-x),k=Math.atan2(S-b,_-x);this.arc(x+t,b+e,o,T,k,c*r80*i){s=n=t[0],o=a=t[1];for(var y=i;yn.x?o.x>a.x?o.x:a.x:n.x>a.x?n.x:a.x,c=o.y>n.y?o.y>a.y?o.y:a.y:n.y>a.y?n.y:a.y,p=PIXI.EarCut.zOrder(r,h,e,i,s),u=PIXI.EarCut.zOrder(l,c,e,i,s),d=t.nextZ;d&&d.z<=u;){if(d!==t.prev&&d!==t.next&&PIXI.EarCut.pointInTriangle(o.x,o.y,n.x,n.y,a.x,a.y,d.x,d.y)&&0<=PIXI.EarCut.area(d.prev,d,d.next))return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=p;){if(d!==t.prev&&d!==t.next&&PIXI.EarCut.pointInTriangle(o.x,o.y,n.x,n.y,a.x,a.y,d.x,d.y)&&0<=PIXI.EarCut.area(d.prev,d,d.next))return!1;d=d.prevZ}return!0},PIXI.EarCut.cureLocalIntersections=function(t,e,i){var s=t;do{var o=s.prev,n=s.next.next;PIXI.EarCut.intersects(o,s,s.next,n)&&PIXI.EarCut.locallyInside(o,n)&&PIXI.EarCut.locallyInside(n,o)&&(e.push(o.i/i),e.push(s.i/i),e.push(n.i/i),PIXI.EarCut.removeNode(s),PIXI.EarCut.removeNode(s.next),s=t=n),s=s.next}while(s!==t);return s},PIXI.EarCut.splitEarcut=function(t,e,i,s,o,n){var a=t;do{for(var r=a.next.next;r!==a.prev;){if(a.i!==r.i&&PIXI.EarCut.isValidDiagonal(a,r)){var h=PIXI.EarCut.splitPolygon(a,r);return a=PIXI.EarCut.filterPoints(a,a.next),h=PIXI.EarCut.filterPoints(h,h.next),PIXI.EarCut.earcutLinked(a,e,i,s,o,n),void PIXI.EarCut.earcutLinked(h,e,i,s,o,n)}r=r.next}a=a.next}while(a!==t)},PIXI.EarCut.eliminateHoles=function(t,e,i,s){var o,n,a,r,h,l=[];for(o=0,n=e.length;o=s.next.y){var r=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);r<=o&&a=s.x&&s.x>=i.x&&PIXI.EarCut.pointInTriangle(ni.x)&&PIXI.EarCut.locallyInside(s,t)&&(i=s,c=h),s=s.next;return i},PIXI.EarCut.indexCurve=function(t,e,i,s){for(var o=t;null===o.z&&(o.z=PIXI.EarCut.zOrder(o.x,o.y,e,i,s)),o.prevZ=o.prev,o.nextZ=o.next,(o=o.next)!==t;);o.prevZ.nextZ=null,o.prevZ=null,PIXI.EarCut.sortLinked(o)},PIXI.EarCut.sortLinked=function(t){var e,i,s,o,n,a,r,h,l=1;do{for(i=t,n=t=null,a=0;i;){for(a++,s=i,e=r=0;en!=i.next.y>n&&o<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),(i=i.next)!==t;);return s},PIXI.EarCut.splitPolygon=function(t,e){var i=new PIXI.EarCut.Node(t.i,t.x,t.y),s=new PIXI.EarCut.Node(e.i,e.x,e.y),o=t.next,n=e.prev;return(t.next=e).prev=t,(i.next=o).prev=i,(s.next=i).prev=s,(n.next=s).prev=n,s},PIXI.EarCut.insertNode=function(t,e,i,s){var o=new PIXI.EarCut.Node(t,e,i);return s?(o.next=s.next,(o.prev=s).next.prev=o,s.next=o):(o.prev=o).next=o,o},PIXI.EarCut.removeNode=function(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)},PIXI.EarCut.Node=function(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1},PIXI.WebGLGraphics=function(){},PIXI.WebGLGraphics.stencilBufferLimit=6,PIXI.WebGLGraphics.renderGraphics=function(t,e){var i,s=e.gl,o=e.projection,n=e.offset,a=e.shaderManager.primitiveShader;t.dirty&&PIXI.WebGLGraphics.updateGraphics(t,s);for(var r=t._webGL[s.id],h=0;h=PIXI.WebGLGraphics.stencilBufferLimit)if(a.points.length<2*PIXI.WebGLGraphics.stencilBufferLimit)s=PIXI.WebGLGraphics.switchMode(o,0),PIXI.WebGLGraphics.buildPoly(a,s)||(s=PIXI.WebGLGraphics.switchMode(o,1),PIXI.WebGLGraphics.buildComplexPoly(a,s));else s=PIXI.WebGLGraphics.switchMode(o,1),PIXI.WebGLGraphics.buildComplexPoly(a,s);0>16&255)/255,i=(t.tint>>8&255)/255,s=(255&t.tint)/255,o=0;o>16&255)/255*e*255<<16)+((a>>8&255)/255*i*255<<8)+(255&a)/255*s*255,n._lineTint=((r>>16&255)/255*e*255<<16)+((r>>8&255)/255*i*255<<8)+(255&r)/255*s*255}},H.Graphics=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this.type=H.GRAPHICS,this.physicsType=H.SPRITE,this.anchor=new H.Point,PIXI.Graphics.call(this),H.Component.Core.init.call(this,t,e,i,"",null)},H.Graphics.prototype=Object.create(PIXI.Graphics.prototype),H.Graphics.prototype.constructor=H.Graphics,H.Component.Core.install.call(H.Graphics.prototype,["Angle","AutoCull","Bounds","Destroy","FixedToCamera","InputEnabled","InWorld","LifeSpan","PhysicsBody","Reset"]),H.Graphics.prototype.preUpdatePhysics=H.Component.PhysicsBody.preUpdate,H.Graphics.prototype.preUpdateLifeSpan=H.Component.LifeSpan.preUpdate,H.Graphics.prototype.preUpdateInWorld=H.Component.InWorld.preUpdate,H.Graphics.prototype.preUpdateCore=H.Component.Core.preUpdate,H.Graphics.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},H.Graphics.prototype.postUpdate=function(){H.Component.PhysicsBody.postUpdate.call(this),H.Component.FixedToCamera.postUpdate.call(this),this._boundsDirty&&(this.updateLocalBounds(),this._boundsDirty=!1);for(var t=0;tg&&(m=-g),0!==m&&(f+=0i&&(this.style.wordWrapWidth=i)),this.updateTexture(),this},H.Text.prototype.updateTexture=function(){var t=this.texture.baseTexture,e=this.texture.crop,i=this.texture.frame,s=this.canvas.width,o=this.canvas.height;if(t.width=s,t.height=o,e.width=s,e.height=o,i.width=s,i.height=o,this.texture.width=s,this.texture.height=o,this._width=s,this._height=o,this.textBounds){var n=this.textBounds.x,a=this.textBounds.y;"right"===this.style.boundsAlignH?n+=this.textBounds.width-this.canvas.width/this.resolution:"center"===this.style.boundsAlignH&&(n+=this.textBounds.halfWidth-this.canvas.width/this.resolution/2),"bottom"===this.style.boundsAlignV?a+=this.textBounds.height-this.canvas.height/this.resolution:"middle"===this.style.boundsAlignV&&(a+=this.textBounds.halfHeight-this.canvas.height/this.resolution/2),this.pivot.x=-n,this.pivot.y=-a}this.renderable=0!==s&&0!==o,this.texture.requiresReTint=!0,this.texture.baseTexture.dirty()},H.Text.prototype._renderWebGL=function(t){this.dirty&&(this.updateText(),this.dirty=!1),PIXI.Sprite.prototype._renderWebGL.call(this,t)},H.Text.prototype._renderCanvas=function(t){this.dirty&&(this.updateText(),this.dirty=!1),PIXI.Sprite.prototype._renderCanvas.call(this,t)},H.Text.prototype.determineFontProperties=function(t){var e=H.Text.fontPropertiesCache[t];if(!e){e={};var i=H.Text.fontPropertiesCanvas,s=H.Text.fontPropertiesContext;s.font=t;var o=Math.ceil(s.measureText("|MÉq").width),n=Math.ceil(s.measureText("|MÉq").width),a=2*n;if(n=1.4*n|0,i.width=o,i.height=a,s.fillStyle="#f00",s.fillRect(0,0,o,a),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText("|MÉq",0,n),!s.getImageData(0,0,o,a))return e.ascent=n,e.descent=n+6,e.fontSize=e.ascent+e.descent,H.Text.fontPropertiesCache[t]=e;var r,h,l=s.getImageData(0,0,o,a).data,c=l.length,p=4*o,u=0,d=!1;for(r=0;rthis.textWidth&&(this.textWidth=c.width),o+=t.lineHeight*i,e=e.substr(c.text.length+1)}while(!1===c.end);this.textHeight=o;for(var n=0,a=0,r=this.textWidth*this.anchor.x,h=this.textHeight*this.anchor.y,l=0;l?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",H.RetroFont.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",H.RetroFont.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",H.RetroFont.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",H.RetroFont.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",H.RetroFont.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",H.RetroFont.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",H.RetroFont.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",H.RetroFont.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",H.RetroFont.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",H.RetroFont.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",H.RetroFont.prototype.setFixedWidth=function(t,e){void 0===e&&(e="left"),this.fixedWidth=t,this.align=e},H.RetroFont.prototype.setText=function(t,e,i,s,o,n){this.multiLine=e||!1,this.customSpacingX=i||0,this.customSpacingY=s||0,this.align=o||"left",this.autoUpperCase=!n,0this.width))break},H.RetroFont.prototype.getLongestLine=function(){var t=0;if(0t&&(t=e[i].length);return t},H.RetroFont.prototype.removeUnsupportedCharacters=function(t){for(var e="",i=0;i=H.Math.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et[i]&&(i=e);return t[i]},minProperty:function(t){if(2===arguments.length&&"object"==typeof arguments[1])var e=arguments[1];else e=arguments.slice(1);for(var i=1,s=0,o=e.length;ie[s][t]&&(s=i);return e[s][t]},wrapAngle:function(t,e){return e?this.wrap(t,-Math.PI,Math.PI):this.wrap(t,-180,180)},linearInterpolation:function(t,e){var i=t.length-1,s=i*e,o=Math.floor(s);return e<0?this.linear(t[0],t[1],s):1>>0,s=(e*=s)>>>0,s+=4294967296*(e-=s);return 2.3283064365386963e-10*(s>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+11102230246251565e-32*(2097152*this.rnd.apply(this)|0)},real:function(){return this.integer()+this.frac()},integerInRange:function(t,e){return Math.floor(this.realInRange(0,e-t+1)+t)},between:function(t,e){return this.integerInRange(t,e)},realInRange:function(t,e){return this.frac()*(e-t)+t},normal:function(){return 1-2*this.frac()},uuid:function(){var t="",e="";for(e=t="";t++<36;e+=~t%5|3*t&4?(15^t?8^this.frac()*(20^t?16:4):4).toString(16):"-");return e},pick:function(t){return t[this.integerInRange(0,t.length-1)]},sign:function(){return this.pick([-1,1])},weightedPick:function(t){return t[~~(Math.pow(this.frac(),2)*(t.length-1)+.5)]},timestamp:function(t,e){return this.realInRange(t||9466848e5,e||1577862e6)},angle:function(){return this.integerInRange(-180,180)},state:function(t){return"string"==typeof t&&t.match(/^!rnd/)&&(t=t.split(","),this.c=parseFloat(t[1]),this.s0=parseFloat(t[2]),this.s1=parseFloat(t[3]),this.s2=parseFloat(t[4])),["!rnd",this.c,this.s0,this.s1,this.s2].join(",")}},H.RandomDataGenerator.prototype.constructor=H.RandomDataGenerator,H.QuadTree=function(t,e,i,s,o,n,a){this.maxObjects=10,this.maxLevels=4,this.level=0,this.bounds={},this.objects=[],this.nodes=[],this._empty=[],this.reset(t,e,i,s,o,n,a)},H.QuadTree.prototype={reset:function(t,e,i,s,o,n,a){this.maxObjects=o||10,this.maxLevels=n||4,this.level=a||0,this.bounds={x:Math.round(t),y:Math.round(e),width:i,height:s,subWidth:Math.floor(i/2),subHeight:Math.floor(s/2),right:Math.round(t)+Math.floor(i/2),bottom:Math.round(e)+Math.floor(s/2)},this.objects.length=0,this.nodes.length=0},populate:function(t){t.forEach(this.populateHandler,this,!0)},populateHandler:function(t){t.body&&t.exists&&this.insert(t.body)},split:function(){this.nodes[0]=new H.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[1]=new H.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[2]=new H.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[3]=new H.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1)},insert:function(t){var e,i=0;if(null==this.nodes[0]||-1===(e=this.getIndex(t))){if(this.objects.push(t),this.objects.length>this.maxObjects&&this.levelthis.bounds.bottom&&(e=2):t.x>this.bounds.right&&(t.ythis.bounds.bottom&&(e=3)),e},retrieve:function(t){if(t instanceof H.Rectangle)var e=this.objects,i=this.getIndex(t);else{if(!t.body)return this._empty;e=this.objects,i=this.getIndex(t.body)}return this.nodes[0]&&(e=-1!==i?e.concat(this.nodes[i].retrieve(t)):(e=(e=(e=e.concat(this.nodes[0].retrieve(t))).concat(this.nodes[1].retrieve(t))).concat(this.nodes[2].retrieve(t))).concat(this.nodes[3].retrieve(t))),e},clear:function(){this.objects.length=0;for(var t=this.nodes.length;t--;)this.nodes[t].clear(),this.nodes.splice(t,1);this.nodes.length=0}},H.QuadTree.prototype.constructor=H.QuadTree,H.Net=function(t){this.game=t},H.Net.prototype={getHostName:function(){return window.location&&window.location.hostname?window.location.hostname:null},checkDomainName:function(t){return-1!==window.location.hostname.indexOf(t)},updateQueryString:function(t,e,i,s){void 0===i&&(i=!1),void 0!==s&&""!==s||(s=window.location.href);var o="",n=new RegExp("([?|&])"+t+"=.*?(&|#|$)(.*)","gi");if(n.test(s))o=null!=e?s.replace(n,"$1"+t+"="+e+"$2$3"):s.replace(n,"$1$3").replace(/(&|\?)$/,"");else if(null!=e){var a=-1!==s.indexOf("?")?"&":"?",r=s.split("#");s=r[0]+a+t+"="+e,r[1]&&(s+="#"+r[1]),o=s}else o=s;if(!i)return o;window.location.href=o},getQueryString:function(t){void 0===t&&(t="");var e={},i=location.search.substring(1).split("&");for(var s in i){var o=i[s].split("=");if(1this.timeline.length-1)&&(t=0),this.current=t,this.timeline[this.current].start(),this},stop:function(t){return void 0===t&&(t=!1),this.isRunning=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,t&&(this.onComplete.dispatch(this.target,this),this._hasStarted=!1,this.chainedTween&&this.chainedTween.start()),this.manager.remove(this),this},updateTweenData:function(t,e,i){if(0===this.timeline.length)return this;if(void 0===i&&(i=0),-1===i)for(var s=0;s=this.startTime))return H.TweenData.PENDING;this.isRunning=!0}var e=this.parent.frameBased?this.game.time.physicsElapsedMS:this.game.time.elapsedMS;for(var i in this.parent.reverse?(this.dt-=e*this.parent.timeScale,this.dt=Math.max(this.dt,0)):(this.dt+=e*this.parent.timeScale,this.dt=Math.min(this.dt,this.duration)),this.percent=this.dt/this.duration,this.value=this.easingFunction(this.percent),this.vEnd){var s=this.vStart[i],o=this.vEnd[i];Array.isArray(o)?this.parent.target[i]=this.interpolationFunction.call(this.interpolationContext,o,this.value):this.parent.target[i]=s+(o-s)*this.value}return!this.parent.reverse&&1===this.percent||this.parent.reverse&&0===this.percent?this.repeat():H.TweenData.RUNNING},generateData:function(t){this.parent.reverse?this.dt=this.duration:this.dt=0;var e=[],i=!1,s=1/t*1e3;do{this.parent.reverse?(this.dt-=s,this.dt=Math.max(this.dt,0)):(this.dt+=s,this.dt=Math.min(this.dt,this.duration)),this.percent=this.dt/this.duration,this.value=this.easingFunction(this.percent);var o={};for(var n in this.vEnd){var a=this.vStart[n],r=this.vEnd[n];Array.isArray(r)?o[n]=this.interpolationFunction(r,this.value):o[n]=a+(r-a)*this.value}e.push(o),(!this.parent.reverse&&1===this.percent||this.parent.reverse&&0===this.percent)&&(i=!0)}while(!i);if(this.yoyo){var h=e.slice();h.reverse(),e=e.concat(h)}return e},repeat:function(){if(this.yoyo){if(this.inReverse&&0===this.repeatCounter){for(var t in this.vStartCache)this.vStart[t]=this.vStartCache[t],this.vEnd[t]=this.vEndCache[t];return this.inReverse=!1,H.TweenData.COMPLETE}this.inReverse=!this.inReverse}else if(0===this.repeatCounter)return H.TweenData.COMPLETE;if(this.inReverse)for(var t in this.vStartCache)this.vStart[t]=this.vEndCache[t],this.vEnd[t]=this.vStartCache[t];else{for(var t in this.vStartCache)this.vStart[t]=this.vStartCache[t],this.vEnd[t]=this.vEndCache[t];0=2*this._desiredFps&&(this.suggestedFps=5*Math.floor(200/(this._elapsedAccumulator/this._frameCount)),this._frameCount=0,this._elapsedAccumulator=0),this.msMin=Math.min(this.msMin,this.elapsed),this.msMax=Math.max(this.msMax,this.elapsed),this.frames++,this.now>this._timeLastSecond+1e3&&(this.fps=Math.round(1e3*this.frames/(this.now-this._timeLastSecond)),this.fpsMin=Math.min(this.fpsMin,this.fps),this.fpsMax=Math.max(this.fpsMax,this.fps),this._timeLastSecond=this.now,this.frames=0)},gamePaused:function(){this._pauseStarted=Date.now(),this.events.pause();for(var t=this._timers.length;t--;)this._timers[t]._pause()},gameResumed:function(){this.time=Date.now(),this.pauseDuration=this.time-this._pauseStarted,this.events.resume();for(var t=this._timers.length;t--;)this._timers[t]._resume()},totalElapsedSeconds:function(){return.001*(this.time-this._started)},elapsedSince:function(t){return this.time-t},elapsedSecondsSince:function(t){return.001*(this.time-t)},reset:function(){this._started=this.time,this.removeAll()}},Object.defineProperty(H.Time.prototype,"desiredFps",{get:function(){return this._desiredFps},set:function(t){this._desiredFps=t,this.physicsElapsed=1/t,this.physicsElapsedMS=1e3*this.physicsElapsed,this.desiredFpsMult=1/t}}),H.Time.prototype.constructor=H.Time,H.Timer=function(t,e){void 0===e&&(e=!0),this.game=t,this.running=!1,this.autoDestroy=e,this.expired=!1,this.elapsed=0,this.events=[],this.onComplete=new H.Signal,this.nextTick=0,this.timeCap=1e3,this.paused=!1,this._codePaused=!1,this._started=0,this._pauseStarted=0,this._pauseTotal=0,this._now=Date.now(),this._len=0,this._marked=0,this._i=0,this._diff=0,this._newTick=0},H.Timer.MINUTE=6e4,H.Timer.SECOND=1e3,H.Timer.HALF=500,H.Timer.QUARTER=250,H.Timer.prototype={create:function(t,e,i,s,o,n){var a=t=Math.round(t);0===this._now?a+=this.game.time.time:a+=this._now;var r=new H.TimerEvent(this,t,a,i,e,s,o,n);return this.events.push(r),this.order(),this.expired=!1,r},add:function(t,e,i){return this.create(t,!1,0,e,i,Array.prototype.slice.call(arguments,3))},repeat:function(t,e,i,s){return this.create(t,!1,e,i,s,Array.prototype.slice.call(arguments,4))},loop:function(t,e,i){return this.create(t,!0,0,e,i,Array.prototype.slice.call(arguments,3))},start:function(t){if(!this.running){this._started=this.game.time.time+(t||0),this.running=!0;for(var e=0;ee.tick?1:0},clearPendingEvents:function(){for(this._i=this.events.length;this._i--;)this.events[this._i].pendingDelete&&this.events.splice(this._i,1);this._len=this.events.length,this._i=0},update:function(t){if(this.paused)return!0;if(this.elapsed=t-this._now,this._now=t,this.elapsed>this.timeCap&&this.adjustEvents(t-this.elapsed),this._marked=0,this.clearPendingEvents(),this.running&&this._now>=this.nextTick&&0=this.events[this._i].tick&&!this.events[this._i].pendingDelete;)this._newTick=this._now+this.events[this._i].delay-(this._now-this.events[this._i].tick),this._newTick<0&&(this._newTick=this._now+this.events[this._i].delay),!0===this.events[this._i].loop?this.events[this._i].tick=this._newTick:0this._marked?this.order():(this.expired=!0,this.onComplete.dispatch(this))}return!this.expired||!this.autoDestroy},pause:function(){this.running&&(this._codePaused=!0,this.paused||(this._pauseStarted=this.game.time.time,this.paused=!0))},_pause:function(){!this.paused&&this.running&&(this._pauseStarted=this.game.time.time,this.paused=!0)},adjustEvents:function(t){for(var e=0;ethis._now?this.nextTick-this._now:0}}),Object.defineProperty(H.Timer.prototype,"length",{get:function(){return this.events.length}}),Object.defineProperty(H.Timer.prototype,"ms",{get:function(){return this.running?this._now-this._started-this._pauseTotal:0}}),Object.defineProperty(H.Timer.prototype,"seconds",{get:function(){return this.running?.001*this.ms:0}}),H.Timer.prototype.constructor=H.Timer,H.TimerEvent=function(t,e,i,s,o,n,a,r){this.timer=t,this.delay=e,this.tick=i,this.repeatCount=s-1,this.loop=o,this.callback=n,this.callbackContext=a,this.args=r,this.pendingDelete=!1},H.TimerEvent.prototype.constructor=H.TimerEvent,H.AnimationManager=function(t){this.sprite=t,this.game=t.game,this.currentFrame=null,this.currentAnim=null,this.updateIfVisible=!0,this.isLoaded=!1,this._frameData=null,this._anims={},this._outputFrames=[]},H.AnimationManager.prototype={loadFrameData:function(t,e){if(void 0===t)return!1;if(this.isLoaded)for(var i in this._anims)this._anims[i].updateFrameData(t);return this._frameData=t,null==e?this.frame=0:"string"==typeof e?this.frameName=e:this.frame=e,this.isLoaded=!0},copyFrameData:function(t,e){if(this._frameData=t.clone(),this.isLoaded)for(var i in this._anims)this._anims[i].updateFrameData(this._frameData);return null==e?this.frame=0:"string"==typeof e?this.frameName=e:this.frame=e,this.isLoaded=!0},add:function(t,e,i,s,o){return e=e||[],i=i||60,void 0===s&&(s=!1),void 0===o&&(o=!(!e||"number"!=typeof e[0])),this._outputFrames=[],this._frameData.getFrameIndexes(e,o,this._outputFrames),this._anims[t]=new H.Animation(this.game,this.sprite,t,this._frameData,this._outputFrames,i,s),this.currentAnim=this._anims[t],this.sprite.tilingTexture&&(this.sprite.refreshTexture=!0),this._anims[t]},validateFrames:function(t,e){void 0===e&&(e=!0);for(var i=0;ithis._frameData.total)return!1}else if(!1===this._frameData.checkFrameName(t[i]))return!1;return!0},play:function(t,e,i,s){if(this._anims[t])return this.currentAnim===this._anims[t]?!1===this.currentAnim.isPlaying?(this.currentAnim.paused=!1,this.currentAnim.play(e,i,s)):this.currentAnim:(this.currentAnim&&this.currentAnim.isPlaying&&this.currentAnim.stop(),this.currentAnim=this._anims[t],this.currentAnim.paused=!1,this.currentFrame=this.currentAnim.currentFrame,this.currentAnim.play(e,i,s))},stop:function(t,e){void 0===e&&(e=!1),!this.currentAnim||"string"==typeof t&&t!==this.currentAnim.name||this.currentAnim.stop(e)},update:function(){return!(this.updateIfVisible&&!this.sprite.visible)&&(!(!this.currentAnim||!this.currentAnim.update())&&(this.currentFrame=this.currentAnim.currentFrame,!0))},next:function(t){this.currentAnim&&(this.currentAnim.next(t),this.currentFrame=this.currentAnim.currentFrame)},previous:function(t){this.currentAnim&&(this.currentAnim.previous(t),this.currentFrame=this.currentAnim.currentFrame)},getAnimation:function(t){return"string"==typeof t&&this._anims[t]?this._anims[t]:null},refreshFrame:function(){},destroy:function(){var t=null;for(var t in this._anims)this._anims.hasOwnProperty(t)&&this._anims[t].destroy();this._anims={},this._outputFrames=[],this._frameData=null,this.currentAnim=null,this.currentFrame=null,this.sprite=null,this.game=null}},H.AnimationManager.prototype.constructor=H.AnimationManager,Object.defineProperty(H.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}}),Object.defineProperty(H.AnimationManager.prototype,"frameTotal",{get:function(){return this._frameData.total}}),Object.defineProperty(H.AnimationManager.prototype,"paused",{get:function(){return this.currentAnim.isPaused},set:function(t){this.currentAnim.paused=t}}),Object.defineProperty(H.AnimationManager.prototype,"name",{get:function(){if(this.currentAnim)return this.currentAnim.name}}),Object.defineProperty(H.AnimationManager.prototype,"frame",{get:function(){if(this.currentFrame)return this.currentFrame.index},set:function(t){"number"==typeof t&&this._frameData&&null!==this._frameData.getFrame(t)&&(this.currentFrame=this._frameData.getFrame(t),this.currentFrame&&this.sprite.setFrame(this.currentFrame))}}),Object.defineProperty(H.AnimationManager.prototype,"frameName",{get:function(){if(this.currentFrame)return this.currentFrame.name},set:function(t){"string"==typeof t&&this._frameData&&null!==this._frameData.getFrameByName(t)&&(this.currentFrame=this._frameData.getFrameByName(t),this.currentFrame&&(this._frameIndex=this.currentFrame.index,this.sprite.setFrame(this.currentFrame)))}}),H.Animation=function(t,e,i,s,o,n,a){void 0===a&&(a=!1),this.game=t,this._parent=e,this._frameData=s,this.name=i,this._frames=[],this._frames=this._frames.concat(o),this.delay=1e3/n,this.loop=a,this.loopCount=0,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart=new H.Signal,this.onUpdate=null,this.onComplete=new H.Signal,this.onLoop=new H.Signal,this.isReversed=!1,this.game.onPause.add(this.onPause,this),this.game.onResume.add(this.onResume,this)},H.Animation.prototype={play:function(t,e,i){return"number"==typeof t&&(this.delay=1e3/t),"boolean"==typeof e&&(this.loop=e),void 0!==i&&(this.killOnComplete=i),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=this.isReversed?this._frames.length-1:0,this.updateCurrentFrame(!1,!0),this._parent.events.onAnimationStart$dispatch(this._parent,this),this.onStart.dispatch(this._parent,this),(this._parent.animations.currentAnim=this)._parent.animations.currentFrame=this.currentFrame,this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setFrame(this.currentFrame),(this._parent.animations.currentAnim=this)._parent.animations.currentFrame=this.currentFrame,this.onStart.dispatch(this._parent,this)},reverse:function(){return this.reversed=!this.reversed,this},reverseOnce:function(){return this.onComplete.addOnce(this.reverse,this),this.reverse()},setFrame:function(t,e){var i;if(void 0===e&&(e=!1),"string"==typeof t)for(var s=0;s=this._timeNextFrame)&&(this._frameSkip=1,this._frameDiff=this.game.time.time-this._timeNextFrame,this._timeLastFrame=this.game.time.time,this._frameDiff>this.delay&&(this._frameSkip=Math.floor(this._frameDiff/this.delay),this._frameDiff-=this._frameSkip*this.delay),this._timeNextFrame=this.game.time.time+(this.delay-this._frameDiff),this.isReversed?this._frameIndex-=this._frameSkip:this._frameIndex+=this._frameSkip,!this.isReversed&&this._frameIndex>=this._frames.length||this.isReversed&&this._frameIndex<=-1?this.loop?(this._frameIndex=Math.abs(this._frameIndex)%this._frames.length,this.isReversed&&(this._frameIndex=this._frames.length-1-this._frameIndex),this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&this._parent.setFrame(this.currentFrame),this.loopCount++,this._parent.events.onAnimationLoop$dispatch(this._parent,this),this.onLoop.dispatch(this._parent,this),!this.onUpdate||(this.onUpdate.dispatch(this,this.currentFrame),!!this._frameData)):(this.complete(),!1):this.updateCurrentFrame(!0)))},updateCurrentFrame:function(t,e){if(void 0===e&&(e=!1),!this._frameData)return!1;var i=this.currentFrame.index;return this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(e||!e&&i!==this.currentFrame.index)&&this._parent.setFrame(this.currentFrame),!this.onUpdate||!t||(this.onUpdate.dispatch(this,this.currentFrame),!!this._frameData)},next:function(t){void 0===t&&(t=1);var e=this._frameIndex+t;e>=this._frames.length&&(this.loop?e%=this._frames.length:e=this._frames.length-1),e!==this._frameIndex&&(this._frameIndex=e,this.updateCurrentFrame(!0))},previous:function(t){void 0===t&&(t=1);var e=this._frameIndex-t;e<0&&(this.loop?e=this._frames.length+e:e++),e!==this._frameIndex&&(this._frameIndex=e,this.updateCurrentFrame(!0))},updateFrameData:function(t){this._frameData=t,this.currentFrame=this._frameData?this._frameData.getFrame(this._frames[this._frameIndex%this._frames.length]):null},destroy:function(){this._frameData&&(this.game.onPause.remove(this.onPause,this),this.game.onResume.remove(this.onResume,this),this.game=null,this._parent=null,this._frames=null,this._frameData=null,this.currentFrame=null,this.isPlaying=!1,this.onStart.dispose(),this.onLoop.dispose(),this.onComplete.dispose(),this.onUpdate&&this.onUpdate.dispose())},complete:function(){this._frameIndex=this._frames.length-1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,this._parent.events.onAnimationComplete$dispatch(this._parent,this),this.onComplete.dispatch(this._parent,this),this.killOnComplete&&this._parent.kill()}},H.Animation.prototype.constructor=H.Animation,Object.defineProperty(H.Animation.prototype,"paused",{get:function(){return this.isPaused},set:function(t){(this.isPaused=t)?this._pauseStartTime=this.game.time.time:this.isPlaying&&(this._timeNextFrame=this.game.time.time+this.delay)}}),Object.defineProperty(H.Animation.prototype,"reversed",{get:function(){return this.isReversed},set:function(t){this.isReversed=t}}),Object.defineProperty(H.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}}),Object.defineProperty(H.Animation.prototype,"frame",{get:function(){return null!==this.currentFrame?this.currentFrame.index:this._frameIndex},set:function(t){this.currentFrame=this._frameData.getFrame(this._frames[t]),null!==this.currentFrame&&(this._frameIndex=t,this._parent.setFrame(this.currentFrame),this.onUpdate&&this.onUpdate.dispatch(this,this.currentFrame))}}),Object.defineProperty(H.Animation.prototype,"speed",{get:function(){return 1e3/this.delay},set:function(t){0=this._frames.length&&(t=0),this._frames[t]},getFrameByName:function(t){return"number"==typeof this._frameNames[t]?this._frames[this._frameNames[t]]:null},checkFrameName:function(t){return null!=this._frameNames[t]},clone:function(){for(var t=new H.FrameData,e=0;e=i||e&&this._loadedPackCount===this._totalPackCount)break}if(this.updateProgress(),this._processingHead>=this._fileList.length)this.finishedLoading();else if(!this._flightQueue.length){var o=this;setTimeout(function(){o.finishedLoading(!0)},2e3)}}else this.finishedLoading(!0)},finishedLoading:function(t){this.hasLoaded||(this.hasLoaded=!0,this.isLoading=!1,t||this._fileLoadStarted||(this._fileLoadStarted=!0,this.onLoadStart.dispatch()),this.onLoadComplete.dispatch(),this.game.state.loadComplete(),this.reset())},asyncComplete:function(t,e){void 0===e&&(e=""),t.loaded=!0,t.error=!!e,e&&(t.errorMessage=e),this.processLoadQueue()},processPack:function(t){var e=t.data[t.key];if(e)for(var i=0;i=this.durationMS&&(this.usingWebAudio?this.loop?(this.onLoop.dispatch(this),this.isPlaying=!1,""===this.currentMarker?(this.currentTime=0,this.startTime=this.game.time.time,this.isPlaying=!0):(this.onMarkerComplete.dispatch(this.currentMarker,this),this.play(this.currentMarker,0,this.volume,!0,!0))):""!==this.currentMarker&&this.stop():this.loop?(this.onLoop.dispatch(this),""===this.currentMarker&&(this.currentTime=0,this.startTime=this.game.time.time),this.isPlaying=!1,this.play(this.currentMarker,0,this.volume,!0,!0)):this.stop()))):this.destroy()},loopFull:function(t){return this.play(null,0,t,!0)},play:function(t,e,i,s,o){if(void 0!==t&&!1!==t&&null!==t||(t=""),void 0===o&&(o=!0),this.isPlaying&&!this.allowMultiple&&!o&&!this.override)return this;if(this._sound&&this.isPlaying&&!this.allowMultiple&&(this.override||o)){if(this.usingWebAudio){if(void 0===this._sound.stop)this._sound.noteOff(0);else try{this._sound.stop(0)}catch(t){}this.externalNode?this._sound.disconnect(this.externalNode):this.gainNode&&this._sound.disconnect(this.gainNode)}else this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0);this.isPlaying=!1}var n=Object.keys(this.markers);if(""===t&&1===n.length&&(t=n[0]),""===t&&0this.width}}),Object.defineProperty(H.ScaleManager.prototype,"isGameLandscape",{get:function(){return this.width>this.height}}),H.Utils.Debug=function(t){this.game=t,this.sprite=null,this.bmd=null,this.canvas=null,this.context=null,this.font="14px Courier",this.columnWidth=100,this.lineHeight=16,this.renderShadow=!0,this.currentX=0,this.currentY=0,this.currentAlpha=1,this.dirty=!1},H.Utils.Debug.prototype={boot:function(){this.game.renderType===H.CANVAS?this.context=this.game.context:(this.bmd=new H.BitmapData(this.game,"__DEBUG",this.game.width,this.game.height,!0),this.sprite=this.game.make.image(0,0,this.bmd),this.game.stage.addChild(this.sprite),this.game.scale.onSizeChange.add(this.resize,this),this.canvas=PIXI.CanvasPool.create(this,this.game.width,this.game.height),this.context=this.canvas.getContext("2d"))},resize:function(t,e,i){this.bmd.resize(e,i),this.canvas.width=e,this.canvas.height=i},preUpdate:function(){this.dirty&&this.sprite&&(this.bmd.clear(),this.bmd.draw(this.canvas,0,0),this.context.clearRect(0,0,this.game.width,this.game.height),this.dirty=!1)},reset:function(){this.context&&this.context.clearRect(0,0,this.game.width,this.game.height),this.sprite&&this.bmd.clear()},start:function(t,e,i,s){"number"!=typeof t&&(t=0),"number"!=typeof e&&(e=0),i=i||"rgb(255,255,255)",void 0===s&&(s=0),this.currentX=t,this.currentY=e,this.currentColor=i,this.columnWidth=s,this.dirty=!0,this.context.save(),this.context.setTransform(1,0,0,1,0,0),this.context.strokeStyle=i,this.context.fillStyle=i,this.context.font=this.font,this.context.globalAlpha=this.currentAlpha},stop:function(){this.context.restore()},line:function(){for(var t=this.currentX,e=0;ee.width?s:o;if("viewport"===t)return this.visualBounds.height>this.visualBounds.width?s:o;if("window.orientation"===t&&"number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?s:o;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return s;if(window.matchMedia("(orientation: landscape)").matches)return o}return this.visualBounds.height>this.visualBounds.width?s:o},visualBounds:new H.Rectangle,layoutBounds:new H.Rectangle,documentBounds:new H.Rectangle},H.Device.whenReady(function(t){var e=window&&"pageXOffset"in window?function(){return window.pageXOffset}:function(){return document.documentElement.scrollLeft},i=window&&"pageYOffset"in window?function(){return window.pageYOffset}:function(){return document.documentElement.scrollTop};if(Object.defineProperty(H.DOM,"scrollX",{get:e}),Object.defineProperty(H.DOM,"scrollY",{get:i}),Object.defineProperty(H.DOM.visualBounds,"x",{get:e}),Object.defineProperty(H.DOM.visualBounds,"y",{get:i}),Object.defineProperty(H.DOM.layoutBounds,"x",{value:0}),Object.defineProperty(H.DOM.layoutBounds,"y",{value:0}),t.desktop&&document.documentElement.clientWidth<=window.innerWidth&&document.documentElement.clientHeight<=window.innerHeight){var s=function(){return Math.max(window.innerWidth,document.documentElement.clientWidth)},o=function(){return Math.max(window.innerHeight,document.documentElement.clientHeight)};Object.defineProperty(H.DOM.visualBounds,"width",{get:s}),Object.defineProperty(H.DOM.visualBounds,"height",{get:o}),Object.defineProperty(H.DOM.layoutBounds,"width",{get:s}),Object.defineProperty(H.DOM.layoutBounds,"height",{get:o})}else Object.defineProperty(H.DOM.visualBounds,"width",{get:function(){return window.innerWidth}}),Object.defineProperty(H.DOM.visualBounds,"height",{get:function(){return window.innerHeight}}),Object.defineProperty(H.DOM.layoutBounds,"width",{get:function(){var t=document.documentElement.clientWidth,e=window.innerWidth;return t>>0:(t<<24|e<<16|i<<8|s)>>>0},unpackPixel:function(t,e,i,s){return null==e&&(e=H.Color.createColor()),null==i&&(i=!1),null==s&&(s=!1),H.Device.LITTLE_ENDIAN?(e.a=(4278190080&t)>>>24,e.b=(16711680&t)>>>16,e.g=(65280&t)>>>8,e.r=255&t):(e.r=(4278190080&t)>>>24,e.g=(16711680&t)>>>16,e.b=(65280&t)>>>8,e.a=255&t),e.color=t,e.rgba="rgba("+e.r+","+e.g+","+e.b+","+e.a/255+")",i&&H.Color.RGBtoHSL(e.r,e.g,e.b,e),s&&H.Color.RGBtoHSV(e.r,e.g,e.b,e),e},fromRGBA:function(t,e){return e||(e=H.Color.createColor()),e.r=(4278190080&t)>>>24,e.g=(16711680&t)>>>16,e.b=(65280&t)>>>8,e.a=255&t,e.rgba="rgba("+e.r+","+e.g+","+e.b+","+e.a+")",e},toRGBA:function(t,e,i,s){return t<<24|e<<16|i<<8|s},toABGR:function(t,e,i,s){return(s<<24|i<<16|e<<8|t)>>>0},RGBtoHSL:function(t,e,i,s){s||(s=H.Color.createColor(t,e,i,1)),t/=255,e/=255,i/=255;var o=Math.min(t,e,i),n=Math.max(t,e,i);if(s.h=0,s.s=0,s.l=(n+o)/2,n!==o){var a=n-o;s.s=.5>>24,red:t>>16&255,green:t>>8&255,blue:255&t,a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{alpha:255,red:t>>16&255,green:t>>8&255,blue:255&t,a:255,r:t>>16&255,g:t>>8&255,b:255&t}},getWebRGB:function(t){if("object"==typeof t)return"rgba("+t.r.toString()+","+t.g.toString()+","+t.b.toString()+","+(t.a/255).toString()+")";var e=H.Color.getRGB(t);return"rgba("+e.r.toString()+","+e.g.toString()+","+e.b.toString()+","+(e.a/255).toString()+")"},getAlpha:function(t){return t>>>24},getAlphaFloat:function(t){return(t>>>24)/255},getRed:function(t){return t>>16&255},getGreen:function(t){return t>>8&255},getBlue:function(t){return 255&t},blendNormal:function(t){return t},blendLighten:function(t,e){return t>8)},blendExclusion:function(t,e){return t+e-2*t*e/255},blendOverlay:function(t,e){return e<128?2*t*e/255:255-2*(255-t)*(255-e)/255},blendSoftLight:function(t,e){return e<128?2*(64+(t>>1))*(e/255):255-2*(255-(64+(t>>1)))*(255-e)/255},blendHardLight:function(t,e){return H.Color.blendOverlay(e,t)},blendColorDodge:function(t,e){return 255===e?e:Math.min(255,(t<<8)/(255-e))},blendColorBurn:function(t,e){return 0===e?e:Math.max(0,255-(255-t<<8)/e)},blendLinearDodge:function(t,e){return H.Color.blendAdd(t,e)},blendLinearBurn:function(t,e){return H.Color.blendSubtract(t,e)},blendLinearLight:function(t,e){return e<128?H.Color.blendLinearBurn(t,2*e):H.Color.blendLinearDodge(t,2*(e-128))},blendVividLight:function(t,e){return e<128?H.Color.blendColorBurn(t,2*e):H.Color.blendColorDodge(t,2*(e-128))},blendPinLight:function(t,e){return e<128?H.Color.blendDarken(t,2*e):H.Color.blendLighten(t,2*(e-128))},blendHardMix:function(t,e){return H.Color.blendVividLight(t,e)<128?0:255},blendReflect:function(t,e){return 255===e?e:Math.min(255,t*t/(255-e))},blendGlow:function(t,e){return H.Color.blendReflect(e,t)},blendPhoenix:function(t,e){return Math.min(t,e)-Math.max(t,e)+255}},H.Physics=function(t,e){e=e||{},this.game=t,this.config=e,this.arcade=null,this.p2=null,this.ninja=null,this.box2d=null,this.chipmunk=null,this.matter=null,this.parseConfig()},H.Physics.ARCADE=0,H.Physics.P2JS=1,H.Physics.NINJA=2,H.Physics.BOX2D=3,H.Physics.CHIPMUNK=4,H.Physics.MATTERJS=5,H.Physics.prototype={parseConfig:function(){this.config.hasOwnProperty("arcade")&&!0!==this.config.arcade||!H.Physics.hasOwnProperty("Arcade")||(this.arcade=new H.Physics.Arcade(this.game)),this.config.hasOwnProperty("ninja")&&!0===this.config.ninja&&H.Physics.hasOwnProperty("Ninja")&&(this.ninja=new H.Physics.Ninja(this.game)),this.config.hasOwnProperty("p2")&&!0===this.config.p2&&H.Physics.hasOwnProperty("P2")&&(this.p2=new H.Physics.P2(this.game,this.config)),this.config.hasOwnProperty("box2d")&&!0===this.config.box2d&&H.Physics.hasOwnProperty("BOX2D")&&(this.box2d=new H.Physics.BOX2D(this.game,this.config)),this.config.hasOwnProperty("matter")&&!0===this.config.matter&&H.Physics.hasOwnProperty("Matter")&&(this.matter=new H.Physics.Matter(this.game,this.config))},startSystem:function(t){t===H.Physics.ARCADE?this.arcade=new H.Physics.Arcade(this.game):t===H.Physics.P2JS?null===this.p2?this.p2=new H.Physics.P2(this.game,this.config):this.p2.reset():t===H.Physics.NINJA?this.ninja=new H.Physics.Ninja(this.game):t===H.Physics.BOX2D?null===this.box2d?this.box2d=new H.Physics.Box2D(this.game,this.config):this.box2d.reset():t===H.Physics.MATTERJS&&(null===this.matter?this.matter=new H.Physics.Matter(this.game,this.config):this.matter.reset())},enable:function(t,e,i){void 0===e&&(e=H.Physics.ARCADE),void 0===i&&(i=!1),e===H.Physics.ARCADE?this.arcade.enable(t):e===H.Physics.P2JS&&this.p2?this.p2.enable(t,i):e===H.Physics.NINJA&&this.ninja?this.ninja.enableAABB(t):e===H.Physics.BOX2D&&this.box2d?this.box2d.enable(t):e===H.Physics.MATTERJS&&this.matter&&this.matter.enable(t)},preUpdate:function(){this.p2&&this.p2.preUpdate(),this.box2d&&this.box2d.preUpdate(),this.matter&&this.matter.preUpdate()},update:function(){this.p2&&this.p2.update(),this.box2d&&this.box2d.update(),this.matter&&this.matter.update()},setBoundsToWorld:function(){this.arcade&&this.arcade.setBoundsToWorld(),this.ninja&&this.ninja.setBoundsToWorld(),this.p2&&this.p2.setBoundsToWorld(),this.box2d&&this.box2d.setBoundsToWorld(),this.matter&&this.matter.setBoundsToWorld()},clear:function(){this.p2&&this.p2.clear(),this.box2d&&this.box2d.clear(),this.matter&&this.matter.clear()},reset:function(){this.p2&&this.p2.reset(),this.box2d&&this.box2d.reset(),this.matter&&this.matter.reset()},destroy:function(){this.p2&&this.p2.destroy(),this.box2d&&this.box2d.destroy(),this.matter&&this.matter.destroy(),this.arcade=null,this.ninja=null,this.p2=null,this.box2d=null,this.matter=null}},H.Physics.prototype.constructor=H.Physics,H.Physics.Arcade=function(t){this.game=t,this.gravity=new H.Point,this.bounds=new H.Rectangle(0,0,t.world.width,t.world.height),this.checkCollision={up:!0,down:!0,left:!0,right:!0},this.maxObjects=10,this.maxLevels=4,this.OVERLAP_BIAS=4,this.forceX=!1,this.sortDirection=H.Physics.Arcade.LEFT_RIGHT,this.skipQuadTree=!0,this.isPaused=!1,this.quadTree=new H.QuadTree(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this._total=0,this.setBoundsToWorld()},H.Physics.Arcade.prototype.constructor=H.Physics.Arcade,H.Physics.Arcade.SORT_NONE=0,H.Physics.Arcade.LEFT_RIGHT=1,H.Physics.Arcade.RIGHT_LEFT=2,H.Physics.Arcade.TOP_BOTTOM=3,H.Physics.Arcade.BOTTOM_TOP=4,H.Physics.Arcade.prototype={setBounds:function(t,e,i,s){this.bounds.setTo(t,e,i,s)},setBoundsToWorld:function(){this.bounds.copyFrom(this.game.world.bounds)},enable:function(t,e){void 0===e&&(e=!0);var i=1;if(Array.isArray(t))for(i=t.length;i--;)t[i]instanceof H.Group?this.enable(t[i].children,e):(this.enableBody(t[i]),e&&t[i].hasOwnProperty("children")&&0a.right)break;if(a.x>t.body.right)continue}else if(this.sortDirection===H.Physics.Arcade.TOP_BOTTOM){if(t.body.bottoma.bottom)break;if(a.y>t.body.bottom)continue}this.collideSpriteVsSprite(t,h,i,s,o,n)}}else{this.quadTree.clear(),this.quadTree.reset(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this.quadTree.populate(e);var l=this.quadTree.retrieve(t);for(r=0;rl.right)continue;if(l.x>a.right)break}else if(this.sortDirection===H.Physics.Arcade.TOP_BOTTOM){if(a.bottoml.bottom)continue;if(l.y>r.body.bottom)break}this.collideSpriteVsSprite(r,c,e,i,s,o)}}}}},collideGroupVsGroup:function(t,e,i,s,o,n){if(0!==t.length&&0!==e.length)for(var a=0;a=e.right)&&!(t.position.y>=e.bottom))))},circleBodyIntersects:function(t,e){var i=H.Math.clamp(t.center.x,e.left,e.right),s=H.Math.clamp(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-s)*(t.center.y-s)<=t.radius*t.radius},separateCircle:function(t,e,i){this.getOverlapX(t,e),this.getOverlapY(t,e);var s=e.center.x-t.center.x,o=e.center.y-t.center.y,n=Math.atan2(o,s),a=0;if(t.isCircle!==e.isCircle){var r={x:e.isCircle?t.position.x:e.position.x,y:e.isCircle?t.position.y:e.position.y,right:e.isCircle?t.right:e.right,bottom:e.isCircle?t.bottom:e.bottom},h={x:t.isCircle?t.position.x+t.radius:e.position.x+e.radius,y:t.isCircle?t.position.y+t.radius:e.position.y+e.radius,radius:t.isCircle?t.radius:e.radius};h.yt.velocity.x?t.velocity.x*=-1:e.velocity.x<0&&!e.immovable&&t.velocity.xt.velocity.y?t.velocity.y*=-1:e.velocity.y<0&&!e.immovable&&t.velocity.yMath.PI/2&&(t.velocity.x<0&&!t.immovable&&e.velocity.xe.velocity.x?e.velocity.x*=-1:t.velocity.y<0&&!t.immovable&&e.velocity.ye.velocity.y&&(e.velocity.y*=-1)),t.immovable||(t.x+=t.velocity.x*this.game.time.physicsElapsed-a*Math.cos(n),t.y+=t.velocity.y*this.game.time.physicsElapsed-a*Math.sin(n)),e.immovable||(e.x+=e.velocity.x*this.game.time.physicsElapsed+a*Math.cos(n),e.y+=e.velocity.y*this.game.time.physicsElapsed+a*Math.sin(n)),t.onCollide&&t.onCollide.dispatch(t.sprite,e.sprite),e.onCollide&&e.onCollide.dispatch(e.sprite,t.sprite),!0},getOverlapX:function(t,e,i){var s=0,o=t.deltaAbsX()+e.deltaAbsX()+this.OVERLAP_BIAS;return 0===t.deltaX()&&0===e.deltaX()?(t.embedded=!0,e.embedded=!0):t.deltaX()>e.deltaX()?o<(s=t.right-e.x)&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0):t.deltaX()e.deltaY()?o<(s=t.bottom-e.y)&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0):t.deltaY()this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:0this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.sprite.position.x+=this._dx,this.sprite.position.y+=this._dy,this._reset=!0),this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.allowRotation&&(this.sprite.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y)},checkWorldBounds:function(){var t=this.position,e=this.game.physics.arcade.bounds,i=this.game.physics.arcade.checkCollision,s=this.worldBounce?-this.worldBounce.x:-this.bounce.x,o=this.worldBounce?-this.worldBounce.y:-this.bounce.y;if(this.isCircle){var n=this.center.x-this.radius,a=this.center.y-this.radius,r=this.center.x+this.radius,h=this.center.y+this.radius;ne.right&&i.right&&(t.x=e.right-this.halfWidth-this.radius,this.velocity.x*=s,this.blocked.right=!0),ae.bottom&&i.down&&(t.y=e.bottom-this.halfHeight-this.radius,this.velocity.y*=o,this.blocked.down=!0)}else t.xe.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=s,this.blocked.right=!0),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=o,this.blocked.down=!0);return this.blocked.up||this.blocked.down||this.blocked.left||this.blocked.right},moveFrom:function(t,e,i){return void 0===e&&(e=this.speed),0!==e&&(void 0===i?(s=this.angle,i=this.game.math.radToDeg(s)):s=this.game.math.degToRad(i),this.moveTimer=0,this.moveDuration=t,0===i||180===i?this.velocity.set(Math.cos(s)*e,0):90===i||270===i?this.velocity.set(0,Math.sin(s)*e):this.velocity.set(Math.cos(s)*e,Math.sin(s)*e),this.isMoving=!0);var s},moveTo:function(t,e,i){var s,o=e/(t/1e3);return 0!==o&&(void 0===i?(s=this.angle,i=this.game.math.radToDeg(s)):s=this.game.math.degToRad(i),e=Math.abs(e),this.moveDuration=0,this.moveDistance=e,null===this.moveTarget&&(this.moveTarget=new H.Line,this.moveEnd=new H.Point),this.moveTarget.fromAngle(this.x,this.y,s,e),this.moveEnd.set(this.moveTarget.end.x,this.moveTarget.end.y),this.moveTarget.setTo(this.x,this.y,this.x,this.y),0===i||180===i?this.velocity.set(Math.cos(s)*o,0):90===i||270===i?this.velocity.set(0,Math.sin(s)*o):this.velocity.set(Math.cos(s)*o,Math.sin(s)*o),this.isMoving=!0)},setSize:function(t,e,i,s){void 0===i&&(i=this.offset.x),void 0===s&&(s=this.offset.y),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.setTo(i,s),this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.isCircle=!1,this.radius=0},setCircle:function(t,e,i){void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),0e.deltaAbsY()?l=-1:e.deltaAbsX()e.left&&(s=t.right-o-e.left)>this.TILE_BIAS&&(s=0),0!==s&&(t.customSeparateX?t.overlapX=s:this.processTileSeparationX(t,s)),s},tileCheckY:function(t,e,i){var s=0,o=i.fixedToCamera?0:i.position.y;return t.deltaY()<0&&!t.blocked.up&&e.collideDown&&t.checkCollision.up?e.faceBottom&&t.y-oe.top&&(s=t.bottom-o-e.top)>this.TILE_BIAS&&(s=0),0!==s&&(t.customSeparateY?t.overlapY=s:this.processTileSeparationY(t,s)),s},processTileSeparationX:function(t,e){e<0?t.blocked.left=!0:0=this.firstgid&&tthis.right||e>this.bottom)},intersects:function(t,e,i,s){return!(i<=this.worldX)&&(!(s<=this.worldY)&&(!(t>=this.worldX+this.width)&&!(e>=this.worldY+this.height)))},setCollisionCallback:function(t,e){this.collisionCallback=t,this.collisionCallbackContext=e},destroy:function(){this.collisionCallback=null,this.collisionCallbackContext=null,this.properties=null},setCollision:function(t,e,i,s){this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=s,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=s},resetCollision:function(){this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1},isInteresting:function(t,e){return t&&e?this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.faceTop||this.faceBottom||this.faceLeft||this.faceRight||this.collisionCallback:t?this.collideLeft||this.collideRight||this.collideUp||this.collideDown:!!e&&(this.faceTop||this.faceBottom||this.faceLeft||this.faceRight)},copy:function(t){this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext}},H.Tile.prototype.constructor=H.Tile,Object.defineProperty(H.Tile.prototype,"collides",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}}),Object.defineProperty(H.Tile.prototype,"canCollide",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}}),Object.defineProperty(H.Tile.prototype,"left",{get:function(){return this.worldX}}),Object.defineProperty(H.Tile.prototype,"right",{get:function(){return this.worldX+this.width}}),Object.defineProperty(H.Tile.prototype,"top",{get:function(){return this.worldY}}),Object.defineProperty(H.Tile.prototype,"bottom",{get:function(){return this.worldY+this.height}}),H.Tilemap=function(t,e,i,s,o,n){this.game=t,this.key=e;var a=H.TilemapParser.parse(this.game,e,i,s,o,n);null!==a&&(this.width=a.width,this.height=a.height,this.tileWidth=a.tileWidth,this.tileHeight=a.tileHeight,this.orientation=a.orientation,this.format=a.format,this.version=a.version,this.properties=a.properties,this.widthInPixels=a.widthInPixels,this.heightInPixels=a.heightInPixels,this.layers=a.layers,this.tilesets=a.tilesets,this.imagecollections=a.imagecollections,this.tiles=a.tiles,this.objects=a.objects,this.collideIndexes=[],this.collision=a.collision,this.images=a.images,this.enableDebug=!1,this.currentLayer=0,this.debugMap=[],this._results=[],this._tempA=0,this._tempB=0)},H.Tilemap.CSV=0,H.Tilemap.TILED_JSON=1,H.Tilemap.NORTH=0,H.Tilemap.EAST=1,H.Tilemap.SOUTH=2,H.Tilemap.WEST=3,H.Tilemap.prototype={create:function(t,e,i,s,o,n){return void 0===n&&(n=this.game.world),this.width=e,this.height=i,this.setTileSize(s,o),this.layers.length=0,this.createBlankLayer(t,e,i,s,o,n)},setTileSize:function(t,e){this.tileWidth=t,this.tileHeight=e,this.widthInPixels=this.width*t,this.heightInPixels=this.height*e},addTilesetImage:function(t,e,i,s,o,n,a){if(void 0===t)return null;void 0===i&&(i=this.tileWidth),void 0===s&&(s=this.tileHeight),void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=0),0===i&&(i=32),0===s&&(s=32);var r=null;if(null==e&&(e=t),e instanceof H.BitmapData)r=e.canvas;else{if(!this.game.cache.checkImageKey(e))return null;r=this.game.cache.getImage(e)}var h=this.getTilesetIndex(t);if(null===h&&this.format===H.Tilemap.TILED_JSON)return null;if(this.tilesets[h])return this.tilesets[h].setImage(r),this.tilesets[h];var l=new H.Tileset(t,a,i,s,o,n,{});l.setImage(r),this.tilesets.push(l);for(var c=this.tilesets.length-1,p=o,u=o,d=0,y=0,g=0,f=a;fthis.layers.length)){void 0===e||e<=0?e=Math.min(this.game.width,this.layers[o].widthInPixels):e>this.game.width&&(e=this.game.width),void 0===i||i<=0?i=Math.min(this.game.height,this.layers[o].heightInPixels):i>this.game.height&&(i=this.game.height),this.enableDebug;var n=s.add(new H.TilemapLayer(this.game,this,o,e,i));return this.enableDebug,n}},createBlankLayer:function(t,e,i,s,o,n){if(void 0===n&&(n=this.game.world),null===this.getLayerIndex(t)){for(var a,r={name:t,x:0,y:0,width:e,height:i,widthInPixels:e*s,heightInPixels:i*o,alpha:1,visible:!0,properties:{},indexes:[],callbacks:[],bodies:[],data:null},h=[],l=0;lthis.game.width&&(p=this.game.width),u>this.game.height&&(u=this.game.height),(h=new H.TilemapLayer(this.game,this,this.layers.length-1,p,u)).name=t,n.add(h)}},getIndex:function(t,e){for(var i=0;ithis.layers[o].width&&(i=this.layers[o].width),s>this.layers[o].height&&(s=this.layers[o].height),this._results.length=0,this._results.push({x:t,y:e,width:i,height:s,layer:o});for(var n=e;n>>0;o.data=r,delete o.encoding}else if(o.compression)continue;var l={name:o.name,x:o.x,y:o.y,width:o.width,height:o.height,widthInPixels:o.width*t.tilewidth,heightInPixels:o.height*t.tileheight,alpha:o.opacity,visible:o.visible,properties:{},indexes:[],callbacks:[],bodies:[]};o.properties&&(l.properties=o.properties);var c,p,u,d=0,y=[],g=[],f=0;for(a=o.data.length;f=this.firstgid&&t=this._timer)if(this._timer=this.game.time.time+this.frequency*this.game.time.slowMotion,0!==this._flowTotal)if(0=this._flowTotal)){this.on=!1;break}}else this.emitParticle()&&(this._counter++,-1!==this._flowTotal&&this._counter>=this._flowTotal&&(this.on=!1));else this.emitParticle()&&(this._counter++,0=this._quantity&&(this.on=!1));for(t=this.children.length;t--;)this.children[t].exists&&this.children[t].update()},H.Particles.Arcade.Emitter.prototype.makeParticles=function(t,e,i,s,o){var n;void 0===e&&(e=0),void 0===i&&(i=this.maxParticles),void 0===s&&(s=!1),void 0===o&&(o=!1);var a=0,r=t,h=e;for(this._frames=e,i>this.maxParticles&&(this.maxParticles=i);athis.maxParticles&&(i=this.maxParticles),this._counter=0,this._flowQuantity=i,this._flowTotal=s,o?(this.start(!0,t,e,i),this._counter+=i,this.on=!0,this._timer=this.game.time.time+e*this.game.time.slowMotion):this.start(!1,t,e,i),this},H.Particles.Arcade.Emitter.prototype.start=function(t,e,i,s,o){if(void 0===t&&(t=!0),void 0===e&&(e=0),null==i&&(i=250),void 0===s&&(s=0),void 0===o&&(o=!1),s>this.maxParticles&&(s=this.maxParticles),this.revive(),this.visible=!0,this.lifespan=e,this.frequency=i,t||o)for(var n=0;n=this.bulletFrames.length&&(this.bulletFrameIndex=0)):this.bulletFrameRandom&&(l.frame=this.bulletFrames[Math.floor(Math.random()*this.bulletFrames.length)]);if(l.data.bodyDirty&&(this._data.customBody&&l.body.setSize(this._data.width,this._data.height,this._data.offsetX,this._data.offsetY),l.body.collideWorldBounds=this.bulletCollideWorldBounds,l.data.bodyDirty=!1),l.body.velocity.set(r,h),l.body.gravity.set(this.bulletGravity.x,this.bulletGravity.y),0!==this.bulletSpeedVariance){var p=this.fireRate;(p+=H.Math.between(-this.fireRateVariance,this.fireRateVariance))<0&&(p=0),this._nextFire=this.game.time.now+p}else this._nextFire=this.game.time.now+this.fireRate;this.shots++,this.onFire.dispatch(l,this,s),0H.Weapon.KILL_LIFESPAN&&(this.data.killType===H.Weapon.KILL_DISTANCE?this.game.physics.arcade.distanceToXY(this,this.data.fromX,this.data.fromY,!0)>this.data.killDistance&&this.kill():this.data.bulletManager.bulletBounds.intersects(this)||this.kill()),this.data.rotateToVelocity&&(this.rotation=Math.atan2(this.body.velocity.y,this.body.velocity.x)),this.data.bulletManager.bulletWorldWrap&&this.game.world.wrap(this,this.data.bulletManager.bulletWorldWrapPadding))},H.Video=function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=null),this.game=t,this.key=e,this.width=0,this.height=0,this.type=H.VIDEO,this.disableTextureUpload=!1,this.touchLocked=!1,this.onPlay=new H.Signal,this.onChangeSource=new H.Signal,this.onComplete=new H.Signal,this.onAccess=new H.Signal,this.onError=new H.Signal,this.onTimeout=new H.Signal,this.timeout=15e3,this._timeOutID=null,this.video=null,this.videoStream=null,this.isStreaming=!1,this.retryLimit=20,this.retry=0,this.retryInterval=500,this._retryID=null,this._codeMuted=!1,this._muted=!1,this._codePaused=!1,this._paused=!1,this._pending=!1,this._autoplay=!1,this._endCallback=null,this._playCallback=null,e&&this.game.cache.checkVideoKey(e)){var s=this.game.cache.getVideo(e);s.isBlob?this.createVideoFromBlob(s.data):this.video=s.data,this.width=this.video.videoWidth,this.height=this.video.videoHeight}else i&&this.createVideoFromURL(i,!1);this.video&&!i?this.baseTexture=new PIXI.BaseTexture(this.video):this.baseTexture=new PIXI.BaseTexture(H.Cache.DEFAULT.baseTexture.source),this.baseTexture.forceLoaded(this.width,this.height),this.texture=new PIXI.Texture(this.baseTexture),this.textureFrame=new H.Frame(0,0,0,this.width,this.height,"video"),this.texture.setFrame(this.textureFrame),this.texture.valid=!1,null!==e&&this.video&&(this.texture.valid=this.video.canplay),this.snapshot=null,H.BitmapData&&(this.snapshot=new H.BitmapData(this.game,"",this.width,this.height)),!this.game.device.cocoonJS&&(this.game.device.iOS||this.game.device.chrome)||window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock?this.setTouchLock():s&&(s.locked=!1)},H.Video.prototype={connectToMediaStream:function(t,e){return t&&e&&(this.video=t,this.videoStream=e,this.isStreaming=!0,this.baseTexture.source=this.video,this.updateTexture(null,this.video.videoWidth,this.video.videoHeight),this.onAccess.dispatch(this)),this},startMediaStream:function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=null),!this.game.device.getUserMedia)return this.onError.dispatch(this,"No getUserMedia"),!1;null!==this.videoStream&&(this.videoStream.active?this.videoStream.active=!1:this.videoStream.stop()),this.removeVideoElement(),this.video=document.createElement("video"),this.video.setAttribute("autoplay","autoplay"),null!==e&&(this.video.width=e),null!==i&&(this.video.height=i),this._timeOutID=window.setTimeout(this.getUserMediaTimeout.bind(this),this.timeout);try{navigator.getUserMedia({audio:t,video:!0},this.getUserMediaSuccess.bind(this),this.getUserMediaError.bind(this))}catch(t){this.getUserMediaError(t)}return this},getUserMediaTimeout:function(){clearTimeout(this._timeOutID),this.onTimeout.dispatch(this)},getUserMediaError:function(t){clearTimeout(this._timeOutID),this.onError.dispatch(this,t)},getUserMediaSuccess:function(t){clearTimeout(this._timeOutID),this.videoStream=t,void 0!==this.video.mozSrcObject?this.video.mozSrcObject=t:this.video.src=window.URL&&window.URL.createObjectURL(t)||t;var o=this;this.video.onloadeddata=function(){var s=10;!function t(){if(0=n.f?s():o.fonts.load((t=n.a,P(t)+" "+t.f+"00 300px "+b(t.c)),n.h).then(function(t){1<=t.length?i():setTimeout(e,25)},function(){s()})}()}),i=null,e=new Promise(function(t,e){i=setTimeout(e,n.f)});Promise.race([e,t]).then(function(){i&&(clearTimeout(i),i=null),n.g(n.a)},function(){n.j(n.a)})};var O={D:"serif",C:"sans-serif"},M=null;function L(){if(null===M){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);M=!!t&&(parseInt(t[1],10)<536||536===parseInt(t[1],10)&&parseInt(t[2],10)<=11)}return M}function D(t,e,i){for(var s in O)if(O.hasOwnProperty(s)&&e===t.f[O[s]]&&i===t.f[O[s]])return!0;return!1}function R(t){var e,i=t.g.a.offsetWidth,s=t.h.a.offsetWidth;(e=i===t.f.serif&&s===t.f["sans-serif"])||(e=L()&&D(t,i,s)),e?r()-t.A>=t.w?L()&&D(t,i,s)&&(null===t.u||t.u.hasOwnProperty(t.a.c))?F(t,t.v):F(t,t.B):setTimeout(y(function(){R(this)},t),50):F(t,t.v)}function F(t,e){setTimeout(y(function(){i(this.g.a),i(this.h.a),i(this.j.a),i(this.m.a),e(this.a)},t),0)}function G(t,e,i){this.c=t,this.a=e,this.f=0,this.m=this.j=!1,this.s=i}I.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=r(),R(this)};var U=null;function N(t){0==--t.f&&t.j&&(t.m?((t=t.a).g&&g(t.f,[t.a.c("wf","active")],[t.a.c("wf","loading"),t.a.c("wf","inactive")]),T(t,"active")):S(t.a))}function t(t){this.j=t,this.a=new k,this.h=0,this.f=this.g=!0}function V(t,e){this.c=t,this.a=e}function H(t,e){this.c=t,this.a=e}function z(t,e){this.c=t||"https://fonts.googleapis.com/css",this.a=[],this.f=[],this.g=e||""}G.prototype.g=function(t){var e=this.a;e.g&&g(e.f,[e.a.c("wf",t.c,w(t).toString(),"active")],[e.a.c("wf",t.c,w(t).toString(),"loading"),e.a.c("wf",t.c,w(t).toString(),"inactive")]),T(e,"fontactive",t),this.m=!0,N(this)},G.prototype.h=function(t){var e=this.a;if(e.g){var i=n(e.f,e.a.c("wf",t.c,w(t).toString(),"active")),s=[],o=[e.a.c("wf",t.c,w(t).toString(),"loading")];i||s.push(e.a.c("wf",t.c,w(t).toString(),"inactive")),g(e.f,s,o)}T(e,"fontinactive",t),N(this)},t.prototype.load=function(t){this.c=new e(this.j,t.context||this.j),this.g=!1!==t.events,this.f=!1!==t.classes,function(o,t,e){var i=[],s=e.timeout;n=t,n.g&&g(n.f,[n.a.c("wf","loading")]),T(n,"loading");var n;var i=function(t,e,i){var s,o=[];for(s in e)if(e.hasOwnProperty(s)){var n=t.c[s];n&&o.push(n(e[s],i))}return o}(o.a,e,o.c),a=new G(o.c,t,s);for(o.h=i.length,t=0,e=i.length;tr[1]||r[0]>a[1]?(m.push(t),u.push(a),u.push(r),!0):(n&&(a[0]r[1]?(i=a[0]-r[1],n.aInB=!1):i=(i=a[1]-r[0])<(s=r[1]-a[0])?i:-s),(s=Math.abs(i))n&&(i.aInB=!1);var g=f(h,l);if(-1===g){if(h.c(t.edges[u]),1===(g=f(h,p=m.pop().c(s).sub(a[u])))){if(o<(g=l.j()))return m.push(s),m.push(h),m.push(l),m.push(p),!1;i&&(i.bInA=!1,y=l.normalize(),d=o-g)}m.push(p)}else if(1===g){if(h.c(t.edges[p]),l.c(s).sub(a[p]),-1===(g=f(h,l))){if(o<(g=l.j()))return m.push(s),m.push(h),m.push(l),!1;i&&(i.bInA=!1,y=l.normalize(),d=o-g)}}else{if(p=h.m().normalize(),g=l.f(p),u=Math.abs(g),0o&&(o=r.x),r.yn&&(n=r.y)}return new l(this.pos.clone().add(new h(i,s)),o-i,n-s).l()},(i.Box=l).prototype.toPolygon=l.prototype.l=function(){var t=this.pos,e=this.w,i=this.h;return new s(new h(t.x,t.y),[new h,new h(e,0),new h(e,i),new h(0,i)])},(i.Response=e).prototype.clear=e.prototype.clear=function(){return this.bInA=this.aInB=!0,this.overlap=Number.MAX_VALUE,this};for(var m=[],a=0;a<10;a++)m.push(new h);var u=[];for(a=0;a<5;a++)u.push([]);var r=new e,d=new l(new h,1e-6,1e-6).l();return i.isSeparatingAxis=p,i.pointInCircle=function(t,e){var i=m.pop().c(t).sub(e.pos),s=e.r*e.r,o=i.g();return m.push(i),o<=s},i.pointInPolygon=function(t,e){d.pos.c(t),r.clear();var i=n(d,e,r);return i&&(i=r.aInB),i},i.testCircleCircle=function(t,e,i){var s=m.pop().c(e.pos).sub(t.pos),o=t.r+e.r,n=s.g();return o*o>0,0!==this._cycle&&this._cycle===this._totalTime/a&&y<=t&&this._cycle--,this._time=this._totalTime-this._cycle*a,this._yoyo&&0!=(1&this._cycle)&&(this._time=f-this._time,(p=this._yoyoEase||this.vars.yoyoEase)&&(this._yoyoEase||(!0!==p||this._initted?this._yoyoEase=p=!0===p?this._ease:p instanceof Ease?p:Ease.map[p]:(p=this.vars.ease,this._yoyoEase=p=p?p instanceof Ease?p:"function"==typeof p?new Ease(p,this.vars.easeParams):Ease.map[p]||v.defaultEase:v.defaultEase)),this.ratio=p?1-p.getRatio((f-this._time)/f):0)),this._time>f?this._time=f:this._time<0&&(this._time=0)),this._easeType&&!p?(r=this._time/f,(1===(h=this._easeType)||3===h&&.5<=r)&&(r=1-r),3===h&&(r*=2),1===(l=this._easePower)?r*=r:2===l?r*=r*r:3===l?r*=r*r*r:4===l&&(r*=r*r*r*r),1===h?this.ratio=1-r:2===h?this.ratio=r:this._time/f<.5?this.ratio=r/2:this.ratio=1-r/2):p||(this.ratio=this._ease.getRatio(this._time/f))),d!==this._time||i||g!==this._cycle){if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!i&&this._firstPT&&(!1!==this.vars.lazy&&this._duration||this.vars.lazy&&!this._duration))return this._time=d,this._totalTime=y,this._rawPrevTime=m,this._cycle=g,w.lazyTweens.push(this),void(this._lazy=[t,e]);!this._time||s||p?s&&this._ease._calcEnd&&!p&&(this.ratio=this._ease.getRatio(0===this._time?0:1)):this.ratio=this._ease.getRatio(this._time/f)}for(!1!==this._lazy&&(this._lazy=!1),this._active||!this._paused&&this._time!==d&&0<=t&&(this._active=!0),0===y&&(2===this._initted&&0this._duration&&(t=this._duration),this._yoyo&&0!=(1&this._cycle)?t=this._duration-t+this._cycle*(this._duration+this._repeatDelay):0!==this._repeat&&(t+=this._cycle*(this._duration+this._repeatDelay)),this.totalTime(t,e)):this._time},t.duration=function(t){return arguments.length?s.prototype.duration.call(this,t):this._duration},t.totalDuration=function(t){return arguments.length?-1===this._repeat?this:this.duration((t-this._repeat*this._repeatDelay)/(this._repeat+1)):(this._dirty&&(this._totalDuration=-1===this._repeat?999999999999:this._duration*(this._repeat+1)+this._repeatDelay*this._repeat,this._dirty=!1),this._totalDuration)},t.repeat=function(t){return arguments.length?(this._repeat=t,this._uncache(!0)):this._repeat},t.repeatDelay=function(t){return arguments.length?(this._repeatDelay=t,this._uncache(!0)):this._repeatDelay},t.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},x},!0),_gsScope._gsDefine("TimelineLite",["core.Animation","core.SimpleTimeline","TweenLite"],function(c,p,u){var d=function(t){p.call(this,t),this._labels={},this.autoRemoveChildren=!0===this.vars.autoRemoveChildren,this.smoothChildTiming=!0===this.vars.smoothChildTiming,this._sortChildren=!0,this._onUpdate=this.vars.onUpdate;var e,i,s=this.vars;for(i in s)e=s[i],g(e)&&-1!==e.join("").indexOf("{self}")&&(s[i]=this._swapSelfInParams(e));g(s.tweens)&&this.add(s.tweens,0,s.align,s.stagger)},t=u._internals,e=d._internals={},y=t.isSelector,g=t.isArray,f=t.lazyTweens,m=t.lazyRender,a=_gsScope._gsDefine.globals,v=function(t){var e,i={};for(e in t)i[e]=t[e];return i},x=function(t,e,i){var s,o,n=t.cycle;for(s in n)o=n[s],t[s]="function"==typeof o?o(i,e[i]):o[i%o.length];delete t.cycle},n=e.pauseCallback=function(){},b=function(t){var e,i=[],s=t.length;for(e=0;e!==s;i.push(t[e++]));return i},i=d.prototype=new p;return d.version="1.20.4",i.constructor=d,i.kill()._gc=i._forcingPlayhead=i._hasPause=!1,i.to=function(t,e,i,s){var o=i.repeat&&a.TweenMax||u;return e?this.add(new o(t,e,i),s):this.set(t,i,s)},i.from=function(t,e,i,s){return this.add((i.repeat&&a.TweenMax||u).from(t,e,i),s)},i.fromTo=function(t,e,i,s,o){var n=s.repeat&&a.TweenMax||u;return e?this.add(n.fromTo(t,e,i,s),o):this.set(t,s,o)},i.staggerTo=function(t,e,i,s,o,n,a,r){var h,l,c=new d({onComplete:n,onCompleteParams:a,callbackScope:r,smoothChildTiming:this.smoothChildTiming}),p=i.cycle;for("string"==typeof t&&(t=u.selector(t)||t),y(t=t||[])&&(t=b(t)),(s=s||0)<0&&((t=b(t)).reverse(),s*=-1),l=0;lt._startTime;h._timeline;)l&&h._timeline.smoothChildTiming?h.totalTime(h._totalTime,!0):h._gc&&h._enabled(!0,!1),h=h._timeline;return this},i.remove=function(t){if(t instanceof c){this._remove(t,!1);var e=t._timeline=t.vars.useFrames?c._rootFramesTimeline:c._rootTimeline;return t._startTime=(t._paused?t._pauseTime:e._time)-(t._reversed?t.totalDuration()-t._totalTime:t._totalTime)/t._timeScale,this}if(t instanceof Array||t&&t.push&&g(t)){for(var i=t.length;-1<--i;)this.remove(t[i]);return this}return"string"==typeof t?this.removeLabel(t):this.kill(null,t)},i._remove=function(t,e){return p.prototype._remove.call(this,t,e),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},i.append=function(t,e){return this.add(t,this._parseTimeOrLabel(null,e,!0,t))},i.insert=i.insertMultiple=function(t,e,i,s){return this.add(t,e||0,i,s)},i.appendMultiple=function(t,e,i,s){return this.add(t,this._parseTimeOrLabel(null,e,!0,t),i,s)},i.addLabel=function(t,e){return this._labels[t]=this._parseTimeOrLabel(e),this},i.addPause=function(t,e,i,s){var o=u.delayedCall(0,n,i,s||this);return o.vars.onComplete=o.vars.onReverseComplete=e,o.data="isPause",this._hasPause=!0,this.add(o,t)},i.removeLabel=function(t){return delete this._labels[t],this},i.getLabelTime=function(t){return null!=this._labels[t]?this._labels[t]:-1},i._parseTimeOrLabel=function(t,e,i,s){var o,n;if(s instanceof c&&s.timeline===this)this.remove(s);else if(s&&(s instanceof Array||s.push&&g(s)))for(n=s.length;-1<--n;)s[n]instanceof c&&s[n].timeline===this&&this.remove(s[n]);if(o="number"!=typeof t||e?99999999999=t&&!h;)s._duration||"isPause"===s.data&&0this._time;)h.render(h._reversed?h.totalDuration()-(t-h._startTime)*h._timeScale:(t-h._startTime)*h._timeScale,e,i),h=h._prev;h=null,this.pause()}s._reversed?s.render((s._dirty?s.totalDuration():s._totalDuration)-(t-s._startTime)*s._timeScale,e,i):s.render((t-s._startTime)*s._timeScale,e,i)}s=n}this._onUpdate&&(e||(f.length&&m(),this._callback("onUpdate"))),a&&(this._gc||u!==this._startTime&&d===this._timeScale||(0===this._time||p>=this.totalDuration())&&(o&&(f.length&&m(),this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!e&&this.vars[a]&&this._callback(a)))}},i._hasPausedChild=function(){for(var t=this._first;t;){if(t._paused||t instanceof d&&t._hasPausedChild())return!0;t=t._next}return!1},i.getChildren=function(t,e,i,s){s=s||-9999999999;for(var o=[],n=this._first,a=0;n;)n._startTime=i&&(o._startTime+=t),o=o._next;if(e)for(s in n)n[s]>=i&&(n[s]+=t);return this._uncache(!0)},i._kill=function(t,e){if(!t&&!e)return this._enabled(!1,!1);for(var i=e?this.getTweensOf(e):this.getChildren(!0,!0,!1),s=i.length,o=!1;-1<--s;)i[s]._kill(t,e)&&(o=!0);return o},i.clear=function(t){var e=this.getChildren(!1,!0,!0),i=e.length;for(this._time=this._totalTime=0;-1<--i;)e[i]._enabled(!1,!1);return!1!==t&&(this._labels={}),this._uncache(!0)},i.invalidate=function(){for(var t=this._first;t;)t.invalidate(),t=t._next;return c.prototype.invalidate.call(this)},i._enabled=function(t,e){if(t===this._gc)for(var i=this._first;i;)i._enabled(t,!0),i=i._next;return p.prototype._enabled.call(this,t,e)},i.totalTime=function(t,e,i){this._forcingPlayhead=!0;var s=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,s},i.duration=function(t){return arguments.length?(0!==this.duration()&&0!==t&&this.timeScale(this._duration/t),this):(this._dirty&&this.totalDuration(),this._duration)},i.totalDuration=function(t){if(arguments.length)return t&&this.totalDuration()?this.timeScale(this._totalDuration/t):this;if(this._dirty){for(var e,i,s=0,o=this._last,n=999999999999;o;)e=o._prev,o._dirty&&o.totalDuration(),o._startTime>n&&this._sortChildren&&!o._paused&&!this._calculatingDuration?(this._calculatingDuration=1,this.add(o,o._startTime-o._delay),this._calculatingDuration=0):n=o._startTime,o._startTime<0&&!o._paused&&(s-=o._startTime,this._timeline.smoothChildTiming&&(this._startTime+=o._startTime/this._timeScale,this._time-=o._startTime,this._totalTime-=o._startTime,this._rawPrevTime-=o._startTime),this.shiftChildren(-o._startTime,!1,-9999999999),n=0),s<(i=o._startTime+o._totalDuration/o._timeScale)&&(s=i),o=e;this._duration=this._totalDuration=s,this._dirty=!1}return this._totalDuration},i.paused=function(t){if(!t)for(var e=this._first,i=this._time;e;)e._startTime===i&&"isPause"===e.data&&(e._rawPrevTime=0),e=e._next;return c.prototype.paused.apply(this,arguments)},i.usesFrames=function(){for(var t=this._timeline;t._timeline;)t=t._timeline;return t===c._rootFramesTimeline},i.rawTime=function(t){return t&&(this._paused||this._repeat&&0>0,0!==this._cycle&&this._cycle===this._totalTime/h&&y<=t&&this._cycle--,this._time=this._totalTime-this._cycle*h,this._yoyo&&0!=(1&this._cycle)&&(this._time=d-this._time),this._time>d?t=(this._time=d)+1e-4:this._time<0?this._time=t=0:t=this._time)),this._hasPause&&!this._forcingPlayhead&&!e){if(p<=(t=this._time)||this._repeat&&x!==this._cycle)for(s=this._first;s&&s._startTime<=t&&!l;)s._duration||"isPause"!==s.data||s.ratio||0===s._startTime&&0===this._rawPrevTime||(l=s),s=s._next;else for(s=this._last;s&&s._startTime>=t&&!l;)s._duration||"isPause"===s.data&&0this._time;)l.render(l._reversed?l.totalDuration()-(t-l._startTime)*l._timeScale:(t-l._startTime)*l._timeScale,e,i),l=l._prev;l=null,this.pause()}s._reversed?s.render((s._dirty?s.totalDuration():s._totalDuration)-(t-s._startTime)*s._timeScale,e,i):s.render((t-s._startTime)*s._timeScale,e,i)}s=n}this._onUpdate&&(e||(k.length&&A(),this._callback("onUpdate"))),a&&(this._locked||this._gc||g!==this._startTime&&f===this._timeScale||(0===this._time||u>=this.totalDuration())&&(o&&(k.length&&A(),this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!e&&this.vars[a]&&this._callback(a)))}else y!==this._totalTime&&this._onUpdate&&(e||this._callback("onUpdate"))},o.getActive=function(t,e,i){null==t&&(t=!0),null==e&&(e=!0),null==i&&(i=!1);var s,o,n=[],a=this.getChildren(t,e,i),r=0,h=a.length;for(s=0;st)return i[e].name;return null},o.getLabelBefore=function(t){null==t&&(t=this._time);for(var e=this.getLabelsArray(),i=e.length;-1<--i;)if(e[i].timethis._duration&&(t=this._duration),this._yoyo&&0!=(1&this._cycle)?t=this._duration-t+this._cycle*(this._duration+this._repeatDelay):0!==this._repeat&&(t+=this._cycle*(this._duration+this._repeatDelay)),this.totalTime(t,e)):this._time},o.repeat=function(t){return arguments.length?(this._repeat=t,this._uncache(!0)):this._repeat},o.repeatDelay=function(t){return arguments.length?(this._repeatDelay=t,this._uncache(!0)):this._repeatDelay},o.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},o.currentLabel=function(t){return arguments.length?this.seek(t,!0):this.getLabelBefore(this._time+1e-8)},i},!0),_=180/Math.PI,w=[],P=[],S=[],m={},i=_gsScope._gsDefine.globals,v=function(t,e,i,s){i===s&&(i=s-(s-e)/1e6),t===e&&(e=t+(i-t)/1e6),this.a=t,this.b=e,this.c=i,this.d=s,this.da=s-t,this.ca=i-t,this.ba=e-t},T=function(t,e,i,s){var o={a:t},n={},a={},r={c:s},h=(t+e)/2,l=(e+i)/2,c=(i+s)/2,p=(h+l)/2,u=(l+c)/2,d=(u-p)/8;return o.b=h+(t-h)/4,n.b=p+d,o.c=n.a=(o.b+n.b)/2,n.c=a.a=(p+u)/2,a.b=u-d,r.b=c+(s-c)/4,a.c=r.a=(a.b+r.b)/2,[o,n,a,r]},x=function(t,e,i,s,o){var n,a,r,h,l,c,p,u,d,y,g,f,m,v=t.length-1,x=0,b=t[0].a;for(n=0;n>0||6)-1,p=[],u=[];for(i in t)y(t[i],a,e);for(o=a.length,s=0;s>0]=u,r[n]=l,h=0,u=[]);return{length:l,lengths:r,segments:p}}(this._beziers,this._timeRes);this._length=u.length,this._lengths=u.lengths,this._segments=u.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(p=this._autoRotate)for(this._initialRotations=[],p[0]instanceof Array||(this._autoRotate=p=[p]),n=p.length;-1<--n;){for(a=0;a<3;a++)s=p[n][a],this._func[s]="function"==typeof t[s]&&t[s.indexOf("set")||"function"!=typeof t["get"+s.substr(3)]?s:"get"+s.substr(3)];s=p[n][2],this._initialRotations[n]=(this._func[s]?this._func[s].call(this._target):this._target[s])||0,this._overwriteProps.push(s)}return this._startRatio=i.vars.runBackwards?1:0,!0},set:function(t){var e,i,s,o,n,a,r,h,l,c,p=this._segCount,u=this._func,d=this._target,y=t!==this._startRatio;if(this._timeRes){if(l=this._lengths,c=this._curSeg,t*=this._length,s=this._li,t>this._l2&&s=t;);0===s&&tthis._s2&&s=t;);0===s&&t>0)*(1/p))*p;for(i=1-a,s=this._props.length;-1<--s;)o=this._props[s],r=(a*a*(n=this._beziers[o][e]).da+3*i*(a*n.ca+i*n.ba))*a+n.a,this._mod[o]&&(r=this._mod[o](r,d)),u[o]?d[o](r):d[o]=r;if(this._autoRotate){var g,f,m,v,x,b,w,P=this._autoRotate;for(s=P.length;-1<--s;)o=P[s][2],b=P[s][3]||0,w=!0===P[s][4]?1:_,n=this._beziers[P[s][0]],g=this._beziers[P[s][1]],n&&g&&(n=n[e],g=g[e],f=n.a+(n.b-n.a)*a,f+=((v=n.b+(n.c-n.b)*a)-f)*a,v+=(n.c+(n.d-n.c)*a-v)*a,m=g.a+(g.b-g.a)*a,m+=((x=g.b+(g.c-g.b)*a)-m)*a,x+=(g.c+(g.d-g.c)*a-x)*a,r=y?Math.atan2(x-m,v-f)*w+b:this._initialRotations[s],this._mod[o]&&(r=this._mod[o](r,d)),u[o]?d[o](r):d[o]=r)}}}),t=f.prototype,f.bezierThrough=d,f.cubicToQuadratic=T,f._autoCSS=!0,f.quadraticToCubic=function(t,e,i){return new v(t,(2*e+t)/3,(2*e+i)/3,i)},f._cssRegister=function(){var t=i.CSSPlugin;if(t){var e=t._internals,d=e._parseToProxy,y=e._setPluginRatio,g=e.CSSPropTween;e._registerComplexSpecialProp("bezier",{parser:function(t,e,i,s,o,n){e instanceof Array&&(e={values:e}),n=new f;var a,r,h,l=e.values,c=l.length-1,p=[],u={};if(c<0)return o;for(a=0;a<=c;a++)h=d(t,l[a],s,o,n,c!==a),p[a]=h.end;for(r in e)u[r]=e[r];return u.values=p,(o=new g(t,"bezier",0,0,h.pt,2)).data=h,o.plugin=n,o.setRatio=y,0===u.autoRotate&&(u.autoRotate=!0),!u.autoRotate||u.autoRotate instanceof Array||(a=!0===u.autoRotate?0:Number(u.autoRotate),u.autoRotate=null!=h.end.left?[["left","top","rotation",a,!1]]:null!=h.end.x&&[["x","y","rotation",a,!1]]),u.autoRotate&&(s._transform||s._enableTransforms(!1),h.autoRotate=s._target._gsTransform,h.proxy.rotation=h.autoRotate.rotation||0,s._overwriteProps.push("rotation")),n._onInitTween(h.proxy,u,s._tween),o}})}},t._mod=function(t){for(var e,i=this._overwriteProps,s=i.length;-1<--s;)(e=t[i[s]])&&"function"==typeof e&&(this._mod[i[s]]=e)},t._kill=function(t){var e,i,s=this._props;for(e in this._beziers)if(e in t)for(delete this._beziers[e],delete this._func[e],i=s.length;-1<--i;)s[i]===e&&s.splice(i,1);if(s=this._autoRotate)for(i=s.length;-1<--i;)t[s[i][2]]&&s.splice(i,1);return this._super._kill.call(this,t)},_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(n,N){var y,S,k,g,V=function(){n.call(this,"css"),this._overwriteProps.length=0,this.setRatio=V.prototype.setRatio},l=_gsScope._gsDefine.globals,f={},t=V.prototype=new n("css");(t.constructor=V).version="1.20.5",V.API=2,V.defaultTransformPerspective=0,V.defaultSkewType="compensated",V.defaultSmoothOrigin=!0,t="px",V.suffixMap={top:t,right:t,bottom:t,left:t,width:t,height:t,fontSize:t,padding:t,margin:t,perspective:t,lineHeight:""};var A,m,v,F,x,T,B,C,e,i,E=/(?:\-|\.|\b)(\d|\.|e\-)+/g,I=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,b=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,c=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,O=/(?:\d|\-|\+|=|#|\.)*/g,M=/opacity *= *([^)]*)/i,w=/opacity:([^;]*)/i,a=/alpha\(opacity *=.+?\)/i,P=/^(rgb|hsl)/,r=/([A-Z])/g,h=/-([a-z])/gi,_=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,p=function(t,e){return e.toUpperCase()},d=/(?:Left|Right|Width)/i,u=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,L=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,D=/,(?=[^\)]*(?:\(|$))/gi,R=/[\s,\(]/i,G=Math.PI/180,H=180/Math.PI,U={},s={style:{}},z=_gsScope.document||{createElement:function(){return s}},X=function(t,e){return z.createElementNS?z.createElementNS(e||"http://www.w3.org/1999/xhtml",t):z.createElement(t)},j=X("div"),W=X("img"),o=V._internals={_specialProps:f},q=(_gsScope.navigator||{}).userAgent||"",Y=(e=q.indexOf("Android"),i=X("a"),v=-1!==q.indexOf("Safari")&&-1===q.indexOf("Chrome")&&(-1===e||3>16,t>>8&255,255&t];else{if(","===t.charAt(t.length-1)&&(t=t.substr(0,t.length-1)),dt[t])i=dt[t];else if("#"===t.charAt(0))4===t.length&&(t="#"+(s=t.charAt(1))+s+(o=t.charAt(2))+o+(n=t.charAt(3))+n),i=[(t=parseInt(t.substr(1),16))>>16,t>>8&255,255&t];else if("hsl"===t.substr(0,3))if(i=u=t.match(E),e){if(-1!==t.indexOf("="))return t.match(I)}else a=Number(i[0])%360/360,r=Number(i[1])/100,s=2*(h=Number(i[2])/100)-(o=h<=.5?h*(r+1):h+r-h*r),3s--)for(;++ss--)for(;++s>0];return s.parse(t,a,o,n)}},bt=(o._setPluginRatio=function(t){this.plugin.setRatio(t);for(var e,i,s,o,n,a=this.data,r=a.proxy,h=a.firstMPT;h;)e=r[h.v],h.r?e=h.r(e):e<1e-6&&-1e-6r.length?h.length:r.length,a=0;an.pr;)a=a._next;(n._prev=a?a._prev:h)?n._prev._next=n:r=n,(n._next=a)?a._prev=n:h=n,n=l}this._firstPT=r}return!0},t.parse=function(t,e,i,s){var o,n,a,r,h,l,c,p,u,d,y=t.style;for(o in e){if("function"==typeof(l=e[o])&&(l=l(C,B)),n=f[o])i=n.parse(t,l,o,this,i,s,e);else{if("--"===o.substr(0,2)){this._tween._propLookup[o]=this._addTween.call(this._tween,t.style,"setProperty",tt(t).getPropertyValue(o)+"",l+"",o,!1,o);continue}h=et(t,o,k)+"",u="string"==typeof l,"color"===o||"fill"===o||"stroke"===o||-1!==o.indexOf("Color")||u&&P.test(l)?(u||(l=(3<(l=gt(l)).length?"rgba(":"rgb(")+l.join(",")+")"),i=_t(y,o,h,l,!0,"transparent",i,0,s)):u&&R.test(l)?i=_t(y,o,h,l,!0,null,i,0,s):(c=(a=parseFloat(h))||0===a?h.substr((a+"").length):"",""!==h&&"auto"!==h||(c="width"===o||"height"===o?(a=ht(t,o,k),"px"):"left"===o||"top"===o?(a=st(t,o,k),"px"):(a="opacity"!==o?0:1,"")),""===(p=(d=u&&"="===l.charAt(1))?(r=parseInt(l.charAt(0)+"1",10),l=l.substr(2),r*=parseFloat(l),l.replace(O,"")):(r=parseFloat(l),u?l.replace(O,""):""))&&(p=o in S?S[o]:c),l=r||0===r?(d?r+a:r)+p:e[o],c!==p&&(""===p&&"lineHeight"!==o||(r||0===r)&&a&&(a=it(t,o,a,c),"%"===p?(a/=it(t,o,100,"%")/100,!0!==e.strictUnits&&(h=a+"%")):"em"===p||"rem"===p||"vw"===p||"vh"===p?a/=it(t,o,1,p):"px"!==p&&(r=it(t,o,r,p),p="px"),d&&(r||0===r)&&(l=r+a+p))),d&&(r+=a),!a&&0!==a||!r&&0!==r?void 0!==y[o]&&(l||l+""!="NaN"&&null!=l)?(i=new wt(y,o,r||a||0,0,i,-1,o,!1,0,h,l)).xs0="none"!==l||"display"!==o&&-1===o.indexOf("Style")?l:h:J(e[o]):(i=new wt(y,o,a,r-a,i,0,o,!1!==A&&("px"===p||"zIndex"===o),0,h,l)).xs0=p)}s&&i&&!i.plugin&&(i.plugin=s)}return i},t.setRatio=function(t){var e,i,s,o=this._firstPT;if(1!==t||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(t||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;o;){if(e=o.c*t+o.s,o.r?e=o.r(e):e<1e-6&&-1e-6this._p3?this._calcEnd?1===t?0:1-(t=(t-this._p3)/this._p1)*t:e+(t-e)*(t=(t-this._p3)/this._p1)*t*t*t:this._calcEnd?1:e},y.ease=new y(.7,.7),g.config=y.config=function(t,e,i){return new y(t,e,i)},(g=(i=h("easing.SteppedEase",function(t,e){t=t||1,this._p1=1/t,this._p2=t+(e?0:1),this._p3=e?1:0},!0)).prototype=new f).constructor=i,g.getRatio=function(t){return t<0?t=0:1<=t&&(t=.999999999),((this._p2*t|0)+this._p3)*this._p1},g.config=i.config=function(t,e){return new i(t,e)},(g=(s=h("easing.ExpoScaleEase",function(t,e,i){this._p1=Math.log(e/t),this._p2=e-t,this._p3=t,this._ease=i},!0)).prototype=new f).constructor=s,g.getRatio=function(t){return this._ease&&(t=this._ease.getRatio(t)),(this._p3*Math.exp(this._p1*t)-this._p3)/this._p2},g.config=s.config=function(t,e,i){return new s(t,e,i)},(g=(e=h("easing.RoughEase",function(t){for(var e,i,s,o,n,a,r=(t=t||{}).taper||"none",h=[],l=0,c=0|(t.points||20),p=c,u=!1!==t.randomize,d=!0===t.clamp,y=t.template instanceof f?t.template:null,g="number"==typeof t.strength?.4*t.strength:.4;-1<--p;)e=u?Math.random():1/c*p,i=y?y.getRatio(e):e,s="none"===r?g:"out"===r?(o=1-e)*o*g:"in"===r?e*e*g:e<.5?(o=2*e)*o*.5*g:(o=2*(1-e))*o*.5*g,u?i+=Math.random()*s-.5*s:p%2?i+=.5*s:i-=.5*s,d&&(1e.t){for(;e.next&&t>=e.t;)e=e.next;e=e.prev}else for(;e.prev&&t<=e.t;)e=e.prev;return(this._prev=e).v+(t-e.t)/e.gap*e.c},g.config=function(t){return new e(t)},e.ease=new e,p("Bounce",l("BounceOut",function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}),l("BounceIn",function(t){return(t=1-t)<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}),l("BounceInOut",function(t){var e=t<.5;return(t=e?1-2*t:2*t-1)<1/2.75?t*=7.5625*t:t=t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5})),p("Circ",l("CircOut",function(t){return Math.sqrt(1-(t-=1)*t)}),l("CircIn",function(t){return-(Math.sqrt(1-t*t)-1)}),l("CircInOut",function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)})),p("Elastic",(t=function(t,e,i){var s=h("easing."+t,function(t,e){this._p1=1<=t?t:1,this._p2=(e||i)/(t<1?t:1),this._p3=this._p2/a*(Math.asin(1/this._p1)||0),this._p2=a/this._p2},!0),o=s.prototype=new f;return o.constructor=s,o.getRatio=e,o.config=function(t,e){return new s(t,e)},s})("ElasticOut",function(t){return this._p1*Math.pow(2,-10*t)*Math.sin((t-this._p3)*this._p2)+1},.3),t("ElasticIn",function(t){return-this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*this._p2)},.3),t("ElasticInOut",function(t){return(t*=2)<1?this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(t-=1))*Math.sin((t-this._p3)*this._p2)*.5+1},.45)),p("Expo",l("ExpoOut",function(t){return 1-Math.pow(2,-10*t)}),l("ExpoIn",function(t){return Math.pow(2,10*(t-1))-.001}),l("ExpoInOut",function(t){return(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))})),p("Sine",l("SineOut",function(t){return Math.sin(t*r)}),l("SineIn",function(t){return 1-Math.cos(t*r)}),l("SineInOut",function(t){return-.5*(Math.cos(Math.PI*t)-1)})),h("easing.EaseLookup",{find:function(t){return f.map[t]}},!0),c(o.SlowMo,"SlowMo","ease,"),c(e,"RoughEase","ease,"),c(i,"SteppedEase","ease,"),d},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(u,d){"use strict";var y={},s=u.document,g=u.GreenSockGlobals=u.GreenSockGlobals||u;if(g.TweenLite)return g.TweenLite;var t,e,i,f,m,o,n,v=function(t){var e,i=t.split("."),s=g;for(e=0;e=i&&tthis._duration?this._duration:t,e)):this._time},i.totalTime=function(t,e,i){if(m||f.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(t<0&&!i&&(t+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var s=this._totalDuration,o=this._timeline;if(sn;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=this._first,this._first=t),t._next?t._next._prev=t:this._last=t,t._prev=o,this._recent=t,this._timeline&&this._uncache(!0),this},i._remove=function(t,e){return t.timeline===this&&(e||t._enabled(!1,!0),t._prev?t._prev._next=t._next:this._first===t&&(this._first=t._next),t._next?t._next._prev=t._prev:this._last===t&&(this._last=t._prev),t._next=t._prev=t.timeline=null,t===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},i.render=function(t,e,i){var s,o=this._first;for(this._totalTime=this._time=this._rawPrevTime=t;o;)s=o._next,(o._active||t>=o._startTime&&!o._paused&&!o._gc)&&(o._reversed?o.render((o._dirty?o.totalDuration():o._totalDuration)-(t-o._startTime)*o._timeScale,e,i):o.render((t-o._startTime)*o._timeScale,e,i)),o=s},i.rawTime=function(){return m||f.wake(),this._totalTime};var L=S("TweenLite",function(t,e,i){if(c.call(this,e,i),this.render=L.prototype.render,null==t)throw"Cannot tween a null target.";this.target=t="string"!=typeof t?t:L.selector(t)||t;var s,o,n,a=t.jquery||t.length&&t!==u&&t[0]&&(t[0]===u||t[0].nodeType&&t[0].style&&!t.nodeType),r=this.vars.overwrite;if(this._overwrite=r=null==r?Y[L.defaultOverwrite]:"number"==typeof r?r>>0:Y[r],(a||t instanceof Array||t.push&&w(t))&&"number"!=typeof t[0])for(this._targets=n=h(t),this._propLookup=[],this._siblings=[],s=0;s=Q){for(i in Q=f.frame+(parseInt(L.autoSleep,10)||120),j){for(t=(e=j[i].tweens).length;-1<--t;)e[t]._gc&&e.splice(t,1);0===e.length&&delete j[i]}if((!(i=J._first)||i._paused)&&L.autoSleep&&!K._first&&1===f._listeners.tick.length){for(;i&&i._paused;)i=i._next;i||f.sleep()}}},f.addEventListener("tick",c._updateRoot);var $=function(t,e,i){var s,o,n=t._gsTweenID;if(j[n||(t._gsTweenID=n="t"+W++)]||(j[n]={target:t,tweens:[]}),e&&((s=j[n].tweens)[o=s.length]=e,i))for(;-1<--o;)s[o]===e&&s.splice(o,1);return j[n].tweens},tt=function(t,e,i,s){var o,n,a=t.vars.onOverwrite;return a&&(o=a(t,e,i,s)),(a=L.onOverwrite)&&(n=a(t,e,i,s)),!1!==o&&!1!==n},et=function(t,e,i,s,o){var n,a,r,h;if(1===s||4<=s){for(h=o.length,n=0;nc&&((d||!r._initted)&&c-r._startTime<=2e-10||(p[u++]=r)));for(n=u;-1<--n;)if(r=p[n],2===s&&r._kill(i,t,e)&&(a=!0),2!==s||!r._firstPT&&r._initted){if(2!==s&&!tt(r,e))continue;r._enabled(!1,!1)&&(a=!0)}return a},it=function(t,e,i){for(var s=t._timeline,o=s._timeScale,n=t._startTime;s._timeline;){if(n+=s._startTime,o*=s._timeScale,s._paused)return-100;s=s._timeline}return e<(n/=o)?n-e:i&&n===e||!t._initted&&n-e<2e-10?x:(n+=t.totalDuration()/t._timeScale/o)>e+x?0:n-e-x};i._init=function(){var t,e,i,s,o,n,a=this.vars,r=this._overwrittenProps,h=this._duration,l=!!a.immediateRender,c=a.ease;if(a.startAt){for(s in this._startAt&&(this._startAt.render(-1,!0),this._startAt.kill()),o={},a.startAt)o[s]=a.startAt[s];if(o.data="isStart",o.overwrite=!1,o.immediateRender=!0,o.lazy=l&&!1!==a.lazy,o.startAt=o.delay=null,o.onUpdate=a.onUpdate,o.onUpdateParams=a.onUpdateParams,o.onUpdateScope=a.onUpdateScope||a.callbackScope||this,this._startAt=L.to(this.target||{},0,o),l)if(0r.pr;)s=s._next;(r._prev=s?s._prev:n)?r._prev._next=r:o=r,(r._next=s)?s._prev=r:n=r,r=a}r=e._firstPT=o}for(;r;)r.pg&&"function"==typeof r.t[t]&&r.t[t]()&&(i=!0),r=r._next;return i},st.activate=function(t){for(var e=t.length;-1<--e;)t[e].API===st.API&&(X[(new t[e])._propName]=t[e]);return!0},a.plugin=function(t){if(!(t&&t.propName&&t.init&&t.API))throw"illegal plugin definition.";var e,i=t.propName,s=t.priority||0,o=t.overwriteProps,n={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=S("plugins."+i.charAt(0).toUpperCase()+i.substr(1)+"Plugin",function(){st.call(this,i,s),this._overwriteProps=o||[]},!0===t.global),r=a.prototype=new st(i);for(e in(r.constructor=a).API=t.API,n)"function"==typeof t[e]&&(r[n[e]]=t[e]);return a.version=t.version,st.activate([a]),a},t=u._gsQueue){for(e=0;ee.levels.latestCompleted&&t<11&&(e.levels.latestCompleted=t,Constants.latestCompleted=t)},this,null,!1),this.state=GameStates.Loading},t.prototype.changeLevel=function(r,h,l,t,c){var p=this;void 0===l&&(l=!1),void 0===t&&(t=-1),void 0===c&&(c=0),this.challengeStep=t,Constants.levelMapStartTime||(Constants.levelMapStartTime=Date.now()),"11"===this.prevLevel&&this.game.world.setBounds(-3e3,-3e3,9e3,6e3);var u=0;if(0===t){var e=SaveGame.getInstance().getChallengeData();0p.levels.latestCompleted&&e<11&&(p.levels.latestCompleted=e,Constants.latestCompleted=e)}if(p.destroyLevel(),"11"===p.currentLevelID){var i=p.currentLevel.data.files.slice(),s=void 0;p.roomslist=[],p.roomsSize=[],p.roomsData=p.currentLevel.data.rooms;var o=[];o.push(i.splice(24,1)[0]),o.push(i.splice(21,1)[0]),o.push(i.splice(18,1)[0]),o.push(i.splice(15,1)[0]),o.push(i.splice(12,1)[0]),o.push(i.splice(2,1)[0]),o=Phaser.ArrayUtils.shuffle(o);for(var n=0;n<3;n++)s=o.splice(Math.floor(Math.random()*o.length),1)[0],p.roomslist.push(s),p.roomsSize.push({width:p.roomsData[s].width,height:p.roomsData[s].height});i=i.concat(o);for(n=0;nthis.challengeStep?(l.splice(c,1),c--):"finishPortal"===l[c].type&&(r.push(l[c]),l[c].challengeStep>r[h].challengeStep&&(h=r.length-1));r.splice(h,1);c=0;for(var p=r.length;c=Constants.particleLimit)for(var p=0,u=this.particles;p=Constants.particleLimit)for(var u=0,d=this.particlesUI;u=Constants.particleLimit)for(var u=0,d=this.particles;uthis.currentLevel.topTime&&this.resetLevel(!0,!0)),this.checkParallax();break;case GameStates.PlayingMainMenu:for(var g=0,f=this.cannons;gthis.currentLevel.topTime&&this.resetLevel(!0,!0)),this.checkParallax();break;case GameStates.Window:case GameStates.PauseMainMenu:break;case GameStates.MainMenu:Constants.parallax&&(this.background.x+=1,this.background.y+=1,this.background.x=this.background.x%140,this.background.y=this.background.y%140)}this.trophiesUI&&this.trophiesUI.setUI(),this.gameplayUI.updateAchievment()},t.prototype.checkParallax=function(){Constants.parallax?(this.background.x=this.game.camera.x+this.game.camera.x/10%140,this.background.y=this.game.camera.y+this.game.camera.y/10%140):(this.background.x=this.game.camera.x,this.background.y=this.game.camera.y)},t.prototype.resetDeath=function(){this.resumeOnReset()},t.prototype.pauseOnLevelEnd=function(){this.game.paused=!0,this.keys.hide(),this.player.pause()},t.prototype.resumeOnReset=function(){var t=Date.now();this.currentTime=t,this.game.paused=!1;for(var e=0,i=this.blocks;eConstants.minSizeView?1:Constants.minSizeView/this.game.width,e=this.game.height>Constants.minSizeView?1:Constants.minSizeView/this.game.height,i=ethis.maxScaleTime&&(this.scaling=!1,this.falling=!0,this.setJump(),this.lastScaled=!1),this.xVelocity=this.forcedXVelocity=0):(e&&this.scaleHistory!=t.rightEdge||!e&&this.scaleHistory!==t.leftEdge)&&(this.scaleTime=0,this.scaling=!0,this.falling=!1,this.diving=!1,this.rotation=0,this.rotationDest=0,5this.xPos+40||r.topEdge>this.yPos+80||r.bottomEdgethis.fallingMax&&SAT.testPolygonPolygon(this.totalPolygon,r.topBoundPolygon)){if("bounce"===r.blockType&&SAT.testPolygonPolygon(this.totalPolygon,r.topBoundPolygon)){this.land(r);continue}return void this.kill(1)}if(0r.xPos-.5*r.width&&this.xPosr.rightEdge)continue;if(this.hanging||this.yVelocity-r.yVelocity<=.5){this.scaling||this.hanging?(this.setJump(),this.scaling=!1,this.scaleTime=0,this.hanging=!1,this.hangTime=0,this.currentHang=null,this.yVelocity=2,this.falling=!0,this.scaleHistory=4e3,this.lastZipline=!1):this.yVelocity*=-.5,"ice"===r.blockType?this.yPos=r.yPos+.5*r.height+r.yVelocity+this.height+2:this.yPos=r.yPos+.5*r.height+4*r.yVelocity+this.height+1,0!=r.yVelocity&&(this.yPos+=20,this.yVelocity=0),this.updateHitBoxesPos(),i=!0,"push"===r.blockType&&(n=!0);continue}}if(!this.currentHang&&this.poolCoolDown<=0&&!this.swimming){if(r.hangable&&this.falling&&this.hangTime>=this.maxHangCoolDown&&(0<=this.yVelocity||r.yVelocity<0)){if(SAT.testPolygonPolygon(this.handsPolygon,r.lhBoundPolygon)&&!this.checkForBlock(r.leftEdge+3,r.topEdge-5)&&!this.checkForBlock(r.leftEdge-3,r.topEdge-5)){this.hang(r),o=t=!0;continue}if(SAT.testPolygonPolygon(this.handsPolygon,r.rhBoundPolygon)&&!this.checkForBlock(r.rightEdge+3,r.topEdge-5)&&!this.checkForBlock(r.rightEdge+-3,r.topEdge-5)){this.hang(r,!1),s=t=!0;continue}}}else{if(null!==this.currentHang&&!this.currentHang.alive){this.unhang(),this.setRun(),this.xVelocity=0;continue}if("right"===this.facing&&this.currentHang===r){this.hang(this.currentHang),o=!0;continue}if("left"===this.facing&&this.currentHang===r){this.hang(this.currentHang,!1),s=!0;continue}t=!0}if(this.xPos>r.rightEdge||this.xPosthis.xVelocity&&(r.xVelocity=this.xVelocity);l=r;this.xPos=r.rightEdge+this.width/2+this.xVelocity,l.pushingLeft=!0,l.pushed=!0,this.state!==PlayerState.Pushing&&this.setPush()}else;}}}else void 0!==r.isIgnore&&(r.isIgnore=!0)}if(s&&o||e&&i)return n&&this.main.achievements.gotAchievement("headsup"),void this.kill(3);t||e&&this.state!==PlayerState.Pushing||this.currentSlope||this.currentHang||(this.falling=!0,!this.diving&&this.yVelocity<=this.fallingMax&&(this.rotationDest=0),this.state===PlayerState.Running||this.state===PlayerState.Idle||this.state===PlayerState.Pushing?this.setJump():this.crouching?(this.setJump(),this.crouching=!1):(this.scaling||this.hanging)&&(this.setJump(),this.scaling=!1,this.scaleTime=0,this.hanging=!1,this.hangTime=0))}},t.prototype.checkSlopeCollisions=function(){this.currentSlope=null;for(var t=0,e=this.main.slopes;ti.leftEdge&&this.xPos=i.bottomEdge+.5*this.height&&this.yVelocity<0&&(this.yPos=i.bottomEdge+this.height,this.yVelocity*=-.5,this.yPos+=this.yVelocity,this.updatePositions(),this.scaleHistory=4e3,this.currentZipline=null),this.xPos>i.leftEdge&&this.xPosi.topEdge&&this.yPos=i.bottomEdge-i.height*s){o=i.height/i.width;if(this.yVelocity>-5-o){if(20<=this.yVelocity)return void this.kill(3);this.state!==PlayerState.Crouching&&(1=i.bottomEdge-i.height*s){var o=i.height/i.width;if(this.yVelocity>-5-o){if(20<=this.yVelocity)return void this.kill(3);1-this.maxVelocity?(this.xVelocity-=this.acc,0e.rightEdge||this.xPos+40e.bottomEdge||this.yPos+80this.fallingMax?(this.state!=PlayerState.Falling&&(this.setFall(),this.diving=!1),this.rotationDest+=-this.container.scale.x*this.yVelocity*.25*this.main.gameSpeed,(this.rotation<-150||150e*s?this.xVelocity=e*s:e<0&&this.xVelocityi*s?this.yVelocity=i*s:i<0&&this.yVelocitye*s?this.xVelocity=e*s:e<0&&this.xVelocityi*s?this.yVelocity=i*s:i<0&&this.yVelocitythis.xPos+40||e.topEdge>this.yPos+80||e.bottomEdgei.height/2-40)return;t=!0,this.currentRope!==i&&(this.rotationDest=0,this.rotation=0,this.xPosConstants.minSizeView?200:1/Constants.zoom*200,s=this.game.height>Constants.minSizeView?200:1/Constants.zoom*200;n=(this.game.input.activePointer.position.x-t)/t*i+this.xPos*(1/Constants.zoom),a=(this.game.input.activePointer.position.y-e)/e*s+this.yPos*(1/Constants.zoom),h=n-this.game.camera.x-t,l=a-this.game.camera.y-e;(r=Math.sqrt(Math.pow(this.game.camera.y-a,2)+Math.pow(this.game.camera.x-n,2)))<.5?(this.game.camera.x=n,this.game.camera.y=a):(this.game.camera.x+=h/15,this.game.camera.y+=l/15)}else{var o=0;10this.rotation?this.rotation+=t+(this.rotationDest-this.rotation)/3:this.rotationDestthis.maxBreathe&&(this.breathe=this.maxBreathe))}this.breatheBar(),this.game.device.desktop&&this.pressDown.blink()}this.main.followingWire||"mainmenu"===this.main.currentLevelID||this.cameraLogic()},t.prototype.breatheBar=function(){if(this.swimming){this.breatheGroup.visible=!0,this.breatheGroup.rotation=-this.container.rotation,this.breatheGroup.scale.x<1&&(this.breatheGroup.scale.x+=-.1,1=this.fadeAfter){if(this.sprite.alpha-=.1*this.main.gameSpeed,this.sprite.alpha<=0)return void this.destroy()}else this.fadeTime++;var t=this.xPos,e=this.yPos;r.prototype.update.call(this),this.alive&&(this.rotation+=this.rotSpeed,0=this.timeHide?this.hide():!this.alive&&this.actTime>=this.timeShow&&this.show(),this.alive&&this.actTime>=this.timeHide*(1-Constants.alertDisapper)?this.sprite.tint=30583:!this.alive&&this.actTime>=this.timeShow*(1-Constants.alertApper)&&(this.sprite.alpha=.2,this.sprite.tint=16777215)},t.prototype.show=function(){this.actTime=0,this.alive=!0,this.sprite.alpha=1},t.prototype.hide=function(){this.actTime=0,this.alive=!1,this.sprite.alpha=0},t.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,o.prototype.destroy.call(this)},t.prototype.resetLevel=function(){o.prototype.resetLevel.call(this),this.actTime=0,this.alive=this.initVisible,this.sprite.alpha=this.initVisible?1:0},t.TOP_BOUND_HEIGHT=12,t}(Block),BasicBlock=function(o){function a(t,e,i){var s=o.call(this,t,e,i)||this;return s.sprite=i.create(0,0,"basicBlockColors"),s.sprite.autoCull=!0,s.sprite.visible=!1,s.alive=!1,s.hangable=!0,s.scalable=!0,s}return __extends(a,o),a.prototype.spawn=function(t,e,i,s){this.xPos=t,this.yPos=e,this.prevX=t,this.prevY=e,this.width=i,this.height=s,this.sprite.position.set(t,e),this.sprite.scale.set(i/this.sprite.width,s/this.sprite.height),this.sprite.anchor.set(.5,.5),this.sprite.frame=parseInt(this.main.currentLevelID),this.sprite.visible=!0,this.xVelocity=0,this.yVelocity=0,this.leftEdge=t-.5*i,this.rightEdge=t+.5*i,this.topEdge=e-.5*s,this.bottomEdge=e+.5*s,this.xVelocity=0,this.yVelocity=0,this.landed=null,this.alive=!0;var o=.5*this.width,n=.5*this.height;this.totalBound=new SAT.Box(new SAT.Vector(t,e),i,s),this.totalBoundPolygon=this.totalBound.toPolygon(),this.totalBoundPolygon.setOffset(new SAT.Vector(-o,-n)),this.topBound=new SAT.Box(new SAT.Vector(t,e),i,a.TOP_BOUND_HEIGHT),this.topBoundPolygon=this.topBound.toPolygon(),this.topBoundPolygon.setOffset(new SAT.Vector(-o,-n)),this.lhBound=new SAT.Box(new SAT.Vector(t,e),o,a.TOP_BOUND_HEIGHT),this.lhBoundPolygon=this.lhBound.toPolygon(),this.lhBoundPolygon.setOffset(new SAT.Vector(-o,-n)),this.rhBound=new SAT.Box(new SAT.Vector(t,e),o,a.TOP_BOUND_HEIGHT),this.rhBoundPolygon=this.rhBound.toPolygon(),this.rhBoundPolygon.setOffset(new SAT.Vector(0,-n)),this.leftBound=new SAT.Box(new SAT.Vector(t,e),o,s),this.leftBoundPolygon=this.leftBound.toPolygon(),this.leftBoundPolygon.setOffset(new SAT.Vector(-o,-n)),this.rightBound=new SAT.Box(new SAT.Vector(t,e),o,s),this.rightBoundPolygon=this.rightBound.toPolygon(),this.rightBoundPolygon.setOffset(new SAT.Vector(0,-n)),this.bottomBound=new SAT.Box(new SAT.Vector(t,e),i,a.TOP_BOUND_HEIGHT),this.bottomBoundPolygon=this.bottomBound.toPolygon(),this.bottomBoundPolygon.setOffset(new SAT.Vector(-o,n-a.TOP_BOUND_HEIGHT))},a.prototype.updatePosition=function(){this.leftEdge=this.xPos-.5*this.width,this.rightEdge=this.xPos+.5*this.width,this.topEdge=this.yPos-.5*this.height,this.bottomEdge=this.yPos+.5*this.height,this.sprite.position.set(this.xPos,this.yPos),this.totalBoundPolygon.pos.x=this.xPos,this.totalBoundPolygon.pos.y=this.yPos,this.topBoundPolygon.pos.x=this.xPos,this.topBoundPolygon.pos.y=this.yPos,this.lhBoundPolygon.pos.x=this.xPos,this.lhBoundPolygon.pos.y=this.yPos,this.rhBoundPolygon.pos.x=this.xPos,this.rhBoundPolygon.pos.y=this.yPos,this.leftBoundPolygon.pos.x=this.xPos,this.leftBoundPolygon.pos.y=this.yPos,this.rightBoundPolygon.pos.x=this.xPos,this.rightBoundPolygon.pos.y=this.yPos,this.bottomBoundPolygon.pos.x=this.xPos,this.bottomBoundPolygon.pos.y=this.yPos},a.prototype.update=function(){this.xPos==this.prevX&&this.yPos==this.prevY||this.updatePosition()},a.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,o.prototype.destroy.call(this)},a.prototype.reset=function(){},a.TOP_BOUND_HEIGHT=12,a}(Block),BlockedWall=function(o){function t(t,e,i){var s=o.call(this,t,e,i)||this;return s.sprite=i.create(0,0,"blockedWall"),s.sprite.animations.add("blockedwall"),s.sprite.animations.play("blockedwall",null,!0),s.sprite.autoCull=!0,s.sprite.visible=!1,s.alive=!1,s.hangable=!0,s.scalable=!0,s.hangable=!1,s.scalable=!1,s.blockType="wall",s}return __extends(t,o),t.prototype.spawn=function(t,e,i,s,o,n,a){this.xPos=t,this.yPos=e,this.prevX=t,this.prevY=e,this.levelNum=a,this.width=i,this.height=s,this.sprite.position.set(t,e),this.sprite.angle=o,this.sprite.anchor.set(.5,.5),this.sprite.frame=parseInt(this.main.currentLevelID),this.sprite.visible=!0,this.xVelocity=0,this.yVelocity=0,this.leftEdge=t-.5*i,this.rightEdge=t+.5*i,this.topEdge=e-.5*s,this.bottomEdge=e+.5*s,this.xVelocity=0,this.yVelocity=0,n.colorFilter&&this.main.options.blend?this.sprite.filters=[n.colorFilter]:this.sprite.filters=null,this.landed=null,this.alive=!0;var r=.5*this.width,h=.5*this.height;this.totalBound=new SAT.Box(new SAT.Vector(t,e),i,s),this.totalBoundPolygon=this.totalBound.toPolygon(),this.totalBoundPolygon.setOffset(new SAT.Vector(-r,-h)),this.topBound=new SAT.Box(new SAT.Vector(t,e),i,PushBlock.TOP_BOUND_HEIGHT),this.topBoundPolygon=this.topBound.toPolygon(),this.topBoundPolygon.setOffset(new SAT.Vector(-r,-h)),this.lhBound=new SAT.Box(new SAT.Vector(t,e),r,PushBlock.TOP_BOUND_HEIGHT),this.lhBoundPolygon=this.lhBound.toPolygon(),this.lhBoundPolygon.setOffset(new SAT.Vector(-r,-h)),this.rhBound=new SAT.Box(new SAT.Vector(t,e),r,PushBlock.TOP_BOUND_HEIGHT),this.rhBoundPolygon=this.rhBound.toPolygon(),this.rhBoundPolygon.setOffset(new SAT.Vector(0,-h)),this.leftBound=new SAT.Box(new SAT.Vector(t,e),r,s),this.leftBoundPolygon=this.leftBound.toPolygon(),this.leftBoundPolygon.setOffset(new SAT.Vector(-r,-h)),this.rightBound=new SAT.Box(new SAT.Vector(t,e),r,s),this.rightBoundPolygon=this.rightBound.toPolygon(),this.rightBoundPolygon.setOffset(new SAT.Vector(0,-h)),this.bottomBound=new SAT.Box(new SAT.Vector(t,e),i,PushBlock.TOP_BOUND_HEIGHT),this.bottomBoundPolygon=this.bottomBound.toPolygon(),this.bottomBoundPolygon.setOffset(new SAT.Vector(-r,h-PushBlock.TOP_BOUND_HEIGHT)),-1!==n.topTime&&(this.alive=!1,this.sprite.visible=!1)},t.prototype.redrawHitBoxes=function(){this.hitGraphic.clear(),this.hitGraphic.beginFill(16711680,.5),this.hitGraphic.moveTo(this.xPos+this.totalBoundPolygon.calcPoints[0].x,this.yPos+this.totalBoundPolygon.calcPoints[0].y);for(var t=1;t<4;t++)this.hitGraphic.lineTo(this.xPos+this.totalBoundPolygon.calcPoints[t].x,this.yPos+this.totalBoundPolygon.calcPoints[t].y);this.hitGraphic.lineTo(this.xPos+this.totalBoundPolygon.calcPoints[0].x,this.yPos+this.totalBoundPolygon.calcPoints[0].y),this.hitGraphic.endFill(),this.hitGraphic.beginFill(65280,.5),this.hitGraphic.moveTo(this.xPos+this.topBoundPolygon.calcPoints[0].x,this.yPos+this.topBoundPolygon.calcPoints[0].y);for(t=1;t<4;t++)this.hitGraphic.lineTo(this.xPos+this.topBoundPolygon.calcPoints[t].x,this.yPos+this.topBoundPolygon.calcPoints[t].y);this.hitGraphic.lineTo(this.xPos+this.topBoundPolygon.calcPoints[0].x,this.yPos+this.topBoundPolygon.calcPoints[0].y),this.hitGraphic.endFill(),this.hitGraphic.beginFill(255,.5),this.hitGraphic.moveTo(this.xPos+this.lhBoundPolygon.calcPoints[0].x,this.yPos+this.lhBoundPolygon.calcPoints[0].y);for(t=1;t<4;t++)this.hitGraphic.lineTo(this.xPos+this.lhBoundPolygon.calcPoints[t].x,this.yPos+this.lhBoundPolygon.calcPoints[t].y);this.hitGraphic.lineTo(this.xPos+this.lhBoundPolygon.calcPoints[0].x,this.yPos+this.lhBoundPolygon.calcPoints[0].y),this.hitGraphic.endFill(),this.hitGraphic.beginFill(6710784,.5),this.hitGraphic.moveTo(this.xPos+this.rhBoundPolygon.calcPoints[0].x,this.yPos+this.rhBoundPolygon.calcPoints[0].y);for(t=1;t<4;t++)this.hitGraphic.lineTo(this.xPos+this.rhBoundPolygon.calcPoints[t].x,this.yPos+this.rhBoundPolygon.calcPoints[t].y);this.hitGraphic.lineTo(this.xPos+this.rhBoundPolygon.calcPoints[0].x,this.yPos+this.rhBoundPolygon.calcPoints[0].y),this.hitGraphic.endFill(),this.hitGraphic.beginFill(26214,.5),this.hitGraphic.moveTo(this.xPos+this.leftBoundPolygon.calcPoints[0].x,this.yPos+this.leftBoundPolygon.calcPoints[0].y);for(t=1;t<4;t++)this.hitGraphic.lineTo(this.xPos+this.leftBoundPolygon.calcPoints[t].x,this.yPos+this.leftBoundPolygon.calcPoints[t].y);this.hitGraphic.lineTo(this.xPos+this.leftBoundPolygon.calcPoints[0].x,this.yPos+this.leftBoundPolygon.calcPoints[0].y),this.hitGraphic.endFill(),this.hitGraphic.beginFill(6684774,.5),this.hitGraphic.moveTo(this.xPos+this.rightBoundPolygon.calcPoints[0].x,this.yPos+this.rightBoundPolygon.calcPoints[0].y);for(t=1;t<4;t++)this.hitGraphic.lineTo(this.xPos+this.rightBoundPolygon.calcPoints[t].x,this.yPos+this.rightBoundPolygon.calcPoints[t].y);this.hitGraphic.lineTo(this.xPos+this.rightBoundPolygon.calcPoints[0].x,this.yPos+this.rightBoundPolygon.calcPoints[0].y),this.hitGraphic.endFill(),this.hitGraphic.beginFill(16773120,.5),this.hitGraphic.moveTo(this.xPos+this.bottomBoundPolygon.calcPoints[0].x,this.yPos+this.bottomBoundPolygon.calcPoints[0].y);for(t=1;t<4;t++)this.hitGraphic.lineTo(this.xPos+this.bottomBoundPolygon.calcPoints[t].x,this.yPos+this.bottomBoundPolygon.calcPoints[t].y);this.hitGraphic.lineTo(this.xPos+this.bottomBoundPolygon.calcPoints[0].x,this.yPos+this.bottomBoundPolygon.calcPoints[0].y),this.hitGraphic.endFill()},t.prototype.updatePosition=function(){this.leftEdge=this.xPos-.5*this.width,this.rightEdge=this.xPos+.5*this.width,this.topEdge=this.yPos-.5*this.height,this.bottomEdge=this.yPos+.5*this.height,this.sprite.position.set(this.xPos,this.yPos),this.totalBoundPolygon.pos.x=this.xPos,this.totalBoundPolygon.pos.y=this.yPos,this.topBoundPolygon.pos.x=this.xPos,this.topBoundPolygon.pos.y=this.yPos,this.lhBoundPolygon.pos.x=this.xPos,this.lhBoundPolygon.pos.y=this.yPos,this.rhBoundPolygon.pos.x=this.xPos,this.rhBoundPolygon.pos.y=this.yPos,this.leftBoundPolygon.pos.x=this.xPos,this.leftBoundPolygon.pos.y=this.yPos,this.rightBoundPolygon.pos.x=this.xPos,this.rightBoundPolygon.pos.y=this.yPos,this.bottomBoundPolygon.pos.x=this.xPos,this.bottomBoundPolygon.pos.y=this.yPos},t.prototype.update=function(){this.xPos==this.prevX&&this.yPos==this.prevY||this.updatePosition()},t.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,o.prototype.destroy.call(this)},t.prototype.reset=function(){},t.TOP_BOUND_HEIGHT=12,t}(Block);!function(t){t[t.up=0]="up",t[t.down=1]="down",t[t.left=2]="left",t[t.right=3]="right"}(SpikeDirection||(SpikeDirection={}));var Fabrique,BlockSpike=function(o){function t(t,e,i){var s=o.call(this,t,e,i)||this;return s.sprite=i.create(0,0,"basicBlockColors"),s.sprite.autoCull=!0,s.sprite.visible=!1,s.alive=!1,s.spikeUpEnable=!1,s.spikeDownEnable=!1,s.spikeLeftEnable=!1,s.spikeRightEnable=!1,s.hangable=!0,s.scalable=!0,s.spikesUp=null,s.spikesDown=null,s.spikesLeft=null,s.spikesRight=null,s}return __extends(t,o),Object.defineProperty(t.prototype,"upEnable",{get:function(){return this.spikeUpEnable?1:0},set:function(t){t?this.enableSpike(SpikeDirection.up):this.disableSpike(SpikeDirection.up)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"downEnable",{get:function(){return this.spikeDownEnable?1:0},set:function(t){t?this.enableSpike(SpikeDirection.down):this.disableSpike(SpikeDirection.down)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftEnable",{get:function(){return this.spikeLeftEnable?1:0},set:function(t){t?this.enableSpike(SpikeDirection.left):this.disableSpike(SpikeDirection.left)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightEnable",{get:function(){return this.spikeRightEnable?1:0},set:function(t){t?this.enableSpike(SpikeDirection.right):this.disableSpike(SpikeDirection.right)},enumerable:!1,configurable:!0}),t.prototype.spawn=function(t,e,i,s,o,n,a,r,h){this.xPos=t,this.yPos=e,this.prevX=t,this.prevY=e,this.width=99,this.height=99,this.spikeMove=0,this.isSpikeUp=i,this.startSpikeUp=i,this.timeDown=h,this.timeUp=r,this.actTime=this.isSpikeUp?this.timeDown:this.timeUp,this.isDelay=!0,s&&this.enableSpike(SpikeDirection.up),o&&this.enableSpike(SpikeDirection.down),n&&this.enableSpike(SpikeDirection.left),a&&this.enableSpike(SpikeDirection.right);var l=this.isSpikeUp?Constants.spikeBlockUp:Constants.spikeBlockDown;this.spikeUpEnable&&this.spikesUp.spawn(this.xPos,this.yPos-(49.5+this.spikesUp.height/2)-l,0),this.spikeDownEnable&&this.spikesDown.spawn(this.xPos,this.yPos+(49.5+this.spikesDown.height/2)+l,180),this.spikeLeftEnable&&this.spikesLeft.spawn(this.xPos-(49.5+this.spikesLeft.height/2)-l,this.yPos,-90),this.spikeRightEnable&&this.spikesRight.spawn(this.xPos+(49.5+this.spikesRight.height/2)+l,this.yPos,90),this.sprite.position.set(t,e),this.sprite.scale.set(this.width/this.sprite.width,this.height/this.sprite.height),this.sprite.anchor.set(.5,.5),this.sprite.frame=parseInt(this.main.currentLevelID),this.sprite.visible=!0,this.xVelocity=0,this.yVelocity=0,this.leftEdge=t-.5*this.width,this.rightEdge=t+.5*this.width,this.topEdge=e-.5*this.height,this.bottomEdge=e+.5*this.height,this.xVelocity=0,this.yVelocity=0,this.landed=null,this.alive=!0;var c=.5*this.width,p=.5*this.height;this.totalBound=new SAT.Box(new SAT.Vector(t,e),this.width,this.height),this.totalBoundPolygon=this.totalBound.toPolygon(),this.totalBoundPolygon.setOffset(new SAT.Vector(-c,-p)),this.topBound=new SAT.Box(new SAT.Vector(t,e),this.width,BasicBlock.TOP_BOUND_HEIGHT),this.topBoundPolygon=this.topBound.toPolygon(),this.topBoundPolygon.setOffset(new SAT.Vector(-c,-p)),this.lhBound=new SAT.Box(new SAT.Vector(t,e),c,BasicBlock.TOP_BOUND_HEIGHT),this.lhBoundPolygon=this.lhBound.toPolygon(),this.lhBoundPolygon.setOffset(new SAT.Vector(-c,-p)),this.rhBound=new SAT.Box(new SAT.Vector(t,e),c,BasicBlock.TOP_BOUND_HEIGHT),this.rhBoundPolygon=this.rhBound.toPolygon(),this.rhBoundPolygon.setOffset(new SAT.Vector(0,-p)),this.leftBound=new SAT.Box(new SAT.Vector(t,e),c,this.height),this.leftBoundPolygon=this.leftBound.toPolygon(),this.leftBoundPolygon.setOffset(new SAT.Vector(-c,-p)),this.rightBound=new SAT.Box(new SAT.Vector(t,e),c,this.height),this.rightBoundPolygon=this.rightBound.toPolygon(),this.rightBoundPolygon.setOffset(new SAT.Vector(0,-p)),this.bottomBound=new SAT.Box(new SAT.Vector(t,e),this.width,BasicBlock.TOP_BOUND_HEIGHT),this.bottomBoundPolygon=this.bottomBound.toPolygon(),this.bottomBoundPolygon.setOffset(new SAT.Vector(-c,p-BasicBlock.TOP_BOUND_HEIGHT))},t.prototype.updatePosition=function(){this.leftEdge=this.xPos-.5*this.width,this.rightEdge=this.xPos+.5*this.width,this.topEdge=this.yPos-.5*this.height,this.bottomEdge=this.yPos+.5*this.height,this.sprite.position.set(this.xPos,this.yPos),this.totalBoundPolygon.pos.x=this.xPos,this.totalBoundPolygon.pos.y=this.yPos,this.topBoundPolygon.pos.x=this.xPos,this.topBoundPolygon.pos.y=this.yPos,this.lhBoundPolygon.pos.x=this.xPos,this.lhBoundPolygon.pos.y=this.yPos,this.rhBoundPolygon.pos.x=this.xPos,this.rhBoundPolygon.pos.y=this.yPos,this.leftBoundPolygon.pos.x=this.xPos,this.leftBoundPolygon.pos.y=this.yPos,this.rightBoundPolygon.pos.x=this.xPos,this.rightBoundPolygon.pos.y=this.yPos,this.bottomBoundPolygon.pos.x=this.xPos,this.bottomBoundPolygon.pos.y=this.yPos},t.prototype.enableSpike=function(t){switch(t){case SpikeDirection.up:if(!this.spikeUpEnable){var e=new Spike10xHigh(this.main,this.game,this.main.obstacleLayer);this.main.obstacles.push(e),(this.spikesUp=e).enableDestroyMain=!1,this.spikeUpEnable=!0}break;case SpikeDirection.down:if(!this.spikeDownEnable){e=new Spike10xHigh(this.main,this.game,this.main.obstacleLayer);this.main.obstacles.push(e),(this.spikesDown=e).enableDestroyMain=!1,this.spikeDownEnable=!0}break;case SpikeDirection.left:if(!this.spikeLeftEnable){e=new Spike10xHigh(this.main,this.game,this.main.obstacleLayer);this.main.obstacles.push(e),(this.spikesLeft=e).enableDestroyMain=!1,this.spikeLeftEnable=!0}break;case SpikeDirection.right:if(!this.spikeRightEnable){e=new Spike10xHigh(this.main,this.game,this.main.obstacleLayer);this.main.obstacles.push(e),(this.spikesRight=e).enableDestroyMain=!1,this.spikeRightEnable=!0}}},t.prototype.disableSpike=function(t){switch(t){case SpikeDirection.up:if(this.spikeUpEnable){var e=this.main.obstacles.indexOf(this.spikesUp);this.main.obstacles.splice(e,1),this.spikesUp.destroy(!1),this.spikesUp=null,this.spikeUpEnable=!1}break;case SpikeDirection.down:if(this.spikeDownEnable){e=this.main.obstacles.indexOf(this.spikesDown);this.main.obstacles.splice(e,1),this.spikesDown.destroy(!1),this.spikesDown=null,this.spikeDownEnable=!1}break;case SpikeDirection.left:if(this.spikeLeftEnable){e=this.main.obstacles.indexOf(this.spikesLeft);this.main.obstacles.splice(e,1),this.spikesLeft.destroy(!1),this.spikesLeft=null,this.spikeDownEnable=!1}break;case SpikeDirection.right:if(this.spikeRightEnable){e=this.main.obstacles.indexOf(this.spikesRight);this.main.obstacles.splice(e,1),this.spikesRight.destroy(!1),this.spikesRight=null,this.spikeDownEnable=!1}}},t.prototype.update=function(){if(this.isDelay)return this.actTime-=this.main.gameSpeed,void(this.actTime<=0&&(this.isDelay=!1));var t=Constants.spikeBlockVelocity*this.main.gameSpeed;this.spikeMove=this.spikeMove+t;var e,i,s=Math.abs(Constants.spikeBlockDown-Constants.spikeBlockUp);this.spikeMove>=s&&(t=s-(this.spikeMove-t),this.spikeMove=0),this.isSpikeUp&&(t*=-1),this.spikeUpEnable&&(e=this.spikesUp.yPos-t,this.spikesUp.movePosition(this.spikesUp.xPos,e)),this.spikeDownEnable&&(e=this.spikesDown.yPos+t,this.spikesDown.movePosition(this.spikesDown.xPos,e)),this.spikeLeftEnable&&(i=this.spikesLeft.xPos-t,this.spikesLeft.movePosition(i,this.spikesLeft.yPos)),this.spikeRightEnable&&(i=this.spikesRight.xPos+t,this.spikesRight.movePosition(i,this.spikesRight.yPos)),0===this.spikeMove&&(this.isSpikeUp=!this.isSpikeUp,this.isDelay=!0,this.actTime=this.isSpikeUp?this.timeUp:this.timeDown),this.xPos==this.prevX&&this.yPos==this.prevY||this.updatePosition()},t.prototype.destroy=function(){if(this.spikeUpEnable){var t=this.main.obstacles.indexOf(this.spikesUp);this.main.obstacles.splice(t,1),this.spikesUp.destroy(!1)}if(this.spikeDownEnable){t=this.main.obstacles.indexOf(this.spikesDown);this.main.obstacles.splice(t,1),this.spikesDown.destroy(!1)}if(this.spikeLeftEnable){t=this.main.obstacles.indexOf(this.spikesLeft);this.main.obstacles.splice(t,1),this.spikesLeft.destroy(!1)}if(this.spikeRightEnable){t=this.main.obstacles.indexOf(this.spikesRight);this.main.obstacles.splice(t,1),this.spikesRight.destroy(!1)}this.sprite.destroy(),this.sprite=null,o.prototype.destroy.call(this)},t.prototype.resetLevel=function(){this.spikeMove=0,this.isSpikeUp=this.startSpikeUp;var t=this.isSpikeUp?Constants.spikeBlockUp:Constants.spikeBlockDown;this.spikeUpEnable&&this.spikesUp.movePosition(this.xPos,this.yPos-(49.5+this.spikesUp.height/2)-t),this.spikeDownEnable&&this.spikesDown.movePosition(this.xPos,this.yPos+(49.5+this.spikesDown.height/2)+t),this.spikeLeftEnable&&this.spikesLeft.movePosition(this.xPos-(49.5+this.spikesLeft.height/2)-t,this.yPos),this.spikeRightEnable&&this.spikesRight.movePosition(this.xPos+(49.5+this.spikesRight.height/2)+t,this.yPos)},t.TOP_BOUND_HEIGHT=12,t}(Block),BounceBlock=function(o){function t(t,e,i){var s=o.call(this,t,e,i)||this;return s.bounceStr=4,s.container=s.game.add.group(i),s.sprite=s.container.create(0,0,"atlas_gameplay","bounceBlock"),s.sprite.autoCull=!0,s.arrowAnimation=s.container.create(0,0,"arrowAnimation"),s.arrowAnimation.autoCull=!0,s.sprite.anchor.set(.5,.5),s.arrowAnimation.anchor.set(.5,.5),s.alive=!1,s.hangable=!0,s.scalable=!0,s.blockType="bounce",s}return __extends(t,o),t.prototype.spawn=function(t,e,i,s){this.xPos=t,this.yPos=e,this.prevX=t,this.prevY=e,this.startY=e,this.spriteYOff=0,this.width=i,this.height=s,this.container.position.set(t,e),this.container.scale.set(i/100,s/100),this.arrowMask=this.game.add.graphics(0,0,this.container),this.main.options.blend?(this.arrowMask.beginFill(0),this.arrowMask.drawRect(-50,-50,100,100),this.arrowMask.endFill(),this.arrowAnimation.mask=this.arrowMask,this.arrowAnimation.animations.add("arrow"),this.arrowAnimation.play("arrow",60*this.main.gameSpeed,!0)):this.arrowAnimation.loadTexture("atlas_gameplay","arrow-static"),this.startScaleX=i/100,this.startScaleY=s/100,this.sprite.anchor.set(.5,.5),this.xVelocity=0,this.yVelocity=0,this.leftEdge=t-.5*i,this.rightEdge=t+.5*i,this.topEdge=e-.5*s,this.bottomEdge=e+.5*s,this.landed=null,this.bouncing=!1,this.alive=!0;var o=.5*this.width,n=.5*this.height,a=t-o,r=e-n;this.totalBound=new SAT.Box(new SAT.Vector(a,r),i,s),this.topBound=new SAT.Box(new SAT.Vector(a,r),i,BasicBlock.TOP_BOUND_HEIGHT),this.lhBound=new SAT.Box(new SAT.Vector(a,r),o,BasicBlock.TOP_BOUND_HEIGHT),this.rhBound=new SAT.Box(new SAT.Vector(t,r),o,BasicBlock.TOP_BOUND_HEIGHT),this.leftBound=new SAT.Box(new SAT.Vector(a,r),o,s),this.rightBound=new SAT.Box(new SAT.Vector(t,r),o,s),this.bottomBound=new SAT.Box(new SAT.Vector(a,e+n-BasicBlock.TOP_BOUND_HEIGHT),i,BasicBlock.TOP_BOUND_HEIGHT),this.totalBoundPolygon=this.totalBound.toPolygon(),this.topBoundPolygon=this.topBound.toPolygon(),this.lhBoundPolygon=this.lhBound.toPolygon(),this.rhBoundPolygon=this.rhBound.toPolygon(),this.leftBoundPolygon=this.leftBound.toPolygon(),this.rightBoundPolygon=this.rightBound.toPolygon(),this.bottomBoundPolygon=this.bottomBound.toPolygon()},t.prototype.updatePosition=function(){this.leftEdge=this.xPos-.5*this.width,this.rightEdge=this.xPos+.5*this.width,this.topEdge=this.yPos-.5*this.height,this.bottomEdge=this.yPos+.5*this.height;var t=.5*this.width,e=.5*this.height,i=this.xPos-t,s=this.yPos-e;this.totalBound.pos.x=i,this.totalBound.pos.y=s,this.topBound.pos.x=i,this.topBound.pos.y=s,this.lhBound.pos.x=i,this.lhBound.pos.y=s,this.rhBound.pos.x=this.xPos,this.rhBound.pos.y=s,this.leftBound.pos.x=i,this.leftBound.pos.y=s,this.rightBound.pos.x=this.xPos,this.rightBound.pos.y=s,this.bottomBound.pos.x=i,this.bottomBound.pos.y=this.yPos+this.height-BasicBlock.TOP_BOUND_HEIGHT,this.topBoundPolygon=this.topBound.toPolygon(),this.lhBoundPolygon=this.lhBound.toPolygon(),this.rhBoundPolygon=this.rhBound.toPolygon(),this.leftBoundPolygon=this.leftBound.toPolygon(),this.rightBoundPolygon=this.rightBound.toPolygon(),this.bottomBoundPolygon=this.bottomBound.toPolygon(),this.container.y=this.yPos},t.prototype.update=function(){this.landed?this.specificLand():1==this.container.scale.x&&1==this.container.scale.y||(this.container.scale.y-=(this.container.scale.y-this.startScaleY)*(.15*this.main.gameSpeed),this.container.scale.x-=(this.container.scale.x-this.startScaleX)*(.15*this.main.gameSpeed),this.spriteYOff=(this.startScaleY-this.container.scale.y)*this.height*.5),this.container.position.y=this.yPos+2*this.spriteYOff},t.prototype.specificLand=function(){this.container.scale.x+=.01*this.bounceStr*this.main.gameSpeed,this.container.scale.y-=.01*this.bounceStr*this.main.gameSpeed,this.spriteYOff=(this.startScaleY-this.container.scale.y)*this.height*.5,this.bouncing?(this.main.player.xPos=this.lockX,this.main.player.spriteYOff=2*this.spriteYOff+5,this.main.player.updatePositions()):(this.lockX=this.main.player.xPos,this.main.player.setCrouch(),this.main.player.bouncing=!0,this.bouncing=!0),this.container.scale.y<.25&&(this.main.player.yPos-=.5*this.height,this.main.player.xPos=this.lockX,this.main.player.jump(-35*this.height*.01),this.main.player.bouncing=!1,this.main.player.spriteYOff=0,this.bouncing=!1,this.main.sounds.playSound("bounce1"))},t.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,this.arrowAnimation.destroy(),this.arrowAnimation=null,this.arrowMask&&(this.arrowMask.destroy(),this.arrowMask=null),this.container.destroy(),this.container=null,o.prototype.destroy.call(this)},t}(Block),Elevator=function(n){function t(t,e,i,s){var o=n.call(this,t,e,i)||this;return o.sprite=i.create(0,0,"elevatorUp"),o.sprite.autoCull=!0,o.sprite.visible=!1,o.alive=!1,o.generator=s,o.hangable=!0,o.scalable=!0,o}return __extends(t,n),t.prototype.spawn=function(t,e,i,s){this.xPos=t,this.yPos=e,this.xVelocity=i;var o=(this.yVelocity=s)<0?"elevatorUp":"elevatorDown";this.sprite.loadTexture(o),this.prevX=t,this.prevY=e,this.width=this.sprite.width,this.height=this.sprite.height,this.sprite.position.set(t,e),this.sprite.scale.set(this.width/this.sprite.width,this.height/this.sprite.height),this.sprite.anchor.set(.5,.5),this.sprite.frame=parseInt(this.main.currentLevelID),this.sprite.visible=!0,this.leftEdge=t-.5*this.width,this.rightEdge=t+.5*this.width,this.topEdge=e-.5*this.height,this.bottomEdge=e+.5*this.height,this.landed=null,this.alive=!0;var n=.5*this.width,a=.5*this.height;this.totalBound=new SAT.Box(new SAT.Vector(t,e),this.width,this.height),this.totalBoundPolygon=this.totalBound.toPolygon(),this.totalBoundPolygon.setOffset(new SAT.Vector(-n,-a)),this.topBound=new SAT.Box(new SAT.Vector(t,e),this.width,BasicBlock.TOP_BOUND_HEIGHT),this.topBoundPolygon=this.topBound.toPolygon(),this.topBoundPolygon.setOffset(new SAT.Vector(-n,-a)),this.lhBound=new SAT.Box(new SAT.Vector(t,e),n,BasicBlock.TOP_BOUND_HEIGHT),this.lhBoundPolygon=this.lhBound.toPolygon(),this.lhBoundPolygon.setOffset(new SAT.Vector(-n,-a)),this.rhBound=new SAT.Box(new SAT.Vector(t,e),n,BasicBlock.TOP_BOUND_HEIGHT),this.rhBoundPolygon=this.rhBound.toPolygon(),this.rhBoundPolygon.setOffset(new SAT.Vector(0,-a)),this.leftBound=new SAT.Box(new SAT.Vector(t,e),n,this.height),this.leftBoundPolygon=this.leftBound.toPolygon(),this.leftBoundPolygon.setOffset(new SAT.Vector(-n,-a)),this.rightBound=new SAT.Box(new SAT.Vector(t,e),n,this.height),this.rightBoundPolygon=this.rightBound.toPolygon(),this.rightBoundPolygon.setOffset(new SAT.Vector(0,-a)),this.bottomBound=new SAT.Box(new SAT.Vector(t,e),this.width,BasicBlock.TOP_BOUND_HEIGHT),this.bottomBoundPolygon=this.bottomBound.toPolygon(),this.bottomBoundPolygon.setOffset(new SAT.Vector(-n,a-BasicBlock.TOP_BOUND_HEIGHT))},t.prototype.updatePosition=function(){this.leftEdge=this.xPos-.5*this.width,this.rightEdge=this.xPos+.5*this.width,this.topEdge=this.yPos-.5*this.height,this.bottomEdge=this.yPos+.5*this.height,this.sprite.position.set(this.xPos,this.yPos),this.totalBoundPolygon.pos.x=this.xPos,this.totalBoundPolygon.pos.y=this.yPos,this.topBoundPolygon.pos.x=this.xPos,this.topBoundPolygon.pos.y=this.yPos,this.lhBoundPolygon.pos.x=this.xPos,this.lhBoundPolygon.pos.y=this.yPos,this.rhBoundPolygon.pos.x=this.xPos,this.rhBoundPolygon.pos.y=this.yPos,this.leftBoundPolygon.pos.x=this.xPos,this.leftBoundPolygon.pos.y=this.yPos,this.rightBoundPolygon.pos.x=this.xPos,this.rightBoundPolygon.pos.y=this.yPos,this.bottomBoundPolygon.pos.x=this.xPos,this.bottomBoundPolygon.pos.y=this.yPos},t.prototype.update=function(){this.xPos+=this.xVelocity,this.yPos+=this.yVelocity,this.updatePosition();for(var t=0,e=this.main.elevatorEliminator;t=this.xPos&&i.xPos-i.width/2<=this.xPos){if(this.isDown&&i.yPos>=this.yPos){var s=i.yPos-this.yPos;this.cable.spawn(this.xPos,this.yPos,s);break}if(!this.isDown&&i.yPos<=this.yPos){s=i.yPos-this.yPos;this.cable.spawn(this.xPos,this.yPos,s);break}this.cable.spawn(this.xPos,this.yPos,0)}else this.cable.spawn(this.xPos,this.yPos,0)}},a.prototype.spawn=function(t,e){this.destroyAllPlatforms();this.xPos=t,this.yPos=e,this.prevX=t,this.prevY=e,this.spawnCable(),this.width=150,this.height=60,this.sprite.position.set(t,e),this.sprite.width=150,this.sprite.height=60,this.sprite.anchor.set(.5,.5),this.sprite.frame=parseInt(this.main.currentLevelID),this.sprite.visible=!0,this.xVelocity=0,this.yVelocity=0,this.leftEdge=t-75,this.rightEdge=t+75,this.topEdge=e-30,this.bottomEdge=e+30,this.xVelocity=0,this.yVelocity=0,this.spawSpikes(),this.landed=null,this.alive=!0;var i=.5*this.width,s=.5*this.height;this.totalBound=new SAT.Box(new SAT.Vector(t,e),150,60),this.totalBoundPolygon=this.totalBound.toPolygon(),this.totalBoundPolygon.setOffset(new SAT.Vector(-i,-s)),this.topBound=new SAT.Box(new SAT.Vector(t,e),150,BasicBlock.TOP_BOUND_HEIGHT),this.topBoundPolygon=this.topBound.toPolygon(),this.topBoundPolygon.setOffset(new SAT.Vector(-i,-s)),this.lhBound=new SAT.Box(new SAT.Vector(t,e),i,BasicBlock.TOP_BOUND_HEIGHT),this.lhBoundPolygon=this.lhBound.toPolygon(),this.lhBoundPolygon.setOffset(new SAT.Vector(-i,-s)),this.rhBound=new SAT.Box(new SAT.Vector(t,e),i,BasicBlock.TOP_BOUND_HEIGHT),this.rhBoundPolygon=this.rhBound.toPolygon(),this.rhBoundPolygon.setOffset(new SAT.Vector(0,-s)),this.leftBound=new SAT.Box(new SAT.Vector(t,e),i,60),this.leftBoundPolygon=this.leftBound.toPolygon(),this.leftBoundPolygon.setOffset(new SAT.Vector(-i,-s)),this.rightBound=new SAT.Box(new SAT.Vector(t,e),i,60),this.rightBoundPolygon=this.rightBound.toPolygon(),this.rightBoundPolygon.setOffset(new SAT.Vector(0,-s)),this.bottomBound=new SAT.Box(new SAT.Vector(t,e),150,BasicBlock.TOP_BOUND_HEIGHT),this.bottomBoundPolygon=this.bottomBound.toPolygon(),this.bottomBoundPolygon.setOffset(new SAT.Vector(-i,s-BasicBlock.TOP_BOUND_HEIGHT))},a.prototype.destroy=function(){this.destroyAllPlatforms(),this.cable.destroy(),this.sprite.destroy(),this.sprite=null,this.spikes=[],n.prototype.destroy.call(this)},a.prototype.update=function(){if(0this.startX+this.maxMoveDist&&(this.xVelocity=-this.xVelocity):this.xPosthis.game.camera.x+640||this.bottomEdgethis.game.camera.y+560)return;this.meltScale-=this.depletionRate,this.maskGraphic?(this.maskGraphic.scale.y=this.meltScale,this.maskGraphic.y-=this.depletionRate*this.startHeight/2):(this.sprite.scale.y=this.height/100*this.meltScale,this.sprite.position.y=this.yPos-this.height/2*(1-this.meltScale));var t=.5*this.width,e=.5*this.height,i=(this.width,this.height),s=this.xPos,o=this.yPos;this.totalBound=new SAT.Box(new SAT.Vector(this.xPos,this.yPos),this.width,this.height*this.meltScale),this.totalBoundPolygon=this.totalBound.toPolygon(),this.totalBoundPolygon.setOffset(new SAT.Vector(-t,-e)),this.leftBound=new SAT.Box(new SAT.Vector(s,o),t,i*this.meltScale),this.leftBoundPolygon=this.leftBound.toPolygon(),this.leftBoundPolygon.setOffset(new SAT.Vector(-t,-e)),this.rightBound=new SAT.Box(new SAT.Vector(s,o),t,i*this.meltScale),this.rightBoundPolygon=this.rightBound.toPolygon(),this.rightBoundPolygon.setOffset(new SAT.Vector(0,-e)),this.bottomBoundPolygon.setOffset(new SAT.Vector(-t,this.meltScale*e-r.TOP_BOUND_HEIGHT)),this.meltScale<=0&&(this.melted=!0,this.alive=!1,this.sprite.visible=!1)}},r.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,this.maskGraphic&&(this.maskGraphic.destroy(),this.maskGraphic=null),this.hitGraphics.destroy(),delete this.hitGraphics,o.prototype.destroy.call(this)},r.prototype.resetLevel=function(){this.reset()},r.prototype.reset=function(){this.meltScale=1,this.maskGraphic&&(this.maskGraphic.scale.y=1,this.maskGraphic.y=this.startY),this.sprite.scale.set(this.startXScale,this.startYScale),this.sprite.visible=!0,this.alive=!0,this.melted=!1,o.prototype.reset.call(this)},r.TOP_BOUND_HEIGHT=12,r}(Block),InvisBlock=function(o){function i(t,e,i){var s=o.call(this,t,e,i)||this;return s.init(),s.hangable=!0,s.scalable=!0,s}return __extends(i,o),i.prototype.init=function(){this.sprite=this.layer.create(0,0,"atlas_gameplay","invisBlock"),this.sprite.autoCull=!0,this.alive=!1},i.prototype.spawn=function(t,e,i,s){this.xPos=t,this.yPos=e,this.prevX=t,this.prevY=e,this.startX=t,this.startY=e,this.width=i,this.height=s,this.sprite.position.set(t,e),this.sprite.scale.set(i/100,s/100),this.sprite.anchor.set(.5,.5),this.xVelocity=0,this.yVelocity=0,this.leftEdge=t-.5*i,this.rightEdge=t+.5*i,this.topEdge=e-.5*s,this.bottomEdge=e+.5*s,this.xVelocity=0,this.yVelocity=0,this.landed=null,this.alive=!0;var o=.5*this.width,n=.5*this.height;this.totalBound=new SAT.Box(new SAT.Vector(t,e),i,s),this.totalBoundPolygon=this.totalBound.toPolygon(),this.totalBoundPolygon.setOffset(new SAT.Vector(-o,-n)),this.topBound=new SAT.Box(new SAT.Vector(t,e),i,PushBlock.TOP_BOUND_HEIGHT),this.topBoundPolygon=this.topBound.toPolygon(),this.topBoundPolygon.setOffset(new SAT.Vector(-o,-n)),this.lhBound=new SAT.Box(new SAT.Vector(t,e),o,PushBlock.TOP_BOUND_HEIGHT),this.lhBoundPolygon=this.lhBound.toPolygon(),this.lhBoundPolygon.setOffset(new SAT.Vector(-o,-n)),this.rhBound=new SAT.Box(new SAT.Vector(t,e),o,PushBlock.TOP_BOUND_HEIGHT),this.rhBoundPolygon=this.rhBound.toPolygon(),this.rhBoundPolygon.setOffset(new SAT.Vector(0,-n)),this.leftBound=new SAT.Box(new SAT.Vector(t,e),o,s),this.leftBoundPolygon=this.leftBound.toPolygon(),this.leftBoundPolygon.setOffset(new SAT.Vector(-o,-n)),this.rightBound=new SAT.Box(new SAT.Vector(t,e),o,s),this.rightBoundPolygon=this.rightBound.toPolygon(),this.rightBoundPolygon.setOffset(new SAT.Vector(0,-n)),this.bottomBound=new SAT.Box(new SAT.Vector(t,e),i,PushBlock.TOP_BOUND_HEIGHT),this.bottomBoundPolygon=this.bottomBound.toPolygon(),this.bottomBoundPolygon.setOffset(new SAT.Vector(-o,n-PushBlock.TOP_BOUND_HEIGHT))},i.prototype.updatePosition=function(){this.leftEdge=this.xPos-.5*this.width,this.rightEdge=this.xPos+.5*this.width,this.topEdge=this.yPos-.5*this.height,this.bottomEdge=this.yPos+.5*this.height,this.sprite.position.set(this.xPos,this.yPos),this.totalBoundPolygon.pos.x=this.xPos,this.totalBoundPolygon.pos.y=this.yPos,this.topBoundPolygon.pos.x=this.xPos,this.topBoundPolygon.pos.y=this.yPos,this.lhBoundPolygon.pos.x=this.xPos,this.lhBoundPolygon.pos.y=this.yPos,this.rhBoundPolygon.pos.x=this.xPos,this.rhBoundPolygon.pos.y=this.yPos,this.leftBoundPolygon.pos.x=this.xPos,this.leftBoundPolygon.pos.y=this.yPos,this.rightBoundPolygon.pos.x=this.xPos,this.rightBoundPolygon.pos.y=this.yPos,this.bottomBoundPolygon.pos.x=this.xPos,this.bottomBoundPolygon.pos.y=this.yPos},i.prototype.update=function(){if(this.alive){var t=this.main.player,e=Math.sqrt(Math.pow(t.xPos-this.xPos,2)+Math.pow(t.yPos-this.yPos,2));this.sprite.alpha=i.RANGEthis.startY+this.maxMoveDist&&(this.yVelocity=-this.yVelocity,this.landed&&(this.main.player.yPos+=2*this.yVelocity),this.main.player.updatePositions()),this.yPos+=this.yVelocity;for(var t=0;tthis.startY+this.maxMoveDist&&(this.yVelocity=-this.yVelocity,this.landed&&(this.main.player.yPos+=2*this.yVelocity),this.main.player.updatePositions()),this.yPos+=this.yVelocity;for(var t=0;ti.yPos-.5*i.height&&(!t&&this.yVelocity,this.yVelocity-=this.main.gameSpeed,this.yVelocity<-3&&(this.yVelocity=-3),this.inWater=!0))}},a.prototype.checkTrapped=function(){for(var t=new SAT.Vector(this.leftEdge-5,this.topEdge+10),e=new SAT.Vector(this.rightEdge+5,this.topEdge+10),i=0;i5*this.speedInc)&&(this.main.player.xVelocity+=this.speedInc,this.main.player.xVelocity===this.speedInc&&(this.main.player.xVelocity+=.75*this.speedInc))},t.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,this.arrowMask&&(this.arrowMask.destroy(),this.arrowMask=null),this.container.destroy(),this.container=null,o.prototype.destroy.call(this)},t.TOP_BOUND_HEIGHT=12,t}(Block),SwimmingPool=function(o){function t(t,e,i){var s=o.call(this,t)||this;return s.game=e,s.layer=i,s.sprite=i.create(0,0,"atlas_gameplay","swimmingPool"),s.sprite.anchor.set(.5,.5),s.sprite.alpha=.6,s.topMask=e.add.graphics(0,0,s.layer),s}return __extends(t,o),t.prototype.spawn=function(t,e,i,s){this.xPos=t,this.yPos=e,this.width=i,this.height=s,this.sprite.position.set(t,e),this.sprite.scale.set(i/250,s/250),this.electric=!1,this.prevElec=!1,this.totalPolygon=new SAT.Box(new SAT.Vector(t-i/2,e-s/2),i,s).toPolygon(),this.topPolygon=new SAT.Box(new SAT.Vector(t-i/2,e-s/2),i,12).toPolygon(),this.topMask.beginFill(16776960,.5),this.topMask.drawRect(0,0,i,s),this.topMask.endFill(),this.topMask.position.set(t-this.width/2,e-this.height/2)},t.prototype.update=function(){this.electric?(this.topMask.visible=!0,this.prevElec=!0):(this.topMask.visible=!1,this.prevElec=!1),this.electric=!1},t.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,this.topMask.destroy(),this.topMask=null,this.game=null,this.layer=null,this.totalPolygon=null,this.topPolygon=null,o.prototype.destroy.call(this)},t}(Entity),VerticalDownBlock=function(o){function t(t,e,i){var s=o.call(this,t,e,i)||this;return s.maxMoveDist=100,s.sprite=i.create(0,0,"atlas_gameplay","verticalDownBlock"),s.sprite.autoCull=!0,s.alive=!1,s.hangable=!0,s.scalable=!0,s}return __extends(t,o),t.prototype.levelStart=function(){for(var t=new SAT.Box(new SAT.Vector(this.leftEdge,this.topEdge-10),this.width,this.height+20).toPolygon(),e=0;ethis.startY+this.maxMoveDist&&(this.yVelocity=-this.yVelocity):this.yPosthis.startY+this.maxMoveDist&&(this.yVelocity=-this.yVelocity,this.landed&&(this.main.player.yPos+=2*this.yVelocity),this.main.player.updatePositions()),this.yPos+=this.yVelocity,this.xPos==this.prevX&&this.yPos==this.prevY||this.updatePosition()},t.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,this.attachments=null,this.attachmentOffsets=null,o.prototype.destroy.call(this)},t}(Block),ControllerButton=function(){function t(t,e,i,s,o){this.game=t,this.sprite=t.add.sprite(e,i,s),this.sprite.alpha=.5,this.sprite.anchor.set(.5,.5),this.sprite.scale.set(1.35,1.35),this.sprite.fixedToCamera=!0,this.sprite.inputEnabled=!0,o&&(this.sprite.events.onInputOver.add(this.onDown,this),this.sprite.events.onInputOut.add(this.onUp,this)),this.sprite.events.onInputDown.add(this.onDown,this),this.sprite.events.onInputUp.add(this.onUp,this),this.pressedDown=new Phaser.Signal,this.isDown=!1,this.isPressed=!1,this.setHitArea()}return t.prototype.setHitArea=function(){this.sprite.hitArea=new Phaser.Circle(0,0,1.3*this.sprite.width)},t.prototype.onDown=function(t,e){this.pointer=e,this.isDown=!0},t.prototype.onUp=function(){this.isDown&&this.pressedDown.dispatch(),this.isDown=!1,this.isPressed=!1},t.prototype.hide=function(){this.sprite.visible=!1},t.prototype.show=function(){this.sprite.visible=!0},t.prototype.buttonPressed=function(){return this.isDown},t}(),ControllerStick=function(){function t(t,e,i,s,o){this.game=t,this.sprite=t.add.sprite(e,i,s),this.sprite.alpha=.5,this.sprite.anchor.set(.5,.5),this.sprite.scale.set(1.35,1.35),this.sprite.hitArea=new Phaser.Rectangle(-this.sprite.width/2,-this.sprite.height/1.4,1.2*this.sprite.width,1.35*this.sprite.height),this.sprite.fixedToCamera=!0,this.sprite.inputEnabled=!0,this.sprite.events.onInputDown.add(this.onDown,this),this.sprite.events.onInputUp.add(this.onUp,this),this.pressedDown=new Phaser.Signal,this.isDown=!1,this.upDd=!1,this.downDd=!1,this.leftDd=!1,this.oneStick=o}return t.prototype.setHitArea=function(){this.sprite.hitArea=new Phaser.Rectangle(-1.2*this.sprite.width*this.sprite.anchor.x,-1.35*this.sprite.height*this.sprite.anchor.y,1.2*this.sprite.width,1.35*this.sprite.height)},t.prototype.onDown=function(t,e){this.pointer=e,this.isDown=!0},t.prototype.onUp=function(){this.isDown&&this.pressedDown.dispatch(),this.isDown=!1,this.upDd=!1,this.downDd=!1,this.leftDd=!1,this.rightDd=!1},t.prototype.hide=function(){this.sprite.visible=!1},t.prototype.show=function(){this.sprite.visible=!0},t.prototype.upIsDown=function(){return this.upDd},t.prototype.downIsDown=function(){return this.downDd},t.prototype.leftIsDown=function(){return this.leftDd},t.prototype.rightIsDown=function(){return this.rightDd},t.prototype.update=function(){if(this.isDown)if(this.oneStick){var t=this.sprite.x-this.game.camera.x;this.pointer.position.xthis.bestRank||(this.topTime=t,this.topTime>t&&(this.topTime=t),this.bestRank=i,this.saveLevel())},t.prototype.gotGold=function(){return-1!==this.topTime&&this.topTime<=this.goldTime},t.prototype.getRankSpriteKey=function(){return this.gotGold()&&this.gotStar&&this.challengeCompleted?"clearText":t.RANK_SPRITE_KEYS[this.bestRank]},t.prototype.loadLevel=function(){var t=parseInt(this.id),e=SaveGame.getInstance().getLevel(t-1);this.topTime=e.tt,this.bestRank=e.br,this.gotStar=e.gs,this.challengeCompleted=e.cc,this.extremeCompleted=e.ec},t.prototype.saveLevel=function(){var t={tt:this.topTime,br:this.bestRank,gs:this.gotStar,cc:this.challengeCompleted,ec:this.extremeCompleted,fn:this.found};SaveGame.getInstance().saveLevels(parseInt(this.id),t)},t.prototype.clearSavedData=function(){SaveGame.getInstance().resetLevels()},t.RANK_SPRITE_KEYS={0:"perfectText",1:"goldText",2:"silverText",3:"bronzeText",4:"clearText"},t.ChallengeSteps=0,t}(),Levels=function(){function t(t,e){this.levels={},this.game=t,this.totalLoad=0,this.loadedNum=0,this.doneCallback=e,this.latestCompleted=Constants.latestCompleted;var i=this.game.cache.getJSON("levelsConfig");for(var s in i)if(i.hasOwnProperty(s)){var o=void 0,n=void 0,a=i[s].name,r=i[s].nameHard,h=i[s].hue;if("hub"===s)o=i[s].file,n=this.game.cache.getJSON(o),levelData[o]=n,this.loadLevel(s,o,a,-1,-1,-1);else if("11"===s){for(var l=i[s].roomsFiles,c=0,p=i[s].roomsFiles;c=this.fadeAfter){if(this.graphics.alpha-=.1*this.main.gameSpeed,this.scaleOut&&(this.graphics.scale.x*=.8,this.graphics.scale.y=this.graphics.scale.x),this.graphics.alpha<=0)return void this.destroy(this.isUI)}else this.fadeTime++;var t=this.xPos,e=this.yPos;c.prototype.update.call(this),this.alive&&(t==this.xPos&&e==this.yPos||(this.graphics.position.set(this.xPos,this.yPos),this.hitBoxPolygon.pos.x=this.xPos-.5*this.size,this.hitBoxPolygon.pos.y=this.yPos-.5*this.size))}},t}(Particle),DeathText=function(){function t(t,e){this.text=t.add.bitmapText(0,0,"grobred32","",18),this.text.visible=!1,this.text.anchor.set(.5,.5),e.add(this.text),this.alive=!1}return t.prototype.show=function(t,e,i){this.xPos=t,this.yPos=e,this.text.position.set(t,e),this.text.setText(i),this.text.visible=!0,this.text.scale.set(.75,.75),this.tarY=e+30,this.alive=!0},t.prototype.update=function(){this.alive&&(this.text.scale.x<1.3?(this.text.scale.x-=.05*(this.text.scale.x-1.3),this.text.scale.y=this.text.scale.x,1.3-this.text.scale.x<.01&&this.text.scale.set(1.3,1.3)):(this.text.alpha-=.15*this.text.alpha,this.text.alpha&&(this.alive=!1,this.text.visible=!1)),this.yPos--,this.text.position.y=this.yPos)},t}(),SimpleTransition=function(){function t(t,e,i){this.main=t,this.game=e,this.scaleX=e.width/640,this.scaleY=e.height/560,this.topHalf=i.create(0,0,"simpleTransition"),this.topHalf.scale.set(this.scaleX,this.scaleY),this.bottomHalf=i.create(0,0,"simpleTransition"),this.bottomHalf.anchor.set(1,1),this.bottomHalf.scale.set(-this.scaleX,-this.scaleY),this.topHalf.fixedToCamera=!0,this.bottomHalf.fixedToCamera=!0,this.topHalf.visible=!1,this.bottomHalf.visible=!1,this.state=0}return t.prototype.beginTransition=function(t,e,i){this.state=1,this.isHub=i,this.topHalf.cameraOffset.set(0,0),this.topHalf.anchor.set(0,0),this.bottomHalf.cameraOffset.set(0,0),this.bottomHalf.anchor.set(1,1),this.topHalf.rotation=-90,this.bottomHalf.rotation=90,this.callback=t,e&&this.main.options.blend?(this.topHalf.filters=[e],this.bottomHalf.filters=[e]):(this.topHalf.filters=null,this.bottomHalf.filters=null),this.topHalf.visible=!0,this.bottomHalf.visible=!0},t.prototype.update=function(){if(1===this.state){var t=this.topHalf.angle-0;this.topHalf.angle-=t/10,Math.abs(t)<.5&&(this.topHalf.rotation=0,this.bottomHalf.rotation=0,this.topHalf.cameraOffset.set(this.game.width,this.game.height),this.bottomHalf.cameraOffset.set(this.game.width,this.game.height),this.topHalf.anchor.set(1,1),this.bottomHalf.anchor.set(0,0),this.state=2,this.callback()),this.bottomHalf.rotation=-this.topHalf.rotation}else if(2===this.state){t=this.topHalf.angle-60;this.topHalf.angle-=t/10,Math.abs(t)<.5&&(this.topHalf.rotation=90,this.bottomHalf.rotation=-this.topHalf.rotation,this.state=0,this.topHalf.visible=!1,this.bottomHalf.visible=!1),this.bottomHalf.rotation=-this.topHalf.rotation}},t.prototype.resizeStage=function(t,e){this.scaleX=t/640,this.scaleY=e/560,this.topHalf.scale.set(this.scaleX,this.scaleY),this.bottomHalf.anchor.set(1,1),this.bottomHalf.scale.set(-this.scaleX,-this.scaleY)},t}(),Sounds=function(){function t(t,e){var i;this.main=t,this.nextMusicNormalIndex=0,this.nextMusicHardIndex=0,this.muted=!1,this.connectHang=e.add.audio("connectHang"),this.fall=e.add.audio("fall",.2),this.downgrade=e.add.audio("downgrade",.7),this.poleSwing=e.add.audio("poleSwing",.7),this.splash1=e.add.audio("splash1",.7),this.ziplineFull=e.add.audio("ziplineFull",.7),this.cannonEnter=e.add.audio("cannonEnter",.7),this.wallSlide=e.add.audio("wallSlide",.7),this.connectSlide=e.add.audio("connect",.7),this.land=e.add.audio("land",.5),this.slide=e.add.audio("slide",.7),this.death1=e.add.audio("death1",.7),this.death2=e.add.audio("death2",.7),this.electricity=e.add.audio("electricity",.5),this.poleWoosh=e.add.audio("poleWoosh",.7),this.bounce1=e.add.audio("bounce1",.7),this.cannonFire=e.add.audio("cannonFire",.7),this.glassSmash=e.add.audio("glassSmash",.7),this.fallingBlock=e.add.audio("fallingBlock",.7),this.blockDestroy=e.add.audio("blockDestroy",.7),this.buttonClick=e.add.audio("buttonClick",.7),this.achievementUnlocked=e.add.audio("achievementUnlocked",.7),this.footstep=e.add.audio("footstep",.7),this.laserFire=e.add.audio("laserFire",.7),this.ding=e.add.audio("ding",.7),this.kickBlock=e.add.audio("kickBlock",.7),this.starPickup=e.add.audio("starPickup",.7),this.menuSong=e.add.audio("vexSong1",.7,!0),this.vexationSong=e.add.audio("vexSong2",.7,!0),this.challengeSong=e.add.audio("vexSong12",.7,!0),this.songs=[],this.vexSongNormal=[],this.vexSongHard=[],i=e.add.audio("vexSong3",.7,!0),this.vexSongNormal.push(i),this.songs.push(i),i=e.add.audio("vexSong4",.7,!0),this.vexSongNormal.push(i),this.songs.push(i),i=e.add.audio("vexSong5",.7,!0),this.vexSongNormal.push(i),this.songs.push(i),i=e.add.audio("vexSong6",.7,!0),this.vexSongNormal.push(i),this.songs.push(i),i=e.add.audio("vexSong7",.7,!0),this.vexSongNormal.push(i),this.songs.push(i),i=e.add.audio("vexSong8",.7,!0),this.vexSongHard.push(i),this.songs.push(i),i=e.add.audio("vexSong9",.7,!0),this.vexSongHard.push(i),this.songs.push(i),i=e.add.audio("vexSong10",.7,!0),this.vexSongHard.push(i),this.songs.push(i),i=e.add.audio("vexSong11",.7,!0),this.vexSongHard.push(i),this.songs.push(i),i=e.add.audio("vexSong12",.7,!0),this.vexSongHard.push(i),this.songs.push(i),i=e.add.audio("vexSong13",.7,!0),this.vexSongHard.push(i),this.songs.push(i),i=e.add.audio("vexSong14",.7,!0),this.vexSongHard.push(i),this.songs.push(i)}return t.prototype.playSound=function(t){Constants.muted||this[t].play(null,null,.6*this.main.options.effectVolume)},t.prototype.playRandomMusic=function(){for(var t=0,e=this.songs;tthis.disappearDistSq&&(this.reappear>=this.reappearTime?(this.sprite.alpha-=.25*this.sprite.alpha,this.sprite.scale.x-=.25*this.sprite.scale.x,this.sprite.scale.y=this.sprite.scale.x):this.reappear++)},t.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,this.main=null},t}();!function(t){var e=function(){function t(){}return t.show=function(){var t=document.getElementById("loader");t&&(t.style.display="block")},t.hide=function(){var t=document.getElementById("loader");t&&(t.style.display="none")},t}();t.LoaderHelper=e}(Fabrique||(Fabrique={})),function(t){var e=function(){function t(){var n,t,a,e,i,r,s=this;this.apiKey="REHaiXjhpLx62lFah1bMUA",this.recurringError=[],n=window,t=document,a="rg4js",n.RaygunObject=a,n[a]=n[a]||function(){(n[a].o=n[a].o||[]).push(arguments)},e=t.createElement("script"),i=t.getElementsByTagName("script")[0],e.async=1,e.src="./raygun.min.js",i.parentNode.insertBefore(e,i),r=n.onerror,n.onerror=function(t,e,i,s,o){r&&r(t,e,i,s,o),o||(o=new Error(t)),n[a].q=n[a].q||[],n[a].q.push({e:o})},rg4js("apiKey",this.apiKey),rg4js("enableCrashReporting",!0),rg4js("setVersion",version),rg4js("options",{ignore3rdPartyErrors:!0}),rg4js("onBeforeSend",function(t){return s.filterError(t)}),rg4js("enablePulse",!1)}return t.getInstance=function(){return null===t.instance&&(t.instance=new t),t.instance},t.prototype.filterError=function(t){if(void 0!==t&&t.Details&&t.Details.Error&&t.Details.Error.Message){if(-1!==this.recurringError.indexOf(t.Details.Error.Message))return!1;this.recurringError.push(t.Details.Error.Message)}return t},t.prototype.setUser=function(){var t=function(){var t,o="brzcrz_local";try{t=window.localStorage.getItem(o)}catch(t){}if(t)return t;var e=function(){for(var t=o+"=",e=document.cookie.split(";"),i=0;iConstants.latestChallengeStep&&(Constants.latestChallengeStep=t)},e.prototype.getAllLevels=function(){return this.levels},e.prototype.setCheckPoint=function(t){this.checkPoint=t},e.prototype.setLevel=function(t,e){var i=t-1,s=this.levels[i];(s=e).id=t,this.levels[i]=s},e.prototype.setAllLevels=function(t){this.levels=[],this.levels=t},e.prototype.getLevel=function(t){return this.levels[t]},e.prototype.getCheckPoint=function(){return this.checkPoint},e.prototype.getAchievements=function(){return this.achievements},e.prototype.getChallengeData=function(){return this.challengeData},e.prototype.setAchievements=function(t){this.achievements=t},e.prototype.setChallengeData=function(t){this.challengeData=t},e.prototype.clearOptions=function(){Constants.musicVolume=1,Constants.effectVolume=.5,Constants.autoReset=!1,Constants.particleLimit=30,Constants.oldControls=!1,Constants.blend=!0,Constants.waves=!0,Constants.parallax=!0,Constants.muted=!1,Constants.mutedMusic=!1,this.game.device.desktop||(Constants.particleLimit=0,Constants.blend=!1,Constants.waves=!1,Constants.parallax=!1)},e.prototype.clearStats=function(){Constants.totalDeaths=0,Constants.timePlayed=0},e.prototype.clearLevel=function(){return{tt:-1,br:4,gs:!1,cc:!1,fn:!1}},e.prototype.clearAllLevels=function(){this.levels=[];for(var t=0;t<=10;t++){var e=this.clearLevel();e.id=t+1,this.levels.push(e)}this.latestCompleted=Constants.latestCompleted},e.prototype.clearChallengeData=function(){this.challengeData={deaths:0,time:0,floor:0}},e.prototype.clearAchievements=function(){this.achievements=Constants.achievements},e.prototype.saveOptions=function(t){this.save()},e.prototype.resetOptions=function(){this.clearOptions(),this.save()},e.prototype.saveStats=function(t){this.save()},e.prototype.resetStats=function(){this.clearStats(),this.save()},e.prototype.saveLevels=function(t,e){this.setLevel(t,e),this.setLastLevel(t),this.save()},e.prototype.saveCheckPoint=function(t,e){this.setCheckPoint({x:t,y:e}),this.save()},e.prototype.removeCheckPoint=function(){this.setCheckPoint(null),this.save()},e.prototype.saveChallengeStep=function(t){this.setLastChallengeStep(t),this.save()},e.prototype.resetLevels=function(){this.clearAllLevels(),this.setLastLevel(0),this.save()},e.prototype.saveAchievements=function(t){this.setAchievements(t),this.save()},e.prototype.resetAchievements=function(){this.clearAchievements(),this.save()},e.prototype.setChallengeStep=function(t){this.setChallengeData(t),this.save()},e.prototype.clearAll=function(){this.checkPoint=null,this.clearOptions(),this.clearStats(),this.clearAllLevels(),this.clearChallengeData(),this.save()},e.prototype.save=function(){var t=JSON.stringify(this.getAllValues()),e=this.hash([t.options,t.stats,t.latestCompleted,t.latestChallengeStep,t.levels,t.achievements,t.challengeData,t.checkPoint].join("-"));this.game.storage.setItem("sg",t),this.game.storage.setItem("h",e)},e.prototype.restore=function(){var e=this;this.game.storage.getItem("sg").then(function(t){e.setAllValues(JSON.parse(t))})},e.prototype.load=function(){return this.game.storage.getItem("sg")},e.prototype.hash=function(t){var e,i,s=0;if(0===t.length)return s.toString();for(e=0,i=t.length;ethis.particleSpawnRate&&(this.main.createColorParticle(this.xPos-80+160*Math.random(),this.yPos-80+160*Math.random(),0,0,4649252,4,!1),this.particleTimer=0);for(var t=0,e=this.main.particles;tthis.yPos&&(i.yVelocity-=.75),i.xPosthis.xPos&&(i.xVelocity-=.75))}},n.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,this.hitBoxPolygon=null,o.prototype.destroy.call(this)},n}(Entity),HazardStrips=function(o){function t(t,e,i){var s=o.call(this,t)||this;return s.game=e,s.layer=i,s.sprite=i.create(0,0,"atlas_gameplay","hazardStrips"),s.sprite.autoCull=!0,s.sprite.visible=!1,s.alive=!1,s}return __extends(t,o),t.prototype.spawn=function(t,e){this.xPos=t,this.yPos=e,this.sprite.position.set(t,e),this.sprite.visible=!0,this.alive=!0},t.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,o.prototype.destroy.call(this)},t}(Entity),Key=function(o){function t(t,e,i){var s=o.call(this,t)||this;return s.game=e,s.layer=i,s.init(),s.hitBoxPolygon=new SAT.Box(new SAT.Vector(0,0),20,40).toPolygon(),s.hitBoxPolygon.setOffset(new SAT.Vector(-10,-20)),s.alive=!1,s.lineColor=16763904,s}return __extends(t,o),t.prototype.init=function(){this.sprite=this.layer.create(0,0,"atlas_gameplay","key"),this.sprite.autoCull=!0,this.sprite.anchor.set(.5,.5),this.lineGraphic=this.game.add.graphics(0,0,this.layer)},t.prototype.spawn=function(t,e){this.xPos=t,this.yPos=e,this.startX=t,this.startY=e,this.xVelocity=0,this.yVelocity=0,this.sprite.position.set(t,e),this.hitBoxPolygon.pos.x=t,this.hitBoxPolygon.pos.y=e,this.alive=!0,this.used=!1,this.keyNum=0,this.saveUse=!1,this.following=!1,this.rad=0},t.prototype.useKey=function(){this.used=!0,this.lineGraphic.clear(),this.sprite.visible=!1,this.alive=!1},t.prototype.followPlayer=function(){var t,e,i=10*(this.keyNum-1);this.rad=-4*this.player.xVelocity*Math.PI/180,this.yVelocity<0&&(this.yVelocity+=.5),this.yPos+=this.yVelocity,e=this.player.swimming?(t=this.player.xPos,this.player.yPos-i):(t="right"===this.player.facing?this.player.xPos-30:this.player.xPos+30,this.player.yPos-6-i);var s=t-this.xPos,o=e-this.yPos;this.xPos+=s/5,this.yPos+=o/5,Math.abs(s)<1&&(this.xPos=t),Math.abs(o)<1&&(this.yPos=e),this.hitBoxPolygon.pos.x=this.xPos,this.hitBoxPolygon.pos.y=this.yPos},t.prototype.runCollisions=function(){for(var t=0,e=this.main.blocks;t=t.TIMER_MAX?(this.main.player.loseKey(this),this.reset()):this.timer++),o.prototype.update.call(this)},t.TIMER_MAX=180,t}(Key),WindBlaster=function(h){function t(t,e,i){var s=h.call(this,t)||this;s.game=e,s.layer=i,s.container=e.add.group(i),s.windGraphics=[];var o=e.make.graphics(0,0);o.lineStyle(1,2236962),o.moveTo(0,0),o.lineTo(27,0);var n=o.generateTexture();o.destroy();for(var a=0;a<6;a++){var r=s.game.add.sprite(0,0,n,null,s.container);r.visible=!1,s.windGraphics.push(r)}return s.sprite=s.container.create(0,0,"atlas_gameplay","windBlaster"),s.sprite.autoCull=!0,s.sprite.anchor.set(0,.5),s.fanSprite=e.add.sprite(0,0,"windFan"),s.fanSprite.anchor.set(0,.5),s.fanSprite.animations.add("fan"),s.fanSprite.play("fan",null,!0),s.sprite.addChild(s.fanSprite),s.fanMask=new SAT.Box(new SAT.Vector(0,0),180,50).toPolygon(),s.fanMask.setOffset(new SAT.Vector(0,-25)),s.alive=!1,s}return __extends(t,h),t.prototype.spawn=function(t,e,i){this.xPos=t,this.yPos=e,this.container.position.set(t,e),this.container.angle=i,this.rotation=i,this.fanMask.pos.x=t,this.fanMask.pos.y=e,this.fanMask.setAngle(i*Math.PI/180),this.alive=!0;for(var s=this.inc=0,o=this.windGraphics;sthis.yPos-5&&(this.main.player.yPos=this.yPos-5,this.main.player.yVelocity=-4,this.main.player.updateHitBoxesPos(),this.main.player.falling=!0),this.inc<2.5?this.inc+=.25:this.inc=2.5}else this.inc-=.25,this.inc<0&&(this.inc=0);for(var s=0,o=this.windGraphics;sthis.startX+this.maxMoveDist&&(this.xVelocity=-this.xVelocity):this.xPosthis.startY+this.maxMoveDist&&(this.yVelocity=-this.yVelocity),this.yPos+=this.yVelocity,this.yPos!=t&&this.updatePosition()},t.prototype.updatePosition=function(){this.sprite.position.set(this.xPos,this.yPos),this.deathCircle.pos.y=this.yPos},t.prototype.reset=function(){this.yVelocity=-2,this.updatePosition()},t.prototype.resetLevel=function(){this.reset()},t}(Buzzsaw),ClassicLaser=function(o){function h(t,e,i){var s=o.call(this,t,e,i)||this;return s.sprite=i.create(0,0,"atlas_gameplay","classicLaser"),s.sprite.autoCull=!0,s.sprite.anchor.set(.5,.5),s.bullet=new Bullet(t,e,t.obstacleLayer),s.main.obstacles.push(s.bullet),s.alive=!1,s}return __extends(h,o),h.prototype.spawn=function(t,e){this.xPos=t,this.yPos=e,this.startX=t,this.startY=e,this.rad=Math.PI/2,this.sprite.position.set(t,e),this.sprite.rotation=this.rad,this.spinDest=Math.PI/2,this.shootTimer=0},h.prototype.levelStart=function(){this.storeNearbyPlatforms()},h.prototype.storeNearbyPlatforms=function(){this.platforms=[];for(var t=new SAT.Circle(new SAT.Vector(this.xPos,this.yPos),250),e=0,i=this.main.blocks;e=h.FIRE_RATE&&(this.shootTimer=0,this.bullet.spawn(this.xPos,this.yPos,25*Math.cos(this.rad),25*Math.sin(this.rad),this.rad),this.main.sounds.playSound("laserFire")))}else this.spinDest=Math.PI/2;var r=this.rad-this.spinDest;Math.abs(r)<.5*Math.PI/180?this.rad=this.spinDest:r>200*Math.PI/180?this.rad=this.spinDest:this.rad-=.25*r,this.sprite.rotation=this.rad}},h.prototype.destroy=function(){this.sprite.destroy(),this.sprite=null,o.prototype.destroy.call(this)},h.prototype.reset=function(){this.shootTimer=0},h.prototype.resetLevel=function(){this.reset(),this.rad=Math.PI/2,this.spinDest=Math.PI/2},h.FIRE_RATE=40,h.RANGE_SQ=62500,h}(Obstacle),EnlargingBuzzsaw=function(o){function t(t,e,i){var s=o.call(this,t,e,i)||this;return s.obstacleType="buzzsaw",s.alive=!1,s}return __extends(t,o),t.prototype.spawn=function(t,e,i){void 0===i&&(i=1),this.xPos=t,this.yPos=e,this.sprite.position.set(t,e),this.sprite.visible=!0,this.enlarging=!0,this.deathCircle.pos.x=t,this.deathCircle.pos.y=e,this.scaleXStart=i,this.scaleYStart=i,this.scale=i,this.alive=!0},t.prototype.update=function(){this.enlarging?(this.scale+=.02*this.scaleXStart*this.main.gameSpeed,this.scale>2.5*this.scaleXStart&&(this.scale=2.5*this.scaleXStart,this.enlarging=!1)):(this.scale-=.02*this.scaleXStart*this.main.gameSpeed,this.scale<.5*this.scaleXStart&&(this.scale=.5*this.scaleXStart,this.enlarging=!0)),o.prototype.update.call(this),this.updatePosition()},t.prototype.updatePosition=function(){this.sprite.scale.set(this.scale,this.scale),this.sprite.position.set(this.xPos,this.yPos),this.deathCircle.pos.y=this.yPos,this.deathCircle.r=42*this.scale},t.prototype.resetLevel=function(){},t}(Buzzsaw),FallingSpike=function(r){function t(t,e,i,s){void 0===s&&(s=!1);var o=r.call(this,t,e,i)||this;o.game=e,o.layer=i,o.obstacleType="spike",o.sprite=o.layer.create(0,0,"atlas_gameplay","fallingSpike"),o.sprite.autoCull=!0,o.sprite.anchor.set(.5,.5),o.sprite.visible=!1,o.alive=!1,o.dispenser=s,o.enableDestroyMain=!0,o.graphics=o.game.add.graphics(0,0,o.layer),o.graphics.visible=!0,o.width=7.5,o.height=14.75,o.deathBoxPolygon=new SAT.Box(new SAT.Vector(0,0),o.width,o.height).toPolygon();var n=.5*o.width,a=.5*o.height;return o.deathBoxPolygon.setOffset(new SAT.Vector(-n,-a)),o}return __extends(t,r),t.prototype.spawn=function(t,e,i){this.xPos=t,this.yPos=e,this.startX=t,this.startY=e,this.rotation=i,this.rad=i*Math.PI/180,this.xVelocity=0,this.yVelocity=0,this.sprite.position.set(t,e),this.sprite.angle=i,this.dispenser||(this.sprite.visible=!0),this.alive=!0,this.deathBoxPolygon.pos.x=t,this.deathBoxPolygon.pos.y=e,this.falling=!1,this.fallDist=0,this.speed=0},t.prototype.levelStart=function(){this.range=350;for(var t=this.rotation*Math.PI/180,e=0,i=10;i<=this.range;){for(var s=new SAT.Polygon(new SAT.Vector(this.xPos,this.yPos),[new SAT.Vector(0,0),new SAT.Vector(Math.cos(t)*i,Math.sin(t)*i)]),o=0,n=this.main.blocks;oe&&(e=Math.abs(r.overlap))}if(0this.range&&(i=this.range)}this.hitDist=i,this.searchHitBox=new SAT.Box(new SAT.Vector(this.xPos,this.yPos),this.hitDist,16).toPolygon(),this.searchHitBox.offset=new SAT.Vector(0,-8),this.searchHitBox.setAngle(t)},t.prototype.update=function(){if(this.alive)if(this.falling)this.xVelocity+=Math.cos(this.rad)*this.main.gravity,this.yVelocity+=Math.sin(this.rad)*this.main.gravity,this.speed+=this.main.gravity,this.xPos+=this.xVelocity,this.yPos+=this.yVelocity,this.fallDist+=this.speed,this.updatePositions(),this.fallDist>this.hitDist&&this.reset();else{if(this.xPos!=this.startX||this.yPos!=this.startY){var t=this.startX-this.xPos,e=this.startY-this.yPos;Math.abs(t)<1?this.xPos=this.startX:this.xPos+=t/5,Math.abs(e)<1?this.yPos=this.startY:this.yPos+=(this.startY-this.yPos)/5,this.updatePositions()}var i=this.main.player;SAT.testPolygonPolygon(this.searchHitBox,i.totalPolygon)&&(this.falling=!0)}},t.prototype.updatePositions=function(){this.sprite.position.set(this.xPos,this.yPos),this.deathBoxPolygon.pos.x=this.xPos,this.deathBoxPolygon.pos.y=this.yPos},t.prototype.reset=function(){this.dispenser?this.die():(this.falling=!1,this.xPos=this.startX-15*Math.cos(this.rad),this.yPos=this.startY-15*Math.sin(this.rad),this.xVelocity=0,this.yVelocity=0,this.sprite.position.set(this.xPos,this.yPos),this.deathBoxPolygon.pos.x=this.xPos,this.deathBoxPolygon.pos.y=this.yPos,this.fallDist=0,this.speed=0)},t.prototype.dispenserFire=function(){this.falling=!0,this.alive=!0,this.xPos=this.startX+15*Math.cos(this.rad),this.yPos=this.startY+15*Math.sin(this.rad),this.xVelocity=0,this.yVelocity=0,this.sprite.position.set(this.xPos,this.yPos),this.sprite.visible=!0,this.deathBoxPolygon.pos.x=this.xPos,this.deathBoxPolygon.pos.y=this.yPos,this.fallDist=0,this.speed=0},t.prototype.die=function(){this.sprite.visible=!1,this.alive=!1},t.prototype.destroy=function(t){void 0===t&&(t=!0),t===this.enableDestroyMain&&(this.sprite.destroy(),this.searchHitBox=null,this.deathBoxPolygon=null,this.graphics.destroy(),r.prototype.destroy.call(this))},t.prototype.resetLevel=function(){this.reset()},t}(Obstacle),LaserPoint=function(o){function t(t,e,i){var s=o.call(this,t,e,i)||this;return s.laserGraphic=e.add.graphics(0,0,i),s.obstacleType="laser",s}return __extends(t,o),t.prototype.spawn=function(t,e,i,s){this.xPos=t,this.yPos=e,this.xLength=i-t,this.yLength=s-e,this.alive=!0,this.deathHitBoxPolygon=new SAT.Polygon(new SAT.Vector(this.xPos,this.yPos),[new SAT.Vector(0,0),new SAT.Vector(i-t,s-e)]),this.laserGraphic.position.set(this.xPos,this.yPos),this.laserGraphic.lineStyle(2,16724787),this.laserGraphic.moveTo(0,0),this.laserGraphic.lineTo(i-t,s-e)},t.prototype.update=function(){if(Math.random()<.05){var t=Math.random(),e=this.xPos+this.xLength*t,i=this.yPos+this.yLength*t;this.main.createColorParticle(e,i,10*Math.random()-5,-5*Math.random(),16711680,4,!1,!1,10,!0)}},t.prototype.destroy=function(){this.game=null,this.layer=null,this.laserGraphic.destroy(),this.laserGraphic=null,o.prototype.destroy.call(this)},t}(Obstacle),Quadrant=function(o){function t(t,e,i){var s=o.call(this,t,e,i)||this;return s.sprite=i.create(0,0,"atlas_gameplay","quadrant"),s.sprite.autoCull=!0,s.sprite.anchor.set(.5,.5),s.sprite.visible=!1,s.obstacleType="quadrant",s.deathHitBoxPolygons=[],s}return __extends(t,o),t.prototype.spawn=function(t,e,i,s,o){var n;void 0===o&&(o=1),this.xPos=t,this.yPos=e,this.startX=t,this.startY=e,this.rad=i*Math.PI/180,this.startRad=this.rad,this.rotSpeed=s,this.sprite.position.set(t,e),this.sprite.visible=!0,this.sprite.scale.set(o,o),this.alive=!0,this.attachHitBoxPolygon=new SAT.Box(new SAT.Vector(t,e),10,10).toPolygon(),this.attachHitBoxPolygon.setOffset(new SAT.Vector(-5,-5)),(n=new SAT.Box(new SAT.Vector(0,0),10*o,10*o).toPolygon()).setOffset(new SAT.Vector(75*o,0)),this.deathHitBoxPolygons.push(n),(n=new SAT.Box(new SAT.Vector(0,0),10*o,10*o).toPolygon()).setOffset(new SAT.Vector(0,75*o)),this.deathHitBoxPolygons.push(n),(n=new SAT.Box(new SAT.Vector(0,0),10*o,10*o).toPolygon()).setOffset(new SAT.Vector(-75*o,0)),this.deathHitBoxPolygons.push(n),(n=new SAT.Box(new SAT.Vector(0,0),10*o,10*o).toPolygon()).setOffset(new SAT.Vector(0,-75*o)),this.deathHitBoxPolygons.push(n)},t.prototype.update=function(){this.rad+=this.rotSpeed,this.updatePosition()},t.prototype.updatePosition=function(){this.sprite.position.set(this.xPos,this.yPos),this.sprite.rotation=this.rad;for(var t=0,e=this.deathHitBoxPolygons;t=r.CHARGE_TIME&&(this.fireSpikes(),this.charge=0,this.rad=0)}}this.chargeo.fireTimer)){this.cooldown=0;var t=this.shurikanPool.pop();if(!t)return;var e=1.3*Math.cos(this.rotation*Math.PI/180),i=1.3*Math.sin(this.rotation*Math.PI/180),s=0;90==this.rotation||-90==this.rotation?s=1:0!=this.rotation&&-180!=this.rotation&&180!=this.rotation&&(s=2),this.shurikanActivePool.push(t),t.spawn(this.xPos,this.yPos,e,i,s),this.spawned++,3===this.spawned&&(this.cooldown=-60)}},o.prototype.resetLevel=function(){this.spawned=0,this.cooldown=0},o.prototype.destroy=function(){for(;0this.sparkBlock.rightEdge&&(this.xPos=this.sparkBlock.rightEdge,this.direction="down");break;case"down":this.yPos+=5*this.main.gameSpeed,this.yPos>this.sparkBlock.bottomEdge&&(this.yPos=this.sparkBlock.bottomEdge,this.direction="left");break;case"left":this.xPos-=5*this.main.gameSpeed,this.xPos=this.wires.length-4)return!0;this.followWire=this.wires[this.followInd],this.followDist=0,this.followX=this.followWire.xPos+25*Math.cos(this.followWire.rad)-this.main.game.width/2,this.followY=this.followWire.yPos+25*Math.sin(this.followWire.rad)-this.main.game.height/2,this.followXSpeed=-8*Math.cos(this.followWire.rad),this.followYSpeed=-8*Math.sin(this.followWire.rad)}return this.main.game.camera.x=this.followX,this.main.game.camera.y=this.followY,!1},t.prototype.destroy=function(){var t=this.main.obstacles.indexOf(this.spark);this.main.obstacles.splice(t,1),this.spark.destroy(),this.burning=!1,this.main=null,this.wires=null,this.spark=null},t.prototype.resetLevel=function(){for(var t=0,e=this.wires;t=window.innerHeight))return void this.handleIncorrect();this.handleCorrect()}var e=1;1this.currentLevel.goldTime&&(this.main.sounds.playSound("downgrade"),this.rankType=RANKTYPE.silver,this.setrankingText(this.currentLevel.silverTime));break;case RANKTYPE.silver:t>this.currentLevel.silverTime&&(this.main.sounds.playSound("downgrade"),this.rankType=RANKTYPE.bronza,this.setrankingText(this.currentLevel.bronzeTime));break;case RANKTYPE.bronza:t>this.currentLevel.bronzeTime&&(this.main.sounds.playSound("downgrade"),this.rankType=RANKTYPE.none,this.setrankingText(this.currentLevel.bronzeTime))}}else this.uiElements[UIGPELEMENTS.levelTime].setText(timeDecoratorHub(Date.now()-Constants.levelMapStartTime))},t.prototype.updateAchievment=function(){if(this.showingAchievement&&(this.showTimeAchievement--,this.showTimeAchievement<=0))return this.uiElements[UIGPELEMENTS.achievementContainer].visible=!1,void(this.showingAchievement=!1)},t.prototype.setrankingText=function(t){switch(this.rankType){case RANKTYPE.perfect:this.uiElements[UIGPELEMENTS.levelRankTime].setText(timeDecorator(t)),this.uiElements[UIGPELEMENTS.levelRankTime].addColor("#aeff2f",0),this.uiElements[UIGPELEMENTS.levelRank].frameName="perfect.png";break;case RANKTYPE.gold:this.uiElements[UIGPELEMENTS.levelRankTime].setText(timeDecorator(t)),this.uiElements[UIGPELEMENTS.levelRankTime].addColor("#ffffff",0),this.uiElements[UIGPELEMENTS.levelRank].frameName="gold.png";break;case RANKTYPE.silver:this.uiElements[UIGPELEMENTS.levelRankTime].setText(timeDecorator(t)),this.uiElements[UIGPELEMENTS.levelRankTime].addColor("#ffffff",0),this.uiElements[UIGPELEMENTS.levelRank].frameName="silver.png";break;case RANKTYPE.bronza:this.uiElements[UIGPELEMENTS.levelRankTime].setText(timeDecorator(t)),this.uiElements[UIGPELEMENTS.levelRankTime].addColor("#ffffff",0),this.uiElements[UIGPELEMENTS.levelRank].frameName="bronze.png";break;case RANKTYPE.none:this.uiElements[UIGPELEMENTS.levelRankTime].setText(timeDecorator(t)),this.uiElements[UIGPELEMENTS.levelRankTime].addColor("#96989A",0),this.uiElements[UIGPELEMENTS.levelRank].frameName="bronze.png"}},t.prototype.updateFloor=function(t){this.uiElements[UIGPELEMENTS.levelFloor].setText(t+"/"+Level.ChallengeSteps)},t.prototype.getRank=function(){return this.rankType},t.prototype.getTime=function(){return this.uiElements[UIGPELEMENTS.levelTime].text},t}(Phaser.Group),LevelCompleteUI=function(s){function t(t,e){var i=s.call(this,t)||this;return i.main=e,i.ui=i.game.add.ph2UI("ui_lvl_complete","atlas_ui_lvl_complete"),i.createOverlay(),i.add(i.ui),i.addTouchCallback(),i.localization(),i.visible=!1,i}return __extends(t,s),t.prototype.createOverlay=function(){this.darkGraphics=this.game.add.graphics(0,0,this),this.darkGraphics.alpha=.4,this.darkGraphics.beginFill(0),this.darkGraphics.drawRect(0,0,this.game.width,this.game.height),this.darkGraphics.endFill(),this.darkGraphics.inputEnabled=!0,this.darkGraphics.input.useHandCursor=!1},t.prototype.addTouchCallback=function(){Game.Util.addTouchCallbackToButton("container/close",this.ui,this.hide,this),Game.Util.addTouchCallbackToButton("container/play",this.ui,this.hide,this),Game.Util.addTouchCallbackToButton("container/trophies",this.ui,this.showTrophie,this),Game.Util.addTouchCallbackToButton("container/reload",this.ui,this.resetlevel,this)},t.prototype.localization=function(){Game.LocalizationManager.getInstance(this.game).localizeText("container/title",this.ui,"ui_level_complet_title")},t.prototype.goBack=function(){this.hide(null,null,!0,[]),this.main.exitLevel()},t.prototype.showTrophie=function(){this.main.trophiesUI.show()},t.prototype.resetlevel=function(){this.hide(null,null,!0,[],!0)},t.prototype.show=function(){Constants.pausedMapTime=Date.now(),null!==Constants.actStartTime&&(Constants.pausedActTime=Date.now()),this.main.player.pause(),this.main.keys.hide(),this.main.state=GameStates.Window,this.visible=!0},t.prototype.updateData=function(t,e){var i=Ph2.UISystem.findObject("container/time",this.ui);i.setText(t);var s=Ph2.UISystem.findObject("container/image",this.ui);switch(s.visible=!0,e){case RANKTYPE.perfect:i.setText(t),i.addColor("#ffffff",0),s.frameName="perfect.png";break;case RANKTYPE.gold:i.setText(t),i.addColor("#ffffff",0),s.frameName="gold.png";break;case RANKTYPE.silver:i.setText(t),i.addColor("#ffffff",0),s.frameName="silver.png";break;case RANKTYPE.bronza:i.setText(t),i.addColor("#ffffff",0),s.frameName="bronze.png";break;case RANKTYPE.none:i.setText(t),i.addColor("#ffffff",0),s.frameName="bronze.png",s.visible=!1}"11"===this.main.currentLevelID&&(s.visible=!1,i.addColor("#ffffff",0))},t.prototype.hide=function(t,e,i,s,o){void 0===o&&(o=!1);var n=Date.now()-Constants.pausedMapTime;if(Constants.levelMapStartTime+=n,null!==Constants.actStartTime){var a=Date.now()-Constants.pausedActTime;Constants.actStartTime+=a}this.main.state=GameStates.Playing,this.visible=!1,this.main.player.resume(),this.main.keys.show(),o?(this.main.player.respawn(),this.main.firstSpawn=!0,this.main.resumeOnReset(),this.main.resetLevel()):this.main.pressContinueLevelCompleted()},t.prototype.resize=function(){var t=960this.game.height+500?(this.container.position.y=900,this.container.visible=!1):this.container.position.y-=e/4}},t.prototype.resizeStage=function(t,e){this.container.x=t/2},t}(),OrientationWindow=function(o){function t(t,e,i){var s=o.call(this,t,e,i)||this;return s.frame=i.create(0,0,"orientationWindow"),s.showY=170,s.init(),s.closeButton.position.set(450,-30),s}return __extends(t,o),t}(VexWindow);