var qqPlayCoreBuildInfo = { buildPath:'/trunk/master/bricktest',version:'4964',creator:'wesleyxiao',buildTime:'Tue Aug 21 2018 21:07:35 GMT+0800 (CST)'};function clone_(t){var e,i,r;if("object"!=typeof t||null===t)return t;if(t instanceof Array)for(e=[],i=0,r=t.length;i<r;i++)"object"==typeof t[i]&&null!=t[i]?e[i]=arguments.callee(t[i]):e[i]=t[i];else{e={};for(i in t)"object"==typeof t[i]&&null!=t[i]?e[i]=arguments.callee(t[i]):e[i]=t[i]}return e}function Canvas(){var t=arguments.length;this._shadowColor={r:0,g:0,b:0,a:0},this._shadowOffset={x:0,y:0},this._shadowRadius=0,this._textBaseLine=0,this._textAlign=0,this._useH5Mode=0,this._a=1,this._b=0,this._c=0,this._d=1,this._tx=0,this._ty=0,2==t&&(this.__nativeObj=new BK.CanvasNode(arguments[0],arguments[1]),this.setFlipXY(0,1),Object.getOwnPropertyNames(this.__nativeObj).forEach(function(t){var e=t;"scale"!=e&&"transform"!=e&&"contentSize"!=e&&"size"!=e&&"fontPath"!=e&&Object.defineProperty(this,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this),Object.defineProperty(Canvas.prototype,"fontPath",{get:function(){return this.__nativeObj.fontPath},set:function(t){BK.FileUtil.isFileExist(t)&&(this.__nativeObj.fontPath=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"contentSize",{get:function(){return this.__nativeObj.contentSize},set:function(t){this.__nativeObj.contentSize=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"size",{get:function(){return this.__nativeObj.size},set:function(t){this.__nativeObj.size=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"textBaseline",{get:function(){return this._textBaseLine},set:function(t){switch(t){case 0:case 1:case 2:this._textBaseLine=t;break;case"bottom":case"Bottom":this._textBaseLine=0;break;case"Middle":case"middle":this._textBaseLine=1;break;case"Top":case"top":this._textBaseLine=2}},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"textAlign",{get:function(){return this._textAlign},set:function(t){switch(t){case 0:case 1:case 2:this._textAlign=t;break;case"left":this._textAlign=0;break;case"center":this._textAlign=1;break;case"right":this._textAlign=2}this.__nativeObj.setTextAlign(this._textAlign)},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"lineWidth",{get:function(){return this.__nativeObj.lineWidth},set:function(t){this.__nativeObj.lineWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"globalAlpha",{get:function(){return this.__nativeObj.globalAlpha},set:function(t){t=Math.min(1,t),t=Math.max(0,t),this.__nativeObj.globalAlpha=t},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"fillColor",{get:function(){return this.__nativeObj.fillColor},set:function(t){this.__nativeObj.fillColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"strokeColor",{get:function(){return this.__nativeObj.strokeColor},set:function(t){this.__nativeObj.strokeColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"lineCap",{get:function(){return this.__nativeObj.lineCap},set:function(t){this.__nativeObj.lineCap=t},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"lineJoin",{get:function(){return this.__nativeObj.lineJoin},set:function(t){this.__nativeObj.lineJoin=t},enumerable:!0,configurable:!0}),Object.defineProperty(Canvas.prototype,"miterLimit",{get:function(){return this.__nativeObj.miterLimit},set:function(t){this.__nativeObj.miterLimit=t},enumerable:!0,configurable:!0}))}function inverseMatrix(t,e,i,r,n,a){var o=t,s=i,h=n,_=e,l=r,d=a,c=o*l*1+s*d*0+h*_*0-h*l*0-s*_*1-o*d*0,u=-1*(1*_-0*d)/c,f=1*(0*_-0*l)/c,g=-1*(1*s-0*h)/c,m=-1*(0*o-0*s)/c,p=1*(s*d-h*l)/c,v=-1*(o*d-h*_)/c,S=g;g=u,u=S;S=p;p=f,f=S;S=m;return m=v,v=S,[1*(1*l-0*d)/c,g,u,1*(1*o-0*h)/c,f,m]}function bkWebGLGetInstance(){return gl||(gl=new BK.WebGL,attatchConst(),attachMethod(),gl.OpenOptMode=OpenOptMode,gl.viewport(0,0,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height)),Object.prototype.hasOwnProperty.call(this,"renderTicker")&&renderTicker.setTickerCallBack(function(t,e){}),gl}function __bkIsSupportTypedArray(){if(void 0==isSupportTA){"android"==GameStatusInfo.platform&&(isSupportTA=!0);var t=BK.Director.queryDeviceInfo(),e=t.version.split(".");"ios"==t.platform&&Number(e[0])>=10||"android"==t.platform?isSupportTA=!0:(BK.Script.log(1,0,"Current Device dont supoort TypedArray.[info = "+JSON.stringify(t)+"]"),isSupportTA=!1)}return isSupportTA}function __TypedArrayGetData(t){if(Object.prototype.hasOwnProperty.call(t,"__rawBKData"))return t.__rawBKData;if(Object.prototype.hasOwnProperty.call(t,"__nativeObj"))return t.__nativeObj;if(0==__bkIsSupportTypedArray()){var e=t instanceof ArrayBuffer;return BK.Misc.arrayBufferToBKBuffer(e?t:t.buffer,e?0:t.byteOffset,t.byteLength)}return t}function checkFirstFrames(){0==firstFrameUpload&&(BK.MQQ.SsoRequest.send({},"cs.first_frame_drawn.local"),firstFrameUpload=!0)}function activeTexture(t){glpause||gl.glActiveTexture(t)}function attachShader(t,e){glpause||gl.glAttachShader(t,e)}function bindAttribLocation(t,e,i){glpause||gl.glBindAttribLocation(t,e,i)}function bindBuffer(t,e){glpause||gl.glBindBuffer(t,e)}function bindFramebuffer(t,e){glpause||gl.glBindFramebuffer(t,e)}function bindRenderbuffer(t,e){glpause||gl.glBindRenderbuffer(t,e)}function bindTexture(t,e){glpause||gl.glBindTexture(t,e)}function blendColor(t,e,i,r){glpause||gl.glBlendColor(t,e,i,r)}function blendEquation(t){glpause||gl.glBlendEquation(t)}function blendEquationSeparate(t,e){glpause||gl.glBlendEquationSeparate(t,e)}function blendFunc(t,e){glpause||gl.glBlendFunc(t,e)}function blendFuncSeparate(t,e,i,r){glpause||gl.glBlendFuncSeparate(t,e,i,r)}function bufferData(t,e,i){glpause||("number"!=typeof e?gl.glBufferData(t,__TypedArrayGetData(e),i):gl.glBufferData(t,e,i))}function bufferSubData(t,e,i){glpause||gl.glBufferSubData(t,e,__TypedArrayGetData(i))}function checkFramebufferStatus(t){if(!glpause)return gl.glCheckFramebufferStatus(t)}function clear(t){glpause||gl.glClear(t)}function clearColor(t,e,i,r){glpause||gl.glClearColor(t,e,i,r)}function clearDepth(t){glpause||gl.glClearDepth(t)}function clearStencil(t){glpause||gl.glClearStencil(t)}function colorMask(t,e,i,r){glpause||gl.glColorMask(t,e,i,r)}function compileShader(t){glpause||gl.glCompileShader(t)}function compressedTexImage2D(t,e,i,r,n,a,o){glpause||gl.glCompressedTexImage2D(t,e,i,r,n,a,o)}function compressedTexSubImage2D(t,e,i,r,n,a,o,s){glpause||gl.glCompressedTexSubImage2D(t,e,i,r,n,a,o,s)}function copyTexImage2D(t,e,i,r,n,a,o,s){glpause||gl.glCopyTexImage2D(t,e,i,r,n,a,o,s)}function copyTexSubImage2D(t,e,i,r,n,a,o,s){glpause||gl.glCopyTexSubImage2D(t,e,i,r,n,a,o,s)}function createBuffer(){return glpause?-1:gl.glCreateBuffer()}function createFramebuffer(){return glpause?-1:gl.glCreateFramebuffer()}function createProgram(){return glpause?-1:gl.glCreateProgram()}function createRenderbuffer(){return glpause?-1:gl.glCreateRenderbuffer()}function createShader(t){return glpause?-1:gl.glCreateShader(t)}function createTexture(){return glpause?-1:gl.glCreateTexture()}function cullFace(t){glpause||gl.glCullFace(t)}function deleteBuffer(t){glpause||gl.glDeleteBuffer(t)}function deleteFramebuffer(t){glpause||gl.glDeleteFramebuffer(t)}function deleteProgram(t){glpause||gl.glDeleteProgram(t)}function deleteRenderbuffer(t){glpause||gl.glDeleteRenderbuffer(t)}function deleteShader(t){glpause||gl.glDeleteShader(t)}function deleteTexture(t){glpause||gl.glDeleteTexture(t)}function depthFunc(t){glpause||gl.glDepthFunc(t)}function depthMask(t){glpause||gl.glDepthMask(t)}function depthRange(t,e){glpause||gl.glDepthRange(t,e)}function detachShader(t,e){glpause||gl.glDetachShader(t,e)}function disable(t){glpause||gl.glDisable(t)}function disableVertexAttribArray(t){glpause||gl.glDisableVertexAttribArray(t)}function drawArrays(t,e,i){glpause||(gl.glDrawArrays(t,e,i),i>0&&checkFirstFrames())}function drawElements(t,e,i,r){glpause||(gl.glDrawElements(t,e,i,r),e>0&&checkFirstFrames())}function enable(t){glpause||gl.glEnable(t)}function enableVertexAttribArray(t){glpause||gl.glEnableVertexAttribArray(t)}function finish(){glpause||gl.glFinish()}function flush(){glpause||gl.glFlush()}function framebufferRenderbuffer(t,e,i,r){glpause||gl.glFramebufferRenderbuffer(t,e,i,r)}function framebufferTexture2D(t,e,i,r,n){glpause||gl.glFramebufferTexture2D(t,e,i,r,n)}function frontFace(t){glpause||gl.glFrontFace(t)}function generateMipmap(t){glpause||gl.glGenerateMipmap(t)}function getAttribLocation(t,e){return glpause?-1:gl.glGetAttribLocation(t,e)}function getError(){return glpause?null:gl.glGetError()}function getShaderPrecisionFormat(t,e){return glpause?-1:gl.glGetShaderPrecisionFormat(t,e)}function getProgramInfoLog(t){return glpause?null:gl.glGetProgramInfoLog(t)}function getShaderInfoLog(t){return glpause?null:gl.glGetShaderInfoLog(t)}function getShaderSource(t){return glpause?null:gl.glGetShaderSource(t)}function getUniformLocation(t,e){return glpause?-1:gl.glGetUniformLocation(t,e)}function getVertexAttribOffset(t,e){return glpause?-1:gl.glGetVertexAttribOffset(t,e)}function hint(t,e){glpause||gl.glHint(t,e)}function isBuffer(t){return!glpause&&gl.glIsBuffer(t)}function isEnabled(t){return!glpause&&gl.glIsEnabled(t)}function isFramebuffer(t){return!glpause&&gl.glIsFramebuffer(t)}function isProgram(t){return!glpause&&gl.glIsProgram(t)}function isRenderbuffer(t){return!glpause&&gl.glIsRenderbuffer(t)}function isShader(t){return!glpause&&gl.glIsShader(t)}function isTexture(t){return!glpause&&gl.glIsTexture(t)}function lineWidth(t){glpause||gl.glLineWidth(t)}function linkProgram(t){glpause||gl.glLinkProgram(t)}function pixelStorei(t,e){glpause||gl.glPixelStorei(t,e)}function polygonOffset(t,e){glpause||gl.glPolygonOffset(t,e)}function readPixels(t,e,i,r,n,a,o){glpause||gl.glReadPixels(t,e,i,r,n,a,o)}function renderbufferStorage(t,e,i,r){glpause||gl.glRenderbufferStorage(t,e,i,r)}function sampleCoverage(t,e){glpause||gl.glSampleCoverage(t,e)}function scissor(t,e,i,r){glpause||gl.glScissor(t,e,i,r)}function shaderSource(t,e){glpause||gl.glShaderSource(t,e)}function stencilFunc(t,e,i){glpause||gl.glStencilFunc(t,e,i)}function stencilFuncSeparate(t,e,i,r){glpause||gl.glStencilFuncSeparate(t,e,i,r)}function stencilMask(t){glpause||gl.glStencilMask(t)}function stencilMaskSeparate(t,e){glpause||gl.glStencilMaskSeparate(t,e)}function stencilOp(t,e,i){glpause||gl.glStencilOp(t,e,i)}function stencilOpSeparate(t,e,i,r){glpause||gl.glStencilOpSeparate(t,e,i,r)}function texImage2D(t,e,i){if(!glpause)switch(arguments.length){case 6:var r=arguments[3],n=arguments[4],a=arguments[5];Object.prototype.hasOwnProperty.call(a,"__nativeObj")?gl.glTexImage2D(t,e,i,r,n,a.__nativeObj):Object.prototype.hasOwnProperty.call(a,"buffer")&&Object.prototype.hasOwnProperty.call(a.buffer,"eof")&&Object.prototype.hasOwnProperty.call(a.buffer,"pointer")&&Object.prototype.hasOwnProperty.call(a.buffer,"netOrder")&&a.width>0&&a.height>0?gl.glTexImage2D(t,e,i,r,n,a):Object.prototype.hasOwnProperty.call(a,"buffer")&&a.buffer.__proto__.hasOwnProperty("eof")&&a.buffer.__proto__.hasOwnProperty("pointer")&&a.buffer.__proto__.hasOwnProperty("netOrder")&&a.width>0&&a.height>0&&gl.glTexImage2D(t,e,i,r,n,a);break;case 9:var o=arguments[3],s=arguments[4],h=arguments[5],r=arguments[6],n=arguments[7],_=arguments[8];gl.glTexImage2D(t,e,i,o,s,h,r,n,_)}}function texParameterf(t,e,i){glpause||gl.glTexParameterf(t,e,i)}function texParameteri(t,e,i){glpause||gl.glTexParameteri(t,e,i)}function texSubImage2D(t,e,i,r){if(!glpause)switch(arguments.length){case 7:var n=arguments[4],a=arguments[5],o=arguments[6];Object.prototype.hasOwnProperty.call(o,"__nativeObj")?gl.glTexSubImage2D(t,e,i,r,n,a,o.__nativeObj):gl.glTexSubImage2D(t,e,i,r,n,a,o);break;case 9:var s=arguments[4],h=arguments[5],n=arguments[6],a=arguments[7],_=arguments[8];gl.glTexSubImage2D(t,e,i,r,s,h,n,a,_)}}function uniform1f(t,e){glpause||gl.glUniform1f(t,e)}function uniform2f(t,e,i){glpause||gl.glUniform2f(t,e,i)}function uniform3f(t,e,i,r){glpause||gl.glUniform3f(t,e,i,r)}function uniform4f(t,e,i,r,n){glpause||gl.glUniform4f(t,e,i,r,n)}function uniform1i(t,e){glpause||gl.glUniform1i(t,e)}function uniform2i(t,e,i){glpause||gl.glUniform2i(t,e,i)}function uniform3i(t,e,i,r){glpause||gl.glUniform3i(t,e,i,r)}function uniform4i(t,e,i,r,n){glpause||gl.glUniform4i(t,e,i,r,n)}function uniform1fv(t,e){glpause||gl.glUniform1fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function uniform2fv(t,e){glpause||gl.glUniform2fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function uniform3fv(t,e){glpause||gl.glUniform3fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function uniform4fv(t,e){glpause||gl.glUniform4fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function uniform1iv(t,e){glpause||gl.glUniform1iv(t,__TypedArrayGetData(e instanceof Array==1?new Int32Array(e):e))}function uniform2iv(t,e){glpause||gl.glUniform2iv(t,__TypedArrayGetData(e instanceof Array==1?new Int32Array(e):e))}function uniform3iv(t,e){glpause||gl.glUniform3iv(t,__TypedArrayGetData(e instanceof Array==1?new Int32Array(e):e))}function uniform4iv(t,e){glpause||gl.glUniform4iv(t,__TypedArrayGetData(e instanceof Array==1?new Int32Array(e):e))}function uniformMatrix2fv(t,e,i){glpause||gl.glUniformMatrix2fv(t,e,__TypedArrayGetData(i instanceof Array==1?new Float32Array(i):i))}function uniformMatrix3fv(t,e,i){glpause||gl.glUniformMatrix3fv(t,e,__TypedArrayGetData(i instanceof Array==1?new Float32Array(i):i))}function uniformMatrix4fv(t,e,i){glpause||gl.glUniformMatrix4fv(t,e,__TypedArrayGetData(i instanceof Array==1?new Float32Array(i):i))}function useProgram(t){glpause||gl.glUseProgram(t)}function validateProgram(t){glpause||gl.glValidateProgram(t)}function vertexAttrib1f(t,e){glpause||gl.glVertexAttrib1f(t,e)}function vertexAttrib2f(t,e,i){glpause||gl.glVertexAttrib2f(t,e,i)}function vertexAttrib3f(t,e,i,r){glpause||gl.glVertexAttrib3f(t,e,i,r)}function vertexAttrib4f(t,e,i,r,n){glpause||gl.glVertexAttrib4f(t,e,i,r,n)}function vertexAttrib1fv(t,e){glpause||gl.glVertexAttrib1fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function vertexAttrib2fv(t,e){glpause||gl.glVertexAttrib2fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function vertexAttrib3fv(t,e){glpause||gl.glVertexAttrib3fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function vertexAttrib4fv(t,e){glpause||gl.glVertexAttrib4fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function vertexAttribPointer(t,e,i,r,n,a,o){if(!glpause){if(void 0===o){var s={index:t,size:e,type:i,normalized:r,stride:n,offset:a};void 0===gl.recordVertexAttribPointer&&(gl.recordVertexAttribPointer=[]);for(var h=!1,_=0;_<gl.recordVertexAttribPointer.length;_++)if(gl.recordVertexAttribPointer[_].index==s.index){h=!0,gl.recordVertexAttribPointer[_]=s;break}0==h&&gl.recordVertexAttribPointer.push(s)}gl.glVertexAttribPointer(t,e,i,r,n,a)}}function viewport(t,e,i,r){glpause||gl.glViewport(t,e,i,r)}function getActiveAttrib(t,e){if(!glpause)return gl.glGetActiveAttrib(t,e)}function getActiveUniform(t,e){if(!glpause)return gl.glGetActiveUniform(t,e)}function getAttachedShaders(t){if(!glpause)return gl.glGetAttachedShaders(t)}function getBufferParameter(t,e){if(!glpause)return gl.glGetBufferParameter(t,e)}function getFramebufferAttachmentParameter(t,e,i){if(!glpause)return gl.glGetFramebufferAttachmentParameter(t,e,i)}function getProgramParameter(t,e){if(!glpause)return gl.glGetProgramParameter(t,e)}function getRenderbufferParameter(t,e){if(!glpause)return gl.glGetRenderbufferParameter(t,e)}function getShaderParameter(t,e){if(!glpause)return gl.glGetShaderParameter(t,e)}function getTexParameter(t,e){if(!glpause)return gl.glGetTexParameter(t,e)}function getVertexAttrib(t,e){if(!glpause)return gl.glGetVertexAttrib(t,e)}function getUniform(t,e){if(!glpause)return gl.glGetUniform(t,e)}function getParameter(t){if(!glpause)switch(t){case gl.ACTIVE_TEXTURE:case gl.ALPHA_BITS:case gl.ARRAY_BUFFER_BINDING:case gl.BLUE_BITS:case gl.CULL_FACE_MODE:case gl.CURRENT_PROGRAM:case gl.DEPTH_BITS:case gl.DEPTH_FUNC:case gl.ELEMENT_ARRAY_BUFFER_BINDING:case gl.FRAMEBUFFER_BINDING:case gl.FRONT_FACE:case gl.GENERATE_MIPMAP_HINT:case gl.GREEN_BITS:case gl.IMPLEMENTATION_COLOR_READ_FORMAT:case gl.IMPLEMENTATION_COLOR_READ_TYPE:case gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS:case gl.MAX_CUBE_MAP_TEXTURE_SIZE:case gl.MAX_FRAGMENT_UNIFORM_VECTORS:case gl.MAX_RENDERBUFFER_SIZE:case gl.MAX_TEXTURE_IMAGE_UNITS:case gl.MAX_TEXTURE_SIZE:case gl.MAX_VARYING_VECTORS:case gl.MAX_VERTEX_ATTRIBS:case gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS:case gl.MAX_VERTEX_UNIFORM_VECTORS:case gl.MAX_VIEWPORT_DIMS:case gl.NUM_COMPRESSED_TEXTURE_FORMATS:case gl.NUM_SHADER_BINARY_FORMATS:case gl.PACK_ALIGNMENT:case gl.RED_BITS:case gl.RENDERBUFFER_BINDING:case gl.SAMPLE_BUFFERS:case gl.SAMPLES:case gl.STENCIL_BACK_FAIL:case gl.STENCIL_BACK_FUNC:case gl.STENCIL_BACK_PASS_DEPTH_FAIL:case gl.STENCIL_BACK_PASS_DEPTH_PASS:case gl.STENCIL_BACK_REF:case gl.STENCIL_BACK_VALUE_MASK:case gl.STENCIL_BACK_WRITEMASK:case gl.STENCIL_BITS:case gl.STENCIL_CLEAR_VALUE:case gl.STENCIL_FAIL:case gl.STENCIL_FUNC:case gl.STENCIL_PASS_DEPTH_FAIL:case gl.STENCIL_PASS_DEPTH_PASS:case gl.STENCIL_REF:case gl.STENCIL_VALUE_MASK:case gl.STENCIL_WRITEMASK:case gl.SUBPIXEL_BITS:case gl.TEXTURE_BINDING_2D:case gl.TEXTURE_BINDING_CUBE_MAP:case gl.UNPACK_ALIGNMENT:case gl.BLEND_DST_ALPHA:case gl.BLEND_DST_RGB:case gl.BLEND_EQUATION_ALPHA:case gl.BLEND_EQUATION_RGB:case gl.BLEND_SRC_ALPHA:case gl.BLEND_SRC_RGB:return gl.glGetParameterInt(t,1);case gl.ALIASED_LINE_WIDTH_RANGE:case gl.ALIASED_POINT_SIZE_RANGE:case gl.DEPTH_RANGE:case gl.MAX_VIEWPORT_DIMS:return gl.glGetParameterFloat(t,2);case gl.BLEND:case gl.CULL_FACE:case gl.DEPTH_TEST:case gl.DEPTH_WRITEMASK:case gl.DITHER:case gl.POLYGON_OFFSET_FILL:case gl.SAMPLE_ALPHA_TO_COVERAGE:case gl.SAMPLE_COVERAGE:case gl.SAMPLE_COVERAGE_INVERT:case gl.SCISSOR_TEST:case gl.SHADER_COMPILER:case gl.STENCIL_TEST:return gl.glGetParameterBool(t,1);case gl.BLEND_COLOR:case gl.COLOR_CLEAR_VALUE:return gl.glGetParameterFloat(t,4);case gl.SCISSOR_BOX:case gl.VIEWPORT:return gl.glGetParameterInt(t,4);case gl.COLOR_WRITEMASK:return gl.glGetParameterBool(t,4);case gl.POLYGON_OFFSET_FACTOR:case gl.POLYGON_OFFSET_UNITS:case gl.SAMPLE_COVERAGE_VALUE:return gl.glGetParameterFloat(t,1);case gl.SHADER_BINARY_FORMATS:e=gl.glGetParameterInt(gl.NUM_SHADER_BINARY_FORMATS,1);return gl.glGetParameterInt(t,e);case gl.COMPRESSED_TEXTURE_FORMATS:var e=gl.glGetParameterInt(gl.NUM_COMPRESSED_TEXTURE_FORMATS,1);return gl.glGetParameterInt(t,e)}}function voidFunc(t,e,i,r,n,a,o,s,h,_){}function attchVoidMethod(){gl.methodWorking=!1,gl.activeTexture=voidFunc,gl.attachShader=voidFunc,gl.bindAttribLocation=voidFunc,gl.bindBuffer=voidFunc,gl.bindFramebuffer=voidFunc,gl.bindRenderbuffer=voidFunc,gl.bindTexture=voidFunc,gl.blendColor=voidFunc,gl.blendEquation=voidFunc,gl.blendEquationSeparate=voidFunc,gl.blendFunc=voidFunc,gl.blendFuncSeparate=voidFunc,gl.bufferData=voidFunc,gl.bufferData=voidFunc,gl.bufferSubData=voidFunc,gl.checkFramebufferStatus=voidFunc,gl.clear=voidFunc,gl.clearColor=voidFunc,gl.clearDepth=voidFunc,gl.clearStencil=voidFunc,gl.colorMask=voidFunc,gl.compileShader=voidFunc,gl.compressedTexImage2D=voidFunc,gl.compressedTexSubImage2D=voidFunc,gl.copyTexImage2D=voidFunc,gl.copyTexSubImage2D=voidFunc,gl.createBuffer=voidFunc,gl.createFramebuffer=voidFunc,gl.createProgram=voidFunc,gl.createRenderbuffer=voidFunc,gl.createShader=voidFunc,gl.createTexture=voidFunc,gl.cullFace=voidFunc,gl.deleteBuffer=voidFunc,gl.deleteFramebuffer=voidFunc,gl.deleteProgram=voidFunc,gl.deleteRenderbuffer=voidFunc,gl.deleteShader=voidFunc,gl.deleteTexture=voidFunc,gl.depthFunc=voidFunc,gl.depthMask=voidFunc,gl.depthRange=voidFunc,gl.detachShader=voidFunc,gl.disable=voidFunc,gl.disableVertexAttribArray=voidFunc,gl.drawArrays=voidFunc,gl.drawElements=voidFunc,gl.enable=voidFunc,gl.enableVertexAttribArray=voidFunc,gl.finish=voidFunc,gl.flush=voidFunc,gl.framebufferRenderbuffer=voidFunc,gl.framebufferTexture2D=voidFunc,gl.frontFace=voidFunc,gl.generateMipmap=voidFunc,gl.getAttribLocation=voidFunc,gl.getError=voidFunc,gl.getProgramInfoLog=voidFunc,gl.getShaderInfoLog=voidFunc,gl.getShaderSource=voidFunc,gl.getUniformLocation=voidFunc,gl.getVertexAttribOffset=voidFunc,gl.hint=voidFunc,gl.isBuffer=voidFunc,gl.isEnabled=voidFunc,gl.isFramebuffer=voidFunc,gl.isProgram=voidFunc,gl.isRenderbuffer=voidFunc,gl.isShader=voidFunc,gl.isTexture=voidFunc,gl.lineWidth=voidFunc,gl.linkProgram=voidFunc,gl.pixelStorei=voidFunc,gl.polygonOffset=voidFunc,gl.readPixels=voidFunc,gl.renderbufferStorage=voidFunc,gl.sampleCoverage=voidFunc,gl.scissor=voidFunc,gl.shaderSource=voidFunc,gl.stencilFunc=voidFunc,gl.stencilFuncSeparate=voidFunc,gl.stencilMask=voidFunc,gl.stencilMaskSeparate=voidFunc,gl.stencilOp=voidFunc,gl.stencilOpSeparate=voidFunc,gl.texImage2D=voidFunc,gl.texSubImage2D=voidFunc,gl.texParameterf=voidFunc,gl.texParameteri=voidFunc,gl.uniform1f=voidFunc,gl.uniform2f=voidFunc,gl.uniform3f=voidFunc,gl.uniform4f=voidFunc,gl.uniform1i=voidFunc,gl.uniform2i=voidFunc,gl.uniform3i=voidFunc,gl.uniform4i=voidFunc,gl.uniform1fv=voidFunc,gl.uniform2fv=voidFunc,gl.uniform3fv=voidFunc,gl.uniform4fv=voidFunc,gl.uniform1iv=voidFunc,gl.uniform2iv=voidFunc,gl.uniform3iv=voidFunc,gl.uniform4iv=voidFunc,gl.uniformMatrix2fv=voidFunc,gl.uniformMatrix3fv=voidFunc,gl.uniformMatrix4fv=voidFunc,gl.useProgram=voidFunc,gl.validateProgram=voidFunc,gl.vertexAttrib1f=voidFunc,gl.vertexAttrib2f=voidFunc,gl.vertexAttrib3f=voidFunc,gl.vertexAttrib4f=voidFunc,gl.vertexAttrib1fv=voidFunc,gl.vertexAttrib2fv=voidFunc,gl.vertexAttrib3fv=voidFunc,gl.vertexAttrib4fv=voidFunc,gl.vertexAttribPointer=voidFunc,gl.viewport=voidFunc,gl.getActiveAttrib=voidFunc,gl.getActiveUniform=voidFunc,gl.getAttachedShaders=voidFunc,gl.getBufferParameter=voidFunc,gl.getFramebufferAttachmentParameter=voidFunc,gl.getProgramParameter=voidFunc,gl.getRenderbufferParameter=voidFunc,gl.getShaderParameter=voidFunc,gl.getTexParameter=voidFunc,gl.getVertexAttrib=voidFunc,gl.getParameter=voidFunc,gl.getUniform=voidFunc,gl.getShaderPrecisionFormat=voidFunc}function attachMethod(){gl.methodWorking=!0,gl.activeTexture=activeTexture,gl.attachShader=attachShader,gl.bindAttribLocation=bindAttribLocation,gl.bindBuffer=bindBuffer,gl.bindFramebuffer=bindFramebuffer,gl.bindRenderbuffer=bindRenderbuffer,gl.bindTexture=bindTexture,gl.blendColor=blendColor,gl.blendEquation=blendEquation,gl.blendEquationSeparate=blendEquationSeparate,gl.blendFunc=blendFunc,gl.blendFuncSeparate=blendFuncSeparate,gl.bufferData=bufferData,gl.bufferData=bufferData,gl.bufferSubData=bufferSubData,gl.checkFramebufferStatus=checkFramebufferStatus,gl.clear=clear,gl.clearColor=clearColor,gl.clearDepth=clearDepth,gl.clearStencil=clearStencil,gl.colorMask=colorMask,gl.compileShader=compileShader,gl.compressedTexImage2D=compressedTexImage2D,gl.compressedTexSubImage2D=compressedTexSubImage2D,gl.copyTexImage2D=copyTexImage2D,gl.copyTexSubImage2D=copyTexSubImage2D,gl.createBuffer=createBuffer,gl.createFramebuffer=createFramebuffer,gl.createProgram=createProgram,gl.createRenderbuffer=createRenderbuffer,gl.createShader=createShader,gl.createTexture=createTexture,gl.cullFace=cullFace,gl.deleteBuffer=deleteBuffer,gl.deleteFramebuffer=deleteFramebuffer,gl.deleteProgram=deleteProgram,gl.deleteRenderbuffer=deleteRenderbuffer,gl.deleteShader=deleteShader,gl.deleteTexture=deleteTexture,gl.depthFunc=depthFunc,gl.depthMask=depthMask,gl.depthRange=depthRange,gl.detachShader=detachShader,gl.disable=disable,gl.disableVertexAttribArray=disableVertexAttribArray,gl.drawArrays=drawArrays,gl.drawElements=drawElements,gl.enable=enable,gl.enableVertexAttribArray=enableVertexAttribArray,gl.finish=finish,gl.flush=flush,gl.framebufferRenderbuffer=framebufferRenderbuffer,gl.framebufferTexture2D=framebufferTexture2D,gl.frontFace=frontFace,gl.generateMipmap=generateMipmap,gl.getAttribLocation=getAttribLocation,gl.getError=getError,gl.getProgramInfoLog=getProgramInfoLog,gl.getShaderInfoLog=getShaderInfoLog,gl.getShaderSource=getShaderSource,gl.getUniformLocation=getUniformLocation,gl.getVertexAttribOffset=getVertexAttribOffset,gl.hint=hint,gl.isBuffer=isBuffer,gl.isEnabled=isEnabled,gl.isFramebuffer=isFramebuffer,gl.isProgram=isProgram,gl.isRenderbuffer=isRenderbuffer,gl.isShader=isShader,gl.isTexture=isTexture,gl.lineWidth=lineWidth,gl.linkProgram=linkProgram,gl.pixelStorei=pixelStorei,gl.polygonOffset=polygonOffset,gl.readPixels=readPixels,gl.renderbufferStorage=renderbufferStorage,gl.sampleCoverage=sampleCoverage,gl.scissor=scissor,gl.shaderSource=shaderSource,gl.stencilFunc=stencilFunc,gl.stencilFuncSeparate=stencilFuncSeparate,gl.stencilMask=stencilMask,gl.stencilMaskSeparate=stencilMaskSeparate,gl.stencilOp=stencilOp,gl.stencilOpSeparate=stencilOpSeparate,gl.texImage2D=texImage2D,gl.texSubImage2D=texSubImage2D,gl.texParameterf=texParameterf,gl.texParameteri=texParameteri,gl.uniform1f=uniform1f,gl.uniform2f=uniform2f,gl.uniform3f=uniform3f,gl.uniform4f=uniform4f,gl.uniform1i=uniform1i,gl.uniform2i=uniform2i,gl.uniform3i=uniform3i,gl.uniform4i=uniform4i,gl.uniform1fv=uniform1fv,gl.uniform2fv=uniform2fv,gl.uniform3fv=uniform3fv,gl.uniform4fv=uniform4fv,gl.uniform1iv=uniform1iv,gl.uniform2iv=uniform2iv,gl.uniform3iv=uniform3iv,gl.uniform4iv=uniform4iv,gl.uniformMatrix2fv=uniformMatrix2fv,gl.uniformMatrix3fv=uniformMatrix3fv,gl.uniformMatrix4fv=uniformMatrix4fv,gl.useProgram=useProgram,gl.validateProgram=validateProgram,gl.vertexAttrib1f=vertexAttrib1f,gl.vertexAttrib2f=vertexAttrib2f,gl.vertexAttrib3f=vertexAttrib3f,gl.vertexAttrib4f=vertexAttrib4f,gl.vertexAttrib1fv=vertexAttrib1fv,gl.vertexAttrib2fv=vertexAttrib2fv,gl.vertexAttrib3fv=vertexAttrib3fv,gl.vertexAttrib4fv=vertexAttrib4fv,gl.vertexAttribPointer=vertexAttribPointer,gl.viewport=viewport,gl.getActiveAttrib=getActiveAttrib,gl.getActiveUniform=getActiveUniform,gl.getAttachedShaders=getAttachedShaders,gl.getBufferParameter=getBufferParameter,gl.getFramebufferAttachmentParameter=getFramebufferAttachmentParameter,gl.getProgramParameter=getProgramParameter,gl.getRenderbufferParameter=getRenderbufferParameter,gl.getShaderParameter=getShaderParameter,gl.getTexParameter=getTexParameter,gl.getVertexAttrib=getVertexAttrib,gl.getParameter=getParameter,gl.getUniform=getUniform,gl.getShaderPrecisionFormat=getShaderPrecisionFormat}function attatchConst(){gl.DEPTH_BUFFER_BIT=256,gl.STENCIL_BUFFER_BIT=1024,gl.COLOR_BUFFER_BIT=16384,gl.POINTS=0,gl.LINES=1,gl.LINE_LOOP=2,gl.LINE_STRIP=3,gl.TRIANGLES=4,gl.TRIANGLE_STRIP=5,gl.TRIANGLE_FAN=6,gl.ZERO=0,gl.ONE=1,gl.SRC_COLOR=768,gl.ONE_MINUS_SRC_COLOR=769,gl.SRC_ALPHA=770,gl.ONE_MINUS_SRC_ALPHA=771,gl.DST_ALPHA=772,gl.ONE_MINUS_DST_ALPHA=773,gl.DST_COLOR=774,gl.ONE_MINUS_DST_COLOR=775,gl.SRC_ALPHA_SATURATE=776,gl.FUNC_ADD=32774,gl.BLEND_EQUATION=32777,gl.BLEND_EQUATION_RGB=32777,gl.BLEND_EQUATION_ALPHA=34877,gl.FUNC_SUBTRACT=32778,gl.FUNC_REVERSE_SUBTRACT=32779,gl.BLEND_DST_RGB=32968,gl.BLEND_SRC_RGB=32969,gl.BLEND_DST_ALPHA=32970,gl.BLEND_SRC_ALPHA=32971,gl.CONSTANT_COLOR=32769,gl.ONE_MINUS_CONSTANT_COLOR=32770,gl.CONSTANT_ALPHA=32771,gl.ONE_MINUS_CONSTANT_ALPHA=32772,gl.BLEND_COLOR=32773,gl.ARRAY_BUFFER=34962,gl.ELEMENT_ARRAY_BUFFER=34963,gl.ARRAY_BUFFER_BINDING=34964,gl.ELEMENT_ARRAY_BUFFER_BINDING=34965,gl.STREAM_DRAW=35040,gl.STATIC_DRAW=35044,gl.DYNAMIC_DRAW=35048,gl.BUFFER_SIZE=34660,gl.BUFFER_USAGE=34661,gl.CURRENT_VERTEX_ATTRIB=34342,gl.FRONT=1028,gl.BACK=1029,gl.FRONT_AND_BACK=1032,gl.CULL_FACE=2884,gl.BLEND=3042,gl.DITHER=3024,gl.STENCIL_TEST=2960,gl.DEPTH_TEST=2929,gl.SCISSOR_TEST=3089,gl.POLYGON_OFFSET_FILL=32823,gl.SAMPLE_ALPHA_TO_COVERAGE=32926,gl.SAMPLE_COVERAGE=32928,gl.NO_ERROR=0,gl.INVALID_ENUM=1280,gl.INVALID_VALUE=1281,gl.INVALID_OPERATION=1282,gl.OUT_OF_MEMORY=1285,gl.CW=2304,gl.CCW=2305,gl.LINE_WIDTH=2849,gl.ALIASED_POINT_SIZE_RANGE=33901,gl.ALIASED_LINE_WIDTH_RANGE=33902,gl.CULL_FACE_MODE=2885,gl.FRONT_FACE=2886,gl.DEPTH_RANGE=2928,gl.DEPTH_WRITEMASK=2930,gl.DEPTH_CLEAR_VALUE=2931,gl.DEPTH_FUNC=2932,gl.STENCIL_CLEAR_VALUE=2961,gl.STENCIL_FUNC=2962,gl.STENCIL_FAIL=2964,gl.STENCIL_PASS_DEPTH_FAIL=2965,gl.STENCIL_PASS_DEPTH_PASS=2966,gl.STENCIL_REF=2967,gl.STENCIL_VALUE_MASK=2963,gl.STENCIL_WRITEMASK=2968,gl.STENCIL_BACK_FUNC=34816,gl.STENCIL_BACK_FAIL=34817,gl.STENCIL_BACK_PASS_DEPTH_FAIL=34818,gl.STENCIL_BACK_PASS_DEPTH_PASS=34819,gl.STENCIL_BACK_REF=36003,gl.STENCIL_BACK_VALUE_MASK=36004,gl.STENCIL_BACK_WRITEMASK=36005,gl.VIEWPORT=2978,gl.SCISSOR_BOX=3088,gl.COLOR_CLEAR_VALUE=3106,gl.COLOR_WRITEMASK=3107,gl.UNPACK_ALIGNMENT=3317,gl.PACK_ALIGNMENT=3333,gl.MAX_TEXTURE_SIZE=3379,gl.MAX_VIEWPORT_DIMS=3386,gl.SUBPIXEL_BITS=3408,gl.RED_BITS=3410,gl.GREEN_BITS=3411,gl.BLUE_BITS=3412,gl.ALPHA_BITS=3413,gl.DEPTH_BITS=3414,gl.STENCIL_BITS=3415,gl.POLYGON_OFFSET_UNITS=10752,gl.POLYGON_OFFSET_FACTOR=32824,gl.TEXTURE_BINDING_2D=32873,gl.SAMPLE_BUFFERS=32936,gl.SAMPLES=32937,gl.SAMPLE_COVERAGE_VALUE=32938,gl.SAMPLE_COVERAGE_INVERT=32939,gl.COMPRESSED_TEXTURE_FORMATS=34467,gl.DONT_CARE=4352,gl.FASTEST=4353,gl.NICEST=4354,gl.GENERATE_MIPMAP_HINT=33170,gl.BYTE=5120,gl.UNSIGNED_BYTE=5121,gl.SHORT=5122,gl.UNSIGNED_SHORT=5123,gl.INT=5124,gl.UNSIGNED_INT=5125,gl.FLOAT=5126,gl.DEPTH_COMPONENT=6402,gl.ALPHA=6406,gl.RGB=6407,gl.RGBA=6408,gl.LUMINANCE=6409,gl.LUMINANCE_ALPHA=6410,gl.UNSIGNED_SHORT_4_4_4_4=32819,gl.UNSIGNED_SHORT_5_5_5_1=32820,gl.UNSIGNED_SHORT_5_6_5=33635,gl.FRAGMENT_SHADER=35632,gl.VERTEX_SHADER=35633,gl.MAX_VERTEX_ATTRIBS=34921,gl.MAX_VERTEX_UNIFORM_VECTORS=36347,gl.MAX_VARYING_VECTORS=36348,gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661,gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660,gl.MAX_TEXTURE_IMAGE_UNITS=34930,gl.MAX_FRAGMENT_UNIFORM_VECTORS=36349,gl.SHADER_TYPE=35663,gl.DELETE_STATUS=35712,gl.LINK_STATUS=35714,gl.VALIDATE_STATUS=35715,gl.ATTACHED_SHADERS=35717,gl.ACTIVE_UNIFORMS=35718,gl.ACTIVE_ATTRIBUTES=35721,gl.SHADING_LANGUAGE_VERSION=35724,gl.CURRENT_PROGRAM=35725,gl.NEVER=512,gl.LESS=513,gl.EQUAL=514,gl.LEQUAL=515,gl.GREATER=516,gl.NOTEQUAL=517,gl.GEQUAL=518,gl.ALWAYS=519,gl.KEEP=7680,gl.REPLACE=7681,gl.INCR=7682,gl.DECR=7683,gl.INVERT=5386,gl.INCR_WRAP=34055,gl.DECR_WRAP=34056,gl.VENDOR=7936,gl.RENDERER=7937,gl.VERSION=7938,gl.NEAREST=9728,gl.LINEAR=9729,gl.NEAREST_MIPMAP_NEAREST=9984,gl.LINEAR_MIPMAP_NEAREST=9985,gl.NEAREST_MIPMAP_LINEAR=9986,gl.LINEAR_MIPMAP_LINEAR=9987,gl.TEXTURE_MAG_FILTER=10240,gl.TEXTURE_MIN_FILTER=10241,gl.TEXTURE_WRAP_S=10242,gl.TEXTURE_WRAP_T=10243,gl.TEXTURE_2D=3553,gl.TEXTURE=5890,gl.TEXTURE_CUBE_MAP=34067,gl.TEXTURE_BINDING_CUBE_MAP=34068,gl.TEXTURE_CUBE_MAP_POSITIVE_X=34069,gl.TEXTURE_CUBE_MAP_NEGATIVE_X=34070,gl.TEXTURE_CUBE_MAP_POSITIVE_Y=34071,gl.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072,gl.TEXTURE_CUBE_MAP_POSITIVE_Z=34073,gl.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074,gl.MAX_CUBE_MAP_TEXTURE_SIZE=34076,gl.TEXTURE0=33984,gl.TEXTURE1=33985,gl.TEXTURE2=33986,gl.TEXTURE3=33987,gl.TEXTURE4=33988,gl.TEXTURE5=33989,gl.TEXTURE6=33990,gl.TEXTURE7=33991,gl.TEXTURE8=33992,gl.TEXTURE9=33993,gl.TEXTURE10=33994,gl.TEXTURE11=33995,gl.TEXTURE12=33996,gl.TEXTURE13=33997,gl.TEXTURE14=33998,gl.TEXTURE15=33999,gl.TEXTURE16=34e3,gl.TEXTURE17=34001,gl.TEXTURE18=34002,gl.TEXTURE19=34003,gl.TEXTURE20=34004,gl.TEXTURE21=34005,gl.TEXTURE22=34006,gl.TEXTURE23=34007,gl.TEXTURE24=34008,gl.TEXTURE25=34009,gl.TEXTURE26=34010,gl.TEXTURE27=34011,gl.TEXTURE28=34012,gl.TEXTURE29=34013,gl.TEXTURE30=34014,gl.TEXTURE31=34015,gl.ACTIVE_TEXTURE=34016,gl.REPEAT=10497,gl.CLAMP_TO_EDGE=33071,gl.MIRRORED_REPEAT=33648,gl.FLOAT_VEC2=35664,gl.FLOAT_VEC3=35665,gl.FLOAT_VEC4=35666,gl.INT_VEC2=35667,gl.INT_VEC3=35668,gl.INT_VEC4=35669,gl.BOOL=35670,gl.BOOL_VEC2=35671,gl.BOOL_VEC3=35672,gl.BOOL_VEC4=35673,gl.FLOAT_MAT2=35674,gl.FLOAT_MAT3=35675,gl.FLOAT_MAT4=35676,gl.SAMPLER_2D=35678,gl.SAMPLER_CUBE=35680,gl.VERTEX_ATTRIB_ARRAY_ENABLED=34338,gl.VERTEX_ATTRIB_ARRAY_SIZE=34339,gl.VERTEX_ATTRIB_ARRAY_STRIDE=34340,gl.VERTEX_ATTRIB_ARRAY_TYPE=34341,gl.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922,gl.VERTEX_ATTRIB_ARRAY_POINTER=34373,gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975,gl.IMPLEMENTATION_COLOR_READ_TYPE=35738,gl.IMPLEMENTATION_COLOR_READ_FORMAT=35739,gl.COMPILE_STATUS=35713,gl.LOW_FLOAT=36336,gl.MEDIUM_FLOAT=36337,gl.HIGH_FLOAT=36338,gl.LOW_INT=36339,gl.MEDIUM_INT=36340,gl.HIGH_INT=36341,gl.FRAMEBUFFER=36160,gl.RENDERBUFFER=36161,gl.RGBA4=32854,gl.RGB5_A1=32855,gl.RGB565=36194,gl.DEPTH_COMPONENT16=33189,gl.STENCIL_INDEX8=36168,gl.DEPTH_STENCIL=34041,gl.RENDERBUFFER_WIDTH=36162,gl.RENDERBUFFER_HEIGHT=36163,gl.RENDERBUFFER_INTERNAL_FORMAT=36164,gl.RENDERBUFFER_RED_SIZE=36176,gl.RENDERBUFFER_GREEN_SIZE=36177,gl.RENDERBUFFER_BLUE_SIZE=36178,gl.RENDERBUFFER_ALPHA_SIZE=36179,gl.RENDERBUFFER_DEPTH_SIZE=36180,gl.RENDERBUFFER_STENCIL_SIZE=36181,gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048,gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049,gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050,gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051,gl.COLOR_ATTACHMENT0=36064,gl.DEPTH_ATTACHMENT=36096,gl.STENCIL_ATTACHMENT=36128,gl.DEPTH_STENCIL_ATTACHMENT=33306,gl.NONE=0,gl.FRAMEBUFFER_COMPLETE=36053,gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054,gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055,gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057,gl.FRAMEBUFFER_UNSUPPORTED=36061,gl.FRAMEBUFFER_BINDING=36006,gl.RENDERBUFFER_BINDING=36007,gl.MAX_RENDERBUFFER_SIZE=34024,gl.INVALID_FRAMEBUFFER_OPERATION=1286,gl.UNPACK_FLIP_Y_WEBGL=37440,gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441,gl.CONTEXT_LOST_WEBGL=37442,gl.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443,gl.BROWSER_DEFAULT_WEBGL=37444,gl.SHADER_BINARY_FORMATS=36344,gl.NUM_SHADER_BINARY_FORMATS=36345,gl.NUM_COMPRESSED_TEXTURE_FORMATS=34466}function OpenOptMode(){gl.flushCommand&&isSupportTypeArray()&&attachMethodOpt(),buffer_data=new Float32Array(total_size)}function closeOptMode(){attachMethod()}function flushCommand(){next_index>0&&(gl.flushCommand(next_index,buffer_data),next_index=0)}function glCommitOpt(){flushCommand(),gl.commit()}function activeTextureOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ACTIVE_TEXTURE,buffer_data[next_index+1]=t,next_index+=2}function attachShaderOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ATTACH_SHADER,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function bindAttribLocationOpt(t,e,i){flushCommand(),bindAttribLocation(t,e,i)}function bindBufferOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BIND_BUFFER,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function bindFramebufferOpt(t,e){flushCommand(),bindFramebuffer(t,e)}function bindRenderbufferOpt(t,e){flushCommand(),bindRenderbuffer(t,e)}function bindTextureOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BIND_TEXTURE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function blendColorOpt(t,e,i,r){next_index+5>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_COLOR,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function blendEquationOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_EQUATION,buffer_data[next_index+1]=t,next_index+=2}function blendEquationSeparateOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_EQUATION_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function blendFuncOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_FUNC,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function blendFuncSeparateOpt(t,e,i,r){next_index+5>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_FUNC_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function bufferDataOpt(t,e,i){flushCommand(),bufferData(t,e,i)}function bufferSubDataOpt(t,e,i){flushCommand(),bufferSubData(t,e,i)}function checkFramebufferStatusOpt(t){flushCommand(),checkFramebufferStatus(t)}function clearOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR,buffer_data[next_index+1]=t,next_index+=2}function clearColorOpt(t,e,i,r){next_index+5>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR_COLOR,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function clearDepthOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR_DEPTH,buffer_data[next_index+1]=t,next_index+=2}function clearStencilOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR_STENCIL,buffer_data[next_index+1]=t,next_index+=2}function colorMaskOpt(t,e,i,r){next_index+5>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_COLOR_MASK,buffer_data[next_index+1]=t?1:0,buffer_data[next_index+2]=e?1:0,buffer_data[next_index+3]=i?1:0,buffer_data[next_index+4]=r?1:0,next_index+=5}function compileShaderOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_COMPILE_SHADER,buffer_data[next_index+1]=t,next_index+=2}function compressedTexImage2DOpt(t,e,i,r,n,a,o){flushCommand(),compressedTexImage2D(t,e,i,r,n,a,o)}function compressedTexSubImage2DOpt(t,e,i,r,n,a,o,s){flushCommand(),compressedTexSubImage2D(t,e,i,r,n,a,o,s)}function copyTexImage2DOpt(t,e,i,r,n,a,o,s){next_index+9>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_COPY_TEX_IMAGE_2D,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,buffer_data[next_index+6]=a,buffer_data[next_index+7]=o,buffer_data[next_index+8]=s,next_index+=9}function copyTexSubImage2DOpt(t,e,i,r,n,a,o,s){next_index+9>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_COPY_TEX_SUB_IMAGE_2D,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,buffer_data[next_index+6]=a,buffer_data[next_index+7]=o,buffer_data[next_index+8]=s,next_index+=9}function createBufferOpt(){return flushCommand(),createBuffer()}function createFramebufferOpt(){return flushCommand(),createFramebuffer()}function createProgramOpt(){return flushCommand(),createProgram()}function createRenderbufferOpt(){return flushCommand(),createRenderbuffer()}function createShaderOpt(t){return flushCommand(),createShader(t)}function createTextureOpt(){return flushCommand(),createTexture()}function cullFaceOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CULL_FACE,buffer_data[next_index+1]=t,next_index+=2}function deleteBufferOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_BUFFER,buffer_data[next_index+1]=t,next_index+=2}function deleteFramebufferOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_FRAME_BUFFER,buffer_data[next_index+1]=t,next_index+=2}function deleteProgramOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function deleteRenderbufferOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_RENDER_BUFFER,buffer_data[next_index+1]=t,next_index+=2}function deleteShaderOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_SHADER,buffer_data[next_index+1]=t,next_index+=2}function deleteTextureOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_TEXTURE,buffer_data[next_index+1]=t,next_index+=2}function depthFuncOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DEPTH_FUNC,buffer_data[next_index+1]=t,next_index+=2}function depthMaskOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DEPTH_MASK,buffer_data[next_index+1]=t?1:0,next_index+=2}function depthRangeOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DEPTH_RANGE,buffer_data[next_index+1]=t,buffer_data[next_index+1]=e,next_index+=3}function detachShaderOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DETACH_SHADER,buffer_data[next_index+1]=t,buffer_data[next_index+1]=e,next_index+=3}function disableOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DISABLE,buffer_data[next_index+1]=t,next_index+=2}function disableVertexAttribArrayOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DISABLE_VERTEX_ATTRIB_ARRAY,buffer_data[next_index+1]=t,next_index+=2}function drawArraysOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DRAW_ARRAYS,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4,i>0&&checkFirstFrames()}function drawElementsOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DRAW_ELEMENTS,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5,e>0&&checkFirstFrames()}function enableOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ENABLE,buffer_data[next_index+1]=t,next_index+=2}function enableVertexAttribArrayOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ENABLE_VERTEX_ATTRIB_ARRAY,buffer_data[next_index+1]=t,next_index+=2}function finishOpt(){next_index+1>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FINISH,next_index+=1}function flushOpt(){next_index+1>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FLUSH,next_index+=1}function framebufferRenderbufferOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FRAME_BUFFER_RENDER_BUFFER,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function framebufferTexture2DOpt(t,e,i,r,n){next_index+6>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FRAME_BUFFER_TEXTURE_2D,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,next_index+=6}function frontFaceOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FRONT_FACE,buffer_data[next_index+1]=t,next_index+=2}function generateMipmapOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_GENERATE_MIPMAP,buffer_data[next_index+1]=t,next_index+=2}function getActiveAttribOpt(t,e){return flushCommand(),getActiveAttrib(t,e)}function getActiveUniformOpt(t,e){return flushCommand(),getActiveUniform(t,e)}function getAttachedShadersOpt(t){return flushCommand(),getAttachedShaders(t)}function getAttribLocationOpt(t,e){return flushCommand(),getAttribLocation(t,e)}function getBufferParameterOpt(t,e){return flushCommand(),getBufferParameter(t,e)}function getParameterOpt(t){return flushCommand(),getParameter(t)}function getErrorOpt(){return flushCommand(),getError()}function getFramebufferAttachmentParameterOpt(t,e,i){return flushCommand(),getFramebufferAttachmentParameter(t,e,i)}function getProgramParameterOpt(t,e){return flushCommand(),getProgramParameter(t,e)}function getProgramInfoLogOpt(t){return flushCommand(),getProgramInfoLog(t)}function getRenderbufferParameterOpt(t,e){return flushCommand(),getRenderbufferParameter(t,e)}function getShaderParameterOpt(t,e){return flushCommand(),getShaderParameter(t,e)}function getShaderPrecisionFormatOpt(t,e){return flushCommand(),getShaderPrecisionFormat(t,e)}function getShaderInfoLogOpt(t){return flushCommand(),getShaderInfoLog(t)}function getShaderSourceOpt(t){return flushCommand(),getShaderSource(t)}function getTexParameterOpt(t,e){return flushCommand(),getTexParameter(t,e)}function getUniformOpt(t,e){return flushCommand(),getUniform(t,e)}function getUniformLocationOpt(t,e){return flushCommand(),getUniformLocation(t,e)}function getVertexAttribOpt(t,e){return flushCommand(),getVertexAttrib(t,e)}function getVertexAttribOffsetOpt(t,e){return flushCommand(),getVertexAttribOffset(t,e)}function hintOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_HINT,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function isBufferOpt(t){return flushCommand(),isBuffer(t)}function isEnabledOpt(t){return flushCommand(),isEnabled(t)}function isFramebufferOpt(t){return flushCommand(),isFramebuffer(t)}function isProgramOpt(t){return flushCommand(),isProgram(t)}function isRenderbufferOpt(t){return flushCommand(),isRenderbuffer(t)}function isShaderOpt(t){return flushCommand(),isShader(t)}function isTextureOpt(t){return flushCommand(),isTexture(t)}function lineWidthOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_LINE_WIDTH,buffer_data[next_index+1]=t,next_index+=2}function linkProgramOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_LINK_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function pixelStoreiOpt(t,e){flushCommand(),pixelStorei(t,e)}function polygonOffsetOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_POLYGON_OFFSET,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function readPixelsOpt(t,e,i,r,n,a,o){flushCommand(),readPixels(t,e,i,r,n,a,o)}function renderbufferStorageOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_RENDER_BUFFER_STORAGE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=internalformat,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function sampleCoverageOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_SAMPLE_COVERAGE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e?1:0,next_index+=3}function scissorOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_SCISSOR,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function shaderSourceOpt(t,e){flushCommand(),shaderSource(t,e)}function stencilFuncOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_FUNC,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function stencilFuncSeparateOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_FUNC_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function stencilMaskOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_MASK,buffer_data[next_index+1]=t,next_index+=2}function stencilMaskSeparateOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_MASK_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function stencilOpOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_OP,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function stencilOpSeparateOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_OP_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function texImage2DOpt(t,e,i){switch(flushCommand(),arguments.length){case 6:var r=arguments[3],n=arguments[4],a=arguments[5];Object.prototype.hasOwnProperty.call(a,"__nativeObj")?gl.glTexImage2D(t,e,i,r,n,a.__nativeObj):Object.prototype.hasOwnProperty.call(a,"buffer")&&Object.prototype.hasOwnProperty.call(a.buffer,"eof")&&Object.prototype.hasOwnProperty.call(a.buffer,"pointer")&&Object.prototype.hasOwnProperty.call(a.buffer,"netOrder")&&a.width>0&&a.height>0&&gl.glTexImage2D(t,e,i,r,n,a);break;case 9:var o=arguments[3],s=arguments[4],h=arguments[5],r=arguments[6],n=arguments[7],_=arguments[8];gl.glTexImage2D(t,e,i,o,s,h,r,n,_)}}function texParameterfOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_TEX_PARAMETER_F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function texParameteriOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_TEX_PARAMETER_I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function texSubImage2DOpt(t,e,i,r,n,a,o,s,h){flushCommand(),texSubImage2D(t,e,i,r,n,a,o,s,h)}function texSubImage2DOpt(t,e,i,r,n,a,o){flushCommand(),texSubImage2D(t,e,i,r,n,a,o)}function uniform1fOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_1F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function uniform2fOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_2F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function uniform3fOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_3F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function uniform4fOpt(t,e,i,r,n){next_index+6>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_4F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,next_index+=6}function uniform1iOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_1I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function uniform2iOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_2I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function uniform3iOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_3I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function uniform4iOpt(t,e,i,r,n){next_index+6>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_4I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,next_index+=6}function uniform1fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_1FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform2fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_2FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform3fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_3FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform4fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_4FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform1ivOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_1IV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform2ivOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_2IV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform3ivOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_3IV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform4ivOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_4IV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniformMatrix2fvOpt(t,e,i){next_index+4+i.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_MATRIX_2FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i.length,buffer_data.set(i,next_index+4),next_index+=4+i.length}function uniformMatrix3fvOpt(t,e,i){next_index+4+i.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_MATRIX_3FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i.length,buffer_data.set(i,next_index+4),next_index+=4+i.length}function uniformMatrix4fvOpt(t,e,i){next_index+4+i.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_MATRIX_4FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i.length,buffer_data.set(i,next_index+4),next_index+=4+i.length}function useProgramOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_USE_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function validateProgramOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VALIDATE_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function vertexAttrib1fOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_1F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function vertexAttrib2fOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_2F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function vertexAttrib3fOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_3F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function vertexAttrib4fOpt(t,e,i,r,n){next_index+6>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_4F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,next_index+=6}function vertexAttrib1fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_1FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function vertexAttrib2fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_2FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function vertexAttrib3fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_3FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function vertexAttrib4fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_4FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function vertexAttribPointerOpt(t,e,i,r,n,a){next_index+7>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_POINTER,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r?1:0,buffer_data[next_index+5]=n,buffer_data[next_index+6]=a,next_index+=7}function viewportOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VIEW_PORT,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function isSupportTypeArray(){if("android"==GameStatusInfo.platform)return!0;var t=BK.Director.queryDeviceInfo(),e=t.version.split(".");return"ios"==t.platform&&Number(e[0])>=10}function attachMethodOpt(){gl.activeTexture=activeTextureOpt,gl.attachShader=attachShaderOpt,gl.bindAttribLocation=bindAttribLocationOpt,gl.bindBuffer=bindBufferOpt,gl.bindFramebuffer=bindFramebufferOpt,gl.bindRenderbuffer=bindRenderbufferOpt,gl.bindTexture=bindTextureOpt,gl.blendColor=blendColorOpt,gl.blendEquation=blendEquationOpt,gl.blendEquationSeparate=blendEquationSeparateOpt,gl.blendFunc=blendFuncOpt,gl.blendFuncSeparate=blendFuncSeparateOpt,gl.bufferData=bufferDataOpt,gl.bufferData=bufferDataOpt,gl.bufferSubData=bufferSubDataOpt,gl.checkFramebufferStatus=checkFramebufferStatusOpt,gl.clear=clearOpt,gl.clearColor=clearColorOpt,gl.clearDepth=clearDepthOpt,gl.clearStencil=clearStencilOpt,gl.colorMask=colorMaskOpt,gl.compileShader=compileShaderOpt,gl.compressedTexImage2D=compressedTexImage2DOpt,gl.compressedTexSubImage2D=compressedTexSubImage2DOpt,gl.copyTexImage2D=copyTexImage2DOpt,gl.copyTexSubImage2D=copyTexSubImage2DOpt,gl.createBuffer=createBufferOpt,gl.createFramebuffer=createFramebufferOpt,gl.createProgram=createProgramOpt,gl.createRenderbuffer=createRenderbufferOpt,gl.createShader=createShaderOpt,gl.createTexture=createTextureOpt,gl.cullFace=cullFaceOpt,gl.deleteBuffer=deleteBufferOpt,gl.deleteFramebuffer=deleteFramebufferOpt,gl.deleteProgram=deleteProgramOpt,gl.deleteRenderbuffer=deleteRenderbufferOpt,gl.deleteShader=deleteShaderOpt,gl.deleteTexture=deleteTextureOpt,gl.depthFunc=depthFuncOpt,gl.depthMask=depthMaskOpt,gl.depthRange=depthRangeOpt,gl.detachShader=detachShaderOpt,gl.disable=disableOpt,gl.disableVertexAttribArray=disableVertexAttribArrayOpt,gl.drawArrays=drawArraysOpt,gl.drawElements=drawElementsOpt,gl.enable=enableOpt,gl.enableVertexAttribArray=enableVertexAttribArrayOpt,gl.finish=finishOpt,gl.flush=flushOpt,gl.framebufferRenderbuffer=framebufferRenderbufferOpt,gl.framebufferTexture2D=framebufferTexture2DOpt,gl.frontFace=frontFaceOpt,gl.generateMipmap=generateMipmapOpt,gl.getActiveAttrib=getActiveAttribOpt,gl.getActiveUniform=getActiveUniformOpt,gl.getAttachedShaders=getAttachedShadersOpt,gl.getAttribLocation=getAttribLocationOpt,gl.getBufferParameter=getBufferParameterOpt,gl.getParameter=getParameterOpt,gl.getError=getErrorOpt,gl.getFramebufferAttachmentParameter=getFramebufferAttachmentParameterOpt,gl.getProgramParameter=getProgramParameterOpt,gl.getProgramInfoLog=getProgramInfoLogOpt,gl.getRenderbufferParameter=getRenderbufferParameterOpt,gl.getShaderParameter=getShaderParameterOpt,gl.getShaderPrecisionFormat=getShaderPrecisionFormatOpt,gl.getShaderInfoLog=getShaderInfoLogOpt,gl.getShaderSource=getShaderSourceOpt,gl.getTexParameter=getTexParameterOpt,gl.getUniform=getUniformOpt,gl.getUniformLocation=getUniformLocationOpt,gl.getVertexAttrib=getVertexAttribOpt,gl.getVertexAttribOffset=getVertexAttribOffsetOpt,gl.hint=hintOpt,gl.isBuffer=isBufferOpt,gl.isEnabled=isEnabledOpt,gl.isFramebuffer=isFramebufferOpt,gl.isProgram=isProgramOpt,gl.isRenderbuffer=isRenderbufferOpt,gl.isShader=isShaderOpt,gl.isTexture=isTextureOpt,gl.lineWidth=lineWidthOpt,gl.linkProgram=linkProgramOpt,gl.pixelStorei=pixelStoreiOpt,gl.polygonOffset=polygonOffsetOpt,gl.readPixels=readPixelsOpt,gl.renderbufferStorage=renderbufferStorageOpt,gl.sampleCoverage=sampleCoverageOpt,gl.scissor=scissorOpt,gl.shaderSource=shaderSourceOpt,gl.stencilFunc=stencilFuncOpt,gl.stencilFuncSeparate=stencilFuncSeparateOpt,gl.stencilMask=stencilMaskOpt,gl.stencilMaskSeparate=stencilMaskSeparateOpt,gl.stencilOp=stencilOpOpt,gl.stencilOpSeparate=stencilOpSeparateOpt,gl.texImage2D=texImage2DOpt,gl.texImage2D=texImage2DOpt,gl.texParameterf=texParameterfOpt,gl.texParameteri=texParameteriOpt,gl.texSubImage2D=texSubImage2DOpt,gl.texSubImage2D=texSubImage2DOpt,gl.uniform1f=uniform1fOpt,gl.uniform2f=uniform2fOpt,gl.uniform3f=uniform3fOpt,gl.uniform4f=uniform4fOpt,gl.uniform1i=uniform1iOpt,gl.uniform2i=uniform2iOpt,gl.uniform3i=uniform3iOpt,gl.uniform4i=uniform4iOpt,gl.uniform1fv=uniform1fvOpt,gl.uniform2fv=uniform2fvOpt,gl.uniform3fv=uniform3fvOpt,gl.uniform4fv=uniform4fvOpt,gl.uniform1iv=uniform1ivOpt,gl.uniform2iv=uniform2ivOpt,gl.uniform3iv=uniform3ivOpt,gl.uniform4iv=uniform4ivOpt,gl.uniformMatrix2fv=uniformMatrix2fvOpt,gl.uniformMatrix3fv=uniformMatrix3fvOpt,gl.uniformMatrix4fv=uniformMatrix4fvOpt,gl.useProgram=useProgramOpt,gl.validateProgram=validateProgramOpt,gl.vertexAttrib1f=vertexAttrib1fOpt,gl.vertexAttrib2f=vertexAttrib2fOpt,gl.vertexAttrib3f=vertexAttrib3fOpt,gl.vertexAttrib4f=vertexAttrib4fOpt,gl.vertexAttrib1fv=vertexAttrib1fvOpt,gl.vertexAttrib2fv=vertexAttrib2fvOpt,gl.vertexAttrib3fv=vertexAttrib3fvOpt,gl.vertexAttrib4fv=vertexAttrib4fvOpt,gl.vertexAttribPointer=vertexAttribPointerOpt,gl.viewport=viewportOpt,gl.glCommit=glCommitOpt}function __dispatchEvent(t,e,i){BK.Script.log(0,0,"__dispatchEvent err:"+t+" cmd:"+e+" data:"+i),Array.isArray(__browserMsgHdl.listenerInfos)&&__browserMsgHdl.listenerInfos.length<=0&&"sc.init_global_var.local"==e&&(GameStatusInfo=JSON.parse(i)),__browserMsgHdl.listenerInfos.forEach(function(r){if(r.cmd==e){var n=r.callback;try{n(t,e,JSON.parse(i))}catch(t){console.log(t),BK.Script.log(0,0,"JSON parse error:"+t+" data: "+i)}}},this),BK.MQQ.SsoRequest.listenerInfos.forEach(function(r){if(r.cmd==e){var n=r.callback;try{"cs.get_file_data.local"==e?n(t,e,i):n(t,e,JSON.parse(i))}catch(t){console.log(t),BK.Script.log(0,0,"JSON parse error:"+t+" data: "+i)}}},this)}function SandBoxCanvas(){var t=arguments.length;this._shadowColor={r:0,g:0,b:0,a:0},this._shadowOffset={x:0,y:0},this._shadowRadius=0,this._textBaseLine=0,this._textAlign=0,this._useH5Mode=0,this._a=1,this._b=0,this._c=0,this._d=1,this._tx=0,this._ty=0,2==t&&(this.__nativeObj=new BK.SandBoxCanvasNode(arguments[0],arguments[1]),this.setFlipXY(0,1),Object.getOwnPropertyNames(this.__nativeObj).forEach(function(t){var e=t;"scale"!=e&&"transform"!=e&&"contentSize"!=e&&"size"!=e&&"fontPath"!=e&&Object.defineProperty(this,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this),Object.defineProperty(SandBoxCanvas.prototype,"fontPath",{get:function(){return this.__nativeObj.fontPath},set:function(t){BK.FileUtil.isFileExist(t)&&(this.__nativeObj.fontPath=t)},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"contentSize",{get:function(){return this.__nativeObj.contentSize},set:function(t){this.__nativeObj.contentSize=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"size",{get:function(){return this.__nativeObj.size},set:function(t){this.__nativeObj.size=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"textBaseline",{get:function(){return this._textBaseLine},set:function(t){switch(t){case 0:case 1:case 2:this._textBaseLine=t;break;case"bottom":case"Bottom":this._textBaseLine=0;break;case"Middle":case"middle":this._textBaseLine=1;break;case"Top":case"top":this._textBaseLine=2}},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"textAlign",{get:function(){return this._textAlign},set:function(t){switch(t){case 0:case 1:case 2:this._textAlign=t;break;case"left":this._textAlign=0;break;case"center":this._textAlign=1;break;case"right":this._textAlign=2}this.__nativeObj.setTextAlign(this._textAlign)},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"lineWidth",{get:function(){return this.__nativeObj.lineWidth},set:function(t){this.__nativeObj.lineWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"globalAlpha",{get:function(){return this.__nativeObj.globalAlpha},set:function(t){t=Math.min(1,t),t=Math.max(0,t),this.__nativeObj.globalAlpha=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"fillColor",{get:function(){return this.__nativeObj.fillColor},set:function(t){this.__nativeObj.fillColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"strokeColor",{get:function(){return this.__nativeObj.strokeColor},set:function(t){this.__nativeObj.strokeColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"lineCap",{get:function(){return this.__nativeObj.lineCap},set:function(t){this.__nativeObj.lineCap=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"lineJoin",{get:function(){return this.__nativeObj.lineJoin},set:function(t){this.__nativeObj.lineJoin=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"miterLimit",{get:function(){return this.__nativeObj.miterLimit},set:function(t){this.__nativeObj.miterLimit=t},enumerable:!0,configurable:!0}))}var hasBK=!("object"!=typeof BK),isBrowser=!hasBK;if(isBrowser)"undefined"!=typeof BK==0&&(BK={},BK.isBrowser=!0),function(t,e){if("object"==typeof t){var i=function(){var t=function(){function t(){}return t.open=function(t){e.send({url:t},"cs.openWebView.local")},t.openTransparent=function(t,i,r){void 0===i&&(i=1);var n="cs.openWebViewWithoutUrl.local";r&&(__browserMsgHdl.removeListener(n,this),__browserMsgHdl.addListener(n,this,r)),e.send({url:t},n)},t.closeTransparent=function(t){e.send({taskId:t},"cs.closeWebview.local")},t.onMessageHandle=function(t){},t}(),e=function(){function t(){}return t.ssoRequestCallBack=function(t,e,i){BK.Script.log(0,0,"ssoRequestCallBack cmd:"+e+" errCode:"+t+" data:"+JSON.stringify(i)),__dispatchEvent(t,i.cmd,JSON.stringify(i.data))},t.sendSSO=function(e,i){__browserMsgHdl.addListener("cs.ssoMessage.local",this,this.ssoRequestCallBack),t.send({cmd:i,data:JSON.stringify(e)},"cs.ssoMessage.local")},t.addListener=function(t,e,i){__browserMsgHdl.addListener(t,e,i)},t.removeListener=function(t,e){__browserMsgHdl.removeListener(t,e)},t.send=function(t,e){-1!=e.indexOf("cs.")&&-1!=e.indexOf(".local")?"undefined"!=typeof __browserMsg?__browserMsg.send(JSON.stringify(t),e):void 0!==window.webkit.messageHandlers&&window.webkit.messageHandlers.cmWebGameSend.postMessage({data:JSON.stringify(t),cmd:e}):BK.MQQ.SsoRequest.sendSSO(t,e)},t.sendWebMessage=function(e,i){t.send({cmd:i,data:JSON.stringify(e)},"sc.web_callback_game.local")},t}(),i=function(){function t(){}return t.accountCallBack=function(e,i,r){var n="0";1===r.nickname?n="1":1===r.avatar&&(n="2");var a=i+"_"+n;t.accountCallBackArr[a]&&(0,t.accountCallBackArr[a])(r.openId,r.data)},t.getNick=function(e,i){t.accountCallBackArr["cs.get_userInfo.local_1"]=i,BK.MQQ.SsoRequest.addListener("cs.get_userInfo.local",this,this.accountCallBack),BK.MQQ.SsoRequest.send({openId:e,nickname:1},"cs.get_userInfo.local")},t.getHead=function(e,i){t.accountCallBackArr["cs.get_userInfo.local_2"]=i,BK.MQQ.SsoRequest.addListener("cs.get_userInfo.local",this,this.accountCallBack),BK.MQQ.SsoRequest.send({openId:e,avatar:1},"cs.get_userInfo.local")},t.accountCallBackArr=[],t}(),r=function(){function t(){}return t.log=function(t,e,i){"undefined"!=typeof GameStatusInfo&&this.compareVersion(GameStatusInfo.QQVer,"7.6.0")>=0&&("undefined"!=typeof __browserMsg?__browserMsg.log(t,e,"webGame_log",i,""):void 0!==window.webkit.messageHandlers&&window.webkit.messageHandlers.cmWebGameLog.postMessage({level:t,errcode:e,info1:"webGame_log",info2:i,info3:""}))},t.compareVersion=function(e,i){var r=e.split("."),n=i.split("."),a=r[0]-n[0];return 0==a&&e!=i?t.compareVersion(r.splice(1).join("."),n.splice(1).join(".")):a},t}(),n=function(){function t(){}return t.base64ToUint8Array=function(t){var e,i,r,n,a,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=.75*t.length,h=t.length,_=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var l=new ArrayBuffer(s),d=new Uint8Array(l);for(e=0;e<h;e+=4)i=o.indexOf(t[e]),r=o.indexOf(t[e+1]),n=o.indexOf(t[e+2]),a=o.indexOf(t[e+3]),d[_++]=i<<2|r>>4,d[_++]=(15&r)<<4|n>>2,d[_++]=(3&n)<<6|63&a;return d},t.upload=function(t,e,i){var r=t.length>1024?1024:t.length,n=t.slice(0,r),a=BK.Crypt.core_md5(n,r),o=new Date,s=o.getFullYear()+(o.getMonth()+1<10?0+(o.getMonth()+1):o.getMonth()+1)+o.getDate(),h=e.tmpSecretId,_=e.upLoadPrefUrl,l=e.downloadUrl,d=e.sessionToken,c=e.signature,u=e.signTime,f="/"+GameStatusInfo.gameId+"_"+BK.Crypt.bin2hex(a)+GameStatusInfo.gameId+"_"+s+".png";_=_.replace(new RegExp("http://","gm"),"");var g="put\n"+f+"\n\nhost="+_+"&x-cos-storage-class=nearline\n",m="sha1\n"+u+"\n"+BK.Crypt.hex_sha1(g)+"\n",p="q-sign-algorithm=sha1&q-ak="+h+"&q-sign-time="+u+"&q-key-time="+u+"&q-header-list=host;x-cos-storage-class&q-url-param-list=&q-signature="+BK.Crypt.hex_hmac_sha1(c,m),v=new XMLHttpRequest;v.onreadystatechange=function(){4==this.readyState&&(200==this.status?(BK.Script.log(0,0," on response res = "+this.status+" "+JSON.stringify(this.HEADERS_RECEIVED)),l.charAt(l.length-1)==f.charAt(0)&&"/"==f.charAt(0)&&(l=l.slice(0,l.length-1)),i(this.status,l+f)):i(this.status,""))},v.open("put","https://"+_+f,!0),v.setRequestHeader("x-cos-storage-class","nearline"),v.setRequestHeader("x-cos-security-token",d),v.setRequestHeader("authorization",p),v.send(t)},t.uploadFromFile=function(t,e){var i="cs.get_file_data.local",r={cmd:i,path:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){var n=BK.FileUtil.base64ToUint8Array(r);BK.FileUtil.uploadFromBuff(n,e)}),BK.MQQ.SsoRequest.send(r,i))},t.uploadFromBuff=function(t,e){BK.QQ.queryCloudSignature(function(i,r){BK.FileUtil.upload(t,r,e)})},t}(),a=function(){function t(){}return t.shareToMQQ=function(t,i,r,n){var a="cs.share_game_result.local",o={cmd:a,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,gameVersion:GameStatusInfo.gameVersion,roomId:GameStatusInfo.roomId,title:t,summary:i,detailUrl:r,picUrl:n};e.send(o,a)},t.getRankList=function(e,i){var r={cmd:this.CMSHOW_SRV_GET_RANK_LIST,from:"default",objType:1,objId:0,busType:3,busId:GameStatusInfo.gameId.toString()};i&&(i.objType&&(r.objType=i.objType),i.objId&&(r.objId=i.objId),i.from&&(r.from=i.from)),BK.Script.log(1,1,"BK.QQ.reqGetRankList! "+JSON.stringify(r)),void 0!=r?(t._getRankListCallBack=e,BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SRV_GET_RANK_LIST,this),BK.MQQ.SsoRequest.addListener(this.CMSHOW_SRV_GET_RANK_LIST,this,this._event4GetRankList),BK.MQQ.SsoRequest.sendSSO(r,this.CMSHOW_SRV_GET_RANK_LIST)):BK.Script.log(0,0,"reqGetRankList data undefined!")},t.consumeItems=function(t,e){var i="apollo_game_item.consume_game_items",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){var n=[],a=[];0==t&&(n=r.data.succList,a=r.data.failList),e(t,n,a)})),BK.MQQ.SsoRequest.sendSSO(r,i)},t.getUserGameItems=function(t){var e="apollo_aio_game.get_user_game_items",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){if(void 0!=r){var n={};n.data=r.data,t(e,i,n)}})),BK.MQQ.SsoRequest.sendSSO(i,e)},t.buyGameItems=function(t,e,i){var r="apollo_aio_game.buy_game_items",n={cmd:r,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,curreType:t,itemIdList:e};i&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,function(t,e,r){if(void 0!=r){var n={};n.data=r.data,i(t,e,n)}})),BK.MQQ.SsoRequest.sendSSO(n,r)},t.queryCloudSignature=function(t){var e="cs.fetch_cloud_signature.local",i={cmd:e,now:(new Date).getTime()/1e3-1,delta:600};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(i,e))},t.notifyCloseGame=function(){var t={gameId:GameStatusInfo.gameId,roomId:0};BK.Script.log(0,0,"BK.QQ.notifyCloseGame!gameId = "+t.gameId+", roomId = "+t.roomId),BK.MQQ.SsoRequest.send(t,"cs.close_room.local")},t.CMSHOW_SRV_GET_RANK_LIST="apollo_router_game.game_rank_linkcmd_get_fri_rank_for_engine",t.shareToArk=function(t,i,r,n,a,o){"boolean"==typeof n&&(n=1==n?1:0);var s="cs.share_game_in_ark.local",h="sc.share_game_to_friend_result.local";"android"==GameStatusInfo.platform&&0==GameStatusInfo.QQVer.indexOf("7.6.0")&&(s="cs.game_shell_share_callback.local");var _={cmd:s,summary:i,picUrl:r,gameId:GameStatusInfo.gameId,roomId:t,gameMode:GameStatusInfo.gameMode,isSelectFriend:n,extendInfo:a};BK.Script.log(0,0,"ShareToArk summary="+_.summary+" roomId="+_.roomId+" gameMode="+_.gameMode+"picUrl="+_.picUrl+" gameId="+_.gameId),o&&(BK.MQQ.SsoRequest.removeListener(h,this),BK.MQQ.SsoRequest.addListener(h,this,o)),e.send(_,s)},t.shareToArkFromFile=function(t,e,i,r){BK.FileUtil.uploadFromFile(r,function(r,n){BK.QQ.shareToArk(t,e,n,!0,i)})},t.shareToArkFromBuff=function(t,e,i,r){BK.FileUtil.uploadFromBuff(r,function(r,n){200==r&&BK.QQ.shareToArk(t,e,n,!0,i)})},t.fetchOpenKey=function(t){var e="cs.on_get_open_key.local",i={gameId:GameStatusInfo.gameId};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(i,e)},t.scoreUpload=function(t,e,i){var r="apollo_aio_game.report_user_score_3rd",n={cmd:r,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,roomId:GameStatusInfo.roomId,gData:t};i&&(n.arkData=i),e&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,e)),BK.MQQ.SsoRequest.sendSSO(n,r)},t._getRankListCallBack=void 0,t._event4GetRankList=function(e,i,r){BK.Script.log(1,1,"BK.QQ.reqGetRankList! callback cmd:"+i+" errCode:"+e+" data:"+JSON.stringify(r)),void 0!=t._getRankListCallBack&&t._getRankListCallBack(e,i,r),BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SRV_GET_RANK_LIST,this)},t.uploadScoreWithoutRoom=function(t,e,i){var r="apollo_report_result.single_user_result",n=Math.floor((new Date).getTime()/1e3),a={from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,aioType:1,ts:n.toString(),src:GameStatusInfo.src,mode:void 0!==t?t:1,userData:e.userData,attr:e.attr};i&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,i)),BK.MQQ.SsoRequest.sendSSO(a,r)},t.getRankListWithoutRoom=function(t,e,i,r){var n="apollo_router_game.apollo_user_rankinglist_linkcmd_custom_ranking",a=Math.floor((new Date).getTime()/1e3),o={from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,ts:a.toString(),attr:void 0!==t?t:"score",order:void 0!==e?e:1,rankType:void 0!==i?i:0};r&&(BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,r)),BK.MQQ.SsoRequest.sendSSO(o,n)},t.qPayPurchase=function(t,e,i,r){var n=1,a={gameOrientation:t,transparent:n=1==e?1:0,businessType:2,url:"https://cmshow.qq.com/apollo/html/game-platform/buy-props.html?_wv=3&adtag=inside_game&gameId="+GameStatusInfo.gameId+"&gameOrientation="+t+"&itemList="+encodeURI(JSON.stringify(i))};if(r){var o="sc.apolloGameWebMessage.local";BK.MQQ.SsoRequest.removeListener(o,this),BK.MQQ.SsoRequest.addListener(o,this,function(t,e,i){0==t&&i.op&&"apolloGamePlatform.buyProps"==i.op&&r(i.data.code,i.data)}.bind(this))}BK.MQQ.SsoRequest.send(a,"cs.openWebViewWithoutUrl.local")},t.getGameItemList=function(t){var e="apollo_aio_game.get_game_itemList",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.sendSSO(i,e)},t.rollbackGameItems=function(t,e){var i="apollo_game_item.rollback_game_items",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){var n=[],a=[];0==t&&(n=r.data.succList,a=r.data.failList),e(t,n,a)}.bind(this))),BK.MQQ.SsoRequest.sendSSO(r,i)},t.uploadData=function(t,e,i,r,n,a){var o="cs.report_data_2_compass.local",s=GameStatusInfo.gameId;"ios"==GameStatusInfo.platform&&(t=t.toString(),i=i.toString());var h={cmd:o,actionName:t,enter:e,entry:e,result:i,r2:s.toString(),r3:r,r4:n,r5:a};BK.MQQ.SsoRequest.sendSSO(h,o)},t.saveGameData=function(t,e){var i="apollo_private_data.set_user_data",r=Math.floor((new Date).getTime()/1e3),n={openId:GameStatusInfo.openId,gameId:GameStatusInfo.gameId,version:GameStatusInfo.gameVersion,from:GameStatusInfo.platform,ts:r.toString(),data:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(n,i)},t.loadGameData=function(t){var e="apollo_private_data.get_user_data",i=Math.floor((new Date).getTime()/1e3),r={openId:GameStatusInfo.openId,gameId:GameStatusInfo.gameId,version:GameStatusInfo.gameVersion,from:GameStatusInfo.platform,ts:i.toString()};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(r,e)},t.reportGameResult=function(t,e){var i="apollo_router_game.apollo_reportcm_linkcmd_game_result";t.gameId=GameStatusInfo.gameId,e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(t,i)},t.sendB2CRedPacket=function(t,e){if(e){var i="sc.send_b2c_redpacket_result.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){e(t,i,r),BK.MQQ.SsoRequest.removeListener(i,this)})}var r={groupPushData:{gameRedPacketId:1,gameId:GameStatusInfo.gameId,extraInfo:t}};BK.Script.log(1,1,"sendB2CRedPacket:"+JSON.stringify(r)),BK.MQQ.SsoRequest.send(r,"cs.send_b2c_redpacket.local"),BK.Script.log(0,0,"sendB2CRedPacket")},t}(),o=function(){function t(){}return t.close=function(){BK.MQQ.SsoRequest.sendWebMessage({},"cs.close_room.local")},t.packUp=function(){BK.MQQ.SsoRequest.sendWebMessage({},"cs.make_room_min.local")},t}(),s=function(){function t(){}return t}();return{Webview:t,SsoRequest:e,Account:i,Script:r,FileUtil:n,QQ:a,Game:o,Misc:s}}();void 0===t.MQQ&&(t.MQQ={Webview:i.Webview,SsoRequest:i.SsoRequest,Account:i.Account}),void 0===t.FileUtil&&(t.FileUtil=i.FileUtil),void 0===t.Script&&(t.Script=i.Script),void 0===t.QQ&&(t.QQ=i.QQ),void 0===t.Game&&(t.Game=i.Game),void 0===t.Misc&&(t.Misc=i.Misc)}}(BK),function(t,e){e.Script.setErrorObserver=function(t){},t._globalErrorCallback_=function(t){}}(this,BK),BK.Misc.compQQVersion||(BK.Misc.compQQVersion=function(t,e){for(var i=t.split("."),r=e.split("."),n=Math.min(3,Math.min(i.length,r.length)),a=0;a<n;a++)if(i[a]!=r[a])return i[a]<r[a];return!0},BK.Misc.qqVerLessthan=function(t,e){for(var i=t.split("."),r=e.split("."),n=Math.min(3,Math.min(i.length,r.length)),a=0;a<n;a++)if(i[a]<r[a])return!0;return!1});else{!function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Emitter=e())}(BK,function(){var t=function(){function t(t,e,i){this.once=i,this.target=t,this.callback=e}return t}();return function(){function e(){this._emits={}}return e.prototype.__emit_get=function(t){return this._emits[t]||(this._emits[t]=new Array),this._emits[t]},e.prototype.__emit_put=function(t,e){this.__emit_get(t).push(e)},e.prototype.__emit_exists=function(t,e){for(var i=this.__emit_get(t),r=!1,n=0;n<i.length;n++)if(i[n].target==e){r=!0;break}return r},e.prototype.dispose=function(){delete this._emits},e.prototype.on=function(e,i,r,n){if(0==this.__emit_exists(e,i)){var a=new t(i,r,n);this.__emit_put(e,a)}else BK.Script.log(0,0,"BK.bkEmitter.on!has found, event = "+e+", target = "+JSON.stringify(i))},e.prototype.off=function(t,e){for(var i=this.__emit_get(t),r=0;r<i.length;r++)if(i[r].target==e){i.splice(r,1);break}},e.prototype.offAll=function(t){Object.keys(this._emits).forEach(function(e){this.off(e,t)}.bind(this))},e.prototype.emitAll=function(t,e){for(var i=new Array,r=this.__emit_get(t),n=0;n<r.length;n++){var a={event:t,source:this,target:r[n].target,extras:e};r[n].callback&&r[n].callback(a),1==r[n].once&&i.push(r[n].target)}for(var o=0;o<i.length;o++)this.off(t,i[o])},e.prototype.emitOnce=function(t,e){for(var i=new Array,r=this.__emit_get(t),n=0;n<r.length;n++)if(1==r[n].once){var a={event:t,source:this,target:r[n].target,extras:e};i.push(r[n].target),r[n].callback&&r[n].callback(a)}for(var o=0;o<i.length;o++)this.off(t,i[o])},e}()}),function(){function t(t){var e,i,n,a,o,s=.75*t.length,h=t.length,_=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var l=new ArrayBuffer(s);for(bytes=new Uint8Array(l),e=0;e<h;e+=4)i=r.indexOf(t[e]),n=r.indexOf(t[e+1]),a=r.indexOf(t[e+2]),o=r.indexOf(t[e+3]),bytes[_++]=i<<2|n>>4,bytes[_++]=(15&n)<<4|a>>2,bytes[_++]=(3&a)<<6|63&o;return l}function e(t,e,i){var n,a=new Uint8Array(t,e||0,i||t.byteLength),o=a.length,s="";for(n=0;n<o;n+=3)s+=r[a[n]>>2],s+=r[(3&a[n])<<4|a[n+1]>>4],s+=r[(15&a[n+1])<<2|a[n+2]>>6],s+=r[63&a[n+2]];return o%3==2?s=s.substring(0,s.length-1)+"=":o%3==1&&(s=s.substring(0,s.length-2)+"=="),s}function i(t){function e(t,e){var i=e.length,r={type:t};switch(t){case 0:for(o=0;i>0;){var n=Math.min(i,4096),a=new Int8Array(e.buffer,o*Int8Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,a),o+=4096,i-=4096}break;case 1:for(o=0;i>0;){var n=Math.min(i,4096),a=new Int16Array(e.buffer,o*Int16Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,a),o+=4096,i-=4096}break;case 2:for(o=0;i>0;){var n=Math.min(i,4096),a=new Int32Array(e.buffer,o*Int32Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,a),o+=4096,i-=4096}break;case 3:for(o=0;i>0;){var n=Math.min(i,4096),a=new Uint8Array(e.buffer,o*Uint8Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,a),o+=4096,i-=4096}break;case 5:for(o=0;i>0;){var n=Math.min(i,4096),a=new Uint16Array(e.buffer,o*Uint16Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,a),o+=4096,i-=4096}break;case 6:for(o=0;i>0;){var n=Math.min(i,4096),a=new Uint32Array(e.buffer,o*Uint32Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,a),o+=4096,i-=4096}break;case 7:for(var o=0;i>0;){var n=Math.min(i,4096),a=new Float32Array(e.buffer,o*Float32Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,a),o+=4096,i-=4096}}}return t instanceof Int8Array==!0?e(0,t):t instanceof Int16Array==!0?e(1,t):t instanceof Int32Array==!0?e(2,t):t instanceof Uint8Array==!0?e(3,t):t instanceof Uint16Array==!0?e(5,t):t instanceof Uint32Array==!0?e(6,t):t instanceof Float32Array==!0&&e(7,t),BK.Misc.getTransferedArrayBuffer()}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";BK.Misc.BKBufferToArrayBuffer=function(e){return e.rewind(),t(BK.Misc.encodeBase64FromBuffer(e))},BK.Misc.arrayBufferToBKBuffer=function(t,i,r){var n=e(t,i,r);return BK.Misc.decodeBase64FromString(n)},BK.Misc.typedArrayToBKBuffer=function(t){return BK.Misc.transferArrayBuffer?i(t):BK.Misc.arrayBufferToBKBuffer(t.buffer,t.byteOffset,t.byteLength)}}(),enGameHallSucc=0,eReqDataLenErr=1e3,eReqMagicErr=1001,eReqFrontCmdErr=1002,eReqBackCmdErr=1003,eReqBackSrcErr=1004,eReqFromIdErr=1005,eSTDecryErr=1006,eReqDecryErr=1007,eSTExpire=1008,eSystmeErr=1009,eVerUnvalid=1010,eReqLimit=1011,eGetSvrErr=1012,eInitMemErr=2001,eQueryMemErr=2002,eUpdateMemErr=2003,eDelMemErr=2004,eGetConfigErr=2005,eNotifyCreateErr=2006,eGetRoomIdErr=2007,eCmdInvalid=2008,eRoomNotExist=2009,eInBlackList=2010,eMatchTimeOut=2011,eGetRoomErr=3e3,eRoomStatusErr=3001,eIsNotCreator=3002,eIsNotInRoom=3003,eFlushTsErr=3004,eLogoutIdErr=3005,eIsNotInSvc=3006,eUsrOverFlow=3007,eRoomOverFlow=3008,eRoomIsExist=3009,eRmvUsrErr=3010,eLoginSysErr=3011,eUsrHasLoginErr=3012,eRoomIsFullErr=3013,eCreateRoomErr=3014,ePlayerHasJoin=3015,eUgcDataAnti=3020,eFowardToClientErr=4e3,eFowardToSvrErr=4001;var DebugRecommandRoomSvrHost="139.199.216.130",DebugRecommandRoomSvrPort=10060,NormalRecommandRoomSvrHost="139.199.216.128",NormalRecommandRoomSvrPort=10060,TLVType=new Object;TLVType.Int8=33,TLVType.Uint8=34,TLVType.Int16=33,TLVType.Uint16=36,TLVType.Int32=37,TLVType.Uint32=38,TLVType.Int64=39,TLVType.Uint64=40,TLVType.Byte=41,TLVType.Double=42,TLVType.Float=43,TLVType.Int8Repeated=49,TLVType.Uint8Repeated=50,TLVType.Int16Repeated=51,TLVType.Uint16Repeated=52,TLVType.Int32Repeated=53,TLVType.Uint32Repeated=54,TLVType.Int64Repeated=55,TLVType.Uint64Repeated=56,TLVType.ByteRepeated=57,TLVType.DoubleRepeated=58,TLVType.FloatRepeated=59;var fixedHeaderLen=120,HeaderLen=12,currentGameMode=GameStatusInfo.gameMode,fromPlatform=GameStatusInfo.platform,currentAioType=GameStatusInfo.aioType,currentPlayerOpenId=GameStatusInfo.openId,isMaster=GameStatusInfo.isMaster;NETWORK_ENVIRONMENT_QQ_RELEASE=0,NETWORK_ENVIRONMENT_QQ_DEBUG=1,NETWORK_ENVIRONMENT_DEMO_DEV=2,CMSHOW_SRV_CMD_JOIN_ROOM="apollo_aio_game.join_room",CMSHOW_SRV_CMD_QUIT_GAME="apollo_aio_game.quit_room",CMSHOW_SRV_CMD_START_GAME="apollo_aio_game.start_game",CMSHOW_SRV_CMD_CANCEL_GAME="apollo_aio_game.cancel_game_room",CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC="apollo_game_openapi.custom_game_logic",CMSHOW_SRV_GET_RANK_LIST="apollo_router_game.game_rank_linkcmd_get_fri_rank_for_engine",CMSHOW_SC_CMD_STOP_GAME="sc.force_stop_game.local",CMSHOW_CS_CMD_MINI_WND="cs.make_room_min.local",CMSHOW_CS_CMD_CLOSE_WND="cs.close_room.local",CMSHOW_CS_CMD_CREATE_ROOM="cs.create_room.local",CMSHOW_CS_CMD_JOIN_ROOM="cs.join_room.local",CMSHOW_CS_CMD_SEND_GAME_MSG="cs.send_game_msg.local",CMSHOW_CS_CMD_GAME_TIPS="cs.game_tips.local",CMSHOW_CS_CMD_GET_PLAYER_DRESS="cs.get_dress_path.local",CMSHOW_CS_CMD_GAME_READY="cs.game_ready.local",CMSHOW_CS_CMD_GAME_START="cs.game_start.local",CMSHOW_CS_CMD_SAVE_RECOMM_VIP="cs.save_recommend_ip.local",CMSHOW_CS_CMD_GET_SRV_IP_PORT="cs.get_server_ip_port.local",CMSHOW_CS_CMD_CHECK_PUBACCOUNT_STATE="cs.check_pubAccount_state.local",CMSHOW_CS_CMD_ENTER_PUBACCOUNT_CARD="cs.enter_pubAccount_card.local",CMSHOW_CS_CMD_SHARE_PIC="cs.share_pic.local",CMSHOW_CS_CMD_SHARE_IN_ARK="cs.share_game_in_ark.local",CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE="cs.fetch_cloud_signature.local",CMSHOW_AIO_PAUSE="sc.aio_pause.local",CMSHOW_AIO_RESUME="sc.aio_resume.local",CMD_CMSHOW_GAME_ENTER_BACKGROUND="sc.game_enter_background.local",CMD_CMSHOW_GAME_ENTER_FORGROUND="sc.game_enter_foreground.local",CMD_CMSHOW_GAME_MAXIMIZE="sc.game_maximize.local",CMD_CMSHOW_GAME_MINIMIZE="sc.game_minimize.local",CMSHOW_CS_CMD_AUDIOROOM_ENTERN="cs.audioRoom_enter.local",CMSHOW_CS_CMD_AUDIOROOM_EXIT="cs.audioRoom_exit.local",CMSHOW_CS_CMD_AUDIOROOM_UPDATEUSERINFO="cs.audioRoom_update_userinfo.local",CMSHOW_CS_CMD_AUDIOROOM_SET_MIC="cs.audioRoom_set_mic.local",CMSHOW_CS_CMD_AUDIOROOM_SET_SPEAKER="cs.audioRoom_set_speaker.local",CMSHOW_CS_CMD_AUDIOROOM_INIT="cs.audioRoom_init.local",CMSHOW_CS_CMD_AUDIOROOM_DISCONNECT="cs.audioRoom_disconnect.local",CMSHOW_CS_CMD_AUDIOROOM_CAMERASWITCH="cs.audioRoom_cameraswitch.local",CMSHOW_CS_CMD_AUDIOROOM_SET_BEAUTY="cs.audioRoom_set_beauty.local",CMSHOW_CS_CMD_AUDIOROOM_REQ_AUDIO_SESSION="cs.audioRoom_req_audio_session.local",CMSHOW_CS_CMD_LOAD_PACKAGE="cs.load_subpackage.local",CMSHOW_CS_CMD_LOAD_PERCENTAGE_NOTIFY="sc.load_percentage_nofity.local",CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK="cs.file_correctness_check.local",CMSHOW_CS_CMD_SHOW_ONE_MORE_PAGE="cs.show_one_more_page.local";var currentRenderMode,glpause;checkRenderMode=function(){0==currentRenderMode&&(BK.Script.renderMode=1,currentRenderMode=1)}(function(t,e){t.QQ=function(){return new function(){this.gameCfg=clone_(GameStatusInfo),this.gameCfg.gameId=parseInt(this.gameCfg.gameId),this.gameCfg.gameMode=0,GameStatusInfo.gameMode=0,this.hasJoinRoomSucc=!1,this.arkData={modeWording:""},this.setArkData=function(t){this.arkData.modeWording=t},this.gameCfg.roomId&&(this.gameCfg.roomId=parseInt(this.gameCfg.roomId)),1==this.gameCfg.isMaster?this.gameCfg.isCreator=!0:this.gameCfg.isCreator=!1,this.delegate={},this.ssoJoinRoomCallback,this.ssoJoinRoomCallbackPublic,BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_ENTER_BACKGROUND,this,function(){1==("android"==GameStatusInfo.platform?1:2)&&BK.Director.tickerPause()}),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_ENTER_FORGROUND,this,function(){1==("android"==GameStatusInfo.platform?1:2)&&BK.Director.tickerResume()}),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_MINIMIZE,this,function(){1==("android"==GameStatusInfo.platform?1:2)&&(renderTicker.paused=!0,glpause=!0)}),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_MAXIMIZE,this,function(){1==("android"==GameStatusInfo.platform?1:2)&&(renderTicker.paused=!1,glpause=!1)}),this.queryCloudSignature=function(t){if(BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.3")){if(t){var e=JSON.parse(GameStatusInfo.extInfo),i=e.certInfo.credentials,r=i.tmpSecretId,n=i.sessionToken,a=e.certInfo.upLoadPrefUrl,o=e.certInfo.downLoadPrefUrl,s=((_=new Date).getFullYear(),_.getMonth()+1<10?_.getMonth():_.getMonth(),_.getDate(),(l=_.getTime()/1e3-1)+";"+(l+600)),h=BK.Crypt.hex_hmac_sha1(i.tmpSecretKey,s);t(0,d={tmpSecretId:r,upLoadPrefUrl:a,downloadUrl:o,sessionToken:n,signature:h,signTime:s})}}else{var _=new Date,l=parseInt(_.getTime()/1e3)-1,d={cmd:CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE,now:l,delta:600};t&&(BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(d,CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE))}},this.qGetRankBoard=function(t,e,i,r){var n={gameOrientation:t,openId:GameStatusInfo.openId,transparent:1,businessType:2,url:"http://cmshow.qq.com/apollo/html/game-platform/general-chart.html?gameId="+GameStatusInfo.gameId+"&_wwv=2&gameOrientation="+t};BK.MQQ.SsoRequest.send(n,"cs.openWebViewWithoutUrl.local")},this.qPayPurchase=function(t,e,i,r){var n=1;n=1==e?1:0;var a={gameOrientation:t,openId:GameStatusInfo.openId,transparent:n,businessType:1,itemList:i};if(r){var o="sc.apolloGameWebMessage.local";BK.MQQ.SsoRequest.removeListener(o,this),BK.MQQ.SsoRequest.addListener(o,this,function(t,e,i){0==t&&i.op&&"apolloGamePlatform.buyProps"==i.op&&r(i.data.code,i.data)}.bind(this))}BK.MQQ.SsoRequest.send(a,"cs.openWebViewWithoutUrl.local")},this.consumeItems=function(t,e){var i="apollo_game_item.consume_game_items",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){var n=[],a=[];0==t&&(n=r.data.succList,a=r.data.failList),e(t,n,a)}.bind(this))),BK.MQQ.SsoRequest.send(r,i)},this.rollbackGameItems=function(t,e){var i="apollo_game_item.rollback_game_items",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){var n=[],a=[];0==t&&(n=r.data.succList,a=r.data.failList),e(t,n,a)}.bind(this))),BK.MQQ.SsoRequest.send(r,i)},this.shareToMQQ=function(t,e,i,r){var n="cs.share_game_result.local",a={cmd:n,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,gameVersion:GameStatusInfo.gameVersion,roomId:GameStatusInfo.roomId,title:t,summary:e,detailUrl:i,picUrl:r};BK.MQQ.SsoRequest.send(a,n)},this.scoreUpload=function(t,e,i){BK.Script.log(1,1,"成绩上报 scoreData:"+JSON.stringify(t));var r="apollo_aio_game.report_user_score_3rd",n={cmd:r,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,roomId:GameStatusInfo.roomId,gData:t,src:GameStatusInfo.src};i&&(n.arkData=i),e&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,e)),BK.MQQ.SsoRequest.send(n,r)},this.getRoomUserScoreInfo=function(t,e){var i="apollo_aio_game.get_room_info_3rd",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,version:GameStatusInfo.gameVersion,roomId:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(r,i)},this.getUserGameinfo=function(t,e,i){var r="apollo_aio_game.get_user_gameinfo_3rd",n={cmd:r,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,roomId:GameStatusInfo.roomId,toOpenId:t,cycleNum:e};i&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,i)),BK.MQQ.SsoRequest.send(n,r)},this.getUserCurrencyInfo=function(t,e){var i="apollo_aio_game.get_user_curreInfo",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,mask:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(r,i)},this.getCmshowDressInfo=function(t,e){var i="cs.get_dress_path.local";e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e));var r={openId:t};BK.MQQ.SsoRequest.send(r,"cs.get_dress_path.local")},this.getGameItemList=function(t){var e="apollo_aio_game.get_game_itemList",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(i,e)},this.getUserGameItems=function(t){var e="apollo_aio_game.get_user_game_items",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(i,e)},this.buyGameItems=function(t,e,i){var r="apollo_aio_game.buy_game_items",n={cmd:r,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,curreType:t,itemIdList:e};i&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,i)),BK.MQQ.SsoRequest.send(n,r)},this.notifyNewRoom=function(t,e){var i={gameId:this.gameCfg.gameId,roomId:t,retcode:e};this.gameCfg.roomId||(this.gameCfg.roomId=t),BK.Script.log(0,0,"BK.QQ.notifyNewRoom!gameId = "+i.gameId+", roomId = "+i.roomId+", retCode = "+e),BK.MQQ.SsoRequest.send(i,CMSHOW_CS_CMD_CREATE_ROOM)},this.notifyHideGame=function(){var t={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyHideGame!gameId = "+t.gameId+", roomId = "+t.roomId),1==("android"==GameStatusInfo.platform?1:2)&&(BK.Script.renderMode=0,currentRenderMode=0),BK.MQQ.SsoRequest.send(t,CMSHOW_CS_CMD_MINI_WND)},this.notifyCloseGame=function(){this._closeRoom();var t={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyCloseGame!gameId = "+t.gameId+", roomId = "+t.roomId),BK.MQQ.SsoRequest.send(t,CMSHOW_CS_CMD_CLOSE_WND)},this.notifyReadyGame=function(){var t={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.MQQ.SsoRequest.send(t,CMSHOW_CS_CMD_GAME_READY)},this.notifyGameTips=function(t){var e={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId,tips:t};BK.MQQ.SsoRequest.send(e,CMSHOW_CS_CMD_GAME_TIPS)},this.notifyGameTipsWaiting=function(){this.notifyGameTips("等待玩家加入")},this.notifyGameTipsSomeOneJoinRoom=function(t){this.notifyGameTips(t+"加入房间")},this.notifyGameTipsSomeOneLeaveRoom=function(t){this.notifyGameTips(t+"离开房间")},this.notifyGameTipsReady=function(){this.notifyGameTips("游戏即将开始")},this.notifyGameTipsPlaying=function(){this.notifyGameTips("游戏进行中")},this.notifyGameTipsGameOver=function(){this.notifyGameTips("游戏已结束")},this.inviteFriend=function(t,e){var i="cs.invite_friends.local",r={cmd:i,wording:t,gameId:this.gameCfg.gameId,gameMode:8,extendInfo:{}};e&&(r.roomId=e),BK.MQQ.SsoRequest.send(r,i)},this.uploadData=function(t,e,i,r,n,a){var o="cs.report_data_2_compass.local",s=this.gameCfg.gameId;"ios"==this.gameCfg.platform&&(t=t.toString(),i=i.toString());var h={cmd:o,actionName:t,enter:e,entry:e,result:i,r2:s.toString(),r3:r,r4:n,r5:a};BK.MQQ.SsoRequest.send(h,o)},this.sharePic=function(t){var e={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId,path:t};BK.MQQ.SsoRequest.send(e,CMSHOW_CS_CMD_SHARE_PIC)};var t={},e={};this.loadPackage=function(i,r,n){if(!GameStatusInfo||"xcode"===GameStatusInfo.devPlatform)return BK.Script.log(1,1,"bk.qq.loadpackage xcode demo ."),r(i,0);var a=GameStatusInfo.QQVer.split(".");if(Number(a[0])<7||7==Number(a[0])&&Number(a[1])<7||7==Number(a[0])&&7==Number(a[1])&&Number(a[2])<5)return BK.Script.log(1,1,"bk.qq.loadpackage old version before 775 ."),r(i,0);var o={xyId:GameStatusInfo.gameId,packName:i};r&&(t[i]=r),n&&(e[i]=n),BK.MQQ.SsoRequest.send(o,CMSHOW_CS_CMD_LOAD_PACKAGE)},this.onLoadPackageFinish=function(e,i,r){BK.Script.log(0,0,"BK.QQ.onLoadPackageFinish errCode = "+e+" cmd = "+i+" data = "+JSON.stringify(r)),r.packName&&t[r.packName]&&(t[r.packName](r.packName,r.result),t[r.packName]=void 0)},BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_LOAD_PACKAGE,this,this.onLoadPackageFinish.bind(this)),this.onLoadPackagePercentage=function(t,i,r){BK.Script.log(0,0,"BK.QQ.onLoadPackagePercentage errCode = "+t+" cmd = "+i+" data = "+JSON.stringify(r)),r.packName&&e[r.packName]&&(e[r.packName](r.packName,r.percentage),e[r.packName]=void 0)},BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_LOAD_PERCENTAGE_NOTIFY,this,this.onLoadPackagePercentage.bind(this)),this.checkPakcage=function(t,e){var i={xyId:GameStatusInfo.gameId,packName:t};this.checkpakcageCallback=e,BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK,this,this._evnet4Checkpackage.bind(this)),BK.MQQ.SsoRequest.send(i,CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK)},this.checkpakcageCallback=void 0,this._evnet4Checkpackage=function(t,e,i){BK.Script.log(0,0,"BK.QQ._evnet4Checkpackage!errCode = "+t+", cmd = "+e+", data = "+JSON.stringify(i)),this.checkpakcageCallback&&this.checkpakcageCallback(i.packName,i.result),this.checkpakcageCallback=void 0,BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK,this)},this.addSSOJoinRoomCallBack=function(t){this.ssoJoinRoomCallbackPublic=t},this.checkPubAccountState=function(t,e){e&&(BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_CHECK_PUBACCOUNT_STATE,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_CHECK_PUBACCOUNT_STATE,this,e));var i=CMSHOW_CS_CMD_CHECK_PUBACCOUNT_STATE,r={cmd:i,puin:t};BK.MQQ.SsoRequest.send(r,i)},this.enterPubAccountCard=function(t){var e=CMSHOW_CS_CMD_ENTER_PUBACCOUNT_CARD,i={cmd:e,puin:t};BK.MQQ.SsoRequest.send(i,e)},this.fetchOpenKey=function(t){var e="cs.on_get_open_key.local",i={gameId:GameStatusInfo.gameId};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(i,e)},this.listenGameEventEnterBackground=function(t,e){var i="sc.game_enter_background.local";e&&(BK.MQQ.SsoRequest.removeListener(i,t),BK.MQQ.SsoRequest.addListener(i,t,e))},this.listenGameEventEnterForeground=function(t,e){var i="sc.game_enter_foreground.local";e&&(BK.MQQ.SsoRequest.removeListener(i,t),BK.MQQ.SsoRequest.addListener(i,t,e))},this.listenGameEventMaximize=function(t,e){var i="sc.game_maximize.local";e&&(BK.MQQ.SsoRequest.removeListener(i,t),BK.MQQ.SsoRequest.addListener(i,t,e))},this.listenGameEventMinimize=function(t,e){var i="sc.game_minimize.local";e&&(BK.MQQ.SsoRequest.removeListener(i,t),BK.MQQ.SsoRequest.addListener(i,t,e))},this._event4GetVIPInfo=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4GetVIPInfo!errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.delegate.onGetVIPInfoEvent&&this.delegate.onGetVIPInfoEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_GET_SRV_IP_PORT,this)},this.notifyGetVIPInfo=function(){BK.MQQ.SsoRequest.send({},CMSHOW_CS_CMD_GET_SRV_IP_PORT),BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_GET_SRV_IP_PORT,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_GET_SRV_IP_PORT,this,this._event4GetVIPInfo.bind(this))},this.notifySaveRecommVIP=function(t,e){BK.Script.log(0,0,"BK.QQ.notifySaveRecommVIP!ip = "+t+", port = "+e);var i={gameId:this.gameCfg.gameId,roomId:this.game.roomId,ip:t,port:e};BK.MQQ.SsoRequest.send(i,CMSHOW_CS_CMD_SAVE_RECOMM_VIP)},this._event4GetPlayerDress=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4GetPlayerDress!errCode = "+t+", cmd = "+e+", data = "+JSON.stringify(i)),this.delegate.onGetPlayerDressEvent&&this.delegate.onGetPlayerDressEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_GET_PLAYER_DRESS,this)},this.notifyGetPlayerDress=function(t){var e={openId:t};BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_GET_PLAYER_DRESS,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_GET_PLAYER_DRESS,this,this._event4GetPlayerDress.bind(this)),BK.MQQ.SsoRequest.send(e,CMSHOW_CS_CMD_GET_PLAYER_DRESS)},this._startGameLocal=function(t,e){var i={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId,resp:e,retcode:t,gameMode:this.gameCfg.gameMode};BK.MQQ.SsoRequest.send(i,CMSHOW_CS_CMD_GAME_START)},this.notifyJoinRoom=function(t,e,i){t&&t.length>0?t.forEach(function(t){var r=t.openId==currentPlayerOpenId;BK.Script.log(1,1,"player.openid="+t.openId+" currentPlayerOpenId="+currentPlayerOpenId);var n=0;e&&e.data&&e.data.avRoomId&&(n=e.data.avRoomId);var a=0;e&&e.data&&e.data.sdkAppId&&(a=e.data.sdkAppId);var o=0;e&&e.data&&e.data.accountType&&(o=e.data.accountType);var s={gameId:this.gameCfg.gameId,openId:t.openId,isCreator:this.gameCfg.isCreator&&t.openId==currentPlayerOpenId?1:0,roomId:this.gameCfg.roomId,resp:e,retcode:i,gameMode:this.gameCfg.gameMode,avRoomId:n,sdkAppId:a,accountType:o,isMine:r,isDisableSendMsg:1};BK.Script.log(0,0,"BK.QQ.notifyJoinroom isDisableSendMsg: "+s.isDisableSendMsg),BK.MQQ.SsoRequest.send(s,CMSHOW_CS_CMD_JOIN_ROOM)},this):BK.Script.log(0,0,"BK.QQ.notifyJoinRoom!newJoinPlayers data error")},this.sendGameMsg=function(){if(this.gameCfg.roomId&&this.gameCfg.roomId>0){var t={gameId:this.gameCfg.gameId,openId:GameStatusInfo.openId,roomId:this.gameCfg.roomId,gameMode:this.gameCfg.gameMode};BK.Script.log(0,0,"SendGameMsg : gameId="+t.gameId+" openId="+t.openId+" roomId="+t.roomId+" gameMode="+t.gameMode),BK.MQQ.SsoRequest.send(t,CMSHOW_CS_CMD_SEND_GAME_MSG)}},this.shareToArk=function(t,e,i,r,n,a){if(BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.3"))this._oldShareToArk(t,e,i,r,n,a);else{var o={summary:e,extendInfo:n,localPicPath:"",picUrl:"",activityId:0,reqCode:1};0==i.indexOf("GameRes://")||0==i.indexOf("GameSandBox://")?o.localPicPath=i:o.picUrl=i,this._share(o,a)}},this._share=function(t,e){if(t.inner=1,t.localPicPath){if(e){var i="sc.share_game_to_friend_result.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){e(t,i,r),this.shareUpload(0==t?0:1),BK.MQQ.SsoRequest.removeListener(i,this)}.bind(this))}BK.Script.log(0,0,"share "+JSON.stringify(t)),BK.MQQ.SsoRequest.send(t,"cs.game_shell_share_callback.local")}else{var r="轻游戏";t.gameName&&(r=t.gameName);var n="一起来玩游戏吧~";t.summary&&(n=t.summary),BK.QQ.defaultSharePic(r,n,function(i,r,n){if(e){var a="sc.share_game_to_friend_result.local";BK.MQQ.SsoRequest.removeListener(a,this),BK.MQQ.SsoRequest.addListener(a,this,function(t,i,r){e(t,i,r),this.shareUpload(0==t?0:1),BK.MQQ.SsoRequest.removeListener(i,this)}.bind(this))}0==i&&(t.localPicPath=n),BK.Script.log(0,0,"share with default pic"+JSON.stringify(t)),BK.MQQ.SsoRequest.send(t,"cs.game_shell_share_callback.local")}.bind(this))}},this.share=function(t,e){this._share(t,function(t,i,r){if(0==t){var n=r.ret,a=r.shareTo,o=1==r.isFirstShare;e(n,a,o)}else e(t,-1,!1)}.bind(this))},this.shareUpload=function(t){var e=t.toString();BK.QQ.uploadData("clickShowOffButton","",e,"","","")},this._oldShareToArk=function(t,e,i,r,n,a){"boolean"==typeof r&&(r=1==r?1:0);var o={summary:e,picUrl:i,gameId:this.gameCfg.gameId,roomId:t,gameMode:this.gameCfg.gameMode,isSelectFriend:r,extendInfo:n};if(a){var s="sc.share_game_to_friend_result.local";BK.MQQ.SsoRequest.removeListener(s,this),BK.MQQ.SsoRequest.addListener(s,this,function(t,e,i){a(t,e,i),this.shareUpload(0==t?0:1),BK.MQQ.SsoRequest.removeListener(e,this)})}BK.Script.log(0,0,"ShareToArk summary="+o.summary+" roomId="+o.roomId+" gameMode="+o.gameMode+"picUrl="+o.picUrl+" gameId="+o.gameId),BK.MQQ.SsoRequest.send(o,CMSHOW_CS_CMD_SHARE_IN_ARK)},this.sendB2CRedPacket=function(t,e){if(e){var i="sc.send_b2c_redpacket_result.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){e(t,i,r),BK.MQQ.SsoRequest.removeListener(i,this)})}var r={groupPushData:{gameRedPacketId:1,gameId:GameStatusInfo.gameId,extraInfo:t}};BK.Script.log(1,1,"sendB2CRedPacket:"+JSON.stringify(r)),BK.MQQ.SsoRequest.send(r,"cs.send_b2c_redpacket.local"),BK.Script.log(0,0,"sendB2CRedPacket")},this.createShortCut=function(t){var e="";t&&(e=t);var i={extendInfo:e};BK.MQQ.SsoRequest.send(i,"cs.create_xy_shortcut.local"),BK.Script.log(0,0,"createShortCut")},this.defaultSharePic=function(t,e,i){t||(t="轻游戏"),e||(e="一起来玩吧!");var r=1;if(BK.FileUtil.isFileExist("GameRes://inviteIcon.png")){var n=BK.Image.loadImage("GameRes://inviteIcon.png");if(n){var a=n.height,o=n.width;r=Math.abs(a/o-304/540)<.01?3:2}else BK.Script.log(1,1,"defaultSharePic loadImage inviteIcon failed.")}else r=1;1==r?i(-1,r,null):3==r?this.generateQRCodeAnd169(t,e,function(t,e){i(t,r,e)}.bind(this),"GameSandBox://shareDefault.png"):i(-1,r,null)},this.generateQRCodeAnd169=function(t,e,i,r){i(0,this.composeShare(t,e,"GameRes://inviteIcon.png","GameRes://share_logo.png",r))},this.composeShare=function(t,e,i,r,n){var a="GameSandBox://compose.png";n&&(a=n);var o=BK.Image.loadImage(i),s=new BK.Canvas(750,750);if(s.fillColor={r:1,g:1,b:1,a:1},s.fillRect(0,0,750,750),BK.FileUtil.isFileExist(r)){s.drawImage(r,0,0,125,28,32,32,126,27)}o&&s.drawImage(i,0,0,o.width,o.height,0,330,750,420);s.fillColor={r:0,g:0,b:0,a:1},s.drawStyle=0,s.setTextAlign(1),s.setTextSize(40),s.textBaseLine="bottom",s.textAlign="left",s.fillText(t,35,258);s.fillColor={r:137/255,g:137/255,b:137/255,a:.5},s.drawStyle=0,s.setTextAlign(1),s.setTextSize(30),s.textBaseLine="bottom",s.textAlign="left",s.fillText(e,35,215);s.fillColor={r:1,g:1,b:1,a:1};var h=this.generatePureQRCode();s.drawImage(h,0,0,256,256,600,64,120,120);return s.fillColor={r:0,g:0,b:0,a:1},s.drawStyle=0,s.setTextAlign(1),s.setTextSize(19),s.textBaseLine="bottom",s.textAlign="left",s.fillText("长按扫码即玩",600,28),s.saveTo(a),s.dispose(),a},this.generatePureQRCode=function(t){var e="GameSandBox://qrcode.png";t&&(e=t);var i={width:256,height:256,colorDark:{r:0,g:0,b:0,a:1},colorLight:{r:1,g:1,b:1,a:1},correctLevel:2},r="http://cmshow.qq.com/apollo/html/game-platform/scan-game.html?gameId="+GameStatusInfo.gameId.toString()+"&src=203";return BK.QRCode.createQRCodeToFile(e,r,i),e},this._event4QuitGame=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4QuitGame errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.delegate.onQuitGameEvent&&this.delegate.onQuitGameEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_QUIT_GAME,this)},this._event4CancelGame=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4CancelGame errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.delegate.onCancelGameEvent&&this.delegate.onCancelGameEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_CANCEL_GAME,this)},this.notifyQuitGameSrv=function(){var t={cmd:CMSHOW_SRV_CMD_QUIT_GAME,from:this.gameCfg.platform,gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyQuitGameSrv!, cmd = "+t.cmd+", from = "+t.from+", gameId = "+t.gameId+", roomId = "+t.roomId),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_QUIT_GAME,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_QUIT_GAME,this,this._event4QuitGame.bind(this)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CMD_QUIT_GAME)},this.notifyCancelGameSrv=function(){var t={cmd:CMSHOW_SRV_CMD_CANCEL_GAME,from:this.gameCfg.platform,gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyCancelGameSrv!, cmd = "+t.cmd+", from = "+t.from+", gameId = "+t.gameId+", roomId = "+t.roomId),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_CANCEL_GAME,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_CANCEL_GAME,this,this._event4CancelGame.bind(this)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CMD_CANCEL_GAME)},this._event4StartGame=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4StartGame! errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.hasStartGameSucc=0==t,this._startGameLocal(t,i),this.delegate.onStartGameEvent&&this.delegate.onStartGameEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_START_GAME,this)},this.notifyStartGameSrv=function(){var t={cmd:CMSHOW_SRV_CMD_START_GAME,from:this.gameCfg.platform,gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyStartGameSrv!, cmd = "+t.cmd+", from = "+t.from+", gameId = "+t.gameId+", roomId = "+t.roomId),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_START_GAME,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_START_GAME,this,this._event4StartGame.bind(this)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CMD_START_GAME)},this._event4JoinRoom=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4JoinRoom errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.hasJoinRoomSucc=0==t,this.delegate.onJoinRoomEvent&&this.delegate.onJoinRoomEvent(t,e,i),BK.QQ.notifyJoinRoom(this.newJoinPlayers,i,t),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_JOIN_ROOM,this),this.ssoJoinRoomCallback&&this.ssoJoinRoomCallback(t,e,i),this.ssoJoinRoomCallbackPublic&&(i.gameId=this.gameCfg.gameId,i.gameRoomId=this.gameCfg.roomId,i.avRoomId=i.data.avRoomId?i.data.avRoomId:0,i.sdkAppId=i.data.sdkAppId?i.data.sdkAppId:0,i.accountType=i.data.accountType?i.data.accountType:0,this.ssoJoinRoomCallbackPublic(t,e,i))},this.notifyNewOrJoinRoomSrv=function(t,e,i,r){var n={cmd:CMSHOW_SRV_CMD_JOIN_ROOM,from:this.gameCfg.platform,aioType:this.gameCfg.aioType,gameId:this.gameCfg.gameId,version:this.gameCfg.gameVersion,roomId:e,opType:i,gameMode:this.gameCfg.gameMode,roomVol:this.roomVol,arkData:this.arkData,src:r};BK.Script.log(1,1,"BK.QQ.notifyNewOrJoinRoomSrv!, cmd = "+n.cmd+", from = "+n.from+", aioType = "+n.aioType+", gameId = "+n.gameId+", version = "+n.version+", roomId = "+n.roomId+", opType = "+n.opType),this.newJoinPlayers=t,BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_JOIN_ROOM,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_JOIN_ROOM,this,this._event4JoinRoom.bind(this)),BK.MQQ.SsoRequest.send(n,CMSHOW_SRV_CMD_JOIN_ROOM)},this._customGameLogicCallBack=void 0,this._event4CustomLogic=function(t,e,i){void 0!=this._customGameLogicCallBack&&this._customGameLogicCallBack(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC,this)},this.reqCustomLogic=function(t,e){void 0!=t?(this._customGameLogicCallBack=e,BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC,this,this._event4CustomLogic.bind(this)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC)):BK.Script.log(0,0,"reqCustomLogic data undefined!")},this._getRankListLogicCallBack=void 0,this._event4GetRankList=function(t,e,i){BK.Script.log(1,1,"BK.QQ.reqGetRankList! callback cmd"+e+" errCode:"+t+" data:"+JSON.stringify(i)),void 0!=this._getRankListLogicCallBack&&this._getRankListLogicCallBack(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_GET_RANK_LIST,this)},this.getRankList=function(t,e){var i={cmd:CMSHOW_SRV_GET_RANK_LIST,from:"default",objType:1,objId:0,busType:3,busId:this.gameCfg.gameId.toString()};e&&(e.objType&&(i.objType=e.objType),e.objId&&(i.objId=e.objId),e.from&&(i.from=e.from)),BK.Script.log(1,1,"BK.QQ.reqGetRankList! "+JSON.stringify(i)),void 0!=i?(this._getRankListLogicCallBack=t,BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_GET_RANK_LIST,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_GET_RANK_LIST,this,this._event4GetRankList.bind(this)),BK.MQQ.SsoRequest.send(i,CMSHOW_SRV_GET_RANK_LIST)):BK.Script.log(0,0,"reqGetRankList data undefined!")},this._pushPublicMsgCallBack=void 0,this._event4PushPublicMsg=function(t,e,i){BK.Script.log(1,1,"BK.QQ.pushPublicMsg! callback cmd"+e+" errCode:"+t+" data:"+JSON.stringify(i)),void 0!=this._pushPublicMsgCallBack&&this._pushPublicMsgCallBack(t,e,i)},this.pushPublicMsg=function(t,e){var i={gameid:this.gameCfg.gameId,templateid:e.templateid,report_ts:e.report_ts,tmpl_param:e.tmpl_param};BK.Script.log(1,1,"BK.QQ.pushPublicMsg! "+JSON.stringify(i)),void 0!=i?(this._pushPublicMsgCallBack=t,BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_PUSH_PUBLIC_MSG,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_PUSH_PUBLIC_MSG,this,this._event4PushPublicMsg.bind(this)),BK.MQQ.SsoRequest.send(i,CMSHOW_SRV_PUSH_PUBLIC_MSG)):BK.Script.log(0,0,"pushPublicMsg data undefined!")},this.hasJoinRoom=function(){return this.hasJoinRoomSucc},this.hasStartGame=function(){return this.hasStartGameSucc},this._event4StopGame=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4StopGame!errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this._closeRoom(),this.delegate.onStopGameEvent&&this.delegate.onStopGameEvent(t,e,i)},this._closeRoom=function(t){BK.QQ.isNeedSSOServer=void 0==t||null==t||t,1==Boolean(BK.QQ.isNeedSSOServer)&&(this.hasStartGameSucc||this.gameCfg.roomId&&0!=this.gameCfg.roomId&&(this.gameCfg.isCreator?this.notifyCancelGameSrv():this.notifyQuitGameSrv()))},this.uploadScoreWithoutRoom=function(t,e,i){var r="apollo_report_result.single_user_result",n=Math.floor((new Date).getTime()/1e3),a={from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,aioType:GameStatusInfo.aioType,ts:n.toString(),src:GameStatusInfo.src,mode:void 0!==t?t:1,userData:e.userData,attr:e.attr};i&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,i)),BK.MQQ.SsoRequest.send(a,r)},this.getRankListWithoutRoom=function(t,e,i,r){var n="apollo_router_game.apollo_user_rankinglist_linkcmd_custom_ranking",a=Math.floor((new Date).getTime()/1e3),o={from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,ts:a.toString(),attr:void 0!==t?t:"score",order:void 0!==e?e:1,rankType:void 0!==i?i:0};r&&(BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,r)),BK.MQQ.SsoRequest.send(o,n)},this.saveGameData=function(t,e){var i="apollo_private_data.set_user_data",r=Math.floor((new Date).getTime()/1e3),n={openId:GameStatusInfo.openId,gameId:GameStatusInfo.gameId,version:GameStatusInfo.gameVersion,from:GameStatusInfo.platform,ts:r.toString(),data:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(n,i)},this.loadGameData=function(t){var e="apollo_private_data.get_user_data",i=Math.floor((new Date).getTime()/1e3),r={openId:GameStatusInfo.openId,gameId:GameStatusInfo.gameId,version:GameStatusInfo.gameVersion,from:GameStatusInfo.platform,ts:i.toString()};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(r,e)},this.reportGameResult=function(t,e){var i="apollo_router_game.apollo_reportcm_linkcmd_game_result";t.gameId=GameStatusInfo.gameId,e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(t,i)},this.updateScoreLocal=function(t){BK.MQQ.SsoRequest.send({gameId:GameStatusInfo.gameId,score:t},"cs.game_update_score.local")},this.getRedPacketResult=function(t,e){var i="cs.get_redPacket_result.local";e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send({gameId:GameStatusInfo.gameId,score:t},i)},this.listenRedPacketEvent=function(t){var e="sc.web_callback_game.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t))},this.skipGame=function(t,e){var i={xyId:t,extendInfo:e,src:302};BK.MQQ.SsoRequest.send(i,"cs.create_xy.local");var r=new Date,n=r.getFullYear(),a=r.getMonth()+1,o=r.getDate(),s=r.getHours(),h=""+n+(a=(""+a).length<2?"0"+a:a)+(o=""+o<2?"0"+o:o)+(s=""+s<2?"0"+s:s);BK.QQ.uploadData("gameAtoB","302",1,t,h,"")},BK.MQQ.SsoRequest.addListener(CMSHOW_SC_CMD_STOP_GAME,this,this._event4StopGame.bind(this))}}()}(BK)),BK.Room=function(){this.roomId,this.gameId,this.mId,this.ownerId,this.createTs,this.status,this.playerNum,this.ip0,this.ip1,this.msgSeq=1,this.ackSeq,this.lastFrame=0,this.startGameTs=0,this.createRoomCallBack,this.queryRoomInfoCallBack,this.joinRoomCallBack,this.leaveRoomCallBack,this.startGameCallBack,this.broadcastDataCallBack,this.sensitiveWordCallBack,this.setUserDataCallBack,this.getUserDataCallBack,this.sendSyncOptCallBack,this.forceStopGameCallBack,this.frameSyncListener,this.queryFrameDataCallBack,this.matchGameCallBack,this.queryMatchGameCallBack,this.quitMatchGameCallBack,this.disconnectNetCallBack,this.reJoinRoomCallBack,this.socket=new BK.Socket,this.reqArray=new Array,this.newJoinPlayers=[],this.currentPlayers=[],this.isCreator=1==GameStatusInfo.isMaster,this.gameStatusInfo=GameStatusInfo,this.serverConnected,this._environment=GameStatusInfo.isWhiteUser,this.headerVersion=769,this.recommandRoomSvrHost=NormalRecommandRoomSvrHost,this.recommandRoomSvrPort=NormalRecommandRoomSvrPort,this.netTimeOutTs=0,this.options=null,this.setArkData=function(t){BK.QQ.setArkData(t)},this.setRoomVol=function(t){BK.QQ.roomVol=t},this.read32BytesToString=function(t){for(var e="",i=0;i<32;i++){var r=t.readUint8Buffer();e+=String.fromCharCode(r)}return e},this.writeOpenIdIntoBuffer=function(t,e){var i=new BK.Buffer(32);if(32==e.length)for(n=0;n<32;n++){var r=e.charCodeAt(n);i.writeUint8Buffer(r)}else{for(var n=0;n<32;n++)i.writeUint8Buffer(0);BK.Script.log(0,0,"writeOpenIdIntoBuffer.length is not 32 bytes,Write empty data")}t.writeBuffer(i)},this.addHeader=function(t,e,i){t.writeUint16Buffer(4660),t.writeUint16Buffer(this.headerVersion),t.writeUint16Buffer(0),t.writeUint16Buffer(i),t.writeUint32Buffer(e)},this.addFixedHeader=function(t,e,i,r,n,a,o,s,h){void 0==a&&(a=""),void 0==o&&(o=0),void 0==s&&(s=0),void 0==h&&(h=0),t.writeUint16Buffer(72),t.writeUint16Buffer(e),t.writeUint32Buffer(0),t.writeUint64Buffer(1111),t.writeUint64Buffer(i),t.writeUint64Buffer(r),this.writeOpenIdIntoBuffer(t,n),this.writeOpenIdIntoBuffer(t,a),t.writeUint64Buffer(o),t.writeUint64Buffer(s),t.writeUint64Buffer(h)},this.getHeader=function(t){var e=t.readUint16Buffer(),i=t.readUint16Buffer(),r=t.readUint16Buffer(),n=t.readUint16Buffer(),a=t.readUint32Buffer(),o=new Object;return o.magic=e,o.ver=i,o.stlen=n,o.bodyLen=a,o.seq=r,o},this.getFixedHeader=function(t){var e=t.readUint16Buffer(),i=t.readUint16Buffer(),r=t.readUint32Buffer(),n=t.readUint64Buffer(),a=t.readUint64Buffer(),o=t.readUint64Buffer(),s="",h="";s=this.read32BytesToString(t),h=this.read32BytesToString(t);var _=t.readUint64Buffer(),l=t.readUint64Buffer(),d=t.readUint64Buffer(),c=new Object;return c.fixLen=e,c.cmd=i,c.ret=r,c.date=n,c.gameId=a,c.roomId=o,c.fromId=s,c.toId=h,c.token=_,c.appId=l,c.accessToken=d,c},this.getRequestCommonBuffer=function(t,e,i,r,n,a,o){var s,h,_=0;if(o&&(o.rewind(),_=o.length),h=new BK.Stream(BK.Security.getST()),s=new BK.Stream(fixedHeaderLen+_+n,1),this.addFixedHeader(s,t,e,i,r),_>0)for(d=0;d<_;d++)s.writeUint8Buffer(o.readUint8Buffer());if(n>0)for(var l=new BK.Stream(a.bkJSTLVGetBuffer()),d=0;d<l.length;d++)s.writeUint8Buffer(l.readUint8Buffer());s=BK.Misc.arrayBufferToBKBuffer(s.data),BK.Security.encrypt(s),s=new BK.Stream(s);var c=new BK.Stream(HeaderLen+s.length+h.length);return this.addHeader(c,s.length,h.length),c.writeBuffer(h),c.writeBuffer(s),c.data},this.matchGame=function(t,e,i){this.mId=e,this.gameId=parseInt(t),BK.QQ.gameCfg.gameMode=6,GameStatusInfo.gameMode=6;var r=this.socket.connect(this.recommandRoomSvrHost,this.recommandRoomSvrPort);BK.Script.log(0,0,"socket con ="+r),-1==r?BK.Script.log(0,0,"socket connect failed! "+r):this.serverConnected=1,this.matchGameCallBack=i;var n=new Object;n.cmd=36,n.arg0=t,n.arg1=e,this.reqArray.push(n),BK.Script.log(0,0,"createRoom ")},this.requestMatch=function(t,e){BK.Script.log(0,0,"match game request in");var i=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(i,36,t,0,e);var r=BK.Security.getST();BK.Security.encrypt(i);var n=r.bufferLength(),a=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(a,i.bufferLength(),n),a.writeBuffer(r),a.writeBuffer(i),BK.Script.log(0,0,"match game request buffer : "+a.bufferLength()+" body len:"+i.bufferLength()),a},this.queryMatchGame=function(t,e,i){BK.Script.log(0,0,"queryMatchGame in "),this.mId=e,this.gameId=parseInt(t),this.queryMatchGameCallBack=i;var r=new Object;r.cmd=38,r.arg0=t,r.arg1=e,this.reqArray.push(r)},this.requestQueryMatch=function(t,e){BK.Script.log(0,0,"query match game request in");var i=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(i,38,t,0,e);var r=BK.Security.getST();BK.Security.encrypt(i);var n=r.bufferLength(),a=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(a,i.bufferLength(),n),a.writeBuffer(r),a.writeBuffer(i),BK.Script.log(0,0,"query match game request buffer : "+a.bufferLength()+" body len:"+i.bufferLength()),a},this.quitMatchGame=function(t,e,i){BK.Script.log(0,0,"quitMatchGame in "),this.mId=e,this.gameId=parseInt(t),this.quitMatchGameCallBack=i;var r=new Object;r.cmd=40,r.arg0=t,r.arg1=e,this.reqArray.push(r)},this.requestQuitMatch=function(t,e){BK.Script.log(0,0,"quit match game request in");var i=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(i,40,t,0,e);var r=BK.Security.getST();BK.Security.encrypt(i);var n=r.bufferLength(),a=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(a,i.bufferLength(),n),a.writeBuffer(r),a.writeBuffer(i),BK.Script.log(0,0,"quit match game request buffer : "+a.bufferLength()+" body len:"+i.bufferLength()),a},this.createRoom=function(t,e,i){if(this.mId=e,this.gameId=parseInt(t),1!=this.serverConnected){var r=this.socket.connect(this.recommandRoomSvrHost,this.recommandRoomSvrPort);BK.Script.log(0,0,"socket con ="+r),-1==r?BK.Script.log(0,0,"socket connect failed! "+r):this.serverConnected=1}this.createRoomCallBack=i;var n=new Object;n.cmd=6,n.arg0=t,n.arg1=e,this.reqArray.push(n),BK.Script.log(0,0,"createRoom ")},this.requestCreateRoom=function(t,e){var i=Number(this.roomId);i||(i=0),BK.Script.log(0,0,"create room request ");var r=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(r,6,t,i,e);var n=BK.Security.getST();BK.Security.encrypt(r);var a=n.bufferLength(),o=new BK.Buffer(HeaderLen+r.bufferLength()+a,1);return this.addHeader(o,r.bufferLength(),a),o.writeBuffer(n),o.writeBuffer(r),BK.Script.log(0,0,"create room request buffer : "+o.bufferLength()+" body len:"+r.bufferLength()),o},this.requestQueryRoom=function(){var t=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(t,10,this.gameId,this.roomId,this.mId);var e=BK.Security.getST();BK.Security.encrypt(t);var i=e.bufferLength(),r=new BK.Buffer(HeaderLen+t.bufferLength()+i,1);return this.addHeader(r,t.bufferLength(),i),r.writeBuffer(e),r.writeBuffer(t),r},this.queryRoom=function(t,e,i,r){this.mId=i,this.roomId=parseFloat(e),this.gameId=parseInt(t),this.queryRoomInfoCallBack=r;var n=new Object;n.cmd=10,this.reqArray.push(n),BK.Script.log(0,0,"queryRoom push")},this.joinRoom=function(t,e,i,r){this.joinRoomCallBack=e,BK.QQ.isNeedSSOServer=void 0==r||null==r||r,BK.Script.log(0,0,"BK.QQ.notifyJoinroom isDisableSendMsg isAuto: "+i+",isAutoSendJoin: "+BK.QQ.isAutoSendJoinRoomNotify);var n=new Object;n.cmd=2,n.arg0=t,this.reqArray.push(n)},this.requestJoinRoom=function(t){BK.Script.log(0,0,"join room request");var e=new BK.Buffer(fixedHeaderLen+5,1);this.addFixedHeader(e,2,this.gameId,this.roomId,this.mId);var i=new BK.TLV(5);i.bkJSTLVWriteUInt8(t,TLVType.Uint8,201),e.writeBuffer(i.bkJSTLVGetBuffer());var r=BK.Security.getST();BK.Security.encrypt(e);var n=r.bufferLength(),a=new BK.Buffer(HeaderLen+e.bufferLength()+n,1);return this.addHeader(a,e.bufferLength(),n),a.writeBuffer(r),a.writeBuffer(e),a},this.setReJoinRoomCallBack=function(t){this.reJoinRoomCallBack=t},this.reConnectAndJoinRoom=function(){var t=this.socket.connect(this.gameSvrIp,this.gameSvrPort);if(BK.Script.log(0,0,"socket con ="+t),-1==t)return BK.Script.log(0,0,"socket connect failed! "+t),-1;this.serverConnected=1,0==t&&BK.Script.log(0,0,"socket connect =0 "),t>=0&&(BK.Script.log(0,0,"rejoinroom send"),this.joinRoom(1,function(t,e){BK.Script.log(0,0,"rejoinroom statusCode:"+t+" roomid is "+e.roomId),this.reJoinRoomCallBack&&this.reJoinRoomCallBack(t,this)}))},this.leaveRoom=function(t,e){void 0==e&&(e=-1);var i=new Object;i.cmd=4,i.arg0=e,this.reqArray.push(i),this.leaveRoomCallBack=t,BK.Script.log(0,0,"leaveRoom push")},this.setLeaveRoomCallback=function(t){this.leaveRoomCallBack=t},this.requestLeaveRoom=function(t){var e=new BK.TLV(44),i=new BK.Buffer(40,1);this.writeOpenIdIntoBuffer(i,this.mId),i.writeUint64Buffer(t),e.bkJSTLVWriteBuffer(i,TLVType.Byte,201);var r=new BK.Buffer(fixedHeaderLen+e.bkJSTLVGetLength(),1);this.addFixedHeader(r,4,this.gameId,this.roomId,this.mId),r.writeBuffer(e.bkJSTLVGetBuffer());var n=BK.Security.getST(),a=n.bufferLength();return BK.Security.encrypt(r),buff=new BK.Buffer(HeaderLen+r.bufferLength()+a,1),this.addHeader(buff,r.bufferLength(),a),buff.writeBuffer(n),buff.writeBuffer(r),BK.Script.log(0,0,"leave room buffer : "+buff.bufferLength()+" body len:"+r.bufferLength()),buff},this._startGame=function(t){this.startGameCallBack=t;var e=new Object;e.cmd=8,this.reqArray.push(e),BK.Script.log(0,0,"startGame push")},this.startGame=function(t){GameStatusInfo.devPlatform?(BK.Script.log(0,0,"startGame dev:"),this._startGame(t)):1==BK.QQ.hasJoinRoomSucc?(BK.Script.log(0,0,"startGame qq:cmsrv confirm joinRoom response"),this._startGame(t)):(BK.Script.log(0,0,"startGame qq:waiting cmsvr joiroom response"),BK.QQ.delegate.onJoinRoomEvent=function(e,i,r){BK.Script.log(0,0,"startGame qq:wait finish.start Game"),this._startGame(t)}.bind(this))},this.setStartGameCallback=function(t){this.startGameCallBack=t},this.requestStartGame=function(){var t=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(t,8,this.gameId,this.roomId,this.mId);var e=BK.Security.getST();BK.Security.encrypt(t);var i=e.bufferLength(),r=new BK.Buffer(HeaderLen+t.bufferLength()+i,1);return this.addHeader(r,t.bufferLength(),i),r.writeBuffer(e),r.writeBuffer(t),r},this.setBroadcastDataCallBack=function(t){this.broadcastDataCallBack=t},this.sendBroadcastData=function(t){var e=new Object;e.cmd=1,e.arg0=t,this.reqArray.push(e)},this.requestsendBroadcastData=function(t){var e=t.capacity?t.capacity:t.bufferLength(),i=new BK.Buffer(fixedHeaderLen+e,1);this.addFixedHeader(i,1,this.gameId,this.roomId,this.mId),i.writeBuffer(t);var r=BK.Security.getST();BK.Security.encrypt(i);var n=r.bufferLength(),a=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(a,i.bufferLength(),n),a.writeBuffer(r),a.writeBuffer(i),a},this.setSensitiveWordCallBack=function(t){this.sensitiveWordCallBack=t},this.sendSensitiveWordData=function(t){var e=new Object;e.cmd=50,e.arg0=t,this.reqArray.push(e)},this.requestSendSendSensitiveWordData=function(t){var e=t.capacity?t.capacity:t.bufferLength(),i=new BK.Buffer(fixedHeaderLen+e,1);this.addFixedHeader(i,50,this.gameId,this.roomId,this.mId),i.writeBuffer(t);var r=BK.Security.getST();BK.Security.encrypt(i);var n=r.bufferLength(),a=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(a,i.bufferLength(),n),a.writeBuffer(r),a.writeBuffer(i),a},this.setUserData=function(t,e){BK.Script.log(0,0,"setUserData call"),this.setUserDataCallBack=e;var i=new Object;i.cmd=32,i.arg0=t,this.reqArray.push(i),BK.Script.log(0,0,"setUserData push")},this.requestSetUserData=function(t){var e=t.capacity?t.capacity:t.bufferLength(),i=new BK.Buffer(fixedHeaderLen+e,1);this.addFixedHeader(i,32,this.gameId,this.roomId,this.mId),i.writeBuffer(t);var r=BK.Security.getST();BK.Security.encrypt(i);var n=r.bufferLength(),a=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(a,i.bufferLength(),n),a.writeBuffer(r),a.writeBuffer(i),a},this.getUserData=function(t,e){void 0==t&&(t=0),this.getUserDataCallBack=e;var i=new Object;i.cmd=34,i.arg0=t,this.reqArray.push(i),BK.Script.log(0,0,"getUserData push roomId = "+t)},this.requestGetUserData=function(t){var e=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(e,34,this.gameId,this.roomId,this.mId);var i=BK.Security.getST();BK.Security.encrypt(e);var r=i.bufferLength(),n=new BK.Buffer(HeaderLen+e.bufferLength()+r,1);return this.addHeader(n,e.bufferLength(),r),n.writeBuffer(i),n.writeBuffer(e),n},this.syncOpt=function(t,e,i,r,n){this.sendSyncOptCallBack=n;var a=new Object;a.cmd=14,a.arg0=t,a.arg1=e,a.arg2=i,a.arg3=r,this.reqArray.push(a)},this.sendSyncOpt=function(t,e){var i=new BK.Buffer(1,1);i.writeUint8Buffer(0);var r=new BK.Buffer(1,1);r.writeUint8Buffer(0),this.syncOpt(i,t,r,void 0,e)},this.requestSyncOpt=function(t,e,i,r){var n=20+(t.capacity?t.capacity:t.bufferLength())+4+(e.capacity?e.capacity:e.bufferLength())+4+(i.capacity?i.capacity:i.bufferLength());if(r){var a=r.capacity?r.capacity:r.bufferLength();n=n+4+a,BK.Script.log(0,0,"requestSyncOpt with item len"+a)}var o=new BK.TLV(n);o.bkJSTLVWriteUInt32(this.msgSeq,TLVType.Uint32,201),o.bkJSTLVWriteUInt32(this.lastFrame,TLVType.Uint32,202),o.bkJSTLVWriteBuffer(t,TLVType.Byte,203),o.bkJSTLVWriteBuffer(e,TLVType.Byte,204),o.bkJSTLVWriteBuffer(i,TLVType.Byte,205),r&&o.bkJSTLVWriteBuffer(r,TLVType.Byte,206),BK.Script.log(0,0,"requestSyncOpt this.msgSeq:"+this.msgSeq+" this.lastFrame:"+this.lastFrame);o.bkJSParseTLV();BK.Script.log(0,0,"requestSyncOpt tlv len:"+o.bkJSTLVGetLength()+" fix header:"+fixedHeaderLen);var s=new BK.Buffer(fixedHeaderLen+o.bkJSTLVGetLength(),1);this.addFixedHeader(s,14,this.gameId,this.roomId,this.mId),s.writeBuffer(o.bkJSTLVGetBuffer());var h=BK.Security.getST();BK.Security.encrypt(s);var _=h.bufferLength(),l=new BK.Buffer(HeaderLen+s.bufferLength()+_,1);return this.addHeader(l,s.bufferLength(),_),l.writeBuffer(h),l.writeBuffer(s),this.msgSeq+=1,l},this.setFrameSyncListener=function(t){this.frameSyncListener=t},this.queryFrameData=function(t,e,i){this.queryFrameDataCallBack=i;var r=new Object;r.cmd=18,r.arg0=t,r.arg1=e,this.reqArray.push(r)},this.requestQueryFrameData=function(t,e){var i=new BK.TLV(22);i.bkJSTLVWriteUInt32(this.lastFrame,TLVType.Uint32,201),i.bkJSTLVWriteUInt32(t,TLVType.Uint32,202),i.bkJSTLVWriteUInt16(e,TLVType.Uint16,203);var r=new BK.Buffer(fixedHeaderLen+i.bkJSTLVGetLength(),1);this.addFixedHeader(r,18,this.gameId,this.roomId,this.mId),r.writeBuffer(i.bkJSTLVGetBuffer());var n=BK.Security.getST();BK.Security.encrypt(r);var a=n.bufferLength(),o=new BK.Buffer(HeaderLen+r.bufferLength()+a,1);return this.addHeader(o,r.bufferLength(),a),o.writeBuffer(n),o.writeBuffer(r),o},this.sendControlCommand=function(t,e,i,r){var n=new Object;n.cmd=48,n.arg0=t,n.arg1=e,n.arg2=i,this.reqArray.push(n),this.controlCommandCallback=r},this.requestControlCommand=function(t,e,i){var r=new BK.TLV(14+e.bufferLength()+i.bufferLength());r.bkJSTLVWriteBuffer(e,TLVType.Byte,201),r.bkJSTLVWriteUInt16(t,TLVType.Uint16,202),r.bkJSTLVWriteBuffer(i,TLVType.Byte,203);var n=new BK.Buffer(fixedHeaderLen+r.bkJSTLVGetLength(),1);this.addFixedHeader(n,48,this.gameId,this.roomId,this.mId),n.writeBuffer(r.bkJSTLVGetBuffer()),BK.Security.encrypt(n);var a=BK.Security.getST(),o=a.bufferLength(),s=new BK.Buffer(HeaderLen+n.bufferLength()+o,1);return this.addHeader(s,n.bufferLength(),o),s.writeBuffer(a),s.writeBuffer(n),s},this.sendKeepAlive=function(){var t=new Object;t.cmd=12,this.reqArray.push(t),0!=this.netTimeOutTs&&BK.Time.timestamp-this.netTimeOutTs>5&&this.disconnectNetCallBack&&this.disconnectNetCallBack()},this.requestSendKeepAlive=function(){var t=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(t,12,this.gameId,this.roomId,this.mId);var e=BK.Security.getST();BK.Security.encrypt(t);var i=e.bufferLength(),r=new BK.Buffer(HeaderLen+t.bufferLength()+i,1);return this.addHeader(r,t.bufferLength(),i),r.writeBuffer(e),r.writeBuffer(t),r},this.recvCreateRoom=function(t,e){BK.Script.log(0,0,"recvCreateRoom bodyLen="+e);var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV();if(r){var n=r.tag202,a=n.readUint8Buffer(),o=n.readUint8Buffer(),s=n.readUint16Buffer();n.readUint64Buffer(),n.readUint32Buffer();var h=n.readUint8Buffer(),_=n.readUint8Buffer(),l=n.readUint8Buffer(),d=n.readUint8Buffer(),c=r.tag201,u=c.readUint8Buffer(),f=c.readUint8Buffer(),g=c.readUint16Buffer();c.readUint64Buffer(),c.readUint32Buffer();var m=c.readUint8Buffer(),p=c.readUint8Buffer(),v=c.readUint8Buffer(),S=c.readUint8Buffer(),b=new Object;return b.ipType_1=a,b.resServe_1=o,b.ipType_2=u,b.resServe_2=f,b.port_1=s,b.ip_1=h+"."+_+"."+l+"."+d,b.port_2=g,b.ip_2=m+"."+p+"."+v+"."+S,this.ip0=b.ip_1,this.ip1=b.ip_2,b}return void BK.Script.log(0,0,"recvCreateRoom parse failed.")},this.recvQueryRoom=function(t,e){BK.Script.log(0,0,"recvQueryRoom bodyLen:"+e);var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV();if(r){var n=r.tag202,a=n.readUint8Buffer(),o=n.readUint8Buffer(),s=n.readUint16Buffer();n.readUint64Buffer(),n.readUint32Buffer();var h=n.readUint8Buffer(),_=n.readUint8Buffer(),l=n.readUint8Buffer(),d=n.readUint8Buffer(),c=r.tag201,u=c.readUint8Buffer(),f=c.readUint8Buffer(),g=c.readUint16Buffer();c.readUint64Buffer(),c.readUint32Buffer();var m=c.readUint8Buffer(),p=c.readUint8Buffer(),v=c.readUint8Buffer(),S=c.readUint8Buffer(),b=r.tag203,T=this.read32BytesToString(b),E=b.readUint64Buffer(),x=b.readUint8Buffer(),B=b.readUint8Buffer(),C=r.tag205;void 0==C&&(C=0);for(var R=[],A=0;A<B;A++){var y={};y.uid=this.read32BytesToString(b),y.status=b.readUint8Buffer(),R.push(y)}var I=new Object;return I.ipType_1=a,I.resServe_1=o,I.ipType_2=u,I.resServe_2=f,I.port_1=s,I.ip_1=h+"."+_+"."+l+"."+d,I.port_2=g,I.ip_2=m+"."+p+"."+v+"."+S,I.ownerId=T,I.createTs=E,I.status=x,I.playerNum=B,I.ext_num=C,this.ip0=I.ip_1,this.ip1=I.ip_2,this.ownerId=T,this.createTs=E,this.status=x,this.playerNum=B,this.players=R,I}return void BK.Script.log(0,0,"recvQueryRoom parse failed.bodyLen is 0")},this.recvJoinRoom=function(t,e){for(var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV().tag201,n=this.read32BytesToString(r),a=r.readUint64Buffer(),o=r.readUint8Buffer(),s=r.readUint8Buffer(),h=[],_=0;_<s;_++){var l={},d=this.read32BytesToString(r),c=r.readUint64Buffer(),o=r.readUint8Buffer();l.openId=d,l.status=o,l.joinTs=c,h.push(l)}if(this.ownerId=n,this.createTs=a,this.status=o,this.playerNum=s,0==this.currentPlayers.length)h.forEach(function(t){this.newJoinPlayers.push(t)},this);else{var u=[];BK.Script.log(0,0,"recvJoinRoom!curPlayers = "+JSON.stringify(this.currentPlayers)),BK.Script.log(0,0,"recvJoinRoom!joinPlayers = "+JSON.stringify(h));for(_=0;_<h.length;_++){for(var l=h[_],f=!1,g=0;g<this.currentPlayers.length;g++)if(this.currentPlayers[g].openId==l.openId){f=!0;break}0==f&&u.push(l)}this.newJoinPlayers=u,BK.Script.log(0,0,"recvJoinRoom!newPlayers = "+JSON.stringify(this.newJoinPlayers))}this.currentPlayers=h,BK.Script.log(0,0,"recvJoinRoom ownerId="+n+",createTs ="+a+",playerNum:"+s)},this.recvLeaveRoom=function(t,e){var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV();if(r){var n=r.tag201,a=this.read32BytesToString(n),o=t.readUint64Buffer(),s=new Object;return BK.Script.log(0,0,"recvLeaveRoom!ret = "+o),s.reason=o,s.logOutId=a,this.currentPlayers.splice(this.currentPlayers.indexOf(a)),s}return void BK.Script.log(0,0,"recvLeaveRoom parse failed.bodylen is "+e)},this.recvStartGame=function(t,e){this.startGameTs=BK.Time.timestamp,BK.Script.log(0,0,"recvStartGame")},this.recvPushFrameSync=function(t,e){for(var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV(),n=(r.tag201,r.tag202,r.tag203),a=new Array,o=0;o<n.length;o++){var s=n[o].readUint32Buffer();this.lastFrame=s;var h=n[o].bufferLength()-4;BK.Script.log(0,0,"sync recv len= "+n[o].bufferLength()+" frameData.length="+n.length);for(var _=new Array;h>0;){BK.Script.log(0,0,"push frameNo="+this.lastFrame);var l=n[o].readUint16Buffer();BK.Script.log(0,0,"push databuf 2 datalen="+l);var d=this.read32BytesToString(n[o]),c=n[o].readUint64Buffer(),u={openId:d,itemId:c,dataBuffer:n[o].readBuffer(l)};BK.Script.log(0,0,"push databuf openid="+d),BK.Script.log(0,0,"push databuf itemid="+c),_.push(u),h-=42,h-=l}_.frameSeq=s,a.push(_)}this.frameSyncListener(a)},this.recvQueryFrameSync=function(t,e){var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV();if(!r)return BK.Script.log(0,0,"recvQueryFrameSync empty."),void this.queryFrameDataCallBack(0,void 0);for(var n=r.tag201,a=new Array,o=0;o<n.length;o++){var s=n[o].readUint32Buffer(),h=n[o].bufferLength()-4;BK.Script.log(0,0,"sync query recv = "+n[o].bufferLength()+" frameData.length="+n.length);for(var _=new Array;h>0;){BK.Script.log(0,0,"push frameNo="+this.lastFrame);var l=n[o].readUint16Buffer();BK.Script.log(0,0,"push databuf 2 datalen="+l);var d=this.read32BytesToString(n[o]),c=n[o].readUint64Buffer(),u={openId:d,itemId:c,dataBuffer:n[o].readBuffer(l)};BK.Script.log(0,0,"push databuf openid="+d),BK.Script.log(0,0,"push databuf itemid="+c),_.push(u),h-=42,h-=l}_.frameSeq=s,a.push(_)}BK.Script.log(0,0,"query end"),this.queryFrameDataCallBack(0,a)},this.recvControlCommand=function(t,e){var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV(),n={};r.tag201&&(n=JSON.parse(r.tag201.readAsString())),this.controlCommandCallback&&this.controlCommandCallback(0,n)},this.recvSSOJoinRoom=function(t,e,i){if(BK.Script.log(1,1,"recvSSOJoinRoom = true data="+JSON.stringify(i)),0==t){var r=i.data.avRoomId,n=i.data.sdkAppId,a=i.data.accountType;GameStatusInfo.avAppId=n,GameStatusInfo.avAccountType=a,GameStatusInfo.avRoomId=r,GameStatusInfo.roomId=this.roomId}},this.handleServerError=function(t,e){switch(BK.Script.log(0,1,"handleServerError!cmd = "+t.cmd+", errCode = "+t.ret),t.cmd){case 6:this.createRoomCallBack(t.ret,null,t.roomId);break;case 7:this.roomId=t.roomId,this.createRoomCallBack(header.ret,null,t.roomId);break;case 11:this.queryRoomInfoCallBack(t.ret,null);break;case 3:this.joinRoomCallBack(t.ret,this);break;case 4:case 5:this.leaveRoomCallBack(t.ret,null);break;case 9:this.startGameCallBack(t.ret);break;case 1:this.broadcastDataCallBack(t.fromId,null);break;case 51:this.sensitiveWordCallBack(t.ret,t.fromId,null);break;case 33:this.setUserDataCallBack(t.ret);break;case 35:this.getUserDataCallBack(t.ret,null);break;case 15:this.sendSyncOptCallBack(t.ret,null);break;case 16:break;case 19:this.queryFrameDataCallBack(t.ret,null);break;case 37:this.matchGameCallBack(t.ret);break;case 39:this.queryMatchGameCallBack(t.ret);break;case 41:this.quitMatchGameCallBack(t.ret);break;case 49:this.controlCommandCallback&&this.controlCommandCallback(t.ret,{})}},this.handleRecv=function(t){var e=this.getHeader(t);if(0!=e.stlen){t.readBuffer(e.stlen);BK.Script.log(0,0,"st.len = "+e.stlen)}var i=t.readBuffer(e.bodyLen);BK.Security.decrypt(i);var r=this.getFixedHeader(i);if(this.netTimeOutTs=0,0==r.ret)switch(BK.Script.log(0,0,"handleRecv = "+r.cmd+",bodyLen="+e.bodyLen+",bodyreal="+i.bufferLength()),r.cmd){case 7:this.roomId=r.roomId;var n=this.recvCreateRoom(i,i.bufferLength()-fixedHeaderLen);BK.Script.log(0,0,"magic = "+e.magic+",stlen = "+e.stlen+",bodyLen="+e.bodyLen+",cmd="+r.cmd+",roomId="+r.roomId),this.createRoomCallBack(r.ret,n,r.roomId),BK.QQ.notifyNewRoom(this.roomId,r.ret);break;case 11:var a=this.recvQueryRoom(i,i.bufferLength()-fixedHeaderLen);this.queryRoomInfoCallBack(r.ret,a),BK.Script.log(0,0,"magic = "+e.magic+",stlen = "+e.stlen+",bodyLen="+e.bodyLen+",cmd="+r.cmd+",roomId="+r.roomId);break;case 3:if(this.recvJoinRoom(i,i.bufferLength()-fixedHeaderLen),this.joinRoomCallBack(r.ret,this),1==Boolean(BK.QQ.isNeedSSOServer))for(var o=0;o<this.newJoinPlayers.length;o++)if(this.newJoinPlayers[o].openId==currentPlayerOpenId)return BK.QQ.ssoJoinRoomCallback=this.recvSSOJoinRoom.bind(this),void BK.QQ.notifyNewOrJoinRoomSrv(this.newJoinPlayers,this.roomId,this.ownerId==GameStatusInfo.openId?1:2);BK.QQ.notifyJoinRoom(this.newJoinPlayers,{},r.ret);break;case 5:var s=this.recvLeaveRoom(i,i.bufferLength()-fixedHeaderLen);this.leaveRoomCallBack&&this.leaveRoomCallBack(r.ret,s);break;case 9:this.recvStartGame(i,i.bufferLength()-fixedHeaderLen),this.startGameCallBack(r.ret),1==Boolean(BK.QQ.isNeedSSOServer)&&BK.QQ.notifyStartGameSrv(),0==r.ret&&(BK.QQ.hasJoinRoomSucc=!1);break;case 1:h=i.readBuffer(i.bufferLength()-fixedHeaderLen);this.broadcastDataCallBack(r.fromId,h,r.toId);break;case 51:h=i.readBuffer(i.bufferLength()-fixedHeaderLen);this.sensitiveWordCallBack(r.ret,r.fromId,h,r.toId);break;case 33:h=i.readBuffer(i.bufferLength()-fixedHeaderLen);this.setUserDataCallBack(r.ret);break;case 35:var h=i.readBuffer(i.bufferLength()-fixedHeaderLen);this.getUserDataCallBack(r.ret,h);break;case 15:var _=i.readUint32Buffer();this.ackSeq=_,this.sendSyncOptCallBack(r.ret,_);break;case 16:this.recvPushFrameSync(i,i.bufferLength()-fixedHeaderLen);break;case 19:this.recvQueryFrameSync(i,i.bufferLength()-fixedHeaderLen);break;case 37:this.matchGameCallBack(r.ret);break;case 39:this.roomId=r.roomId,this.queryMatchGameCallBack(r.ret);break;case 41:this.roomId=r.roomId,this.quitMatchGameCallBack(r.ret);break;case 49:this.recvControlCommand(i,i.bufferLength()-fixedHeaderLen)}else this.handleServerError(r)},this.requestSocket=function(t){var e;switch(BK.Script.log(0,0,"requestSocket = "+t.cmd),t.cmd){case 6:e=this.requestCreateRoom(t.arg0,t.arg1);break;case 10:e=this.requestQueryRoom();break;case 2:e=this.requestJoinRoom(t.arg0);break;case 4:e=this.requestLeaveRoom(t.arg0);break;case 8:e=this.requestStartGame();break;case 1:e=this.requestsendBroadcastData(t.arg0);break;case 50:e=this.requestSendSendSensitiveWordData(t.arg0);break;case 32:e=this.requestSetUserData(t.arg0);break;case 34:e=this.requestGetUserData(t.arg0);break;case 14:e=this.requestSyncOpt(t.arg0,t.arg1,t.arg2,t.arg3);break;case 18:e=this.requestQueryFrameData(t.arg0,t.arg1);break;case 36:e=this.requestMatch(t.arg0,t.arg1);break;case 38:e=this.requestQueryMatch(t.arg0,t.arg1);break;case 40:e=this.requestQuitMatch(t.arg0,t.arg1);break;case 12:e=this.requestSendKeepAlive(),0==this.netTimeOutTs&&(this.netTimeOutTs=BK.Time.timestamp);break;case 48:var i=new BK.Buffer,r=new BK.Buffer;i.writeAsString(t.arg1),r.writeAsString(t.arg2),e=this.requestControlCommand(t.arg0,i,r)}void 0!=e&&(BK.Script.log(0,0,"requestSocket = "+t.cmd),this.socket.send(e))},this.seperatePackHandle=function(){for(;;){var t=this.socket.receiveNotRemove(),e=t.bufferLength(),i=this.getHeader(t),r=i.stlen+i.bodyLen+HeaderLen;if(BK.Script.log(0,0,"this.socket.receive():totalLen = "+e+" onePackLen="+r),e==r){BK.Script.log(0,0," this.socket.receive():onePackLen="+r),void 0!=(n=this.socket.receive(r))&&this.handleRecv(n);break}if(e<r){BK.Script.log(0,0," this.socket.receive():part of onePackLen="+r);break}if(e>r){BK.Script.log(0,0," this.socket.receive():Multipacks onePackLen="+r);var n=this.socket.receive(r);void 0!=n&&this.handleRecv(n)}}},this.curConnRetrys=0,this.curConnTimeout=0,this.prevNetState=0,this.reConnectTime=0,this.updateNet=function(){var t=this.socket.update(),e=this.socket.state;if(-1!=t)switch(this.prevNetState){case 0:switch(e){case 3:this.onErrorEvent(this);break;case 1:this.onConnectingEvent(this);break;case 2:this.onConnectedEvent(this)}break;case 1:switch(e){case 2:switch(t){case 2:this.onConnectedEvent();break;case 3:BK.Script.log(0,0,"BK.Socket.update!unexcepted status")}}break;case 2:switch(e){case 2:this.onUpdateEvent();break;default:this.onErrorEvent()}}else switch(BK.Script.log(0,0,"BK.Socket.DisconnectEvent prevNetState="+this.prevNetState),this.prevNetState){case 3:case 2:case 1:this.onDisconnectEvent()}return this.prevNetState=e,t},this.onErrorEvent=function(){BK.Script.log(0,0,"BK.Socket.ErrorEvent")},this.onUpdateEvent=function(){return 0},this.onTimeoutEvent=function(){BK.Script.log(0,0,"BK.Socket.TimeoutEvent")},this.onConnectingEvent=function(){BK.Script.log(0,0,"BK.Socket.ConnectingEvent")},this.onConnectedEvent=function(){BK.Script.log(0,0,"BK.Socket.ConnectedEvent"),this.connectedNetCallback&&this.connectedNetCallback()},this.onReconnectEvent=function(){BK.Script.log(0,0,"BK.Socket.ReconnectEvent")},this.onDisconnectEvent=function(){BK.Script.log(0,0,"BK.Socket.DisconnectEvent"),this.disconnectNetCallBack&&this.disconnectNetCallBack(),this.reConnectTime<3?(BK.Script.log(0,0,"BK.Socket.DisconnectEvent reconnectAndJoinRoom"),(BK.Time.timestamp-this.startGameTs)/60<5?(this.reConnectTime++,this.reConnectAndJoinRoom()):BK.Script.log(0,0,"BK.Socket.DisconnectEvent over 5 min")):this.terminatedNetCallback&&this.terminatedNetCallback()},this.setConnectedNetCallBack=function(t){this.connectedNetCallback=t},this.setDisconnectNetCallBack=function(t){this.disconnectNetCallBack=t},this.setTerminatedNetCallback=function(t){this.terminatedNetCallback=t},this.updateSocket=function(){var t=this.updateNet();if((3==t||2==t)&&this.reqArray.length>0){var e=this.reqArray.pop();void 0!=e&&null!=e&&this.requestSocket(e)}return 3!=t&&1!=t||this.seperatePackHandle(),t},this.createAndJoinRoom=function(t,e,i,r,n){this.createRoom(t,e,function(t,e,a){0==t?(BK.Script.log(0,0,"创建游戏 statusCode:"+t+" roomId:"+a),this.gameSvrIp=e.ip_2,this.gameSvrPort=e.port_2,this.roomSvrIp=e.ip_1,this.roomSvrPort=e.port_1,this.socket.close(),this.socket.connect(this.gameSvrIp,this.gameSvrPort),this.joinRoom(0,function(t,e){BK.Script.log(0,0,"加入房间 statusCode:"+t+" roomid is "+e.roomId),0==t&&(GameStatusInfo.roomId=e.roomId,BK.QQ.gameCfg.roomId=e.roomId),n?1==BK.QQ.hasJoinRoomSucc?i(t,this):BK.QQ.delegate.onJoinRoomEvent=function(e,r,n){i(t,this)}.bind(this):i(t,this)},r,n)):i(t,this)})},this.queryAndJoinRoom=function(t,e,i,r,n,a){1!=this.serverConnected&&(this.socket.close(),this.socket.connect(this.recommandRoomSvrHost,this.recommandRoomSvrPort)),this.queryRoom(t,e,i,function(t,e){0==t?(this.gameSvrIp=e.ip_2,this.gameSvrPort=e.port_2,this.roomSvrIp=e.ip_1,this.roomSvrPort=e.port_1,this.socket.close(),this.socket.connect(this.gameSvrIp,this.gameSvrPort),this.joinRoom(0,function(t,e){BK.QQ.hasJoinRoomSucc=!0,BK.Script.log(0,0,"加入房间 statusCode:"+t+" roomid is "+e.roomId),r(t,this)},n,a)):r(t,void 0)})},this.socialMatch=function(t){this.roomId=Number(GameStatusInfo.roomId),BK.Script.log(1,1,"1v1匹配 玩家来源:"+GameStatusInfo.src+" 房间号:"+GameStatusInfo.roomId),this.createRoom(GameStatusInfo.gameId,GameStatusInfo.openId,function(e,i,r){BK.Script.log(1,1,"1v1匹配 创建房间 statusCode:"+e+" roomid:"+r),0==e?(this.isCreator=!0,this.gameSvrIp=i.ip_2,this.gameSvrPort=i.port_2,this.roomSvrIp=i.ip_1,this.roomSvrPort=i.port_1,this.socket.close(),this.socket.connect(this.gameSvrIp,this.gameSvrPort),this.joinRoom(GameStatusInfo.src,function(e,i){BK.Script.log(1,1,"1v1匹配 加入房间 statusCode:"+e+" roomid:"+i.roomId),0==e?(BK.Script.log(1,1,"1v1匹配 加入房间成功"),t(e,i)):(BK.Script.log(1,1,"1v1匹配 加入房间失败 statusCode:"+e+" 具体错误码参见http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),t(e,this))},!0,!0)):2007==e?(this.isCreator=!1,this.queryRoom(GameStatusInfo.gameId,GameStatusInfo.roomId,GameStatusInfo.openId,function(e,i){BK.Script.log(1,1,"1v1匹配 查询房间 statusCode:"+e+" roomId:"+r+" 房间中玩家数:"+i.playerNum),0==e&&i?(this.gameSvrIp=i.ip_2,this.gameSvrPort=i.port_2,this.roomSvrIp=i.ip_1,this.roomSvrPort=i.port_1,this.socket.close(),this.socket.connect(this.gameSvrIp,this.gameSvrPort),this.joinRoom(GameStatusInfo.src,function(e,i){BK.Script.log(1,1,"1v1匹配 加入房间 statusCode:"+e+" roomid:"+i.roomId),0==e?(BK.Script.log(1,1,"1v1匹配 加入房间成功"),t(e,i)):(BK.Script.log(1,1,"1v1匹配 加入房间失败 statusCode:"+e+" 具体错误码参见http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),t(e,this))},!0,!0)):(BK.Script.log(1,1,"1v1匹配 查询房间失败 statusCode:"+e+" 具体错误码参见http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),t(e,this))})):(BK.Script.log(1,1,"1v1匹配 创建房间失败 statusCode:"+e+" 具体错误码参见http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),t(e,this))})},this.showOneMorePage=function(t,e){var i=[],r=0;if(e&&2==e.length)for(var n=0;n<e.length;n++){r=2!=t&&GameStatusInfo.openId==e[n]?t:2==t?2:2!=t&&GameStatusInfo.openId!=e[n]?1-t:-1;a={openId:e[n],scoreState:r};BK.Script.log(1,1,"玩家信息 playerInfo:"+JSON.stringify(a)),i.push(a)}else if(this.newJoinPlayers){if(this.newJoinPlayers.forEach(function(e){r=2!=t&&GameStatusInfo.openId==e.openId?t:2==t?2:2!=t&&GameStatusInfo.openId!=e.openId?1-t:-1;var n={openId:e.openId,scoreState:r};BK.Script.log(1,1,"玩家信息 playerInfo:"+JSON.stringify(n)),i.push(n)},this),this.isCreator){2!=t?r=t:2==t&&(r=2);var a={openId:this.ownerId,scoreState:r};BK.Script.log(1,1,"玩家信息 playerInfo:"+JSON.stringify(a)),i.push(a)}}else BK.Script.log(1,1,"再来一局失败,openIds(自建后台)或newJoinPlayers(非自建后台)为null或者undefined");var o={scoreState:t,playerInfos:i};BK.Script.log(1,1,"再来一局成功 data:"+JSON.stringify(o)),BK.MQQ.SsoRequest.send(o,CMSHOW_CS_CMD_SHOW_ONE_MORE_PAGE)},this.forceLeaveRoom=function(t,e){var i=new Object;i.cmd=4,i.arg0=e,this.leaveRoomCallBack=t;var r=this.requestLeaveRoom(i.arg0),n=this.socket.update();3==n||2==n?(this.socket.send(r),BK.Script.log(0,0,"forceLeaveRoom push")):BK.Script.log(0,0,"forceLeaveRoom push Failed. Socket not allow Send.")},this._event4StopGame=function(t,e,i){BK.Script.log(0,0,"BK.Room._event4StopGame!errCode = "+t+", cmd = "+e+", data = "+JSON.stringify(i)),0==t&&this.forceLeaveRoom(function(t,e){BK.Script.log(0,0,"forceLeaveRoom callback")},0)},BK.MQQ.SsoRequest.addListener(CMSHOW_SC_CMD_STOP_GAME,this,this._event4StopGame.bind(this)),this.addDebugFunctions=function(){this.createFixedRoom=function(t,e,i,r){this.roomId=i,this.mId=e,this.gameId=t;var n=this.socket.connect(this.recommandRoomSvrHost,this.recommandRoomSvrPort);BK.Script.log(0,0,"socket con ="+n),-1!=n&&BK.Script.log(0,0,"socket connect failed! "+n),this.createRoomCallBack=r;var a=new Object;a.cmd=6,a.arg0=t,a.arg1=e,this.reqArray.push(a),BK.Script.log(0,0,"create Fixed Room ")},this.createAndJoinFixedRoom=function(t,e,i,r,n){this.createFixedRoom(t,e,i,function(t,e,i){0==t?(BK.Script.log(0,0,"创建固定房间号 游戏 statusCode:"+t+" roomId:"+i),this.gameSvrIp=e.ip_2,this.gameSvrPort=e.port_2,this.roomSvrIp=e.ip_1,this.roomSvrPort=e.port_1,this.socket.close(),this.socket.connect(this.gameSvrIp,this.gameSvrPort),this.joinRoom(0,function(t,e){BK.Script.log(0,0,"加入房间 statusCode:"+t+" roomid is "+e.roomId),r(t,this)},n)):r(t,this)})},this.requestCreateRoom=function(t,e){var i=this.roomId;i||(i=0),BK.Script.log(0,0,"create fixed room request in fixedRoomId:"+i);var r=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(r,6,t,i,e);var n=BK.Security.getST();BK.Security.encrypt(r);var a=n.bufferLength(),o=new BK.Buffer(HeaderLen+r.bufferLength()+a,1);return this.addHeader(o,r.bufferLength(),a),o.writeBuffer(n),o.writeBuffer(r),BK.Script.log(0,0,"create room request buffer : "+o.bufferLength()+" body len:"+r.bufferLength()),o}},Object.defineProperty(this,"environment",{get:function(){return this._environment},set:function(t){BK.Script.log(0,0,"Set Environment failed!Can't set the environment!!!")}}),GameStatusInfo.devPlatform?(this._environment=NETWORK_ENVIRONMENT_DEMO_DEV,BK.Script.log(1,1,"当前环境为---开发环境")):1==GameStatusInfo.isWhiteUser?(this._environment=NETWORK_ENVIRONMENT_QQ_DEBUG,BK.Script.log(1,1,"当前环境为---手Q开发环境")):(this._environment=NETWORK_ENVIRONMENT_QQ_RELEASE,BK.Script.log(1,1,"当前环境为---正式环境")),this._environment==NETWORK_ENVIRONMENT_QQ_DEBUG?(this.headerVersion=769,this.recommandRoomSvrHost=DebugRecommandRoomSvrHost,this.recommandRoomSvrPort=DebugRecommandRoomSvrPort):this._environment==NETWORK_ENVIRONMENT_DEMO_DEV&&(this.addDebugFunctions(),this.headerVersion=257,this.recommandRoomSvrHost=DebugRecommandRoomSvrHost,this.recommandRoomSvrPort=DebugRecommandRoomSvrPort)},function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Device=e(),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_ENTER_BACKGROUND,this,function(){BK.Script.log(1,1,"keepScreenOn CMD_CMSHOW_GAME_ENTER_BACKGROUND "),BK.Device.innnerSetKeepScreenOn(!1)}),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_ENTER_FORGROUND,this,function(){BK.Script.log(1,1,"keepScreenOn CMD_CMSHOW_GAME_ENTER_FORGROUND "),BK.Device.isKeepScreenOnInit?BK.Device.innnerSetKeepScreenOn(BK.Device.userSetDeviceScreenValue):BK.Device.innnerSetKeepScreenOn(!1)}),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_MINIMIZE,this,function(){BK.Script.log(1,1,"keepScreenOn CMD_CMSHOW_GAME_MINIMIZE "),BK.Device.innnerSetKeepScreenOn(!1)}),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_MAXIMIZE,this,function(){BK.Script.log(1,1,"keepScreenOn CMD_CMSHOW_GAME_MAXIMIZE "),BK.Device.isKeepScreenOnInit?BK.Device.innnerSetKeepScreenOn(BK.Device.userSetDeviceScreenValue):BK.Device.innnerSetKeepScreenOn(!1)}),BK.MQQ.SsoRequest.addListener(CMSHOW_SC_CMD_STOP_GAME,this,function(){BK.Script.log(1,1,"keepScreenOn CMSHOW_SC_CMD_STOP_GAME "),BK.Device.innnerSetKeepScreenOn(!1)}))}(BK,function(){function t(){this.isKeepScreenOnInit=!1,this.userSetDeviceScreenValue=void 0,BK.Director.isKeepScreenOn=!1}return t.prototype.innnerSetKeepScreenOn=function(t){this.isKeepScreenOnInit?(BK.QQ.uploadData("call_screen_on",GameStatusInfo.src,t?1:0,"","",""),BK.Director.isKeepScreenOn=t):BK.Script.log(1,1,"user unset keepScreenOn,ignore the value")},t.prototype.setKeepScreenOn=function(t){BK.Script.log(1,1,"user set keepScreenOn "+t),this.userSetDeviceScreenValue=t,this.isKeepScreenOnInit=!0,this.innnerSetKeepScreenOn(t)},new t}),BK.Script.log(0,0,"filemanage.js is loaded"),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.FileManager=e())}(BK,function(){function t(){BK.FileUtil.getCompleteQueue&&(this.taskQ=new Array,BK.Director.ticker.add(function(){for(var t=BK.FileUtil.getCompleteQueue();t.length>0;)for(var e=t.shift(),i=0;i<this.taskQ.length;i++){var r=this.taskQ[i];if(r.taskId==e.id){this.taskQ.splice(i,1);for(var n=0;n<e.res.length;n++)switch(r.taskInfo[n].tag){case 1:r.callback&&(void 0!=r.taskInfo[n].encoding&&"binary"!=r.taskInfo[n].encoding||e.res[n].errcode&&(e.res[n].data={}))}r.callback(e.res);break}}}.bind(this)))}return t.Instance=new t,t.prototype._addReadIOTask=function(t,e){var i=BK.FileUtil.addReadIOTask(t);-1!=i&&(this.taskQ.push({taskId:i,taskInfo:t,callback:e}),this.name="fm 0")},t.prototype.readFile=function(t,e){if(BK.FileUtil.addReadIOTask&&t&&t.file){for(var i=new Array,r=0;r<t.file.length;r++)void 0!=t.file[r].path&&i.push({tag:1,path:t.file[r].path,encoding:void 0==t.file[r].encoding?"binary":t.file[r].encoding,netOrder:void 0==t.file[r].netOrder?0:t.file[r].netOrder});this._addReadIOTask(i,e)}},t.prototype._addWriteIOTask=function(t,e){var i=BK.FileUtil.addWriteIOTask(t);-1!=i&&this.taskQ.push({taskId:i,taskInfo:t,callback:e})},t.prototype.writeFile=function(t,e){if(BK.FileUtil.addWriteIOTask&&t&&t.file){for(var i=new Array,r=0;r<t.file.length;r++)void 0!=t.file[r].path&&t.file[r].data&&i.push({tag:1,path:t.file[r].path,encoding:void 0==t.file[r].encoding?"binary":t.file[r].encoding,data:t.file[r].data});this._addWriteIOTask(i,e)}},t.prototype._addZipIOTask=function(t,e){var i=BK.FileUtil.addZipIOTask(t);-1!=i&&this.taskQ.push({taskId:i,taskInfo:t,callback:e})},t.prototype.zipAsync=function(t,e){if(BK.FileUtil.addZipIOTask){if(t&&t.file){for(var i=new Array,r=0;r<t.file.length;r++)t.file[r].path&&t.file[r].zipPath&&i.push({tag:2,path:t.file[r].path,zipPath:t.file[r].zipPath});this._addZipIOTask(i,e)}}else{var n=new Array;if(t&&t.file)for(r=0;r<t.file.length;r++){var a=t.file[r];if(a.path&&a.zipPath){var o=BK.FileUtil.zip(a.path,a.zipPath);n.push({errcode:1==o?0:-1,errmsg:"zip failed!",path:a.path,zipPath:a.zipPath})}}e&&e(n)}},t.prototype._addUnzipIOTask=function(t,e){var i=BK.FileUtil.addUnzipIOTask(t);-1!=i&&this.taskQ.push({taskId:i,taskInfo:t,callback:e})},t.prototype.unzipAsync=function(t,e){if(BK.FileUtil.addUnzipIOTask){if(t&&t.file){for(var i=new Array,r=0;r<t.file.length;r++)t.file[r].path&&t.file[r].zipPath&&i.push({tag:2,path:t.file[r].path,zipPath:t.file[r].zipPath});this._addUnzipIOTask(i,e)}}else{var n=new Array;if(t&&t.file)for(r=0;r<t.file.length;r++){var a=t.file[r];if(a.path&&a.zipPath){var o=BK.FileUtil.unzip(a.zipPath,a.path);n.push({errcode:1==o?0:-1,errmsg:"unzip failed!",path:a.path,zipPath:a.zipPath})}}e&&e(n)}},t}),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.DNS=e())}(BK,function(){function t(){this.records=[],this.running=!1}return t.prototype.exists=function(t){for(var e=0;e<this.records.length;e++)if(this.records[e].hostname===t)return!0;return!1},t.prototype.query=function(t,e){for(var i=0;i<this.records.length;i++)if(this.records[i].af===e&&this.records[i].hostname===t)return this.records[i];return null},t.prototype.update=function(t,e,i,r){for(var n=0;n<this.records.length;n++)if(this.records[n].af===i&&this.records[n].hostname===t)return void this.records[n].callbacks.push(e);this.records.push({af:i,timeout:r,hostname:t,callbacks:[e]})},t.prototype.delete=function(t){for(var e=this.records.length-1;e>=0;e--)if(this.records[e].hostname===t){this.records.splice(e,1);break}},t.prototype.start=function(){if(!this.running){this.running=!0;var t=this;BK.Director.ticker.add(function(e,i){t.records.length&&BK.Misc.handleDNSQueryResult()})}},t.prototype.queryIPAddress=function(t,e,i,r){var n=!this.exists(t);if(void 0==i&&(i=2),void 0==r&&(r=0),this.update(t,e,i,r),n){var a=this;a.start(),BK.Misc.queryIPAddress(t,function(e,i,r){var n=a.query(t,i);if(n)for(var o=n.callbacks,s=0;s<o.length;s++)o[s].call(a,e,i,r);a.delete(t)},i,r)}},new t}),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.HTTPParser=e())}(this,function(){function t(t){this.onHeaders=void 0,this.onComplete=void 0,this.reinitialize(t)}var e=/^HTTP\/1\.([01]) ([0-9]{3})(?: ((?:[\x21-\x7E](?:[\t ]+[\x21-\x7E])*)*))?$/,i=/^([!#$%'*+\-.^_`|~0-9A-Za-z]+):[\t ]*((?:[\x21-\x7E](?:[\t ]+[\x21-\x7E])*)*)[\t ]*$/,r=/^[\t ]+(.*)$/;return t.prototype.reinitialize=function(e){this.execute=this._executeHeader,this.type=e,e===t.RESPONSE&&(this._state=1),this._err=void 0,this._flags=0,this._contentLen=void 0,this._nbytes=0,this._nhdrbytes=0,this._nhdrpairs=0,this._buf="",this._seenCR=!1,this.headers={},this.httpMajor=1,this.httpMinor=void 0,this.maxHeaderPairs=2e3,this.method=void 0,this.url=void 0,this.statusCode=void 0,this.statusText=void 0},t.prototype._processHdrLine=function(t){switch(this._state){case 2:if(0===t.length)return void this._headersEnd();if(null===(l=i.exec(t))){if(null===(l=r.exec(t)))return this.execute=this._executeError,this._err=new Error("Malformed header line"),this.execute(this._err),this._err;var n=l[1];n.length>0&&BK.Script.log(1,0,"processHdrLine!extra = "+n)}else{var a=l[1],o=l[2];switch(a.toLowerCase()){case"connection":"close"===(s=o.toLowerCase()).substring(0,5)?this._flags|=4:"keep-alive"===s.substring(0,10)?this._flags|=2:"upgrade"===s.substring(0,7)&&(this._flags|=8);break;case"transfer-encoding":var s=o.toLowerCase();"chunked"===s.substring(0,7)&&(this._flags|=1);break;case"upgrade":this._flags|=32;break;case"content-length":var h=parseInt(o,10);if(isNaN(h)||h>524288)return this.execute=this._executeError,this._err=new Error("Bad Content-Length: "+inspect(h)),this.execute(this._err),this._err;this._contentLen=h}var _=this.maxHeaderPairs;(_<=0||++this._nhdrpairs<_)&&(this.headers[a.toLowerCase()]=o)}break;case 1:if(0===t.length)return!0;var l=e.exec(t);if(null===l)return this.execute=this._executeError,this._err=new Error("Malformed status line"),this.execute(this._err),this._err;this.httpMinor=parseInt(l[1],10),this.statusCode=parseInt(l[2],10),this.statusText=l[3]||"",this._state=2;break;default:return this.execute=this._executeError,this._err=new Error("Unexpected HTTP parser state: "+this._state),this.execute(this._err),this._err}},t.prototype._headersEnd=function(){var t=this._flags,e=this.method&&this.method.toLowerCase(),i=40==(40&t)||"connect"===e,r=0==(4&t),n=this._contentLen;if(this._buf="",this._seenCR=!1,this._nbytes=0,(0===this.httpMajor&&9===this.httpMinor||0===this.httpMinor&&0==(2&t))&&(r=!1),(16&t)>0)return this.onComplete&&this.onComplete(),void this.reinitialize(this.type);if(this.onHeaders){var a=this.headers;!0===this.onHeaders(this.httpMajor,this.httpMinor,a,this.method,this.url,this.statusCode,this.statusText,i,r)&&(t=this._flags|=64)}i?(this.onComplete&&this.onComplete(),this._state=3):(0===n||(64&t)>0||0==(1&t)&&void 0===n&&!this._needsEOF())&&(this.onComplete&&this.onComplete(),this.reinitialize(this.type))},t.prototype._executeHeader=function(t){for(var e,i,r,n=0,a=t.length,o=this._seenCR,s=this._buf,h=this._nhdrbytes;n<a;){if(o)if(o=!1,10===t.charCodeAt(n)){if(++n,i=this._processHdrLine(s),s="","object"==typeof i)return this._err=i,this.execute(this._err),i;if(void 0===i&&2!==(l=this._state))return l<3&&n<a?(i=this.execute(t.slice(n)),"number"!=typeof i?(this._err=i,this.execute(this._err),i):n+i):(3===l&&this.reinitialize(this.type),n)}else if(s+="\r",++h>81920)return this.execute=this._executeError,this._err=new Error("Header size limit exceeded (81920)"),this.execute(this._err),this._err;if(!((e=t.indexOf("\r\n",n))>-1)){var _;if(13===t.charCodeAt(a-1)?(o=!0,_=a-1):_=a,(h+=_-n)>81920)return this.execute=this._executeError,this._err=new Error("Header size limit exceeded (81920)"),this.execute(this._err),this._err;s+=t.substring(n,_);break}if((r=e-n)>0){if((h+=r)>81920)return this.execute=this._executeError,this._err=new Error("Header size limit exceeded (81920)"),this.execute(this._err),this._err;s+=t.substring(n,e)}if(n=e+2,i=this._processHdrLine(s),s="","object"==typeof i)return this._err=i,this.execute(this._err),i;if(void 0===i){var l=this._state;if(2!==l)return l<3&&n<a?(i=this.execute(t.slice(n)),"number"!=typeof i?(this._err=i,this.execute(this._err),i):n+i):(3===l&&this.reinitialize(this.type),n)}}return this._buf=s,this._seenCR=o,this._nhdrbytes=h,a},t.prototype._executeError=function(t){return BK.Script.log(1,0,"_executeError!err = "+t.message),this._err},t.prototype.execute=t.prototype._executeHeader,t.prototype._needsEOF=function(){if(this.type===t.REQUEST)return!1;var e=this.statusCode,i=this._flags;return!(void 0!==e&&(204===e||304===e||1===parseInt(e/100,1))||64&i)&&!((1&i)>0||void 0!=this._contentLen)},t.REQUEST=0,t.RESPONSE=1,t}),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.URL=e())}(BK,function(){return function(){function t(){return new RegExp(/(.*?)\.?([^\.]*?)\.?(com|net|org|biz|ws|in|me|co\.uk|co|org\.uk|ltd\.uk|plc\.uk|me\.uk|edu|mil|br\.com|cn\.com|eu\.com|hu\.com|no\.com|qc\.com|sa\.com|se\.com|se\.net|us\.com|uy\.com|ac|co\.ac|gv\.ac|or\.ac|ac\.ac|af|am|as|at|ac\.at|co\.at|gv\.at|or\.at|asn\.au|com\.au|edu\.au|org\.au|net\.au|id\.au|be|ac\.be|adm\.br|adv\.br|am\.br|arq\.br|art\.br|bio\.br|cng\.br|cnt\.br|com\.br|ecn\.br|eng\.br|esp\.br|etc\.br|eti\.br|fm\.br|fot\.br|fst\.br|g12\.br|gov\.br|ind\.br|inf\.br|jor\.br|lel\.br|med\.br|mil\.br|net\.br|nom\.br|ntr\.br|odo\.br|org\.br|ppg\.br|pro\.br|psc\.br|psi\.br|rec\.br|slg\.br|tmp\.br|tur\.br|tv\.br|vet\.br|zlg\.br|br|ab\.ca|bc\.ca|mb\.ca|nb\.ca|nf\.ca|ns\.ca|nt\.ca|on\.ca|pe\.ca|qc\.ca|sk\.ca|yk\.ca|ca|cc|ac\.cn|com\.cn|edu\.cn|gov\.cn|org\.cn|bj\.cn|sh\.cn|tj\.cn|cq\.cn|he\.cn|nm\.cn|ln\.cn|jl\.cn|hl\.cn|js\.cn|zj\.cn|ah\.cn|gd\.cn|gx\.cn|hi\.cn|sc\.cn|gz\.cn|yn\.cn|xz\.cn|sn\.cn|gs\.cn|qh\.cn|nx\.cn|xj\.cn|tw\.cn|hk\.cn|mo\.cn|cn|cx|cz|de|dk|fo|com\.ec|tm\.fr|com\.fr|asso\.fr|presse\.fr|fr|gf|gs|co\.il|net\.il|ac\.il|k12\.il|gov\.il|muni\.il|ac\.in|co\.in|org\.in|ernet\.in|gov\.in|net\.in|res\.in|is|it|ac\.jp|co\.jp|go\.jp|or\.jp|ne\.jp|ac\.kr|co\.kr|go\.kr|ne\.kr|nm\.kr|or\.kr|li|lt|lu|asso\.mc|tm\.mc|com\.mm|org\.mm|net\.mm|edu\.mm|gov\.mm|ms|nl|no|nu|pl|ro|org\.ro|store\.ro|tm\.ro|firm\.ro|www\.ro|arts\.ro|rec\.ro|info\.ro|nom\.ro|nt\.ro|se|si|com\.sg|org\.sg|net\.sg|gov\.sg|sk|st|tf|ac\.th|co\.th|go\.th|mi\.th|net\.th|or\.th|tm|to|com\.tr|edu\.tr|gov\.tr|k12\.tr|net\.tr|org\.tr|com\.tw|org\.tw|net\.tw|ac\.uk|uk\.com|uk\.net|gb\.com|gb\.net|vg|sh|kz|ch|info|ua|gov|name|pro|ie|hk|com\.hk|org\.hk|net\.hk|edu\.hk|us|tk|cd|by|ad|lv|eu\.lv|bz|es|jp|cl|ag|mobi|eu|co\.nz|org\.nz|net\.nz|maori\.nz|iwi\.nz|io|la|md|sc|sg|vc|tw|travel|my|se|tv|pt|com\.pt|edu\.pt|asia|fi|com\.ve|net\.ve|fi|org\.ve|web\.ve|info\.ve|co\.ve|tel|im|gr|ru|net\.ru|org\.ru|hr|com\.hr|ly|xyz)$/)}function e(t){return decodeURIComponent(t.replace(/\+/g," "))}function i(t,e){var i=t.charAt(0),r=e.split(i);return i===t?r:(t=parseInt(t.substring(1),10),r[t<0?r.length+t:t-1])}function r(t,i){for(var r=t.charAt(0),n=i.split("&"),a=[],o={},s=[],h=t.substring(1),_=0,l=n.length;_<l;_++)if((a=n[_].match(/(.*?)=(.*)/))||(a=[n[_],n[_],""]),""!==a[1].replace(/\s/g,"")){if(a[2]=e(a[2]||""),h===a[1])return a[2];(s=a[1].match(/(.*)\[([0-9]+)\]/))?(o[s[1]]=o[s[1]]||[],o[s[1]][s[2]]=a[2]):o[a[1]]=a[2]}return r===t?o:o[h]}return function(e,n){var a,o={};if("tld?"===e)return t();if(n=n||window.location.toString(),!e)return n;if(e=e.toString(),a=n.match(/^mailto:([^\/].+)/))o.protocol="mailto",o.email=a[1];else{if((a=n.match(/(.*?)\/#\!(.*)/))&&(n=a[1]+a[2]),(a=n.match(/(.*?)#(.*)/))&&(o.hash=a[2],n=a[1]),o.hash&&e.match(/^#/))return r(e,o.hash);if((a=n.match(/(.*?)\?(.*)/))&&(o.query=a[2],n=a[1]),o.query&&e.match(/^\?/))return r(e,o.query);if((a=n.match(/(.*?)\:?\/\/(.*)/))&&(o.protocol=a[1].toLowerCase(),n=a[2]),(a=n.match(/(.*?)(\/.*)/))&&(o.path=a[2],n=a[1]),o.path=(o.path||"").replace(/^([^\/])/,"/$1"),e.match(/^[\-0-9]+$/)&&(e=e.replace(/^([^\/])/,"/$1")),e.match(/^\//))return i(e,o.path.substring(1));if((a=i("/-1",o.path.substring(1)))&&(a=a.match(/(.*?)\.(.*)/))&&(o.file=a[0],o.filename=a[1],o.fileext=a[2]),(a=n.match(/(.*)\:([0-9]+)$/))&&(o.port=a[2],n=a[1]),(a=n.match(/(.*?)@(.*)/))&&(o.auth=a[1],n=a[2]),o.auth&&(a=o.auth.match(/(.*)\:(.*)/),o.user=a?a[1]:o.auth,o.pass=a?a[2]:void 0),o.hostname=n.toLowerCase(),"."===e.charAt(0))return i(e,o.hostname);t()&&(a=o.hostname.match(t()))&&(o.tld=a[3],o.domain=a[2]?a[2]+"."+a[3]:void 0,o.sub=a[1]||void 0),o.port||("http"===o.protocol||"ws"===o.protocol?o.port="80":"https"!==o.protocol&&"wss"!==o.protocol||(o.port="443"))}return e in o?o[e]:"{}"===e?o:void 0}}()});var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();!function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.WebSocket=e())}(BK,function(){var t=function(){function t(){this._wsArray=[],BK.Director.ticker.add(function(e,i){t.Instance.dispatchEvent()})}return t.prototype.add=function(t){this._wsArray.push(t),BK.Script.log(1,0,"SocketEventMgr.add!so = "+t)},t.prototype.del=function(t){var e=this._wsArray.indexOf(t,0);e>=0&&(this._wsArray.splice(e,1),BK.Script.log(1,0,"SocketEventMgr.del!so = "+t))},t.prototype.dispatchEvent=function(){this._wsArray.forEach(function(t,e,i){t&&t.update()})},t.Instance=new t,t}(),e=function(){function e(t,e){this.ip=t,this.port=e,this.__nativeObj=new BK.Socket,this.prevConnTs=0,this.curConnRetrys=0,this.curConnTimeout=0,this.prevNetState=0,this.prevNetStateUpdateFlag=!1,this.options={ConnectRetryCount:3,ConnectTimeoutInterval:3e3}}return e.prototype.__internalClose=function(){return this.__nativeObj?this.__nativeObj.close():-2},e.prototype.__internalSend=function(t){return this.__nativeObj?this.__nativeObj.send(t):-2},e.prototype.__internalRecv=function(t){if(this.__nativeObj)return this.__nativeObj.receive(t)},e.prototype.__internalUpdate=function(){return this.__nativeObj?this.__nativeObj.update():-2},e.prototype.__internalConnect=function(){if(this.__nativeObj){var t=this.__nativeObj.connect(this.ip,this.port),e=this.curNetState();switch(this.prevNetState){case 3:this.onReconnectEvent(this);case 0:switch(e){case 3:this.onErrorEvent(this);break;case 1:case 4:this.prevConnTs=BK.Time.clock,this.curConnTimeout||(this.curConnTimeout=this.options.ConnectTimeoutInterval),this.onConnectingEvent(this),t=0;break;case 2:case 5:this.onConnectedEvent(this),t=0}}return this.prevNetState=e,this.prevNetStateUpdateFlag=!0,t}return-2},e.prototype.__internalCanReadLength=function(){return this.__nativeObj?this.__nativeObj.canReadLength():0},e.prototype.__internalIsEnableSSL=function(){return!!this.__nativeObj&&this.__nativeObj.getSSLEnable()},e.prototype.__internalEnableSSL=function(t){this.__nativeObj&&this.__nativeObj.setSSLEnable(t)},e.prototype.__internalUpdateSSL=function(){var t=this.__internalUpdate(),e=this.curNetState();if(-1!=t)switch(this.prevNetState){case 1:switch(e){case 2:BK.Script.log(1,0,"BK.Socket.update.ssl!connected, ip = "+this.ip+", port = "+this.port);break;case 4:case 5:break;default:i=BK.Time.clock;return 1e3*(r=BK.Time.diffTime(this.prevConnTs,i))>=this.curConnTimeout&&(this.curConnRetrys=this.curConnRetrys+1,this.curConnRetrys<this.options.ConnectRetryCount?(this.close(),this.connect(),this.curConnTimeout=2*this.curConnTimeout):(this.onTimeoutEvent(this),this.close())),t}break;case 2:break;case 4:switch(e){case 5:switch(t){case 2:case 3:this.onConnectedEvent(this)}break;default:var i=BK.Time.clock,r=BK.Time.diffTime(this.prevConnTs,i);return 1e3*r>=this.curConnTimeout&&(this.curConnRetrys=this.curConnRetrys+1,this.curConnRetrys<this.options.ConnectRetryCount?(this.close(),this.connect(),this.curConnTimeout=2*this.curConnTimeout):(this.onTimeoutEvent(this),this.close())),t}break;case 5:switch(e){case 5:this.onUpdateEvent(this);break;case 3:this.onDisconnectEvent(this);break;default:this.onErrorEvent(this)}}else switch(this.prevNetState){case 2:case 1:this.onDisconnectEvent(this);break;case 4:case 6:case 5:this.onErrorEvent(this)}return this.prevNetStateUpdateFlag||(this.prevNetState=e,this.prevNetStateUpdateFlag=!0),t},e.prototype.__internalUpdateNoSSL=function(){var t=this.__internalUpdate(),e=this.curNetState();if(-1!=t)switch(this.prevNetState){case 1:switch(e){case 2:switch(t){case 2:this.onConnectedEvent(this);break;case 3:BK.Script.log(1,0,"BK.Socket.update!unexcepted status")}break;default:var i=BK.Time.clock;return 1e3*BK.Time.diffTime(this.prevConnTs,i)>=this.curConnTimeout&&(this.curConnRetrys=this.curConnRetrys+1,this.curConnRetrys<this.options.ConnectRetryCount?(this.close(),this.connect(),this.curConnTimeout=2*this.curConnTimeout):(this.onTimeoutEvent(this),this.close())),t}break;case 2:switch(e){case 2:this.onUpdateEvent(this);break;case 3:this.onDisconnectEvent(this);break;default:this.onErrorEvent(this)}}else switch(this.prevNetState){case 2:case 1:this.onDisconnectEvent(this)}return this.prevNetStateUpdateFlag||(this.prevNetState=e,this.prevNetStateUpdateFlag=!0),t},e.prototype.curNetState=function(){return this.__nativeObj?this.__nativeObj.state:0},e.prototype.close=function(){var e=this.__internalClose();return e||(this.prevNetState=0,this.prevNetStateUpdateFlag=!0),t.Instance.del(this),e},e.prototype.send=function(t){var i=this.__internalSend(t);return i<0&&(this.onErrorEvent(this),e.prototype.close.call(this)),i},e.prototype.recv=function(t){return this.__internalRecv(t)},e.prototype.canRecvLength=function(){return this.__internalCanReadLength()},e.prototype.update=function(){return this.prevNetStateUpdateFlag=!1,this.isEnableSSL()?this.__internalUpdateSSL():this.__internalUpdateNoSSL()},e.prototype.connect=function(){var e=this.curNetState();if(0==e||3==e){var i=this.__internalConnect();return i||t.Instance.add(this),i}return 0},e.prototype.isEnableSSL=function(){return this.__internalIsEnableSSL()},e.prototype.enableSSL=function(t){this.__internalEnableSSL(t)},e.prototype.onErrorEvent=function(t){BK.Script.log(1,0,"BK.Socket.ErrorEvent")},e.prototype.onUpdateEvent=function(t){return 0},e.prototype.onTimeoutEvent=function(t){BK.Script.log(1,0,"BK.Socket.TimeoutEvent")},e.prototype.onConnectingEvent=function(t){BK.Script.log(1,0,"BK.Socket.ConnectingEvent")},e.prototype.onConnectedEvent=function(t){BK.Script.log(1,0,"BK.Socket.ConnectedEvent")},e.prototype.onReconnectEvent=function(t){BK.Script.log(1,0,"BK.Socket.ReconnectEvent")},e.prototype.onDisconnectEvent=function(t){BK.Script.log(1,0,"BK.Socket.DisconnectEvent")},e}(),i=function(){function t(t,e){this.data=t,this.isBinary=e}return t}(),r=function(t){function e(e,i,r,n,a){var o=t.call(this,e,i)||this;return o.path=n||"/",o.host=r,o.query=a,o.httpVer=1.1,o.httpParser=new HTTPParser(HTTPParser.RESPONSE),o.version=13,o.protocols=new Array,o.extensions=new Array,o.delegate={onOpen:null,onClose:null,onError:null,onMessage:null,onSendComplete:null},o.options||(o.options={}),o.options.DrainSegmentCount=8,o.options.DefaultSegmentSize=4096,o.options.PingPongInterval=0,o.options.HandleShakeRequestTimeout=1e4,o.options.HandleShakeResponseTimeout=1e4,o.options.CloseAckTimeout=2e3,o.options.PingPongTimeout=3e3,o.clear(),o}return __extends(e,t),e.prototype.clear=function(){this.mask4=new BK.Buffer(4,!1),this.txbuf=new BK.Buffer(128,!0),this.rxbuf=new BK.Buffer(128,!0),this.txMsgQue=new Array,this.rxbufQue=new Array,this.udataQue=new Array,this.peerClosed=!1,this.txSegCount=0,this.rxSegCount=0,this.rxFrameType=-1,this.isFinalSeg=!1,this.inTxSegFrame=!1,this.inRxSegFrame=!1,this.inPartialTxbuf=!1,this.inPingFrame=!1,this.inPongFrame=!1,this.errcode=65535,this.state=0,this.parseState=0,this.phaseTimeout=0,this.pingpongTimer=0,this.prevPhaseTickCount=0,this.prevPingPongTickCount=0,this.framePackageCount=0},e.prototype.getReadyState=function(){return this.state},e.prototype.getErrorCode=function(){return this.errcode},e.prototype.getErrorString=function(){return this.message},e.prototype.randomN=function(t){for(var e=new BK.Buffer(t,!1),i=0;i<t;i++){var r=Math.round(65535*Math.random());e.writeUint8Buffer(r)}return e},e.prototype.toHex=function(t){if(t>=0&&t<=9)return t.toString();switch(t){case 10:return"A";case 11:return"B";case 12:return"C";case 13:return"D";case 14:return"E";case 15:return"F"}return"u"},e.prototype.bufferToHexString=function(t){var e="";for(t.rewind();!t.eof;){var i=t.readUint8Buffer();e=e.concat("x"+this.toHex((240&i)>>4)+this.toHex(15&i)+" ")}return e},e.prototype.startPhaseTimeout=function(t){if(6==t)this.phaseTimeout=t,this.prevPhaseTickCount=0;else switch(this.state){case 2:1==t&&(this.phaseTimeout=t,this.prevPhaseTickCount=BK.Time.clock);break;case 3:2==t&&(this.phaseTimeout=t,this.prevPhaseTickCount=BK.Time.clock);break;case 1:3==t&&(this.phaseTimeout=t,this.prevPhaseTickCount=BK.Time.clock);break;case 4:switch(t){case 4:this.options.PingPongTimeout=Math.min(this.options.PingPongTimeout,this.options.PingPongInterval)}this.phaseTimeout=t,this.prevPhaseTickCount=BK.Time.clock}},e.prototype.handlePhaseTimeout=function(){if(6!=this.phaseTimeout){var e=BK.Time.diffTime(this.prevPhaseTickCount,BK.Time.clock);switch(this.phaseTimeout){case 1:1e3*e>this.options.HandleShakeRequestTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!handshake request timeout"),this.prevPhaseTickCount=BK.Time.clock,this.state=-1,this.errcode=4096,this.message="handshake request timeout",t.prototype.close.call(this),this.delegate.onError&&this.delegate.onError(this));break;case 2:1e3*e>this.options.HandleShakeResponseTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!handshake response timeout"),this.prevPhaseTickCount=BK.Time.clock,this.state=-1,this.errcode=4097,this.message="handshake response timeout",t.prototype.close.call(this),this.delegate.onError&&this.delegate.onError(this));break;case 3:1e3*e>this.options.CloseAckTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!close ack timeout"),this.prevPhaseTickCount=BK.Time.clock,t.prototype.close.call(this),1==this.state?this.peerClosed?this.delegate.onClose&&this.delegate.onClose(this):(this.errcode=1006,this.message="abnormal close",this.delegate.onError&&this.delegate.onError(this),this.startPhaseTimeout(6)):this.delegate.onError&&this.delegate.onError(this));break;case 4:1e3*e>this.options.PingPongTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!receive pong timeout"),this.prevPhaseTickCount=BK.Time.clock)}}},e.prototype.restartPingPongTimer=function(){4==this.state&&this.options.PingPongInterval>0&&(this.prevPingPongTickCount=BK.Time.clock)},e.prototype.handlePingPongTimer=function(){4==this.state&&this.options.PingPongInterval>0&&1e3*BK.Time.diffTime(this.prevPingPongTickCount,BK.Time.clock)>this.options.PingPongInterval&&(this.inPingFrame=!1,this.txPingData=this.randomN(16),this.sendPingFrame(this.txPingData),this.restartPingPongTimer())},e.prototype.doHandshakePhase=function(){var e="",i=this.query?"?"+this.query:"";e=e.concat("GET "+this.path+i+" HTTP/"+this.httpVer+"\r\n"),e=(e=(e=80==this.port||443==this.port?e.concat("Host: "+this.host+"\r\n"):e.concat("Host: "+this.host+":"+this.port+"\r\n")).concat("Upgrade: websocket\r\n")).concat("Connection: Upgrade\r\n"),e=this.isEnableSSL()?e.concat("Origin: https://"+this.host+"\r\n"):e.concat("Origin: http://"+this.host+"\r\n");var r=this.randomN(16),n=BK.Misc.encodeBase64FromBuffer(r);if(e=e.concat("Sec-WebSocket-Key: "+n+"\r\n"),e=e.concat("Sec-WebSocket-Version: "+this.version+"\r\n"),this.query)for(var a=this.query.split("&"),o=0;o<a.length;o++){var s=a[o].split("=");s.length>0&&(e=e.concat(s[0]+": "+s[1]+"\r\n"))}e=e.concat("\r\n");var h=BK.Misc.sha1(n.concat("258EAFA5-E914-47DA-95CA-C5AB0DC85B11"));this.handshakeSig=BK.Misc.encodeBase64FromBuffer(h);var _=new BK.Buffer(e.length,!1);_.writeAsString(e,!1),0<t.prototype.send.call(this,_)&&(this.state=2,this.startPhaseTimeout(1))},e.prototype.doSvrHandshakePhase1=function(e){var i=this;e&&(this.httpParser.onComplete||(this.httpParser.onComplete=function(){for(var e in i.httpParser.headers);i.doSvrHandshakePhase2()?(i.restartPingPongTimer(),i.startPhaseTimeout(6),i.delegate.onOpen&&i.delegate.onOpen(i)):(i.errcode=4098,i.message="handshake parse error",i.startPhaseTimeout(6),t.prototype.close.call(i),i.delegate.onError&&i.delegate.onError(i))}),this.httpParser.execute(e),2==this.state&&(this.state=3,this.startPhaseTimeout(2)))},e.prototype.doSvrHandshakePhase2=function(){switch(this.httpParser.statusCode){case 101:return void 0==this.httpParser.headers.upgrade?(this.state=-1,BK.Script.log(1,0,"BK.WebSocket.doSvrHandshakePhase2!missing 'upgrade' header"),!1):void 0==this.httpParser.headers.connection?(this.state=-1,BK.Script.log(1,0,"BK.WebSocket.doSvrHandshakePhase2!missing 'connection' header"),!1):"upgrade"!=this.httpParser.headers.connection.toLowerCase()?(this.state=-1,BK.Script.log(1,0,"BK.WebSocket.doSvrHandshakePhase2!error 'connection' header"),!1):void 0==this.httpParser.headers["sec-websocket-accept"]?(this.state=-1,BK.Script.log(1,0,"BK.WebSocket.doSvrHandshakePhase2!missing 'sec-websocket-accept' header"),!1):this.handshakeSig!=this.httpParser.headers["sec-websocket-accept"]?(this.state=-1,BK.Script.log(1,0,"BK.WebSocket.doSvrHandshakePhase2!error 'sec-websocket-accept' header"),!1):(this.state=4,!0)}return!1},e.prototype.doFrameDataPhase=function(t,i,r){void 0===r&&(r=!1);var n=6,a=t.length;this.extensions.length,n+=a;var o=new BK.Buffer(n,!1),s=0,h=!1;switch(this.version){case 13:h=!0,s=128}var _=!0;switch(i){case 1:case 2:r?this.inTxSegFrame?(_=!1,i=0):(_=!1,this.inTxSegFrame=!0):this.inTxSegFrame&&(i=0)}if(_?o.writeUint8Buffer(128|15&i):o.writeUint8Buffer(15&i),a<126?o.writeUint8Buffer(s|127&t.length):a<65536?(o.writeUint8Buffer(126|s),e.isLittleEndian?(o.writeUint8Buffer((65280&a)>>8),o.writeUint8Buffer(255&a)):(o.writeUint8Buffer(255&a),o.writeUint8Buffer((65280&a)>>8))):BK.Script.log(1,0,"BK.WebSocket.doFrameDataPhase!js don't support 64bit data type"),h){var l=this.randomN(4);BK.Misc.encodeBufferXorMask4(t,l),o.writeBuffer(l)}return o.writeBuffer(t),o},e.prototype.doSvrFrameDataPhase=function(t){if(!t)return!0;for(;!t.eof;){switch(this.parseState){case 0:this.mask4.rewind(),this.rxbuf=new BK.Buffer(this.options.DefaultSegmentSize,!0),this.maskBit=0,this.rxbuflen=0,this.isFinalSeg=!1,this.parseState=1;case 1:var i=t.readUint8Buffer();switch(this.isFinalSeg=!!(128&i),this.opcode=15&i,this.version){case 13:switch(this.opcode){case 3:case 4:case 5:case 6:case 7:case 11:case 12:case 13:case 14:case 15:return this.errcode=1002,this.message="protocol error",BK.Script.log(1,0,"BK.WebSocket.doSvrFrameDataPhase!unknown opcode = "+this.opcode),!1}}switch(this.opcode){case 8:case 9:case 10:case 0:break;default:if(!this.isFinalSeg&&1!=this.opcode&&2!=this.opcode)return this.errcode=1003,this.message="unsupported data",BK.Script.log(1,0,"BK.WebSocket.doSvrFrameDataPhase!illegal opcode = "+this.opcode),!1;if(-1==this.rxFrameType)this.rxFrameType=this.opcode;else if(this.rxFrameType!=this.opcode)return this.errcode=1002,this.message="protocol error",BK.Script.log(1,0,"BK.WebSocket.doSvrFrameDataPhase!rxFrameType = "+this.rxFrameType+", illegal opcode = "+this.opcode),!1}if(this.parseState=2,t.eof)return!0;case 2:var r=t.readUint8Buffer();switch(this.maskBit=(128&r)>>7,127&r){case 126:if(this.parseState=3,t.eof)return!0;break;case 127:if(this.parseState=5,t.eof)return!0;break;default:if(this.rxbuflen=127&r,1==this.maskBit?this.parseState=13:this.parseState=17,this.rxbuflen>0&&t.eof)return!0}}switch(this.parseState){case 3:n=t.readUint8Buffer();if(e.isLittleEndian?this.rxbuflen|=(255&n)<<8:this.rxbuflen|=255&n,t.eof)return!0;case 4:var n=t.readUint8Buffer();if(e.isLittleEndian?this.rxbuflen|=255&n:this.rxbuflen|=(255&n)<<8,1==this.maskBit?this.parseState=13:this.parseState=17,this.rxbuflen>0&&t.eof)return!0;break;case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:return this.errcode=1002,this.message="protocol errors",BK.Script.log(1,0,"BK.WebSocket.doSvrFrameDataPhase!js don't support 64bit data type"),!1}switch(this.parseState){case 13:if(this.mask4.writeUint8Buffer(t.readUint8Buffer()),this.parseState=14,t.eof)return!0;case 14:if(this.mask4.writeUint8Buffer(t.readUint8Buffer()),this.parseState=15,t.eof)return!0;case 15:if(this.mask4.writeUint8Buffer(t.readUint8Buffer()),this.parseState=16,t.eof)return!0;case 16:if(this.mask4.writeUint8Buffer(t.readUint8Buffer()),this.parseState=17,t.eof)return!0}if(17==this.parseState){var a=t.length-t.pointer;if(a<=this.rxbuflen-this.rxbuf.length?this.rxbuf.writeBuffer(t.readBuffer(a)):this.rxbuf.writeBuffer(t.readBuffer(this.rxbuflen-this.rxbuf.length)),this.rxbuf.length==this.rxbuflen)if(this.rxSegCount=this.rxSegCount+1,this.parseState=0,this.isFinalSeg)switch(this.rxbuf.rewind(),this.opcode){case 8:BK.Script.log(0,0,"BK.WebSocket.doSvrFrameDataPhase!receive close frame"),this.handleCloseFrame();break;case 9:BK.Script.log(0,0,"BK.WebSocket.doSvrFrameDataPhase!receive ping frame"),this.handlePingFrame();break;case 10:BK.Script.log(0,0,"BK.WebSocket.doSvrFrameDataPhase!receive pong frame"),this.handlePongFrame();break;default:this.rxbufQue.push(this.rxbuf),this.recvFrameFromRxQ(this.rxFrameType),this.rxSegCount=0,this.rxFrameType=-1}else this.rxbuf.rewind(),this.rxbufQue.push(this.rxbuf)}}return!0},e.prototype.handleCloseFrame=function(){if(this.peerClosed=!0,4==this.state){var t=this.rxbuf.readUint16Buffer(),e=this.rxbuf.readBuffer(this.rxbuflen-2);t?(this.errcode=t,this.message=e.readAsString()):(this.errcode=1005,this.message="no status recv"),BK.Script.log(1,0,"BK.WebSocket.handleCloseFrame!errcode = "+this.errcode+", msg = "+this.message),this.sendCloseFrame(this.errcode,this.message?this.message:"")}else if(1==this.state){if(BK.Script.log(1,0,"BK.WebSocket.handleCloseFrame!normal closed"),this.close(),this.state=0,this.delegate.onMessage)for(;this.udataQue.length>0;){var i=this.udataQue.shift();this.delegate.onMessage(this,i)}this.delegate.onClose&&this.delegate.onClose(this)}},e.prototype.handlePingFrame=function(){if(4==this.state){if(this.rxbuflen>125)return this.errcode=4099,void(this.message="ping packet large");if(this.inPongFrame)return void BK.Script.log(1,0,"BK.WebSocket.handlePingFrame!already recv ping, drop it.");this.rxPongData=new BK.Buffer(this.rxbuflen,!0),this.rxPongData.writeBuffer(this.rxbuf.readBuffer(this.rxbuflen)),this.sendPongFrame(this.rxPongData)}},e.prototype.handlePongFrame=function(){if(4==this.state){var t=new BK.Buffer(this.rxbuflen,!0);t.writeBuffer(this.rxbuf.readBuffer(this.rxbuflen)),this.startPhaseTimeout(6),BK.Script.log(0,0,"BK.WebSocket.handlePongFrame!pong data = "+this.bufferToHexString(t))}},e.prototype.sendFrameFromTxQ=function(e){if(4==this.state&&this.packageSendCheck()){if(this.inPartialTxbuf){if(!((l=t.prototype.send.call(this,this.txbuf))>0))return BK.Script.log(1,l,"BK.WebSocket.sendFrameFromTxQ!partial send failed, data type = "+e),!1;if(this.restartPingPongTimer(),l<this.txbuf.length){var i=this.txbuf.length-l,r=new BK.Buffer(i,!1);return this.txbuf.rewind(),this.txbuf.jumpBytes(l),r.writeBuffer(this.txbuf.readBuffer(i)),this.txbuf=r,!1}this.framePackageCount++,this.inPartialTxbuf=!1}for(var n=!0,a=0;a<this.txMsgQue.length;a++){for(var o=element=this.txMsgQue[a];o.length>0;){var s=o.shift(),h=o.length>0,_=this.doFrameDataPhase(s,e,h),l=t.prototype.send.call(this,_);if(!(l>0)){n=!1,BK.Script.log(1,l,"BK.WebSocket.sendFrameFromTxQ!send failed, data type = "+e);break}if(this.restartPingPongTimer(),l<_.length){_.rewind(),_.jumpBytes(l),this.txbuf.rewind(),this.txbuf.writeBuffer(_.readBuffer(_.length-l)),this.inPartialTxbuf=!0,n=!1,BK.Script.log(1,0,"BK.WebSocket.sendFrameFromTxQ!partial send, total size = "+_.length+", tx size = "+l);break}if(0==o.length&&(this.inTxSegFrame=!1),this.framePackageCount++,!this.packageSendCheck())return}if(0==o.length&&this.txMsgQue.shift(),!n)break;if(!this.packageSendCheck())return}return n&&!this.txMsgQue.length&&this.inTxSegFrame&&(this.inTxSegFrame=!1),n}},e.prototype.recvFrameFromRxQ=function(t){for(var e=2==t,r=new BK.Buffer(128,!0);this.rxbufQue.length>0;){var n=this.rxbufQue.shift();r.writeBuffer(n)}0==e&&r.writeUint8Buffer(0),r.rewind(),this.udataQue.push(new i(r,e))},e.prototype.__sendBinaryFrame=function(t,e){var i=t.length,r=this.options.DefaultSegmentSize,n=0;t.rewind();for(var a=new Array;i>r;){o=new BK.Buffer(r,!1);t.rewind(),t.jumpBytes(n),o.writeBuffer(t.readBuffer(r)),o.rewind(),a.push(o),n+=r,i-=r}if(i>0){var o=new BK.Buffer(i,!1);t.rewind(),t.jumpBytes(n),o.writeBuffer(t.readBuffer(i)),o.rewind(),a.push(o)}return this.txMsgQue.push(a),this.txFrameType=e,this.sendFrameFromTxQ(e)},e.prototype.sendTextFrame=function(t){if(4!=this.state)return!1;var e=new BK.Buffer(128,!0);return e.writeAsString(t,!1),e.rewind(),this.__sendBinaryFrame(e,1)},e.prototype.sendBinaryFrame=function(t){if(4==this.state)return this.__sendBinaryFrame(t,2)},e.prototype.sendCloseFrame=function(i,r){if(!this.isSendClose){this.isSendClose=!0;var n=new BK.Buffer(r.length+1,!1),a=new BK.Buffer(3+r.length,!1);e.isLittleEndian?(a.writeUint8Buffer((65280&i)>>8),a.writeUint8Buffer(255&i)):(a.writeUint8Buffer(255&i),a.writeUint8Buffer((65280&i)>>8)),n.writeAsString(r,!0),a.writeBuffer(n);var o=this.doFrameDataPhase(a,8);0<t.prototype.send.call(this,o)&&(0==this.peerClosed&&(this.state=1,this.startPhaseTimeout(3)),BK.Script.log(1,0,"BK.WebSocket.sendCloseFrame!code = "+i+", reason = "+r))}},e.prototype.sendPingFrame=function(e){if(!this.inPingFrame){BK.Script.log(0,0,"BK.WebSocket.sendPingFrame!ping data = "+this.bufferToHexString(e));var i=this.doFrameDataPhase(e,9);0<t.prototype.send.call(this,i)&&(this.inPingFrame=!0,this.startPhaseTimeout(4))}},e.prototype.sendPongFrame=function(e){if(!this.inPongFrame){var i=this.doFrameDataPhase(e,10);0<t.prototype.send.call(this,i)&&(this.inPongFrame=!0)}},e.prototype.onErrorEvent=function(e){0!=this.state&&1!=this.state&&(t.prototype.onErrorEvent.call(this,e),this.state=-1,this.errcode=1006,this.message="abnormal closure",this.delegate.onError&&this.delegate.onError(this))},e.prototype.onTimeoutEvent=function(e){t.prototype.onErrorEvent.call(this,e),this.state=0,this.errcode=-1e3,this.message="socket connect timeout",this.delegate.onError&&this.delegate.onError(this)},e.prototype.onDisconnectEvent=function(e){switch(t.prototype.onDisconnectEvent.call(this,e),this.state){case 2:case 3:case 4:this.state=-1,this.errcode=1006,this.message="abnormal closure",this.delegate.onError&&this.delegate.onError(this);break;case 1:this.state=0,this.delegate.onClose&&this.delegate.onClose(this),BK.Script.log(1,0,"BK.WebSocket.onDisconnectEvent!enter closed state")}},e.prototype.onConnectedEvent=function(e){t.prototype.onConnectedEvent.call(this,e),0==this.state&&(this.clear(),this.doHandshakePhase())},e.prototype.phaseBufferCheck=function(t){for(var e=0,i=0;!t.eof;)if(i++,t.readUint8Buffer()=="\r\n\r\n".charCodeAt(e)){if(++e=="\r\n\r\n".length)return i}else e=0;return-1},e.prototype.packageSendCheck=function(){return this.framePackageCount<this.options.DrainSegmentCount},e.prototype.onUpdateEvent=function(e){switch(this.framePackageCount=0,t.prototype.onUpdateEvent.call(this,e),this.state){case 2:case 3:if((a=e.canRecvLength())>0){var i=this.recv(a),r=this.phaseBufferCheck(i);if(i.rewind(),r<i.length){var n=i.readBuffer(r);if(void 0!=n&&this.doSvrHandshakePhase1(n.readAsString(!0)),this.handlePhaseTimeout(),4!=this.state){BK.Script.log(1,0,"BK.Websocket websocket state expected ESTABLISHED!");break}if(BK.Script.log(1,0,"BK.Websocket pointer:"+i.pointer+"length:"+i.length),void 0!=i)for(;!i.eof;)if(!this.doSvrFrameDataPhase(i)){this.sendCloseFrame(this.errcode,this.message?this.message:""),this.delegate.onError&&this.delegate.onError(this);break}if(this.delegate.onMessage)for(;this.udataQue.length>0;){h=this.udataQue.shift();this.delegate.onMessage(this,h)}this.txMsgQue.length>0&&this.sendFrameFromTxQ(this.txFrameType),this.delegate.onSendComplete&&this.delegate.onSendComplete(this),this.inPongFrame=!1,this.handlePhaseTimeout(),this.handlePingPongTimer()}else void 0!=i&&this.doSvrHandshakePhase1(i.readAsString(!0)),this.handlePhaseTimeout()}break;case 4:for(var a=e.canRecvLength();a>0;){var o=a,s=this.recv(a);if(void 0!=s)for(;!s.eof;)if(!this.doSvrFrameDataPhase(s)){this.sendCloseFrame(this.errcode,this.message?this.message:""),this.delegate.onError&&this.delegate.onError(this);break}if((a=e.canRecvLength())==o)break}if(this.delegate.onMessage)for(;this.udataQue.length>0;){h=this.udataQue.shift();this.delegate.onMessage(this,h)}this.txMsgQue.length>0&&this.sendFrameFromTxQ(this.txFrameType),this.delegate.onSendComplete&&this.delegate.onSendComplete(this),this.inPongFrame=!1,this.handlePhaseTimeout(),this.handlePingPongTimer();break;case 1:if((a=e.canRecvLength())>0&&this.doSvrFrameDataPhase(this.recv(a))&&this.delegate.onMessage)for(;this.udataQue.length>0;){var h=this.udataQue.shift();this.delegate.onMessage(this,h)}this.handlePhaseTimeout()}return 0},e.isLittleEndian=BK.Misc.isLittleEndian(),e}(e),n=function(){function t(t,e){this.data=t,this.isBinary=e}return t}();return function(){function t(t){var e=this;this.__url=t,this.options=null,this.inTrans=!1,this.isPendingConn=!0,this.txdataQ=new Array;var i=BK.URL("{}",t);this.scheme=i.protocol,this.port=i.port,this.path=i.path,this.query=i.query,this.host=i.hostname,BK.DNS.queryIPAddress(i.hostname,function(t,i,n){switch(n=e.ipListFilter(n),t){case 0:BK.Script.log(1,0,"BK.WebSocket.queryIPAddress!iplist = "+JSON.stringify(n)),e.iplist=n,e.__nativeObj=new r(n[0],e.port,e.host,e.path,e.query),BK.Notification.on("game_network_change",e,function(t){this.__nativeObj.close(),this.__nativeObj.delegate.onClose(this.__nativeObj)}.bind(e),!0),"wss"==e.scheme&&e.__nativeObj.enableSSL(!0),e.options&&(e.setOptions(e.options),e.options=null),e.isPendingConn&&(e.connect(),e.isPendingConn=!1),e.__nativeObj.delegate.onOpen=function(t){e.txdataQ.length>0&&e.send(e.txdataQ.shift()),e.onOpen?e.onOpen(e):e.onopen&&e.onopen.call(e)},e.__nativeObj.delegate.onClose=function(t){var i={};i.code=e.getErrorCode(),i.reason=e.getErrorString(),e.onClose?e.onClose(e,i):e.onclose&&e.onclose.call(e,i)},e.__nativeObj.delegate.onError=function(t){var i={};i.code=e.getErrorCode(),i.reason=e.getErrorString(),e.onError?e.onError(e,i):e.onerror&&e.onerror.call(e,i)},e.__nativeObj.delegate.onMessage=function(t,i){if(e.onMessage)e.onMessage(e,i);else if(e.onmessage){if(1==i.isBinary){var r=i.data;r.rewind();for(var n=new ArrayBuffer(r.length),a=new DataView(n);!r.eof;)a.setUint8(r.pointer,r.readUint8Buffer());i.data=n}e.onmessage.call(e,i)}},e.__nativeObj.delegate.onSendComplete=function(t){for(var i=e.txdataQ.length;i>0&&e.__nativeObj.packageSendCheck();i--){var r=e.txdataQ.shift();r.isBinary?e.__sendBinaryFrame(r.data):e.__nativeObj.sendTextFrame(r.data)}}}})}return Object.defineProperty(t.prototype,"url",{get:function(){return this.__url},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"readyState",{get:function(){return this.getReadyState()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bufferedAmount",{get:function(){for(var t=0,e=0;e<this.txdataQ.length;e++)t+=this.txdataQ[e].data.length;return t},enumerable:!0,configurable:!0}),t.prototype.__sendBinaryFrame=function(t){if(Object.prototype.hasOwnProperty.call(t,"__rawBKData"))return this.__nativeObj.sendBinaryFrame(t.__rawBKData);if(t instanceof Int8Array==1||t instanceof Uint8Array==1||t instanceof Int16Array==1||t instanceof Uint16Array==1||t instanceof Int32Array==1||t instanceof Uint32Array==1||t instanceof Float32Array==1){for(var e=new BK.Buffer(t.byteLength),i=new DataView(t.buffer),r=0;r<t.byteLength;r++)e.writeUint8Buffer(i.getUint8(r));return this.__nativeObj.sendBinaryFrame(e)}if(t instanceof ArrayBuffer==1){for(var e=new BK.Buffer(t.byteLength),i=new DataView(t),r=0;r<t.byteLength;r++)e.writeUint8Buffer(i.getUint8(r));return this.__nativeObj.sendBinaryFrame(e)}return this.__nativeObj.sendBinaryFrame(t)},t.prototype.ipListFilter=function(t){var e=new Array;return t.forEach(function(t){for(var i=!1,r=0;r<e.length;r++)if(t==e[r]){i=!0;break}0==i&&e.push(t)}),e},t.prototype.getReadyState=function(){return this.__nativeObj?this.__nativeObj.getReadyState():0},t.prototype.getErrorCode=function(){return this.__nativeObj?this.__nativeObj.getErrorCode():65535},t.prototype.getErrorString=function(){return this.__nativeObj?this.__nativeObj.getErrorString():""},t.prototype.close=function(){4==this.getReadyState()&&this.__nativeObj.sendCloseFrame(1e3,"see ya")},t.prototype.connect=function(){return!this.__nativeObj||0!=this.__nativeObj.connect()},t.prototype.send=function(t){var e=this.getReadyState();if(1==e||0==e)return!1;if("string"==typeof t){if(this.__nativeObj.packageSendCheck()&&4==e)return this.__nativeObj.sendTextFrame(t);this.txdataQ.push(new n(t,!1))}else if("object"==typeof t){if(this.__nativeObj.packageSendCheck()&&4==e)return this.__sendBinaryFrame(t);this.txdataQ.push(new n(t,!0))}return!1},t.prototype.setOptions=function(t){this.__nativeObj?(t.DrainSegmentCount&&(this.__nativeObj.options.DrainSegmentCount=t.DrainSegmentCount),t.DefaultSegmentSize&&(this.__nativeObj.options.DefaultSegmentSize=t.DefaultSegmentSize),t.PingPongInterval&&(this.__nativeObj.options.PingPongInterval=t.PingPongInterval),t.HandleShakeRequestTimeout&&(this.__nativeObj.options.HandleShakeRequestTimeout=t.HandleShakeRequestTimeout),t.HandleShakeResponseTimeout&&(this.__nativeObj.options.HandleShakeResponseTimeout=t.HandleShakeResponseTimeout),t.CloseAckTimeout&&(this.__nativeObj.options.CloseAckTimeout=t.CloseAckTimeout),t.PingPongTimeout&&(this.__nativeObj.options.PingPongTimeout=t.PingPongTimeout)):this.options=t},t}()});var SheetSprite=function(){function t(t,e,i,r,n,a,o){this.size={width:0,height:0},this.flipU=0,this.flipV=1,this.stretchX=1,this.stretchY=1,r&&(this.flipU=r),n&&(this.flipV=n),a&&(this.stretchX=a),o&&(this.stretchY=o),e&&(this.size.width=e),i&&(this.size.height=i),this.textureInfo=t,this.onInit(this.size.width,this.size.height),this.adjustWithTextureInfo(t)}return t.prototype.onInit=function(t,e){this.createSprites(t,e),Object.getOwnPropertyNames(this.__nativeObj).forEach(function(t){var e=t;Object.defineProperty(this,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this),Object.defineProperty(this,"size",{get:function(){return this.__nativeObj.contentSize},set:function(t){this.__nativeObj.contentSize=t,this.updateSize(this.textureInfo)}}),Object.defineProperty(this,"anchor",{get:function(){return this.__nativeObj.localAnchor},set:function(t){this.__nativeObj.localAnchor=t}})},t.prototype.updateSize=function(t){if(1==t.frameInfo.trimmed){var e=t.frameInfo.spriteSourceSize.x,i=t.frameInfo.spriteSourceSize.y,r=t.frameInfo.spriteSourceSize.w,n=t.frameInfo.spriteSourceSize.h,a=t.frameInfo.sourceSize,o=this.__nativeObj.contentSize;e=o.width*e/a.w,i=o.height*i/a.h,r=o.width*r/a.w,n=o.height*n/a.h,this.contentSprite.position={x:e,y:i},this.contentSprite.contentSize={width:r,height:n}}else this.contentSprite.contentSize=this.__nativeObj.contentSize},t.prototype.adjustWithTextureInfo=function(t){if(t){this.textureInfo=t;var e=t.texture,i=t.frameInfo;this.updateSize(t),this.currTexturePath=t.texturePath;e=new BK.Texture(this.currTexturePath);this.contentSprite.setTexture(e),this.contentSprite.adjustTexturePosition(i.frame.x,i.frame.y,i.frame.w,i.frame.h,i.rotated)}},t.prototype.setTexture=function(t){this.__nativeObj.setTexture(t)},t.prototype.dispose=function(){BK.Director.ticker.remove(this),this.__nativeObj.dispose()},t.prototype.removeChild=function(t){return this.__nativeObj.removeChild(t)},t.prototype.removeChildById=function(t,e){return this.__nativeObj.removeChildById(t,e)},t.prototype.removeChildByName=function(t,e){return this.__nativeObj.removeChildByName(t,e)},t.prototype.removeFromParent=function(){return this.__nativeObj.removeFromParent()},t.prototype.addChild=function(t,e){return this.__nativeObj.addChild(t,e)},t.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},t.prototype.convertToWorldSpace=function(t){return this.__nativeObj.convertToWorldSpace(t)},t.prototype.convertToNodeSpace=function(t){return this.__nativeObj.convertToNodeSpace(t)},t.prototype.createSprites=function(t,e){this.__nativeObj=new BK.SpriteNode(t,e,{},this.flipU,this.flipV,this.stretchX,this.stretchY),this.contentSprite=new BK.SpriteNode(t,e,{},this.flipU,this.flipV,this.stretchX,this.stretchY),this.__nativeObj.addChild(this.contentSprite)},t}();BK.SheetSprite||(BK.SheetSprite=SheetSprite);var SpriteSheetCache=function(){function t(){this.sheets={},this.jsonConfigs={}}return t.prototype.getFrameInfoByFilename=function(t){for(var e in this.jsonConfigs)if(this.jsonConfigs.hasOwnProperty(e)){var i=this.jsonConfigs[e],r=(this.sheets[e],i.frames),n=i.meta;this.fullWidth=n.size.w,this.fullHeight=n.size.h;for(var a=0;a<r.length;a++){var o=r[a];if(t==o.filename){var s={x:0,y:1,w:0,h:0},h=o.rotated,_=o.trimmed,l=o.spriteSourceSize,d=o.sourceSize;return h?(s.x=o.frame.x,s.y=this.fullHeight-o.frame.y-o.frame.w,s.w=o.frame.w,s.h=o.frame.h):(s.x=o.frame.x,s.y=this.fullHeight-o.frame.y-o.frame.h,s.w=o.frame.w,s.h=o.frame.h),l.y=d.h-l.y-l.h,{filename:t,frame:s,rotated:h,trimmed:_,spriteSourceSize:l,sourceSize:d}}}}return null},t.prototype.getTexturePathByFilename=function(t){for(var e in this.jsonConfigs)if(this.jsonConfigs.hasOwnProperty(e))for(var i=this.jsonConfigs[e].frames,r=0;r<i.length;r++)if(i[r].filename==t)return e;return null},t.prototype.loadSheet=function(t,e,i,r,n,a,o){var s=BK.FileUtil.readFile(t).readAsString();if(s){var h=JSON.parse(s);void 0===e&&(e=t.replace(/.json$/,".png")),this.jsonConfigs[e]=h,void 0===i&&(i=4),i=4,void 0===r&&(r=1),void 0===n&&(n=1),void 0===a&&(a=1),void 0===o&&(o=1);var _=new BK.Texture(e,i,r,n,a,o);this.sheets[e]=_}else BK.Script.log(0,0,"loadSheet Failed.Please check path")},t.prototype.removeSheet=function(t,e){if(this.jsonConfigs[e])for(var i in this.jsonConfigs)if(this.jsonConfigs.hasOwnProperty(i)){r=this.jsonConfigs[i];i==e&&(delete this.jsonConfigs[e],BK.Script.log(0,0,"Delete jsonConfigs key:"+i+" val:"+r))}if(this.sheets[e])for(var i in this.sheets)if(this.sheets.hasOwnProperty(i)){var r=this.sheets[i];i==e&&(delete this.sheets[e],BK.Script.log(0,0,"Delete sheets key:"+i+" val:"+r))}},t.prototype.getTextureByFilename=function(t){var e=this.getFrameInfoByFilename(t),i=this.getTexturePathByFilename(t);return e&&i?new BK.Texture(i):(BK.Script.log(0,0,"getTexture Failed.Please check path"),null)},t.prototype.getSprite=function(t,e,i){var r=this.getTextureFrameInfoByFileName(t);if(r){var n=r.frameInfo,a=r.texturePath,o=new BK.Texture(a);if(e||(e=n.frame.w),i||(i=n.frame.h),BK.Script.log(0,0,"getSprite texture:"+o+" width:"+e+" height:"+i),n.trimmed)return s=new BK.SheetSprite(r,e,i);var s=new BK.Sprite(e,i,o,0,1,1,1);return s.adjustTexturePosition(n.frame.x,n.frame.y,n.frame.w,n.frame.h,n.rotated),s}return null},t.prototype.createSheetSprite=function(t,e,i){var r=this.getTextureFrameInfoByFileName(t);if(r){var n=r.frameInfo,a=r.texturePath,o=new BK.Texture(a);return e||(e=n.frame.w),i||(i=n.frame.h),BK.Script.log(0,0,"SheetSprite texture:"+o+" width:"+e+" height:"+i),new BK.SheetSprite(r,e,i)}return null},t.prototype.getTextureFrameInfoByFileName=function(t){var e=this.getFrameInfoByFilename(t),i=this.getTexturePathByFilename(t);return e&&i?{frameInfo:e,texturePath:i}:null},t}(),Sprite9=function(){function t(t,e,i,r,n,a){void 0===n&&(n={x:0,y:0}),this._size={width:0,height:0},this.__nativeObj=new BK.Node,this.onInit(),this._grid=r,this._size={width:e,height:e},this._leftTop=new BK.Sprite(r.left,r.top,i,0,1,1,1),this._leftTop.position={x:0,y:e-r.top},this._leftTop.zOrder=99999,this._leftTop.name="_leftTop",this.__nativeObj.addChild(this._leftTop),this._centerTop=new BK.Sprite(t-r.left-r.right,r.top,i,0,1,1,1),this._centerTop.position={x:r.left,y:e-r.top},this._centerTop.zOrder=99999,this._centerTop.name="_centerTop",this.__nativeObj.addChild(this._centerTop),this._rightTop=new BK.Sprite(r.right,r.top,i,0,1,1,1),this._rightTop.position={x:t-r.right,y:e-r.top},this._rightTop.zOrder=99999,this._rightTop.name="_rightTop",this.__nativeObj.addChild(this._rightTop),this._leftCenter=new BK.Sprite(r.left,e-r.top-r.bottom,i,0,1,1,1),this._leftCenter.position={x:0,y:r.bottom},this._leftCenter.name="_leftCenter",this.__nativeObj.addChild(this._leftCenter),this._centerCenter=new BK.Sprite(t-r.left-r.right,e-r.top-r.bottom,i,0,1,1,1),this._centerCenter.position={x:r.left,y:r.bottom},this._centerCenter.name="_centerCenter",this.__nativeObj.addChild(this._centerCenter),this._rightCenter=new BK.Sprite(r.right,e-r.bottom-r.top,i,0,1,1,1),this._rightCenter.position={x:t-r.right,y:r.bottom},this._rightCenter.name="_rightCenter",this.__nativeObj.addChild(this._rightCenter),this._leftBottom=new BK.Sprite(r.left,r.bottom,i,0,1,1,1),this._leftBottom.position={x:0,y:0},this._leftBottom.name="_leftBottom",this.__nativeObj.addChild(this._leftBottom),this._centerBottom=new BK.Sprite(t-r.left-r.right,r.bottom,i,0,1,1,1),this._centerBottom.position={x:r.left,y:0},this._centerBottom.name="_centerBottom",this.__nativeObj.addChild(this._centerBottom),this._rightBottom=new BK.Sprite(r.right,r.bottom,i,0,1,1,1),this._rightBottom.position={x:t-r.right,y:0},this._rightBottom.name="_rightBottom",this.__nativeObj.addChild(this._rightBottom),1==a?(this._leftTop.adjustTexturePosition(n.x+(e-r.top),n.y+(t-r.left),r.left,r.top,a),this._centerTop.adjustTexturePosition(n.x+(e-r.top),n.y+r.right,t-r.left-r.right,r.top,a),this._rightTop.adjustTexturePosition(n.x+(e-r.top),n.y,r.right,r.top,a),this._leftCenter.adjustTexturePosition(n.x+r.bottom,n.y+(t-r.left),r.left,e-r.top-r.bottom,a),this._centerCenter.adjustTexturePosition(n.x+r.bottom,n.y+r.right,t-r.left-r.right,e-r.top-r.bottom,a),this._rightCenter.adjustTexturePosition(n.x+r.bottom,n.y,r.right,e-r.bottom-r.top,a),this._leftBottom.adjustTexturePosition(n.x,n.y+(t-r.left),r.left,r.bottom,a),this._centerBottom.adjustTexturePosition(n.x,n.y+r.right,t-r.left-r.right,r.bottom,a),this._rightBottom.adjustTexturePosition(n.x,n.y,r.right,r.bottom,a)):(this._leftTop.adjustTexturePosition(0+n.x,e-r.top+n.y,r.left,r.top),this._centerTop.adjustTexturePosition(r.left+n.x,e-r.top+n.y,t-r.left-r.right,r.top),this._rightTop.adjustTexturePosition(t-r.right+n.x,e-r.top+n.y,r.right,r.top),this._leftCenter.adjustTexturePosition(0+n.x,r.bottom+n.y,r.left,e-r.top-r.bottom),this._centerCenter.adjustTexturePosition(r.left+n.x,r.bottom+n.y,t-r.left-r.right,e-r.top-r.bottom),this._rightCenter.adjustTexturePosition(t-r.right+n.x,r.bottom+n.y,r.right,e-r.bottom-r.top),this._leftBottom.adjustTexturePosition(0+n.x,0+n.y,r.left,r.bottom),this._centerBottom.adjustTexturePosition(r.left+n.x,0+n.y,t-r.left-r.right,r.bottom),this._rightBottom.adjustTexturePosition(t-r.right+n.x,0+n.y,r.right,r.bottom))}return t.prototype.onInit=function(){Object.getOwnPropertyNames(this.__nativeObj).forEach(function(t){var e=t;"size"!=e&&Object.defineProperty(this,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this)},Object.defineProperty(t.prototype,"alpha",{get:function(){return this._rightBottom.vertexColor.a},set:function(t){this._leftTop.vertexColor={r:1,g:1,b:1,a:t},this._centerTop.vertexColor={r:1,g:1,b:1,a:t},this._rightTop.vertexColor={r:1,g:1,b:1,a:t},this._leftCenter.vertexColor={r:1,g:1,b:1,a:t},this._centerCenter.vertexColor={r:1,g:1,b:1,a:t},this._rightCenter.vertexColor={r:1,g:1,b:1,a:t},this._leftBottom.vertexColor={r:1,g:1,b:1,a:t},this._centerBottom.vertexColor={r:1,g:1,b:1,a:t},this._rightBottom.vertexColor={r:1,g:1,b:1,a:t}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},set:function(t){this._size=t;var e=t.width-this._grid.left-this._grid.right,i=t.height-this._grid.top-this._grid.bottom;this._leftTop.position={x:0,y:t.height-this._grid.top},this._leftCenter.size={width:this._grid.left,height:i},this._leftCenter.position={x:0,y:this._grid.bottom},this._rightCenter.size={width:this._grid.right,height:i},this._rightCenter.position={x:t.width-this._grid.right,y:this._grid.bottom},this._centerCenter.size={width:e,height:i},this._centerTop.size={width:e,height:this._grid.top},this._centerTop.position={x:this._grid.left,y:t.height-this._grid.top},this._centerBottom.size={width:e,height:this._grid.bottom},this._centerBottom.position={x:this._grid.left,y:0},this._rightCenter.size={width:this._grid.right,height:i},this._rightCenter.position={x:t.width-this._grid.right,y:this._grid.bottom},this._rightBottom.position={x:t.width-this._grid.right,y:0},this._rightTop.position={x:t.width-this._grid.right,y:t.height-this._grid.top}},enumerable:!0,configurable:!0}),t.prototype.pos=function(t,e){this.__nativeObj.position={x:t,y:e}},t.prototype.dispose=function(){this.__nativeObj.dispose()},t.prototype.attachBody=function(t){this.__nativeObj.attachComponent(t)},t.prototype.addChild=function(t){this.__nativeObj.addChild(t)},t.prototype.removeChildById=function(t,e){return this.__nativeObj.removeChildById(t,e)},t.prototype.removeChildByName=function(t,e){return this.__nativeObj.removeChildByName(t,e)},t.prototype.removeFromParent=function(){return this.__nativeObj.removeFromParent()},t.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},t}();BK.SpriteSheetCache||(BK.SpriteSheetCache=new SpriteSheetCache),BK.Sprite9||(BK.Sprite9=Sprite9),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.AnimatedSprite=e())}(BK,function(){return function(){function t(t){this.paused=!1,this.delayUnits=1/30,this.tmpPlayingIdx=0,this.previousTs=-1,this.playedCount=0,this.size={width:0,height:0},this.readyTextureInfo(t),this.onInit(this.size.width,this.size.height),this.displayFrame(0),this.paused=!0,BK.Director.ticker.add(function(t,e,i){i.update(t,e)},this)}return t.prototype.onInit=function(t,e){this.createSprites(t,e),Object.getOwnPropertyNames(this.__nativeObj).forEach(function(t){var e=t;Object.defineProperty(this,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this),Object.defineProperty(this,"size",{get:function(){return this.__nativeObj.contentSize},set:function(t){this.__nativeObj.contentSize=t,this.displayFrame(this.currDisplayIdx)}}),Object.defineProperty(this,"anchor",{get:function(){return this.__nativeObj.localAnchor},set:function(t){this.__nativeObj.localAnchor=t,this.displayFrame(this.currDisplayIdx)}})},t.prototype.setTexture=function(t){this.__nativeObj.setTexture(t)},t.prototype.dispose=function(){BK.Director.ticker.remove(this),this.__nativeObj.dispose()},t.prototype.removeChild=function(t){return this.__nativeObj.removeChild(t)},t.prototype.removeChildById=function(t,e){return this.__nativeObj.removeChildById(t,e)},t.prototype.removeChildByName=function(t,e){return this.__nativeObj.removeChildByName(t,e)},t.prototype.removeFromParent=function(){return this.__nativeObj.removeFromParent()},t.prototype.addChild=function(t,e){return this.__nativeObj.addChild(t,e)},t.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},t.prototype.convertToWorldSpace=function(t){return this.__nativeObj.convertToWorldSpace(t)},t.prototype.convertToNodeSpace=function(t){return this.__nativeObj.convertToNodeSpace(t)},t.prototype.createSprites=function(t,e){this.__nativeObj=new BK.SpriteNode(t,e,{},0,1,1,1),this.contentSprite=new BK.SpriteNode(t,e,{},0,1,1,1),this.__nativeObj.addChild(this.contentSprite)},t.prototype.readyTextureInfo=function(t){var e=this;this.textureInfoArr=[],t.forEach(function(t){t.texturePath&&(t.texture=new BK.Texture(t.texturePath),e.textureInfoArr.push(t),e.size={width:t.frameInfo.sourceSize.w,height:t.frameInfo.sourceSize.h})})},t.prototype.displayFrame=function(t){if(this.textureInfoArr.length>0){var e=this.textureInfoArr[t];if(e){this.currDisplayIdx=t;var i=e.texture,r=e.frameInfo;if(1==e.frameInfo.trimmed){var n=e.frameInfo.spriteSourceSize.x,a=e.frameInfo.spriteSourceSize.y,o=e.frameInfo.spriteSourceSize.w,s=e.frameInfo.spriteSourceSize.h,h=e.frameInfo.sourceSize,_=this.__nativeObj.contentSize;n=_.width*n/h.w,a=_.height*a/h.h,o=_.width*o/h.w,s=_.height*s/h.h,this.contentSprite.position={x:n,y:a},this.contentSprite.contentSize={width:o,height:s}}else this.contentSprite.contentSize=this.__nativeObj.contentSize;this.currTexturePath&&this.currTexturePath==e.texturePath||(BK.Script.log(1,-1,"this.currTexture != tex"),this.currTexturePath=e.texturePath,this.contentSprite.setTexture(i)),this.contentSprite.adjustTexturePosition(r.frame.x,r.frame.y,r.frame.w,r.frame.h,r.rotated)}else BK.Script.log(1,-1,"displayFrame failed! textureInfo is null. index is "+t)}else BK.Script.log(1,-1,"displayFrame failed! textureInfoArr.length is 0")},t.prototype.render=function(){this.tmpPlayingIdx>this.textureInfoArr.length-1&&(this.tmpPlayingIdx=0),this.displayFrame(this.tmpPlayingIdx),this.tmpPlayingIdx++,this.currDisplaySum++,this.updateCallback()},t.prototype.update=function(t,e){0==this.paused&&(this.previousTs<0?(this.previousTs=t,this.render()):t-this.previousTs>1e3*this.delayUnits&&(this.previousTs=t,this.render()))},t.prototype.play=function(t,e){void 0===t&&(t=0),void 0===e&&(e=-1),t>this.textureInfoArr.length-1?this.tmpPlayingIdx=0:this.tmpPlayingIdx=t,this.paused=!1,this.repeatCount=e,this.currDisplaySum=0,this.playedCount=0},t.prototype.stop=function(t){void 0===t&&(t=-1),this.paused=!0,t>-1&&this.displayFrame(t)},t.prototype.updateCallback=function(){var t=this.textureInfoArr.length;this.currDisplaySum%t==0&&(this.playedCount=parseInt(String(this.currDisplaySum/t)),this.completeCallback&&this.completeCallback(this,this.playedCount),this.repeatCount>0&&this.repeatCount<=this.playedCount&&(this.endCallback&&this.endCallback(this,this.playedCount),this.stop()))},t.prototype.setCompleteCallback=function(t){this.completeCallback=t},t.prototype.setEndCallback=function(t){this.endCallback=t},t}()}),Canvas.prototype.setImagePath=function(t){if(t){this.imagePath=t;var e=new BK.Texture(t);this.__nativeObj.setTexture(e)}},Canvas.prototype.getImagePath=function(){return this.imagePath},Canvas.prototype.setTexture=function(t){this.__nativeObj.setTexture(t)},Canvas.prototype.setFlipXY=function(t,e){this.__nativeObj.setUVFlip(t,e)},Canvas.prototype.setUVFlip=function(t,e){this.__nativeObj.setUVFlip(t,e)},Canvas.prototype.setUVWrap=function(t,e){this.__nativeObj.setUVWrap(t,e)},Canvas.prototype.setXYStretch=function(t,e){this.__nativeObj.setXYStretch(t,e)},Canvas.prototype.adjustTexturePosition=function(t,e,i,r,n){this.__nativeObj.adjustTexturePosition(t,e,i,r,n)},Canvas.prototype.addChild=function(t){return this.__nativeObj.addChild(t)},Canvas.prototype.dispose=function(){return this.__nativeObj.dispose()},Canvas.prototype.removeChild=function(t){return this.__nativeObj.removeChild(t)},Canvas.prototype.removeChildById=function(t){return this.__nativeObj.removeChildById(t)},Canvas.prototype.removeChildByName=function(t){return this.__nativeObj.removeChildByName(t)},Canvas.prototype.removeChildByTag=function(t){return this.__nativeObj.removeChildByTag(t)},Canvas.prototype.queryChildAtIndex=function(t){return this.__nativeObj.queryChildAtIndex(t)},Canvas.prototype.queryChildById=function(t){return this.__nativeObj.queryChildById(t)},Canvas.prototype.queryChildByName=function(t){return this.__nativeObj.queryChildByName(t)},Canvas.prototype.queryChildByTag=function(t){return this.__nativeObj.queryChildByTag(t)},Canvas.prototype.getChildCount=function(){return this.__nativeObj.getChildCount()},Canvas.prototype.removeFromParent=function(){return this.__nativeObj.removeFromParent()},Canvas.prototype.attachComponent=function(t){return this.__nativeObj.attachComponent(t)},Canvas.prototype.detachComponent=function(t){return this.__nativeObj.detachComponent(t)},Canvas.prototype.queryComponent=function(t){return this.__nativeObj.queryComponent(t)},Canvas.prototype.queryComponentList=function(t){return this.__nativeObj.queryComponentList(t)},Canvas.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},Canvas.prototype.isEqual=function(t){return this.__nativeObj.isEqual(t)},Canvas.prototype.convertToWorldSpace=function(t){return this.__nativeObj.convertToWorldSpace(t)},Canvas.prototype.convertToNodeSpace=function(t){return this.__nativeObj.convertToNodeSpace(t)},Canvas.prototype.setAtlas=function(t,e){if(this.__nativeObj){BK.CanvasSheetCache.loadSheet(t);var i=BK.CanvasSheetCache.getTexturePathByFilename(e),r=new BK.Texture(i);this.__nativeObj.setTexture(r);var n=BK.CanvasSheetCache.getFrameInfoByFilename(e);this.__nativeObj.adjustTexturePosition(n.frame.x,n.frame.y,n.frame.w,n.frame.h,n.rotated)}return 0},Canvas.prototype.useH5Mode=function(){return this.__nativeObj?(this._useH5Mode=1,1==arguments.length?(this._useH5Mode=arguments[0],this.__nativeObj.useH5Mode(arguments[0])):this.__nativeObj.useH5Mode()):0},Canvas.prototype.drawCircle=function(){return this.__nativeObj?this.__nativeObj.drawCircle(arguments[0],arguments[1],arguments[2]):0},Canvas.prototype.drawEllipse=function(){return this.__nativeObj?this.__nativeObj.drawEllipse(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.drawImage=function(){if(this.__nativeObj){var t=arguments.length;if(9==t)this.__nativeObj.drawImage(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);else if(5==t)this.__nativeObj.drawImage(arguments[0],0,0,0,0,arguments[1],arguments[2],arguments[3],arguments[4]);else{if(3!=t)return;this.__nativeObj.drawImage(arguments[0],0,0,0,0,arguments[1],arguments[2],0,0)}this._innerSetTransform()}return 0},Canvas.prototype.fill=function(){return this.__nativeObj?this.__nativeObj.fill():0},Canvas.prototype.stroke=function(){return this.__nativeObj?this.__nativeObj.stroke():0},Canvas.prototype.rect=function(){return this.__nativeObj?this.__nativeObj.rect(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.fillRect=function(){return this.__nativeObj?this.__nativeObj.fillRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.strokeRect=function(){return this.__nativeObj?this.__nativeObj.strokeRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.clearRect=function(){return this.__nativeObj?this.__nativeObj.clearRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.beginPath=function(){return this.__nativeObj?this.__nativeObj.beginPath():0},Canvas.prototype.closePath=function(){return this.__nativeObj?this.__nativeObj.closePath():0},Canvas.prototype.moveTo=function(){return this.__nativeObj?this.__nativeObj.moveTo(arguments[0],arguments[1]):0},Canvas.prototype.lineTo=function(){return this.__nativeObj?this.__nativeObj.lineTo(arguments[0],arguments[1]):0},Canvas.prototype.arcTo=function(){return this.__nativeObj?this.__nativeObj.arcTo(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]):0},Canvas.prototype.arc=function(){if(this.__nativeObj){var t=arguments.length;if(5==t)return this.__nativeObj.arc(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]);if(6==t)return this.__nativeObj.arc(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}return 0},Canvas.prototype.quadraticCurveTo=function(){return this.__nativeObj?this.__nativeObj.quadraticCurveTo(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.bezierCurveTo=function(){return this.__nativeObj?this.__nativeObj.bezierCurveTo(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]):0},Canvas.prototype.save=function(){return this.__nativeObj?this.__nativeObj.save():0},Canvas.prototype.restore=function(){return this.__nativeObj?this.__nativeObj.restore():0},Canvas.prototype.fillText=function(){if(3==arguments.length){var t=this.measureText(arguments[0],2048,1024),e=arguments[1],i=arguments[2];switch(1==this._useH5Mode?2-this._textBaseLine:this._textBaseLine){case 1:i-=.5*t.height;break;case 2:i-=1*t.height}switch(this._textAlign){case 1:e-=.5*t.width;break;case 2:e-=1*t.width}this.__nativeObj.fillText(arguments[0],e,i,Math.min(2048,t.width),Math.min(1024,t.height)),this._innerSetTransform()}return 0},Canvas.prototype.clip=function(){return this.__nativeObj?this.__nativeObj.clip():0},Canvas.prototype.isPointInPath=function(){if(this.__nativeObj)return this.__nativeObj.isPointInPath(arguments[0],arguments[1])},Canvas.prototype.createImageData=function(){var t=arguments.length;if(this.__nativeObj&&2==t){var e=new BK.Buffer(arguments[0]*arguments[1]*4);return e.__inner_image_width=arguments[0],e.__inner_image_height=arguments[1],e}},Canvas.prototype.getImageData=function(){var t=arguments.length;if(this.__nativeObj&&4==t){var e=this.__nativeObj.getImageData(arguments[0],arguments[1],arguments[2],arguments[3]);return e.__inner_image_width=arguments[2],e.__inner_image_height=arguments[3],e}},Canvas.prototype.putImageData=function(){var t=arguments.length;if(this.__nativeObj&&3==t){var e=arguments[0],i=arguments[1],r=arguments[2],n=e.__inner_image_width,a=e.__inner_image_height;return this.__nativeObj.putImageData(arguments[0],i,r,n,a)}},Canvas.prototype.scale=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. scale :"+arguments[0]+" , "+arguments[1]),this.__nativeObj.scales(arguments[0],arguments[1])},Canvas.prototype.scales=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. scales :"+arguments[0]+" , "+arguments[1]),this.__nativeObj.scales(arguments[0],arguments[1])},Canvas.prototype.rotate=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. rotate :"+arguments[0]),this.__nativeObj.rotate(arguments[0])},Canvas.prototype.translate=function(){if(this.__nativeObj){var t=GameStatusInfo.QQVer.split(".");7==Number(t[0])&&Number(7==t[1]&&Number(t[2])<=5)?(this._tx=arguments[0],this._ty=arguments[1],this._innerSetTransform()):this.__nativeObj.translate(arguments[0],arguments[1])}},Canvas.prototype.transform=function(){if(this.__nativeObj)return this.__nativeObj.transforms(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},Canvas.prototype.transforms=function(){return this.setTransform(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},Canvas.prototype.setTransform=function(){if(this.__nativeObj){var t=GameStatusInfo.QQVer.split(".");if(Number(t[0])<7||7==Number(t[0])&&Number(t[1])<7){if("ios"==GameStatusInfo.platform){var e=inverseMatrix(this._a,this._b,this._c,this._d,this._tx,this._ty);this.__nativeObj.transforms(e[0],e[1],e[2],e[3],e[4],e[5])}return this._a=arguments[0],this._b=arguments[1],this._c=arguments[2],this._d=arguments[3],this._tx=arguments[4],this._ty=arguments[5],this.__nativeObj.transforms(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}return this._a=arguments[0],this._b=arguments[1],this._c=arguments[2],this._d=arguments[3],this._tx=arguments[4],this._ty=arguments[5],this.__nativeObj.setTransform(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}},Canvas.prototype._innerSetTransform=function(){if(this.__nativeObj){var t=GameStatusInfo.QQVer.split(".");if(7==Number(t[0])&&Number(7==t[1]&&Number(t[2])<=5))return this.__nativeObj.setTransform(this._a,this._b,this._c,this._d,this._tx,this._ty)}},Canvas.prototype.shadowColor=function(){if(this._shadowColor=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},Canvas.prototype.shadowRadius=function(){if(this._shadowRadius=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},Canvas.prototype.shadowOffsetX=function(){if(this._shadowOffset.x=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},Canvas.prototype.shadowOffsetY=function(){if(this._shadowOffset.y=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},Canvas.prototype.clear=function(){if(this.__nativeObj)return this.__nativeObj.clear()},Canvas.prototype.getTexture=function(){return this.__nativeObj?this.__nativeObj.getTexture():null},Canvas.prototype.drawText=function(){return this.__nativeObj&&(this.__nativeObj.drawText(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]),this._innerSetTransform()),null},Canvas.prototype.setTextSize=function(){return this.__nativeObj?this.__nativeObj.setTextSize(arguments[0]):null},Canvas.prototype.setTextAlign=function(){if(this.__nativeObj){switch(arguments[0]){case 0:case 1:case 2:this._textAlign=arguments[0];break;case"left":this._textAlign=0;break;case"center":this._textAlign=1;break;case"right":this._textAlign=2}return this.__nativeObj.setTextAlign(this._textAlign)}return null},Canvas.prototype.setTextBold=function(){return this.__nativeObj?this.__nativeObj.setTextBold(arguments[0]):null},Canvas.prototype.setTextItalic=function(){return this.__nativeObj?this.__nativeObj.setTextItalic(arguments[0]):null},Canvas.prototype.measureText=function(){return this.__nativeObj?this.__nativeObj.measureText(arguments[0],arguments[1],arguments[2]):null},Canvas.prototype.updateCanvasTexture=function(){return this.__nativeObj?this.__nativeObj.updateCanvasTexture():null},Canvas.prototype.saveTo=function(){var t=arguments.length;return this.__nativeObj&&1==t&&this.__nativeObj.saveTo(arguments[0]),null},BK.Canvas=Canvas,BK.Script.log(0,0,"Load Canvas.js succeed."),BK.Sprite.__proto__.setImagePath=function(t){if(t){this.imagePath=t;var e=new BK.Texture(t);this.setTexture(e)}},BK.Sprite.__proto__.getImagePath=function(){return this.imagePath},BK.Sprite.__proto__.setAtlas=function(t,e){BK.SpriteSheetCache.loadSheet(t);var i=BK.SpriteSheetCache.getTexturePathByFilename(e),r=new BK.Texture(i);this.setTexture(r);var n=BK.SpriteSheetCache.getFrameInfoByFilename(e);return this.adjustTexturePosition(n.frame.x,n.frame.y,n.frame.w,n.frame.h,n.rotated),0},BK.Script.log(0,0,"Load Sprite.js succeed.");var gl;BK.ScreenShot=function(){function t(){if(void 0==a){"android"==GameStatusInfo.platform&&(a=!0);var t=BK.Director.queryDeviceInfo(),e=t.version.split(".");"ios"==t.platform&&Number(e[0])>=10||"android"==t.platform?a=!0:(BK.Script.log(1,0,"Current Device dont supoort TypedArray.[info = "+JSON.stringify(t)+"]"),a=!1)}return a}function e(e){if(Object.prototype.hasOwnProperty.call(e,"__rawBKData"))return e.__rawBKData;if(Object.prototype.hasOwnProperty.call(e,"__nativeObj"))return e.__nativeObj;if(0==t()){if(e instanceof Uint16Array==1){for(var i=new BK.Buffer(e.byteLength,!1),r=0;r<e.length;r++)i.writeUint16Buffer(e[r]);return i}if(e instanceof Float32Array==1){for(var i=new BK.Buffer(e.byteLength,!1),r=0;r<e.length;r++)i.writeFloatBuffer(e[r]);return i}}return e}function i(){var t=gl.glCreateShader(gl.VERTEX_SHADER);0!=t&&(gl.glShaderSource(t,"attribute vec2 pos; attribute vec2 inUVs; varying lowp vec2 outUVs; void main() { gl_Position = vec4(pos, 0, 1); outUVs = inUVs; }"),gl.glCompileShader(t));var e=gl.glCreateShader(gl.FRAGMENT_SHADER);0!=e&&(gl.glShaderSource(e,"varying lowp vec2 outUVs; uniform sampler2D uSampler; void main() { gl_FragColor = texture2D(uSampler, outUVs); }"),gl.glCompileShader(e));var i=gl.glCreateProgram();return gl.glAttachShader(i,t),gl.glAttachShader(i,e),gl.glLinkProgram(i),gl.glDeleteShader(t),gl.glDeleteShader(e),i}function r(t,e){gl.glActiveTexture(gl.TEXTURE1);var i=gl.glCreateTexture(),r=gl.glGetParameterInt(gl.TEXTURE_BINDING_2D,1);gl.glBindTexture(gl.TEXTURE_2D,i),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.glTexImage2D(gl.TEXTURE_2D,0,gl.RGBA,t,e,0,gl.RGBA,gl.UNSIGNED_BYTE,null);var n=gl.glCreateFramebuffer();gl.glBindFramebuffer(gl.FRAMEBUFFER,n),gl.glFramebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,i,0);var a=gl.glCheckFramebufferStatus(gl.FRAMEBUFFER);return a!=gl.FRAMEBUFFER_COMPLETE&&BK.Script.log(1,-1,"_createFramebuffer!failed, status = "+a),gl.glActiveTexture(gl.TEXTURE1),gl.glBindTexture(gl.TEXTURE_2D,r),{tex:i,fbo:n}}function n(t){var n=i();gl.glUseProgram(n);var a=gl.glGetAttribLocation(n,"pos"),o=gl.glGetAttribLocation(n,"inUVs"),s=gl.glGetUniformLocation(n,"uSampler");gl.glActiveTexture(gl.TEXTURE0);var h=gl.glCreateTexture(),_=gl.glGetParameterInt(gl.TEXTURE_BINDING_2D,1);gl.glBindTexture(gl.TEXTURE_2D,h),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.glTexImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,t),gl.glUniform1i(s,0);var l=gl.glGetParameterInt(gl.ARRAY_BUFFER_BINDING,1),d=gl.glGetParameterInt(gl.ELEMENT_ARRAY_BUFFER_BINDING,1),c=new Float32Array([-1,-1,0,1,1,-1,1,1,1,1,1,0,-1,1,0,0]),u=gl.glCreateBuffer();gl.glBindBuffer(gl.ARRAY_BUFFER,u),gl.glEnableVertexAttribArray(a),gl.glVertexAttribPointer(a,2,gl.FLOAT,!1,16,0),gl.glVertexAttribPointer(o,2,gl.FLOAT,!1,16,8),gl.glBufferData(gl.ARRAY_BUFFER,e(c),gl.STATIC_DRAW);var f=new Uint16Array([0,1,2,0,2,3]),g=gl.glCreateBuffer();gl.glBindBuffer(gl.ELEMENT_ARRAY_BUFFER,g),gl.glBufferData(gl.ELEMENT_ARRAY_BUFFER,e(f),gl.STATIC_DRAW);var m=new BK.Buffer(t.width*t.height*4),p=gl.glGetParameterInt(gl.FRAMEBUFFER_BINDING,1),v=r(t.width,t.height);gl.glClearColor(1,1,1,1),gl.glClear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT|gl.STENCIL_BUFFER_BIT),gl.glDrawElements(gl.TRIANGLES,6,gl.UNSIGNED_SHORT,0),gl.glReadPixels(0,0,t.width,t.height,gl.RGBA,gl.UNSIGNED_BYTE,m),gl.glBindFramebuffer(gl.FRAMEBUFFER,p);for(var S=0,b=1;b<=10;b++){gl.glUseProgram(b);var T=gl.glGetAttribLocation(b,"Position"),E=gl.glGetAttribLocation(b,"SourceColor"),x=gl.glGetAttribLocation(b,"TexCoordIn");if(-1!=T&&-1!=E&&-1!=x){S=1;break}}return gl.glBindBuffer(gl.ARRAY_BUFFER,l),1==S?(gl.glEnableVertexAttribArray(T),gl.glEnableVertexAttribArray(E),gl.glEnableVertexAttribArray(x),gl.glVertexAttribPointer(T,3,gl.FLOAT,!1,36,0),gl.glVertexAttribPointer(E,4,gl.FLOAT,!1,36,12),gl.glVertexAttribPointer(x,2,gl.FLOAT,!1,36,28)):(gl.glEnableVertexAttribArray(0),gl.glEnableVertexAttribArray(1),gl.glEnableVertexAttribArray(2),gl.glVertexAttribPointer(0,3,gl.FLOAT,!1,36,0),gl.glVertexAttribPointer(1,4,gl.FLOAT,!1,36,12),gl.glVertexAttribPointer(2,2,gl.FLOAT,!1,36,28)),gl.glBindBuffer(gl.ELEMENT_ARRAY_BUFFER,d),gl.glActiveTexture(gl.TEXTURE0),gl.glBindTexture(gl.TEXTURE_2D,_),gl.glDeleteProgram(n),gl.glDeleteTexture(h),gl.glDeleteTexture(v.tex),gl.glDeleteFramebuffer(v.fbo),m}if(this.origin={x:0,y:0},this.size={width:0,height:0},GameStatusInfo){BK.Misc.compQQVersion||(BK.Misc.compQQVersion=function(t,e){for(var i=t.split("."),r=e.split("."),n=Math.min(3,Math.min(i.length,r.length)),a=0;a<n;a++)if(i[a]!=r[a])return i[a]<r[a];return!0});var a;gl||(gl=new BK.WebGL,function(){gl.DEPTH_BUFFER_BIT=256,gl.STENCIL_BUFFER_BIT=1024,gl.COLOR_BUFFER_BIT=16384,gl.TRIANGLES=4,gl.TEXTURE_BINDING_2D=32873,gl.ARRAY_BUFFER=34962,gl.ARRAY_BUFFER_BINDING=34964,gl.ELEMENT_ARRAY_BUFFER=34963,gl.ELEMENT_ARRAY_BUFFER_BINDING=34965,gl.STATIC_DRAW=35044,gl.UNSIGNED_BYTE=5121,gl.UNSIGNED_SHORT=5123,gl.FLOAT=5126,gl.RGBA=6408,gl.FRAGMENT_SHADER=35632,gl.VERTEX_SHADER=35633,gl.LINK_STATUS=35714,gl.CURRENT_PROGRAM=35725,gl.NEAREST=9728,gl.LINEAR=9729,gl.TEXTURE_MAG_FILTER=10240,gl.TEXTURE_MIN_FILTER=10241,gl.TEXTURE_WRAP_S=10242,gl.TEXTURE_WRAP_T=10243,gl.TEXTURE_2D=3553,gl.TEXTURE0=33984,gl.TEXTURE1=33985,gl.ACTIVE_TEXTURE=34016,gl.REPEAT=10497,gl.CLAMP_TO_EDGE=33071,gl.MIRRORED_REPEAT=33648,gl.FRAMEBUFFER=36160,gl.RENDERBUFFER=36161,gl.COLOR_ATTACHMENT0=36064,gl.DEPTH_ATTACHMENT=36096,gl.STENCIL_ATTACHMENT=36128,gl.NONE=0,gl.FRAMEBUFFER_COMPLETE=36053,gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054,gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055,gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057,gl.FRAMEBUFFER_UNSUPPORTED=36061,gl.FRAMEBUFFER_BINDING=36006,gl.RENDERBUFFER_BINDING=36007,gl.INVALID_FRAMEBUFFER_OPERATION=1286}()),BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.1")&&(this.doImage_rotate180=n),BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.1")&&(this.bufferFromScreenShot_760=function(t,e,i,r,n){var a=gl.glCreateTexture();gl.glActiveTexture(gl.TEXTURE1),gl.glBindTexture(gl.TEXTURE_2D,a),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.glTexParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.glTexImage2D(gl.TEXTURE_2D,0,gl.RGBA,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height,0,gl.RGBA,gl.UNSIGNED_BYTE,null);var o=gl.glGetParameterInt(gl.FRAMEBUFFER_BINDING,1),s=gl.glGetParameterInt(gl.RENDERBUFFER_BINDING,1),h=gl.glCreateRenderbuffer();gl.glBindRenderbuffer(gl.RENDERBUFFER,h),gl.glRenderbufferStorage(gl.RENDERBUFFER,35056,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height),gl.glBindRenderbuffer(gl.RENDERBUFFER,s);var _=gl.glCreateFramebuffer();gl.glBindFramebuffer(gl.FRAMEBUFFER,_),gl.glFramebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,a,0),gl.glFramebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_ATTACHMENT,gl.RENDERBUFFER,h),gl.glFramebufferRenderbuffer(gl.FRAMEBUFFER,gl.STENCIL_ATTACHMENT,gl.RENDERBUFFER,h);var l,d=gl.glCheckFramebufferStatus(gl.FRAMEBUFFER);return d==gl.FRAMEBUFFER_COMPLETE?(BK.Render.render(t,0),l=new BK.Buffer(r*n*4),gl.glReadPixels(e,i,r,n,gl.RGBA,gl.UNSIGNED_BYTE,l)):BK.Script.log(1,-1,"bufferFromScreenShot_760!framebuffer failed, code = "+d),gl.glBindFramebuffer(gl.FRAMEBUFFER,o),gl.glDeleteTexture(a),gl.glDeleteRenderbuffer(h),gl.glDeleteFramebuffer(_),l})}this.isInScreen=function(){(void 0==this.origin.x||this.origin.x<0||this.origin.x>BK.Director.screenPixelSize.width)&&(this.origin.x=0),(void 0==this.origin.y||this.origin.y<0||this.origin.y>BK.Director.screenPixelSize.height)&&(this.origin.y=0),(void 0==this.size.width||this.size.width<=0||this.size.width>BK.Director.screenPixelSize.width-this.origin.x)&&(this.origin.x=0,this.size.width=BK.Director.screenPixelSize.width),(void 0==this.size.height||this.size.height<=0||this.size.height>BK.Director.screenPixelSize.height-this.origin.y)&&(this.origin.y=0,this.size.height=BK.Director.screenPixelSize.height)},this.isInNode=function(t){(void 0==this.origin.x||this.origin.x<0||this.origin.x>t.contentSize.width)&&(this.origin.x=0),(void 0==this.origin.y||this.origin.y<0||this.origin.y>t.contentSize.height)&&(this.origin.y=0),(void 0==this.size.width||this.size.width<=0)&&(this.size.width=t.contentSize.width),(void 0==this.size.height||this.size.height<=0)&&(this.size.height=t.contentSize.height)},this.saveImage=function(t,e,i){GameStatusInfo&&BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.1")?(t=this.doImage_rotate180({buffer:t,width:this.size.width,height:this.size.height}),BK.Image.saveImage(t,this.size.width,this.size.height,e,i)):BK.Image.saveImage(t,this.size.width,this.size.height,e,i,1)},this.shotToFile=function(t,e){this.isInScreen();var i="";if(this.bufferFromScreenShot_760){var r=this.bufferFromScreenShot_760(BK.Director.root,this.origin.x,this.origin.y,this.size.width,this.size.height);void 0!=r&&(i="GameSandBox://"+t,this.saveImage(r,i,e))}else{i="GameSandBox://"+t+"."+e;var n=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(BK.Director.root,n),n.writeToDiskWithXY(i,this.origin.x,this.origin.y,this.size.width,this.size.height)}return i},this.shotToBuff=function(){if(this.isInScreen(),this.bufferFromScreenShot_760)return this.bufferFromScreenShot_760(BK.Director.root,this.origin.x,this.origin.y,this.size.width,this.size.height);var t=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);return BK.Render.renderToTexture(BK.Director.root,t),t.readPixels(this.origin.x,this.origin.y,this.size.width,this.size.height)},this.shotToFileFromNode=function(t,e,i){this.isInNode(t);var r="";if(this.bufferFromScreenShot_760){var n=this.bufferFromScreenShot_760(t,this.origin.x+t.position.x,this.origin.y+t.position.y,this.size.width,this.size.height);void 0!=n&&(r="GameSandBox://"+e,this.saveImage(n,r,i))}else{r="GameSandBox://"+e+"."+i;var a=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(t,a),a.writeToDiskWithXY(r,this.origin.x+t.position.x,this.origin.y+t.position.y,this.size.width,this.size.height)}return r},this.shotToBuffFromNode=function(t){if(this.isInNode(t),this.bufferFromScreenShot_760)return this.bufferFromScreenShot_760(t,this.origin.x+t.position.x,this.origin.y+t.position.y,this.size.width,this.size.height);var e=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);return BK.Render.renderToTexture(t,e),e.readPixels(this.origin.x+t.position.x,this.origin.y+t.position.y,this.size.width,this.size.height)},this.shotToFileFromGL=function(t,e,i,r){BK.Notification.on("frame_final",this,function(){this.isInScreen();var n="GameSandBox://"+e,a=new BK.Buffer(this.size.height*this.size.width*4);t.glReadPixels(this.origin.x,this.origin.y,this.size.width,this.size.height,t.RGBA,t.UNSIGNED_BYTE,a),this.saveImage(a,n,i),r&&r(n+"."+i)}.bind(this),!0)},this.shotToBuffFromGL=function(t,e){BK.Notification.on("frame_final",this,function(){this.isInScreen();var i=new BK.Buffer(this.size.height*this.size.width*4);t.glReadPixels(this.origin.x,this.origin.y,this.size.width,this.size.height,t.RGBA,t.UNSIGNED_BYTE,i),e&&e(i)}.bind(this),!0)}};var gl,isSupportTA,firstFrameUpload=!1,GL_COMMAND_ACTIVE_TEXTURE=0,GL_COMMAND_ATTACH_SHADER=1,GL_COMMAND_BIND_ATTRIB_LOCATION=2,GL_COMMAND_BIND_BUFFER=3,GL_COMMAND_BIND_FRAME_BUFFER=4,GL_COMMAND_BIND_RENDER_BUFFER=5,GL_COMMAND_BIND_TEXTURE=6,GL_COMMAND_BLEND_COLOR=7,GL_COMMAND_BLEND_EQUATION=8,GL_COMMAND_BLEND_EQUATION_SEPARATE=9,GL_COMMAND_BLEND_FUNC=10,GL_COMMAND_BLEND_FUNC_SEPARATE=11,GL_COMMAND_BUFFER_DATA=12,GL_COMMAND_BUFFER_SUB_DATA=13,GL_COMMAND_CLEAR=14,GL_COMMAND_CLEAR_COLOR=15,GL_COMMAND_CLEAR_DEPTH=16,GL_COMMAND_CLEAR_STENCIL=17,GL_COMMAND_COLOR_MASK=18,GL_COMMAND_COMMIT=19,GL_COMMAND_COMPILE_SHADER=20,GL_COMMAND_COMPRESSED_TEX_IMAGE_2D=21,GL_COMMAND_COMPRESSED_TEX_SUB_IMAGE_2D=22,GL_COMMAND_COPY_TEX_IMAGE_2D=23,GL_COMMAND_COPY_TEX_SUB_IMAGE_2D=24,GL_COMMAND_CULL_FACE=25,GL_COMMAND_DELETE_BUFFER=26,GL_COMMAND_DELETE_FRAME_BUFFER=27,GL_COMMAND_DELETE_PROGRAM=28,GL_COMMAND_DELETE_RENDER_BUFFER=29,GL_COMMAND_DELETE_SHADER=30,GL_COMMAND_DELETE_TEXTURE=31,GL_COMMAND_DEPTH_FUNC=32,GL_COMMAND_DEPTH_MASK=33,GL_COMMAND_DEPTH_RANGE=34,GL_COMMAND_DETACH_SHADER=35,GL_COMMAND_DISABLE=36,GL_COMMAND_DISABLE_VERTEX_ATTRIB_ARRAY=37,GL_COMMAND_DRAW_ARRAYS=38,GL_COMMAND_DRAW_ELEMENTS=39,GL_COMMAND_ENABLE=40,GL_COMMAND_ENABLE_VERTEX_ATTRIB_ARRAY=41,GL_COMMAND_FINISH=42,GL_COMMAND_FLUSH=43,GL_COMMAND_FRAME_BUFFER_RENDER_BUFFER=44,GL_COMMAND_FRAME_BUFFER_TEXTURE_2D=45,GL_COMMAND_FRONT_FACE=46,GL_COMMAND_GENERATE_MIPMAP=47,GL_COMMAND_HINT=48,GL_COMMAND_LINE_WIDTH=49,GL_COMMAND_LINK_PROGRAM=50,GL_COMMAND_PIXEL_STOREI=51,GL_COMMAND_POLYGON_OFFSET=52,GL_COMMAND_RENDER_BUFFER_STORAGE=53,GL_COMMAND_SAMPLE_COVERAGE=54,GL_COMMAND_SCISSOR=55,GL_COMMAND_SHADER_SOURCE=56,GL_COMMAND_STENCIL_FUNC=57,GL_COMMAND_STENCIL_FUNC_SEPARATE=58,GL_COMMAND_STENCIL_MASK=59,GL_COMMAND_STENCIL_MASK_SEPARATE=60,GL_COMMAND_STENCIL_OP=61,GL_COMMAND_STENCIL_OP_SEPARATE=62,GL_COMMAND_TEX_IMAGE_2D=63,GL_COMMAND_TEX_PARAMETER_F=64,GL_COMMAND_TEX_PARAMETER_I=65,GL_COMMAND_TEX_SUB_IMAGE_2D=66,GL_COMMAND_UNIFORM_1F=67,GL_COMMAND_UNIFORM_1FV=68,GL_COMMAND_UNIFORM_1I=69,GL_COMMAND_UNIFORM_1IV=70,GL_COMMAND_UNIFORM_2F=71,GL_COMMAND_UNIFORM_2FV=72,GL_COMMAND_UNIFORM_2I=73,GL_COMMAND_UNIFORM_2IV=74,GL_COMMAND_UNIFORM_3F=75,GL_COMMAND_UNIFORM_3FV=76,GL_COMMAND_UNIFORM_3I=77,GL_COMMAND_UNIFORM_3IV=78,GL_COMMAND_UNIFORM_4F=79,GL_COMMAND_UNIFORM_4FV=80,GL_COMMAND_UNIFORM_4I=81,GL_COMMAND_UNIFORM_4IV=82,GL_COMMAND_UNIFORM_MATRIX_2FV=83,GL_COMMAND_UNIFORM_MATRIX_3FV=84,GL_COMMAND_UNIFORM_MATRIX_4FV=85,GL_COMMAND_USE_PROGRAM=86,GL_COMMAND_VALIDATE_PROGRAM=87,GL_COMMAND_VERTEX_ATTRIB_1F=88,GL_COMMAND_VERTEX_ATTRIB_2F=89,GL_COMMAND_VERTEX_ATTRIB_3F=90,GL_COMMAND_VERTEX_ATTRIB_4F=91,GL_COMMAND_VERTEX_ATTRIB_1FV=92,GL_COMMAND_VERTEX_ATTRIB_2FV=93,GL_COMMAND_VERTEX_ATTRIB_3FV=94,GL_COMMAND_VERTEX_ATTRIB_4FV=95,GL_COMMAND_VERTEX_ATTRIB_POINTER=96,GL_COMMAND_VIEW_PORT=97,total_size=1e5,next_index=0,buffer_data,bufferdata_array,bufferdata_view,bufferdata_pointer=0;if(function(t,e){"object"==typeof t&&(t.MQQ.Webview.openTransparent=e().openTransparent,t.MQQ.Webview.closeTransparent=e().closeTransparent,t.MQQ.Webview.sendMessageToWebView=e().sendMessageToWebView,t.MQQ.Webview.onMessageHandle=e().onMessageHandle)}(BK,function(){function t(t,e,i){void 0===e&&(e=1);var r="cs.openWebViewWithoutUrl.local",n={url:t,gameOrientation:e,businessType:2};GameStatusInfo.devPlatform&&BK.Script.log(0,0,"BK.MQQ.Webview.openTransparent rely QQ.Call Failed!"),i&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,i)),BK.MQQ.SsoRequest.send(n,r)}function e(t){var e={taskId:t};BK.MQQ.SsoRequest.send(e,"cs.closeWebview.local")}function i(t,e){var i={taskId:t,msg:e};BK.MQQ.SsoRequest.send(i,"cs.apolloGameTargetWebMessage.local")}function r(t){BK.MQQ.SsoRequest.addListener("sc.web_callback_game.local",null,function(e,i,r){t&&t(i,r)})}return{openTransparent:t,closeTransparent:e,sendMessageToWebView:i,onMessageHandle:r}}),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Audio=e())}(BK,function(){var t=BK.Audio,e=function(){function e(e,i,r){this.__nativeObj=new t(e,i,r),this._type=e,this.path=i,this._loopCount=r}return Object.defineProperty(e.prototype,"type",{set:function(t){1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")&&this.__nativeObj.setAudioParam("type",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"musicPath",{set:function(t){1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")&&this.__nativeObj.setAudioParam("musicPath",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loopCount",{set:function(t){1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")&&this.__nativeObj.setAudioParam("loopCount",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5"))return this.__nativeObj.currentTime},set:function(t){1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")&&this.__nativeObj.setAudioParam("currentTime",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5"))return this.__nativeObj.volume},set:function(t){1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")&&this.__nativeObj.setAudioParam("volume",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"audioType",{set:function(t){1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")&&this.__nativeObj.setAudioParam("audioType",t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5"))return this.__nativeObj.duration},enumerable:!0,configurable:!0}),e.pauseAllBackground=function(){if(this.playingBackgrounds)for(var t=0;t<this.playingBackgrounds.length;t++){var e=this.playingBackgrounds[t];"string"!=typeof e.music&&e.music.pauseMusic()}},e.resumeAllBackground=function(){if(this.playingBackgrounds)for(var e=0;e<this.playingBackgrounds.length;e++){var i=this.playingBackgrounds[e];"string"!=typeof i.music?(i.music.resumeMusic(),BK.Script.log(0,0," music.resumeMusic not string")):(BK.Script.log(0,0," music.resumeMusic "+typeof i.music),t.playMusic(i.type,i.music,i.loop))}},e.removeBackgrounFromArray=function(t){if(this.playingBackgrounds)for(var i=0;i<e.playingBackgrounds.length;i++)e.playingBackgrounds[i].music},e.addBackgroundToArray=function(t,i,r){var n={music:t,type:i,loop:r};void 0===this.playingBackgrounds&&(this.playingBackgrounds=[]);for(var a=0;a<e.playingBackgrounds.length;a++)e.playingBackgrounds[a].music;this.playingBackgrounds.push(n)},e.playMusic=function(i,r,n){var a=new t(i,r,n);a.startMusic(function(){}),0==i&&e.addBackgroundToArray(a,i,n)},e.prototype.startMusic=function(i){"ios"===GameStatusInfo.platform&&GameStatusInfo.QQVer.indexOf("7.5.8")>-1?t.playMusic(this._type,this.path,this._loopCount):(null!=i&&void 0!=i?this.__nativeObj.startMusic(i):this.__nativeObj.startMusic(),0==this._type&&e.addBackgroundToArray(this.__nativeObj,this._type,this._loopCount))},e.prototype.pauseMusic=function(){"ios"===GameStatusInfo.platform&&GameStatusInfo.QQVer.indexOf("7.5.8")>-1||(this.__nativeObj.pauseMusic(),0==this._type&&e.removeBackgrounFromArray(this.__nativeObj))},e.prototype.resumeMusic=function(){"ios"===GameStatusInfo.platform&&GameStatusInfo.QQVer.indexOf("7.5.8")>-1||(this.__nativeObj.resumeMusic(),0==this._type&&e.addBackgroundToArray(this.__nativeObj,this._type,this._loopCount))},e.prototype.stopMusic=function(){"ios"===GameStatusInfo.platform&&GameStatusInfo.QQVer.indexOf("7.5.8")>-1||(0==this._type&&e.removeBackgrounFromArray(this.__nativeObj),this.__nativeObj.stopMusic())},e.prototype.seekTo=function(t){1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")&&this.__nativeObj.seekTo(t)},e}();return Object.defineProperty(e,"switch",{get:function(){return t.switch},set:function(e){t.switch=e},enumerable:!0,configurable:!0}),e}),BK.MQQ&&BK.MQQ.Account){var headCacheDir_1="GameSandBox://_head/";BK.FileUtil.isFileExist(headCacheDir_1)||BK.FileUtil.makeDir(headCacheDir_1),BK.MQQ.Account.getHeadEx||(BK.MQQ.Account.getHeadEx=function(t,e){BK.MQQ.Account.getHead(t,function(i,r){if(r&&r.buffer&&r.width&&r.height)if(BK.Image.saveImage)BK.Image.saveImage(r.buffer,r.width,r.height,headCacheDir_1+i,"jpg"),e(i,headCacheDir_1+i+".jpg");else{var n=new BK.Texture(r.buffer,r.width,r.height),a=new BK.Sprite(r.width,r.height,n,0,0,1,1),o=new BK.RenderTexture(r.width,r.height);BK.Render.renderToTexture(a.__nativeObj?a.__nativeObj:a,o),o.saveTo(headCacheDir_1+i),e(t,headCacheDir_1+i)}else e(t,"")})}),BK.MQQ.Account.getUserInfo=function(t){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var e="cs.get_user_info.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(null,e))}else t(-1,null)},BK.MQQ.Account.getFriends=function(t){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var e="cs.get_app_friends.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(null,e))}else t(-1,null)},BK.MQQ.Account.getLocation=function(t){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var e="cs.get_location.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(null,e))}else t(-1,null)},BK.MQQ.Account.getCity=function(t){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var e="cs.get_city.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(null,e))}else t(-1,null)},BK.MQQ.Account.preloadUserInfoList=function(t,e){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var i="cs.preload_userInfoList.local";if(e){var r={openIdList:t};BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){e(t)}),BK.MQQ.SsoRequest.send(r,i)}}else e(-1)},BK.MQQ.Account.queryNick=function(t,e,i,r,n){var a=new BK.QQNickCanvas(t,e,i,r,function(t,e){n(a.__nativeObj,e)})},BK.MQQ.Account.queryHead=function(t,e,i,r,n){var a=new BK.QQAvatarCanvas(t,e,i,r,null,function(t,e){n(a.__nativeObj,e)})}}BK.Misc.compQQVersion||(BK.Misc.compQQVersion=function(t,e){for(var i=t.split("."),r=e.split("."),n=Math.min(3,Math.min(i.length,r.length)),a=0;a<n;a++)if(i[a]!=r[a])return i[a]<r[a];return!0},BK.Misc.qqVerLessthan=function(t,e){for(var i=t.split("."),r=e.split("."),n=Math.min(3,Math.min(i.length,r.length)),a=0;a<n;a++){if(i[a]<r[a])return!0;if(i[a]>r[a])return!1}return!1}),function(t,e){"object"==typeof t&&(t.TouchEventDispatch=function(){var t=BK.TouchEvent.getAllTouchEvent,e=BK.TouchEvent.getTouchEvent,i=BK.TouchEvent.updateTouchStatus;return{TouchEventDispatch:function(){function r(){}return r.listenAllTouch=function(t,e){void 0===this.listenerInfos&&(this.listenerInfos=[]);var i={obj:t,callback:e};this.listenerInfos.push(i)},r.remove=function(t){for(var e=-1,i=0;i<len;i++)this.listenerInfos[i].obj==t&&(e=i);-1!=e&&this.listenerInfos.splice(e,1)},r.dispatch=function(t){t&&this.listenerInfos.forEach(function(e){e.callback(t)})},r.getTouchEvent=function(){var t=e();return t&&this.dispatch([t]),t},r.getAllTouchEvent=function(){var e=t();return e&&this.dispatch(e),e},r.updateTouchStatus=function(){i()},r.listenerInfos=[],r}()}}().TouchEventDispatch)}(BK),function(t,e){t.TouchEvent=function(){return function(){function t(){}return t.getTouchEvent=function(){return BK.TouchEventDispatch.getTouchEvent()},t.getAllTouchEvent=function(){return BK.TouchEventDispatch.getAllTouchEvent()},t.updateTouchStatus=function(){BK.TouchEventDispatch.updateTouchStatus()},t}()}()}(BK),function(t,e){function i(e,i){try{t.gl&&0==r&&(r=!0,a()),o(e,i),t.gl&&t.gl.__oldGlCommit()}catch(t){}BK.Notification.emitAll("frame_final",{})}var r=!1,n=function(){},a=function(){this.__gl=bkWebGLGetInstance(),this.__oldGlCommit=this.__gl.glCommit,this.__gl.glCommit=n,this.__gl.__oldGlCommit=this.__oldGlCommit,n.bind(this.__gl)};BK.Notification=new BK.Emitter;var o=t._tickerCallback_;t._tickerCallback_=i}(this),function(t,e){var i=void 0;e.Script.setErrorObserver=function(t){i=t},t._globalErrorCallback_=function(t){i&&i(t.message,t.stack)}}(this,BK),function(t,e){e&&e.Image&&!e.Image.loadImageWithBase64&&(e.Image.loadImageWithBase64=function(t){if(t){var i=e.Misc.decodeBase64FromString(t);return e.Image.loadImage(i)}e.Script.log(1,0,"buffer is empty")})}(0,BK),function(t,e){if(e&&e.Image&&!e.Image.loadImageAsync){var i=e.Image.loadImage;e.Image.loadImageSync=i;var r=function(t,r){t&&r?e.FileManager.Instance.readFile(t,function(t){for(var e=0;e<t.length;e++)if(0==t[e].errcode){var n=i(t[e].data);n?t[e].image=n:(t[e].errcode=-1,t[e].errmsg="load Image failed!"),delete t[e].data}else t[e].errmsg=t[e].errmsg;r(t)}):e.Script.log(1,1,"BK.Image.loadImageAsync failed! config or callback is null")};e.Image.loadImage=function(t,n){if(t){if(void 0==n)return i(t);if(n instanceof Function)return r(t,n);if(n instanceof Number||"number"==typeof n)return i(t,n)}e.Script.log(1,1,"BK.Image.loadImage failed! ")}}}(0,BK),function(t,e){function i(t){if(!(t.indexOf("GameRes://")<0)){var e=t.substring("GameRes://".length,t.length),i=e.indexOf("/");if(!(i<0)){var r=e.substring(0,i);if(r&&""!=r)for(var n in a.subpackages){var o=a.subpackages[n];if(o&&o.root&&o.root===r&&o.name)return o.name}}}}if(GameStatusInfo&&"xcode"!==GameStatusInfo.devPlatform){var r=GameStatusInfo.QQVer.split(".");if(Number(r[0])<7||7==Number(r[0])&&Number(r[1])<7||7==Number(r[0])&&7==Number(r[1])&&Number(r[2])<5)e.Script.log(1,0,"775 以下手q 版本");else{var n=e.FileUtil.readFile("GameRes://gameConfig.json");if(n){var a=JSON.parse(n.readAsString(!0));a&&a.subpackages&&(e.Script.innerLoadLib=e.Script.loadlib,e.Script.loadlib=function(t){var r=i(t);r?e.QQ.checkPakcage(r,function(i,r){0==r?e.Script.innerLoadLib(t):e.Script.log(1,1,"终端校验子包完整性失败 pack:"+i+" code:"+r)}):e.Script.innerLoadLib(t)})}}}else e.Script.log(1,0,"Xcode 环境")}(0,BK),function(t,e){if(BK.Notification){BK.MQQ.SsoRequest.addListener("sc.game_enter_background.local",null,function(){BK.Notification.emitAll("game_enter_background",{})}.bind(this)),BK.MQQ.SsoRequest.addListener("sc.game_enter_foreground.local",null,function(){BK.Notification.emitAll("game_enter_foreground",{})}.bind(this)),BK.MQQ.SsoRequest.addListener("sc.game_maximize.local",null,function(){BK.Notification.emitAll("game_maximize",{})}.bind(this)),BK.MQQ.SsoRequest.addListener("sc.game_minimize.local",null,function(){BK.Notification.emitAll("game_minimize",{})}.bind(this)),BK.MQQ.SsoRequest.addListener("sc.game_shell_pack_up.local",null,function(){BK.Notification.emitAll("game_pack_up",{})}.bind(this)),BK.MQQ.SsoRequest.addListener("sc.game_shell_close.local",null,function(){if("ios"===GameStatusInfo.platform||BK.showPlusTips&&3==BK.showPlusTips||0==(1&GameStatusInfo.commFlagBits)||1==BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.9"))BK.Notification.emitAll("game_close",{}),isBrowser?BK.MQQ.SsoRequest.sendTo({},"cs.close_room.local"):BK.MQQ.SsoRequest.send({},"cs.close_room.local");else{var t="apollo_router_game.apl_d_r_linkcmd_plus_exist_tips",e={cmd:t,gameid:GameStatusInfo.gameId+""};BK.MQQ.SsoRequest.send(e,t),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){BK.Script.log(0,0," apl_d_r_linkcmd_plus_exist_tips = "+t)});new BK.PlusTips(!1).showTips(function(){BK.Notification.emitAll("game_close",{}),isBrowser?BK.MQQ.SsoRequest.sendTo({},"cs.close_room.local"):BK.MQQ.SsoRequest.send({},"cs.close_room.local")}),BK.showPlusTips=3}}.bind(this)),BK.MQQ.SsoRequest.addListener("sc.network_change.local",null,function(t,e,i){void 0===i.type?BK.Script.log(1,1,"net work change .data is worng!"):BK.Notification.emitAll("game_network_change",i.type)}.bind(this))}}(),function(t,e){t.FileUtil.upload=function(){function t(t,e,i){function r(t,e){i(e,f+c)}for(var n=t.length>1024?1024:t.length,a=new Uint8Array(n),o=0;o<n;o++)a[o]=t.readUint8Buffer();t.rewind();var s=new Date,h=s.getFullYear()+(s.getMonth()+1<10?0+(s.getMonth()+1):s.getMonth()+1)+s.getDate(),_=e.signTime,l=e.tmpSecretId,d=e.sessionToken,c="/"+GameStatusInfo.gameId+"_"+BK.Crypt.bin2hex(BK.Crypt.core_md5(a,n))+GameStatusInfo.gameId+"_"+h+".png",u=e.upLoadPrefUrl.replace(new RegExp("http://","gm"),""),f=e.downloadUrl,g=e.signature,m="put\n"+c+"\n\nhost="+u+"&x-cos-storage-class=nearline\n",p="sha1\n"+_+"\n"+BK.Crypt.hex_sha1(m)+"\n",v="q-sign-algorithm=sha1&q-ak="+l+"&q-sign-time="+_+"&q-key-time="+_+"&q-header-list=host;x-cos-storage-class&q-url-param-list=&q-signature="+BK.Crypt.hex_hmac_sha1(g,p),S=new BK.HttpUtil("https://"+u+c);S.setHttpMethod("put"),S.setHttpHeader("host",u),S.setHttpHeader("x-cos-storage-class","nearline"),S.setHttpHeader("x-cos-security-token",d),S.setHttpHeader("authorization",v),S.setBodyCompatible(!1),S.setHttpRawBody(t),S.requestAsync(r)}return BK.FileUtil.uploadFromFile=function(t,e){var i=BK.FileUtil.readFile(t);i&&i.length>0?BK.FileUtil.uploadFromBuff(i,e):(BK.Script.log(1,1,"uploadFromFile failed.file is empty!"),e(-1,""))},BK.FileUtil.uploadFromBuff=function(e,i){BK.QQ.queryCloudSignature(function(r,n){t(e,n,i)})},BK.FileUtil.uploadFromNode=function(e,i){var r=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(e,r),r.writeToDiskWithXY("GameSandBox://temp.png",e.position.x,e.position.y,e.contentSize.width,e.contentSize.height);var n=BK.FileUtil.readFile("GameSandBox://temp.png");BK.QQ.queryCloudSignature(function(e,r){t(n,r,i)})},BK.FileUtil.uploadNode=function(e,i,r,n,a,o){var s=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(e,s),s.writeToDiskWithXY("GameSandBox://temp.png",i,r,n,a);var h=BK.FileUtil.readFile("GameSandBox://temp.png");BK.QQ.queryCloudSignature(function(e,i){t(h,i,o)})},t}()}(BK),BK.QQ.shareToArkFromFile=function(t,e,i,r){BK.FileUtil.uploadFromFile(r,function(r,n){BK.QQ.shareToArk(t,e,n,!0,i)})},BK.QQ.shareToArkFromBuff=function(t,e,i,r){BK.FileUtil.uploadFromBuff(r,function(r,n){200==r&&BK.QQ.shareToArk(t,e,n,!0,i)})},BK.QQ.shareToArkFromNode=function(t,e,i,r){BK.FileUtil.uploadFromNode(r,function(r,n){200==r&&BK.QQ.shareToArk(t,e,n,!0,i)})},function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.UIEventHandler=e())}(this,function(){function t(){this.eveFuncTb=[],this._eventMap={1:[],2:[],3:[]},this.rootNode=BK.Director.root,this.nodeTreeHittest=function(t,e){if(1==t.canUserInteract&&0==t.hidden){if(t.children)for(var i=t.children,r=i.length-1;r>=0;r--){var n=i[r],a=this.nodeTreeHittest(n,e);if(void 0!=a)return a}return 1==t.hittest(e)?t:void 0}},this.treeHittest=function(t){return this.nodeTreeHittest(this.rootNode,t)},this.setRootNode=function(t){this.rootNode=t},this.addNodeEvent=function(t,e,i){var r={};r.obj=t,r.func=i;for(var n=!1,a=0;a<this._eventMap[e].length;a++)this._eventMap[e][a].obj==t&&(n=!0);0==n?this._eventMap[e].push(r):BK.Script.log(1,0,"Add Same Node Event has added Event Before.")},this.removeNodeEvent=function(t,e){for(var i=-1,r=0;r<this._eventMap[e].length;r++)this._eventMap[e][r].obj==t&&(i=r);i>=0&&(this._eventMap[e].splice(i,1),BK.Script.log(1,0,"Remove Node Event Succeed!"))},this.triggerEvent=function(t,e,i,r){for(var n=0;n<this._eventMap[e].length;n++){var a=this._eventMap[e][n];if(t&&a.obj==t){var o=a.func;o&&o(t,e,i,r)}}},this.triggerAllNodeEvent=function(t){for(var e=0;e<this._eventMap[t].length;e++){var i=this._eventMap[t][e],r=i.func,n=i.obj;r&&r(n,t)}},this.isFirstTouchDown=-1,this.currentNode=void 0,this.touchUpdate=function(t){if(void 0!=t)for(var n=0;n<t.length;n++)for(var a=t[n],o=0;o<a.length;o++){var s=a[o].x,h=a[o].y;if(2==a[o].status)if(-1==this.isFirstTouchDown){this.isFirstTouchDown=a[o].id;var _=this.treeHittest({x:s,y:h});_?(this.currentNode=_,this.triggerEvent(this.currentNode,e,s,h)):this.currentNode=void 0}else BK.Script.log(0,0,"detectGesture begin not first id:"+a[o].id+" x:"+s+" y:"+h);else 3==a[o].status?-1!=this.isFirstTouchDown&&a[o].id==this.isFirstTouchDown?this.currentNode&&this.triggerEvent(this.currentNode,i,s,h):BK.Script.log(0,0,"detectGesture moved! Failed touchArr[i].id = "+a[o].id):1==a[o].status&&(-1!=this.isFirstTouchDown&&a[o].id==this.isFirstTouchDown?(this.isFirstTouchDown=-1,this.currentNode&&(this.triggerEvent(this.currentNode,r,s,h),this.currentNode=void 0)):BK.Script.log(0,0,"detectGesture end!!!Failed!!! touchArr[i].id= "+a[o].id+" this.isFirstTouchDown:"+this.isFirstTouchDown))}},this.detectGesture=function(){var t=BK.TouchEvent.getAllTouchEvent();this.touchUpdate(t),BK.TouchEvent.updateTouchStatus()},"function"==typeof BK.TouchEventDispatch?BK.TouchEventDispatch.listenAllTouch(this,this.touchUpdate.bind(this)):BK.Director.ticker.add(function(t,e){this&&this.detectGesture()}.bind(this))}var e=1,i=2,r=3;return new t}),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Button=e())}(BK,function(){function t(t,e,i,r){this.touchStatus=0,this.normalTexture=void 0,this.pressTexture=void 0,this.disableTexture=void 0,this.normalTextureOffset={frame:{x:0,y:0,w:0,h:0},rotated:!1},this.pressTextureOffset={frame:{x:0,y:0,w:0,h:0},rotated:!1},this.disableTextureOffset={frame:{x:0,y:0,w:0,h:0},rotated:!1},this.touchInsideCallback=void 0,i?(this.normalTexture=new BK.Texture(i),this.normalTexture&&(this.normalTextureOffset.frame.x=0,this.normalTextureOffset.frame.y=0,this.normalTextureOffset.frame.w=this.normalTexture.size.width,this.normalTextureOffset.frame.h=this.normalTexture.size.height,this.normalTextureOffset.rotated=!1)):this.normalTexture={},r&&(this.touchInsideCallback=r),this.__nativeObj=new BK.Sprite(t,e,this.normalTexture,0,1,1,1);try{Object.getOwnPropertyNames(this.__nativeObj).forEach(function(t){var e=t;BK.Script.log(1,1,t),Object.defineProperty(this,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this)}catch(t){BK.Script.log(1,1," error :"+t)}this.enable=!0,Object.defineProperty(this,"disable",{get:function(){return!this.enable},set:function(t){1==t?this.updateTexture(2):this.updateTexture(0),this.enable=!t}}),this.updateTexture=function(t){if(0==t){if(this.normalTexture){this.__nativeObj.setTexture(this.normalTexture);e=this.normalTextureOffset;this.__nativeObj.adjustTexturePosition(e.frame.x,e.frame.y,e.frame.w,e.frame.h,e.rotated)}}else if(1==t){if(this.pressTexture){this.__nativeObj.setTexture(this.pressTexture);e=this.pressTextureOffset;this.__nativeObj.adjustTexturePosition(e.frame.x,e.frame.y,e.frame.w,e.frame.h,e.rotated)}}else if(2==t&&this.disableTexture){this.__nativeObj.setTexture(this.disableTexture);var e=this.disableTextureOffset;this.__nativeObj.adjustTexturePosition(e.frame.x,e.frame.y,e.frame.w,e.frame.h,e.rotated)}},this.changeStatus=function(t){this.touchStatus=t,this.updateTexture(this.touchStatus)},this.updateStatus=function(){this.updateTexture(this.touchStatus)},this.changeStatus(0),this.isCancelClick=void 0,UIEventHandler.addNodeEvent(this,1,function(t,e,i,r){t.isCancelClick=!1,t.enable?t.changeStatus(1):t.changeStatus(2)}),UIEventHandler.addNodeEvent(this,2,function(t,e,i,r){var n={x:i,y:r};0==t.hittest(n)&&(t.isCancelClick=!0)}),UIEventHandler.addNodeEvent(this,3,function(t,e,i,r){t.enable?t.changeStatus(0):t.changeStatus(2),0==t.isCancelClick&&t.touchInsideCallback&&t.touchInsideCallback(t)}),this.canUserInteract=!0}return t.prototype.setTouchInsideCallback=function(t){this.touchInsideCallback=t},t.prototype.setNormalTexturePath=function(t){var e=new BK.Texture(t);e&&this.setNormalTexture(e)},t.prototype.setPressTexturePath=function(t){var e=new BK.Texture(t);e&&this.setPressTexture(e)},t.prototype.setDisableTexturePath=function(t){var e=new BK.Texture(t);e&&this.setDisableTexture(e)},t.prototype.setNormalTexture=function(t){this.normalTexture=t,this.normalTexture&&(this.normalTextureOffset.frame.x=0,this.normalTextureOffset.frame.y=0,this.normalTextureOffset.frame.w=this.normalTexture.size.width,this.normalTextureOffset.frame.h=this.normalTexture.size.height,this.normalTextureOffset.rotated=!1),this.updateStatus()},t.prototype.setPressTexture=function(t){this.pressTexture=t,this.pressTexture&&(this.pressTextureOffset.frame.x=0,this.pressTextureOffset.frame.y=0,this.pressTextureOffset.frame.w=this.pressTexture.size.width,this.pressTextureOffset.frame.h=this.pressTexture.size.height,this.pressTextureOffset.rotated=!1),this.updateStatus()},t.prototype.setDisableTexture=function(t){this.disableTexture=t,this.disableTexture&&(this.disableTextureOffset.frame.x=0,this.disableTextureOffset.frame.y=0,this.disableTextureOffset.frame.w=this.disableTexture.size.width,this.disableTextureOffset.frame.h=this.disableTexture.size.height,this.disableTextureOffset.rotated=!1),this.updateStatus()},t.prototype.setNormalTextureFromSheetInfo=function(t){if(t){var e=new BK.Texture(t.texturePath);e?(this.normalTexture=e,this.normalTextureOffset=t.frameInfo,this.updateStatus()):BK.Script.log(0,0,"setNormalTextureFromSheetInfo error! Create texture failed.")}else BK.Script.log(0,0,"setNormalTextureFromSheetInfo error! textureFrameInfo is null or undefined")},t.prototype.setPressTextureFromSheetInfo=function(t){if(t){var e=new BK.Texture(t.texturePath);e?(this.pressTexture=e,this.pressTextureOffset=t.frameInfo,this.updateStatus()):BK.Script.log(0,0,"setPressTextureFromSheetInfo error! Create texture failed.")}else BK.Script.log(0,0,"setPressTextureFromSheetInfo error! textureFrameInfo is null or undefined")},t.prototype.setDisableTextureFromSheetInfo=function(t){if(t){var e=new BK.Texture(t.texturePath);e?(this.disableTexture=e,this.disableTextureOffset=t.frameInfo,this.updateStatus()):BK.Script.log(0,0,"setDisableTextureFromSheetInfo error! Create texture failed.")}else BK.Script.log(0,0,"setDisableTextureFromSheetInfo error! textureFrameInfo is null or undefined")},t.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},t.prototype.addChild=function(t){this.__nativeObj.addChild(t)},t.prototype.attach=function(t){this.__nativeObj.attach(t)},t.prototype.dispose=function(){this.__nativeObj.dispose()},t.prototype.setTexture=function(t){this.__nativeObj.setTexture(t)},t.prototype.removeFromParent=function(){this.__nativeObj.removeFromParent()},t.prototype.setNormalTextureFromUrl=function(t,e){this.normalUrl=t,new BK.HttpUtil(this.normalUrl).requestAsync(function(t,i){if(200==i){var r="GameSandBox://btntmp/"+this.normalUrl;BK.FileUtil.writeBufferToFile(r,t);var n=new BK.Texture(r);this.setNormalTexture(n)}else BK.Script.log(1,1,"Fetch advertisemSent image failed.");e&&e(this,i)}.bind(this))},t.prototype.setPressTextureFromUrl=function(t,e){this.pressUrl=t,new BK.HttpUtil(this.pressUrl).requestAsync(function(t,i){if(200==i){var r="GameSandBox://btntmp/"+this.pressUrl;BK.FileUtil.writeBufferToFile(r,t);var n=new BK.Texture(r);this.setPressTexture(n)}else BK.Script.log(1,1,"Fetch advertisement image failed.");e&&e(this,i)}.bind(this))},t.prototype.setDisableTextureFromUrl=function(t,e){this.disableUrl=t,new BK.HttpUtil(this.disableUrl).requestAsync(function(t,i){if(200==i){var r="GameSandBox://btntmp/"+this.disableUrl;BK.FileUtil.writeBufferToFile(r,t);var n=new BK.Texture(r);this.setDisableTexture(n)}else BK.Script.log(1,1,"Fetch advertisement image failed.");e&&e(this,i)}.bind(this))},t}),function(t,e){if("object"==typeof t){var i=function(){function t(t){return.01745329251994*t}return{Matrix:function(){function e(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];if(this.data=new Float32Array(16),arguments.length){if(1==arguments.length){if(arguments[0]instanceof e==1)for(var r=0;r<16;r++)this.data[r]=arguments[0].data[r]}else if(16==arguments.length)for(var n=0;n<16;n++)this.data[n]=arguments[n]}else this.data[0]=1,this.data[5]=1,this.data[10]=1,this.data[15]=1}return e.prototype.clone=function(){return new e(this)},e.prototype.mul=function(t){var e=this.data[0],i=this.data[1],r=this.data[2],n=this.data[3],a=this.data[4],o=this.data[5],s=this.data[6],h=this.data[7],_=this.data[8],l=this.data[9],d=this.data[10],c=this.data[11],u=this.data[12],f=this.data[13],g=this.data[14],m=this.data[15],p=t.data[0],v=t.data[1],S=t.data[2],b=t.data[3],T=t.data[4],E=t.data[5],x=t.data[6],B=t.data[7],C=t.data[8],R=t.data[9],A=t.data[10],y=t.data[11],I=t.data[12],O=t.data[13],M=t.data[14],D=t.data[15];return this.data[0]=e*p+a*v+_*S+u*b,this.data[1]=i*p+o*v+l*S+f*b,this.data[2]=r*p+s*v+d*S+g*b,this.data[3]=n*p+h*v+c*S+m*b,this.data[4]=e*T+a*E+_*x+u*B,this.data[5]=i*T+o*E+l*x+f*B,this.data[6]=r*T+s*E+d*x+g*B,this.data[7]=n*T+h*E+c*x+m*B,this.data[8]=e*C+a*R+_*A+u*y,this.data[9]=i*C+o*R+l*A+f*y,this.data[10]=r*C+s*R+d*A+g*y,this.data[11]=n*C+h*R+c*A+m*y,this.data[12]=e*I+a*O+_*M+u*D,this.data[13]=i*I+o*O+l*M+f*D,this.data[14]=r*I+s*O+d*M+g*D,this.data[15]=n*I+h*O+c*M+m*D,this},e.prototype.mulPoint=function(t){var e=this.data[0],i=this.data[1],r=this.data[2],n=this.data[3],a=this.data[4],o=this.data[5],s=this.data[6],h=this.data[7],_=this.data[8],l=this.data[9],d=this.data[10],c=this.data[11],u=this.data[12],f=this.data[13],g=this.data[14],m=this.data[15];void 0===t.z&&(t.z=0);var p={x:0,y:0,z:0};p.x=e*t.x+a*t.y+_*t.z+u,p.y=i*t.x+o*t.y+l*t.z+f,p.z=r*t.x+s*t.y+d*t.z+g;t.x,t.y,t.z;return p},e.prototype.inverse=function(){var t=this.data[10]*this.data[15]-this.data[14]*this.data[11],e=this.data[6]*this.data[15]-this.data[14]*this.data[7],i=this.data[6]*this.data[11]-this.data[10]*this.data[7],r=this.data[2]*this.data[15]-this.data[14]*this.data[3],n=this.data[2]*this.data[11]-this.data[10]*this.data[3],a=this.data[2]*this.data[7]-this.data[6]*this.data[3],o=this.data[9]*this.data[15]-this.data[13]*this.data[11],s=this.data[5]*this.data[15]-this.data[13]*this.data[7],h=this.data[5]*this.data[11]-this.data[9]*this.data[7],_=this.data[1]*this.data[15]-this.data[13]*this.data[3],l=this.data[1]*this.data[11]-this.data[9]*this.data[3],d=this.data[1]*this.data[7]-this.data[5]*this.data[3],c=this.data[9]*this.data[14]-this.data[13]*this.data[10],u=this.data[5]*this.data[14]-this.data[13]*this.data[6],f=this.data[5]*this.data[10]-this.data[9]*this.data[6],g=this.data[1]*this.data[14]-this.data[13]*this.data[2],m=this.data[1]*this.data[10]-this.data[9]*this.data[2],p=this.data[1]*this.data[6]-this.data[5]*this.data[2],v=this.data[5]*t-this.data[9]*e+this.data[13]*i,S=this.data[9]*r-this.data[1]*t-this.data[13]*n,b=this.data[1]*e-this.data[5]*r+this.data[13]*a,T=this.data[5]*n-this.data[1]*i-this.data[9]*a,E=this.data[8]*e-this.data[4]*t-this.data[12]*i,x=this.data[0]*t-this.data[8]*r+this.data[12]*n,B=this.data[4]*r-this.data[0]*e-this.data[12]*a,C=this.data[0]*i-this.data[4]*n+this.data[8]*a,R=this.data[4]*o-this.data[8]*s+this.data[12]*h,A=this.data[8]*_-this.data[0]*o-this.data[12]*l,y=this.data[0]*s-this.data[4]*_+this.data[12]*d,I=this.data[4]*l-this.data[0]*h-this.data[8]*d,O=this.data[8]*u-this.data[4]*c-this.data[12]*f,M=this.data[0]*c-this.data[8]*g+this.data[12]*m,D=this.data[4]*g-this.data[0]*u-this.data[12]*p,N=this.data[0]*f-this.data[4]*m+this.data[8]*p,P=this.data[0]*v+this.data[1]*E+this.data[2]*R+this.data[3]*O;return 0!=P&&(this.data[0]=v/P,this.data[4]=E/P,this.data[8]=R/P,this.data[12]=O/P,this.data[1]=S/P,this.data[5]=x/P,this.data[9]=A/P,this.data[13]=M/P,this.data[2]=b/P,this.data[6]=B/P,this.data[10]=y/P,this.data[14]=D/P,this.data[3]=T/P,this.data[7]=C/P,this.data[11]=I/P,this.data[15]=N/P),this},e.prototype.scale=function(t,i,r){var n=e.fromScale(t,i,r);return this.mul(n)},e.prototype.rotate=function(t,i,r){var n=e.fromEulerAngle(t,i,r);return this.mul(n)},e.prototype.translate=function(t,i,r){var n=e.fromTranslate(t,i,r);return this.mul(n)},e.prototype.transform=function(t,e,i){return{x:t*this.data[0]+e*this.data[4]+i*this.data[8]+1*this.data[12],y:t*this.data[1]+e*this.data[5]+i*this.data[9]+1*this.data[13],z:t*this.data[2]+e*this.data[6]+i*this.data[10]+1*this.data[14]}},e.prototype.toEulerAngle=function(){var t=0,e=0,i=0,r=this.data[0],n=this.data[4],a=this.data[8],o=this.data[5],s=this.data[2],h=this.data[6],_=this.data[10],l=-h;e=l<=-1?-1.570796:l>=1?1.570796:Math.asin(l),Math.abs(l)>.9999?(i=0,t=Math.atan2(-a,r)):(t=Math.atan2(s,_),i=Math.atan2(n,o));var d=new Float32Array(3);return d[0]=e,d[1]=t,d[2]=i,d},e.fromScale=function(t,i,r){var n=new e;return n.data[0]=t,n.data[5]=i,n.data[10]=r,n},e.fromTranslate=function(t,i,r){var n=new e;return n.data[12]=t,n.data[13]=i,n.data[14]=r,n},e.fromEulerAngle=function(i,r,n){var a=-t(i),o=-t(r),s=-t(n),h=Math.cos(a),_=Math.sin(a),l=Math.cos(o),d=Math.sin(o),c=Math.cos(s),u=Math.sin(s);return new e(h*c+_*d*u,-h*u+_*d*c,_*l,0,u*l,c*l,-d,0,-_*c+h*d*u,u*_+h*d*c,h*l,0,0,0,0,1)},e.fromViewport=function(t,i,r,n,a,o){var s=new e;return s.data[0]=(i-t)/2,s.data[5]=(n-r)/2,s.data[10]=(o-a)/2,s.data[12]=(t+i)/2,s.data[13]=(n+r)/2,s.data[14]=(a+o)/2,s.data[15]=1,s},e.fromOrthographic=function(t,i,r,n,a,o){var s=new e;return s.data[0]=2/(i-t),s.data[5]=2/(n-r),s.data[10]=2/(a-o),s.data[12]=(t+i)/(t-i),s.data[13]=(n+r)/(r-n),s.data[14]=(a+o)/(a-o),s.data[15]=1,s},e}()}}();t.JSMatrix=i.Matrix}}(BK),function(t,e){"object"==typeof t&&(t.JSTransform=function(){return function(){function t(e){if(void 0==e)this.transform=new Float32Array(19),this.transform[2]=1,this.transform[3]=1,this.transform[4]=1,this._localAnchorOrPivot=void 0,this._parentAnchorOrPivot=void 0,this._needUpdate=!0;else{if(e instanceof t!=1)throw new Error("BK.Transform.constructor!paramater error");this.transform=new Float32Array(19),this._localAnchorOrPivot=e._localAnchorOrPivot,this._parentAnchorOrPivot=e._parentAnchorOrPivot,this._needUpdate=e._needUpdate;for(var i=0;i<19;i++)this.transform[i]=e.transform[i]}this.matrix={get:function(){return null},set:function(t,e,i,r,n,a){this._needUpdate=!0,this.transform[2]=t,this.transform[3]=r,this.transform[4]=1,this.transform[5]=i,this.transform[6]=e,this.transform[7]=0,this.transform[8]=n,this.transform[9]=a,this.transform[10]=0}}}return Object.defineProperty(t.prototype,"needUpdate",{get:function(){return this._needUpdate},set:function(t){this._needUpdate=t},enumerable:!0,configurable:!0}),t.prototype.getNeedUpdate=function(){return this._needUpdate},t.prototype.setNeedUpdate=function(t){this._needUpdate=t},Object.defineProperty(t.prototype,"scale",{get:function(){return{x:this.transform[2],y:this.transform[3],z:this.transform[4]}},set:function(t){this.transform[2]==t.x&&this.transform[3]==t.y&&this.transform[4]==t.z||(this._needUpdate=!0,this.transform[2]=void 0==t.x?1:t.x,this.transform[3]=void 0==t.y?1:t.y,this.transform[4]=void 0==t.z?1:t.z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return{x:this.transform[5],y:this.transform[6],z:this.transform[7]}},set:function(t){this.transform[5]==t.x&&this.transform[6]==t.y&&this.transform[7]==t.z||(this._needUpdate=!0,this.transform[5]=void 0==t.x?0:t.x,this.transform[6]=void 0==t.y?0:t.y,this.transform[7]=void 0==t.z?0:t.z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return{x:this.transform[8],y:this.transform[9],z:this.transform[10]}},set:function(t){this.transform[8]==t.x&&this.transform[9]==t.y&&this.transform[10]==t.z||(this._needUpdate=!0,this.transform[8]=void 0==t.x?0:t.x,this.transform[9]=void 0==t.y?0:t.y,this.transform[10]=void 0==t.z?0:t.z)},enumerable:!0,configurable:!0}),t.prototype.getPosition=function(){return{x:this.transform[8],y:this.transform[9],z:this.transform[10]}},t.prototype.setPosition=function(t,e,i){this.transform[8]==t&&this.transform[9]==e&&this.transform[10]==i||(this._needUpdate=!0,this.transform[8]=void 0==t?0:t,this.transform[9]=void 0==e?0:e,this.transform[10]=void 0==i?0:i)},Object.defineProperty(t.prototype,"localPivot",{get:function(){if(void 0!=this._localAnchorOrPivot&&0!=this._localAnchorOrPivot)throw new Error("BK.Transform.localPivot!current mode is localAnchor!!");return this._localAnchorOrPivot=0,{x:this.transform[11],y:this.transform[12]}},set:function(t){0==this._localAnchorOrPivot&&this.transform[11]==t.x&&this.transform[12]==t.y||(this._needUpdate=!0,this._localAnchorOrPivot=0,this.transform[11]=void 0==t.x?0:t.x,this.transform[12]=void 0==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localAnchor",{get:function(){if(void 0!=this._localAnchorOrPivot&&1!=this._localAnchorOrPivot)throw new Error("BK.Transform.localAnchor!current mode is localPivot!!");return this._localAnchorOrPivot=1,{x:this.transform[13],y:this.transform[14]}},set:function(t){1==this._localAnchorOrPivot&&this.transform[13]==t.x&&this.transform[14]==t.y||(this._needUpdate=!0,this._localAnchorOrPivot=1,this.transform[13]=void 0==t.x?0:t.x,this.transform[14]=void 0==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pivotParent",{get:function(){if(void 0!=this._parentAnchorOrPivot&&0!=this._parentAnchorOrPivot)throw new Error("BK.Transform.pivotParent!current mode is anchorParent!!");return this._parentAnchorOrPivot=0,{x:this.transform[15],y:this.transform[16]}},set:function(t){0==this._parentAnchorOrPivot&&this.transform[15]==t.x&&this.transform[16]==t.y||(this._needUpdate=!0,this._parentAnchorOrPivot=0,this.transform[15]=void 0==t.x?0:t.x,this.transform[16]=void 0==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"anchorParent",{get:function(){if(void 0!=this._parentAnchorOrPivot&&1!=this._parentAnchorOrPivot)throw new Error("BK.Transform.anchorParent!current mode is pivotParent!!");return this._parentAnchorOrPivot=1,{x:this.transform[17],y:this.transform[18]}},set:function(t){1==this._parentAnchorOrPivot&&this.transform[17]==t.x&&this.transform[18]==t.y||(this._needUpdate=!0,this._parentAnchorOrPivot=1,this.transform[17]=void 0==t.x?0:t.x,this.transform[18]=void 0==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentSize",{get:function(){return{width:this.transform[0],height:this.transform[1]}},set:function(t){this.transform[0]==t.width&&this.transform[1]==t.height||(this._needUpdate=!0,this.transform[0]=void 0==t.width?0:t.width,this.transform[1]=void 0==t.height?0:t.height)},enumerable:!0,configurable:!0}),t.prototype.getContentSize=function(){return{width:this.transform[0],height:this.transform[1]}},t.prototype.setContentSize=function(t,e){this.transform[0]==t&&this.transform[1]==e||(this._needUpdate=!0,this.transform[0]=void 0==t?0:t,this.transform[1]=void 0==e?0:e)},t.prototype.update=function(t,e){return 1==this._needUpdate&&(1==this._localAnchorOrPivot&&(this.transform[11]=this.transform[13]*this.transform[0],this.transform[12]=this.transform[14]*this.transform[1]),1==this._parentAnchorOrPivot&&(this.transform[15]=this.transform[17]*t,this.transform[16]=this.transform[18]*e),this._needUpdate=!1),this.transform},t}()}())}(BK);var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();!function(t,e){if("object"==typeof t){var i=function(){var t=function(){function t(){this.getTypeSize=function(t){return this._gl.BYTE==t?1:this._gl.UNSIGNED_BYTE==t?1:this._gl.SHORT==t?2:this._gl.UNSIGNED_SHORT==t?2:this._gl.INT==t?4:this._gl.UNSIGNED_INT==t?4:this._gl.FLOAT==t?4:void 0},this._ibo=0,this._vbo=0,this._program=0,this._hasLoadShader=!1,this._gl=bkWebGLGetInstance()}return t.__hookGlCommit=function(){var t=bkWebGLGetInstance();BK.GLRenderContext.__updataCallback(t),t.oldGlCommit()},t.hookGLCommit=function(t){this.__updataCallback=t,this.__gl=bkWebGLGetInstance(),this.__oldGlCommit=this.__gl.glCommit,this.__gl.glCommit=this.__hookGlCommit,this.__gl.oldGlCommit=this.__oldGlCommit,this.__hookGlCommit.bind(this.__gl)},t.exit=function(){this.__gl=bkWebGLGetInstance(),this.__oldGlCommit&&(this.__gl.glCommit=this.__oldGlCommit)},Object.defineProperty(t.prototype,"gl",{get:function(){return this._gl},enumerable:!0,configurable:!0}),t.prototype.__loadShader=function(t,e){var i,r=t||"uniform mat4 worldMat; uniform mat4 projMat; attribute vec2 pos; attribute vec2 inUVs; varying lowp vec2 outUVs; void main() { gl_Position = projMat * worldMat * vec4(pos, 0, 1); outUVs = inUVs; }",n=e||"varying lowp vec2 outUVs; uniform sampler2D uSampler; void main() { gl_FragColor = texture2D(uSampler, outUVs); }",a=this._gl.createShader(this._gl.VERTEX_SHADER);t&&(this._gl.enable(this._gl.BLEND),this._gl.blendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA)),0!=a&&(this._gl.shaderSource(a,r),this._gl.compileShader(a));var o=this._gl.createShader(this._gl.FRAGMENT_SHADER);0!=o&&(this._gl.shaderSource(o,n),this._gl.compileShader(o));var s=this._gl.createProgram();return this._gl.attachShader(s,a),this._gl.attachShader(s,o),this._gl.linkProgram(s),this._gl.deleteShader(a),this._gl.deleteShader(o),this._gl.getError()==this._gl.NO_ERROR?(this._program=s,this._gl.useProgram(this._program)):(i=this._gl.getProgramInfoLog(s),BK.Script.log(1,-1,"link program fail, err = "+i)),this.calculateProjection(),this._program},t.prototype.getProgram=function(){return this._program},t.prototype.__loadArrayBuffer=function(){var t=this._gl.getAttribLocation(this._program,"pos"),e=this._gl.getAttribLocation(this._program,"inUVs");0==this._vbo&&(this._vbo=this._gl.createBuffer()),this._gl.bindBuffer(this._gl.ARRAY_BUFFER,this._vbo),this._gl.enableVertexAttribArray(t),this._gl.enableVertexAttribArray(e),this._gl.glVertexAttribPointer(t,2,this._gl.FLOAT,!1,16,0,!0),this._gl.glVertexAttribPointer(e,2,this._gl.FLOAT,!1,16,8,!0),0==this._ibo&&(this._ibo=this._gl.createBuffer())},t.prototype.dispose=function(){0!=this._vbo&&this._gl.deleteBuffer(this._vbo),0!=this._ibo&&this._gl.deleteBuffer(this._ibo),0!=this._program&&this._gl.deleteProgram(this._program),this._gl=null},t.prototype.save=function(){this._prevVP=this._gl.glGetParameterInt(this._gl.VIEWPORT,4),this._prevVBO=this._gl.glGetParameterInt(this._gl.ARRAY_BUFFER_BINDING,1),this._prevIBO=this._gl.glGetParameterInt(this._gl.ELEMENT_ARRAY_BUFFER_BINDING,1),this._prevProgram=this._gl.glGetParameterInt(this._gl.CURRENT_PROGRAM,1),this._prevTextureID=this._gl.glGetParameterInt(this._gl.TEXTURE_BINDING_2D,1),this._prevTextureUnit=this._gl.glGetParameterInt(this._gl.ACTIVE_TEXTURE,1),this._prevFrameBuffer=this._gl.glGetParameterInt(this._gl.FRAMEBUFFER_BINDING,1),this._prevRenderBuffer=this._gl.glGetParameterInt(this._gl.RENDERBUFFER_BINDING,1),this._activeAttribusInfo=[];for(var t=this._gl.glGetProgramParameter(this._prevProgram,gl.ACTIVE_ATTRIBUTES),e=0;e<t;++e){var i=this._gl.getActiveAttrib(this._prevProgram,e),r=i.name,n=this._gl.getAttribLocation(this._prevProgram,r),a=this._gl.getVertexAttrib(n,this._gl.VERTEX_ATTRIB_ARRAY_SIZE),o=this._gl.getVertexAttrib(n,this._gl.VERTEX_ATTRIB_ARRAY_TYPE),s=this._gl.getVertexAttrib(n,this._gl.VERTEX_ATTRIB_ARRAY_NORMALIZED),h=this._gl.getVertexAttrib(n,this._gl.VERTEX_ATTRIB_ARRAY_STRIDE),_=this._gl.getVertexAttribOffset(n,gl.VERTEX_ATTRIB_ARRAY_POINTER);if(i.name=r,i.index=n,i.size=a,i.type=o,i.normalized=s,i.stride=h,i.offset=_,void 0!==this._gl.recordVertexAttribPointer)for(var l=0;l<this._gl.recordVertexAttribPointer.length;l++){var d=this._gl.recordVertexAttribPointer[l];if(i.index==d.index&&i.type==d.type&&i.stride==d.stride&&i.offset==d.offset){i.index=d.index,i.size=d.size,i.type=d.type,i.normalized=d.normalized,i.stride=d.stride,i.offset=d.offset;break}}this.debugLog("save name:"+i.name+" index:"+i.index+" size:"+i.size+" type:"+i.type+" normalized:"+i.normalized+" stride:"+i.stride+" offset:"+i.offset),this._activeAttribusInfo.push(i)}},t.prototype.restore=function(){if(this._gl.viewport(this._prevVP[0],this._prevVP[1],this._prevVP[2],this._prevVP[3]),this._gl.useProgram(this._prevProgram),this._gl.bindBuffer(this._gl.ARRAY_BUFFER,this._prevVBO),this._activeAttribusInfo.length>0){this._activeAttribusInfo[0].stride;for(var t=0;t<this._activeAttribusInfo.length;t++){var e=this._activeAttribusInfo[t],i=(e.name,e.index),r=e.size,n=e.type,a=e.normalized,o=e.offset,s=e.stride,h=0!=a;this.debugLog("restore name:"+e.name+" index:"+i+" size:"+r+" type:"+n+" normalized:"+a+" stride:"+s+" offset:"+o),this._gl.vertexAttribPointer(i,r,n,h,s,o,!0)}}this._activeAttribusInfo=[],this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,this._prevIBO),this._gl.activeTexture(this._prevTextureUnit),this._gl.bindTexture(this._gl.TEXTURE_2D,this._prevTextureID),this._gl.glBindFramebuffer(this._gl.FRAMEBUFFER,this._prevFrameBuffer),this._gl.glBindRenderbuffer(this._gl.RENDERBUFFER,this._prevRenderBuffer)},t.prototype.setViewport=function(t,e,i,r){this._gl.viewport(t,e,i,r)},t.prototype.setProjection=function(t){this._projMat=t},t.prototype.calculateProjection=function(){var t=this._projMat.data;this._gl.useProgram(this._program);var e=this._gl.getUniformLocation(this._program,"projMat");this._gl.uniformMatrix4fv(e,!1,t);var i=this._gl.getUniformLocation(this._program,"uSampler");this._gl.uniform1i(i,0);this._gl.getError()},t.prototype.debugLog=function(t){},t.prototype.getProjection=function(){return this._projMat},t.prototype.drawMesh=function(t,e,i,r,n){this._program=n,this._gl.useProgram(this._program),this.__loadArrayBuffer();var a=this._gl.getUniformLocation(this._program,"worldMat");this._gl.uniformMatrix4fv(a,!1,i.data),this._gl.activeTexture(this._gl.TEXTURE0),this._gl.bindTexture(this._gl.TEXTURE_2D,r),this._gl.bindBuffer(this._gl.ARRAY_BUFFER,this._vbo),this._gl.bufferData(this._gl.ARRAY_BUFFER,t,this._gl.STATIC_DRAW),this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,this._ibo),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,e,this._gl.STATIC_DRAW),this._gl.drawElements(this._gl.TRIANGLES,e.length,this._gl.UNSIGNED_SHORT,0)},t}();return{GLRenderNode:function(){function t(t,e){this._context=t,this._parent=null,this._childrens=new Array,this._textureID=0,this._localMatrix=new BK.JSMatrix,this._worldMatrix=new BK.JSMatrix,this._localTransform=new BK.JSTransform,this._zOrder=0,this._needSort=!1,this._needUpdate=!0,this._needUpdateWorldMatrix=!0,this.canUserInteract=!1,this.hidden=!1,this._hasDispose=!1,this.program=void 0,this._vs=e&&e.vs?e.vs:null,this._fs=e&&e.fs?e.fs:null}return Object.defineProperty(t.prototype,"path",{set:function(t){this._path!=t&&(this._path=t,0!=this._textureID&&(this._context.gl.deleteTexture(this._textureID),this._textureID=0))},enumerable:!0,configurable:!0}),t.prototype.setUrlPath=function(t,e){new BK.HttpUtil(t).requestAsync(function(i,r){if(1!=this._hasDispose){if(200==r){var n="GameSandBox://ad/"+t;BK.FileUtil.writeBufferToFile(n,i),this.path=n}else BK.Script.log(1,1,"Fetch advertisement Sent image failed.");e&&e(this,r)}else BK.Script.log(1,1,"node hasn been disposed.response ignore")}.bind(this))},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(t){this._parent=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zOrder",{get:function(){return this._zOrder},set:function(t){this._zOrder!=t&&(this._needSort=!0,this._zOrder=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this._localTransform.scale},set:function(t){var e=this._localTransform.scale;e.x==t.x&&e.y==t.y&&e.z==t.z||(this._needUpdate=!0,this._localTransform.scale=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._localTransform.rotation},set:function(t){var e=this._localTransform.rotation;e.x==t.x&&e.y==t.y&&e.z==t.z||(this._localTransform.rotation=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._localTransform.position},set:function(t){var e=this._localTransform.position;e.x==t.x&&e.y==t.y&&e.z==t.z||(this._localTransform.position=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentSize",{get:function(){return this._localTransform.getContentSize()},set:function(t){var e=this._localTransform.contentSize;e.width==t.width&&e.height==t.height||(this._needUpdate=!0,this._localTransform.contentSize=t)},enumerable:!0,configurable:!0}),t.prototype.getContentSize=function(){return this._localTransform.getContentSize()},t.prototype.setContentSize=function(t,e){this._localTransform.setContentSize(t,e)},Object.defineProperty(t.prototype,"localPivot",{get:function(){return this._localTransform.localPivot},set:function(t){var e=this._localTransform.localPivot;e.x==t.x&&e.y==t.y||(this._localTransform.localPivot=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localAnchor",{get:function(){return this._localTransform.localAnchor},set:function(t){var e=this._localTransform.localAnchor;e.x==t.x&&e.y==t.y||(this._localTransform.localAnchor=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pivotParent",{get:function(){return this._localTransform.pivotParent},set:function(t){var e=this._localTransform.pivotParent;e.x==t.x&&e.y==t.y||(this._localTransform.pivotParent=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"anchorParent",{get:function(){return this._localTransform.anchorParent},set:function(t){var e=this._localTransform.anchorParent;e.x==t.x&&e.y==t.y||(this._localTransform.anchorParent=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"worldMatrix",{get:function(){if(0==this.__needUpdateTransform())return this._worldMatrix.clone();var t=this.matrixFromLocal(),e=null!=this._parent?this._parent.worldMatrix:new BK.JSMatrix;return this.__updateWorldMatrix(e.mul(t)),this._worldMatrix.clone()},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){if(this.children)for(var t=0;t<this.children.length;t++)this.children[t].dispose();this._context.gl.deleteTexture(this._textureID),this._hasDispose=!0},t.prototype.addChild=function(t){for(var e=0;e<this._childrens.length;e++)if(this._childrens[e]==t||null!=t.parent)return BK.Script.log(0,0,"BK.Node.addChild!node has been in node tree"),!1;return t.parent=this,this._needSort=!0,this._childrens.push(t),!0},Object.defineProperty(t.prototype,"children",{get:function(){return this._childrens},enumerable:!0,configurable:!0}),t.prototype.__needUpdateTransform=function(){return 1==this._needUpdateWorldMatrix||1==this._localTransform.getNeedUpdate()||null!=this._parent&&(this._needUpdateWorldMatrix=this._parent.__needUpdateTransform(),this._needUpdateWorldMatrix)},t.prototype.__updateWorldMatrix=function(t){this._worldMatrix=t,this._needUpdateWorldMatrix=!1,this._childrens.forEach(function(t){t._needUpdateWorldMatrix=!0})},t.prototype.matrixFromLocal=function(){if(0==this._localTransform.getNeedUpdate())return this._localMatrix.clone();var t;t=null!=this._parent?this._localTransform.update(this._parent._localTransform.transform[0],this._parent._localTransform.transform[1]):this._localTransform.update(0,0);var e=new BK.JSMatrix;e.translate(t[8],t[9],t[10]),e.rotate(t[5],t[6],t[7]),e.scale(t[2],t[3],t[4]);var i=new BK.JSMatrix;if(i.data[12]=-t[11],i.data[13]=-t[12],this._localMatrix=e.mul(i),null!=this._parent){var r=new BK.JSMatrix;r.data[12]=t[15],r.data[13]=t[16],this._localMatrix=r.mul(e)}return this._localMatrix.clone()},t.prototype.loadTexture=function(){if(0==this._textureID){if(this._path){var t=BK.Image.loadImage(this._path);if(!t)return 0;var e=this._context.gl;this._textureID=e.createTexture(),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._textureID),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.glTexParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.glTexParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t)}return 1}return this._textureID},t.prototype.render=function(){if(1!=this.hidden){1==this._needSort&&(this._needSort=!1,this._childrens.sort(function(t,e){return t._zOrder<e._zOrder?1:0}));var t=this._localTransform.transform[0],e=this._localTransform.transform[1],i=new Uint16Array([0,1,2,0,2,3]),r=new Float32Array([0,0,0,1,t,0,1,1,t,e,1,0,0,e,0,0]),n=this.loadTexture();0!=n&&(this.program||(this.program=this._context.__loadShader(this._vs,this._fs)),this._context.drawMesh(r,i,this.worldMatrix,n,this.program));for(var a=0;a<this._childrens.length;a++)this._childrens[a].render()}},t.prototype.__log=function(t){BK.Script.log(1,1,"GLRenderNode:"+t)},t.prototype.hittest=function(t){this._context.getProjection();var e=this.worldMatrix,i={x:0,y:0},r={x:i.x+this.contentSize.width,y:i.y+this.contentSize.height},n=e.mulPoint(i),a=e.mulPoint(r);return t.x>=n.x&&t.x<=a.x&&t.y>=n.y&&t.y<=a.y},t}(),GLRenderContext:t}}();t.GLRenderNode=i.GLRenderNode,t.GLRenderContext=i.GLRenderContext}}(BK),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.GLRenderButton=e())}(BK,function(){return function(t){function e(e,i,r){var n=t.call(this,e)||this;return n.updateTexture=function(t){},n.__nativeObj=new BK.GLRenderNode(e),n.contentSize={width:i,height:r},n.isCancelClick=void 0,n.touchStatus=0,n.canUserInteract=!0,n.enable=!0,n.canClick=!0,n.addTouchListener(),n}return __extends(e,t),e.prototype.addTouchListener=function(){"undefined"!=typeof UIEventHandler?(UIEventHandler.addNodeEvent(this,1,function(t,e,i,r){t.isCancelClick=!1,t.enable?t.changeStatus(1):t.changeStatus(2)}.bind(this)),UIEventHandler.addNodeEvent(this,2,function(t,e,i,r){var n={x:i,y:r};0==t.hittest(n)&&(t.isCancelClick=!0)}.bind(this)),UIEventHandler.addNodeEvent(this,3,function(t,e,i,r){t.enable?t.changeStatus(0):t.changeStatus(2),0==t.isCancelClick&&t.touchInsideCallback&&1==this.canClick&&t.touchInsideCallback(t)}.bind(this))):BK.Script.log(1,1,"UIEventHandler is undefined")},e.prototype.dispose=function(){UIEventHandler.removeNodeEvent(this,1),UIEventHandler.removeNodeEvent(this,2),UIEventHandler.removeNodeEvent(this,3),t.prototype.dispose.call(this)},e.prototype.changeStatus=function(t){this.touchStatus=t,this.updateTexture(t)},e.prototype.setTouchInsideCallback=function(t){this.touchInsideCallback=t},e}(BK.GLRenderNode)}),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PlusTips=e())}(BK,function(){return function(){function t(t){if(this.useWebGl=!0,1==arguments.length&&(this.useWebGl=t),this.screenWidth=BK.Director.screenPixelSize.width,this.screenHeight=BK.Director.screenPixelSize.height,this.screenMode=0,this.createNum=0,this.node=new Array(3),this.maskUrl="https://i.hudongcdn.com/plusRes/mask.png",this.tipsUrl_v="https://i.hudongcdn.com/plusRes/plusTips_v.png",this.tipsUrl_h="https://i.hudongcdn.com/plusRes/plusTips_h.png",this.sureBtnUrl="https://i.hudongcdn.com/plusRes/button.png",this.screenWidth>this.screenHeight){this.screenMode=1,this.scale_x=this.screenWidth/1334,this.scale_y=this.screenHeight/750;e=this.scale_x>this.scale_y?this.scale_y:this.scale_x;this.tipsWidth=700*e/BK.Director.root.scale.x,this.tipsHeight=524*e/BK.Director.root.scale.y,this.tips_x=(this.screenWidth/BK.Director.root.scale.x-this.tipsWidth)/2,this.tips_y=162*this.scale_y/BK.Director.root.scale.y,this.buttonWidth=260*e/BK.Director.root.scale.x,this.buttonHeight=81*e/BK.Director.root.scale.y,this.button_x=(this.screenWidth/BK.Director.root.scale.x-this.buttonWidth)/2,this.button_y=41*this.scale_x/BK.Director.root.scale.y}else{this.scale_x=this.screenWidth/750,this.scale_y=this.screenHeight/1334;var e=this.scale_x>this.scale_y?this.scale_y:this.scale_x;this.tipsWidth=452*e/BK.Director.root.scale.x,this.tipsHeight=820*e/BK.Director.root.scale.y,this.tips_x=(this.screenWidth/BK.Director.root.scale.x-this.tipsWidth)/2,this.tips_y=362*this.scale_y/BK.Director.root.scale.y,this.buttonWidth=260*e/BK.Director.root.scale.x,this.buttonHeight=79*e/BK.Director.root.scale.y,this.button_x=(this.screenWidth/BK.Director.root.scale.x-this.buttonWidth)/2,this.button_y=197*this.scale_y/BK.Director.root.scale.y}this.tipsUrl=1==this.screenMode?this.tipsUrl_h:this.tipsUrl_v,this.screenWidth=this.screenWidth/BK.Director.root.scale.x,this.screenHeight=this.screenHeight/BK.Director.root.scale.y}return t.prototype.showTips=function(t){this.useWebGl?this.showTipsWebGL(t):this.showTipsBK(t)},t.prototype.showTipsWebGL=function(t){this.context=new BK.GLRenderContext;var e=BK.JSMatrix.fromOrthographic(0,BK.Director.screenPixelSize.width,0,BK.Director.screenPixelSize.height,-1,1);this.context.setProjection(e),this.node[0]=new BK.GLRenderNode(this.context,{vs:"uniform mat4 worldMat; uniform mat4 projMat; attribute vec2 pos; attribute vec2 inUVs; varying lowp vec2 outUVs; void main() { gl_Position = projMat * worldMat * vec4(pos, 0, 1); outUVs = inUVs; }",fs:"precision mediump float; uniform sampler2D uSampler; void main() { gl_FragColor = texture2D(uSampler,vec2(0,0)); gl_FragColor.a = 0.8; }"}),this.node[0].setUrlPath(this.maskUrl),this.node[0].contentSize={width:this.screenWidth,height:this.screenHeight},this.node[0].position={x:0,y:0},this.node[0].canUserInteract=!0,this.node[1]=new BK.GLRenderNode(this.context),this.node[1].setUrlPath(this.tipsUrl),this.node[1].path=1==this.screenMode?"GameRes://resource/plusTips_h.png":"GameRes://resource/plusTips_v.png",this.node[1].contentSize={width:this.tipsWidth,height:this.tipsHeight},this.node[1].position={x:this.tips_x,y:this.tips_y},this.node[0].addChild(this.node[1]),this.node[2]=new BK.GLRenderButton(this.context,this.buttonWidth,this.buttonHeight),this.node[2].setUrlPath(this.sureBtnUrl),this.node[2].position={x:this.button_x,y:this.button_y},this.node[2].canUserInteract=!0,this.node[2].setTouchInsideCallback(t),this.node[0].addChild(this.node[2]),UIEventHandler&&UIEventHandler.setRootNode(this.node[0]);var i=this;BK.GLRenderContext.hookGLCommit(function(){i.context.save(),gl.viewport(0,0,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height),i.context.gl.useProgram(i.context.getProgram()),i.node[0].render(),i.context.restore()})},t.prototype.showTipsBK=function(t){this.callback=t;var e={x:0,y:0},i={r:0,g:0,b:0,a:.8};this.bkCreateSprite(0,this.maskUrl,this.screenWidth,this.screenHeight,e,i);var r={x:this.tips_x,y:this.tips_y},n={r:1,g:1,b:1,a:1.25};this.bkCreateSprite(1,this.tipsUrl,this.tipsWidth,this.tipsHeight,r,n);var a={x:this.button_x,y:this.button_y},o={r:1,g:1,b:1,a:1.25};this.bkCreateSprite(2,this.sureBtnUrl,this.buttonWidth,this.buttonHeight,a,o),BK.Script.getTouchModeAll=1,BK.Director.ticker.add(function(t,e){BK.TouchEvent.getAllTouchEvent();BK.TouchEvent.updateTouchStatus()}.bind(this))},t.prototype.bkCreateSprite=function(t,e,i,r,n,a){var o=this;new BK.HttpUtil(e).requestAsync(function(s,h){if(200==h){var _=e.split("/"),l=_[_.length-1],d="GameSandBox://plusRes/"+l;if(BK.Script.log(0,0," picName = "+l+" path == "+d),BK.FileUtil.writeBufferToFile(d,s),t<2){var c=new BK.Texture(d);o.node[t]=new BK.Sprite(i,r,c,0,1,1,1)}else o.node[t]=new BK.Button(i,r,d,o.callback);o.node[t].zOrder=0,o.node[t].position=n,o.node[t].canUserInteract=!0,o.node[t].color=a,3==++o.createNum&&(BK.Director.root.addChild(o.node[0]),o.node[0].addChild(o.node[1]),o.node[0].addChild(o.node[2]))}else o.callback()})},t}()}),function(t,e){if("object"==typeof t){var i=function(){var t="attribute vec3 Position; attribute vec2 TexCoordIn; attribute vec4 SourceColor; uniform mat4 ModelView; uniform mat4 Projection; varying vec4 DestColor; varying vec2 TexCoordOut; void main() { mat4 gWVP = Projection * ModelView; gl_Position = gWVP * vec4(Position, 1); DestColor = SourceColor; TexCoordOut = TexCoordIn; }",e="varying lowp vec2 TexCoordOut; uniform int formatYUV; uniform sampler2D samplerY; uniform sampler2D samplerU; uniform sampler2D samplerV; uniform sampler2D samplerUV; const lowp vec3 defyuv = vec3(-0.0/255.0, -128.0/255.0, -128.0/255.0); void main(void) { lowp vec3 yuv = vec3(0.0); if (formatYUV == 0) { yuv.x = texture2D(samplerY, TexCoordOut).r; yuv.y = texture2D(samplerU, TexCoordOut).r; yuv.z = texture2D(samplerV, TexCoordOut).r; yuv += defyuv; } else if (formatYUV == 1) { yuv.x = texture2D(samplerY, TexCoordOut).r; yuv.y = texture2D(samplerUV, TexCoordOut).a; yuv.z = texture2D(samplerUV, TexCoordOut).r; yuv += defyuv; } else if (formatYUV == 3) { yuv.x = texture2D(samplerY, TexCoordOut).r; yuv.y = texture2D(samplerUV, TexCoordOut).r; yuv.z = texture2D(samplerUV, TexCoordOut).a; yuv += defyuv; } lowp vec3 rgb = mat3(1.0, 1.0, 1.0, 0.0, -.34414, 1.772, 1.402, -.71414, 0.0) * yuv; gl_FragColor = vec4(rgb, 1.0); }",i=(function(){function t(){}}(),function(){function t(){}}(),function(){function t(){this.videoViews=new Array,void 0!==BK.Director.setQAVDelegate&&BK.Director.setQAVDelegate(this)}return t.prototype.addView=function(t){var e=this.videoViews.filter(function(e){return t==e});return e.length||this.videoViews.push(t),0==e.length},t.prototype.delView=function(t){var e=this.videoViews.length;return this.videoViews=this.videoViews.filter(function(e){return t!=e}),e!=this.videoViews.length},t.prototype.onRemoveVideoPreview=function(t){this.videoViews.forEach(function(e){e.identifier==t.identifier&&e.render(t)})},t.prototype.onLocalVideoPreview=function(t){this.videoViews.forEach(function(e){if(e.identifier==t.identifier){var i=t,r=e;r.onPrePreview&&(i=r.onPrePreview.call(r,t)),e.render(i)}})},t.prototype.onLocalVideoPreProcess=function(t){this.videoViews.forEach(function(e){if(e.identifier==t.identifier){var i=e;i.onPreProcess&&i.onPreProcess.call(i,t)}})},t.Instance=new t,t}()),r=function(){function r(t,e,r,n,a,o,s){this.identifier=t,this.__nativeObj=new BK.Sprite(e,r,null,0,0,1,1),this._innerBindMethods4NativeObj(),null!=n&&void 0!=n||(n=!0),o&&(this.position=o),a?a.addChild(this):BK.Director.root.addChild(this),s&&(this.zOrder=s),1==n&&i.Instance.addView(this)}return r.prototype._innerBindMethods4NativeObj=function(t){var e=this;Object.getOwnPropertyNames(this.__nativeObj).forEach(function(i,r,n){var a=i;t&&-1!=t.indexOf(a)||Object.defineProperty(e,a,{get:function(){return this.__nativeObj[a]},set:function(t){this.__nativeObj[a]=t},enumerable:!0,configurable:!0})})},r.prototype.addChild=function(t){this.__nativeObj&&this.__nativeObj.addChild(t)},r.prototype._restartRenderTimer=function(){this.__renderTimeoutCallback&&this.__renderTimeoutThreshold>0&&(BK.Director.ticker.removeTimeout(this),BK.Director.ticker.setTimeout(function(t,e,i){this.__renderTimeoutCallback&&this.__renderTimeoutCallback.call(this)},this.__renderTimeoutThreshold,this))},r.prototype._innerUseRGBA=function(t,e){if(this.__bitmap){var i=this.__bitmap.size;i.width==t&&i.height==e||(BK.Script.log(0,0,"BK.QAVView.useRGBA!size change, ow = "+i.width+", oh = "+i.height+", nw = "+t+", nh = "+e),this.__bitmap=BK.Texture.createBitmapTexture(t,e),this.__nativeObj.setTexture(this.__bitmap))}else this.__bitmap=BK.Texture.createBitmapTexture(t,e),this.__nativeObj.setTexture(this.__bitmap)},r.prototype._innerUseYUVMaterial_I420=function(i,r){if(this.__yuvMaterial||(this.__yuvMaterial=new BK.Render.Material(t,e,!0),this.__nativeObj.attachComponent(this.__yuvMaterial),this.__yuvMaterial.uniforms.samplerY=0,this.__yuvMaterial.uniforms.samplerU=1,this.__yuvMaterial.uniforms.samplerV=2,this.__yuvMaterial.uniforms.samplerUV=3),this.__bitmapY){var n=this.__bitmapY.size;n.width==i&&n.height==r||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_I420!Y size change, ow = "+n.width+", oh = "+n.height+", nw = "+i+", nh = "+r),this.__bitmapY=BK.Texture.createBitmapTexture(i,r,7),this.__yuvMaterial.setTexture(0,this.__bitmapY))}else this.__bitmapY=BK.Texture.createBitmapTexture(i,r,7),this.__yuvMaterial.setTexture(0,this.__bitmapY);if(this.__bitmapU){var a=this.__bitmapU.size;a.width==i/2&&a.height==r/2||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_I420!U size change, ow = "+a.width+", oh = "+a.height+", nw = "+i+", nh = "+r),this.__bitmapU=BK.Texture.createBitmapTexture(i/2,r/2,7),this.__yuvMaterial.setTexture(1,this.__bitmapU))}else this.__bitmapU=BK.Texture.createBitmapTexture(i/2,r/2,7),this.__yuvMaterial.setTexture(1,this.__bitmapU);if(this.__bitmapV){var o=this.__bitmapV.size;o.width==i/2&&o.height==r/2||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_I420!V size change, ow = "+o.width+", oh = "+o.height+", nw = "+i+", nh = "+r),this.__bitmapV=BK.Texture.createBitmapTexture(i/2,r/2,7),this.__yuvMaterial.setTexture(2,this.__bitmapV))}else this.__bitmapV=BK.Texture.createBitmapTexture(i/2,r/2,7),this.__yuvMaterial.setTexture(2,this.__bitmapV)},r.prototype._innerUseYUVMaterial_NVxx=function(i,r){if(this.__yuvMaterial||(this.__yuvMaterial=new BK.Render.Material(t,e,!0),this.__nativeObj.attachComponent(this.__yuvMaterial),this.__yuvMaterial.uniforms.samplerY=0,this.__yuvMaterial.uniforms.samplerU=1,this.__yuvMaterial.uniforms.samplerV=2,this.__yuvMaterial.uniforms.samplerUV=3),this.__bitmapY){var n=this.__bitmapY.size;n.width==i&&n.height==r||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_NVxx!Y size change, ow = "+n.width+", oh = "+n.height+", nw = "+i+", nh = "+r),this.__bitmapY=BK.Texture.createBitmapTexture(i,r,7),this.__yuvMaterial.setTexture(0,this.__bitmapY))}else this.__bitmapY=BK.Texture.createBitmapTexture(i,r,7),this.__yuvMaterial.setTexture(0,this.__bitmapY);if(this.__bitmapUV){var a=this.__bitmapUV.size;a.width==i/2&&a.height==r/2||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_NVxx!UV size change, ow = "+a.width+", oh = "+a.height+", nw = "+i+", nh = "+r),this.__bitmapUV=BK.Texture.createBitmapTexture(i/2,r/2,2),this.__yuvMaterial.setTexture(3,this.__bitmapUV))}else this.__bitmapUV=BK.Texture.createBitmapTexture(i/2,r/2,2),this.__yuvMaterial.setTexture(3,this.__bitmapUV)},r.prototype.render=function(t){var e=t.frameDesc.width,i=t.frameDesc.height;if(this.__nativeObj){switch(this._restartRenderTimer(),t.frameDesc.rotate){case 0:this.cameraPos&&1==this.cameraPos?this.__nativeObj.setUVFlip(1,0):this.__nativeObj.setUVFlip(1,1);break;case 1:case 2:this.cameraPos&&1==this.cameraPos?(this.__nativeObj.setUVFlip(0,1),this.__nativeObj.setUVRotate(1)):(this.__nativeObj.setUVFlip(0,0),this.__nativeObj.setUVRotate(1));break;case 3:this.cameraPos&&1==this.cameraPos?(this.__nativeObj.setUVFlip(0,1),this.__nativeObj.setUVRotate(3)):(this.__nativeObj.setUVFlip(0,0),this.__nativeObj.setUVRotate(3))}switch(t.frameDesc.colorFormat){case 10:this._innerUseRGBA(e,i),this.__bitmap.uploadSubData(0,0,e,i,t.extraData.buffer);break;case 0:this._innerUseYUVMaterial_I420(e,i),this.__yuvMaterial.uniforms.formatYUV=t.frameDesc.colorFormat,this.__bitmapY.uploadSubData(0,0,e,i,t.extraData.Y),this.__bitmapU.uploadSubData(0,0,e/2,i/2,t.extraData.U),this.__bitmapV.uploadSubData(0,0,e/2,i/2,t.extraData.V);break;case 3:case 1:this._innerUseYUVMaterial_NVxx(e,i),this.__yuvMaterial.uniforms.formatYUV=t.frameDesc.colorFormat,this.__bitmapY.uploadSubData(0,0,e,i,t.extraData.Y),this.__bitmapUV.uploadSubData(0,0,e/2,i/2,t.extraData.UV);break;default:BK.Script.log(1,-1,"BK.QAVView.render!unknown format = "+t.frameDesc.colorFormat)}}},r.prototype.renderAsCache=function(t,e,i,r,n,a,o,s){switch(a){case 0:this._innerUseYUVMaterial_I420(t,e),this.__yuvMaterial.uniforms.formatYUV=a,this.__bitmapY.uploadSubData(0,0,t,e,s.Y),this.__bitmapU.uploadSubData(0,0,t/2,e/2,s.U),this.__bitmapV.uploadSubData(0,0,t/2,e/2,s.V);break;case 3:case 1:this._innerUseYUVMaterial_NVxx(t,e),this.__yuvMaterial.uniforms.formatYUV=a,this.__bitmapY.uploadSubData(0,0,t,e,s.Y),this.__bitmapUV.uploadSubData(0,0,t/2,e/2,s.UV);break;default:return BK.Script.log(1,-1,"BK.QAVView.renderAsCache!unknown format = "+a),null}if(this.__graphic||(this.__graphic=new BK.Graphics),this.__cacheTexture){var h=this.__cacheTexture.size;h.width==i&&h.height==r||(BK.Script.log(0,0,"BK.QAVView.renderAsCache!cache tex size change, ow = "+h.width+", oh = "+h.height+", nw = "+i+", nh = "+r),this.__cacheTexture=new BK.RenderTexture(i,r,o))}else this.__cacheTexture=new BK.RenderTexture(i,r,o);if(this.__cacheSprite){var _=this.__cacheSprite.size;_.width==i&&_.height==r||(this.__cacheSprite.size={width:i,height:r})}else this.__cacheSprite=new BK.Sprite(i,r,null,0,0,1,1),this.__cacheSprite.attachComponent(this.__yuvMaterial);switch(n){case 0:this.__cacheSprite.setUVFlip(1,0),this.__cacheSprite.setUVRotate(0);break;case 1:this.__cacheSprite.setUVFlip(1,0),this.__cacheSprite.setUVRotate(1);break;case 2:this.__cacheSprite.setUVFlip(0,1),this.__cacheSprite.setUVRotate(0);break;case 3:this.__cacheSprite.setUVFlip(1,0),this.__cacheSprite.setUVRotate(4)}var l=this;return this.__graphic.drawRenderTexture(this.__cacheTexture,function(){this.drawSprite(l.__cacheSprite)}),this.__cacheTexture.readPixels(0,0,i,r,o)},r.prototype.renderAsTexture=function(){var t=new BK.RenderTexture(this.__nativeObj.size.width,this.__nativeObj.size.height,6);return BK.Render.renderToTexture(this.__nativeObj,t),t},r.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},r.prototype.removeFromParent=function(){this.__nativeObj&&this.__nativeObj.removeFromParent()},r.prototype.setRenderTimeout=function(t,e){this.__renderTimeoutCallback=e,this.__renderTimeoutThreshold=t,this.__renderTimeoutThreshold>0&&this._restartRenderTimer()},r}(),n=function(){function t(){this.skipNum=-1}return t.prototype.start=function(t){function e(t,e,i){if(BK.Script.log(0,0,"BK.Camera.switchCameraEvent222!data = "+JSON.stringify(i)),0==t){BK.Script.log(0,0,"BK.Camera.switchCameraEvent!data = "+JSON.stringify(i));var r=this;BK.Director.ticker.removeTimeout(this),BK.Director.ticker.setTimeout(function(t,e,n){r.view.cameraPos=i.cameraPos,r=null},160,this)}}var n=t.identifier?t.identifier:"";if(t.width&&t.height){BK.Script.log(1,0,"BK.Camera!options = "+JSON.stringify(t)),this.options=t,this.identifier=n,this.view=new r(n,t.width,t.height,!1,t.parent,t.position),i.Instance.addView(this),this.options.needFaceTracker&&(this.detector=new BK.AI.FaceDetector(!0,!0));return BK.MQQ.SsoRequest.addListener("cs.audioRoom_camera_switch.local",this,e.bind(this)),this.isStart=!1,this}},t.prototype.configCamera=function(t){if(t&&(BK.Script.log(0,0,"configCamera"),BK.Script.log(0,0,"configCamera BK.Room ok1"),t.beauty&&(BK.Script.log(0,0,"configCamera BK.Room audioRoomSetBeauty1"),this.setBeauty(t.beauty)),t.cameraPos)){BK.Script.log(0,0,"configCamera BK.Room cameraPos");t.onSwitchCamera&&t.onSwitchCamera.bind(this);this.switchCamera(t.cameraPos,function(t,e,i){BK.Script.log(0,0,"configCamera BK.Room cameraPos errCode:"+t+" cmd:"+e+" data:"+i),this.options.onSwitchCamera&&this.options.onSwitchCamera(t,e,i)})}},t.prototype.switchCamera=function(t,e){var i={cameraPos:t},r="cs.audioRoom_cameraswitch.local";BK.MQQ.SsoRequest.addListener(r,this,e.bind(this)),BK.MQQ.SsoRequest.send(i,r)},t.prototype.setBeauty=function(t){var e={beauty:t};BK.MQQ.SsoRequest.send(e,"cs.audioRoom_set_beauty.local")},t.prototype.setSpeaker=function(t){var e={speaker:t};BK.MQQ.SsoRequest.send(e,"cs.audioRoom_set_speaker.local")},t.prototype.close=function(){},t.prototype._innerConvertRGBA=function(t){var e=this.options.scaleSample?this.options.scaleSample:1,i=t.frameDesc.width,r=t.frameDesc.height,n=function(t,e,i){var r={width:t,height:e};switch(i){case 1:case 3:r.width=e,r.height=t}return r}(t.frameDesc.width,t.frameDesc.height,t.frameDesc.rotate),a={};return a.frameDesc={},a.extraData={},a.frameDesc.width=n.width*e,a.frameDesc.height=n.height*e,a.frameDesc.rotate=0,a.frameDesc.colorFormat=10,a.frameDesc.videoSrcType=t.frameDesc.videoSrcType,a.extraData.buffer=this.view.renderAsCache(i,r,n.width*e,n.height*e,t.frameDesc.rotate,t.frameDesc.colorFormat,6,t.extraData),a},t.prototype.onPrePreview=function(t){if(this.options.onPrePreview){var e=t;if(this.detector){e=this._innerConvertRGBA(t);var i=this._innerExtractBitmap(e);(this.hasFace||-1==this.skipNum)&&(this.skipNum=0,e.faceFeatures=this.detector.detectForBitmapSync(i)),void 0==e.faceFeatures||e.faceFeatures.length<=0?(this.hasFace=!1,this.skipNum=this.skipNum+1,(this.skipNum>this.options.skipFaceTrackerNum||this.skipNum==this.options.skipFaceTrackerNum)&&(e.faceFeatures=this.detector.detectForBitmapSync(i),this.skipNum=0,e.faceFeatures&&(this.hasFace=!0))):this.hasFace=!0}this.options.onPrePreview.call(this,e)}return 0==this.isStart&&(this.configCamera(this.options),this.isStart=!0),t},t.prototype.onPreProcess=function(t){return this.options.onPreProcess?this.options.onPreProcess.call(this,t):t},t.prototype.render=function(t){this.view&&this.view.render(t)},t.prototype.renderAsTexture=function(){return this.view?this.view.renderAsTexture():null},t.prototype._innerExtractBitmap=function(t){var e={};switch(e.width=t.frameDesc.width,e.height=t.frameDesc.height,e.format=t.frameDesc.colorFormat,t.frameDesc.colorFormat){case 7:e.format=3;break;case 10:e.buffer=t.extraData.buffer,e.format=6;break;default:BK.Script.log(1,-1,"BK.QAVCamera.extractBitmap!unknown format = "+t.frameDesc.colorFormat)}switch(t.frameDesc.rotate){case 0:e.oreintation=0;break;case 1:e.oreintation=1;break;case 2:e.oreintation=5;break;case 3:e.oreintation=6}return e},t.Instance=new t,t}();return{QAVView:r,QAVCamera:new n}}();t.QAVView=i.QAVView,t.AVCamera=i.QAVCamera}}(BK),function(t,e){"object"==typeof t&&(BK.QQAVManager=function(){return new(function(){function t(){this._hasInitFlag=!1,this._hasSuccEnter=!1,this._iosHasInitFlag=!1,this._isFrontCamera=!1,this._hasStartQAVRoomFlag=!1,this._callbackQueue=[],BK.MQQ.SsoRequest.addListener("cs.audioRoom_disconnect.local",this,this.__handleRoomDisconnect.bind(this)),BK.MQQ.SsoRequest.addListener("cs.audioRoom_update_userinfo.local",this,this.__handleUserUpdate.bind(this))}return t.prototype.log=function(t){BK.Script.log(0,0,"QQAVManager:"+t)},t.prototype.errorLog=function(t){BK.Script.log(1,1,"QQAVManager Error:"+t)},t.prototype.setQAVCfg=function(t){this.qavCfg=t},t.prototype.setUpdateUserInfoCallback=function(t){var e="cs.audioRoom_update_userinfo.local";BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)},t.prototype.setEventCallbackConfig=function(t){this.eventCallbackConfig=t},t.prototype.initQAV=function(t,e){this.setQAVCfg(t),this.__startQAVRoom(e)},t.prototype.setMic=function(t,e){this.__enterQAVRoomIfNeed(function(i){if(0==i){var r={switch:t},n="cs.audioRoom_set_mic.local";BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,e),BK.MQQ.SsoRequest.send(r,n)}else this.errorLog("setMic failed!start qav room failed")}.bind(this))},t.prototype.setSpeaker=function(t,e){this.__enterQAVRoomIfNeed(function(i){if(0==i){var r={switch:t},n="cs.audioRoom_set_speaker.local";BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,e),BK.MQQ.SsoRequest.send(r,n)}else this.errorLog("setSpeaker failed!start qav room failed")}.bind(this))},t.prototype.switchCamera=function(t,e){this.__enterQAVRoomIfNeed(function(i){if(0==i){var r={cameraPos:t},n="cs.audioRoom_camera_switch.local";BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,function(i,r,n){0==i&&(this._isFrontCamera=0==t),e(i,r,n)}.bind(this)),BK.MQQ.SsoRequest.send(r,n)}else this.errorLog("switchCamera failed!start qav room failed")}.bind(this))},t.prototype.enableCamera=function(t,e){this.__enterQAVRoomIfNeed(function(i){if(0==i){var r={switch:t},n="cs.audioRoom_camera_enable.local";this._isFrontCamera=!0,BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,e),BK.MQQ.SsoRequest.send(r,n)}else this.errorLog("enableCamera failed!start qav room failed")}.bind(this))},t.prototype.setBeauty=function(t){this.__enterQAVRoomIfNeed(function(e){if(0==e){var i={beauty:t};BK.MQQ.SsoRequest.send(i,"cs.audioRoom_set_beauty.local")}else this.errorLog("setBeauty failed!start qav room failed")}.bind(this))},t.prototype.setLocalVideo=function(t){this.__enterQAVRoomIfNeed(function(e){if(0==e){var i={switch:t};BK.MQQ.SsoRequest.send(i,"cs.audioRoom_set_local_video.local")}else this.errorLog("setLocalVideo failed!start qav room failed")}.bind(this))},t.prototype.watchRemoteVideo=function(t){this.__enterQAVRoomIfNeed(function(e){if(0==e){this.log("watchRemoteVideo ok1");var i={openIdList:t};BK.MQQ.SsoRequest.send(i,"cs.audioRoom_watch_remote_video.local"),this.log("watchRemoteVideo ok2")}else this.errorLog("watchRemoteVideo failed!start qav room failed")}.bind(this))},t.prototype.setRemoteVideo=function(t){this.__enterQAVRoomIfNeed(function(e){if(0==e){var i={switch:t};BK.MQQ.SsoRequest.send(i,"cs.audioRoom_set_remote_video.local")}else this.errorLog("setMic failed!start qav room failed")}.bind(this))},t.prototype.exitRoom=function(t){this._hasInitFlag=!1,this.__exitQAVRoom(function(e,i,r){this.log("exit qav room errCode:"+e),t(e,i,r)}.bind(this))},t.prototype.getEndpointList=function(t){var e={},i="cs.audioRoom_get_endpointList.local";t&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,t)),BK.MQQ.SsoRequest.send(e,i)},t.prototype.isFrontCamera=function(){return this._isFrontCamera},t.prototype.getFluidCtrlCfg=function(t,e){var i="cs.audioRoom_get_fluid_ctrl_cfg.local";e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(t,i)},t.prototype.changeAudioCategory=function(t,e){var i="cs.audioRoom_change_audio_category.local",r={category:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(r,i)},t.prototype.changeQAVRole=function(t,e){var i="cs.audioRoom_change_qav_role.local",r={role:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(r,i)},t.prototype.__enterQAVRoomIfNeed=function(t){this._hasSuccEnter?t(0):(this.log("__enterQAVRoomIfNeed entering qav room."),this._callbackQueue.push(t),0==this._hasStartQAVRoomFlag&&(this._hasStartQAVRoomFlag=!0,this.__startQAVRoom(function(t,e,i){for(var r=0;r<this._callbackQueue.length;r++)(0,this._callbackQueue[r])(t);this._callbackQueue.splice(0,this._callbackQueue.length)}.bind(this))))},t.prototype.initQAVRoom=function(t,e){var i="cs.audioRoom_init.local";if("ios"==GameStatusInfo.platform&&1==this._iosHasInitFlag)return this.log("ios init once "),void e(0,i,this._initData);1!=this._hasInitFlag?(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){this.log("cmd:"+i+" errCode:"+t+" data:"+JSON.stringify(r)),0==t&&(this._hasInitFlag=!0,this._initData=r,"ios"==GameStatusInfo.platform&&(this._iosHasInitFlag=!0,this.log("_iosHasInitFlag"))),e(t,i,r)}.bind(this)),BK.MQQ.SsoRequest.send(t,i)):this.log("AVRoom has been init .can't init Room twice !!")},t.prototype.enterQAVRoom=function(t,e){var i=t.gameRoomId,r=t.avRoomId,n=t.avRoleName,a={avRoomId:r,gameRoomId:i,avRoleName:n,avKey:t.avKey};this.avRoomId=r,this.gameRoomId=i,this.avRoleName=n;var o="cs.audioRoom_enter.local";BK.MQQ.SsoRequest.removeListener(o,this),BK.MQQ.SsoRequest.addListener(o,this,function(t,i,r){this.log("cmd:"+i+" errCode:"+t+" data:"+JSON.stringify(r)),e(t,i,r)}.bind(this)),BK.MQQ.SsoRequest.send(a,o),BK.MQQ.SsoRequest.removeListener("cs.close_room.local",this),BK.MQQ.SsoRequest.addListener("cs.close_room.local",this,function(t,e,i){this.log("BK.QAVManager.closeGame!exitQAVRoom, avRoomId = "+this.avRoomId),this.__exitQAVRoom()}.bind(this)),BK.MQQ.SsoRequest.removeListener("cs.audioRoom_req_audio_session.local",this),BK.MQQ.SsoRequest.addListener("cs.audioRoom_req_audio_session.local",this,function(t,e,i){this.log("BK.QAVManager.reqAudioSession!result = "+JSON.stringify(i))}.bind(this))},t.prototype.__exitQAVRoom=function(t){var e={avRoomId:this.avRoomId},i="cs.audioRoom_exit.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,t),BK.MQQ.SsoRequest.send(e,i)},t.prototype.__checkGameStatusInfoParam=function(){return GameStatusInfo.avAppId?GameStatusInfo.avAccountType?GameStatusInfo.avRoomId?GameStatusInfo.roomId?{sdkAppId:GameStatusInfo.avAppId,accountType:GameStatusInfo.avAccountType,avRoomId:GameStatusInfo.avRoomId,gameRoomId:GameStatusInfo.roomId}:(this.log("GameStatusInfo.roomId is null"),null):(this.log("GameStatusInfo.avRoomId is null"),null):(this.log("GameStatusInfo.avAccountType is null"),null):(this.log("GameStatusInfo.avAppId is null"),null)},t.prototype.__addQAVCfg=function(t){if(this.qavCfg)for(var e in this.qavCfg)if(this.qavCfg.hasOwnProperty(e)){var i=this.qavCfg[e];t[e]=i}return t},t.prototype.__startQAVRoom=function(t){if(GameStatusInfo.devPlatform){var e={sdkAppId:1400035750,accountType:14181,avRoomId:122333,gameRoomId:54321,selfOpenId:GameStatusInfo.openId};e=this.__addQAVCfg(e),this.initAndEnterRoom(e,t)}else(e=this.__checkGameStatusInfoParam())?(e=this.__addQAVCfg(e),this.initAndEnterRoom(e,function(e,i,r){t(e,i,r)}.bind(this))):BK.QQ.addSSOJoinRoomCallBack(function(e,i,r){r.gameRoomId&&r.avRoomId&&r.sdkAppId&&r.accountType?(r=this.__addQAVCfg(r),this.initAndEnterRoom(r,t)):BK.Script.log(0,0,"addSSOJoinRoomCallBack data is incorrect.")}.bind(this))},t.prototype.initAndEnterRoom=function(t,e){void 0!=t.sdkAppId?void 0!=t.accountType?void 0!=t.avRoomId?void 0!=t.gameRoomId?(this.setQAVCfg(t),this.log("initAndEnterRoom step1 initRoom cfg:"+JSON.stringify(t)),this.initQAVRoom(t,function(i,r,n){0==i?(this.log("initAndEnterRoom step2 enterRoom"),this.enterQAVRoom(t,function(t,i,r){0==t?(this.log("initAndEnterRoom step2 enterRoom succ!"),this._hasSuccEnter=!0):this._hasStartQAVRoomFlag=!1,e(t,i,r)}.bind(this))):(this.log("initAndEnterRoom failed cmd:"+r+" errCode:"+i+" data:"+JSON.stringify(n)),this._hasStartQAVRoomFlag=!1,e(i,r,n))}.bind(this))):this.log("initAndEnterRoom gameRoomId is null;"):this.log("initAndEnterRoom avRoomId is null;"):this.log("initAndEnterRoom accountType is null;"):this.log("initAndEnterRoom sdkAppId is null;")},t.prototype.__handleUserUpdate=function(t,e,i){i&&(this.log("handleUserUpdate data:"+JSON.stringify(i)),1==i.eventId?(this.log("进入房间事件:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventEnterCallback&&this.eventCallbackConfig.eventEnterCallback(i.eventId,i)):2==i.eventId?(this.log("退出房间事件:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventExitCallback&&this.eventCallbackConfig.eventExitCallback(i.eventId,i)):3==i.eventId?(this.log("有发摄像头视频事件。:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventHasCameraVideoCallback&&this.eventCallbackConfig.eventHasCameraVideoCallback(i.eventId,i)):4==i.eventId?(this.log("无发摄像头视频事件。:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNoCameraVideoCallback&&this.eventCallbackConfig.eventNoCameraVideoCallback(i.eventId,i)):5==i.eventId?(this.log("有发语音事件。:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventHasAudioCallback&&this.eventCallbackConfig.eventHasAudioCallback(i.eventId,i)):6==i.eventId?(this.log("无发语音事件。:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNoAudioCallback&&this.eventCallbackConfig.eventNoAudioCallback(i.eventId,i)):7==i.eventId?(this.log("有发屏幕视频事件。:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventHasScreenVideoCallback&&this.eventCallbackConfig.eventHasScreenVideoCallback(i.eventId,i)):8==i.eventId?(this.log("无发屏幕视频事件。:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNoScreenVideoCallback&&this.eventCallbackConfig.eventNoScreenVideoCallback(i.eventId,i)):9==i.eventId?(this.log("有发文件视频事件。:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventHasMediaFileCallback&&this.eventCallbackConfig.eventHasMediaFileCallback(i.eventId,i)):10==i.eventId?(this.log("无发文件视频事件。:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNoMediaFileCallback&&this.eventCallbackConfig.eventNoMediaFileCallback(i.eventId,i)):42==i.eventId?(this.log("新成员说话:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNewSpeakCallback&&this.eventCallbackConfig.eventNewSpeakCallback(i.eventId,i)):43==i.eventId&&(this.log("旧成员停止说话:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventOldStopSpeakCallback&&this.eventCallbackConfig.eventOldStopSpeakCallback(i.eventId,i)))},t.prototype.__handleRoomDisconnect=function(t,e,i){this.eventCallbackConfig&&this.eventCallbackConfig.eventRoomDisconnectCallback&&this.eventCallbackConfig.eventRoomDisconnectCallback(i)},t}())}())}(BK),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.QRCode=e())}(BK,function(){function t(t){this.mode=s.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,i=this.data.length;e<i;e++){var r=[],n=this.data.charCodeAt(e);n>65536?(r[0]=240|(1835008&n)>>>18,r[1]=128|(258048&n)>>>12,r[2]=128|(4032&n)>>>6,r[3]=128|63&n):n>2048?(r[0]=224|(61440&n)>>>12,r[1]=128|(4032&n)>>>6,r[2]=128|63&n):n>128?(r[0]=192|(1984&n)>>>6,r[1]=128|63&n):r[0]=n,this.parsedData.push(r)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function e(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(t,e){if(void 0==t.length)throw new Error(t.length+"/"+e);for(var i=0;i<t.length&&0==t[i];)i++;this.num=new Array(t.length-i+e);for(var r=0;r<t.length-i;r++)this.num[r]=t[r+i]}function r(t,e){this.totalCount=t,this.dataCount=e}function n(){this.buffer=[],this.length=0}function a(t,e){for(var i=1,r=o(t),n=0,a=u.length;n<=a;n++){var s=0;switch(e){case h.L:s=u[n][0];break;case h.M:s=u[n][1];break;case h.Q:s=u[n][2];break;case h.H:s=u[n][3]}if(r<=s)break;i++}if(i>u.length)throw new Error("Too long data");return i}function o(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=t?3:0)}t.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,i=this.parsedData.length;e<i;e++)t.put(this.parsedData[e],8)}},e.prototype={addData:function(e){var i=new t(e);this.dataList.push(i),this.dataCache=null},isDark:function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,i){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,i),this.typeNumber>=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=e.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,i)},setupPositionProbePattern:function(t,e){for(var i=-1;i<=7;i++)if(!(t+i<=-1||this.moduleCount<=t+i))for(var r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(this.modules[t+i][e+r]=0<=i&&i<=6&&(0==r||6==r)||0<=r&&r<=6&&(0==i||6==i)||2<=i&&i<=4&&2<=r&&r<=4)},getBestMaskPattern:function(){for(var t=0,e=0,i=0;i<8;i++){this.makeImpl(!0,i);var r=l.getLostPoint(this);(0==i||t>r)&&(t=r,e=i)}return e},createMovieClip:function(t,e,i){var r=t.createEmptyMovieClip(e,i);this.make();for(var n=0;n<this.modules.length;n++)for(var a=1*n,o=0;o<this.modules[n].length;o++){var s=1*o;this.modules[n][o]&&(r.beginFill(0,100),r.moveTo(s,a),r.lineTo(s+1,a),r.lineTo(s+1,a+1),r.lineTo(s,a+1),r.endFill())}return r},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=t%2==0);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=e%2==0)},setupPositionAdjustPattern:function(){for(var t=l.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var i=0;i<t.length;i++){var r=t[e],n=t[i];if(null==this.modules[r][n])for(var a=-2;a<=2;a++)for(var o=-2;o<=2;o++)this.modules[r+a][n+o]=-2==a||2==a||-2==o||2==o||0==a&&0==o}},setupTypeNumber:function(t){for(var e=l.getBCHTypeNumber(this.typeNumber),i=0;i<18;i++){r=!t&&1==(e>>i&1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=r}for(i=0;i<18;i++){var r=!t&&1==(e>>i&1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r}},setupTypeInfo:function(t,e){for(var i=this.errorCorrectLevel<<3|e,r=l.getBCHTypeInfo(i),n=0;n<15;n++){a=!t&&1==(r>>n&1);n<6?this.modules[n][8]=a:n<8?this.modules[n+1][8]=a:this.modules[this.moduleCount-15+n][8]=a}for(n=0;n<15;n++){var a=!t&&1==(r>>n&1);n<8?this.modules[8][this.moduleCount-n-1]=a:n<9?this.modules[8][15-n-1+1]=a:this.modules[8][15-n-1]=a}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var i=-1,r=this.moduleCount-1,n=7,a=0,o=this.moduleCount-1;o>0;o-=2)for(6==o&&o--;;){for(var s=0;s<2;s++)if(null==this.modules[r][o-s]){var h=!1;a<t.length&&(h=1==(t[a]>>>n&1)),l.getMask(e,r,o-s)&&(h=!h),this.modules[r][o-s]=h,-1==--n&&(a++,n=7)}if((r+=i)<0||this.moduleCount<=r){r-=i,i=-i;break}}}},e.PAD0=236,e.PAD1=17,e.createData=function(t,i,a){for(var o=r.getRSBlocks(t,i),s=new n,h=0;h<a.length;h++){var _=a[h];s.put(_.mode,4),s.put(_.getLength(),l.getLengthInBits(_.mode,t)),_.write(s)}for(var d=0,h=0;h<o.length;h++)d+=o[h].dataCount;if(s.getLengthInBits()>8*d)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+8*d+")");for(s.getLengthInBits()+4<=8*d&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;;){if(s.getLengthInBits()>=8*d)break;if(s.put(e.PAD0,8),s.getLengthInBits()>=8*d)break;s.put(e.PAD1,8)}return e.createBytes(s,o)},e.createBytes=function(t,e){for(var r=0,n=0,a=0,o=new Array(e.length),s=new Array(e.length),h=0;h<e.length;h++){var _=e[h].dataCount,d=e[h].totalCount-_;n=Math.max(n,_),a=Math.max(a,d),o[h]=new Array(_);for(m=0;m<o[h].length;m++)o[h][m]=255&t.buffer[m+r];r+=_;var c=l.getErrorCorrectPolynomial(d),u=new i(o[h],c.getLength()-1).mod(c);s[h]=new Array(c.getLength()-1);for(m=0;m<s[h].length;m++){var f=m+u.getLength()-s[h].length;s[h][m]=f>=0?u.get(f):0}}for(var g=0,m=0;m<e.length;m++)g+=e[m].totalCount;for(var p=new Array(g),v=0,m=0;m<n;m++)for(h=0;h<e.length;h++)m<o[h].length&&(p[v++]=o[h][m]);for(m=0;m<a;m++)for(h=0;h<e.length;h++)m<s[h].length&&(p[v++]=s[h][m]);return p};for(var s={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},h={L:1,M:0,Q:3,H:2},_={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},l={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;l.getBCHDigit(e)-l.getBCHDigit(l.G15)>=0;)e^=l.G15<<l.getBCHDigit(e)-l.getBCHDigit(l.G15);return(t<<10|e)^l.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;l.getBCHDigit(e)-l.getBCHDigit(l.G18)>=0;)e^=l.G18<<l.getBCHDigit(e)-l.getBCHDigit(l.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;0!=t;)e++,t>>>=1;return e},getPatternPosition:function(t){return l.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,i){switch(t){case _.PATTERN000:return(e+i)%2==0;case _.PATTERN001:return e%2==0;case _.PATTERN010:return i%3==0;case _.PATTERN011:return(e+i)%3==0;case _.PATTERN100:return(Math.floor(e/2)+Math.floor(i/3))%2==0;case _.PATTERN101:return e*i%2+e*i%3==0;case _.PATTERN110:return(e*i%2+e*i%3)%2==0;case _.PATTERN111:return(e*i%3+(e+i)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new i([1],0),r=0;r<t;r++)e=e.multiply(new i([1,d.gexp(r)],0));return e},getLengthInBits:function(t,e){if(1<=e&&e<10)switch(t){case s.MODE_NUMBER:return 10;case s.MODE_ALPHA_NUM:return 9;case s.MODE_8BIT_BYTE:case s.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(e<27)switch(t){case s.MODE_NUMBER:return 12;case s.MODE_ALPHA_NUM:return 11;case s.MODE_8BIT_BYTE:return 16;case s.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(e<41))throw new Error("type:"+e);switch(t){case s.MODE_NUMBER:return 14;case s.MODE_ALPHA_NUM:return 13;case s.MODE_8BIT_BYTE:return 16;case s.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},getLostPoint:function(t){for(var e=t.getModuleCount(),i=0,r=0;r<e;r++)for(l=0;l<e;l++){for(var n=0,a=t.isDark(r,l),o=-1;o<=1;o++)if(!(r+o<0||e<=r+o))for(var s=-1;s<=1;s++)l+s<0||e<=l+s||0==o&&0==s||a==t.isDark(r+o,l+s)&&n++;n>5&&(i+=3+n-5)}for(r=0;r<e-1;r++)for(l=0;l<e-1;l++){var h=0;t.isDark(r,l)&&h++,t.isDark(r+1,l)&&h++,t.isDark(r,l+1)&&h++,t.isDark(r+1,l+1)&&h++,0!=h&&4!=h||(i+=3)}for(r=0;r<e;r++)for(l=0;l<e-6;l++)t.isDark(r,l)&&!t.isDark(r,l+1)&&t.isDark(r,l+2)&&t.isDark(r,l+3)&&t.isDark(r,l+4)&&!t.isDark(r,l+5)&&t.isDark(r,l+6)&&(i+=40);for(l=0;l<e;l++)for(r=0;r<e-6;r++)t.isDark(r,l)&&!t.isDark(r+1,l)&&t.isDark(r+2,l)&&t.isDark(r+3,l)&&t.isDark(r+4,l)&&!t.isDark(r+5,l)&&t.isDark(r+6,l)&&(i+=40);for(var _=0,l=0;l<e;l++)for(r=0;r<e;r++)t.isDark(r,l)&&_++;return i+=10*(Math.abs(100*_/e/e-50)/5)}},d={glog:function(t){if(t<1)throw new Error("glog("+t+")");return d.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return d.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},c=0;c<8;c++)d.EXP_TABLE[c]=1<<c;for(c=8;c<256;c++)d.EXP_TABLE[c]=d.EXP_TABLE[c-4]^d.EXP_TABLE[c-5]^d.EXP_TABLE[c-6]^d.EXP_TABLE[c-8];for(c=0;c<255;c++)d.LOG_TABLE[d.EXP_TABLE[c]]=c;i.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=new Array(this.getLength()+t.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<t.getLength();n++)e[r+n]^=d.gexp(d.glog(this.get(r))+d.glog(t.get(n)));return new i(e,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=d.glog(this.get(0))-d.glog(t.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(n=0;n<t.getLength();n++)r[n]^=d.gexp(d.glog(t.get(n))+e);return new i(r,0).mod(t)}},r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],r.getRSBlocks=function(t,e){var i=r.getRsBlockTable(t,e);if(void 0==i)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var n=i.length/3,a=[],o=0;o<n;o++)for(var s=i[3*o+0],h=i[3*o+1],_=i[3*o+2],l=0;l<s;l++)a.push(new r(h,_));return a},r.getRsBlockTable=function(t,e){switch(e){case h.L:return r.RS_BLOCK_TABLE[4*(t-1)+0];case h.M:return r.RS_BLOCK_TABLE[4*(t-1)+1];case h.Q:return r.RS_BLOCK_TABLE[4*(t-1)+2];case h.H:return r.RS_BLOCK_TABLE[4*(t-1)+3];default:return}},n.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var i=0;i<e;i++)this.putBit(1==(t>>>e-i-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var u=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],f=function(){};return f.createQRModel=function(t,i){var r,n=new e(a(t,(r=void 0===i?{width:256,height:256,colorDark:{r:0,g:0,b:0,a:1},colorLight:{r:1,g:1,b:1,a:1},correctLevel:2}:i).correctLevel),r.correctLevel);return n.addData(t),n.make(),n},f.createQRCodeNode=function(t,e){var i;i=void 0===e?{width:256,height:256,colorDark:{r:0,g:0,b:0,a:1},colorLight:{r:1,g:1,b:1,a:1},correctLevel:2}:e;for(var r=new BK.Canvas(i.width,i.height),n=f.createQRModel(t,e),a=n.getModuleCount(),o=i.width/a,s=i.height/a,h=Math.round(o),_=Math.round(s),l=0;l<a;l++)for(var d=0;d<a;d++){var c=n.isDark(l,d),u=d*o,g=l*s;r.lineWidth=1,r.fillColor=c?i.colorDark:i.colorLight,r.drawStyle=0,r.fillRect(u,g,o,s),r.strokeColor=c?i.colorDark:i.colorLight,r.strokeRect(Math.ceil(u)-.5,Math.ceil(g)-.5,h,_),r.strokeRect(Math.ceil(u)+.5,Math.ceil(g)+.5,h,_)}return r},f.createQRCodeToFile=function(t,e,i){var r=f.createQRCodeNode(e,i);return r.saveTo(t),r.dispose(),!0},f.compose=function(t,e,i,r){var n=BK.Director.screenPixelSize.width,a=BK.Director.screenPixelSize.height,o=new BK.Canvas(n,a);o.drawImage(t,0,0),o.drawImage(e,0,0),o.saveTo("GameSandBox://compose.png"),o.dispose()},f}),function(t,e){var i=function(){function t(t,e){this.loadJsonAtlasArray(t,function(t,i){for(var r=0;r<i.length;r++){var n=i[r],a=n.jsonInfo,o=n.atlasInfo,s=a.data,h=o.data,_=a.path,l=o.path;this.loadAccessory(s,_,h,l)}e(t,i)}.bind(this))}function e(t,e){var i=[t];this.loadJsonAtlasArray(i,function(i,r){if(0==i){var n=r[0],a=n.jsonInfo,o=n.atlasInfo,s=a.data,h=o.data,_=a.path,l=o.path,d=this.load(s,_,h,l);e(d,t)}else e(-1,null)}.bind(this))}function i(t,e,i){BK.FileManager.Instance.readFile({file:[{path:t},{path:e}]},function(t){BK.Script.log(1,0,"res = "+JSON.stringify(t));for(var e,r,n=0;n<t.length;n++){var a=t[n],o=a.path,s=o.substring(o.lastIndexOf("."));".json"==s?e=a:".atlas"==s&&(r=a)}i(0,e,r)}.bind(this))}function r(t,e){for(var i=[],r=0;r<t.length;r++){var n=t[r],a={path:n.json},o={path:n.atlas};i.push(a),i.push(o)}BK.FileManager.Instance.readFile({file:i},function(i){BK.Script.log(1,0,"res = "+JSON.stringify(i));for(var r=0;r<i.length;r++){var n=i[r],a=n.path,o=a.substring(a.lastIndexOf(".")),s=!1;".json"==o?s=!0:".atlas"==o&&(s=!1);for(var h=0;h<t.length;h++){var _=t[h],l=null;if(s){d=(l=_.json).substring(l.indexOf("://")+3,l.length);a.indexOf(d)>0&&(t[h].jsonInfo=n)}else{var d=(l=_.atlas).substring(l.indexOf("://")+3,l.length);a.indexOf(d)>0&&(t[h].atlasInfo=n)}}}e(0,t)}.bind(this))}function n(t,e,i){var r=[t];this.loadJsonAtlasArray(r,function(r,n){if(0==r){var a=n[0],o=a.jsonInfo,s=a.atlasInfo,h=o.data,_=s.data,l=o.path,d=s.path,c=this.loadAccessoryAnimation(h,l,_,d,e);i(c,e,t)}else i(-1,e,null)}.bind(this))}return{setAccessoryAsync:t,loadJsonAtlas:i,loadSkeletonAsync:e,setAccessoryAnimationAsync:n,loadJsonAtlasArray:r}}();t.SkeletonAnimation.__proto__.setAccessoryAsync=i.setAccessoryAsync,t.SkeletonAnimation.__proto__.loadJsonAtlas=i.loadJsonAtlas,t.SkeletonAnimation.__proto__.loadSkeletonAsync=i.loadSkeletonAsync,t.SkeletonAnimation.__proto__.setAccessoryAnimationAsync=i.setAccessoryAnimationAsync,t.SkeletonAnimation.__proto__.loadJsonAtlasArray=i.loadJsonAtlasArray}(BK),function(t,e){"object"==typeof t&&(t.AdBannerHandler=function(){return{AdBannerHandler:function(){function t(t,e){this.closeUrl="https://i.hudongcdn.com/game_cdn/ad_close.png",this.adIconUrl="https://i.hudongcdn.com/game_cdn/ad_icon.png",this.pos_id=t,this.event={},this.adInfo=e,this.sizeW=.78*BK.Director.screenPixelSize.width;var i=BK.Director.screenPixelSize.width;i>BK.Director.screenPixelSize.height&&(this.sizeW=.44*i),this.sizeH=166*this.sizeW/582,this.closeBtnW=46*this.sizeW/582,this.clsoeBtnH=46*this.sizeH/166,this.btnSpace=14*this.sizeH/166,BK.Script.log(1,1," constructor: "+this.btnSpace),this.adIconW=74*this.sizeW/582,this.adIconH=46*this.sizeH/166}return t.prototype.isUseWebGL=function(){return void 0!==gl},t.prototype.onClickContent=function(t){this.event.onClickContent=t},t.prototype.onClickClose=function(t){this.event.onClickClose=t},t.prototype.show=function(t){this.isUseWebGL()?this.showWebGLNode(t):this.showBKNode(t)},t.prototype._onLoadBackgroundCallback=function(t,e,i){200==e?(this.exposeureReport(),i(0,"OK",this)):(i(-1,"load image failed!",this),this.close())},t.prototype._jumpToDestPage=function(){BK.MQQ.Webview.open(this.adInfo.report_info.click_url)},t.prototype._emmitClickEvent=function(){this.event.onClickContent&&this.event.onClickContent()},t.prototype._onClickContentBtn=function(){this._emmitClickEvent(),this._jumpToDestPage()},t.prototype._reportClick=function(){this.clickReport(),this.cmshowReport(3)},t.prototype._onClickCloseBtn=function(){this.event.onClickClose&&this.event.onClickClose(),this.closeReport(),this.close()},t.prototype.showBKNode=function(t){this.rootNode=new BK.Node,this.rootNode.canUserInteract=!0,this.backgound=new BK.Button(this.sizeW,this.sizeH),this.backgound.setNormalTextureFromUrl(this.adInfo.display_info.basic_info.img,function(e,i){this._onLoadBackgroundCallback(e,i,t)}.bind(this)),this.rootNode.addChild(this.backgound),this.closeBtn=new BK.Button(this.closeBtnW,this.clsoeBtnH),this.closeBtn.position={x:this.sizeW-this.closeBtnW-this.btnSpace,y:this.sizeH-this.clsoeBtnH-this.btnSpace},this.closeBtn.setNormalTextureFromUrl(this.closeUrl,function(t,e){}.bind(this)),this.rootNode.addChild(this.closeBtn),this.adIconBtn=new BK.Button(this.adIconW,this.adIconH),this.adIconBtn.position={x:this.btnSpace,y:this.btnSpace},this.adIconBtn.setNormalTextureFromUrl(this.adIconUrl,function(t,e){200!=e&&BK.Script.log(1,1,"")}.bind(this)),this.rootNode.addChild(this.adIconBtn),this.backgound.setTouchInsideCallback(function(t){this._onClickContentBtn()}.bind(this)),this.closeBtn.setTouchInsideCallback(function(t){this._onClickCloseBtn()}.bind(this)),this.renderBKNode()},t.prototype.renderBKNode=function(){var t=BK.Director.screenPixelSize.width/BK.Director.root.scale.x,e=this.sizeW*(1/BK.Director.root.scale.x);this.rootNode.position={x:(t-e)/2,y:0},this.rootNode.scale={x:1/BK.Director.root.scale.x,y:1/BK.Director.root.scale.y},BK.Director.root.addChild(this.rootNode)},t.prototype.closeBKNode=function(){this.rootNode.removeFromParent()},t.prototype.showWebGLNode=function(t){this.context=new BK.GLRenderContext;var e=BK.JSMatrix.fromOrthographic(0,BK.Director.screenPixelSize.width,0,BK.Director.screenPixelSize.height,-1,1);this.context.setProjection(e);var i=BK.Director.screenPixelSize.width;BK.Director.screenPixelSize.height;this.glRootNode=new BK.GLRenderButton(this.context,this.sizeW,this.sizeH),this.glRootNode.canUserInteract=!0,this.glRootNode.canClick=!1,this.glRootNode.setUrlPath(this.adInfo.display_info.basic_info.img,function(e,i){this.glRootNode.canClick=!0,this._onLoadBackgroundCallback(e,i,t)}.bind(this)),this.glRootNode.position={x:(i-this.sizeW)/2,y:0},this.glCloseBtn=new BK.GLRenderButton(this.context,this.closeBtnW,this.clsoeBtnH),this.glCloseBtn.setUrlPath(this.closeUrl),this.glCloseBtn.position={x:this.sizeW-this.closeBtnW-this.btnSpace,y:this.sizeH-this.clsoeBtnH-this.btnSpace},this.glRootNode.addChild(this.glCloseBtn),this.glAdIconBtn=new BK.GLRenderButton(this.context,this.adIconW,this.adIconH),this.glAdIconBtn.setUrlPath(this.adIconUrl),this.glAdIconBtn.position={x:this.btnSpace,y:this.btnSpace},this.glRootNode.addChild(this.glAdIconBtn),this.glRootNode.setTouchInsideCallback(function(t){this._onClickContentBtn(),this._reportClick()}.bind(this)),this.glCloseBtn.setTouchInsideCallback(function(t){this._onClickCloseBtn()}.bind(this)),this.renderWebGLNode()},t.prototype.renderWebGLNode=function(){UIEventHandler.setRootNode(this.glRootNode),BK.GLRenderContext.hookGLCommit(function(t){if(this.context&&this.glRootNode){if(0==t.methodWorking)return;this.context.save(),t.viewport(0,0,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height),t.disable(t.DEPTH_TEST),t.useProgram(this.context.getProgram()),this.glRootNode.render(),this.context.restore()}}.bind(this))},t.prototype.closeWebGLNode=function(){this.glRootNode&&this.glRootNode.dispose(),this.context&&this.context.dispose(),this.glRootNode=null,this.context=null,BK.GLRenderContext.exit()},t.prototype.close=function(){this.isUseWebGL()?this.closeWebGLNode():this.closeBKNode()},t.prototype.exposeureReport=function(t,e,i){if(this.adInfo.report_info&&this.adInfo.report_info.exposure_url){var r=this.adInfo.report_info.exposure_url,n=new BK.HttpUtil(r);BK.Script.log(0,0,"exposeureReport param:"+t+" exposure_url:"+r),n.requestAsync(function(t,e){200==e?BK.Script.log(1,1,"exposeureReport succ."):BK.Script.log(1,1,"exposeureReport failed.statuscode:"+e)}.bind(this)),this.cmshowReport(0,t,e,i)}else BK.Script.log(1,1,"exposeureReport failed. no report_info ")},t.prototype.clickReport=function(){},t.prototype.closeReport=function(t,e,i){if(this.adInfo.report_info&&this.adInfo.report_info.negative_feedback_url){var r=this.adInfo.report_info.negative_feedback_url;r=r.replace("__ACT_TYPE__","2001"),new BK.HttpUtil(r).requestAsync(function(t,e){200==e?BK.Script.log(1,1,"negative_feedback succ."):BK.Script.log(1,1,"negative_feedback failed.statuscode:"+e)}.bind(this)),this.cmshowReport(3,t,e,i)}else BK.Script.log(1,1,"closeReport failed.can not find the negative_feedback_url")},t.prototype.cmshowReport=function(t,e,i,r){var n=this.pos_id,a=t.toString(),o="",s="",h="";e&&(o=e),i&&(s=i),r&&(h=r),BK.QQ.uploadData("banner_SPA",n,a,o,s,h)},t.prototype.reportParamToString=function(){var t=this.adInfo.report_info.trace_info,e="";if("object"==typeof t){for(var i in t)e=e+i+"="+t[i]+"&";e=e.substring(0,e.length-1)}return e},t}()}}().AdBannerHandler)}(BK),function(t,e){"object"==typeof t&&(t.AdAnimateBanner=function(){function t(){return IS_IPHONE_X}function e(){return!!t()}function i(){return t()?BK.Director.screenPixelSize.height>BK.Director.screenPixelSize.width?.015*BK.Director.screenPixelSize.height:.035*BK.Director.screenPixelSize.height:0}function r(t,e,i,r,n,a,o,s,h,_,l,d,c,u,f,g){this._data=void 0!==t?[t,e,i,r,n,a,o,s,h,_,l,d,c,u,f,g]:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function n(t,e,i,n,a,o){return new r(2/(e-t),0,0,0,0,2/(n-i),0,0,0,0,2/(a-o),0,(t+e)/(t-e),(n+i)/(i-n),(a+o)/(a-o),1)}function o(t){return new r(1,0,0,0,0,1,0,0,0,0,1,0,t.x,t.y,t.z,1)}function s(t){return new r(t.x,0,0,0,0,t.y,0,0,0,0,1,0,0,0,0,1)}function h(t){return.01745329251994*t}function _(t){var e=h(-t.y),i=h(-t.x),n=h(-t.z),a=Math.cos(e),o=Math.sin(e),s=Math.cos(i),_=Math.sin(i),l=Math.cos(n),d=Math.sin(n);return new r(a*l+o*_*d,-a*d+o*_*l,o*s,0,d*s,l*s,-_,0,-o*l+a*_*d,d*o+a*_*l,a*s,0,0,0,0,1)}function l(t,e){this._gl=t;var i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,e.vs_source),t.compileShader(i);var r=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(r,e.fs_source),t.compileShader(r),this._shader_program=t.createProgram(),t.attachShader(this._shader_program,i),t.attachShader(this._shader_program,r),t.linkProgram(this._shader_program),this._attributes=[];for(o=0;o<e.attributes.length;++o){var n=e.attributes[o],a=t.getAttribLocation(this._shader_program,n.name);this._attributes.push({name:n.name,size:n.size,location:a})}this._uniforms=[];for(var o=0;o<e.uniforms.length;++o){var s=e.uniforms[o];this._uniforms.push({name:s.name,type:s.type,location:t.getUniformLocation(this._shader_program,s.name),value:s.default_value})}}function d(){this._parent=null,this._children=[],this._rotation_matrix=new r,this._scalar_matrix=new r,this._local_matrix=new r,this._world_matrix=new r,this._canUserInteract=!1,this._dirty_flags=0,this._need_update_flag=!1,this._position={x:0,y:0,z:0},this._hidden=!1,Object.defineProperty(this,"canUserInteract",{configurable:!0,get:function(){return this._canUserInteract},set:function(t){this._canUserInteract=t}}),Object.defineProperty(this,"children",{configurable:!0,get:function(){return this._children}}),Object.defineProperty(this,"hidden",{configurable:!0,get:function(){return this._hidden},set:function(t){this._hidden=t}}),Object.defineProperty(this,"position",{configurable:!0,get:function(){return this._position},set:function(t){this._position.x=void 0!==t.x?t.x:this._position.x,this._position.y=void 0!==t.y?t.y:this._position.y,this._position.z=void 0!==t.z?t.z:this._position.z,this._need_update_flag=!0,this._dirty_flags|=DIRTY_TRANSLATION|DIRTY_WORLD_MATRIX}}),this._scale={x:1,y:1,z:1},Object.defineProperty(this,"scale",{configurable:!0,get:function(){return this._scale},set:function(t){this._scale.x=void 0!==t.x?t.x:this._scale.x,this._scale.y=void 0!==t.y?t.y:this._scale.y,this._scale.z=void 0!==t.z?t.z:this._scale.z,this._need_update_flag=!0,this._dirty_flags|=DIRTY_SCALE|DIRTY_WORLD_MATRIX}}),this._rotation={x:0,y:0,z:0},Object.defineProperty(this,"rotation",{configurable:!0,get:function(){return this._rotation},set:function(t){this._rotation.x=void 0!==t.x?t.x:this._rotation.x,this._rotation.y=void 0!==t.y?t.y:this._rotation.y,this._rotation.z=void 0!==t.z?t.z:this._rotation.z,this._need_update_flag=!0,this._dirty_flags|=DIRTY_ROTATION|DIRTY_WORLD_MATRIX}}),this._visible=!0,Object.defineProperty(this,"visible",{configurable:!0,get:function(){return this._visible},set:function(t){this._visible=t}})}function c(t,e,i,r,n,a,o){d.call(this),this._color={r:1,g:1,b:1,a:1},Object.defineProperty(this,"color",{configurable:!0,get:function(){return this._color},set:function(t){this._color.r=void 0!==t.r?t.r:this._color.r,this._color.g=void 0!==t.g?t.g:this._color.g,this._color.b=void 0!==t.b?t.b:this._color.b,this._color.a=void 0!==t.a?t.a:this._color.a,this._dirty_flags|=DIRTY_COLOR}}),this._anchor={x:.5,y:.5},Object.defineProperty(this,"anchor",{configurable:!0,get:function(){return this._anchor},set:function(t){this._anchor.x=void 0!==t.x?t.x:this._anchor.x,this._anchor.y=void 0!==t.y?t.y:this._anchor.y,this._dirty_flags|=DIRTY_ANCHOR}}),this.setTexture(i),this._uv_rotate=BK_SPRITE_UV_ROTATE_NONE,this._origin_tex_uv=[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}],this._flip_u=void 0!==r&&r,this._flip_v=void 0!==n&&n,this._stretch_x=void 0!==a&&a,this._stretch_y=void 0!==o&&o,this._blend_mode=BK_BLEND_MODE_MULTIPLY,this._content_size={width:t,height:e},Object.defineProperty(this,"size",{configurable:!0,get:function(){return this._content_size},set:function(t){this._content_size=t,this._dirty_flags|=DIRTY_CONTENT_SIZE}});var s=.5*this._content_size.width,h=.5*this._content_size.height;this._vertices=new Float32Array([-s,h,0,1,1,1,1,0,0,s,h,0,1,1,1,1,1,0,s,-h,0,1,1,1,1,1,1,-s,-h,0,1,1,1,1,0,1]),this._vbo=null,this._ibo=null}function u(t,e,i,r,n,a,o){c.call(this,t,e,i,r,n,a,o),this.contentSize={width:t,height:e},this.isCancelClick=void 0,this.touchStatus=0,this.canUserInteract=!0,this.enable=!0,this.canClick=!0,this.touchInsideCallback=void 0,this.addTouchListener()}function f(t){var e=Math.floor(255*t.a);return e<<=8,e|=Math.floor(255*t.r),e<<=8,e|=Math.floor(255*t.g),e<<=8,(e|=Math.floor(255*t.b))>>>0}function g(r){this._ad_final_size=[],this._clickInsideCallback=void 0;for(var n=0;n<AD_DESIGN_SIZE.length;++n)this._ad_final_size.push({width:Math.ceil(AD_DESIGN_SIZE[n].width*STANDARD_SCALE),height:Math.ceil(AD_DESIGN_SIZE[n].height*STANDARD_SCALE)});this._is_webgl=void 0!==gl,this._is_webgl&&this.webGL_init();var a="GameRes://res/bg_left.png",o="GameRes://res/bg_bg_1.png",s="GameRes://res/bg_bg_2.png",h="GameRes://res/bg_fg_1.png",_="GameRes://res/bg_fg_2.png",l="GameRes://res/bg_right.png";r&&(a=r.bg_left_path,l=r.bg_right_path,o=r.bg_bg_1_path,s=r.bg_bg_2_path,h=r.bg_fg_1_path,_=r.bg_fg_2_path),this._tex_bg_left=this.create_texture(a,!1),this._tex_bg_bg_1=this.create_texture(o,!1),this._tex_bg_bg_2=this.create_texture(s,!1),this._tex_bg_fg_1=this.create_texture(h,!1),this._tex_bg_fg_2=this.create_texture(_,!1),this._tex_bg_right=this.create_texture(l,!1),this._root_node=this.create_node(),this._root_node.canUserInteract=!0,this._mv_node=this.create_clip_node(this._root_node,{x:.5*-this._ad_final_size[AD_BANNER_TYPE_RESERVED_CLIP_RECT].width,y:t()?2*STANDARD_SCALE:0,width:this._ad_final_size[AD_BANNER_TYPE_RESERVED_CLIP_RECT].width,height:this._ad_final_size[AD_BANNER_TYPE_RESERVED_CLIP_RECT].height}),this._mv_node.canUserInteract=!0,e()?this._mv_node.position={x:.5*BK.Director.screenPixelSize.width,y:i()}:this._mv_node.position={x:.5*BK.Director.screenPixelSize.width,y:0},this._node_1=this.node_extend(this.create_button(this._mv_node,this._tex_bg_left,this._ad_final_size[AD_BANNER_TYPE_RESERVED_0],this._onTouchInside.bind(this))),this._node_2=this.node_extend(this.create_node(this._mv_node)),this._node_2.canUserInteract=!0,this._node_2_1=this.create_button(this._node_2,this._tex_bg_bg_1,this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1],this._onTouchInside.bind(this)),this._content_node=this.create_node(this._node_2),this._real_content_node=void 0,this._node_2_2=this.create_sprite_with_texture(this._node_2,this._tex_bg_fg_1,this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_1]),this._node_3=this.node_extend(this.create_button(this._mv_node,this._tex_bg_right,this._ad_final_size[AD_BANNER_TYPE_RESERVED_3],this._onTouchInside.bind(this)));var d=new BK.Ticker;d.interval=.033,d.setTickerCallBack(function(t,e){this.update(e)}.bind(this))}AD_BANNER_TYPE_DYNAMIC_193_582_166=0,AD_BANNER_TYPE_DYNAMIC_194_147_147=1,AD_BANNER_TYPE_DYNAMIC_184_240_180=2,AD_BANNER_TYPE_DYNAMIC_285_240_180_3=3,AD_BANNER_TYPE_DYNAMIC_210_640_288=4,AD_BANNER_TYPE_DYNAMIC_65_1000_560=5,AD_BANNER_TYPE_STATIC_193_582_166=6,AD_BANNER_TYPE_STATIC_194_147_147=7,AD_BANNER_TYPE_STATIC_184_240_180=8,AD_BANNER_TYPE_STATIC_285_240_180_3=9,AD_BANNER_TYPE_STATIC_210_640_288=10,AD_BANNER_TYPE_STATIC_65_1000_560=11,AD_BANNER_TYPE_RESERVED_0=12,AD_BANNER_TYPE_RESERVED_1_1=13,AD_BANNER_TYPE_RESERVED_1_2=14,AD_BANNER_TYPE_RESERVED_2_1=15,AD_BANNER_TYPE_RESERVED_2_2=16,AD_BANNER_TYPE_RESERVED_3=17,AD_BANNER_TYPE_RESERVED_CLIP_RECT=18,AD_DESIGN_SIZE=[{width:490,height:140},{width:147,height:147},{width:193,height:145},{width:147,height:110},{width:322,height:145},{width:263,height:147},{width:582,height:166},{width:166,height:166},{width:221,height:166},{width:179,height:132},{width:368,height:166},{width:297,height:166},{width:114,height:87},{width:530,height:166},{width:581,height:166},{width:530,height:38},{width:60,height:30},{width:115,height:115},{width:730,height:166}],IPHONE_X_WIDTH=375,IPHONE_X_HEIGHT=812;var m=BK.Director.queryDeviceInfo();return"ios"===m.platform&&m.screenWidth===IPHONE_X_WIDTH&&m.screenHeight===IPHONE_X_HEIGHT?IS_IPHONE_X=!0:IS_IPHONE_X=!1,STANDARD_HEIGHT=function(){return t()?BK.Director.screenPixelSize.height>BK.Director.screenPixelSize.width?.1*BK.Director.screenPixelSize.height:.2*BK.Director.screenPixelSize.height:BK.Director.screenPixelSize.height*(BK.Director.screenPixelSize.height>BK.Director.screenPixelSize.width?.12:.22)}(),STANDARD_SCALE=STANDARD_HEIGHT/AD_DESIGN_SIZE[AD_BANNER_TYPE_RESERVED_1_1].height,NODE_TWEEN_ATTR_TYPE_NONE=0,NODE_TWEEN_ATTR_TYPE_SCALE=1,NODE_TWEEN_ATTR_TYPE_SCALE_X=2,NODE_TWEEN_ATTR_TYPE_SCALE_Y=3,NODE_TWEEN_ATTR_TYPE_POSITION_X=4,NODE_TWEEN_ATTR_TYPE_POSITION_Y=5,NODE_TWEEN_ATTR_TYPE_OPACITY=6,NODE_TWEEN_ATTR_TYPE_ROTATION_X=7,NODE_TWEEN_ATTR_TYPE_ROTATION_Y=8,NODE_TWEEN_ATTR_TYPE_ROTATION_Z=9,r.prototype={constructor:r,is_identity:function(){return 1===this._data[0]&&0===this._data[1]&&0===this._data[2]&&0===this._data[3]&&0===this._data[4]&&1===this._data[5]&&0===this._data[6]&&0===this._data[7]&&0===this._data[8]&&0===this._data[9]&&1===this._data[10]&&0===this._data[11]&&0===this._data[12]&&0===this._data[13]&&0===this._data[14]&&1===this._data[15]},set_translation:function(t,e,i){this._data[12]=t,this._data[13]=e,this._data[14]=i},set_scale:function(t,e,i){this._data[0]=t,this._data[5]=e,this._data[10]=i},set:function(t,e,i,r,n,a,o,s,h,_,l,d,c,u,f,g){this._data[0]=t,this._data[1]=e,this._data[2]=i,this._data[3]=r,this._data[4]=n,this._data[5]=a,this._data[6]=o,this._data[7]=s,this._data[8]=h,this._data[9]=_,this._data[10]=l,this._data[11]=d,this._data[12]=c,this._data[13]=u,this._data[14]=f,this._data[15]=g},setTo:function(t){return this._data=t._data.slice(0),this},multiply:function(t){if(this.is_identity())return this.setTo(t);if(t.is_identity())return this;var e=this._data[0]*t._data[0]+this._data[4]*t._data[1]+this._data[8]*t._data[2]+this._data[12]*t._data[3],i=this._data[1]*t._data[0]+this._data[5]*t._data[1]+this._data[9]*t._data[2]+this._data[13]*t._data[3],r=this._data[2]*t._data[0]+this._data[6]*t._data[1]+this._data[10]*t._data[2]+this._data[14]*t._data[3],n=this._data[3]*t._data[0]+this._data[7]*t._data[1]+this._data[11]*t._data[2]+this._data[15]*t._data[3],a=this._data[0]*t._data[4]+this._data[4]*t._data[5]+this._data[8]*t._data[6]+this._data[12]*t._data[7],o=this._data[1]*t._data[4]+this._data[5]*t._data[5]+this._data[9]*t._data[6]+this._data[13]*t._data[7],s=this._data[2]*t._data[4]+this._data[6]*t._data[5]+this._data[10]*t._data[6]+this._data[14]*t._data[7],h=this._data[3]*t._data[4]+this._data[7]*t._data[5]+this._data[11]*t._data[6]+this._data[15]*t._data[7],_=this._data[0]*t._data[8]+this._data[4]*t._data[9]+this._data[8]*t._data[10]+this._data[12]*t._data[11],l=this._data[1]*t._data[8]+this._data[5]*t._data[9]+this._data[9]*t._data[10]+this._data[13]*t._data[11],d=this._data[2]*t._data[8]+this._data[6]*t._data[9]+this._data[10]*t._data[10]+this._data[14]*t._data[11],c=this._data[3]*t._data[8]+this._data[7]*t._data[9]+this._data[11]*t._data[10]+this._data[15]*t._data[11],u=this._data[0]*t._data[12]+this._data[4]*t._data[13]+this._data[8]*t._data[14]+this._data[12]*t._data[15],f=this._data[1]*t._data[12]+this._data[5]*t._data[13]+this._data[9]*t._data[14]+this._data[13]*t._data[15],g=this._data[2]*t._data[12]+this._data[6]*t._data[13]+this._data[10]*t._data[14]+this._data[14]*t._data[15],m=this._data[3]*t._data[12]+this._data[7]*t._data[13]+this._data[11]*t._data[14]+this._data[15]*t._data[15];return this.set(e,i,r,n,a,o,s,h,_,l,d,c,u,f,g,m),this},multiplyXY:function(t){return{x:t.x*this._data[0]+t.y*this._data[4]+this._data[12],y:t.x*this._data[1]+t.y*this._data[5]+this._data[13]}}},SHADER_UNIFORM_TYPE_FLOAT1=1,SHADER_UNIFORM_TYPE_FLOAT2=2,SHADER_UNIFORM_TYPE_FLOAT3=3,SHADER_UNIFORM_TYPE_FLOAT4=4,SHADER_UNIFORM_TYPE_INT1=5,SHADER_UNIFORM_TYPE_INT2=6,SHADER_UNIFORM_TYPE_INT3=7,SHADER_UNIFORM_TYPE_INT4=8,SHADER_UNIFORM_TYPE_FLOATV1=9,SHADER_UNIFORM_TYPE_FLOATV2=10,SHADER_UNIFORM_TYPE_FLOATV3=11,SHADER_UNIFORM_TYPE_FLOATV4=12,SHADER_UNIFORM_TYPE_INTV1=13,SHADER_UNIFORM_TYPE_INTV2=14,SHADER_UNIFORM_TYPE_INTV3=15,SHADER_UNIFORM_TYPE_INTV4=16,SHADER_UNIFORM_TYPE_MATRIX2=17,SHADER_UNIFORM_TYPE_MATRIX3=18,SHADER_UNIFORM_TYPE_MATRIX4=19,SHADER_UNIFORM_TYPE_TEXTURE0=20,SHADER_UNIFORM_TYPE_TEXTURE1=21,SHADER_UNIFORM_TYPE_TEXTURE2=22,SHADER_UNIFORM_TYPE_TEXTURE3=23,SHADER_UNIFORM_TYPE_TEXTURE4=24,SHADER_UNIFORM_TYPE_TEXTURE5=25,SHADER_UNIFORM_TYPE_TEXTURE6=26,SHADER_UNIFORM_TYPE_TEXTURE7=27,l.prototype={set_uniform:function(t,e,i){for(var r=0;r<this._uniforms.length;++r)this._uniforms[r].name===t&&(this._uniforms[r].value=e,i&&this.update_uniform(this._uniforms[r]))},bind:function(){this._gl.useProgram(this._shader_program);for(e=0;e<this._uniforms.length;++e)this.update_uniform(this._uniforms[e]);for(var t=0,e=0;e<this._attributes.length;++e){var i=this._attributes[e];this._gl.vertexAttribPointer(i.location,i.size,this._gl.FLOAT,!1,36,t),this._gl.enableVertexAttribArray(i.location),t+=4*i.size}},update_uniform:function(t){var e=this._gl;switch(t.type){case SHADER_UNIFORM_TYPE_FLOAT1:e.uniform1f(t.location,t.value);break;case SHADER_UNIFORM_TYPE_FLOAT2:e.uniform2f(t.location,t.value.x,t.value.y);break;case SHADER_UNIFORM_TYPE_FLOAT3:e.uniform3f(t.location,t.value.x,t.value.y,t.value.z);break;case SHADER_UNIFORM_TYPE_FLOAT4:e.uniform4f(t.location,t.value.x,t.value.y,t.value.z,t.value.w);break;case SHADER_UNIFORM_TYPE_INT1:e.uniform1i(t.location,t.value);break;case SHADER_UNIFORM_TYPE_INT2:e.uniform2i(t.location,t.value.x,t.value.y);break;case SHADER_UNIFORM_TYPE_INT3:e.uniform3i(t.location,t.value.x,t.value.y,t.value.z);break;case SHADER_UNIFORM_TYPE_INT4:e.uniform4i(t.location,t.value.x,t.value.y,t.value.z,t.value.w);break;case SHADER_UNIFORM_TYPE_FLOATV1:e.uniform1fv(t.location,t.value);break;case SHADER_UNIFORM_TYPE_FLOATV2:e.uniform2fv(t.location,t.value);break;case SHADER_UNIFORM_TYPE_FLOATV3:e.uniform3fv(t.location,t.value);break;case SHADER_UNIFORM_TYPE_FLOATV4:e.uniform4fv(t.location,t.value);break;case SHADER_UNIFORM_TYPE_INTV1:e.uniform1iv(t.location,t.value);break;case SHADER_UNIFORM_TYPE_INTV2:e.uniform2iv(t.location,t.value);break;case SHADER_UNIFORM_TYPE_INTV3:e.uniform3iv(t.location,t.value);break;case SHADER_UNIFORM_TYPE_INTV4:e.uniform4iv(t.location,t.value);break;case SHADER_UNIFORM_TYPE_MATRIX2:e.uniformMatrix2fv(t.location,!1,t.value._data);break;case SHADER_UNIFORM_TYPE_MATRIX3:e.uniformMatrix3fv(t.location,!1,t.value._data);break;case SHADER_UNIFORM_TYPE_MATRIX4:e.uniformMatrix4fv(t.location,!1,t.value._data);break;case SHADER_UNIFORM_TYPE_TEXTURE0:e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t.value);break;case SHADER_UNIFORM_TYPE_TEXTURE1:e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,t.value);break;case SHADER_UNIFORM_TYPE_TEXTURE2:e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,t.value);break;case SHADER_UNIFORM_TYPE_TEXTURE3:e.activeTexture(e.TEXTURE3),e.bindTexture(e.TEXTURE_2D,t.value);break;case SHADER_UNIFORM_TYPE_TEXTURE4:e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,t.value);break;case SHADER_UNIFORM_TYPE_TEXTURE5:e.activeTexture(e.TEXTURE5),e.bindTexture(e.TEXTURE_2D,t.value);break;case SHADER_UNIFORM_TYPE_TEXTURE6:e.activeTexture(e.TEXTURE6),e.bindTexture(e.TEXTURE_2D,t.value);break;case SHADER_UNIFORM_TYPE_TEXTURE7:e.activeTexture(e.TEXTURE7),e.bindTexture(e.TEXTURE_2D,t.value)}}},DIRTY_TRANSLATION=1,DIRTY_SCALE=2,DIRTY_ROTATION=4,DIRTY_UV=8,DIRTY_CONTENT_SIZE=16,DIRTY_COLOR=32,DIRTY_WORLD_MATRIX=64,DIRTY_ANCHOR=128,d.prototype={constructor:d,dispose:function(){for(var t=0;t<this._children.length;++t)this._children[t].dispose()},addChild:function(t){t._parent!==this&&(t._parent&&t._parent.removeChild(t),this._children.push(t),t._parent=this)},removeChild:function(t){if(t._parent===this)for(var e=0;e<this._children.length;++e)this._children[e]===t&&(this._children.splice(e,1),t._parent=null,t.dispose())},getLocalMatrix:function(){return this._local_matrix=o(this.position),0===this.rotation.x&&0===this.rotation.y&&0===this.rotation.z||(this._rotation_matrix=_(this.rotation),this._local_matrix.multiply(this._rotation_matrix)),1===this.scale.x&&1===this.scale.y&&1===this.scale.z||(this._scalar_matrix=s(this.scale),this._local_matrix.multiply(this._scalar_matrix)),this._dirty_flags&=~(DIRTY_TRANSLATION|DIRTY_SCALE|DIRTY_ROTATION),this._local_matrix},getWorldMatrix:function(t){return(t||this._dirty_flags&DIRTY_WORLD_MATRIX)&&(this._parent?(this._world_matrix.setTo(this._parent.getWorldMatrix()),this._world_matrix.multiply(this.getLocalMatrix())):this._world_matrix.setTo(this.getLocalMatrix()),this._dirty_flags&=~DIRTY_WORLD_MATRIX),this._world_matrix},render:function(t,e,i){if(this.visible){i&&this.getWorldMatrix(i);for(var r=0;r<this._children.length;++r)this._children[r].render(t,e,this._need_update_flag||i);this._need_update_flag=!1}},hittest:function(t){return!1}},BK_SPRITE_UV_ROTATE_NONE=0,BK_SPRITE_UV_ROTATE_CW_90=1,BK_SPRITE_UV_ROTATE_CW_180=2,BK_SPRITE_UV_ROTATE_CW_270=3,BK_SPRITE_UV_ROTATE_CCW_90=4,BK_SPRITE_UV_ROTATE_CCW_180=5,BK_SPRITE_UV_ROTATE_CCW_270=6,BK_BLEND_MODE_ADDITIVE=0,BK_BLEND_MODE_MULTIPLY=1,BK_BLEND_MODE_INTERPOLATIVE=2,BK_BLEND_MODE_SCREEN=3,c.prototype=Object.create(d.prototype),c.prototype.constructor=c,c.prototype.dispose=function(){var t=bkWebGLGetInstance();this._tex&&this._tex.need_delete&&(t.deleteTexture(this._tex.texture),this._tex=null),this._vbo&&(t.deleteBuffer(this._vbo),t.deleteBuffer(this._ibo),this._vbo=null,this._ibo=null),d.prototype.dispose.call(this)},c.prototype.setTexture=function(t){void 0!==this._tex&&this._tex.need_delete&&bkWebGLGetInstance().deleteTexture(this._tex.texture),this._tex=t,t?(this._tex_width=t.width,this._tex_height=t.height):(this._tex_width=0,this._tex_height=0)},c.prototype.adjustTexturePosition=function(t,e,i,r,n){n?(this._origin_tex_uv[0].x=(t+r)/this._tex_width,this._origin_tex_uv[0].y=(e+i)/this._tex_height,this._origin_tex_uv[1].x=(t+r)/this._tex_width,this._origin_tex_uv[1].y=e/this._tex_height,this._origin_tex_uv[2].x=t/this._tex_width,this._origin_tex_uv[2].y=e/this._tex_height,this._origin_tex_uv[3].x=t/this._tex_width,this._origin_tex_uv[3].y=(e+i)/this._tex_height):(this._origin_tex_uv[0].x=t/this._tex_width,this._origin_tex_uv[0].y=e/this._tex_height,this._origin_tex_uv[1].x=(t+i)/this._tex_width,this._origin_tex_uv[1].y=e/this._tex_height,this._origin_tex_uv[2].x=(t+i)/this._tex_width,this._origin_tex_uv[2].y=(e+r)/this._tex_height,this._origin_tex_uv[3].x=t/this._tex_width,this._origin_tex_uv[3].y=(e+r)/this._tex_height),this.dirty(DIRTY_UV)},c.prototype.render=function(t,e,i){if(this.visible){if(i&&this.getWorldMatrix(i),this._vbo||(this._vbo=t.createBuffer(),this._ibo=t.createBuffer(),this._indices=new Uint16Array([0,3,1,1,3,2]),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this._ibo),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this._indices,t.STATIC_DRAW)),this._dirty_flags&DIRTY_UV){var r=1;this._stretch_x||0===this._content_size.width||0===this._tex_width||(r=this._content_size.width/this._tex_width);var n=1;this._stretch_y||0===this._content_size.height||0===this._tex_height||(n=this._content_size.height/this._tex_height);var o=this._origin_tex_uv.slice(0);this.flip_u&&(o=[o[1],o[0],o[3],o[2]]),this.flip_v&&(o=[o[3],o[2],o[1],o[0]]),this._uv_rotate===BK_SPRITE_UV_ROTATE_CW_90||this._uv_rotate===BK_SPRITE_UV_ROTATE_CCW_270?o=[o[3],o[0],o[1],o[2]]:this._uv_rotate===BK_SPRITE_UV_ROTATE_CW_270||this._uv_rotate===BK_SPRITE_UV_ROTATE_CW_270?o=[o[1],o[2],o[3],o[0]]:this._uv_rotate!==BK_SPRITE_UV_ROTATE_CW_180&&this._uv_rotate!==BK_SPRITE_UV_ROTATE_CCW_180||(o=[o[2],o[3],o[0],o[1]]),this._vertices[7]=r*o[0].x,this._vertices[8]=n*o[0].y,this._vertices[16]=r*o[1].x,this._vertices[17]=n*o[1].y,this._vertices[25]=r*o[2].x,this._vertices[26]=n*o[2].y,this._vertices[34]=r*o[3].x,this._vertices[35]=n*o[3].y,this._dirty_flags&=~DIRTY_UV}if(i||this._dirty_flags&(DIRTY_CONTENT_SIZE|DIRTY_WORLD_MATRIX|DIRTY_ANCHOR)){var s=this.getWorldMatrix(i),h={x:-this._content_size.width*this._anchor.x,y:this._content_size.height*(1-this._anchor.y)},_={x:this._content_size.width*(1-this._anchor.x),y:this._content_size.height*(1-this._anchor.y)},l={x:-this._content_size.width*this._anchor.x,y:-this._content_size.height*this._anchor.y},c={x:this._content_size.width*(1-this._anchor.x),y:-this._content_size.height*this._anchor.y},h=s.multiplyXY(h),_=s.multiplyXY(_),l=s.multiplyXY(l),c=s.multiplyXY(c);this._vertices[0]=h.x,this._vertices[1]=h.y,this._vertices[9]=_.x,this._vertices[10]=_.y,this._vertices[18]=c.x,this._vertices[19]=c.y,this._vertices[27]=l.x,this._vertices[28]=l.y,this._dirty_flags&=~(DIRTY_CONTENT_SIZE|DIRTY_ANCHOR)}if(this._dirty_flags&DIRTY_COLOR){var u=this.color.a,f=this.color.r*u,g=this.color.g*u,m=this.color.b*u;this._vertices[3]=f,this._vertices[4]=g,this._vertices[5]=m,this._vertices[6]=a,this._vertices[12]=f,this._vertices[13]=g,this._vertices[14]=m,this._vertices[15]=a,this._vertices[21]=f,this._vertices[22]=g,this._vertices[23]=m,this._vertices[24]=a,this._vertices[30]=f,this._vertices[31]=g,this._vertices[32]=m,this._vertices[33]=a,this._dirty_flags&=~DIRTY_COLOR}t.bindBuffer(t.ARRAY_BUFFER,this._vbo),t.bufferData(t.ARRAY_BUFFER,this._vertices,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this._ibo),e.set_uniform("Texture",this._tex.texture),e.bind(),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),d.prototype.render.call(this,t,e,i)}},c.prototype.hittest=function(t){var e=this.getWorldMatrix(),i=e.multiplyXY({x:-this._content_size.width*this._anchor.x,y:-this._content_size.height*this._anchor.y}),r=e.multiplyXY({x:this._content_size.width*(1-this._anchor.x),y:this._content_size.height*(1-this._anchor.y)});return t.x>=i.x&&t.x<=r.x&&t.y>=i.y&&t.y<=r.y},u.prototype=Object.create(c.prototype),u.prototype.constructor=u,u.prototype.addTouchListener=function(){"undefined"!=typeof UIEventHandler?(UIEventHandler.addNodeEvent(this,1,function(t,e,i,r){t.isCancelClick=!1,t.enable?t.changeStatus(1):t.changeStatus(2)}.bind(this)),UIEventHandler.addNodeEvent(this,2,function(t,e,i,r){var n={x:i,y:r};0==t.hittest(n)&&(t.isCancelClick=!0)}.bind(this)),UIEventHandler.addNodeEvent(this,3,function(t,e,i,r){t.enable?t.changeStatus(0):t.changeStatus(2),0==t.isCancelClick&&t.touchInsideCallback&&1==this.canClick&&t.touchInsideCallback(t)}.bind(this))):BK.Script.log(1,1,"UIEventHandler is undefined")},u.prototype.setTouchInsideCallback=function(t){this.touchInsideCallback=t},u.prototype.dispose=function(){UIEventHandler.removeNodeEvent(this,1),UIEventHandler.removeNodeEvent(this,2),UIEventHandler.removeNodeEvent(this,3),c.prototype.dispose.call(this)},u.prototype.changeStatus=function(t){this.touchStatus=t,this.updateTexture(t)},u.prototype.updateTexture=function(t){},g.prototype={constructor:g,setHidden:function(t){this._root_node?this._root_node.hidden=t:BK.Script.log(1,1,"set hidden error.root_node is null")},dispose:function(){this._is_webgl?(this._root_node.dispose(),this._root_node=void 0,this.webGL_exit()):this._root_node.removeFromParent()},_onTouchInside:function(){BK.Script.log(1,1,"_onTouchInside"),this._clickInsideCallback&&this._clickInsideCallback()},setClickContentCallback:function(t){this._clickInsideCallback=t},create_texture:function(t,e){if(this._is_webgl){var i=this._gl,r=i.RGBA,n=i.RGBA,a=i.UNSIGNED_BYTE,o=BK.Image.loadImage(t,6),s=i.createTexture();return i.bindTexture(i.TEXTURE_2D,s),i.texImage2D(i.TEXTURE_2D,0,r,n,a,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),{width:o.width,height:o.height,texture:s,tex_file:t,need_delete:e}}return new BK.Texture(t)},create_clip_node:function(t,r){if(this._is_webgl){e()&&(r.x+=.5*BK.Director.screenPixelSize.width,r.y=i());var n=new d;return this._clip_rect=r,t.addChild(n),n}return(n=new BK.ClipRectNode(r.x,r.y,r.width,r.height)).enableClip=!0,t.addChild(n),n},create_node:function(t){if(this._is_webgl){e=new d;return void 0!==t?t.addChild(e):this._gl_root_node.addChild(e),e}var e=new BK.Node;return void 0!==t?t.addChild(e):BK.Director.root.addChild(e),e},create_sprite:function(t,e,i,r){var n=this.create_texture(e,r);return this.create_sprite_with_texture(t,n,i)},create_button:function(t,e,i,r){if(this._is_webgl){var n=new u(i.width,i.height,e,0,1,1,1);return r&&n.setTouchInsideCallback(r),void 0!==t?t.addChild(n):this._gl_root_node.addChild(n),n}return(n=new BK.Button(i.width,i.height)).setNormalTexture(e),n.updateTexture=function(){},r&&n.setTouchInsideCallback(r),void 0!==t?t.addChild(n):BK.Director.root.addChild(n),n},create_sprite_with_texture:function(t,e,i){if(this._is_webgl){r=new c(i.width,i.height,e,0,1,1,1);return void 0!==t?t.addChild(r):this._gl_root_node.addChild(r),r}var r=new BK.Sprite(i.width,i.height,e,0,1,1,1);return void 0!==t?t.addChild(r):BK.Director.root.addChild(r),r},create_text:function(t,e){if(this._is_webgl){var i=new BK.CanvasNode(t.maxWidth,t.maxHeight);i.fillColor=t.textColor,i.strokeColor=t.strokeColor,i.setTextAlign(t.textAlign),i.setTextSize(t.fontSize),i.setTextItalic(t.italic),i.setTextBold(t.bold),i.setTextShadow(t.shadowDx,t.shadowDy,t.shadowRadius,t.shadowColor);var r=i.measureText(e,t.maxWidth,t.maxHeight);i.drawText(e,0,0,r.width,r.height);var n=i.getBitmap(),a=this._gl,o=a.RGBA,s=a.RGBA,h=a.UNSIGNED_BYTE,_=a.createTexture();a.bindTexture(a.TEXTURE_2D,_),a.texImage2D(a.TEXTURE_2D,0,o,s,h,n),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);var l={width:n.width,height:n.height,texture:_,tex_file:e,need_delete:!0},d=new c(n.width,n.height,l,0,1,1,1);return d.anchor={x:0,y:0},d.width=r.width,d.height=r.height,d}return t.textColor=f(t.textColor),t.strokeColor=f(t.strokeColor),t.shadowColor=f(t.shadowColor),new BK.TextNode(t,e)},show:function(t){if(!this._is_webgl){var i=BK.Director.root.scale;this._root_node.scale={x:1/i.x,y:1/i.y,z:1/i.z},this._root_node.enableClip=e()}void 0!==this._real_content_node&&this._content_node.removeChild(this._real_content_node),this._real_content_node=this.create_node(this._content_node),void 0!==t.content&&t.content.length>20&&(t.content=t.content.substring(0,20),t.content=t.content+"...");var r=this._ad_final_size[t.ad_type];switch(t.ad_type){case AD_BANNER_TYPE_DYNAMIC_193_582_166:case AD_BANNER_TYPE_STATIC_193_582_166:(g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0)).anchor={x:0,y:1};break;case AD_BANNER_TYPE_DYNAMIC_194_147_147:case AD_BANNER_TYPE_STATIC_194_147_147:(g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0)).anchor={x:0,y:1};var n=15*STANDARD_SCALE,a=0;a=t.ad_type===AD_BANNER_TYPE_DYNAMIC_194_147_147?(m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-r.width-80*STANDARD_SCALE-n:(m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)-r.width-2*n;var o=26,s=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:a,maxHeight:30*STANDARD_SCALE,width:a,height:30*STANDARD_SCALE,textAlign:0,bold:1,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.title);s.position={x:r.width+n,y:-50*STANDARD_SCALE},this._real_content_node.addChild(s),(p=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.4,g:.4,b:.4,a:1},maxWidth:a,maxHeight:60*STANDARD_SCALE,width:a,height:60*STANDARD_SCALE,textAlign:0,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content)).anchor={x:0,y:1},p.position={x:r.width+n,y:-65*STANDARD_SCALE},this._real_content_node.addChild(p);break;case AD_BANNER_TYPE_DYNAMIC_184_240_180:case AD_BANNER_TYPE_STATIC_184_240_180:(g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0)).anchor={x:0,y:1};var n=15*STANDARD_SCALE,a=0;a=t.ad_type===AD_BANNER_TYPE_DYNAMIC_184_240_180?(m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-r.width-60*STANDARD_SCALE-n:(m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)-r.width-2*n;o=26;(p=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:a,maxHeight:60*STANDARD_SCALE,width:a,height:60*STANDARD_SCALE,textAlign:0,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content)).anchor={x:0,y:1},p.position={x:r.width+n,y:.5*(p.height-r.height)},this._real_content_node.addChild(p);break;case AD_BANNER_TYPE_DYNAMIC_285_240_180_3:case AD_BANNER_TYPE_STATIC_285_240_180_3:var h=23*STANDARD_SCALE,_=0,l=0,d=3*STANDARD_SCALE;t.ad_type===AD_BANNER_TYPE_STATIC_285_240_180_3&&(h=11*STANDARD_SCALE,_=11*STANDARD_SCALE,l=-6*STANDARD_SCALE,d=4*STANDARD_SCALE);var c=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0);c.anchor={x:0,y:1},c.position={x:_,y:l};var u=this.create_sprite(this._real_content_node,t.tex_files[1],r,!0);u.anchor={x:0,y:1},u.position={x:_+r.width+h,y:l};var f=this.create_sprite(this._real_content_node,t.tex_files[2],r,!0);f.anchor={x:0,y:1},f.position={x:_+2*(r.width+h),y:l};a=0;a=t.ad_type===AD_BANNER_TYPE_DYNAMIC_285_240_180_3?(m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-40*STANDARD_SCALE:(m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)-40*STANDARD_SCALE;o=24;(p=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:a,maxHeight:30*STANDARD_SCALE,width:a,height:30*STANDARD_SCALE,textAlign:1,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content)).anchor={x:.5,y:1},p.position={x:.5*a,y:-r.height-d},this._real_content_node.addChild(p);break;case AD_BANNER_TYPE_DYNAMIC_210_640_288:case AD_BANNER_TYPE_STATIC_210_640_288:(g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0)).anchor={x:0,y:1};var n=10*STANDARD_SCALE,a=0;a=t.ad_type===AD_BANNER_TYPE_DYNAMIC_210_640_288?(m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-r.width-50*STANDARD_SCALE-n:(m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)-r.width-2*n;o=24;(p=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:a,maxHeight:120*STANDARD_SCALE,width:a,height:120*STANDARD_SCALE,textAlign:0,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content)).anchor={x:0,y:.5},p.position={x:r.width+n,y:.5*-r.height},this._real_content_node.addChild(p);break;case AD_BANNER_TYPE_DYNAMIC_65_1000_560:case AD_BANNER_TYPE_STATIC_65_1000_560:var g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0);g.anchor={x:0,y:1};var n=10*STANDARD_SCALE,a=0;if(t.ad_type===AD_BANNER_TYPE_DYNAMIC_65_1000_560)a=(m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-r.width-50*STANDARD_SCALE-n;else{var m=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width;a=m-r.width-2*n}var o=26,p=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:a,maxHeight:120*STANDARD_SCALE,width:a,height:120*STANDARD_SCALE,textAlign:0,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content);p.anchor={x:0,y:.5},p.position={x:r.width+n,y:.5*-r.height},this._real_content_node.addChild(p)}var v=t.ad_type>=AD_BANNER_TYPE_DYNAMIC_193_582_166&&t.ad_type<=AD_BANNER_TYPE_DYNAMIC_65_1000_560;this.anim_node_1(v),this.anim_node_2(v,t.ad_type===AD_BANNER_TYPE_STATIC_285_240_180_3?11*STANDARD_SCALE:0,t.ad_type===AD_BANNER_TYPE_STATIC_285_240_180_3?25*STANDARD_SCALE:0),this.anim_node_3(v)},update:function(t){this._node_1.update_tweens(t),this._node_2.update_tweens(t),this._node_3.update_tweens(t)},node_extend:function(t){return t._next_tween_handler=0,t._all_tween_data=[],t.tween_from_to=function(t,e,i,r,n,a,o){var s=this._next_tween_handler;return this._next_tween_handler+=1,this._all_tween_data.push({attr_type:t,duration:e,delay:i,interval:r,from:n,to:a,loop_count:o,pass_time:-i,handler:s,is_stop:!1}),s},t.remove_tween=function(t){for(;0<this._all_tween_data.length;)if(this._all_tween_data[0].handler===t)return void(this._all_tween_data[0].is_stop=!0)},t.update_tweens=function(t){for(var e=0;e<this._all_tween_data.length;){var i=this._all_tween_data[e];if(i.is_stop)this._all_tween_data.splice(e,1);else{if(i.pass_time+=t,i.pass_time>=i.duration)i.pass_time-=i.duration,-1===i.loop_count?(i.pass_time-=i.interval,this.update_tween_value(i,i.to)):(i.loop_count-=1,i.loop_count>=0?(i.pass_time-=i.interval,this.update_tween_value(i,i.to)):(this.update_tween_value(i,i.to),i.is_stop=!0));else if(i.pass_time>0){var r=(i.to-i.from)*(i.pass_time/i.duration)+i.from;this.update_tween_value(i,r)}++e}}},t.update_tween_value=function(t,e){switch(t.attr_type){case NODE_TWEEN_ATTR_TYPE_SCALE:this.scale={x:e,y:e};break;case NODE_TWEEN_ATTR_TYPE_SCALE_X:this.scale={x:e,y:this.scale.y};break;case NODE_TWEEN_ATTR_TYPE_SCALE_Y:this.scale={x:this.scale.x,y:e};break;case NODE_TWEEN_ATTR_TYPE_POSITION_X:this.position={x:e,y:this.position.y};break;case NODE_TWEEN_ATTR_TYPE_POSITION_Y:this.position={x:this.position.x,y:e};break;case NODE_TWEEN_ATTR_TYPE_OPACITY:this.opacity=e;break;case NODE_TWEEN_ATTR_TYPE_ROTATION_X:this.rotation={x:e,y:this.rotation.y,z:this.rotation.z};break;case NODE_TWEEN_ATTR_TYPE_ROTATION_Y:this.rotation={x:this.rotation.x,y:e,z:this.rotation.z};break;case NODE_TWEEN_ATTR_TYPE_ROTATION_Z:this.rotation={x:this.rotation.x,y:this.rotation.y,z:e}}},t},anim_node_1:function(t){if(t){var e={x:.8,y:.2},i=.5*-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width+.4*this._ad_final_size[AD_BANNER_TYPE_RESERVED_0].width,r=0-.7*this._ad_final_size[AD_BANNER_TYPE_RESERVED_0].height;this._node_1.anchor=e,this._node_1.visible=!0,this._node_1.position={x:i,y:r},this._node_1.rotation={x:0,y:0,z:120},this._node_1.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.1,.2,0,r,0,0),this._node_1.tween_from_to(NODE_TWEEN_ATTR_TYPE_ROTATION_Z,.3,.2,0,120,10,0)}else this._node_1.visible=!1},anim_node_2:function(t,e,i){var r={x:.8,y:0},n=(t?this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)*(r.x-.5);this._node_2.position={x:n,y:0},t?(this._node_2.rotation={x:0,y:0,z:120},this._node_2.tween_from_to(NODE_TWEEN_ATTR_TYPE_ROTATION_Z,.3,0,0,120,0,0),this._node_2_1.anchor={x:.5,y:.5},this._node_2_1.size=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1],this._node_2_1.setTexture(this._tex_bg_bg_1),this._node_2_1.position={x:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width*(.5-r.x),y:.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height},this._content_node.position={x:20*STANDARD_SCALE-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width*r.x,y:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height-6*STANDARD_SCALE},this._node_2_2.anchor={x:.5,y:.5},this._node_2_2.setTexture(this._tex_bg_fg_1),this._node_2_2.size=this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_1],this._node_2_2.position={x:this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_1].width*(.5-r.x),y:.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_1].height}):(this._node_2.rotation={x:0,y:0,z:0},this._node_2_1.anchor={x:.5,y:.5},this._node_2_1.size=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2],this._node_2_1.setTexture(this._tex_bg_bg_2),this._node_2_1.position={x:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width*(.5-r.x),y:.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].height},this._content_node.position={x:-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width*r.x,y:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].height},this._node_2_2.anchor={x:0,y:0},this._node_2_2.size=this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_2],this._node_2_2.setTexture(this._tex_bg_fg_2),this._node_2_2.position={x:5*STANDARD_SCALE+this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width*-r.x+e,y:5*STANDARD_SCALE+i})},anim_node_3:function(t){if(t){var e={x:.5,y:.5},i=.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width+.15*this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].width,r=.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height-.1*this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].height,n=.3*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width,a=-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height,o=Math.sqrt((i-n)*(i-n)+(r-a)*(r-a)),s={x:(i-n)/o,y:(r-a)/o},h=i+this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].width*s.x*.2,_=r+this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].height*s.y*.2,l=i-this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].width*s.x*.1,d=r-this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].height*s.y*.1;this._node_3.anchor=e,this._node_3.visible=!0,this._node_3.position={x:n,y:a},this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_X,.3,.1,0,n,h,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.3,.1,0,a,_,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_X,.15,.4,0,h,l,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.15,.4,0,_,d,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_ROTATION_Z,.15,.4,0,0,5,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_X,.08,.55,0,l,i,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.08,.55,0,d,r,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_ROTATION_Z,.08,.55,0,5,0,0)}else this._node_3.visible=!1},gl_commit:function(t){var e=t._gl;UIEventHandler&&UIEventHandler.setRootNode(t._root_node),t.webGL_save(),e.viewport(0,0,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height),e.disable(e.DEPTH_TEST),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);var i=n(0,BK.Director.screenPixelSize.width,0,BK.Director.screenPixelSize.height,-1,1);t._webgl_shader.set_uniform("Projection",i);var a=new r;t._webgl_shader.set_uniform("ModelView",a),t._gl_root_node.render(e,t._webgl_shader,!0),t.webGL_restore(),e.superGLCommit()},webGL_init:function(){this._gl=bkWebGLGetInstance(),this._gl_root_node=new d,this._webgl_shader=this.webGL_load_shader(),this._gl.superGLCommit=this._gl.glCommit,this._gl.glCommit=this.gl_commit.bind(this._gl,this)},webGL_load_shader:function(){var t=new r,e={vs_source:"attribute vec3 Position;attribute vec4 SourceColor;varying vec4 DestinationColor;uniform mat4 Projection;uniform mat4 ModelView;attribute vec2 TexCoordIn;varying vec2 TexCoordOut;void main(void) { DestinationColor = SourceColor; mat4 mp = Projection * ModelView; gl_Position = mp * vec4(Position, 1.0); TexCoordOut = TexCoordIn;}",fs_source:"varying lowp vec4 DestinationColor;varying lowp vec2 TexCoordOut;uniform sampler2D Texture;void main(void) { lowp vec4 tc = texture2D(Texture, TexCoordOut); gl_FragColor = DestinationColor * tc;}",attributes:[{name:"Position",size:3},{name:"SourceColor",size:4},{name:"TexCoordIn",size:2}],uniforms:[{name:"Projection",type:SHADER_UNIFORM_TYPE_MATRIX4,default_value:t},{name:"ModelView",type:SHADER_UNIFORM_TYPE_MATRIX4,default_value:t},{name:"Texture",type:SHADER_UNIFORM_TYPE_TEXTURE0,default_value:0}]};return new l(this._gl,e)},webGL_exit:function(){void 0!==this._gl.superGLCommit&&(this._gl.glCommit=this._gl.superGLCommit,this._gl.superGLCommit=void 0),this._tex_bg_left&&(this._gl.deleteTexture(this._tex_bg_left.texture),this._gl.deleteTexture(this._tex_bg_bg_1.texture),this._gl.deleteTexture(this._tex_bg_bg_2.texture),this._gl.deleteTexture(this._tex_bg_fg_1.texture),this._gl.deleteTexture(this._tex_bg_fg_2.texture),this._gl.deleteTexture(this._tex_bg_right.texture))},webGL_save:function(){e()&&(this._is_clip_enabled=this._gl.glIsEnabled(this._gl.SCISSOR_TEST),this._is_clip_enabled?this._old_scissor=this._gl.glGetParameterInt(this._gl.SCISSOR_BOX,4):this._gl.glEnable(this._gl.SCISSOR_TEST),this._gl.glScissor(this._clip_rect.x,this._clip_rect.y,this._clip_rect.width,this._clip_rect.height)),this._is_enable_blend=this._gl.glIsEnabled(this._gl.BLEND),this._is_enable_blend&&(this._blend_color=this._gl.glGetParameterFloat(this._gl.BLEND_COLOR,4),this._blend_equation_rgb=this._gl.getParameter(this._gl.BLEND_EQUATION_RGB),this._blend_equation_alpha=this._gl.getParameter(this._gl.BLEND_EQUATION_ALPHA),this._blend_src_rgb=this._gl.getParameter(this._gl.BLEND_SRC_RGB),this._blend_src_alpha=this._gl.getParameter(this._gl.BLEND_SRC_ALPHA),this._blend_dst_rgb=this._gl.getParameter(this._gl.BLEND_DST_RGB),this._blend_dst_alpha=this._gl.getParameter(this._gl.BLEND_DST_ALPHA)),this._prevVP=this._gl.glGetParameterInt(this._gl.VIEWPORT,4),this._prevVBO=this._gl.glGetParameterInt(this._gl.ARRAY_BUFFER_BINDING,1),this._prevIBO=this._gl.glGetParameterInt(this._gl.ELEMENT_ARRAY_BUFFER_BINDING,1),this._prevProgram=this._gl.glGetParameterInt(this._gl.CURRENT_PROGRAM,1),this._prevTextureID=this._gl.glGetParameterInt(this._gl.TEXTURE_BINDING_2D,1),this._prevTextureUnit=this._gl.glGetParameterInt(this._gl.ACTIVE_TEXTURE,1),this._prevFrameBuffer=this._gl.glGetParameterInt(this._gl.FRAMEBUFFER_BINDING,1),this._prevRenderBuffer=this._gl.glGetParameterInt(this._gl.RENDERBUFFER_BINDING,1),this._activeAttribusInfo=[];for(var t=this._gl.glGetProgramParameter(this._prevProgram,gl.ACTIVE_ATTRIBUTES),i=0;i<t;++i){var r=this._gl.getActiveAttrib(this._prevProgram,i),n=r.name,a=this._gl.getAttribLocation(this._prevProgram,n),o=this._gl.getVertexAttrib(a,this._gl.VERTEX_ATTRIB_ARRAY_SIZE),s=this._gl.getVertexAttrib(a,this._gl.VERTEX_ATTRIB_ARRAY_TYPE),h=this._gl.getVertexAttrib(a,this._gl.VERTEX_ATTRIB_ARRAY_NORMALIZED),_=this._gl.getVertexAttrib(a,this._gl.VERTEX_ATTRIB_ARRAY_STRIDE),l=this._gl.getVertexAttribOffset(a,gl.VERTEX_ATTRIB_ARRAY_POINTER);if(r.name=n,r.index=a,r.size=o,r.type=s,r.normalized=h,r.stride=_,r.offset=l,void 0!==this._gl.recordVertexAttribPointer)for(var d=0;d<this._gl.recordVertexAttribPointer.length;d++){var c=this._gl.recordVertexAttribPointer[d];if(r.index==c.index&&r.type==c.type&&r.stride==c.stride&&r.offset==c.offset){r.index=c.index,r.size=c.size,r.type=c.type,r.normalized=c.normalized,r.stride=c.stride,r.offset=c.offset;break}}this._activeAttribusInfo.push(r)}},webGL_restore:function(){if(this._is_enable_blend?(this._gl.glEnable(this._gl.BLEND),this._gl.blendColor(this._blend_color[0],this._blend_color[1],this._blend_color[2],this._blend_color[3]),this._gl.blendEquationSeparate(this._blend_equation_rgb,this._blend_equation_alpha),this._gl.blendFuncSeparate(this._blend_src_rgb,this._blend_dst_rgb,this._blend_src_alpha,this._blend_dst_alpha)):this._gl.glDisable(this._gl.BLEND),this._gl.viewport(this._prevVP[0],this._prevVP[1],this._prevVP[2],this._prevVP[3]),this._gl.useProgram(this._prevProgram),this._gl.bindBuffer(this._gl.ARRAY_BUFFER,this._prevVBO),this._activeAttribusInfo.length>0){this._activeAttribusInfo[0].stride;for(var t=0;t<this._activeAttribusInfo.length;t++){var i=this._activeAttribusInfo[t],r=(i.name,i.index),n=i.size,a=i.type,o=i.normalized,s=i.offset,h=i.stride,_=0!=o;this._gl.vertexAttribPointer(r,n,a,_,h,s,!0)}}this._activeAttribusInfo=[],this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,this._prevIBO),this._gl.activeTexture(this._prevTextureUnit),this._gl.bindTexture(this._gl.TEXTURE_2D,this._prevTextureID),this._gl.glBindFramebuffer(this._gl.FRAMEBUFFER,this._prevFrameBuffer),this._gl.glBindRenderbuffer(this._gl.RENDERBUFFER,this._prevRenderBuffer),e()&&(this._is_clip_enabled?this._gl.glScissor(this._old_scissor[0],this._old_scissor[1],this._old_scissor[2],this._old_scissor[3]):this._gl.glDisable(this._gl.SCISSOR_TEST))}},{AdAnimateBanner:g}}().AdAnimateBanner)}(BK);var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();!function(t,e){"object"==typeof t&&(t.AdAnimateBannerHandler=function(){var t=function(){function t(t,e){this.info=t,this.download(e)}return t.prototype.download=function(t){var e="GameSandBox://__bkDownloadCache/"+BK.Crypt.hex_md5(this.info.url);this.info.savePath&&(e=this.info.savePath);var i=!0;if(1==(!!this.info.useCache&&this.info.useCache)&&1==BK.FileUtil.isFileExist(e)){i=!1;var r={url:this.info.url,statueCode:200,savePath:e};t(r)}1==i&&new BK.HttpUtil(this.info.url).requestAsync(function(i,r){200==r?BK.FileUtil.writeBufferToFile(e,i):BK.Script.log(1,1,"Fetch banner image failed.url:"+this.info.url);var n={url:this.info.url,statueCode:r,savePath:e};t(n)}.bind(this))},t}(),e=function(){function e(){}return e.download=function(e,i){this.completeTasks=[],this.reqTasks=e;for(var r=0;r<e.length;r++){var n=e[r];new t(n,function(t){this.completeTasks.push(t),this.check()&&i(this.completeTasks)}.bind(this))}BK.Director.ticker.setTimeout(function(){this.fillUncomplete(),i(this.completeTasks)}.bind(this),3e4,this)},e.cancelTimeOut=function(){BK.Director.ticker.removeTimeout(this)},e.fillUncomplete=function(){for(var t=0;t<this.reqTasks.length;t++){for(var e=this.reqTasks[t],i=!1,r=0;r<this.completeTasks.length;r++){var n=this.completeTasks[r];e.url==n.url&&(i=!0)}if(0==i){var a={url:e.url,statueCode:-1,savePath:e.savePath};this.completeTasks.push(a)}}},e.check=function(){return this.completeTasks.length==this.reqTasks.length&&(this.cancelTimeOut(),!0)},e}();return{AdAnimateBannerHandler:function(t){function i(e,i){var r=t.call(this,e,i)||this;return r.bannerContentInfo=r.parseInfo(r.adInfo),r.banner=null,r}return __extends(i,t),i.prototype.setHidden=function(t){this.banner?this.banner.setHidden(t):BK.Script.log(1,1,"set hidden fail ,this.banner is null")},i.prototype.show=function(t){this.bannerType=1,this._show(function(e,i,r){if(0==e)if(void 0!==this.bannerContentInfo.staticBannerType){this.banner=new BK.AdAnimateBanner(i),this.bannerContentInfo.ad_type=this.bannerContentInfo,this.bannerContentInfo.tex_files=r;var n={ad_type:this.bannerContentInfo.staticBannerType,tex_files:r,title:this.bannerContentInfo.title,content:this.bannerContentInfo.content};this.banner.setClickContentCallback(this._onClickContentCallback.bind(this)),this.banner.show(n),this._onShowCallback(),t(e,"show ok",this)}else t(-1,"show failed",null);else t(e,"show _show failed",null)}.bind(this))},i.prototype.showAnimate=function(t){this.bannerType=2,this._show(function(e,i,r){if(0==e)if(void 0!==this.bannerContentInfo.dynamicBannerType){this.banner=new BK.AdAnimateBanner(i),this.bannerContentInfo.ad_type=this.bannerContentInfo,this.bannerContentInfo.tex_files=r;var n={ad_type:this.bannerContentInfo.dynamicBannerType,tex_files:r,title:this.bannerContentInfo.title,content:this.bannerContentInfo.content};this.banner.setClickContentCallback(this._onClickContentCallback.bind(this)),this.banner.show(n),this._onShowCallback(),t(e,"showAnimate ok",this)}else t(-1,"fshowAnimate ailed",null);else t(e,"showAnimate _show failed",null)}.bind(this))},i.prototype._onShowCallback=function(){this.cmshowReport(1,"","",this.bannerType.toString()),this.exposeureReport()},i.prototype._jumpToGDTDestPage=function(){var t=this.adInfo;BK.MQQ.SsoRequest.send(t,"cs.xy_ad_banner_jump.local")},i.prototype._onClickContentCallback=function(){this.cmshowReport(3,"","",this.bannerType.toString()),this.clickReport(),1==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")||"android"===GameStatusInfo.platform?this._onClickContentBtn():(this._emmitClickEvent(),this._jumpToGDTDestPage())},i.prototype._show=function(t){if(!this.bannerContentInfo)return BK.Script.log(1,1,"show failed.ad info is illegal!"),void t(-2,null,null);this.loadRes(function(e,i){0==e?this.loadImage(function(e,r){t(e,i,r)}.bind(this)):t(-1,null,null)}.bind(this))},i.prototype.close=function(){this.banner?(this.banner.dispose(),this.banner=null):BK.Script.log(1,1,"close banner failed. banner has not been inited!")},i.prototype.loadImage=function(t){for(var i=[],r=0;r<this.bannerContentInfo.image.length;r++){var n={url:this.bannerContentInfo.image[r]};i.push(n)}e.download(i,function(e){for(var r=!0,n=[],a=0;a<i.length;a++)for(var o=i[a],s=0;s<e.length;s++){var h=e[s];o.url==h.url&&(200!=h.statueCode?(BK.Script.log(1,1,"banner load image failed.url:"+h.url),r=!1):n.push(h.savePath))}t(1==r?0:-1,n)}.bind(this))},i.prototype.loadRes=function(t){e.download([{url:"https://qzonestyle.gtimg.cn/aoi/sola/20180713161350_Jwn4D4m83k.png",savePath:"GameSandBox://_bkAd/bg_left.png",useCache:!0},{url:"https://qzonestyle.gtimg.cn/aoi/sola/20180713161350_A8Q8Sow7O2.png",savePath:"GameSandBox://_bkAd/bg_right.png",useCache:!0},{url:"https://qzonestyle.gtimg.cn/aoi/sola/20180713161350_ufpiWlVIBh.png",savePath:"GameSandBox://_bkAd/bg_bg_2.png",useCache:!0},{url:"https://qzonestyle.gtimg.cn/aoi/sola/20180713161350_bb7MoaVYPP.png",savePath:"GameSandBox://_bkAd/bg_fg_2.png",useCache:!0},{url:"https://qzonestyle.gtimg.cn/aoi/sola/20180713161349_490ORk1ziJ.png",savePath:"GameSandBox://_bkAd/bg_fg_1.png",useCache:!0},{url:"https://qzonestyle.gtimg.cn/aoi/sola/20180713161349_I3ZMMhw8al.png",savePath:"GameSandBox://_bkAd/bg_bg_1.png",useCache:!0}],function(e){for(var i="",r="",n="",a="",o="",s="",h=!0,_=0;_<e.length;_++){var l=e[_];200!=l.statueCode&&(h=!1),l.savePath.indexOf("bg_bg_1")>0?n=l.savePath:l.savePath.indexOf("bg_bg_2")>0?a=l.savePath:l.savePath.indexOf("bg_fg_1")>0?o=l.savePath:l.savePath.indexOf("bg_fg_2")>0?s=l.savePath:l.savePath.indexOf("bg_left")>0?i=l.savePath:l.savePath.indexOf("bg_right")>0&&(r=l.savePath)}t(1==h?0:-1,{bg_left_path:i,bg_right_path:r,bg_bg_1_path:n,bg_bg_2_path:a,bg_fg_1_path:o,bg_fg_2_path:s})}.bind(this))},i.prototype.parseInfo=function(t){var e=t.display_info.creative_size;this.creativeSize=e;var i={creative_size:e,content:"",title:""};switch(e){case 193:i.image=[t.display_info.basic_info.img],i.staticBannerType=6,i.dynamicBannerType=0;break;case 194:i.image=[t.display_info.basic_info.img],i.title=t.display_info.basic_info.txt,i.content=t.display_info.basic_info.desc,i.staticBannerType=7,i.dynamicBannerType=1;break;case 285:i.image=t.display_info.muti_pic_text_info.image,i.content=t.display_info.basic_info.txt,i.staticBannerType=9,i.dynamicBannerType=3;break;case 184:i.image=[t.display_info.basic_info.img],i.content=t.display_info.basic_info.txt,i.staticBannerType=8,i.dynamicBannerType=2;break;case 210:i.image=[t.display_info.basic_info.img],i.content=t.display_info.basic_info.txt,i.staticBannerType=10,i.dynamicBannerType=4;break;case 65:i.image=[t.display_info.basic_info.img],i.content=t.display_info.basic_info.txt,i.staticBannerType=11,i.dynamicBannerType=5;break;default:return BK.Script.log(1,1,"parseInfo failed."),null}return i},i}(BK.AdBannerHandler)}}().AdAnimateBannerHandler)}(BK)}!function(t,e){t.Crypt=function(){function t(){this.hexcase=0,this.b64pad="",this.chrsz=8}return t.prototype.hex_md5=function(t){return this.bin2hex(this.core_md5(this.str2bin(t),t.length*this.chrsz))},t.prototype.b64_md5=function(t){return this.bin2b64(this.core_md5(this.str2bin(t),t.length*this.chrsz))},t.prototype.str_md5=function(t){return this.bin2str(this.core_md5(this.str2bin(t),t.length*this.chrsz))},t.prototype.hex_hmac_md5=function(t,e){return this.bin2hex(this.core_hmac_md5(t,e))},t.prototype.b64_hmac_md5=function(t,e){return this.bin2b64(this.core_hmac_md5(t,e))},t.prototype.str_hmac_md5=function(t,e){return this.bin2str(this.core_hmac_md5(t,e))},t.prototype.md5_vm_test=function(){return"900150983cd24fb0d6963f7d28e17f72"==this.hex_md5("abc")},t.prototype.core_md5=function(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var i=1732584193,r=-271733879,n=-1732584194,a=271733878,o=0;o<t.length;o+=16){var s=i,h=r,_=n,l=a;i=this.md5_ff(i,r,n,a,t[o+0],7,-680876936),a=this.md5_ff(a,i,r,n,t[o+1],12,-389564586),n=this.md5_ff(n,a,i,r,t[o+2],17,606105819),r=this.md5_ff(r,n,a,i,t[o+3],22,-1044525330),i=this.md5_ff(i,r,n,a,t[o+4],7,-176418897),a=this.md5_ff(a,i,r,n,t[o+5],12,1200080426),n=this.md5_ff(n,a,i,r,t[o+6],17,-1473231341),r=this.md5_ff(r,n,a,i,t[o+7],22,-45705983),i=this.md5_ff(i,r,n,a,t[o+8],7,1770035416),a=this.md5_ff(a,i,r,n,t[o+9],12,-1958414417),n=this.md5_ff(n,a,i,r,t[o+10],17,-42063),r=this.md5_ff(r,n,a,i,t[o+11],22,-1990404162),i=this.md5_ff(i,r,n,a,t[o+12],7,1804603682),a=this.md5_ff(a,i,r,n,t[o+13],12,-40341101),n=this.md5_ff(n,a,i,r,t[o+14],17,-1502002290),r=this.md5_ff(r,n,a,i,t[o+15],22,1236535329),i=this.md5_gg(i,r,n,a,t[o+1],5,-165796510),a=this.md5_gg(a,i,r,n,t[o+6],9,-1069501632),n=this.md5_gg(n,a,i,r,t[o+11],14,643717713),r=this.md5_gg(r,n,a,i,t[o+0],20,-373897302),i=this.md5_gg(i,r,n,a,t[o+5],5,-701558691),a=this.md5_gg(a,i,r,n,t[o+10],9,38016083),n=this.md5_gg(n,a,i,r,t[o+15],14,-660478335),r=this.md5_gg(r,n,a,i,t[o+4],20,-405537848),i=this.md5_gg(i,r,n,a,t[o+9],5,568446438),a=this.md5_gg(a,i,r,n,t[o+14],9,-1019803690),n=this.md5_gg(n,a,i,r,t[o+3],14,-187363961),r=this.md5_gg(r,n,a,i,t[o+8],20,1163531501),i=this.md5_gg(i,r,n,a,t[o+13],5,-1444681467),a=this.md5_gg(a,i,r,n,t[o+2],9,-51403784),n=this.md5_gg(n,a,i,r,t[o+7],14,1735328473),r=this.md5_gg(r,n,a,i,t[o+12],20,-1926607734),i=this.md5_hh(i,r,n,a,t[o+5],4,-378558),a=this.md5_hh(a,i,r,n,t[o+8],11,-2022574463),n=this.md5_hh(n,a,i,r,t[o+11],16,1839030562),r=this.md5_hh(r,n,a,i,t[o+14],23,-35309556),i=this.md5_hh(i,r,n,a,t[o+1],4,-1530992060),a=this.md5_hh(a,i,r,n,t[o+4],11,1272893353),n=this.md5_hh(n,a,i,r,t[o+7],16,-155497632),r=this.md5_hh(r,n,a,i,t[o+10],23,-1094730640),i=this.md5_hh(i,r,n,a,t[o+13],4,681279174),a=this.md5_hh(a,i,r,n,t[o+0],11,-358537222),n=this.md5_hh(n,a,i,r,t[o+3],16,-722521979),r=this.md5_hh(r,n,a,i,t[o+6],23,76029189),i=this.md5_hh(i,r,n,a,t[o+9],4,-640364487),a=this.md5_hh(a,i,r,n,t[o+12],11,-421815835),n=this.md5_hh(n,a,i,r,t[o+15],16,530742520),r=this.md5_hh(r,n,a,i,t[o+2],23,-995338651),i=this.md5_ii(i,r,n,a,t[o+0],6,-198630844),a=this.md5_ii(a,i,r,n,t[o+7],10,1126891415),n=this.md5_ii(n,a,i,r,t[o+14],15,-1416354905),r=this.md5_ii(r,n,a,i,t[o+5],21,-57434055),i=this.md5_ii(i,r,n,a,t[o+12],6,1700485571),a=this.md5_ii(a,i,r,n,t[o+3],10,-1894986606),n=this.md5_ii(n,a,i,r,t[o+10],15,-1051523),r=this.md5_ii(r,n,a,i,t[o+1],21,-2054922799),i=this.md5_ii(i,r,n,a,t[o+8],6,1873313359),a=this.md5_ii(a,i,r,n,t[o+15],10,-30611744),n=this.md5_ii(n,a,i,r,t[o+6],15,-1560198380),r=this.md5_ii(r,n,a,i,t[o+13],21,1309151649),i=this.md5_ii(i,r,n,a,t[o+4],6,-145523070),a=this.md5_ii(a,i,r,n,t[o+11],10,-1120210379),n=this.md5_ii(n,a,i,r,t[o+2],15,718787259),r=this.md5_ii(r,n,a,i,t[o+9],21,-343485551),i=this.safe_add(i,s),r=this.safe_add(r,h),n=this.safe_add(n,_),a=this.safe_add(a,l)}return Array(i,r,n,a)},t.prototype.md5_cmn=function(t,e,i,r,n,a){return this.safe_add(this.rol(this.safe_add(this.safe_add(e,t),this.safe_add(r,a)),n),i)},t.prototype.md5_ff=function(t,e,i,r,n,a,o){return this.md5_cmn(e&i|~e&r,t,e,n,a,o)},t.prototype.md5_gg=function(t,e,i,r,n,a,o){return this.md5_cmn(e&r|i&~r,t,e,n,a,o)},t.prototype.md5_hh=function(t,e,i,r,n,a,o){return this.md5_cmn(e^i^r,t,e,n,a,o)},t.prototype.md5_ii=function(t,e,i,r,n,a,o){return this.md5_cmn(i^(e|~r),t,e,n,a,o)},t.prototype.core_hmac_md5=function(t,e){var i=this.str2bin(t);i.length>16&&(i=this.core_md5(i,t.length*this.chrsz));for(var r=Array(16),n=Array(16),a=0;a<16;a++)r[a]=909522486^i[a],n[a]=1549556828^i[a];var o=this.core_md5(r.concat(this.str2bin(e)),512+e.length*this.chrsz);return this.core_md5(n.concat(o),640)},t.prototype.hex_sha1=function(t){return this.bin2hex(this.core_sha1(this.str2bin(t),t.length*this.chrsz))},t.prototype.b64_sha1=function(t){return this.bin2b64(this.core_sha1(this.str2bin(t),t.length*this.chrsz))},t.prototype.str_sha1=function(t){return this.bin2str(this.core_sha1(this.str2bin(t),t.length*this.chrsz))},t.prototype.hex_hmac_sha1=function(t,e){return this.bin2hex(this.core_hmac_sha1(t,e))},t.prototype.b64_hmac_sha1=function(t,e){return this.bin2b64(this.core_hmac_sha1(t,e))},t.prototype.str_hmac_sha1=function(t,e){return this.bin2str(this.core_hmac_sha1(t,e))},t.prototype.sha1_vm_test=function(){return"a9993e364706816aba3e25717850c26c9cd0d89d"==this.hex_sha1("abc")},t.prototype.core_sha1=function(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var i=Array(80),r=1732584193,n=-271733879,a=-1732584194,o=271733878,s=-1009589776,h=0;h<t.length;h+=16){for(var _=r,l=n,d=a,c=o,u=s,f=0;f<80;f++){i[f]=f<16?t[h+f]:this.rol(i[f-3]^i[f-8]^i[f-14]^i[f-16],1);var g=this.safe_add(this.safe_add(this.rol(r,5),this.sha1_ft(f,n,a,o)),this.safe_add(this.safe_add(s,i[f]),this.sha1_kt(f)));s=o,o=a,a=this.rol(n,30),n=r,r=g}r=this.safe_add(r,_),n=this.safe_add(n,l),a=this.safe_add(a,d),o=this.safe_add(o,c),s=this.safe_add(s,u)}return Array(r,n,a,o,s)},t.prototype.sha1_ft=function(t,e,i,r){return t<20?e&i|~e&r:t<40?e^i^r:t<60?e&i|e&r|i&r:e^i^r},t.prototype.sha1_kt=function(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514},t.prototype.core_hmac_sha1=function(t,e){var i=this.str2bin(t);i.length>16&&(i=this.core_sha1(i,t.length*this.chrsz));for(var r=Array(16),n=Array(16),a=0;a<16;a++)r[a]=909522486^i[a],n[a]=1549556828^i[a];var o=this.core_sha1(r.concat(this.str2bin(e)),512+e.length*this.chrsz);return this.core_sha1(n.concat(o),672)},t.prototype.safe_add=function(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i},t.prototype.rol=function(t,e){return t<<e|t>>>32-e},t.prototype.str2bin=function(t){for(var e=Array(),i=(1<<this.chrsz)-1,r=0;r<t.length*this.chrsz;r+=this.chrsz)e[r>>5]|=(t.charCodeAt(r/this.chrsz)&i)<<24-r%32;return e},t.prototype.bin2str=function(t){for(var e="",i=(1<<this.chrsz)-1,r=0;r<32*t.length;r+=this.chrsz)e+=String.fromCharCode(t[r>>5]>>>24-r%32&i);return e},t.prototype.bin2hex=function(t){for(var e=this.hexcase?"0123456789ABCDEF":"0123456789abcdef",i="",r=0;r<4*t.length;r++)i+=e.charAt(t[r>>2]>>8*(3-r%4)+4&15)+e.charAt(t[r>>2]>>8*(3-r%4)&15);return i},t.prototype.bin2b64=function(t){for(var e="",i=0;i<4*t.length;i+=3)for(var r=(t[i>>2]>>8*(3-i%4)&255)<<16|(t[i+1>>2]>>8*(3-(i+1)%4)&255)<<8|t[i+2>>2]>>8*(3-(i+2)%4)&255,n=0;n<4;n++)8*i+6*n>32*t.length?e+=this.b64pad:e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>6*(3-n)&63);return e},new t}()}(BK);var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();if(function(t,e){"object"==typeof t&&(t.AdVideoHandler=e().AdVideoHandler,t.AdVideoHandlerNative=e().AdVideoHandlerNative)}(BK,function(){var t=function(){function t(t,e,i,r){this._onStartPlay=function(t){this.event&&this.event.onStartPlay?this.event.onStartPlay(t.code,t.msg):this.log("lack of onStartPlay callback"),this.log("_onStartPlay")},this.hasJump=!1,this.videoType=t;var n="";i.display_info&&i.display_info.button_info&&i.display_info.button_info.length>0&&(n=i.display_info.button_info[0].txt);i.display_info.advertiser_info.corporation_name,i.display_info.advertiser_info.corporate_image_name,i.display_info.advertiser_info.corporate_logo;var a=0;if(i.display_info.button_info.length>0)for(var o=i.display_info.button_info,s=0;s<o.length;s++){var h=o[s];if(void 0!=typeof h.pos){a=h.pos;break}}this.adVideoInfo={pos_id:e,tencent_video_id:i.display_info.video_info.tencent_video_id,creative_size:i.display_info.creative_size,dest_info:i.dest_info,buttonInfo_txt:n,buttonInfo_pos:a,corporation_name:i.display_info.advertiser_info.corporation_name,corporate_image_name:i.display_info.advertiser_info.corporate_image_name,corporate_logo:i.display_info.advertiser_info.corporate_logo,base_info:i.display_info.basic_info.txt,product_type:i.product_type,exposure_url:i.report_info.exposure_url,click_url:i.report_info.click_url,video_preview_url:i.display_info.basic_info.img,pkg_download_schema:i.app_info.pkg_download_schema},this.adVideoInfo.dksjs=Math.random().toString(),this.gameOrientation=r}return t.prototype._onEnterForeground=function(){this.log("_onEnterForeground"),void 0!==this.envType?this._resumeAllMusic():BK.Audio.switch=!1},t.prototype._removeListener=function(){BK.MQQ.SsoRequest.removeListener("sc.game_enter_foreground.local",this),BK.MQQ.SsoRequest.removeListener("sc.apolloGameWebMessage.local",this)},t.prototype._addListener=function(){BK.MQQ.SsoRequest.addListener("sc.game_enter_foreground.local",this,this._onEnterForeground.bind(this))},t.prototype.jump=function(){if(1!=this.hasJump){this.hasJump=!0,this._addListener(),BK.Advertisement.videoCMReport(this.videoType,3),this._pauseAllMusic();var t=this.gameOrientation,e=this.adVideoInfo,i="https://cmshow.qq.com/apollo/html/game-platform/game-ad.html?_wv=4099&_bid=3143&_fv=0&";i=(i=(i=i+"gameOrientation="+(void 0===t?1:t)+"&")+"gameId="+GameStatusInfo.gameId+"&")+"adInfo="+encodeURI(JSON.stringify(e));var r={gameOrientation:t,transparent:1,businessType:2,openId:GameStatusInfo.openId,url:i};BK.MQQ.SsoRequest.addListener("sc.apolloGameWebMessage.local",this,function(t,e,i){0==t&&i.op&&("apolloGamePlatform.endAdVideo"==i.op?i.data?this._onEndAdVideo(i.data):(this._onEndAdVideo(null),BK.Script.log(1,1,"video ad end failed. data.data is null")):"apolloGamePlatform.closeGame"==i.op?i.data?this._onCloseGame(i.data):(this._onCloseGame(null),BK.Script.log(1,1,"video ad close failed. data.data is null")):"apolloGamePlatform.miniGame"==i.op?"number"==typeof i.ggspd&&(BK.Advertisement.ggspd=i.ggspd):"apolloGamePlatform.closeWv"==i.op?(this._onCloseWebView(i.data),this.log("closeWv:"+JSON.stringify(i))):"apolloGamePlatform.startAdVideo"==i.op&&(this._onStartPlay(i.data),this.log("startAdVideo:"+JSON.stringify(i))))}.bind(this)),BK.MQQ.SsoRequest.send(r,"cs.openWebViewWithoutUrl.local")}else this.log("jump failed!Can't call jump twice!")},t.prototype._onCloseWebView=function(t){var e=0;void 0!==t.type&&(0==(e=t.type)?(this._resumeAllMusic(),this._removeListener()):1==e&&(this.envType=1),this.log("_onCloseWebView "+e)),this.event&&this.event.onCloseVideo?this.event.onCloseVideo(t.code,t.msg):this.log("lack of onCloseWebView callback"),this.event.onCloseVideo=null},t.prototype._onMini=function(){},t.prototype._onCloseGame=function(t){t?this.event&&this.event.onCloseGame?t&&t.code?this.event.onCloseGame(t.code,t.msg):this.event.onCloseGame(0,""):this.log("lack of onClose callback"):this.event.onCloseGame(-1,"_onCloseGame failed data is null"),BK.QQ.notifyCloseGame(),this.event.onCloseGame=null},t.prototype._onEndAdVideo=function(t){t?this.event&&this.event.onEndVideo?t.dksjs==this.adVideoInfo.dksjs?this.event.onEndVideo(t.code,t.msg):(BK.Script.log(1,1,"data.dksjs:"+t.dksjs+" this.adInfo[dksjs]:"+this.adVideoInfo.dksjs),this.event.onEndVideo(-1,"end video failed! illegal end viedo")):this.log("lack of onEnd callback"):this.event.onEndVideo(-1,"_onEndAdVideo failed.data is null"),this.event.onEndVideo=void 0},t.prototype._pauseAllMusic=function(){void 0===BK.isBrowser&&BK.Audio.pauseAllBackground()},t.prototype._resumeAllMusic=function(){void 0===BK.isBrowser&&BK.Audio.resumeAllBackground()},t.prototype.setEventCallack=function(t,e,i,r){void 0===this.event?this.event={onCloseGame:t,onEndVideo:e,onCloseVideo:i,onStartPlay:r}:(this.event.onCloseGame=t,this.event.onEndVideo=e,this.event.onCloseVideo=i,this.event.onStartPlay=r)},t.prototype.setEventCallback=function(t,e,i,r){this.setEventCallack(t,e,i,r)},t.prototype.log=function(t){BK.Script.log(1,1,"AdVideoHandler:"+t)},t.prototype.debugLog=function(t){BK.Script.log(0,0,"AdVideoHandler Debug:"+t)},t.prototype.errorLog=function(t){BK.Script.log(1,1,"AdVideoHandler Error:"+t)},t}();return{AdVideoHandler:t,AdVideoHandlerNative:function(t){function e(e,i,r,n){var a=t.call(this,e,i,r,n)||this;return a.CMSHOW_SC_CMD_AD_VIDEO_START="sc.game_ad_video_start.local",a.CMSHOW_SC_CMD_AD_VIDEO_END="sc.game_ad_video_end.local",a.CMSHOW_SC_CMD_AD_VIDEO_CLOSE="sc.game_ad_video_view_close.local",a.CMSHOW_SC_CMD_SHELL_CLOSE="sc.game_shell_close.local",a.CMSHOW_CS_CMD_AD_VIDEO_JUMP="cs.game_ad_video_jump.local",a.CMSHOW_CS_CMD_AD_VIDEO_CLOSE="cs.game_ad_video_close.local",a.posid=i,a.adInfo=r,a}return __extends(e,t),e.prototype.jump=function(){this.addNativeListener(),BK.Advertisement.videoCMReport(this.videoType,3),this._pauseAllMusic(),BK.MQQ.SsoRequest.send(this.adInfo,this.CMSHOW_CS_CMD_AD_VIDEO_JUMP)},e.prototype.close=function(){BK.MQQ.SsoRequest.send({},this.CMSHOW_CS_CMD_AD_VIDEO_CLOSE)},e.prototype.setEventCallack=function(t,e,i,r){void 0===this.event?this.event={onCloseGame:t,onEndVideo:e,onCloseVideo:i,onStartPlay:r}:(this.event.onCloseGame=t,this.event.onEndVideo=e,this.event.onCloseVideo=i,this.event.onStartPlay=r)},e.prototype._startVideo=function(t,e,i){this.event&&this.event.onStartPlay?this.event.onStartPlay(t,""):this.log("lack of onStartPlay callback"),this.log("_onStartPlay")},e.prototype._endVideo=function(t,e,i){this.event&&this.event.onEndVideo?this.event.onEndVideo(t,""):this.log("lack of onEnd callback"),this.log("_endVideo")},e.prototype._closeVideo=function(t,e,i){this._resumeAllMusic(),this.event&&this.event.onCloseVideo?this.event.onCloseVideo(t,""):this.log("lack of onEnd callback"),this.log("_closeVideo"),this.removeNativeListener()},e.prototype._closeGame=function(t,e,i){this.event&&this.event.onCloseGame?this.event.onCloseGame(t,""):this.log("lack of onClose callback"),this.event.onCloseGame=null},e.prototype.removeNativeListener=function(){BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SC_CMD_AD_VIDEO_START,this),BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SC_CMD_AD_VIDEO_END,this),BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SC_CMD_AD_VIDEO_CLOSE,this),BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SC_CMD_SHELL_CLOSE,this)},e.prototype.addNativeListener=function(){BK.MQQ.SsoRequest.addListener(this.CMSHOW_SC_CMD_AD_VIDEO_START,this,this._startVideo.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMSHOW_SC_CMD_AD_VIDEO_END,this,this._endVideo.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMSHOW_SC_CMD_AD_VIDEO_CLOSE,this,this._closeVideo.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMSHOW_SC_CMD_SHELL_CLOSE,this,this._closeGame.bind(this))},e}(t)}}),function(t,e){"object"==typeof t&&(t.Advertisement=function(){return{Advertisement:function(){function t(){}return t.fetch=function(t,e){if(GameStatusInfo.devPlatform){var i=this.getDebugRetData();this.parseQQAdGetRsp(i,e)}else{var r="apollo_router_game.game_ad_linkcmd_get_ad";BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,function(t,i,r){0==t?this.parseQQAdGetRsp(r,e):e(t,"sso respose not 0.",null)}.bind(this));var n={game_id:GameStatusInfo.gameId,posid:t};BK.isBrowser?BK.MQQ.SsoRequest.sendSSO(n,r):BK.MQQ.SsoRequest.send(n,r)}},t.videoCMReport=function(t,e){var i=t.toString(),r=e.toString(),n=GameStatusInfo.openId;BK.QQ.uploadData("enter_SPA",i,r,n,"","")},t.parseQQAdGetRsp=function(t,e){if(0==t.ret)if(t.pos_ads_info.length>0){var i=t.pos_ads_info[0];if(0==i.ret){BK.Script.log(1,1,"fetch ad 广告位id:"+i.pos_id);var r=i.ads_info;r.length>0&&e(0,"OK",r[0])}else BK.Script.log(1,1,"广告位信息返回失败为空 ret:"+i.ret+" msg:"+i.msg),e(-1,"posAdInfo.ret not succeed 0. Detail:"+JSON.stringify(t),null)}else BK.Script.log(1,1,"fetch ad 广告信息为空"),e(-1,"pos_ads_info.length is 0.Detail:"+JSON.stringify(t),null);else BK.Script.log(1,1,"fetch ad failed.ret:"+t.ret+" msg:"+t.msg),e(-1,"fetch ad failed. Detail:"+JSON.stringify(t),null)},t.canReqBanner=function(){var t=!0;return void 0==this.lastBannerReqTs?(this.lastBannerReqTs=BK.Time.timestamp,t):(BK.Time.timestamp-this.lastBannerReqTs>1?(t=!0,this.lastBannerReqTs=BK.Time.timestamp):t=!1,t)},t.fetchBannerAd=function(t){if(0!=this.canReqBanner()){var e="6060137618613664";this.fetch(e,function(i,r,n){if(0==i){if(0==this.bannerCreativeSizeFilter(n))return void t(-1,"ad data is creative is illegal.",null);this.currentAdBannerHandle&&(this.currentAdBannerHandle.close(),this.currentAdBannerHandle=void 0);var a=new BK.AdAnimateBannerHandler(e,n);this.currentAdBannerHandle=a,t(i,r,a)}else t(i,r,null)}.bind(this))}else t(-1,"frequency is limited",null)},t.videoCreativeSizeFilter=function(t){var e=[185,585],i=[185,585,564,565],r=[];return r=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")?e:i,this.createSizeFilter(r,t)},t.bannerCreativeSizeFilter=function(t){var e=[193,65,184,194,210,285];return this.createSizeFilter(e,t)},t.createSizeFilter=function(t,e){var i=-1;if(e&&e.display_info&&e.display_info.creative_size){i=e.display_info.creative_size;for(var r=0;r<t.length;r++){var n=t[r];if(BK.Script.log(1,1,"createSizeFilter:"+n),Math.abs(i-n)<.01)return BK.Script.log(1,1,"compare found:"+i),!0}return BK.Script.log(1,1,"data is error!creative size is not illegal! current:"+i),!1}return BK.Script.log(1,1,"data is error!creative size is not found!"),!1},t.fetchVideoAd=function(t,e){var i="2090532727455152";this.videoCMReport(t,4),this.fetch(i,function(r,n,a){if(a)if(0!=this.videoCreativeSizeFilter(a)){var o=1;a&&a.display_info&&a.display_info.creative_size?185==a.display_info.creative_size?o=3:585==a.display_info.creative_size&&(o=1):BK.Script.log(1,1,"fetch ad has problem.lack of display_info.creative_size property.");var s=1,h=this.getGameConfig();h&&void 0!==h.viewMode&&(s=h.viewMode);var _=!0,l="";if(a.display_info&&a.display_info.video_info&&a.display_info.video_info.tencent_video_id&&"string"==typeof a.display_info.video_info.tencent_video_id&&a.display_info.video_info.tencent_video_id.length>0?_=!0:(_=!1,l="can not find video id"),1==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.0")&&(3!=s&&2!=s||1!=o||(_=!1,l="device oriation compare failed.device :"+s.toString()+" ad:"+o.toString())),1==_)if(0==r){this.videoCMReport(t,5);var d=void 0;d=1==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.0")?new BK.AdVideoHandler(t,i,a,s):new BK.AdVideoHandlerNative(t,i,a,s),e(r,n,d)}else e(r,n,null);else e(-1,"no ads found."+l,null)}else e(-1,"ad data is creative is illegal.",null);else e(-1,"ad data is undefined or null",null)}.bind(this))},t.getGameConfig=function(){if(!BK.isBrowser){var t=BK.FileUtil.readFile("GameRes://gameConfig.json");if(t&&t.length>0){var e=t.readAsString();return JSON.parse(e)}}},t.getDebugRetData=function(){var t=BK.FileUtil.readFile("GameRes://script/demo/data/adBanner285.json");if(t&&t.length>0){var e=t.readAsString();return JSON.parse(e)}return{ret:0,msg:"s",pos_ads_info:[{ret:0,msg:"string",pos_id:"string",ads_info:[{product_type:1,display_info:{pattern_type:1,creative_size:1,animation_effect:1,basic_info:{img:"http://mat1.gtimg.com/ipad/qq_time/imgs/20180505_lixia_base.jpg",img_s:"http://mat1.gtimg.com/ipad/images/time/timelogo.jpg",txt:"广告素材的标题",desc:"广告的详细描述"},button_info:[{txt:"按钮",url:"http://www.qq.com",pos:1}],muti_pic_text_info:{txt:["txt1","txt2"],image:["http://txt2.png","http://txt2.png"],url:["http://txt2.png","http://txt2.png"]},advertiser_info:{corporation_name:"string",corporate_image_name:"string",corporate_logo:"string"},video_info:{video_url:"string",media_duration:30}},report_info:void 0,dest_info:{dest_url_display_type:1,landing_page:"https://www.qq.com",canvas_json:"string",dest_type:1},app_info:void 0}]}],gdt_cookie:"string",busi_cookie:"string"}},t.openAdVideo=function(t,e){var i="https://cmshow.qq.com/apollo/html/game-platform/game-ad.html";i=(i=(i=i+"?gameOrientation="+(void 0===e?1:e)+"&")+"gameId="+GameStatusInfo.gameId+"&")+"adInfo="+JSON.stringify(t);var r={gameOrientation:e,transparent:1,businessType:2,openId:GameStatusInfo.openId,url:i};BK.MQQ.SsoRequest.send(r,"cs.openWebViewWithoutUrl.local")},t.lastBannerReqTs=void 0,t}()}}().Advertisement)}(BK),isBrowser){var __browserMsgHdl={};BK.MQQ.SsoRequest.listenerInfos=[],BK.MQQ.SsoRequest.addListener=function(t,e,i){var r={cmd:t,target:e,callback:i};BK.MQQ.SsoRequest.listenerInfos.forEach(function(r){r.cmd==t&&r.target==e&&(r.callback=i)},this),BK.MQQ.SsoRequest.listenerInfos.push(r)},BK.MQQ.SsoRequest.removeListener=function(t,e){for(var i=BK.MQQ.SsoRequest.listenerInfos.length,r=-1,n=0;n<i;n++){var a=BK.MQQ.SsoRequest.listenerInfos[n];a.cmd==t&&a.target==e&&(r=n)}-1!=r&&BK.MQQ.SsoRequest.listenerInfos.splice(r,1)},__browserMsgHdl.listenerInfos=[],__browserMsgHdl.addListener=function(t,e,i){var r={cmd:t,target:e,callback:i},n=!1;__browserMsgHdl.listenerInfos.forEach(function(r){r.cmd==t&&r.target==e&&(r.callback=i,n=!0)},this),0==n&&__browserMsgHdl.listenerInfos.push(r)},__browserMsgHdl.removeListener=function(t,e){for(var i=__browserMsgHdl.listenerInfos.length,r=-1,n=0;n<i;n++){var a=__browserMsgHdl.listenerInfos[n];a.cmd==t&&a.target==e&&(r=n)}-1!=r&&__browserMsgHdl.listenerInfos.splice(r,1)}}!function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Game=e())}(1==isBrowser?window:BK,function(){var t;!function(t){t[t.load=0]="load",t[t.min=1]="min",t[t.max=2]="max",t[t.share=3]="share",t[t.enterBackground=4]="enterBackground",t[t.enterForeground=5]="enterForeground"}(t||(t={}));var e;return function(t){t[t.native=0]="native",t[t.browser=1]="browser"}(e||(e={})),function(){function t(t){this.CMSHOW_CS_CMD_CLOSE_WND="cs.close_room.local",this.CMSHOW_CS_CMD_SHARE_INFO="cs.game_shell_share_callback.local",this.CMSHOW_SC_CMD_SHELL_PACK_UP="sc.game_shell_pack_up.local",this.CMSHOW_SC_CMD_SHELL_SHARE="sc.game_shell_share.local",this.CMSHOW_SC_CMD_SHELL_SHARE_COMPLETE="sc.share_game_to_friend_result.local",this.CMSHOW_SC_CMD_SHELL_CLOSE="sc.game_shell_close.local",this.CMD_CMSHOW_GAME_ENTER_BACKGROUND="sc.game_enter_background.local",this.CMD_CMSHOW_GAME_ENTER_FORGROUND="sc.game_enter_foreground.local",this.CMD_CMSHOW_GAME_MAXIMIZE="sc.game_maximize.local",this.CMD_CMSHOW_GAME_MINIMIZE="sc.game_minimize.local",this.CMD_CMSHOW_GAME_INIT_GLOBAL_VAR="sc.init_global_var.local",this.CMD_CMSHOW_GAME_NETWORK_CHANGE="sc.network_change.local",this.CMD_CMSHOW_GAME_WEBMESSAGE_HANDLE="sc.web_callback_game.local",this.cfg=t,this.addAllListener(),this.cfg.onLoad&&(!isBrowser||isBrowser&&"undefined"!=typeof GameStatusInfo)&&(this.formatInfo(),this.cfg.onLoad(this,GameStatusInfo.src,GameStatusInfo.roomId))}return t.prototype.formatInfo=function(){GameStatusInfo.gameId&&(GameStatusInfo.gameId=Number(GameStatusInfo.gameId)),GameStatusInfo.isMaster&&(GameStatusInfo.isMaster=Number(GameStatusInfo.isMaster)),GameStatusInfo.roomId&&(GameStatusInfo.roomId=Number(GameStatusInfo.roomId)),GameStatusInfo.gameVersion&&(GameStatusInfo.gameVersion=String(GameStatusInfo.gameVersion)),GameStatusInfo.platform&&(GameStatusInfo.platform=String(GameStatusInfo.platform)),GameStatusInfo.openId&&(GameStatusInfo.openId=String(GameStatusInfo.openId)),GameStatusInfo.QQVer&&(GameStatusInfo.QQVer=String(GameStatusInfo.QQVer)),GameStatusInfo.networkType&&(GameStatusInfo.networkType=Number(GameStatusInfo.networkType)),GameStatusInfo.src&&(GameStatusInfo.src=Number(GameStatusInfo.src))},t.prototype.log=function(t){BK.Script.log(0,0,"Game:"+t)},t.prototype.errorMessage=function(){return this.err.message},t.prototype.errorStacktrace=function(){return this.err.stacktrace},t.prototype.__isBrowser=function(){return isBrowser},t.prototype.platform=function(){return this.__isBrowser()?e.browser:e.native},t.prototype.addAllListener=function(){this.platform()==e.native?(BK.Script.setErrorObserver(function(t,e){this.cfg.onException&&(this.err={message:t,stacktrace:e},this.cfg.onException(this))}.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMD_CMSHOW_GAME_ENTER_BACKGROUND,this,this._onEnterBackground.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMD_CMSHOW_GAME_ENTER_FORGROUND,this,this._onEnterForeground.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMD_CMSHOW_GAME_MAXIMIZE,this,this._onMax.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMD_CMSHOW_GAME_MINIMIZE,this,this._onMin.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMSHOW_SC_CMD_SHELL_SHARE,this,this._onShare.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMSHOW_SC_CMD_SHELL_SHARE_COMPLETE,this,this._onShareComplete.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMSHOW_SC_CMD_SHELL_CLOSE,this,this._onClose.bind(this)),BK.MQQ.SsoRequest.addListener(this.CMD_CMSHOW_GAME_NETWORK_CHANGE,this,this._onNetworkChange.bind(this))):(__browserMsgHdl.addListener(this.CMD_CMSHOW_GAME_ENTER_BACKGROUND,this,this._onEnterBackground.bind(this)),__browserMsgHdl.addListener(this.CMD_CMSHOW_GAME_ENTER_FORGROUND,this,this._onEnterForeground.bind(this)),__browserMsgHdl.addListener(this.CMD_CMSHOW_GAME_MINIMIZE,this,this._onMin.bind(this)),__browserMsgHdl.addListener(this.CMD_CMSHOW_GAME_MAXIMIZE,this,this._onMax.bind(this)),__browserMsgHdl.addListener(this.CMSHOW_SC_CMD_SHELL_SHARE,this,this._onShare.bind(this)),__browserMsgHdl.addListener(this.CMSHOW_SC_CMD_SHELL_SHARE_COMPLETE,this,this._onShareComplete.bind(this)),__browserMsgHdl.addListener(this.CMSHOW_SC_CMD_SHELL_CLOSE,this,this._onClose.bind(this)),__browserMsgHdl.addListener(this.CMD_CMSHOW_GAME_INIT_GLOBAL_VAR,this,this._onInitGlobalVar.bind(this)),__browserMsgHdl.addListener(this.CMD_CMSHOW_GAME_NETWORK_CHANGE,this,this._onNetworkChange.bind(this)),__browserMsgHdl.addListener(this.CMD_CMSHOW_GAME_WEBMESSAGE_HANDLE,this,this._onWebMessageHandle.bind(this)))},t.prototype.removeAllListener=function(){this.platform()==e.native?(BK.Script.setErrorObserver(void 0),BK.MQQ.SsoRequest.removeListener(this.CMD_CMSHOW_GAME_ENTER_BACKGROUND,this),BK.MQQ.SsoRequest.removeListener(this.CMD_CMSHOW_GAME_ENTER_FORGROUND,this),BK.MQQ.SsoRequest.removeListener(this.CMD_CMSHOW_GAME_MAXIMIZE,this),BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SC_CMD_SHELL_PACK_UP,this),BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SC_CMD_SHELL_SHARE,this),BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SC_CMD_SHELL_CLOSE,this),BK.MQQ.SsoRequest.removeListener(this.CMD_CMSHOW_GAME_NETWORK_CHANGE,this)):(__browserMsgHdl.removeListener(this.CMD_CMSHOW_GAME_ENTER_BACKGROUND,this),__browserMsgHdl.removeListener(this.CMD_CMSHOW_GAME_ENTER_FORGROUND,this),__browserMsgHdl.removeListener(this.CMD_CMSHOW_GAME_MAXIMIZE,this),__browserMsgHdl.removeListener(this.CMSHOW_SC_CMD_SHELL_PACK_UP,this),__browserMsgHdl.removeListener(this.CMSHOW_SC_CMD_SHELL_SHARE,this),__browserMsgHdl.removeListener(this.CMSHOW_SC_CMD_SHELL_CLOSE,this),__browserMsgHdl.removeListener(this.CMD_CMSHOW_GAME_INIT_GLOBAL_VAR,this),__browserMsgHdl.removeListener(this.CMD_CMSHOW_GAME_NETWORK_CHANGE,this),__browserMsgHdl.removeListener(this.CMD_CMSHOW_GAME_WEBMESSAGE_HANDLE,this))},t.prototype._onEnterBackground=function(){this.cfg.onEnterBackground&&this.cfg.onEnterBackground(this)},t.prototype._onEnterForeground=function(){this.cfg.onEnterForeground&&this.cfg.onEnterForeground(this)},t.prototype._onMax=function(){this.cfg.onMaximize&&this.cfg.onMaximize(this)},t.prototype._onMin=function(){this.cfg.onMinimize&&this.cfg.onMinimize(this)},t.prototype._generatedefaultSharePic=function(){var t={width:256,height:256,colorDark:{r:0,g:0,b:0,a:1},colorLight:{r:1,g:1,b:1,a:1},correctLevel:2},e="http://cmshow.qq.com/apollo/html/game-platform/scan-game.html?gameId="+GameStatusInfo.gameId.toString()+"&src=203";return BK.QRCode.createQRCodeToFile("GameSandBox://qrcode.png",e,t),"GameSandBox://qrcode.png"},t.prototype._onShare=function(){var t=void 0;if(this.cfg.onShare&&(t=this.cfg.onShare(this)),t||(t={}),void 0===t.localPicPath){var e=t.gameName,i=t.summary;BK.QQ.defaultSharePic(e,i,function(e,i,r){3==i&&(t.localPicPath=r),this.confirmShare(t)}.bind(this))}else this.confirmShare(t)},t.prototype._onShareComplete=function(t,e,i){if(this.cfg.onShareComplete)if(0==i.reqCode){var r=i.ret,n=0==i.isFirstTimeShare,a=i.shareTo;this.cfg.onShareComplete(this,r,a,n)}else this.cfg.onShareComplete(this,t,-1,!1)},t.prototype._onClose=function(){this.cfg.onClose&&this.cfg.onClose(this)},t.prototype.confirmShare=function(t){var i=t||{};i.reqCode=0,this.platform()==e.native?BK.MQQ.SsoRequest.send(i,this.CMSHOW_CS_CMD_SHARE_INFO):BK.MQQ.SsoRequest.sendTo(i,this.CMSHOW_CS_CMD_SHARE_INFO)},t.prototype._onInitGlobalVar=function(t,e,i){void 0!==i.uin&&delete i.uin,GameStatusInfo=i,this.cfg.onLoad&&(this.formatInfo(),this.cfg.onLoad(this,GameStatusInfo.src,GameStatusInfo.roomId))},t.prototype._onNetworkChange=function(t,e,i){this.cfg.onNetworkChange&&(void 0===i.type?BK.Script.log(1,1,"net work change .data is worng!"):this.cfg.onNetworkChange(this,i.type))},t.prototype._onWebMessageHandle=function(t,e,i){this.cfg.onWebMessageHandle&&(void 0===e||void 0===i?BK.Script.log(1,1,"WebMessageHandle data is worng!"):this.cfg.onWebMessageHandle(this,e,i))},t}()}),SandBoxCanvas.prototype.setImagePath=function(t){if(t){this.imagePath=t;var e=new BK.Texture(t);this.__nativeObj.setTexture(e)}},SandBoxCanvas.prototype.getImagePath=function(){return this.imagePath},SandBoxCanvas.prototype.setTexture=function(t){this.__nativeObj.setTexture(t)},SandBoxCanvas.prototype.setFlipXY=function(t,e){this.__nativeObj.setUVFlip(t,e)},SandBoxCanvas.prototype.setUVFlip=function(t,e){this.__nativeObj.setUVFlip(t,e)},SandBoxCanvas.prototype.setUVWrap=function(t,e){this.__nativeObj.setUVWrap(t,e)},SandBoxCanvas.prototype.setXYStretch=function(t,e){this.__nativeObj.setXYStretch(t,e)},SandBoxCanvas.prototype.adjustTexturePosition=function(t,e,i,r,n){this.__nativeObj.adjustTexturePosition(t,e,i,r,n)},SandBoxCanvas.prototype.addChild=function(t){return this.__nativeObj.addChild(t)},SandBoxCanvas.prototype.dispose=function(){return this.__nativeObj.dispose()},SandBoxCanvas.prototype.removeChild=function(t){return this.__nativeObj.removeChild(t)},SandBoxCanvas.prototype.removeChildById=function(t){return this.__nativeObj.removeChildById(t)},SandBoxCanvas.prototype.removeChildByName=function(t){return this.__nativeObj.removeChildByName(t)},SandBoxCanvas.prototype.removeChildByTag=function(t){return this.__nativeObj.removeChildByTag(t)},SandBoxCanvas.prototype.queryChildAtIndex=function(t){return this.__nativeObj.queryChildAtIndex(t)},SandBoxCanvas.prototype.queryChildById=function(t){return this.__nativeObj.queryChildById(t)},SandBoxCanvas.prototype.queryChildByName=function(t){return this.__nativeObj.queryChildByName(t)},SandBoxCanvas.prototype.queryChildByTag=function(t){return this.__nativeObj.queryChildByTag(t)},SandBoxCanvas.prototype.getChildCount=function(){return this.__nativeObj.getChildCount()},SandBoxCanvas.prototype.removeFromParent=function(){return this.__nativeObj.removeFromParent()},SandBoxCanvas.prototype.attachComponent=function(t){return this.__nativeObj.attachComponent(t)},SandBoxCanvas.prototype.detachComponent=function(t){return this.__nativeObj.detachComponent(t)},SandBoxCanvas.prototype.queryComponent=function(t){return this.__nativeObj.queryComponent(t)},SandBoxCanvas.prototype.queryComponentList=function(t){return this.__nativeObj.queryComponentList(t)},SandBoxCanvas.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},SandBoxCanvas.prototype.isEqual=function(t){return this.__nativeObj.isEqual(t)},SandBoxCanvas.prototype.convertToWorldSpace=function(t){return this.__nativeObj.convertToWorldSpace(t)},SandBoxCanvas.prototype.convertToNodeSpace=function(t){return this.__nativeObj.convertToNodeSpace(t)},SandBoxCanvas.prototype.setAtlas=function(t,e){if(this.__nativeObj){BK.CanvasSheetCache.loadSheet(t);var i=BK.CanvasSheetCache.getTexturePathByFilename(e),r=new BK.Texture(i);this.__nativeObj.setTexture(r);var n=BK.CanvasSheetCache.getFrameInfoByFilename(e);this.__nativeObj.adjustTexturePosition(n.frame.x,n.frame.y,n.frame.w,n.frame.h,n.rotated)}return 0},SandBoxCanvas.prototype.useH5Mode=function(){return this.__nativeObj?(this._useH5Mode=1,1==arguments.length?(this._useH5Mode=arguments[0],this.__nativeObj.useH5Mode(arguments[0])):this.__nativeObj.useH5Mode()):0},SandBoxCanvas.prototype.drawCircle=function(){return this.__nativeObj?this.__nativeObj.drawCircle(arguments[0],arguments[1],arguments[2]):0},SandBoxCanvas.prototype.drawEllipse=function(){return this.__nativeObj?this.__nativeObj.drawEllipse(arguments[0],arguments[1],arguments[2],arguments[3]):0},SandBoxCanvas.prototype.drawImage=function(){if(this.__nativeObj){var t=arguments.length;if(9==t)this.__nativeObj.drawImage(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);else if(5==t)this.__nativeObj.drawImage(arguments[0],0,0,0,0,arguments[1],arguments[2],arguments[3],arguments[4]);else{if(3!=t)return;this.__nativeObj.drawImage(arguments[0],0,0,0,0,arguments[1],arguments[2],0,0)}this._innerSetTransform()}return 0},SandBoxCanvas.prototype.fill=function(){return this.__nativeObj?this.__nativeObj.fill():0},SandBoxCanvas.prototype.stroke=function(){return this.__nativeObj?this.__nativeObj.stroke():0},SandBoxCanvas.prototype.rect=function(){return this.__nativeObj?this.__nativeObj.rect(arguments[0],arguments[1],arguments[2],arguments[3]):0},SandBoxCanvas.prototype.fillRect=function(){return this.__nativeObj?this.__nativeObj.fillRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},SandBoxCanvas.prototype.strokeRect=function(){return this.__nativeObj?this.__nativeObj.strokeRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},SandBoxCanvas.prototype.clearRect=function(){return this.__nativeObj?this.__nativeObj.clearRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},SandBoxCanvas.prototype.beginPath=function(){return this.__nativeObj?this.__nativeObj.beginPath():0},SandBoxCanvas.prototype.closePath=function(){return this.__nativeObj?this.__nativeObj.closePath():0},SandBoxCanvas.prototype.moveTo=function(){return this.__nativeObj?this.__nativeObj.moveTo(arguments[0],arguments[1]):0},SandBoxCanvas.prototype.lineTo=function(){return this.__nativeObj?this.__nativeObj.lineTo(arguments[0],arguments[1]):0},SandBoxCanvas.prototype.arcTo=function(){return this.__nativeObj?this.__nativeObj.arcTo(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]):0},SandBoxCanvas.prototype.arc=function(){if(this.__nativeObj){var t=arguments.length;if(5==t)return this.__nativeObj.arc(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]);if(6==t)return this.__nativeObj.arc(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}return 0},SandBoxCanvas.prototype.quadraticCurveTo=function(){return this.__nativeObj?this.__nativeObj.quadraticCurveTo(arguments[0],arguments[1],arguments[2],arguments[3]):0},SandBoxCanvas.prototype.bezierCurveTo=function(){return this.__nativeObj?this.__nativeObj.bezierCurveTo(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]):0},SandBoxCanvas.prototype.save=function(){return this.__nativeObj?this.__nativeObj.save():0},SandBoxCanvas.prototype.restore=function(){return this.__nativeObj?this.__nativeObj.restore():0},SandBoxCanvas.prototype.fillTextWithSize=function(t,e,i,r,n,a,o){if(7==arguments.length){switch(1==n?2-a:a){case 1:e-=.5*r;break;case 2:e-=1*r}switch(o){case 1:t-=.5*i;break;case 2:t-=1*i}var s=new Object;return s.x=t,s.y=e,s.width=Math.min(2048,i),s.height=Math.min(1024,r),s}return 0},SandBoxCanvas.prototype.fillText=function(){if(3==arguments.length){var t=this.measureText(arguments[0],2048,1024),e=arguments[1],i=arguments[2];switch(1==this._useH5Mode?2-this._textBaseLine:this._textBaseLine){case 1:i-=.5*t.height;break;case 2:i-=1*t.height}switch(this._textAlign){case 1:e-=.5*t.width;break;case 2:e-=1*t.width}this.__nativeObj.fillText(arguments[0],e,i,Math.min(2048,t.width),Math.min(1024,t.height)),this._innerSetTransform()}return 0},SandBoxCanvas.prototype.clip=function(){return this.__nativeObj?this.__nativeObj.clip():0},SandBoxCanvas.prototype.isPointInPath=function(){if(this.__nativeObj)return this.__nativeObj.isPointInPath(arguments[0],arguments[1])},SandBoxCanvas.prototype.createImageData=function(){var t=arguments.length;if(this.__nativeObj&&2==t){var e=new BK.Buffer(arguments[0]*arguments[1]*4);return e.__inner_image_width=arguments[0],e.__inner_image_height=arguments[1],e}},SandBoxCanvas.prototype.getImageData=function(){},SandBoxCanvas.prototype.putImageData=function(){var t=arguments.length;if(this.__nativeObj&&3==t){var e=arguments[0],i=arguments[1],r=arguments[2],n=e.__inner_image_width,a=e.__inner_image_height;return this.__nativeObj.putImageData(arguments[0],i,r,n,a)}},SandBoxCanvas.prototype.scale=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. scale :"+arguments[0]+" , "+arguments[1]),this.__nativeObj.scales(arguments[0],arguments[1])},SandBoxCanvas.prototype.scales=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. scales :"+arguments[0]+" , "+arguments[1]),this.__nativeObj.scales(arguments[0],arguments[1])},SandBoxCanvas.prototype.rotate=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. rotate :"+arguments[0]),this.__nativeObj.rotate(arguments[0])},SandBoxCanvas.prototype.translate=function(){if(this.__nativeObj){var t=GameStatusInfo.QQVer.split(".");7==Number(t[0])&&Number(7==t[1]&&Number(t[2])<=5)?(this._tx=arguments[0],this._ty=arguments[1],this._innerSetTransform()):this.__nativeObj.translate(arguments[0],arguments[1])}},SandBoxCanvas.prototype.transform=function(){if(this.__nativeObj)return this.__nativeObj.transforms(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},SandBoxCanvas.prototype.transforms=function(){var t=GameStatusInfo.QQVer.split(".");return Number(t[0])<7||7==Number(t[0])&&Number(t[1])<7?this.__nativeObj.transforms(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]):this.setTransform(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},SandBoxCanvas.prototype.setTransform=function(){if(this.__nativeObj)return this._a=arguments[0],this._b=arguments[1],this._c=arguments[2],this._d=arguments[3],this._tx=arguments[4],this._ty=arguments[5],this.__nativeObj.setTransform(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},SandBoxCanvas.prototype._innerSetTransform=function(){if(this.__nativeObj){var t=GameStatusInfo.QQVer.split(".");if(7==Number(t[0])&&Number(7==t[1]&&Number(t[2])<=5))return this.__nativeObj.setTransform(this._a,this._b,this._c,this._d,this._tx,this._ty)}},SandBoxCanvas.prototype.shadowColor=function(){if(this._shadowColor=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},SandBoxCanvas.prototype.shadowRadius=function(){if(this._shadowRadius=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},SandBoxCanvas.prototype.shadowOffsetX=function(){if(this._shadowOffset.x=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},SandBoxCanvas.prototype.shadowOffsetY=function(){if(this._shadowOffset.y=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},SandBoxCanvas.prototype.clear=function(){if(this.__nativeObj)return this.__nativeObj.clear()},SandBoxCanvas.prototype.getTexture=function(){return null},SandBoxCanvas.prototype.drawText=function(){return this.__nativeObj&&(this.__nativeObj.drawText(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]),this._innerSetTransform()),null},SandBoxCanvas.prototype.setTextSize=function(){return this.__nativeObj?this.__nativeObj.setTextSize(arguments[0]):null},SandBoxCanvas.prototype.setTextAlign=function(){if(this.__nativeObj){switch(arguments[0]){case 0:case 1:case 2:this._textAlign=arguments[0];break;case"left":this._textAlign=0;break;case"center":this._textAlign=1;break;case"right":this._textAlign=2}return this.__nativeObj.setTextAlign(this._textAlign)}return null},SandBoxCanvas.prototype.setTextBold=function(){return this.__nativeObj?this.__nativeObj.setTextBold(arguments[0]):null},SandBoxCanvas.prototype.setTextItalic=function(){return this.__nativeObj?this.__nativeObj.setTextItalic(arguments[0]):null},SandBoxCanvas.prototype.measureText=function(){return this.__nativeObj?this.__nativeObj.measureText(arguments[0],arguments[1],arguments[2]):null},SandBoxCanvas.prototype.updateCanvasTexture=function(){return this.__nativeObj?this.__nativeObj.updateCanvasTexture():null},SandBoxCanvas.prototype.saveTo=function(){return null},SandBoxCanvas.prototype.drawHead=function(){var t=arguments.length;return this.__nativeObj&&4==t&&this.__nativeObj.drawHead(arguments[0],arguments[1],arguments[2],arguments[3]),null},BK.SandBoxCanvas=SandBoxCanvas,BK.Script.log(0,0,"Load SandBoxCanvas.js succeed."),function(t,e){"object"==typeof t&&(t.QQNickCanvas=function(){return function(){function t(t,e,i,r,n){this.__nativeObj=new BK.SandBoxCanvas(e,i),this.maxHeight=2048,this.maxWidth=1024;var a=0,o=0;1==r.useH5Mode&&this.__nativeObj.useH5Mode(),r.x&&(a=r.x),r.y&&(o=r.y),r.fontSize&&this.__nativeObj.setTextSize(r.fontSize),r.textColor&&(this.__nativeObj.fillColor=r.textColor),r.textAlign&&(this.__nativeObj.textAlign=r.textAlign),r.textBaseLine&&(this.__nativeObj.textBaseLine=r.textBaseLine),r.bold&&this.__nativeObj.setTextBold(r.bold),r.italic&&this.__nativeObj.setTextItalic(r.italic),r.strokeColor&&this.__nativeObj.setStrokeColor(r.strokeColor),r.shadowColor&&this.__nativeObj.shadowColor(r.shadowColor),r.shadowRadius&&this.__nativeObj.shadowRadius(r.shadowColor),r.shadowOffsetX&&this.__nativeObj.shadowOffsetX(r.shadowOffsetX),r.shadowOffsetY&&this.__nativeObj.shadowOffsetY(r.shadowOffsetY),r.fontPath&&(this.__nativeObj.fontPath=r.fontPath),this.callback=n,BK.MQQ.Account.drawNick(this.__nativeObj.__nativeObj,t,a,o,this.maxHeight,this.maxWidth,this.__nativeObj._useH5Mode,this.__nativeObj.textBaseLine,this.__nativeObj.textAlign,this.__nativeObj.fillTextWithSize,function(t,e){this.callback(t,e)}.bind(this))}return t.prototype.getNode=function(){return this.__nativeObj},t}()}())}(BK),function(t,e){"object"==typeof t&&(t.QQAvatarCanvas=function(){return function(){function t(t,e,i,r,n,a){this.openid=t,this.__nativeObj=new BK.SandBoxCanvas(e,i),this.post=a,r.isRound&&(this.__nativeObj.beginPath(),this.__nativeObj.arc(e/2,e/2,e/2,0,2*Math.PI),this.__nativeObj.closePath(),this.__nativeObj.clip()),n&&n(),BK.MQQ.Account.drawHead(this.__nativeObj.__nativeObj,t,e,i,function(t,e,i,r){this.post&&this.post(t,e)}.bind(this))}return t}()}())}(BK);
|