text: cordova.define("com.ludei.canvasplus.common.CanvasPlus", function(require, exports, module) { !function(){var o=window.Cocoon;!o&&window.cordova&&"undefined"!=typeof require&&(o=cordova.require("com.ludei.cocoon.common.Cocoon")),o.nativeAvailable=!!window.ext,o.clone=function(o,e){if(null===o||"object"!=typeof o)return o;var t=[];for(var n in o)t.push(e.hasOwnProperty(n)?e[n]:o[n]);return t},o.callNative=function(e,t,n,i){if(o.nativeAvailable){var a=Array.prototype.slice.call(n);a.unshift(t);var r=ext[e],c=i?r.makeCallAsync:r.makeCall,s=c.apply(r,a),l=s;if("string"==typeof s)try{l=JSON.parse(s)}catch(d){console.log(d)}return l}},o.getObjectFromPath=function(o,e){for(var t=e.split("."),n=o,i=0,a=t.length;a>i;++i)n[t[i]]=n[t[i]]||void 0,n=n[t[i]];return n},o.EventHandler=function(e,t,n,i){return this.listeners=[],this.listenersOnce=[],this.chainFunction=i,this.addEventListener=function(a){if(i){var r=function(){i.call(this,arguments.callee.sourceListener,Array.prototype.slice.call(arguments))};a.CocoonEventHandlerChainFunction=r,r.sourceListener=a,a=r}var c=o.getObjectFromPath(o,t);if(c&&c.nativeAvailable)ext[e].addEventListener(n,a);else{var s=this.listeners.indexOf(a);0>s&&this.listeners.push(a)}},this.addEventListenerOnce=function(a){if(i){var r=function(){i(arguments.callee.sourceListener,Array.prototype.slice.call(arguments))};r.sourceListener=a,a=r}var c=o.getObjectFromPath(o,t);if(c.nativeAvailable)ext[e].addEventListenerOnce(n,a);else{var s=this.listeners.indexOf(a);0>s&&this.listenersOnce.push(a)}},this.removeEventListener=function(a){i&&(a=a.CocoonEventHandlerChainFunction,delete a.CocoonEventHandlerChainFunction);var r=o.getObjectFromPath(o,t);if(r.nativeAvailable)ext[e].removeEventListener(n,a);else{var c=this.listeners.indexOf(a);c>=0&&this.listeners.splice(c,1)}},this.removeEventListenerOnce=function(a){i&&(a=a.CocoonEventHandlerChainFunction,delete a.CocoonEventHandlerChainFunction);var r=o.getObjectFromPath(o,t);if(r.nativeAvailable)ext[e].removeEventListenerOnce(n,a);else{var c=this.listenersOnce.indexOf(a);c>=0&&this.listenersOnce.splice(c,1)}},this.notifyEventListeners=function(){var i=o.getObjectFromPath(o,t);if(i&&i.nativeAvailable)ext[e].notifyEventListeners(n);else{var a=Array.prototype.slice.call(arguments),r=Array.prototype.slice.call(this.listeners),c=Array.prototype.slice.call(this.listenersOnce),s=this;setTimeout(function(){for(var o=0;o<r.length;o++)r[o].apply(s,a);for(o=0;o<c.length;o++)c[o].apply(s,a)},0),s.listenersOnce=[]}},this},o.createSignal=function(){this.handle=null,this.signals={},this.register=function(o,e){if(!o&&!e)throw new Error("Can't create signal "+(o||""));if(e.addEventListener)return this.signals[o]=e,!0;if(!e.addEventListener){this.signals[o]={};for(var t in e)e.hasOwnProperty(t)&&(this.signals[o][t]=e[t]);return!0}throw new Error("Can't create handler for "+o+" signal.")},this.expose=function(){return function(o,e,t){var n=!1;if(1===arguments.length){var i=this,a=function(o){this.signal=o};return a.prototype.remove=function(o){var e=i.signals[this.signal];e&&e.removeEventListener&&(e.removeEventListener.apply(i,[o]),i.signals[this.signal]=void 0)},new a(o)}if(t&&t.once&&(n=!0),!this.signals[o])throw new Error("The signal "+o+" does not exists.");var r=this.signals[o];if(r.addEventListener&&(n?r.addEventListenerOnce(function(){e.apply(this||window,arguments)}):r.addEventListener(function(){e.apply(this||window,arguments)})),!this.signals[o].addEventListener)for(var c in this.signals[o])this.signals[o].hasOwnProperty(c)&&(r=this.signals[o][c],n?r.addEventListenerOnce(function(){this.clbk[this.name].apply(this||window,arguments)}.bind({name:c,clbk:e})):r.addEventListener(function(){this.clbk[this.name].apply(this||window,arguments)}.bind({name:c,clbk:e})))}.bind(this)}}}(),Cocoon.define("Cocoon.App",function(o){o.nativeAvailable=!!window.ext&&!!window.ext.IDTK_APP,o.isBridgeAvailable=function(){if("boolean"===Cocoon.App.forward.nativeAvailable)return Cocoon.App.forward.nativeAvailable;var o=Cocoon.callNative("IDTK_APP","forwardAvailable",arguments);return o=!!o,Cocoon.App.forward.nativeAvailable=o,o};var e="CocoonJS_App_ForCocoonJS_WebViewIFrame";o.forward=function(o){return Cocoon.App.nativeAvailable&&Cocoon.App.isBridgeAvailable()?Cocoon.callNative("IDTK_APP","forward",arguments):navigator.isCocoonJS?void 0:window.name===e?window.parent.eval(o):window.frames[e].window.eval(o)},o.forwardAsync=function(o,t){return Cocoon.App.nativeAvailable&&Cocoon.App.isBridgeAvailable()?"undefined"!=typeof t?ext.IDTK_APP.makeCallAsync("forward",o,t):ext.IDTK_APP.makeCallAsync("forward",o):void setTimeout(function(){var n;n=window.name===e?window.parent.eval(o):window.parent.frames[e].window.eval(o),t&&t(n)},1)},o.load=function(o,e){if(Cocoon.App.nativeAvailable)return Cocoon.callNative("IDTK_APP","loadPath",arguments);if(!navigator.isCocoonJS){var t=new XMLHttpRequest;t.onreadystatechange=function(e){if(4===t.readyState){var n;200===t.status?(n=Cocoon.App.EmulatedWebViewIFrame?"window.Cocoon && window.Cocoon.App.onLoadInCocoonJSSucceed.notifyEventListeners('"+o+"');":"window.Cocoon && window.Cocoon.App.onLoadInTheWebViewSucceed.notifyEventListeners('"+o+"');",Cocoon.App.forwardAsync(n),window.location.href=o):404===t.status&&(this.onreadystatechange=null,n=Cocoon.App.EmulatedWebViewIFrame?"Cocoon && Cocoon.App.onLoadInCocoonJSFailed.notifyEventListeners('"+o+"');":"Cocoon && Cocoon.App.onLoadInTheWebViewFailed.notifyEventListeners('"+o+"');",Cocoon.App.forwardAsync(n))}},t.open("GET",o,!0),t.send()}},o.reload=function(){return Cocoon.App.nativeAvailable?Cocoon.callNative("IDTK_APP","reload",arguments):navigator.isCocoonJS?void 0:window.name===e?window.parent.location.reload():window.parent.frames[e].window.location.reload()},o.openURL=function(o){return Cocoon.App.nativeAvailable?Cocoon.callNative("IDTK_APP","openURL",arguments,!0):void(navigator.isCocoonJS||window.open(o,"_blank"))},o.exit=function(){return Cocoon.App.nativeAvailable?Cocoon.callNative("IDTK_APP","forceToFinish",arguments):void(navigator.isCocoonJS||window.close())},o.StorageType={APP_STORAGE:"APP_STORAGE",INTERNAL_STORAGE:"INTERNAL_STORAGE",EXTERNAL_STORAGE:"EXTERNAL_STORAGE",TEMPORARY_STORAGE:"TEMPORARY_STORAGE"},o.onSuspended=new Cocoon.EventHandler("IDTK_APP","App","onsuspended"),o.onActivated=new Cocoon.EventHandler("IDTK_APP","App","onactivated"),o.onSuspending=new Cocoon.EventHandler("IDTK_APP","App","onsuspending"),o.onMemoryWarning=new Cocoon.EventHandler("IDTK_APP","App","onmemorywarning");var t=new Cocoon.createSignal;return t.register("suspended",o.onSuspended),t.register("activated",o.onActivated),t.register("suspending",o.onSuspending),t.register("memorywarning",o.onMemoryWarning),o.on=t.expose(),o}),window.ext&&"undefined"!=typeof window.ext.IDTK_SRV_BOX2D?(window.Box2D={},window.Box2D.Dynamics={},window.Box2D.Dynamics.Joints={},window.Box2D.Common={},window.Box2D.Common.Math={},window.Box2D.Collision={},window.Box2D.Collision.Shapes={},function(){"use strict";function o(o){console.error(o)}var e=function(o,e){void 0===o&&(o=0),void 0===e&&(e=0),this.x=o,this.y=e};window.Box2D.Common.Math.b2Vec2=e,e.prototype.SetZero=function(){this.x=0,this.y=0},e.prototype.Set=function(o,e){void 0===o&&(o=0),void 0===e&&(e=0),this.x=o,this.y=e},e.prototype.SetV=function(e){void 0===e&&o("undefined 'v' in b2Vec2.SetV"),this.x=e.x,this.y=e.y},e.Make=function(o,t){return void 0===o&&(o=0),void 0===t&&(t=0),new e(o,t)},void 0===e.Get&&(e.Get=e.Make,e._freeCache=[],e.Free=function(){}),e.prototype.Copy=function(){return new e(this.x,this.y)},e.prototype.Add=function(e){void 0===e&&o("undefined 'v' in b2Vec2.Add"),this.x+=e.x,this.y+=e.y},e.prototype.Subtract=function(e){void 0===e&&o("undefined 'v' in b2Vec2.Subtract"),this.x-=e.x,this.y-=e.y},e.prototype.Multiply=function(o){void 0===o&&(o=0),this.x*=o,this.y*=o},e.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y},e.prototype.Normalize=function(){var o=Math.sqrt(this.x*this.x+this.y*this.y);if(o<Number.MIN_VALUE)return 0;var e=1/o;return this.x*=e,this.y*=e,o},e.prototype.NegativeSelf=function(){this.x=-this.x,this.y=-this.y};var t=function(){this.col1=new e,this.col2=new e,this.SetIdentity()};window.Box2D.Common.Math.b2Mat22=t,t.FromAngle=function(o){void 0===o&&(o=0);var e=new t;return e.Set(o),e},t.FromVV=function(o,e){var n=new t;return n.SetVV(o,e),n},t.prototype.Set=function(o){void 0===o&&(o=0);var e=Math.cos(o),t=Math.sin(o);this.col1.x=e,this.col2.x=-t,this.col1.y=t,this.col2.y=e},t.prototype.SetVV=function(o,e){this.col1.SetV(o),this.col2.SetV(e)},t.prototype.Copy=function(){var o=new t;return o.SetM(this),o},t.prototype.SetM=function(o){this.col1.SetV(o.col1),this.col2.SetV(o.col2)},t.prototype.AddM=function(o){this.col1.x+=o.col1.x,this.col1.y+=o.col1.y,this.col2.x+=o.col2.x,this.col2.y+=o.col2.y},t.prototype.SetIdentity=function(){this.col1.x=1,this.col2.x=0,this.col1.y=0,this.col2.y=1},t.prototype.SetZero=function(){this.col1.x=0,this.col2.x=0,this.col1.y=0,this.col2.y=0},t.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)},t.prototype.GetInverse=function(o){var e=this.col1.x,t=this.col2.x,n=this.col1.y,i=this.col2.y,a=e*i-t*n;return 0!==a&&(a=1/a),o.col1.x=a*i,o.col2.x=-a*t,o.col1.y=-a*n,o.col2.y=a*e,o},t.prototype.Solve=function(o,e,t){void 0===e&&(e=0),void 0===t&&(t=0);var n=this.col1.x,i=this.col2.x,a=this.col1.y,r=this.col2.y,c=n*r-i*a;return 0!==c&&(c=1/c),o.x=c*(r*e-i*t),o.y=c*(n*t-a*e),o},t.prototype.Abs=function(){this.col1.Abs(),this.col2.Abs()};var n=function(o,n){this.position=new e,this.R=new t,void 0===o&&(o=null),void 0===n&&(n=null),o&&(this.position.SetV(o),this.R.SetM(n))};window.Box2D.Common.Math.b2Transform=n,n.prototype.Initialize=function(o,e){this.position.SetV(o),this.R.SetM(e)},n.prototype.SetIdentity=function(){this.position.SetZero(),this.R.SetIdentity()},n.prototype.Set=function(o){this.position.SetV(o.position),this.R.SetM(o.R)},n.prototype.SetAngle=function(){return Math.atan2(this.R.col1.y,this.R.col1.x)};var i=function(){};window.Box2D.Common.Math.b2Math=i,i.IsValid=function(o){return void 0===o&&(o=0),isFinite(o)},i.Dot=function(o,e){return o.x*e.x+o.y*e.y},i.CrossVV=function(o,e){return o.x*e.y-o.y*e.x},i.CrossVF=function(o,t){void 0===t&&(t=0);var n=new e(t*o.y,-t*o.x);return n},i.CrossFV=function(o,t){void 0===o&&(o=0);var n=new e(-o*t.y,o*t.x);return n},i.MulMV=function(t,n){void 0===n&&o("undefined 'v' in b2Math.MulMV");var i=new e(t.col1.x*n.x+t.col2.x*n.y,t.col1.y*n.x+t.col2.y*n.y);return i},i.MulTMV=function(o,t){var n=new e(i.Dot(t,o.col1),i.Dot(t,o.col2));return n},i.MulX=function(o,e){var t=i.MulMV(o.R,e);return t.x+=o.position.x,t.y+=o.position.y,t},i.MulXT=function(o,e){var t=i.SubtractVV(e,o.position),n=t.x*o.R.col1.x+t.y*o.R.col1.y;return t.y=t.x*o.R.col2.x+t.y*o.R.col2.y,t.x=n,t},i.AddVV=function(o,t){var n=new e(o.x+t.x,o.y+t.y);return n},i.SubtractVV=function(o,t){var n=new e(o.x-t.x,o.y-t.y);return n},i.Distance=function(o,e){var t=o.x-e.x,n=o.y-e.y;return Math.sqrt(t*t+n*n)},i.DistanceSquared=function(o,e){var t=o.x-e.x,n=o.y-e.y;return t*t+n*n},i.MulFV=function(o,t){void 0===o&&(o=0);var n=new e(o*t.x,o*t.y);return n},i.AddMM=function(o,e){var n=t.FromVV(i.AddVV(o.col1,e.col1),i.AddVV(o.col2,e.col2));return n},i.MulMM=function(o,e){var n=t.FromVV(i.MulMV(o,e.col1),i.MulMV(o,e.col2));return n},i.MulTMM=function(o,n){var a=new e(i.Dot(o.col1,n.col1),i.Dot(o.col2,n.col1)),r=new e(i.Dot(o.col1,n.col2),i.Dot(o.col2,n.col2)),c=t.FromVV(a,r);return c},i.Abs=function(o){return void 0===o&&(o=0),o>0?o:-o},i.AbsV=function(o){var t=new e(i.Abs(o.x),i.Abs(o.y));return t},i.AbsM=function(o){var e=t.FromVV(i.AbsV(o.col1),i.AbsV(o.col2));return e},i.Min=function(o,e){return void 0===o&&(o=0),void 0===e&&(e=0),e>o?o:e},i.MinV=function(o,t){var n=new e(i.Min(o.x,t.x),i.Min(o.y,t.y));return n},i.Max=function(o,e){return void 0===o&&(o=0),void 0===e&&(e=0),o>e?o:e},i.MaxV=function(o,t){var n=new e(i.Max(o.x,t.x),i.Max(o.y,t.y));return n},i.Clamp=function(o,e,t){return void 0===o&&(o=0),void 0===e&&(e=0),void 0===t&&(t=0),e>o?e:o>t?t:o},i.ClampV=function(o,e,t){return i.MaxV(e,i.MinV(o,t))},i.Swap=function(o,e){var t=o[0];o[0]=e[0],e[0]=t},i.Random=function(){return 2*Math.random()-1},i.RandomRange=function(o,e){void 0===o&&(o=0),void 0===e&&(e=0);var t=Math.random();return t=(e-o)*t+o},i.NextPowerOfTwo=function(o){return void 0===o&&(o=0),o|=o>>1&2147483647,o|=o>>2&1073741823,o|=o>>4&268435455,o|=o>>8&16777215,o|=o>>16&65535,o+1},i.IsPowerOfTwo=function(o){void 0===o&&(o=0);var e=o>0&&0===(o&o-1);return e},i.b2Vec2_zero=new e(0,0),i.b2Mat22_identity=t.FromVV(new e(1,0),new e(0,1)),i.b2Transform_identity=new n(i.b2Vec2_zero,i.b2Mat22_identity);var a=function(){this.e_aabbBit=4,this.e_centerOfMassBit=16,this.e_controllerBit=32,this.e_jointBit=2,this.e_pairBit=8,this.e_shapeBit=0};window.Box2D.Dynamics.b2DebugDraw=a,a.prototype.AppendFlags=function(){},a.prototype.ClearFlags=function(){},a.prototype.DrawCircle=function(){},a.prototype.DrawPolygon=function(){},a.prototype.DrawSegment=function(){},a.prototype.DrawSolidCircle=function(){},a.prototype.DrawSolidPolygon=function(){},a.prototype.DrawTransform=function(){},a.prototype.GetAlpha=function(){},a.prototype.GetDrawScale=function(){},a.prototype.GetFillAlpha=function(){},a.prototype.GetFlags=function(){},a.prototype.GetLineThickness=function(){},a.prototype.GetSprite=function(){},a.prototype.GetXFormScale=function(){},a.prototype.SetAlpha=function(){},a.prototype.SetDrawScale=function(){},a.prototype.SetFillAlpha=function(){},a.prototype.SetFlags=function(){},a.prototype.SetLineThickness=function(){},a.prototype.SetSprite=function(){},a.prototype.SetXFormScale=function(){};var r=function(){this.position=new e(0,0),this.linearVelocity=new e,this.userData=null,this.angle=0,this.linearVelocity.Set(0,0),this.angularVelocity=0,this.linearDamping=0,this.angularDamping=0,this.allowSleep=!0,this.awake=!0,this.fixedRotation=!1,this.bullet=!1,this.type=s.b2_staticBody,this.active=!0,this.inertiaScale=1};window.Box2D.Dynamics.b2BodyDef=r;var c=function(o,t,n,i){this.m_body=o,this.m_userData=t,this.m_fixtureID=n,this.m_shape={},this.m_shape.m_centroid=new e,this.m_isSensor=!1,this.m_density=i.density,this.m_friction=i.friction,this.m_restitution=i.restitution,this.m_isSensor=i.isSensor};window.Box2D.Dynamics.b2Fixture=c,c.prototype.GetBody=function(){return this.m_body},c.prototype.GetShape=function(){return console.log("fixture.GetShape not yet supported in CocoonJS Box2D binding"),null},c.prototype.GetUserData=function(){return this.m_userData},c.prototype.SetSensor=function(o){this.m_isSensor=o,window.ext.IDTK_SRV_BOX2D.makeCall("setSensor",this.m_body.m_world.m_worldID,this.m_fixtureID,this.m_isSensor)},c.prototype.IsSensor=function(){return this.m_isSensor},c.prototype.SetDensity=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setDensity",this.m_body.m_world.m_worldID,this.m_fixtureID,o),this.m_density=o},c.prototype.SetFriction=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setFriction",this.m_body.m_world.m_worldID,this.m_fixtureID,o),this.m_friction=o},c.prototype.SetRestitution=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setRestitution",this.m_body.m_world.m_worldID,this.m_fixtureID,o),this.m_restitution=o},c.prototype.GetDensity=function(){return this.m_density},c.prototype.GetFriction=function(){return this.m_friction},c.prototype.GetRestitution=function(){return this.m_restitution};var s=function(o,e){var i=o.userData;o.userData=null,this.m_world=e,this.m_xf=new n(o.position,t.FromAngle(o.angle)),this.m_fixtures=[],this.m_active=o.active,o.type===s.b2_staticBody&&(o.density=0),this.m_bodyID=window.ext.IDTK_SRV_BOX2D.makeCall("createBody",e.m_worldID,o),this.m_userData=i,o.userData=i};window.Box2D.Dynamics.b2Body=s,s.prototype.CreateFixture=function(o){var e=o.userData;o.userData=null;var t=window.ext.IDTK_SRV_BOX2D.makeCall("createFixture",this.m_world.m_worldID,this.m_bodyID,o);o.userData=e;var n=new c(this,e,t,o);return this.m_world.m_fixturesList[t]=n,this.m_fixtures.push(n),n},s.prototype.GetFixtureList=function(){return 0===this.m_fixtures.length?null:this.m_fixtures[0]},s.prototype.DestroyFixture=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("deleteFixture",this.m_world.m_worldID,o.m_fixtureID),delete this.m_world.m_fixturesList[o.m_fixtureID]},s.prototype.SetPositionAndAngle=function(o,e){window.ext.IDTK_SRV_BOX2D.makeCall("setBodyTransform",this.m_world.m_worldID,this.m_bodyID,o.x,o.y,e),this.m_xf.R.Set(e),this.m_xf.position.SetV(o)},s.prototype.GetPosition=function(){return this.m_xf.position},s.prototype.SetPosition=function(o){this.SetPositionAndAngle(o,this.GetAngle())},s.prototype.GetLinearVelocity=function(){var o=window.ext.IDTK_SRV_BOX2D.makeCall("getLinearVelocity",this.m_world.m_worldID,this.m_bodyID);return new e(o[0],o[1])},s.prototype.GetWorldCenter=function(){var o=window.ext.IDTK_SRV_BOX2D.makeCall("getWorldCenter",this.m_world.m_worldID,this.m_bodyID);return new e(o[0],o[1])},s.prototype.GetLocalCenter=function(){var o=window.ext.IDTK_SRV_BOX2D.makeCall("getLocalCenter",this.m_world.m_worldID,this.m_bodyID);return new e(o[0],o[1])},s.prototype.GetLocalPoint=function(o){return i.MulXT(this.m_xf,o)},s.prototype.ApplyImpulse=function(o,e,t){window.ext.IDTK_SRV_BOX2D.makeCall("applyImpulse",this.m_world.m_worldID,this.m_bodyID,o.x,o.y,e.x,e.y,t)},s.prototype.GetMass=function(){return window.ext.IDTK_SRV_BOX2D.makeCall("getMass",this.m_world.m_worldID,this.m_bodyID)},s.prototype.IsAwake=function(){return window.ext.IDTK_SRV_BOX2D.makeCall("isAwake",this.m_world.m_worldID,this.m_bodyID)},s.prototype.GetAngularVelocity=function(){return window.ext.IDTK_SRV_BOX2D.makeCall("getAngularVelocity",this.m_world.m_worldID,this.m_bodyID)},s.prototype.SetFixedRotation=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setFixedRotation",this.m_world.m_worldID,this.m_bodyID,o)},s.prototype.SetAwake=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setAwake",this.m_world.m_worldID,this.m_bodyID,o)},s.prototype.SetLinearVelocity=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setLinearVelocity",this.m_world.m_worldID,this.m_bodyID,o.x,o.y)},s.prototype.ApplyForceToCenter=function(o,e){window.ext.IDTK_SRV_BOX2D.makeCall("applyForceToCenter",this.m_world.m_worldID,this.m_bodyID,o.x,o.y,e)},s.prototype.ApplyForce=function(o,e,t){window.ext.IDTK_SRV_BOX2D.makeCall("applyForce",this.m_world.m_worldID,this.m_bodyID,o.x,o.y,e.x,e.y,t)},s.prototype.ApplyTorque=function(o,e){window.ext.IDTK_SRV_BOX2D.makeCall("applyTorque",this.m_world.m_worldID,this.m_bodyID,o,e)},s.prototype.SetLinearDamping=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setLinearDamping",this.m_world.m_worldID,this.m_bodyID,o)},s.prototype.SetAngularVelocity=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setAngularVelocity",this.m_world.m_worldID,this.m_bodyID,o)},s.prototype.SetType=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setType",this.m_world.m_worldID,this.m_bodyID,o)},s.prototype.SetActive=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setActive",this.m_world.m_worldID,this.m_bodyID,o),this.m_active=o},s.prototype.IsActive=function(){return this.m_active},s.prototype.GetAngle=function(){return this.m_xf.R.GetAngle()},s.prototype.SetAngle=function(o){void 0===o&&(o=0),this.SetPositionAndAngle(this.GetPosition(),o)},s.prototype.GetContactList=function(){for(var o=window.ext.IDTK_SRV_BOX2D.makeCall("getObjectContacts",this.m_world.m_worldID,this.m_bodyID),e=[],t=0;t<o.length;t++)e.push(this.m_world.m_bodyList[o[t]]);return e},s.prototype.SetUserData=function(o){this.m_userData=o},s.prototype.GetUserData=function(){return this.m_userData},s.prototype.GetWorld=function(){return this.m_world},window.Box2D.Dynamics.b2Body.b2_staticBody=0,window.Box2D.Dynamics.b2Body.b2_kinematicBody=1,window.Box2D.Dynamics.b2Body.b2_dynamicBody=2;var l=function(o,e,t){this.m_fixtureA=o,this.m_fixtureB=e,this.m_touching=t};window.Box2D.Dynamics.b2Contact=l,l.prototype.GetFixtureA=function(){return this.m_fixtureA},l.prototype.GetFixtureB=function(){return this.m_fixtureB},l.prototype.IsTouching=function(){return this.m_touching};var d=function(){};window.Box2D.Dynamics.b2ContactListener=d,d.prototype.BeginContact=function(){},d.prototype.EndContact=function(){},d.prototype.PreSolve=function(){},d.prototype.PostSolve=function(){},window.Box2D.Dynamics.b2ContactListener.b2_defaultListener=new d;var p=function(){};window.Box2D.Dynamics.b2ContactFilter=p;var u=function(o,e){this.m_bodyList=[],this.m_jointList=[],this.m_fixturesList=[],this.m_contactListener=null,this.m_jointsList=[],this.m_worldID=window.ext.IDTK_SRV_BOX2D.makeCall("createWorld",o.x,o.y,e)};window.Box2D.Dynamics.b2World=u,u.prototype.SetContactListener=function(o){this.m_contactListener=o},u.prototype.SetContactFilter=function(o){var e=o,t=this,n=function(o,n){var i=t.m_fixturesList[o],a=t.m_fixturesList[n];return e.ShouldCollide(i,a)};window.ext.IDTK_SRV_BOX2D.makeCall("setContactFilter",this.m_worldID,n)},u.prototype.CreateBody=function(o){var e=new s(o,this);return this.m_bodyList[e.m_bodyID]=e,e},u.prototype.DestroyBody=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("deleteBody",this.m_worldID,o.m_bodyID),delete this.m_bodyList[o.m_bodyID];for(var e=0;e<o.m_fixtures.length;++e)delete this.m_fixturesList[o.m_fixtures[e].m_fixtureID]},u.prototype.CreateJoint=function(o){if(o.bodyA.m_bodyID!==o.bodyB.m_bodyID){var e=o.bodyA,t=o.bodyB;o.bodyA=e.m_bodyID,o.bodyB=t.m_bodyID;var n="createDistanceJoint";o.type===f.e_revoluteJoint&&(n="createRevoluteJoint");var i=new f(o);return i.m_jointID=window.ext.IDTK_SRV_BOX2D.makeCall(n,this.m_worldID,o),o.bodyA=e,o.bodyB=t,this.m_jointsList.push(i),i}},u.prototype.DestroyJoint=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("destroyJoint",this.m_worldID,o.m_jointID)},u.prototype.GetJointList=function(){if(0===this.m_jointsList.length)return null;for(var o=0;o<this.m_jointsList.length-1;++o)this.m_jointsList[o].next=this.m_jointsList[o+1];return this.m_jointsList[this.m_jointsList.length-1].next=null,this.m_jointsList[0]},u.prototype.SetContinuousPhysics=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setContinuous",this.m_worldID,o)},u.prototype.SetGravity=function(o){window.ext.IDTK_SRV_BOX2D.makeCall("setGravity",this.m_worldID,o.x,o.y)},u.prototype.Step=function(o,e,t){var n,i=window.ext.IDTK_SRV_BOX2D.makeCall("step",this.m_worldID,o,e,t),a=i[0];for(n=1;4*a>=n;n+=4){var r=this.m_bodyList[i[n+0]];if(null===r)break;r.m_xf.position.Set(i[n+1],i[n+2]),r.m_xf.R.Set(i[n+3])}if(null!==this.m_contactListener){var c=window.ext.IDTK_SRV_BOX2D.makeCall("getLastContacts",this.m_worldID);for(a=c[0],n=1;3*a>=n;n+=3){var s=c[n+0],d=c[n+1],p=c[n+2],u=this.m_fixturesList[s],y=this.m_fixturesList[d];"undefined"!=typeof u&&"undefined"!=typeof y?this.m_contactListener.BeginContact(new l(u,y,p)):console.log("One of the fixtures in a contact DOESN'T EXIST!!")}}},u.prototype.ClearForces=function(){window.ext.IDTK_SRV_BOX2D.makeCall("clearForces",this.m_worldID)},u.prototype.SetDebugDraw=function(){},u.prototype.DrawDebugData=function(){},window.Box2D.Collision.Shapes.b2CircleShape=function(o){this.radius=o,this.type="circle"},window.Box2D.Collision.Shapes.b2PolygonShape=function(){this.SetAsBox=function(o,e){this.type="box",this.width=o,this.height=e},this.SetAsEdge=function(o,e){this.type="edge",this.p1x=o.x,this.p1y=o.y,this.p2x=e.x,this.p2y=e.y},this.SetAsArray=function(o,e){this.type="polygon",this.vertices=[];for(var t=0;e>t;t++)this.vertices.push(o[t].x),this.vertices.push(o[t].y)}};var y=function(){this.shape=null,this.userData=null,this.friction=.2,this.restitution=0,this.density=0,this.isSensor=!1,this.filter={categoryBits:1,maskBits:65535,groupIndex:0}};window.Box2D.Dynamics.b2FixtureDef=y;var f=function(o){this.bodyA=o.bodyA,this.bodyB=o.bodyB,this.userData=o.userData,this.type=o.type,this.next=null};window.Box2D.Dynamics.Joints.b2Joint=f,f.prototype.GetBodyA=function(){return this.bodyA},f.prototype.GetBodyB=function(){return this.bodyB},f.prototype.GetUserData=function(){return this.userData},f.prototype.GetType=function(){return this.type},f.prototype.GetNext=function(){return this.next},f.e_distanceJoint=0,f.e_revoluteJoint=1;var v=function(o,t,n,i){if(this.type=f.e_distanceJoint,this.localAnchorA=new e,this.localAnchorB=new e,this.userData=null,void 0!==o&&(this.bodyA=o),void 0!==t&&(this.bodyB=t),void 0!==n&&this.localAnchorA.SetV(n),void 0!==i&&this.localAnchorB.SetV(i),void 0!==n&&void 0!==i){var a=i.x-n.x,r=i.y-n.y;this.length=Math.sqrt(a*a+r*r)}this.frequencyHz=0,this.dampingRatio=0};window.Box2D.Dynamics.Joints.b2DistanceJointDef=v;var h=function(o,t,n,i){this.type=f.e_revoluteJoint,this.localAnchorA=new e,this.localAnchorB=new e,this.userData=null,void 0!==o&&(this.bodyA=o),void 0!==t&&(this.bodyB=t),void 0!==n&&this.localAnchorA.SetV(n),void 0!==i&&this.localAnchorB.SetV(i),this.referenceAngle=0,this.lowerAngle=0,this.upperAngle=0,this.maxMotorTorque=0,this.motorSpeed=0,this.enableLimit=!1,this.enableMotor=!1};h.prototype.Initialize=function(o,e,t){this.bodyA=o,this.bodyB=e,this.localAnchorA=this.bodyA.GetLocalPoint(t),this.localAnchorB=this.bodyB.GetLocalPoint(t),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},window.Box2D.Dynamics.Joints.b2RevoluteJointDef=h}()):console.log("The CocoonJS binding for Box2D has been ignored because ext.IDTK_SRV_BOX2D is not available"),Cocoon.define("Cocoon.Device",function(o){"use strict";return o.DeviceInfo={os:null,version:null,dpi:null,brand:null,model:null,imei:null,platformId:null,odin:null,openudid:null},o.getDeviceId=function(){return Cocoon.nativeAvailable?window.ext.IDTK_APP.makeCall("getDeviceId"):void 0},o.getDeviceInfo=function(){return Cocoon.nativeAvailable?window.ext.IDTK_APP.makeCall("getDeviceInfo"):void 0},o.getOrientation=function(){return Cocoon.nativeAvailable?window.ext.IDTK_APP.makeCall("getPreferredOrientation"):0},o.setOrientation=function(o){Cocoon.nativeAvailable&&window.ext.IDTK_APP.makeCall("setPreferredOrientation",o)},o.Orientations={PORTRAIT:1,PORTRAIT_UPSIDE_DOWN:2,LANDSCAPE_LEFT:4,LANDSCAPE_RIGHT:8,LANDSCAPE:12,BOTH:15},o.autoLock=function(o){return Cocoon.nativeAvailable?Cocoon.callNative("IDTK_APP","setAutoLockEnabled",arguments):void 0},o}),Cocoon.define("Cocoon.Dialog",function(o){"use strict";return o.keyboardType={TEXT:"text",NUMBER:"num",PHONE:"phone",EMAIL:"email",URL:"url"},o.prompt=function(o,e){if(!e)throw"Callback missing for Cocoon.Dialog.prompt();";var t=Cocoon.Dialog.keyboardType.TEXT;switch(o.type){case Cocoon.Dialog.keyboardType.TEXT:t=Cocoon.Dialog.keyboardType.TEXT;break;case Cocoon.Dialog.keyboardType.NUMBER:t=Cocoon.Dialog.keyboardType.NUMBER;break;case Cocoon.Dialog.keyboardType.PHONE:t=Cocoon.Dialog.keyboardType.PHONE;break;case Cocoon.Dialog.keyboardType.EMAIL:t=Cocoon.Dialog.keyboardType.EMAIL;break;case Cocoon.Dialog.keyboardType.URL:t=Cocoon.Dialog.keyboardType.URL}var n={title:"",message:"",text:"",type:t,cancelText:"Cancel",confirmText:"Ok",secureText:!1},i=Cocoon.clone(n,o),a=function(){Cocoon.Dialog.onTextDialogCancelled.removeEventListener(r),Cocoon.Dialog.onTextDialogFinished.removeEventListener(a),e.success.apply(window,Array.prototype.slice.call(arguments))},r=function(){Cocoon.Dialog.onTextDialogCancelled.removeEventListener(r),Cocoon.Dialog.onTextDialogFinished.removeEventListener(a),e.cancel.apply(window,Array.prototype.slice.call(arguments))};return Cocoon.Dialog.onTextDialogCancelled.addEventListener(r),Cocoon.Dialog.onTextDialogFinished.addEventListener(a),Cocoon.App.nativeAvailable?Cocoon.callNative("IDTK_APP","showTextDialog",i,!0):void setTimeout(function(){var o=prompt(n.message,n.text),e=o?Cocoon.Dialog.onTextDialogFinished:Cocoon.Dialog.onTextDialogCancelled;e.notifyEventListeners(o)},0)},o.confirm=function(o,e){if(!e)throw"Callback missing for Cocoon.Dialog.confirm();";var t={title:"",message:"",cancelText:"Cancel",confirmText:"Ok"},n=Cocoon.clone(t,o),i=function(){Cocoon.Dialog.onMessageBoxDenied.removeEventListenerOnce(a),e(!0)},a=function(){Cocoon.Dialog.onMessageBoxConfirmed.removeEventListenerOnce(i),e(!1)};return Cocoon.Dialog.onMessageBoxDenied.addEventListenerOnce(a),Cocoon.Dialog.onMessageBoxConfirmed.addEventListenerOnce(i),Cocoon.nativeAvailable?Cocoon.callNative("IDTK_APP","showMessageBox",n,!0):void setTimeout(function(){var o=confirm(t.message),e=o?Cocoon.Dialog.onMessageBoxConfirmed:Cocoon.Dialog.onMessageBoxDenied;e.notifyEventListeners()},0)},o.showKeyboard=function(o,e){o=o||{},o.type=o.type||Cocoon.Dialog.keyboardType.TEXT;var t=e&&e.insertText,n=e&&e.deleteBackward,i=e&&e.done,a=e&&e.cancel;Cocoon.nativeAvailable&&Cocoon.callNative("IDTK_APP","showKeyboard",[o,t,n,i,a],!0)},o.dismissKeyboard=function(){Cocoon.nativeAvailable&&Cocoon.callNative("IDTK_APP","dismissKeyboard",[],!0)},o.onTextDialogFinished=new Cocoon.EventHandler("IDTK_APP","App","ontextdialogfinish"),o.onTextDialogCancelled=new Cocoon.EventHandler("IDTK_APP","App","ontextdialogcancel"),o.onMessageBoxConfirmed=new Cocoon.EventHandler("IDTK_APP","App","onmessageboxconfirmed"),o.onMessageBoxDenied=new Cocoon.EventHandler("IDTK_APP","App","onmessageboxdenied"),o}),Cocoon.define("Cocoon.Motion",function(o){"use strict";return o.nativeAvailable=Cocoon.nativeAvailable,o.setAccelerometerInterval=function(o){return Cocoon.Motion.nativeAvailable?window.ext.IDTK_APP.makeCall("setAccelerometerUpdateIntervalInSeconds",o):void 0},o.getAccelerometerInterval=function(){return Cocoon.Motion.nativeAvailable?window.ext.IDTK_APP.makeCall("getAccelerometerUpdateIntervalInSeconds"):void 0},o.setGyroscopeInterval=function(o){return Cocoon.Motion.nativeAvailable?window.ext.IDTK_APP.makeCall("setGyroscopeUpdateIntervalInSeconds",o):void 0},o.getGyroscopeInterval=function(){Cocoon.Motion.nativeAvailable&&window.ext.IDTK_APP.makeCall("getGyroscopeUpdateIntervalInSeconds")},o}),Cocoon.define("Cocoon.App",function(o){function e(){var o=Cocoon.App.EmulatedWebView;if(!o){o=document.createElement("div"),o.setAttribute("id","CocoonJS_App_ForCocoonJS_WebViewDiv"),o.style.width=0,o.style.height=0,o.style.position="absolute",o.style.left=0,o.style.top=0,o.style.backgroundColor="transparent",o.style.border="0px solid #000";var e=document.createElement("IFRAME");e.setAttribute("id","CocoonJS_App_ForCocoonJS_WebViewIFrame"),e.setAttribute("name","CocoonJS_App_ForCocoonJS_WebViewIFrame"),e.style.width=0,e.style.height=0,e.frameBorder=0,e.allowtransparency=!0,o.appendChild(e),Cocoon.App.EmulatedWebView=o,Cocoon.App.EmulatedWebViewIFrame=e,document.body||(document.body=document.createElement("body")),document.body.appendChild(Cocoon.App.EmulatedWebView)}}o.pause=function(){return Cocoon.App.nativeAvailable?Cocoon.callNative("IDTK_APP","pause",arguments):void 0},o.resume=function(){return Cocoon.App.nativeAvailable?Cocoon.callNative("IDTK_APP","resume",arguments):void 0},o.loadInTheWebView=function(o,t){if(navigator.isCocoonJS&&Cocoon.App.nativeAvailable)Cocoon.callNative("IDTK_APP","loadInTheWebView",arguments);else{var n=new XMLHttpRequest;n.onreadystatechange=function(t){if(4===n.readyState)if(n.status>=200&&n.status<=299||0===n.status){e();var i=function(e){Cocoon.App.onLoadInTheWebViewSucceed.notifyEventListeners(o),Cocoon.App.EmulatedWebViewIFrame.removeEventListener("load",i)};Cocoon.App.EmulatedWebViewIFrame.addEventListener("load",i),Cocoon.App.EmulatedWebViewIFrame.contentWindow.location.href=o}else this.onreadystatechange=null,Cocoon.App.onLoadInTheWebViewFailed.notifyEventListeners(o)},n.open("GET",o,!0),n.send()}},o.reloadWebView=function(){Cocoon.App.nativeAvailable&&navigator.isCocoonJS?Cocoon.callNative("IDTK_APP","reloadWebView",arguments):(e(),Cocoon.App.EmulatedWebViewIFrame.contentWindow.location.reload())},o.showTheWebView=function(o,t,n,i){Cocoon.App.nativeAvailable&&navigator.isCocoonJS?Cocoon.callNative("IDTK_APP","showTheWebView",arguments):(e(),Cocoon.App.EmulatedWebViewIFrame.style.width=(n?n/window.devicePixelRatio:window.innerWidth)+"px",Cocoon.App.EmulatedWebViewIFrame.style.height=(i?i/window.devicePixelRatio:window.innerHeight)+"px",
  Cocoon.App.EmulatedWebView.style.left=(o?o:0)+"px",Cocoon.App.EmulatedWebView.style.top=(t?t:0)+"px",Cocoon.App.EmulatedWebView.style.width=(n?n/window.devicePixelRatio:window.innerWidth)+"px",Cocoon.App.EmulatedWebView.style.height=(i?i/window.devicePixelRatio:window.innerHeight)+"px",Cocoon.App.EmulatedWebView.style.display="block")},o.hideTheWebView=function(){if(Cocoon.App.nativeAvailable&&navigator.isCocoonJS){var o="ext.IDTK_APP.makeCall('hide');";return Cocoon.App.forwardAsync(o)}e(),Cocoon.App.EmulatedWebView.style.display="none"},o.exitCallback=function(o){navigator.isCocoonJS&&Cocoon.App.nativeAvailable&&(window.onidtkappfinish=o)},o.forwardedEventFromTheWebView=function(o,e){var t=JSON.parse(e);t.target=window;var n=new Event(o);for(var i in t)n[i]=t[i];n.target=window,window.dispatchEvent(n);for(var a=document.getElementsByTagName("canvas"),r=0;r<a.length;r++)n.target=a[r],a[r].dispatchEvent(n)},o.onLoadInTheWebViewSucceed=new Cocoon.EventHandler("IDTK_APP","App","forwardpageload"),o.onLoadInTheWebViewFailed=new Cocoon.EventHandler("IDTK_APP","App","forwardpagefail");var t=new Cocoon.createSignal;return t.register("load",{success:o.onLoadInTheWebViewSucceed,error:o.onLoadInTheWebViewFailed}),o.WebView=Cocoon.WebView||{},o.WebView.on=t.expose(),o}),Cocoon.define("Cocoon.Proxify",function(o){"use strict";return o.getKeyForValueInDictionary=function(o,e){var t=null;for(var n in o)if(o[n]===e){t=n;break}return t},o.setupOriginProxyType=function(e,t,n,i){if(Cocoon.nativeAvailable){if(!e)throw"The given typeName must be valid.";if(!t&&!n&&!i)throw"There is no point on setting up a proxy for no attributes, functions nor eventHandlers.";t=t?t:[],n=n?n:[],i=i?i:[];var a=window,r="Cocoon.Proxify.setupDestinationProxyType("+JSON.stringify(e)+", "+JSON.stringify(i)+");";Cocoon.App.forward(r);var c=a[e];a[e]=function(){var o=this;this._cocoonjs_proxy_object_data={};var r="Cocoon.Proxify.newDestinationProxyObject("+JSON.stringify(e)+");";this._cocoonjs_proxy_object_data.id=Cocoon.App.forward(r),this._cocoonjs_proxy_object_data.eventHandlers={},this._cocoonjs_proxy_object_data.typeName=e,this._cocoonjs_proxy_object_data.eventListeners={},a[e]._cocoonjs_proxy_type_data.proxyObjects[this._cocoonjs_proxy_object_data.id]=this;for(var c=0;c<t.length;c++)!function(t){o.__defineSetter__(t,function(n){var i="Cocoon.Proxify.setDestinationProxyObjectAttribute("+JSON.stringify(e)+", "+o._cocoonjs_proxy_object_data.id+", "+JSON.stringify(t)+", "+JSON.stringify(n)+");";return Cocoon.App.forward(i)}),o.__defineGetter__(t,function(){var n="Cocoon.Proxify.getDestinationProxyObjectAttribute("+JSON.stringify(e)+", "+o._cocoonjs_proxy_object_data.id+", "+JSON.stringify(t)+");";return Cocoon.App.forward(n)})}(t[c]);for(c=0;c<n.length;c++)!function(t){o[t]=function(){var o=Array.prototype.slice.call(arguments);o.unshift(t),o.unshift(this._cocoonjs_proxy_object_data.id),o.unshift(e);for(var n="Cocoon.Proxify.callDestinationProxyObjectFunction(",i=0;i<o.length;i++)n+=(1!==i?JSON.stringify(o[i]):o[i])+(i<o.length-1?", ":"");n+=");";var a=Cocoon.App.forwardAsync(n);return a}}(n[c]);for(c=0;c<i.length;c++)!function(e){o.__defineSetter__(e,function(t){o._cocoonjs_proxy_object_data.eventHandlers[e]=t}),o.__defineGetter__(e,function(){return o._cocoonjs_proxy_object_data.eventHandlers[e]})}(i[c]);return o.addEventListener=function(e,t){var n=!0,i=o._cocoonjs_proxy_object_data.eventListeners[e];if(i)n=i.indexOf(t)<0;else{i=[],o._cocoonjs_proxy_object_data.eventListeners[e]=i;var a="Cocoon.Proxify.addDestinationProxyObjectEventListener("+JSON.stringify(o._cocoonjs_proxy_object_data.typeName)+", "+o._cocoonjs_proxy_object_data.id+", "+JSON.stringify(e)+");";Cocoon.App.forwardAsync(a)}n&&i.push(t)},o.removeEventListener=function(e,t){var n=o._cocoonjs_proxy_object_data.eventListeners[e];if(n){var i=n.indexOf(t);i>=0&&n.splice(i,1)}},this},a[e]._cocoonjs_proxy_type_data={originalType:c,proxyObjects:[]},a[e]._cocoonjs_proxy_type_data.deleteProxyObject=function(t){var n=o.getKeyForValueInDictionary(this.proxyObjects,t);if(n){var i="Cocoon.Proxify.deleteDestinationProxyObject("+JSON.stringify(e)+", "+t._cocoonjs_proxy_object_data.id+");";Cocoon.App.forwardAsync(i),t._cocoonjs_proxy_object_data=null,delete this.proxyObjects[n]}},a[e]._cocoonjs_proxy_type_data.callProxyObjectEventHandler=function(o,e){var t=this.proxyObjects[o],n=t._cocoonjs_proxy_object_data.eventHandlers[e];n&&n({target:t})},a[e]._cocoonjs_proxy_type_data.callProxyObjectEventListeners=function(o,e){for(var t=this.proxyObjects[o],n=t._cocoonjs_proxy_object_data.eventListeners[e].slice(),i=0;i<n.length;i++)n[i]({target:t})}}},o.takedownOriginProxyType=function(o){if(Cocoon.App.nativeAvailable){var e=window;e[o]&&e[o]._cocoonjs_proxy_type_data&&(e[o]=e[o]._cocoonjs_proxy_type_data.originalType)}},o.deleteOriginProxyObject=function(o){if(Cocoon.App.nativeAvailable){var e=window;o&&o._cocoonjs_proxy_object_data&&e[o._cocoonjs_proxy_object_data.typeName]._cocoonjs_proxy_type_data.deleteProxyObject(o)}},o.callOriginProxyObjectEventHandler=function(o,e,t){if(Cocoon.App.nativeAvailable){var n=window;n[o]._cocoonjs_proxy_type_data.callProxyObjectEventHandler(e,t)}},o.callOriginProxyObjectEventListeners=function(o,e,t){if(Cocoon.App.nativeAvailable){var n=window;n[o]._cocoonjs_proxy_type_data.callProxyObjectEventListeners(e,t)}},o.setupDestinationProxyType=function(o,e){if(Cocoon.App.nativeAvailable){var t=window;t[o]._cocoonjs_proxy_type_data={nextId:0,proxyObjects:{},eventHandlerNames:e}}},o.takedownDestinationProxyType=function(o){if(Cocoon.App.nativeAvailable){var e=window;parent[o]&&e[o]._cocoonjs_proxy_type_data&&delete e[o]._cocoonjs_proxy_type_data}},o.newDestinationProxyObject=function(o){if(Cocoon.App.nativeAvailable){var e=window,t=new e[o];t._cocoonjs_proxy_object_data={},t._cocoonjs_proxy_object_data.typeName=o;var n=e[o]._cocoonjs_proxy_type_data.nextId;e[o]._cocoonjs_proxy_type_data.proxyObjects[n]=t,t._cocoonjs_proxy_object_data.id=n,e[o]._cocoonjs_proxy_type_data.nextId++;for(var i=0;i<e[o]._cocoonjs_proxy_type_data.eventHandlerNames.length;i++)!function(o){t[o]=function(e){var t=this,n="Cocoon.App.callOriginProxyObjectEventHandler("+JSON.stringify(t._cocoonjs_proxy_object_data.typeName)+", "+t._cocoonjs_proxy_object_data.id+", "+JSON.stringify(o)+");";Cocoon.App.forwardAsync(n)}}(e[o]._cocoonjs_proxy_type_data.eventHandlerNames[i]);return t._cocoonjs_proxy_object_data.eventListeners={},n}},o.callDestinationProxyObjectFunction=function(o,e,t){if(Cocoon.App.nativeAvailable){var n=window,i=Array.prototype.slice.call(arguments);i.splice(0,3);var a=n[o]._cocoonjs_proxy_type_data.proxyObjects[e],r=a[t].apply(a,i);return r}},o.setDestinationProxyObjectAttribute=function(o,e,t,n){if(Cocoon.App.nativeAvailable){var i=window,a=i[o]._cocoonjs_proxy_type_data.proxyObjects[e];a[t]=n}},o.getDestinationProxyObjectAttribute=function(o,e,t){if(Cocoon.App.nativeAvailable){var n=window,i=n[o]._cocoonjs_proxy_type_data.proxyObjects[e];return i[t]}},o.deleteDestinationProxyObject=function(o,e){if(Cocoon.App.nativeAvailable){var t=window;delete t[o]._cocoonjs_proxy_type_data.proxyObjects[e]}},o.addDestinationProxyObjectEventListener=function(o,e,t){if(Cocoon.App.nativeAvailable){var n=window,i=n[o]._cocoonjs_proxy_type_data.proxyObjects[e],a=function(o){var e=this,n="Cocoon.Proxify.callOriginProxyObjectEventListeners("+JSON.stringify(e._cocoonjs_proxy_object_data.typeName)+", "+e._cocoonjs_proxy_object_data.id+", "+JSON.stringify(t)+");";Cocoon.App.forwardAsync(n)};i._cocoonjs_proxy_object_data.eventListeners[t]=a,i.addEventListener(t,a)}},o.xhr=function(){var o=["timeout","withCredentials","upload","status","statusText","responseType","response","responseText","responseXML","readyState"],e=["open","setRequestHeader","send","abort","getResponseHeader","getAllResponseHeaders","overrideMimeType"],t=["onloadstart","onprogress","onabort","onerror","onload","ontimeout","onloadend","onreadystatechange"];Cocoon.Proxify.setupOriginProxyType("XMLHttpRequest",o,e,t)},o.audio=function(){var o=["src","loop","volume","preload"],e=["play","pause","load","canPlayType"],t=["onended","oncanplay","oncanplaythrough","onerror"];Cocoon.Proxify.setupOriginProxyType("Audio",o,e,t)},o.console=function(){if(Cocoon.nativeAvailable){"undefined"==typeof Cocoon.originalConsole&&(Cocoon.originalConsole=window.console);for(var o=["log","error","info","debug","warn"],e={},t=0;t<o.length;t++)e[o[t]]=function(o){return function(o){try{var e="Proxified log: "+JSON.stringify(o);Cocoon.originalConsole.log(e),ext.IDTK_APP.makeCallAsync("forward",e)}catch(t){console.log("Proxified log: "+t)}}}(o[t]);e.assert||(e.assert=function(){if(arguments.length>0&&!arguments[0]){var o="Assertion failed: "+(arguments.length>1?arguments[1]:"");e.error(o)}}),window.console=e}},o.deproxifyConsole=function(){!window.navigator.isCocoonJS&&Cocoon.nativeAvailable&&"undefined"!=typeof Cocoon.originalConsole&&(window.console=Cocoon.originalConsole,Cocoon.originalConsole=void 0)},o}),Cocoon.define("Cocoon.Touch",function(o){return o.addADivToDisableInput=function(){var o=document.createElement("div");o.id="CocoonJSInputBlockingDiv",o.style.left=0,o.style.top=0,o.style.width="100%",o.style.height="100%",o.style.position="absolute",o.style.backgroundColor="transparent",o.style.border="0px solid #000",o.style.zIndex=999999999,document.body.appendChild(o)},o.removeTheDivToEnableInput=function(){var o=document.getElementById("CocoonJSInputBlockingDiv");o&&document.body.removeChild(o)},o.disable=function(){Cocoon.nativeAvailable?window.ext.IDTK_APP.makeCall("disableTouchLayer","CocoonJSView"):navigator.isCocoonJS||Cocoon.App.EmulatedWebViewIFrame||(Cocoon.App.forwardEventsToCocoonJSEnabled=!1,Cocoon.App.forwardAsync("Cocoon && Cocoon.Touch && Cocoon.Touch.disable();"))},o.enable=function(){Cocoon.nativeAvailable?window.ext.IDTK_APP.makeCall("enableTouchLayer","CocoonJSView"):navigator.isCocoonJS||Cocoon.App.EmulatedWebViewIFrame||(Cocoon.App.forwardEventsToCocoonJSEnabled=!0,Cocoon.App.forwardAsync("Cocoon && Cocoon.Touch && Cocoon.Touch.enable();"))},o.disableInWebView=function(){Cocoon.nativeAvailable?window.ext.IDTK_APP.makeCall("disableTouchLayer","WebView"):navigator.isCocoonJS||(Cocoon.App.EmulatedWebViewIFrame?Cocoon.App.forwardAsync("Cocoon && Cocoon.Touch && Cocoon.Touch.disableInWebView();"):Cocoon.Touch.addADivToDisableInput())},o.enableInWebView=function(){Cocoon.nativeAvailable?window.ext.IDTK_APP.makeCall("enableTouchLayer","WebView"):navigator.isCocoonJS||(Cocoon.App.EmulatedWebViewIFrame?Cocoon.Touch.forwardAsync("Cocoon && Cocoon.Touch && Cocoon.Touch.enableInWebView();"):Cocoon.Touch.removeTheDivToEnableInput())},o}),Cocoon.define("Cocoon.Utils",function(o){"use strict";return o.logMemoryInfo=function(){return Cocoon.nativeAvailable&&navigator.isCocoonJS?Cocoon.callNative("IDTK_APP","logMemoryInfo",arguments):void 0},o.textureReduction=function(o,e,t){return Cocoon.nativeAvailable&&navigator.isCocoonJS?Cocoon.callNative("IDTK_APP","setDefaultTextureReducerThreshold",arguments):void 0},o.markAsMusic=function(o){return Cocoon.nativeAvailable?Cocoon.callNative("IDTK_APP","addForceMusic",arguments):void 0},o.captureScreen=function(o,e,t,n){return Cocoon.nativeAvailable?Cocoon.callNative("IDTK_APP","captureScreen",arguments):void 0},o.captureScreenAsync=function(o,e,t,n,i){Cocoon.nativeAvailable&&Cocoon.callNative("IDTK_APP","captureScreen",arguments,!0)},o.setAntialias=function(o){return Cocoon.nativeAvailable&&navigator.isCocoonJS?Cocoon.callNative("IDTK_APP","setDefaultAntialias",arguments):void 0},o.setWebGLEnabled=function(o){return Cocoon.nativeAvailable?Cocoon.callNative("IDTK_APP","setDefaultAntialias",arguments):void 0},o.setNPOTEnabled=function(o){return Cocoon.nativeAvailable&&navigator.isCocoonJS?window.ext.IDTK_APP.makeCall("setNPOTEnabled",o):void 0},o.setMaxMemory=function(o){return Cocoon.nativeAvailable&&navigator.isCocoonJS?window.ext.IDTK_APP.makeCall("setMaxMemory",o):void 0},o.CaptureType={EVERYTHING:0,COCOONJS_GL_SURFACE:1,JUST_SYSTEM_VIEWS:2},o.existsPath=function(o,e){return Cocoon.nativeAvailable?Cocoon.callNative("IDTK_APP","existsPath",arguments):!1},o.setTextCacheSize=function(o){return Cocoon.nativeAvailable&&navigator.isCocoonJS?Cocoon.callNative("IDTK_APP","setTextCacheSize",arguments):void 0},o}),Cocoon.define("Cocoon.WebView",function(o){return"undefined"==typeof Cocoon||null===Cocoon?o:"undefined"==typeof Cocoon.App||null===Cocoon.App?o:navigator.isCocoonJS?o:(o.show=function(o,e,t,n){if(Cocoon.App.nativeAvailable)return Cocoon.callNative("IDTK_APP","show",arguments);var i=window.parent.document.getElementById("CocoonJS_App_ForCocoonJS_WebViewDiv");i.style.left=(o?o:i.style.left)+"px",i.style.top=(e?e:i.style.top)+"px",i.style.width=(t?t/window.devicePixelRatio:window.parent.innerWidth)+"px",i.style.height=(n?n/window.devicePixelRatio:window.parent.innerHeight)+"px",i.style.display="block";var a=window.parent.document.getElementById("CocoonJS_App_ForCocoonJS_WebViewIFrame");a.style.width=(t?t/window.devicePixelRatio:window.parent.innerWidth)+"px",a.style.height=(n?n/window.devicePixelRatio:window.parent.innerHeight)+"px"},o.hide=function(){return Cocoon.App.nativeAvailable?Cocoon.callNative("IDTK_APP","hide",arguments):void(window.parent.document.getElementById("CocoonJS_App_ForCocoonJS_WebViewDiv").style.display="none")},o.loadInCocoon=function(o,e,t){if(Cocoon.App.nativeAvailable){var n="ext.IDTK_APP.makeCall('loadPath'";return"undefined"!=typeof o&&(n+=", '"+o+"'","undefined"!=typeof t&&(n+=", '"+t+"'")),n+=");",Cocoon.App.forwardAsync(n)}Cocoon.App.forwardAsync("Cocoon.App.load('"+o+"');")},o.reloadCocoonJS=function(){return Cocoon.App.nativeAvailable?Cocoon.App.forwardAsync("ext.IDTK_APP.makeCall('reload');"):void(navigator.isCocoonJS||window.parent.location.reload())},window.addEventListener("load",function(){if(!Cocoon.App.nativeAvailable&&"CocoonJS_App_ForCocoonJS_WebViewIFrame"==window.name){Cocoon.App.forwardEventsToCocoonJSEnabled=!1;for(var o=["timeStamp","button","type","x","y","pageX","pageY","clientX","clientY","offsetX","offsetY"],e=["dblclick","touchmove","mousemove","touchend","touchcancel","mouseup","touchstart","mousedown","release","dragleft","dragright","swipeleft","swiperight"],t=function(e,t){var n={};for(var i in t){var a=o.indexOf(i);a>=0&&(n[i]=t[i])}var r="Cocoon && Cocoon.App && Cocoon.App.forwardedEventFromTheWebView && Cocoon.App.forwardedEventFromTheWebView("+JSON.stringify(e)+", '"+JSON.stringify(n)+"');";Cocoon.App.forward(r)},n=0;n<e.length;n++)window.addEventListener(e[n],function(o){return function(e){Cocoon.App.forwardEventsToCocoonJSEnabled&&t(o,e)}}(e[n]))}}),o.onLoadInCocoonJSSucceed=new Cocoon.EventHandler("IDTK_APP","App","forwardpageload"),o.onLoadInCocoonJSFailed=new Cocoon.EventHandler("IDTK_APP","App","forwardpagefail"),o)}),Cocoon.define("Cocoon.Widget",function(o){"use strict";return o.WebDialog=function(){if(Cocoon.App.nativeAvailable)this.webDialogID=window.ext.IDTK_APP.makeCall("createWebDialog");else{var o=document.createElement("iframe");o.id="CocoonJSWebDialogIFrame",o.name="CocoonJSWebDialogIFrame",o.style.cssText="position:fixed;left:0;top:0;bottom:0;right:0; width:100%; height:100%;margin:0;padding:0;";var e=this;o.onload=function(){e.iframeloaded=!0;var o="Cocoon = {}; Cocoon.Widget = {}; Cocoon.Widget.WebDialog = {}; Cocoon.Widget.WebDialog.close = function(){   window.parent.CocoonJSCloseWebDialog();};";e.evalIframe(o);for(var t=0;t<e.pendingEvals.length;++t)e.evalIframe(e.pendingEvals[t]);e.pendingEvals=[]},o.onerror=function(){e.close()},this.iframe=o,this.pendingEvals=[],window.CocoonJSCloseWebDialog=function(){e.close()}}},o.WebDialog.prototype={show:function(o,e){return this.closeCallback=function(){Cocoon.Touch.enable(),e&&e()},Cocoon.App.nativeAvailable?(Cocoon.Touch.disable(),window.ext.IDTK_APP.makeCallAsync("showWebDialog",this.webDialogID,o,this.closeCallback)):(this.iframe.src=o,void document.body.appendChild(this.iframe))},close:function(){return Cocoon.App.nativeAvailable?window.ext.IDTK_APP.makeCallAsync("closeWebDialog",this.webDialogID):(this.iframe.parentNode&&this.iframe.parentNode.removeChild(this.iframe),void(this.closeCallback&&this.closeCallback()))},evalIframe:function(o){window.frames.CocoonJSWebDialogIFrame.eval(o)},eval:function(o){return Cocoon.App.nativeAvailable?window.ext.IDTK_APP.makeCallAsync("evalWebDialog",this.webDialogID,o):void(this.iframeloaded?this.evalIframe(o):this.pendingEvals.push(o))}},o});
  });
  