qqPlayCore.js 570 KB

1
  1. var qqPlayCoreBuildInfo = { buildPath:'master',version:'3fd501f',creator:'northka',buildTime:'Thu Dec 20 2018 19:45:21 GMT+0800 (GMT+08:00)'};var hasBK=!("object"!=typeof BK),isBrowser=!hasBK;if(isBrowser)"undefined"!=typeof BK==0&&(BK={isBrowser:!0}),function(i){BK.buildInfo={debug:!1,branch:"master",version:"3fd501f",creater:"northka",buildTime:"Thu Dec 20 2018 19:45:07 GMT+0800 (GMT+08:00)"};var r={};function n(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return i[t].call(e.exports,e,e.exports,n),e.l=!0,e.exports}n.m=i,n.c=r,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=49)}({1:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(3),n=function(){function i(){}return i.ssoRequestCallBack=function(t,e,i){r.default.log(0,0,"ssoRequestCallBack cmd:"+e+" errCode:"+t+" data:"+JSON.stringify(i)),__dispatchEvent(t,i.cmd,JSON.stringify(i.data))},i.sendSSO=function(t,e){__browserMsgHdl.addListener("cs.ssoMessage.local",i,i.ssoRequestCallBack),i.send({cmd:e,data:JSON.stringify(t)},"cs.ssoMessage.local")},i.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}):i.sendSSO(t,e)},i.sendWebMessage=function(t,e){i.send({cmd:e,data:JSON.stringify(t)},"sc.web_callback_game.local")},i.addListener=function(t,e,i){__browserMsgHdl.addListener(t,e,i)},i.removeListener=function(t,e){__browserMsgHdl.removeListener(t,e)},i}();e.default=n},10:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(1),n=i(11),o=function(){function o(){}return o.base64ToUint8Array=function(t){var e,i,r,n,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=.75*t.length,h=t.length,l=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var c=new ArrayBuffer(s),u=new Uint8Array(c);for(e=0;e<h;e+=4)i=a.indexOf(t[e]),r=a.indexOf(t[e+1]),n=a.indexOf(t[e+2]),o=a.indexOf(t[e+3]),u[l++]=i<<2|r>>4,u[l++]=(15&r)<<4|n>>2,u[l++]=(3&n)<<6|63&o;return u},o.upload=function(t,e,i){for(var r=1024<t.length?1024:t.length,n=new Uint8Array(r),o=0;o<r/2;o++)n[o]=t[o];for(var a=t.length-r/2;a<t.length;a++)n[a]=t[a];var s=BK.Crypt.core_md5(n,r),h=new Date,l=h.getFullYear()+(h.getMonth()+1<10?0+(h.getMonth()+1):h.getMonth()+1)+h.getDate(),c=e.tmpSecretId,u=e.upLoadPrefUrl.replace(new RegExp("http://","gm"),""),_=e.downloadUrl,d=e.sessionToken,f=e.signature,p=e.signTime,g="/"+GameStatusInfo.gameId+"_"+BK.Crypt.bin2hex(s)+GameStatusInfo.gameId+"_"+l+".png",m="put\n"+g+"\n\nhost="+u+"&x-cos-storage-class=nearline\n",v="sha1\n"+p+"\n"+BK.Crypt.hex_sha1(m)+"\n",S="q-sign-algorithm=sha1&q-ak="+c+"&q-sign-time="+p+"&q-key-time="+p+"&q-header-list=host;x-cos-storage-class&q-url-param-list=&q-signature="+BK.Crypt.hex_hmac_sha1(f,v),b=new XMLHttpRequest;b.onreadystatechange=function(){4==this.readyState&&(200==this.status?(BK.Script.log(0,0," on response res = "+this.status+" "+JSON.stringify(this.HEADERS_RECEIVED)),_.charAt(_.length-1)==g.charAt(0)&&"/"==g.charAt(0)&&(_=_.slice(0,_.length-1)),i(this.status,_+g)):i(this.status,""))},b.open("put","https://"+u+g,!0),b.setRequestHeader("x-cos-storage-class","nearline"),b.setRequestHeader("x-cos-security-token",d),b.setRequestHeader("authorization",S),b.send(t)},o.uploadFromFile=function(t,n){var e="cs.get_file_data.local",i={cmd:e,path:t};n&&(r.removeListener(e,this),r.addListener(e,this,function(t,e,i){var r=o.base64ToUint8Array(i);o.uploadFromBuff(r,n)}),r.send(i,e))},o.uploadFromBuff=function(i,r){n.queryCloudSignature(function(t,e){o.upload(i,e,r)})},o}();e.default=o},11:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,l=i(1),a=i(3),s=i(10),h=i(12);function n(t,e,i){BK.Script.log(1,1,"BK.QQ.reqGetRankList! callback cmd:"+e+" errCode:"+t+" data:"+JSON.stringify(i)),null!=r&&r(t,e,i),l.default.removeListener(o.CMSHOW_SRV_GET_RANK_LIST,o),r=void 0}var c=0,o=function(){function o(){}return o.share=function(t,r){if(t.inner=1,r){var e="sc.share_game_to_friend_result.local";l.default.removeListener(e,o),l.default.addListener(e,o,function(t,e,i){r(t,e,i),o.shareUpload(0==t?0:1),l.default.removeListener(e,o)}.bind(this))}a.default.log(0,0,"share "+JSON.stringify(t)),l.default.send(t,"cs.game_shell_share_callback.local")},o.shareToMQQ=function(t,e,i,r){var n="cs.share_game_result.local",o={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};l.default.send(o,n)},o.getRankList=function(t,e){var i={cmd:o.CMSHOW_SRV_GET_RANK_LIST,from:"default",objType:1,objId:0,busType:3,busId:GameStatusInfo.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)),r=t,BK.MQQ.SsoRequest.removeListener(this.CMSHOW_SRV_GET_RANK_LIST,this),BK.MQQ.SsoRequest.addListener(this.CMSHOW_SRV_GET_RANK_LIST,this,n),BK.MQQ.SsoRequest.sendSSO(i,this.CMSHOW_SRV_GET_RANK_LIST)},o.consumeItems=function(t,o){var e="apollo_game_item.consume_game_items",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};o&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(t,e,i){var r=0===t?i.data.succList:[],n=0===t?i.data.failList:[];o(t,r,n)})),l.default.sendSSO(i,e)},o.getUserGameItems=function(n){var t="apollo_aio_game.get_user_game_items",e={cmd:t,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId};n&&(BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){if(void 0!==i){var r={data:i.data};n(t,e,r)}})),l.default.sendSSO(e,t)},o.buyGameItems=function(t,e,n){void 0===t&&(t=3);var i="apollo_aio_game.buy_game_items",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,curreType:t,itemIdList:e};n&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,e,i){if(null!=i){var r={data:i.data};n(t,e,r)}})),BK.MQQ.SsoRequest.sendSSO(r,i)},o.queryCloudSignature=function(r){var t="cs.fetch_cloud_signature.local",e={cmd:t,now:(new Date).getTime()/1e3-1,delta:600};r&&(BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r(t,i)}),BK.MQQ.SsoRequest.send(e,t))},o.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")},o.shareToArk=function(t,e,i,r,n,o){void 0===n&&(n={}),"boolean"==typeof r&&(r=1==r?1:0);var a="cs.share_game_in_ark.local",s="sc.share_game_to_friend_result.local";"android"==GameStatusInfo.platform&&0==GameStatusInfo.QQVer.indexOf("7.6.0")&&(a="cs.game_shell_share_callback.local");var h={cmd:a,summary:e,picUrl:i,gameId:GameStatusInfo.gameId,roomId:t,gameMode:GameStatusInfo.gameMode,isSelectFriend:r,extendInfo:n};BK.Script.log(0,0,"ShareToArk summary="+h.summary+" roomId="+h.roomId+" gameMode="+h.gameMode+"picUrl="+h.picUrl+" gameId="+h.gameId),o&&(l.default.removeListener(s,this),l.default.addListener(s,this,o)),l.default.send(h,a)},o.shareToArkFromFile=function(i,r,n,t){void 0===n&&(n={}),s.default.uploadFromFile(t,function(t,e){o.shareToArk(i,r,e,!0,n)})},o.shareToArkFromBuff=function(i,r,n,t){s.default.uploadFromBuff(t,function(t,e){200==t&&o.shareToArk(i,r,e,!0,n)})},o.createShortCut=function(t,r){var n=this,e={extendInfo:t||""};if(r){var i="cs.create_xy_shortcut.local";l.default.removeListener(i,this),l.default.addListener(i,this,function(t,e,i){r(t,e,i),l.default.removeListener(e,n)})}l.default.send(e,"cs.create_xy_shortcut.local"),a.default.log(0,0,"createShortCut")},o.fetchOpenKey=function(t){var e="cs.on_get_open_key.local",i={gameId:GameStatusInfo.gameId};t&&(l.default.removeListener(e,this),l.default.addListener(e,this,t)),l.default.send(i,e)},o.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,arkData:i};e&&(l.default.removeListener(r,this),l.default.addListener(r,this,e)),l.default.sendSSO(n,r)},o.uploadScoreWithoutRoom=function(t,e,i){void 0===t&&(t=1);var r="apollo_report_result.single_user_result",n=Math.floor((new Date).getTime()/1e3),o={from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,aioType:1,ts:n.toString(),src:GameStatusInfo.src,mode:t,userData:e.userData,attr:e.attr};i&&(l.default.removeListener(r,this),l.default.addListener(r,this,i)),l.default.sendSSO(o,r)},o.getRankListWithoutRoom=function(t,e,i,r){var n="apollo_router_game.apollo_user_rankinglist_linkcmd_custom_ranking",o=Math.floor((new Date).getTime()/1e3),a={from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,ts:o.toString(),attr:void 0!==t?t:"score",order:void 0!==e?e:1,rankType:void 0!==i?i:0};r&&(l.default.removeListener(n,this),l.default.addListener(n,this,r)),l.default.sendSSO(a,n)},o.qPayPurchase=function(t,e,i,r){var n={gameOrientation:t,transparent:e?1:2,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";l.default.removeListener(o,this),l.default.addListener(o,this,function(t,e,i){0==t&&i.op&&"apolloGamePlatform.buyProps"==i.op&&r(i.data.code,i.data)})}BK.MQQ.SsoRequest.send(n,"cs.openWebViewWithoutUrl.local")},o.getGameItemList=function(t){var e="apollo_aio_game.get_game_itemList",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId};l.default.removeListener(e,this),l.default.addListener(e,this,t),l.default.sendSSO(i,e)},o.rollbackGameItems=function(t,o){var e="apollo_game_item.rollback_game_items",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};o&&(l.default.removeListener(e,this),l.default.addListener(e,this,function(t,e,i){var r=0===t?i.data.succList:[],n=0===t?i.data.failList:[];o(t,r,n)})),l.default.sendSSO(i,e)},o.shareUpload=function(t){var e=t.toString();o.uploadData("clickShowOffButton","",e,"","","")},o.uploadData=function(t,e,i,r,n,o){var a="cs.report_data_2_compass.local",s=GameStatusInfo.gameId;"ios"==GameStatusInfo.platform&&(t=t.toString(),i=i.toString());var h={cmd:a,actionName:t,enter:e,entry:e,result:i,r2:s.toString(),r3:r,r4:n,r5:o};l.default.sendSSO(h,a)},o.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&&(l.default.removeListener(i,this),l.default.addListener(i,this,e)),l.default.send(n,i)},o.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&&(l.default.removeListener(e,this),l.default.addListener(e,this,t)),l.default.send(r,e)},o.reportGameResult=function(t,r){var e="apollo_router_game.apollo_reportcm_linkcmd_game_result";t.gameId=GameStatusInfo.gameId,0<GameStatusInfo.isWhiteUser&&a.default.log(1,1,"reportGameResult :"+t),l.default.removeListener(e,this),l.default.addListener(e,this,function(t,e,i){BK.QQ.checkNewRedPackage(),r&&r(t,e,i)}),l.default.send(t,e)},o.sendB2CRedPacket=function(t,r){var n=this;if(r){var e="sc.send_b2c_redpacket_result.local";l.default.removeListener(e,this),l.default.addListener(e,this,function(t,e,i){r(t,e,i),l.default.removeListener(e,n)})}var i={groupPushData:{gameRedPacketId:1,gameId:GameStatusInfo.gameId,extraInfo:t}};a.default.log(1,1,"sendB2CRedPacket:"+JSON.stringify(i)),l.default.send(i,"cs.send_b2c_redpacket.local"),a.default.log(0,0,"sendB2CRedPacket")},o.isUserInRedPackageActivity=function(){var t=GameStatusInfo.commFlagBits>>1&1&&310!==GameStatusInfo.src;return BK.Script.log(1,1,"redPackage isUserInRedPackageActivity: "+t),t},o.isOpenActivityPage=function(){var t=GameStatusInfo.commFlagBits>>2&1&&310!==GameStatusInfo.src;return BK.Script.log(1,1,"redPackage isOpenActivityPage: "+t),t},o.showRedPackageActivityPage=function(){if(o.isOpenActivityPage()&&0===c){var t="http://cmshow.qq.com/act_apollo/h5_act/gameRedPacket/html/popup.html?game_id="+GameStatusInfo.gameId+"&page=ad&_cwv=1&wv=3&adtag=engine";BK.Script.log(1,0,"redPackage \u6253\u5f00\u6e38\u620f\u6d6e\u5c42 :"+t),h.default.openTransparent(t),c++}},o.checkNewRedPackage=function(){if(o.isUserInRedPackageActivity()){var t={cmd:"apollo_router_light.apollo_activity_linkcmd_query_new_redpacket",gameId:GameStatusInfo.gameId.toString()};BK.MQQ.SsoRequest.send(t,"apollo_router_light.apollo_activity_linkcmd_query_new_redpacket")}},o.onNewRedPackage=function(t,e,i){if(BK.Script.log(1,0,"BK.QQ.onNewRedPackage redPackage errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),0===t)if(i.data&&i.data.redPacket&&i.data.redPacket.actId&&i.data.redPacket.taskId){var r=i.data.redPacket,n="http://cmshow.qq.com/act_apollo/h5_act/gameRedPacket/html/popup.html?game_id="+GameStatusInfo.gameId+"&page=task&task_id="+r.taskId+"&_cwv=1&wv=3&adtag=engine";h.default.openTransparent(n)}else BK.Script.log(1,0,"request new red package redPackage ,\u6ca1\u6709\u65b0\u7ea2\u5305\u4efb\u52a1\u89e6\u53d1");else BK.Script.log(1,0,"request new red package Failed! redPackage ErrCode:"+t)},o.skipGame=function(t,e){var i={xyId:t,extendInfo:e,src:302};l.default.send(i,"cs.create_xy.local");var r=new Date,n=""+r.getFullYear()+(r.getMonth()+1)+r.getDate()+r.getHours();o.uploadData("gameAtoB","302","1",t,n,"")},o.CMSHOW_SRV_GET_RANK_LIST="apollo_router_game.game_rank_linkcmd_get_fri_rank_for_engine",o}();e.default=o},12:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),r=function(){function n(){}return n.open=function(t){o.default.send({url:t},"cs.openWebView.local")},n.closeTransparent=function(t){o.default.send({taskId:t},"cs.closeWebview.local")},n.onMessageHandle=function(){},n.openTransparent=function(t,e,i){void 0===e&&(e=1);var r="cs.openWebViewWithoutUrl.local";i&&(__browserMsgHdl.removeListener(r,n),__browserMsgHdl.addListener(r,n,i)),o.default.send({url:t},r)},n}();e.default=r},3:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function o(){}return o.log=function(t,e,i){"undefined"!=typeof GameStatusInfo&&o.compareVersion(GameStatusInfo.QQVer,"7.6.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:""}))},o.compareVersion=function(t,e){var i=t.split("."),r=e.split("."),n=Number(i[0])-Number(r[0]);return 0==n&&t!=e?o.compareVersion(i.splice(1).join("."),r.splice(1).join(".")):n},o.setErrorObserver=function(){},o}();e.default=r},49:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(50),n=i(10),o=i(51),a=i(11),s=i(3),h=i(1),l=i(12),c=i(52),u=i(53);BK.MQQ={},BK.MQQ.Webview=l.default,BK.MQQ.SsoRequest=h.default,BK.MQQ.Account=r.default,BK.FileUtil=n.default,BK.Script=s.default,BK.Game=o.default,BK.QQ=a.default,BK.Misc=c.default,BK.Room=u.default,window._globalErrorCallback_=function(){}},50:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(1),n=function(){function o(){}return o.accountCallBack=function(t,e,i){var r="0";1===i.nickname?r="1":1===i.avatar&&(r="2");var n=e+"_"+r;o.accountCallBackArr[n]&&(0,o.accountCallBackArr[n])(i.openId,i.data)},o.getNick=function(t,e){o.accountCallBackArr["cs.get_userInfo.local_1"]=e,r.default.addListener("cs.get_userInfo.local",this,this.accountCallBack),r.default.send({openId:t,nickname:1},"cs.get_userInfo.local")},o.getHead=function(t,e){o.accountCallBackArr["cs.get_userInfo.local_2"]=e,r.default.addListener("cs.get_userInfo.local",this,this.accountCallBack),r.default.send({openId:t,avatar:1},"cs.get_userInfo.local")},o.accountCallBackArr={},o}();e.default=n},51:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(1),n=function(){function t(){}return t.close=function(){r.default.sendWebMessage({},"cs.close_room.local")},t.packUp=function(){r.default.sendWebMessage({},"cs.make_room_min.local")},t.getGameStatusInfo=function(r){var t="cs.get_state_info.local";r&&(BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r(t,i)})),BK.MQQ.SsoRequest.send({},t)},t}();e.default=n},52:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){}return t.compQQVersion=function(t,e){for(var i=t.split("."),r=e.split("."),n=Math.min(3,Math.min(i.length,r.length)),o=0;o<n;o++)if(i[o]!=r[o])return i[o]<r[o];return!0},t.qqVerLessthan=function(t,e){for(var i=t.split("."),r=e.split("."),n=Math.min(3,Math.min(i.length,r.length)),o=0;o<n;o++){if(i[o]<r[o])return!0;if(i[o]>r[o])return!1}return!1},t}();e.default=r},53:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.showOneMorePage=function(t,e){var r=[],n=0;if(e&&2===e.length){for(var o=0;o<e.length;o++)n=2!=t&&GameStatusInfo.openId==e[o]?t:2==t?2:2!=t&&GameStatusInfo.openId!=e[o]?1-t:-1;var a={openId:e[i],scoreState:n};BK.Script.log(1,1,"\u73a9\u5bb6\u4fe1\u606f playerInfo:"+JSON.stringify(a)),r.push(a)}var s={scoreState:t,playerInfos:r};BK.Script.log(1,1,"\u518d\u6765\u4e00\u5c40\u6210\u529f data:"+JSON.stringify(s)),BK.MQQ.SsoRequest.send(s,"cs.show_one_more_page.local")},t}();e.default=n}});else{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 for(i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=arguments.callee(t[i]):e[i]=t[i];return e}!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 o=function(t,e,i){this.once=i,this.target=t,this.callback=e};return function(){function t(){this._emits={}}return t.prototype.__emit_get=function(t){return this._emits[t]||(this._emits[t]=new Array),this._emits[t]},t.prototype.__emit_put=function(t,e){this.__emit_get(t).push(e)},t.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},t.prototype.dispose=function(){delete this._emits},t.prototype.on=function(t,e,i,r){if(0==this.__emit_exists(t,e)){var n=new o(e,i,r);this.__emit_put(t,n)}else BK.Script.log(0,0,"BK.bkEmitter.on!has found, event = "+t+", target = "+JSON.stringify(e))},t.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}},t.prototype.offAll=function(e){Object.keys(this._emits).forEach(function(t){this.off(t,e)}.bind(this))},t.prototype.emitAll=function(t,e){for(var i=new Array,r=this.__emit_get(t),n=0;n<r.length;n++){var o={event:t,source:this,target:r[n].target,extras:e};r[n].callback&&r[n].callback(o),1==r[n].once&&i.push(r[n].target)}for(n=0;n<i.length;n++)this.off(t,i[n])},t.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 o={event:t,source:this,target:r[n].target,extras:e};i.push(r[n].target),r[n].callback&&r[n].callback(o)}for(n=0;n<i.length;n++)this.off(t,i[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;0<=e;e--)if(this.records[e].hostname===t){this.records.splice(e,1);break}},t.prototype.start=function(){if(!this.running){this.running=!0;var i=this;BK.Director.ticker.add(function(t,e){i.records.length&&BK.Misc.handleDNSQueryResult()})}},t.prototype.queryIPAddress=function(s,t,e,i){var r=!this.exists(s);if(null==e&&(e=2),null==i&&(i=0),this.update(s,t,e,i),r){var h=this;h.start(),BK.Misc.queryIPAddress(s,function(t,e,i,r){var n=h.query(s,e);if(n)for(var o=n.callbacks,a=0;a<o.length;a++)o[a].call(h,t,e,i,r);h.delete(s)},e,i)}},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(){var u=81920,h=/^HTTP\/1\.([01]) ([0-9]{3})(?: ((?:[\x21-\x7E](?:[\t ]+[\x21-\x7E])*)*))?$/,l=/^([!#$%'*+\-.^_`|~0-9A-Za-z]+):[\t ]*((?:[\x21-\x7E](?:[\t ]+[\x21-\x7E])*)*)[\t ]*$/,c=/^[\t ]+(.*)$/;function i(t){this.onHeaders=void 0,this.onComplete=void 0,this.reinitialize(t)}return i.prototype.reinitialize=function(t){this.execute=this._executeHeader,(this.type=t)===i.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},i.prototype._processHdrLine=function(t){switch(this._state){case 2:if(0===t.length)return void this._headersEnd();if(null===(s=l.exec(t))){if(null===(s=c.exec(t)))return this.execute=this._executeError,this._err=new Error("Malformed header line"),this.execute(this._err),this._err;var e=s[1];0<e.length&&BK.Script.log(1,0,"processHdrLine!extra = "+e)}else{var i=s[1],r=s[2];switch(i.toLowerCase()){case"connection":"close"===(n=r.toLowerCase()).substring(0,5)?this._flags|=4:"keep-alive"===n.substring(0,10)?this._flags|=2:"upgrade"===n.substring(0,7)&&(this._flags|=8);break;case"transfer-encoding":var n;"chunked"===(n=r.toLowerCase()).substring(0,7)&&(this._flags|=1);break;case"upgrade":this._flags|=32;break;case"content-length":var o=parseInt(r,10);if(isNaN(o)||524288<o)return this.execute=this._executeError,this._err=new Error("Bad Content-Length: "+inspect(o)),this.execute(this._err),this._err;this._contentLen=o}var a=this.maxHeaderPairs;(a<=0||++this._nhdrpairs<a)&&(this.headers[i.toLowerCase()]=r)}break;case 1:if(0===t.length)return!0;var s;if(null===(s=h.exec(t)))return this.execute=this._executeError,this._err=new Error("Malformed status line"),this.execute(this._err),this._err;this.httpMinor=parseInt(s[1],10),this.statusCode=parseInt(s[2],10),this.statusText=s[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}},i.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)===this.httpMajor&&9===this.httpMinor||0===this.httpMinor&&0==(2&t))&&(r=!1),0<(16&t))return this.onComplete&&this.onComplete(),void this.reinitialize(this.type);if(this.onHeaders){var o=this.headers;!0===this.onHeaders(this.httpMajor,this.httpMinor,o,this.method,this.url,this.statusCode,this.statusText,i,r)&&(t=this._flags|=64)}i?(this.onComplete&&this.onComplete(),this._state=3):(0===n||0<(64&t)||0==(1&t)&&void 0===n&&!this._needsEOF())&&(this.onComplete&&this.onComplete(),this.reinitialize(this.type))},i.prototype._executeHeader=function(t){for(var e,i,r=0,n=t.length,o=this._seenCR,a=this._buf,s=this._nhdrbytes;r<n;){if(o)if(o=!1,10===t.charCodeAt(r)){if(++r,e=this._processHdrLine(a),a="","object"==typeof e)return this._err=e,this.execute(this._err),e;if(void 0===e&&2!==(l=this._state))return l<3&&r<n?"number"!=typeof(e=this.execute(t.slice(r)))?(this._err=e,this.execute(this._err),e):r+e:(3===l&&this.reinitialize(this.type),r)}else if(a+="\r",u<++s)return this.execute=this._executeError,this._err=new Error("Header size limit exceeded (81920)"),this.execute(this._err),this._err;var h,l;if(!(-1<(h=t.indexOf("\r\n",r)))){var c;if(c=13===t.charCodeAt(n-1)?(o=!0,n-1):n,u<(s+=c-r))return this.execute=this._executeError,this._err=new Error("Header size limit exceeded (81920)"),this.execute(this._err),this._err;a+=t.substring(r,c);break}if(0<(i=h-r)){if(u<(s+=i))return this.execute=this._executeError,this._err=new Error("Header size limit exceeded (81920)"),this.execute(this._err),this._err;a+=t.substring(r,h)}if(r=h+2,e=this._processHdrLine(a),a="","object"==typeof e)return this._err=e,this.execute(this._err),e;if(void 0===e&&2!==(l=this._state))return l<3&&r<n?"number"!=typeof(e=this.execute(t.slice(r)))?(this._err=e,this.execute(this._err),e):r+e:(3===l&&this.reinitialize(this.type),r)}return this._buf=a,this._seenCR=o,this._nhdrbytes=s,n},i.prototype._executeError=function(t){return BK.Script.log(1,0,"_executeError!err = "+t.message),this._err},i.prototype.execute=i.prototype._executeHeader,i.prototype._needsEOF=function(){if(this.type===i.REQUEST)return!1;var t=this.statusCode,e=this._flags;return!(void 0!==t&&(204===t||304===t||1===parseInt(t/100,1))||64&e)&&!(0<(1&e)||null!=this._contentLen)},i.REQUEST=0,i.RESPONSE=1,i}),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 currentRenderMode,glpause,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",checkRenderMode=(BK.QQ=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(){BK.Director.tickerPause()}.bind(this)),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_ENTER_FORGROUND,this,function(){BK.Director.tickerResume()}.bind(this)),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_MINIMIZE,this,function(){GameStatusInfo.platform,renderTicker.paused=!0,glpause=!0,BK.Director.tickerPause()}.bind(this)),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_MAXIMIZE,this,function(){renderTicker.paused=!1,glpause=!1,BK.Director.tickerResume()}.bind(this)),this.queryCloudSignature=function(r){if(BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.3")){if(r){var t=JSON.parse(GameStatusInfo.extInfo),e=t.certInfo.credentials,i=e.tmpSecretId,n=e.sessionToken,o=t.certInfo.upLoadPrefUrl,a=t.certInfo.downLoadPrefUrl,s=new Date,h=(s.getFullYear(),s.getMonth(),s.getMonth(),s.getDate(),s.getTime()/1e3-1),l=h+600,c=h+";"+l,u=BK.Crypt.hex_hmac_sha1(e.tmpSecretKey,c),_={tmpSecretId:i,upLoadPrefUrl:o,downloadUrl:a,sessionToken:n,signature:u,signTime:c};r(0,_)}}else{var s=new Date,h=parseInt(s.getTime()/1e3)-1,_={cmd:CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE,now:h,delta:600};r&&(BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE,this,function(t,e,i){r(t,i)}),BK.MQQ.SsoRequest.send(_,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 o={gameOrientation:t,openId:GameStatusInfo.openId,transparent:n,businessType:1,itemList:i};if(r){var a="sc.apolloGameWebMessage.local";BK.MQQ.SsoRequest.removeListener(a,this),BK.MQQ.SsoRequest.addListener(a,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(o,"cs.openWebViewWithoutUrl.local")},this.consumeItems=function(t,o){var e="apollo_game_item.consume_game_items",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};o&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(t,e,i){var r=[],n=[];0==t&&(r=i.data.succList,n=i.data.failList),o(t,r,n)}.bind(this))),BK.MQQ.SsoRequest.send(i,e)},this.rollbackGameItems=function(t,o){var e="apollo_game_item.rollback_game_items",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};o&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(t,e,i){var r=[],n=[];0==t&&(r=i.data.succList,n=i.data.failList),o(t,r,n)}.bind(this))),BK.MQQ.SsoRequest.send(i,e)},this.shareToMQQ=function(t,e,i,r){var n="cs.share_game_result.local",o={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(o,n)},this.scoreUpload=function(t,e,i){BK.Script.log(1,1,"\u6210\u7ee9\u4e0a\u62a5 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);var e="android"==GameStatusInfo.platform?1:2;1==e&&(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("\u7b49\u5f85\u73a9\u5bb6\u52a0\u5165")},this.notifyGameTipsSomeOneJoinRoom=function(t){this.notifyGameTips(t+"\u52a0\u5165\u623f\u95f4")},this.notifyGameTipsSomeOneLeaveRoom=function(t){this.notifyGameTips(t+"\u79bb\u5f00\u623f\u95f4")},this.notifyGameTipsReady=function(){this.notifyGameTips("\u6e38\u620f\u5373\u5c06\u5f00\u59cb")},this.notifyGameTipsPlaying=function(){this.notifyGameTips("\u6e38\u620f\u8fdb\u884c\u4e2d")},this.notifyGameTipsGameOver=function(){this.notifyGameTips("\u6e38\u620f\u5df2\u7ed3\u675f")},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,o){var a="cs.report_data_2_compass.local",s=this.gameCfg.gameId;"ios"==this.gameCfg.platform&&(t=t.toString(),i=i.toString());var h={cmd:a,actionName:t,enter:e,entry:e,result:i,r2:s.toString(),r3:r,r4:n,r5:o};BK.MQQ.SsoRequest.send(h,a)},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 a={},s={};this.loadPackage=function(t,e,i){if(!GameStatusInfo||"xcode"===GameStatusInfo.devPlatform)return BK.Script.log(1,1,"bk.qq.loadpackage xcode demo ."),e(t,0);var r=GameStatusInfo.QQVer,n=r.split(".");if(Number(n[0])<7||7==Number(n[0])&&Number(n[1])<7||7==Number(n[0])&&7==Number(n[1])&&Number(n[2])<5)return BK.Script.log(1,1,"bk.qq.loadpackage old version before 775 ."),e(t,0);var o={xyId:GameStatusInfo.gameId,packName:t};e&&(a[t]=e),i&&(s[t]=i),BK.MQQ.SsoRequest.send(o,CMSHOW_CS_CMD_LOAD_PACKAGE)},this.onLoadPackageFinish=function(t,e,i){BK.Script.log(0,0,"BK.QQ.onLoadPackageFinish errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),i.packName&&a[i.packName]&&(a[i.packName](i.packName,i.result),a[i.packName]=void 0)},BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_LOAD_PACKAGE,this,this.onLoadPackageFinish.bind(this)),this.onLoadPackagePercentage=function(t,e,i){BK.Script.log(0,0,"BK.QQ.onLoadPackagePercentage errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),i.packName&&s[i.packName]&&(s[i.packName](i.packName,i.percentage),s[i.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,a,s){t&&0<t.length?t.forEach(function(t){var e=t.openId==currentPlayerOpenId;BK.Script.log(1,1,"player.openid="+t.openId+" currentPlayerOpenId="+currentPlayerOpenId);var i=0;a&&a.data&&a.data.avRoomId&&(i=a.data.avRoomId);var r=0;a&&a.data&&a.data.sdkAppId&&(r=a.data.sdkAppId);var n=0;a&&a.data&&a.data.accountType&&(n=a.data.accountType);var o={gameId:this.gameCfg.gameId,openId:t.openId,isCreator:this.gameCfg.isCreator&&t.openId==currentPlayerOpenId?1:0,roomId:this.gameCfg.roomId,resp:a,retcode:s,gameMode:this.gameCfg.gameMode,avRoomId:i,sdkAppId:r,accountType:n,isMine:e,isDisableSendMsg:1};BK.Script.log(0,0,"BK.QQ.notifyJoinroom isDisableSendMsg: "+o.isDisableSendMsg),BK.MQQ.SsoRequest.send(o,CMSHOW_CS_CMD_JOIN_ROOM)},this):BK.Script.log(0,0,"BK.QQ.notifyJoinRoom!newJoinPlayers data error")},this.sendGameMsg=function(){if(this.gameCfg.roomId&&0<this.gameCfg.roomId){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,o){if(BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.3"))this._oldShareToArk(t,e,i,r,n,o);else{var a={summary:e,extendInfo:n,localPicPath:"",picUrl:"",activityId:0,reqCode:1};0==i.indexOf("GameRes://")||0==i.indexOf("GameSandBox://")?a.localPicPath=i:a.picUrl=i,this._share(a,o)}},this._share=function(n,o){if(n.inner=1,n.localPicPath){if(o){var t="sc.share_game_to_friend_result.local";BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){o(t,e,i),this.shareUpload(0==t?0:1),BK.MQQ.SsoRequest.removeListener(e,this)}.bind(this))}BK.Script.log(0,0,"share "+JSON.stringify(n)),BK.MQQ.SsoRequest.send(n,"cs.game_shell_share_callback.local")}else{var e="\u8f7b\u6e38\u620f";n.gameName&&(e=n.gameName);var i="\u4e00\u8d77\u6765\u73a9\u6e38\u620f\u5427~";n.summary&&(i=n.summary),BK.QQ.defaultSharePic(e,i,function(t,e,i){if(o){var r="sc.share_game_to_friend_result.local";BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,function(t,e,i){o(t,e,i),this.shareUpload(0==t?0:1),BK.MQQ.SsoRequest.removeListener(e,this)}.bind(this))}0==t&&(n.localPicPath=i),BK.Script.log(0,0,"share with default pic"+JSON.stringify(n)),BK.MQQ.SsoRequest.send(n,"cs.game_shell_share_callback.local")}.bind(this))}},this.share=function(t,a){this._share(t,function(t,e,i){if(0==t){var r=i.ret,n=i.shareTo,o=1==i.isFirstShare;a(r,n,o)}else a(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,o){"boolean"==typeof r&&(r=1==r?1:0);var a={summary:e,picUrl:i,gameId:this.gameCfg.gameId,roomId:t,gameMode:this.gameCfg.gameMode,isSelectFriend:r,extendInfo:n};if(o){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){o(t,e,i),this.shareUpload(0==t?0:1),BK.MQQ.SsoRequest.removeListener(e,this)}.bind(this))}BK.Script.log(0,0,"ShareToArk summary="+a.summary+" roomId="+a.roomId+" gameMode="+a.gameMode+"picUrl="+a.picUrl+" gameId="+a.gameId),BK.MQQ.SsoRequest.send(a,CMSHOW_CS_CMD_SHARE_IN_ARK)},this.sendB2CRedPacket=function(t,r){if(r){var e="sc.send_b2c_redpacket_result.local";BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(t,e,i){r(t,e,i),BK.MQQ.SsoRequest.removeListener(e,this)}.bind(this))}var i={groupPushData:{gameRedPacketId:1,gameId:GameStatusInfo.gameId,extraInfo:t}};BK.Script.log(1,1,"sendB2CRedPacket:"+JSON.stringify(i)),BK.MQQ.SsoRequest.send(i,"cs.send_b2c_redpacket.local"),BK.Script.log(0,0,"sendB2CRedPacket")},this.createShortCut=function(t,r){var e="";t&&(e=t);var i={extendInfo:e};if(r){var n="cs.create_xy_shortcut.local";BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,function(t,e,i){r(t,e,i),BK.MQQ.SsoRequest.removeListener(e,this)}.bind(this))}BK.MQQ.SsoRequest.send(i,"cs.create_xy_shortcut.local"),BK.Script.log(0,0,"createShortCut")},this.defaultSharePic=function(t,e,i){t||(t="\u8f7b\u6e38\u620f"),e||(e="\u4e00\u8d77\u6765\u73a9\u5427\uff01"),this.generateQRCodeAnd169(t,e,function(t,e){i(t,3,e)}.bind(this),"GameSandBox://shareDefault.png")},this.generateQRCodeAnd169=function(t,e,i,r){this.composeShare(t,e,"GameRes://inviteIcon.png","GameRes://share_logo.png",r,function(t){i(0,t)}.bind(this))},this.composeShare=function(r,n,o,a,s,h){var t="http://i.hudongcdn.com/"+GameStatusInfo.gameId+"/sp_main_16_9.480.jpg",e=new BK.HttpUtil(t),l="",c=this;e.requestAsync(function(t,e){if(200==e){o="GameSandBox://shareImg-"+GameStatusInfo.gameId+".jpg",BK.FileUtil.writeBufferToFile(o,t),o=c.judgeImgSize(o);var i="apollo_game_info.get_base_info";BK.MQQ.SsoRequest.removeListener(i,c),BK.MQQ.SsoRequest.addListener(i,c,function(t,e,i){0==t&&(r=i.data.gameList[0].name),l=c.compseIMG(r,n,o,a,s),BK.MQQ.SsoRequest.removeListener(e,c),h(l)}.bind(c)),BK.MQQ.SsoRequest.send({gameId:[GameStatusInfo.gameId]},"apollo_game_info.get_base_info")}else{var i="apollo_game_info.get_base_info";BK.MQQ.SsoRequest.removeListener(i,c),BK.MQQ.SsoRequest.addListener(i,c,function(t,e,i){o=c.judgeImgSize(o),0==t&&(r=i.data.gameList[0].name),l=c.compseIMG(r,n,o,a,s),BK.MQQ.SsoRequest.removeListener(e,c),h(l)}.bind(c)),BK.MQQ.SsoRequest.send({gameId:[GameStatusInfo.gameId]},"apollo_game_info.get_base_info")}})},this.judgeImgSize=function(t){var e=BK.Image.loadImage(t);if(e){var i=e.height,r=e.width;if(Math.abs(i/r-304/540)<.01)return t}return""},this.compseIMG=function(t,e,i,r,n){var o="GameSandBox://compose.png";n&&(o=n);var a=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),!a)return"";s.drawImage(i,0,0,a.width,a.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();return s.drawImage(h,0,0,256,256,600,64,120,120),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("\u957f\u6309\u626b\u7801\u5373\u73a9",600,28),s.saveTo(o),s.dispose(),o},this.generatePureQRCode=function(t){var e="GameSandBox://qrcode.png";t&&(e=t);var i="http://cmshow.qq.com/apollo/html/game-platform/scan-game.html?gameId="+GameStatusInfo.gameId.toString()+"&src=203";return BK.QRCode.createQRCodeToFile(e,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}),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){null!=this._customGameLogicCallBack&&this._customGameLogicCallBack(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC,this)},this.reqCustomLogic=function(t,e){null!=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)),null!=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)),null!=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)),null!=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)),null!=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=null==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),o={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(o,r)},this.getRankListWithoutRoom=function(t,e,i,r){var n="apollo_router_game.apollo_user_rankinglist_linkcmd_custom_ranking",o=Math.floor((new Date).getTime()/1e3),a={from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,ts:o.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(a,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,r){var e="apollo_router_game.apollo_reportcm_linkcmd_game_result";t.gameId=GameStatusInfo.gameId,0<GameStatusInfo.isWhiteUser&&BK.Script.log(1,1,"reportGameResult :"+t),BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(t,e,i){this.checkNewRedPackage(),r&&r(t,e,i)}.bind(this)),BK.MQQ.SsoRequest.send(t,e)},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(),o=r.getMonth()+1,a=r.getDate(),s=r.getHours(),h=""+n+(o=(""+o).length<2?"0"+o:o)+(a=""+a<2?"0"+a:a)+(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)),CMSHOW_SRV_CHECK_NEW_RED_PACKAGE="apollo_router_light.apollo_activity_linkcmd_query_new_redpacket",GameStatusInfo.commFlagBits||(GameStatusInfo.commFlagBits=0),BK.Script.log(1,1,"redPackage commonFlagBits : "+GameStatusInfo.commFlagBits),this.isUserInRedPackageActivity=function(){var t=GameStatusInfo.commFlagBits>>1&1,e=t&&310!==GameStatusInfo.src;return BK.Script.log(1,1,"redPackage isUserInRedPackageActivity: "+e),e},this.isOpenActivityPage=function(){var t=GameStatusInfo.commFlagBits>>2&1,e=t&&310!==GameStatusInfo.src;return BK.Script.log(1,1,"redPackage isOpenActivityPage: "+e),e},this.showRedPackageActivityPage=function(){BK.Director.ticker.setTimeout(function(){var t="http://cmshow.qq.com/act_apollo/h5_act/gameRedPacket/html/popup.html?game_id="+GameStatusInfo.gameId+"&page=ad&_cwv=1&wv=3&adtag=engine";BK.MQQ.Webview.openTransparent(t)}.bind(this),100,this)},this.checkNewRedPackage=function(){if(this.isUserInRedPackageActivity()){var t={cmd:CMSHOW_SRV_CHECK_NEW_RED_PACKAGE,gameId:GameStatusInfo.gameId.toString()};BK.Script.log(1,1,"redPackage \u53d1\u9001\u65b0\u7ea2\u5305\u68c0\u67e5:"+JSON.stringify(t)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CHECK_NEW_RED_PACKAGE)}},this.onNewRedPackage=function(t,e,i){if(BK.Script.log(0,0,"BK.QQ.onNewRedPackage redPackage errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),0==t)if(i.data&&i.data.redPacket&&i.data.redPacket.actId&&i.data.redPacket.taskId){var r=i.data.redPacket,n="http://cmshow.qq.com/act_apollo/h5_act/gameRedPacket/html/popup.html?game_id="+GameStatusInfo.gameId+"&page=task&task_id="+r.taskId+"&_cwv=1&wv=3&adtag=engine";BK.MQQ.Webview.openTransparent(n)}else BK.Script.log(1,1,"request new red package redPackage ,\u6ca1\u6709\u65b0\u7ea2\u5305\u4efb\u52a1\u89e6\u53d1");else BK.Script.log(1,1,"request new red package Failed! redPackage ErrCode:"+t)}},void(0==currentRenderMode&&(BK.Script.renderMode=1,currentRenderMode=1))),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(e&&32==e.length)for(var r=0;r<32;r++){var n=e.charCodeAt(r);i.writeUint8Buffer(n)}else{for(r=0;r<32;r++)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,o,a,s,h){null==o&&(o=""),null==a&&(a=0),null==s&&(s=0),null==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,o),t.writeUint64Buffer(a),t.writeUint64Buffer(s),t.writeUint64Buffer(h)},this.getHeader=function(t){var e=t.readUint16Buffer(),i=t.readUint16Buffer(),r=t.readUint16Buffer(),n=t.readUint16Buffer(),o=t.readUint32Buffer(),a=new Object;return a.magic=e,a.ver=i,a.stlen=n,a.bodyLen=o,a.seq=r,a},this.getFixedHeader=function(t){var e,i,r=t.readUint16Buffer(),n=t.readUint16Buffer(),o=t.readUint32Buffer(),a=t.readUint64Buffer(),s=t.readUint64Buffer(),h=t.readUint64Buffer();e=this.read32BytesToString(t),i=this.read32BytesToString(t);var l=t.readUint64Buffer(),c=t.readUint64Buffer(),u=t.readUint64Buffer(),_=new Object;return _.fixLen=r,_.cmd=n,_.ret=o,_.date=a,_.gameId=s,_.roomId=h,_.fromId=e,_.toId=i,_.token=l,_.appId=c,_.accessToken=u,_},this.getRequestCommonBuffer=function(t,e,i,r,n,o,a){var s,h,l=0;if(a&&(a.rewind(),l=a.length),h=new BK.Stream(BK.Security.getST()),s=new BK.Stream(fixedHeaderLen+l+n,1),this.addFixedHeader(s,t,e,i,r),0<l)for(var c=0;c<l;c++)s.writeUint8Buffer(a.readUint8Buffer());if(0<n){var u=new BK.Stream(o.bkJSTLVGetBuffer());for(c=0;c<u.length;c++)s.writeUint8Buffer(u.readUint8Buffer())}s=BK.Misc.arrayBufferToBKBuffer(s.data),BK.Security.encrypt(s),s=new BK.Stream(s);var _=new BK.Stream(HeaderLen+s.length+h.length);return this.addHeader(_,s.length,h.length),_.writeBuffer(h),_.writeBuffer(s),_.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(),o=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(o,i.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(i),BK.Script.log(0,0,"match game request buffer : "+o.bufferLength()+" body len:"+i.bufferLength()),o},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(),o=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(o,i.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(i),BK.Script.log(0,0,"query match game request buffer : "+o.bufferLength()+" body len:"+i.bufferLength()),o},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(),o=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(o,i.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(i),BK.Script.log(0,0,"quit match game request buffer : "+o.bufferLength()+" body len:"+i.bufferLength()),o},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 o=n.bufferLength(),a=new BK.Buffer(HeaderLen+r.bufferLength()+o,1);return this.addHeader(a,r.bufferLength(),o),a.writeBuffer(n),a.writeBuffer(r),BK.Script.log(0,0,"create room request buffer : "+a.bufferLength()+" body len:"+r.bufferLength()),a},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=null==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(),o=new BK.Buffer(HeaderLen+e.bufferLength()+n,1);return this.addHeader(o,e.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(e),o},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 "),0<=t&&(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){null==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(),o=n.bufferLength();return BK.Security.encrypt(r),buff=new BK.Buffer(HeaderLen+r.bufferLength()+o,1),this.addHeader(buff,r.bufferLength(),o),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(r){GameStatusInfo.devPlatform?(BK.Script.log(0,0,"startGame dev:"),this._startGame(r)):1==BK.QQ.hasJoinRoomSucc?(BK.Script.log(0,0,"startGame qq:cmsrv confirm joinRoom response"),this._startGame(r)):(BK.Script.log(0,0,"startGame qq:waiting cmsvr joiroom response"),BK.QQ.delegate.onJoinRoomEvent=function(t,e,i){BK.Script.log(0,0,"startGame qq:wait finish.start Game"),this._startGame(r)}.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(),o=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(o,i.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(i),o},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(),o=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(o,i.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(i),o},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(),o=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(o,i.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(i),o},this.getUserData=function(t,e){null==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 o=new Object;o.cmd=14,o.arg0=t,o.arg1=e,o.arg2=i,o.arg3=r,this.reqArray.push(o)},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 o=r.capacity?r.capacity:r.bufferLength();n=n+4+o,BK.Script.log(0,0,"requestSyncOpt with item len"+o)}var a=new BK.TLV(n);a.bkJSTLVWriteUInt32(this.msgSeq,TLVType.Uint32,201),a.bkJSTLVWriteUInt32(this.lastFrame,TLVType.Uint32,202),a.bkJSTLVWriteBuffer(t,TLVType.Byte,203),a.bkJSTLVWriteBuffer(e,TLVType.Byte,204),a.bkJSTLVWriteBuffer(i,TLVType.Byte,205),r&&a.bkJSTLVWriteBuffer(r,TLVType.Byte,206),BK.Script.log(0,0,"requestSyncOpt this.msgSeq:"+this.msgSeq+" this.lastFrame:"+this.lastFrame);a.bkJSParseTLV();BK.Script.log(0,0,"requestSyncOpt tlv len:"+a.bkJSTLVGetLength()+" fix header:"+fixedHeaderLen);var s=new BK.Buffer(fixedHeaderLen+a.bkJSTLVGetLength(),1);this.addFixedHeader(s,14,this.gameId,this.roomId,this.mId),s.writeBuffer(a.bkJSTLVGetBuffer());var h=BK.Security.getST();BK.Security.encrypt(s);var l=h.bufferLength(),c=new BK.Buffer(HeaderLen+s.bufferLength()+l,1);return this.addHeader(c,s.bufferLength(),l),c.writeBuffer(h),c.writeBuffer(s),this.msgSeq+=1,c},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 o=n.bufferLength(),a=new BK.Buffer(HeaderLen+r.bufferLength()+o,1);return this.addHeader(a,r.bufferLength(),o),a.writeBuffer(n),a.writeBuffer(r),a},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 o=BK.Security.getST(),a=o.bufferLength(),s=new BK.Buffer(HeaderLen+n.bufferLength()+a,1);return this.addHeader(s,n.bufferLength(),a),s.writeBuffer(o),s.writeBuffer(n),s},this.sendKeepAlive=function(){var t=new Object;(t.cmd=12,this.reqArray.push(t),0!=this.netTimeOutTs)&&(5<BK.Time.timestamp-this.netTimeOutTs&&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,o=n.readUint8Buffer(),a=n.readUint8Buffer(),s=n.readUint16Buffer();n.readUint64Buffer(),n.readUint32Buffer();var h=n.readUint8Buffer(),l=n.readUint8Buffer(),c=n.readUint8Buffer(),u=n.readUint8Buffer(),_=r.tag201,d=_.readUint8Buffer(),f=_.readUint8Buffer(),p=_.readUint16Buffer();_.readUint64Buffer(),_.readUint32Buffer();var g=_.readUint8Buffer(),m=_.readUint8Buffer(),v=_.readUint8Buffer(),S=_.readUint8Buffer(),b=new Object;return b.ipType_1=o,b.resServe_1=a,b.ipType_2=d,b.resServe_2=f,b.port_1=s,b.ip_1=h+"."+l+"."+c+"."+u,b.port_2=p,b.ip_2=g+"."+m+"."+v+"."+S,this.ip0=b.ip_1,this.ip1=b.ip_2,b}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,o=n.readUint8Buffer(),a=n.readUint8Buffer(),s=n.readUint16Buffer();n.readUint64Buffer(),n.readUint32Buffer();var h=n.readUint8Buffer(),l=n.readUint8Buffer(),c=n.readUint8Buffer(),u=n.readUint8Buffer(),_=r.tag201,d=_.readUint8Buffer(),f=_.readUint8Buffer(),p=_.readUint16Buffer();_.readUint64Buffer(),_.readUint32Buffer();var g=_.readUint8Buffer(),m=_.readUint8Buffer(),v=_.readUint8Buffer(),S=_.readUint8Buffer(),b=r.tag203,y=this.read32BytesToString(b),T=b.readUint64Buffer(),B=b.readUint8Buffer(),E=b.readUint8Buffer(),x=r.tag205;null==x&&(x=0);for(var C=[],R=0;R<E;R++){var A={};A.uid=this.read32BytesToString(b),A.status=b.readUint8Buffer(),C.push(A)}var I=new Object;return I.ipType_1=o,I.resServe_1=a,I.ipType_2=d,I.resServe_2=f,I.port_1=s,I.ip_1=h+"."+l+"."+c+"."+u,I.port_2=p,I.ip_2=g+"."+m+"."+v+"."+S,I.ownerId=y,I.createTs=T,I.status=B,I.playerNum=E,I.ext_num=x,this.ip0=I.ip_1,this.ip1=I.ip_2,this.ownerId=y,this.createTs=T,this.status=B,this.playerNum=E,this.players=C,I}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),o=r.readUint64Buffer(),a=r.readUint8Buffer(),s=r.readUint8Buffer(),h=[],l=0;l<s;l++){var c={},u=this.read32BytesToString(r),_=r.readUint64Buffer();a=r.readUint8Buffer();c.openId=u,c.status=a,c.joinTs=_,h.push(c)}if(this.ownerId=n,this.createTs=o,this.status=a,this.playerNum=s,0==this.currentPlayers.length)h.forEach(function(t){this.newJoinPlayers.push(t)},this);else{var d=[];BK.Script.log(0,0,"recvJoinRoom!curPlayers = "+JSON.stringify(this.currentPlayers)),BK.Script.log(0,0,"recvJoinRoom!joinPlayers = "+JSON.stringify(h));for(l=0;l<h.length;l++){c=h[l];for(var f=!1,p=0;p<this.currentPlayers.length;p++){if(this.currentPlayers[p].openId==c.openId){f=!0;break}}0==f&&d.push(c)}this.newJoinPlayers=d,BK.Script.log(0,0,"recvJoinRoom!newPlayers = "+JSON.stringify(this.newJoinPlayers))}this.currentPlayers=h,BK.Script.log(0,0,"recvJoinRoom ownerId="+n+",createTs ="+o+",playerNum:"+s)},this.recvLeaveRoom=function(t,e){var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV();if(r){var n=r.tag201,o=this.read32BytesToString(n),a=t.readUint64Buffer(),s=new Object;return BK.Script.log(0,0,"recvLeaveRoom!ret = "+a),s.reason=a,s.logOutId=o,this.currentPlayers.splice(this.currentPlayers.indexOf(o)),s}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),o=new Array,a=0;a<n.length;a++){var s=n[a].readUint32Buffer();this.lastFrame=s;var h=n[a].bufferLength()-4;BK.Script.log(0,0,"sync recv len= "+n[a].bufferLength()+" frameData.length="+n.length);for(var l=new Array;0<h;){BK.Script.log(0,0,"push frameNo="+this.lastFrame);var c=n[a].readUint16Buffer();BK.Script.log(0,0,"push databuf 2 datalen="+c);var u=this.read32BytesToString(n[a]),_=n[a].readUint64Buffer(),d={openId:u,itemId:_,dataBuffer:n[a].readBuffer(c)};BK.Script.log(0,0,"push databuf openid="+u),BK.Script.log(0,0,"push databuf itemid="+_),l.push(d),h-=42,h-=c}l.frameSeq=s,o.push(l)}this.frameSyncListener(o)},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,o=new Array,a=0;a<n.length;a++){var s=n[a].readUint32Buffer(),h=n[a].bufferLength()-4;BK.Script.log(0,0,"sync query recv = "+n[a].bufferLength()+" frameData.length="+n.length);for(var l=new Array;0<h;){BK.Script.log(0,0,"push frameNo="+this.lastFrame);var c=n[a].readUint16Buffer();BK.Script.log(0,0,"push databuf 2 datalen="+c);var u=this.read32BytesToString(n[a]),_=n[a].readUint64Buffer(),d={openId:u,itemId:_,dataBuffer:n[a].readBuffer(c)};BK.Script.log(0,0,"push databuf openid="+u),BK.Script.log(0,0,"push databuf itemid="+_),l.push(d),h-=42,h-=c}l.frameSeq=s,o.push(l)}BK.Script.log(0,0,"query end"),this.queryFrameDataCallBack(0,o)},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,o=i.data.accountType;GameStatusInfo.avAppId=n,GameStatusInfo.avAccountType=o,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)==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 o=this.recvQueryRoom(i,i.bufferLength()-fixedHeaderLen);this.queryRoomInfoCallBack(r.ret,o),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 a=0;a<this.newJoinPlayers.length;a++)if(this.newJoinPlayers[a].openId==currentPlayerOpenId)return BK.QQ.ssoJoinRoomCallback=this.recvSSOJoinRoom.bind(this),void BK.QQ.notifyNewOrJoinRoomSrv(this.newJoinPlayers,this.roomId,this.ownerId==GameStatusInfo.openId?1:2,GameStatusInfo||GameStatusInfo.src);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:var 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:h=i.readBuffer(i.bufferLength()-fixedHeaderLen);this.getUserDataCallBack(r.ret,h);break;case 15:var l=i.readUint32Buffer();this.ackSeq=l,this.sendSyncOptCallBack(r.ret,l);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)}null!=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){var n;BK.Script.log(0,0," this.socket.receive():onePackLen="+r),null!=(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}r<e&&(BK.Script.log(0,0," this.socket.receive():Multipacks onePackLen="+r),null!=(n=this.socket.receive(r))&&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)&&0<this.reqArray.length){var e=this.reqArray.pop();null!=e&&null!=e&&this.requestSocket(e)}return 3!=t&&1!=t||this.seperatePackHandle(),t},this.createAndJoinRoom=function(t,e,n,r,o){this.createRoom(t,e,function(t,e,i){0==t?(BK.Script.log(0,0,"\u521b\u5efa\u6e38\u620f 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(r,t){BK.Script.log(0,0,"\u52a0\u5165\u623f\u95f4 statusCode:"+r+" roomid is "+t.roomId),0==r&&(GameStatusInfo.roomId=t.roomId,BK.QQ.gameCfg.roomId=t.roomId),o?1==BK.QQ.hasJoinRoomSucc?n(r,this):BK.QQ.delegate.onJoinRoomEvent=function(t,e,i){n(r,this)}.bind(this):n(r,this)},r,o)):n(t,this)})},this.queryAndJoinRoom=function(t,e,i,r,n,o){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,"\u52a0\u5165\u623f\u95f4 statusCode:"+t+" roomid is "+e.roomId),r(t,this)},n,o)):r(t,void 0)})},this.socialMatch=function(r){this.roomId=Number(GameStatusInfo.roomId),BK.Script.log(1,1,"1v1\u5339\u914d \u73a9\u5bb6\u6765\u6e90:"+GameStatusInfo.src+" \u623f\u95f4\u53f7:"+GameStatusInfo.roomId),this.createRoom(GameStatusInfo.gameId,GameStatusInfo.openId,function(t,e,i){BK.Script.log(1,1,"1v1\u5339\u914d \u521b\u5efa\u623f\u95f4 statusCode:"+t+" roomid:"+i),0==t?(this.isCreator=!0,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(GameStatusInfo.src,function(t,e){BK.Script.log(1,1,"1v1\u5339\u914d \u52a0\u5165\u623f\u95f4 statusCode:"+t+" roomid:"+e.roomId),0==t?(BK.Script.log(1,1,"1v1\u5339\u914d \u52a0\u5165\u623f\u95f4\u6210\u529f"),r(t,e)):(BK.Script.log(1,1,"1v1\u5339\u914d \u52a0\u5165\u623f\u95f4\u5931\u8d25 statusCode:"+t+" \u5177\u4f53\u9519\u8bef\u7801\u53c2\u89c1http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),r(t,this))},!0,!0)):2007==t?(this.isCreator=!1,this.queryRoom(GameStatusInfo.gameId,GameStatusInfo.roomId,GameStatusInfo.openId,function(t,e){BK.Script.log(1,1,"1v1\u5339\u914d \u67e5\u8be2\u623f\u95f4 statusCode:"+t+" roomId:"+i+" \u623f\u95f4\u4e2d\u73a9\u5bb6\u6570:"+e.playerNum),0==t&&e?(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(GameStatusInfo.src,function(t,e){BK.Script.log(1,1,"1v1\u5339\u914d \u52a0\u5165\u623f\u95f4 statusCode:"+t+" roomid:"+e.roomId),0==t?(BK.Script.log(1,1,"1v1\u5339\u914d \u52a0\u5165\u623f\u95f4\u6210\u529f"),r(t,e)):(BK.Script.log(1,1,"1v1\u5339\u914d \u52a0\u5165\u623f\u95f4\u5931\u8d25 statusCode:"+t+" \u5177\u4f53\u9519\u8bef\u7801\u53c2\u89c1http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),r(t,this))},!0,!0)):(BK.Script.log(1,1,"1v1\u5339\u914d \u67e5\u8be2\u623f\u95f4\u5931\u8d25 statusCode:"+t+" \u5177\u4f53\u9519\u8bef\u7801\u53c2\u89c1http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),r(t,this))})):(BK.Script.log(1,1,"1v1\u5339\u914d \u521b\u5efa\u623f\u95f4\u5931\u8d25 statusCode:"+t+" \u5177\u4f53\u9519\u8bef\u7801\u53c2\u89c1http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),r(t,this))})},this.showOneMorePage=function(i,t){var r=[],n=0;if(t&&2==t.length)for(var e=0;e<t.length;e++){n=2!=i&&GameStatusInfo.openId==t[e]?i:2==i?2:2!=i&&GameStatusInfo.openId!=t[e]?1-i:-1;var o={openId:t[e],scoreState:n};BK.Script.log(1,1,"\u73a9\u5bb6\u4fe1\u606f playerInfo:"+JSON.stringify(o)),r.push(o)}else if(this.newJoinPlayers){if(this.newJoinPlayers.forEach(function(t){n=2!=i&&GameStatusInfo.openId==t.openId?i:2==i?2:2!=i&&GameStatusInfo.openId!=t.openId?1-i:-1;var e={openId:t.openId,scoreState:n};BK.Script.log(1,1,"\u73a9\u5bb6\u4fe1\u606f playerInfo:"+JSON.stringify(e)),r.push(e)},this),this.isCreator){2!=i?n=i:2==i&&(n=2);o={openId:this.ownerId,scoreState:n};BK.Script.log(1,1,"\u73a9\u5bb6\u4fe1\u606f playerInfo:"+JSON.stringify(o)),r.push(o)}}else BK.Script.log(1,1,"\u518d\u6765\u4e00\u5c40\u5931\u8d25\uff0copenIds\uff08\u81ea\u5efa\u540e\u53f0\uff09\u6216newJoinPlayers\uff08\u975e\u81ea\u5efa\u540e\u53f0\uff09\u4e3anull\u6216\u8005undefined");var a={scoreState:i,playerInfos:r};BK.Script.log(1,1,"\u518d\u6765\u4e00\u5c40\u6210\u529f data:"+JSON.stringify(a)),BK.MQQ.SsoRequest.send(a,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 o=new Object;o.cmd=6,o.arg0=t,o.arg1=e,this.reqArray.push(o),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,"\u521b\u5efa\u56fa\u5b9a\u623f\u95f4\u53f7 \u6e38\u620f 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,"\u52a0\u5165\u623f\u95f4 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 o=n.bufferLength(),a=new BK.Buffer(HeaderLen+r.bufferLength()+o,1);return this.addHeader(a,r.bufferLength(),o),a.writeBuffer(n),a.writeBuffer(r),BK.Script.log(0,0,"create room request buffer : "+a.bufferLength()+" body len:"+r.bufferLength()),a}},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,"\u5f53\u524d\u73af\u5883\u4e3a---\u5f00\u53d1\u73af\u5883")):1==GameStatusInfo.isWhiteUser?(this._environment=NETWORK_ENVIRONMENT_QQ_DEBUG,BK.Script.log(1,1,"\u5f53\u524d\u73af\u5883\u4e3a---\u624bQ\u5f00\u53d1\u73af\u5883")):(this._environment=NETWORK_ENVIRONMENT_QQ_RELEASE,BK.Script.log(1,1,"\u5f53\u524d\u73af\u5883\u4e3a---\u6b63\u5f0f\u73af\u5883")),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.URL=e())}(BK,function(){return function(){function n(){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 o(t,e){var i=t.charAt(0),r=e.split(i);return i===t?r:r[(t=parseInt(t.substring(1),10))<0?r.length+t:t-1]}function a(t,e){for(var i,r=t.charAt(0),n=e.split("&"),o=[],a={},s=[],h=t.substring(1),l=0,c=n.length;l<c;l++)if((o=n[l].match(/(.*?)=(.*)/))||(o=[n[l],n[l],""]),""!==o[1].replace(/\s/g,"")){if(o[2]=(i=o[2]||"",decodeURIComponent(i.replace(/\+/g," "))),h===o[1])return o[2];(s=o[1].match(/(.*)\[([0-9]+)\]/))?(a[s[1]]=a[s[1]]||[],a[s[1]][s[2]]=o[2]):a[o[1]]=o[2]}return r===t?a:a[h]}return function(t,e){var i,r={};if("tld?"===t)return n();if(e=e||window.location.toString(),!t)return e;if(t=t.toString(),i=e.match(/^mailto:([^\/].+)/))r.protocol="mailto",r.email=i[1];else{if((i=e.match(/(.*?)\/#\!(.*)/))&&(e=i[1]+i[2]),(i=e.match(/(.*?)#(.*)/))&&(r.hash=i[2],e=i[1]),r.hash&&t.match(/^#/))return a(t,r.hash);if((i=e.match(/(.*?)\?(.*)/))&&(r.query=i[2],e=i[1]),r.query&&t.match(/^\?/))return a(t,r.query);if((i=e.match(/(.*?)\:?\/\/(.*)/))&&(r.protocol=i[1].toLowerCase(),e=i[2]),(i=e.match(/(.*?)(\/.*)/))&&(r.path=i[2],e=i[1]),r.path=(r.path||"").replace(/^([^\/])/,"/$1"),t.match(/^[\-0-9]+$/)&&(t=t.replace(/^([^\/])/,"/$1")),t.match(/^\//))return o(t,r.path.substring(1));if((i=o("/-1",r.path.substring(1)))&&(i=i.match(/(.*?)\.(.*)/))&&(r.file=i[0],r.filename=i[1],r.fileext=i[2]),(i=e.match(/(.*)\:([0-9]+)$/))&&(r.port=i[2],e=i[1]),(i=e.match(/(.*?)@(.*)/))&&(r.auth=i[1],e=i[2]),r.auth&&(i=r.auth.match(/(.*)\:(.*)/),r.user=i?i[1]:r.auth,r.pass=i?i[2]:void 0),r.hostname=e.toLowerCase(),"."===t.charAt(0))return o(t,r.hostname);n()&&(i=r.hostname.match(n()))&&(r.tld=i[3],r.domain=i[2]?i[2]+"."+i[3]:void 0,r.sub=i[1]||void 0),r.port||("http"===r.protocol||"ws"===r.protocol?r.port="80":"https"!==r.protocol&&"wss"!==r.protocol||(r.port="443"))}return t in r?r[t]:"{}"===t?r:void 0}}()});var __extends=this&&this.__extends||function(){var r=function(t,e){return(r=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])})(t,e)};return function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}}();!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 r=function(){function i(){this._wsArray=[],BK.Director.ticker.add(function(t,e){i.Instance.dispatchEvent()})}return i.prototype.add=function(t){this._wsArray.push(t),BK.Script.log(1,0,"SocketEventMgr.add!so = "+t)},i.prototype.del=function(t){var e=this._wsArray.indexOf(t,0);0<=e&&(this._wsArray.splice(e,1),BK.Script.log(1,0,"SocketEventMgr.del!so = "+t))},i.prototype.dispatchEvent=function(){this._wsArray.forEach(function(t,e,i){t&&t.update()})},i.Instance=new i,i}(),t=function(){function i(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 i.prototype.__setEnableProxy=function(t){this.enableProxy=t,this.proxyhasEstablisdHttpTunnel=!1},i.prototype.__internalClose=function(){return this.__nativeObj?this.__nativeObj.close():-2},i.prototype.__internalSend=function(t){return this.__nativeObj?this.__nativeObj.send(t):-2},i.prototype.__internalRecv=function(t){if(this.__nativeObj)return this.__nativeObj.receive(t)},i.prototype.__internalUpdate=function(){return this.__nativeObj?this.__nativeObj.update():-2},i.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},i.prototype.__internalCanReadLength=function(){return this.__nativeObj?this.__nativeObj.canReadLength():0},i.prototype.__internalIsEnableSSL=function(){return!!this.__nativeObj&&this.__nativeObj.getSSLEnable()},i.prototype.__internalEnableSSL=function(t){this.__nativeObj&&this.__nativeObj.setSSLEnable(t)},i.prototype.__internalUpdateSSL=function(){var t=this.__internalUpdate(),e=this.curNetState();if(-1!=t)switch(this.prevNetState){case 2: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: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 4:switch(e){case 5:switch(t){case 2:case 3:this.clearState(),this.onConnectedEvent(this)}break;default: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 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},i.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.clearState(),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},i.prototype.curNetState=function(){return this.__nativeObj?this.__nativeObj.state:0},i.prototype.close=function(){var t=this.__internalClose();return t||(this.prevNetState=0,this.prevNetStateUpdateFlag=!0),r.Instance.del(this),t},i.prototype.send=function(t){var e=this.__internalSend(t);return e<0&&(this.onErrorEvent(this),i.prototype.close.call(this)),e},i.prototype.recv=function(t){return this.__internalRecv(t)},i.prototype.canRecvLength=function(){return this.__internalCanReadLength()},i.prototype.update=function(){return this.prevNetStateUpdateFlag=!1,this.isEnableSSL()?this.__internalUpdateSSL():this.__internalUpdateNoSSL()},i.prototype.connect=function(){var t=this.curNetState();if(0!=t&&3!=t)return 0;var e=this.__internalConnect();return e||r.Instance.add(this),e},i.prototype.isEnableSSL=function(){return this.__internalIsEnableSSL()},i.prototype.enableSSL=function(t){this.__internalEnableSSL(t)},i.prototype.onErrorEvent=function(t){BK.Script.log(1,0,"BK.Socket.ErrorEvent")},i.prototype.onUpdateEvent=function(t){return 0},i.prototype.onTimeoutEvent=function(t){BK.Script.log(1,0,"BK.Socket.TimeoutEvent")},i.prototype.onConnectingEvent=function(t){BK.Script.log(1,0,"BK.Socket.ConnectingEvent")},i.prototype.onConnectedEvent=function(t){BK.Script.log(1,0,"BK.Socket.ConnectedEvent")},i.prototype.onReconnectEvent=function(t){BK.Script.log(1,0,"BK.Socket.ReconnectEvent")},i.prototype.onDisconnectEvent=function(t){BK.Script.log(1,0,"BK.Socket.DisconnectEvent")},i.prototype.clearState=function(){},i}(),n=function(t,e){this.data=t,this.isBinary=e},o=function(c){function u(t,e,i,r,n){var o=c.call(this,t,e)||this;return o.path=r||"/",o.host=i,o.query=n,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,onHttpTunnel: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(u,c),u.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},u.prototype.setDelegate=function(t){this.delegate=t},u.prototype.setProxyDetail=function(t){c.prototype.__setEnableProxy.call(this,!0),this.proxyDetail=t},u.prototype.getReadyState=function(){return this.state},u.prototype.getErrorCode=function(){return this.errcode},u.prototype.getErrorString=function(){return this.message},u.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},u.prototype.toHex=function(t){if(0<=t&&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"},u.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},u.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}},u.prototype.handlePhaseTimeout=function(){if(6!=this.phaseTimeout){var t=BK.Time.diffTime(this.prevPhaseTickCount,BK.Time.clock);switch(this.phaseTimeout){case 1:1e3*t>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",c.prototype.close.call(this),this.delegate.onError&&this.delegate.onError(this));break;case 2:1e3*t>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",c.prototype.close.call(this),this.delegate.onError&&this.delegate.onError(this));break;case 3:1e3*t>this.options.CloseAckTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!close ack timeout"),this.prevPhaseTickCount=BK.Time.clock,c.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*t>this.options.PingPongTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!receive pong timeout"),this.prevPhaseTickCount=BK.Time.clock)}}},u.prototype.restartPingPongTimer=function(){4==this.state&&0<this.options.PingPongInterval&&(this.prevPingPongTickCount=BK.Time.clock)},u.prototype.handlePingPongTimer=function(){4==this.state&&0<this.options.PingPongInterval&&(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()))},u.prototype.doHttpTunnelRequstPhase=function(){var t=this.proxyDetail.dstHost,e=this.proxyDetail.dstPort,i="";i=i.concat(t+":"+e);var r="";r=(r=(r=(r=r.concat("CONNECT "+i+" HTTP/"+this.httpVer+"\r\n")).concat("Host: "+i+"\r\n")).concat("Connection: close\r\n")).concat("\r\n");var n=new BK.Buffer(r.length,!1);n.writeAsString(r,!1),0<c.prototype.send.call(this,n)&&(this.state=5,this.startPhaseTimeout(1))},u.prototype.doHttpTunnelResopnsePhase=function(t){if(this.httpParser.execute(t),200==this.httpParser.statusCode){var e=!(this.proxyhasEstablisdHttpTunnel=!0);this.delegate.onHttpTunnel&&(e=this.delegate.onHttpTunnel(this)),5==this.state&&0==e&&(this.httpParser=new HTTPParser(HTTPParser.RESPONSE),this.state=2,this.doHandshakePhase())}},u.prototype.doHandshakePhase=function(){var t="",e=this.query?"?"+this.query:"";t=t.concat("GET "+this.path+e+" HTTP/"+this.httpVer+"\r\n"),t=(t=(t=this.enableProxy?t.concat("Host: "+this.proxyDetail.dstHost+"\r\n"):80==this.port||443==this.port?t.concat("Host: "+this.host+"\r\n"):t.concat("Host: "+this.host+":"+this.port+"\r\n")).concat("Upgrade: websocket\r\n")).concat("Connection: Upgrade\r\n"),t=this.isEnableSSL()?t.concat("Origin: https://"+this.host+"\r\n"):t.concat("Origin: http://"+this.host+"\r\n");var i=this.randomN(16),r=BK.Misc.encodeBase64FromBuffer(i);if(t=(t=t.concat("Sec-WebSocket-Key: "+r+"\r\n")).concat("Sec-WebSocket-Version: "+this.version+"\r\n"),this.query)for(var n=this.query.split("&"),o=0;o<n.length;o++){var a=n[o].split("=");0<a.length&&(t=t.concat(a[0]+": "+a[1]+"\r\n"))}t=t.concat("\r\n");var s=BK.Misc.sha1(r.concat("258EAFA5-E914-47DA-95CA-C5AB0DC85B11"));this.handshakeSig=BK.Misc.encodeBase64FromBuffer(s);var h=new BK.Buffer(t.length,!1);h.writeAsString(t,!1),0<c.prototype.send.call(this,h)&&(this.state=2,this.startPhaseTimeout(1))},u.prototype.doSvrHandshakePhase1=function(t){var e=this;t&&(this.httpParser.onComplete||(this.httpParser.onComplete=function(){for(var t in e.httpParser.headers);e.doSvrHandshakePhase2()?(e.restartPingPongTimer(),e.startPhaseTimeout(6),e.delegate.onOpen&&e.delegate.onOpen(e)):(e.errcode=4098,e.message="handshake parse error",e.startPhaseTimeout(6),c.prototype.close.call(e),e.delegate.onError&&e.delegate.onError(e))}),this.httpParser.execute(t),2==this.state&&(this.state=3,this.startPhaseTimeout(2)))},u.prototype.doSvrHandshakePhase2=function(){switch(this.httpParser.statusCode){case 101:return null==this.httpParser.headers.upgrade?(this.state=-1,BK.Script.log(1,0,"BK.WebSocket.doSvrHandshakePhase2!missing 'upgrade' header"),!1):null==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):null==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},u.prototype.doFrameDataPhase=function(t,e,i){void 0===i&&(i=!1);var r=6,n=t.length;this.extensions.length,r+=n;var o=new BK.Buffer(r,!1),a=0,s=!1;switch(this.version){case 13:s=!0,a=128}var h=!0;switch(e){case 1:case 2:i?this.inTxSegFrame?(h=!1,e=0):(h=!1,this.inTxSegFrame=!0):this.inTxSegFrame&&(e=0)}if(h?o.writeUint8Buffer(128|15&e):o.writeUint8Buffer(15&e),n<126?o.writeUint8Buffer(a|127&t.length):n<65536?(o.writeUint8Buffer(126|a),u.isLittleEndian?(o.writeUint8Buffer((65280&n)>>8),o.writeUint8Buffer(255&n)):(o.writeUint8Buffer(255&n),o.writeUint8Buffer((65280&n)>>8))):BK.Script.log(1,0,"BK.WebSocket.doFrameDataPhase!js don't support 64bit data type"),s){var l=this.randomN(4);BK.Misc.encodeBufferXorMask4(t,l),o.writeBuffer(l)}return o.writeBuffer(t),o},u.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 e=t.readUint8Buffer();switch(this.isFinalSeg=!!(128&e),this.opcode=15&e,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 i=t.readUint8Buffer();switch(this.maskBit=(128&i)>>7,127&i){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&i,1==this.maskBit?this.parseState=13:this.parseState=17,0<this.rxbuflen&&t.eof)return!0}}switch(this.parseState){case 3:var r=t.readUint8Buffer();if(this.rxbuflen|=u.isLittleEndian?(255&r)<<8:255&r,t.eof)return!0;case 4:r=t.readUint8Buffer();if(this.rxbuflen|=u.isLittleEndian?255&r:(255&r)<<8,1==this.maskBit?this.parseState=13:this.parseState=17,0<this.rxbuflen&&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 n=t.length-t.pointer;if(n<=this.rxbuflen-this.rxbuf.length?this.rxbuf.writeBuffer(t.readBuffer(n)):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},u.prototype.handleCloseFrame=function(){if(this.peerClosed=!0,4==this.state){var t=this.rxbuf.readUint16Buffer(),e=this.rxbuf.readBuffer(this.rxbuflen-2);if(this.message=t?(this.errcode=t,e.readAsString()):(this.errcode=1005,"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:""),BK.Script.log(1,0,"BK.WebSocket.handleCloseFrame! closed by romote peer"),this.close(),this.state=0,this.delegate.onMessage)for(;0<this.udataQue.length;){var i=this.udataQue.shift();this.delegate.onMessage(this,i)}this.delegate.onClose&&this.delegate.onClose(this)}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(;0<this.udataQue.length;){i=this.udataQue.shift();this.delegate.onMessage(this,i)}this.delegate.onClose&&this.delegate.onClose(this)}},u.prototype.handlePingFrame=function(){if(4==this.state){if(125<this.rxbuflen)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)}},u.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))}},u.prototype.sendFrameFromTxQ=function(t){if(4==this.state&&this.packageSendCheck()){if(this.inPartialTxbuf){if(!(0<(a=c.prototype.send.call(this,this.txbuf))))return BK.Script.log(1,a,"BK.WebSocket.sendFrameFromTxQ!partial send failed, data type = "+t),!1;if(this.restartPingPongTimer(),a<this.txbuf.length){var e=this.txbuf.length-a,i=new BK.Buffer(e,!1);return this.txbuf.rewind(),this.txbuf.jumpBytes(a),i.writeBuffer(this.txbuf.readBuffer(e)),this.txbuf=i,!1}this.framePackageCount++,this.inPartialTxbuf=!1}for(var r=!0,n=0;n<this.txMsgQue.length;n++){for(var o=this.txMsgQue[n];0<o.length;){var a,s=o.shift(),h=0<o.length,l=this.doFrameDataPhase(s,t,h);if(!(0<(a=c.prototype.send.call(this,l)))){r=!1,BK.Script.log(1,a,"BK.WebSocket.sendFrameFromTxQ!send failed, data type = "+t);break}if(this.restartPingPongTimer(),a<l.length){l.rewind(),l.jumpBytes(a),this.txbuf.rewind(),this.txbuf.writeBuffer(l.readBuffer(l.length-a)),r=!(this.inPartialTxbuf=!0),BK.Script.log(1,0,"BK.WebSocket.sendFrameFromTxQ!partial send, total size = "+l.length+", tx size = "+a);break}if(0==o.length&&(this.inTxSegFrame=!1),this.framePackageCount++,!this.packageSendCheck())return}if(0==o.length&&this.txMsgQue.shift(),!r)break;if(!this.packageSendCheck())return}return r&&!this.txMsgQue.length&&this.inTxSegFrame&&(this.inTxSegFrame=!1),r}},u.prototype.recvFrameFromRxQ=function(t){for(var e=2==t,i=new BK.Buffer(128,!0);0<this.rxbufQue.length;){var r=this.rxbufQue.shift();i.writeBuffer(r)}0==e&&i.writeUint8Buffer(0),i.rewind(),this.udataQue.push(new n(i,e))},u.prototype.__sendBinaryFrame=function(t,e){var i=t.length,r=this.options.DefaultSegmentSize,n=0;t.rewind();for(var o=new Array;r<i;){var a=new BK.Buffer(r,!1);t.rewind(),t.jumpBytes(n),a.writeBuffer(t.readBuffer(r)),a.rewind(),o.push(a),n+=r,i-=r}if(0<i){a=new BK.Buffer(i,!1);t.rewind(),t.jumpBytes(n),a.writeBuffer(t.readBuffer(i)),a.rewind(),o.push(a)}return this.txMsgQue.push(o),this.txFrameType=e,this.sendFrameFromTxQ(e)},u.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)},u.prototype.sendBinaryFrame=function(t){if(4==this.state)return this.__sendBinaryFrame(t,2)},u.prototype.sendCloseFrame=function(t,e){if(!this.isSendClose){this.isSendClose=!0;var i=new BK.Buffer(e.length+1,!1),r=new BK.Buffer(3+e.length,!1);u.isLittleEndian?(r.writeUint8Buffer((65280&t)>>8),r.writeUint8Buffer(255&t)):(r.writeUint8Buffer(255&t),r.writeUint8Buffer((65280&t)>>8)),i.writeAsString(e,!0),r.writeBuffer(i);var n=this.doFrameDataPhase(r,8);0<c.prototype.send.call(this,n)&&(0==this.peerClosed&&(this.state=1,this.startPhaseTimeout(3)),BK.Script.log(1,0,"BK.WebSocket.sendCloseFrame!code = "+t+", reason = "+e))}},u.prototype.sendPingFrame=function(t){if(!this.inPingFrame){BK.Script.log(0,0,"BK.WebSocket.sendPingFrame!ping data = "+this.bufferToHexString(t));var e=this.doFrameDataPhase(t,9);0<c.prototype.send.call(this,e)&&(this.inPingFrame=!0,this.startPhaseTimeout(4))}},u.prototype.sendPongFrame=function(t){if(!this.inPongFrame){var e=this.doFrameDataPhase(t,10);0<c.prototype.send.call(this,e)&&(this.inPongFrame=!0)}},u.prototype.clearState=function(){this.state=0},u.prototype.onErrorEvent=function(t){0!=this.state&&1!=this.state&&(c.prototype.onErrorEvent.call(this,t),this.state=-1,this.errcode=1006,this.message="abnormal closure",this.delegate.onError&&this.delegate.onError(this))},u.prototype.onTimeoutEvent=function(t){c.prototype.onErrorEvent.call(this,t),this.state=0,this.errcode=-1e3,this.message="socket connect timeout",this.delegate.onError&&this.delegate.onError(this)},u.prototype.onDisconnectEvent=function(t){switch(c.prototype.onDisconnectEvent.call(this,t),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")}},u.prototype.onConnectedEvent=function(t){c.prototype.onConnectedEvent.call(this,t),0==this.state&&(this.clear(),this.httpParser=new HTTPParser(HTTPParser.RESPONSE),1==this.enableProxy&&0==this.proxyhasEstablisdHttpTunnel?this.doHttpTunnelRequstPhase():this.doHandshakePhase())},u.prototype.phaseBufferCheck=function(t){for(var e="\r\n\r\n",i=0,r=0;!t.eof;){if(r++,t.readUint8Buffer()==e.charCodeAt(i)){if(++i==e.length)return r}else i=0}return-1},u.prototype.packageSendCheck=function(){return this.framePackageCount<this.options.DrainSegmentCount},u.prototype.onUpdateEvent=function(t){switch(this.framePackageCount=0,c.prototype.onUpdateEvent.call(this,t),this.state){case 5:case 6:if(0<(a=t.canRecvLength())){var e=this.recv(a),i=this.phaseBufferCheck(e);e.rewind();var r=e.readBuffer(i);null!=r&&this.doHttpTunnelResopnsePhase(r.readAsString(!0))}break;case 2:case 3:if(0<(a=t.canRecvLength())){e=this.recv(a),i=this.phaseBufferCheck(e);if(e.rewind(),i<e.length){var n=e.readBuffer(i);if(null!=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:"+e.pointer+"length:"+e.length),null!=e)for(;!e.eof;)if(!this.doSvrFrameDataPhase(e)){this.sendCloseFrame(this.errcode,this.message?this.message:""),this.delegate.onError&&this.delegate.onError(this);break}if(this.delegate.onMessage)for(;0<this.udataQue.length;){var o=this.udataQue.shift();this.delegate.onMessage(this,o)}0<this.txMsgQue.length&&this.sendFrameFromTxQ(this.txFrameType),this.delegate.onSendComplete&&this.delegate.onSendComplete(this),this.inPongFrame=!1,this.handlePhaseTimeout(),this.handlePingPongTimer()}else null!=e&&this.doSvrHandshakePhase1(e.readAsString(!0)),this.handlePhaseTimeout()}break;case 4:for(var a=t.canRecvLength();0<a;){var s=a,h=this.recv(a);if(null!=h)for(;!h.eof;){if(!this.doSvrFrameDataPhase(h)){this.sendCloseFrame(this.errcode,this.message?this.message:""),this.delegate.onError&&this.delegate.onError(this);break}if(0==this.state)return}if((a=t.canRecvLength())==s)break}if(this.delegate.onMessage)for(;0<this.udataQue.length;){o=this.udataQue.shift();this.delegate.onMessage(this,o)}0<this.txMsgQue.length&&this.sendFrameFromTxQ(this.txFrameType),this.delegate.onSendComplete&&this.delegate.onSendComplete(this),this.inPongFrame=!1,this.handlePhaseTimeout(),this.handlePingPongTimer();break;case 1:if(0<(a=t.canRecvLength())&&this.doSvrFrameDataPhase(this.recv(a))&&this.delegate.onMessage)for(;0<this.udataQue.length;){o=this.udataQue.shift();this.delegate.onMessage(this,o)}this.handlePhaseTimeout()}return 0},u.isLittleEndian=BK.Misc.isLittleEndian(),u}(t),i=function(t,e){this.data=t,this.isBinary=e};return function(){function t(t){var n=this;this.__url=t,this.options=null,this.inTrans=!1,this.isPendingConn=!0,this.txdataQ=new Array;var e=BK.URL("{}",t);this.scheme=e.protocol,this.port=e.port,this.path=e.path,this.query=e.query,this.host=e.hostname,BK.DNS.queryIPAddress(e.hostname,function(t,e,i,r){r?n.queryProxyIpAndPort(r[1],function(t,e){this.proxyRequest(t,e)}.bind(n)):n.mainRequest(t,e,i)})}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)return this.__nativeObj.sendBinaryFrame(t);for(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)},t.prototype.ipListFilter=function(t){var r=new Array;return t.forEach(function(t){for(var e=!1,i=0;i<r.length;i++){if(t==r[i]){e=!0;break}}0==e&&r.push(t)}),r},t.prototype.startConnect=function(){this.isPendingConn&&(this.connect(),this.isPendingConn=!1)},t.prototype.subscribeEvent=function(){var o=this;BK.Notification.on("game_network_change",this,function(t){this.__nativeObj.close(),this.__nativeObj.delegate.onClose(this.__nativeObj)}.bind(this),!0),"wss"==this.scheme&&this.__nativeObj.enableSSL(!0),this.options&&(this.setOptions(this.options),this.options=null),this.__nativeObj.delegate.onOpen=function(t){0<o.txdataQ.length&&o.send(o.txdataQ.shift()),o.onOpen?o.onOpen(o):o.onopen&&o.onopen.call(o)},this.__nativeObj.delegate.onClose=function(t){var e={};e.code=o.getErrorCode(),e.reason=o.getErrorString(),o.onClose?o.onClose(o,e):o.onclose&&o.onclose.call(o,e)},this.__nativeObj.delegate.onError=function(t){var e={};e.code=o.getErrorCode(),e.reason=o.getErrorString(),o.onError?o.onError(o,e):o.onerror&&o.onerror.call(o,e)},this.__nativeObj.delegate.onMessage=function(t,e){if(o.onMessage)o.onMessage(o,e);else if(o.onmessage){if(1==e.isBinary){var i=e.data;i.rewind();for(var r=new ArrayBuffer(i.length),n=new DataView(r);!i.eof;)n.setUint8(i.pointer,i.readUint8Buffer());e.data=r}o.onmessage.call(o,e)}},this.__nativeObj.delegate.onSendComplete=function(t){for(var e=o.txdataQ.length;0<e&&o.__nativeObj.packageSendCheck();e--){var i=o.txdataQ.shift();i.isBinary?o.__sendBinaryFrame(i.data):o.__nativeObj.sendTextFrame(i.data)}}},t.prototype.mainRequest=function(t,e,i){switch(i=this.ipListFilter(i),t){case 0:BK.Script.log(1,0,"BK.WebSocket.queryIPAddress!iplist = "+JSON.stringify(i)),this.iplist=i,this.__nativeObj=new o(i[0],this.port,this.host,this.path,this.query),this.startConnect(),this.subscribeEvent()}},t.prototype.proxyRequest=function(t,e){var i=this.ipListFilter([t]);BK.Script.log(1,0,"BK.WebSocket.queryIPAddress!iplist = "+JSON.stringify(i)),this.__nativeObj=new o(i[0],e,this.host,this.path,this.query),this.__nativeObj.setProxyDetail({dstHost:this.host,dstPort:this.port,proxyIp:i[0],proxyPort:e}),this.startConnect(),this.__nativeObj.setDelegate({onHttpTunnel:function(){return this.subscribeEvent(),"wss"==this.scheme}.bind(this)})},t.prototype._isStringIPAndPort=function(t){for(var e=t.split(":")[0].split("."),i=0;i<e.length;i++){var r=e[i];if(isNaN(parseInt(r)))return!1}return!0},t.prototype.queryProxyIpAndPort=function(t,o){if(0==this._isStringIPAndPort(t)){var e=t.split(":")[0],a=parseInt(t.split(":")[1]);BK.DNS.queryIPAddress(e,function(t,e,i,r){var n=i[0];o(n,a)}.bind(this))}else{var i=t.split(":")[0];a=parseInt(t.split(":")[1]);o(i,a)}},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 i(t,!1))}else if("object"==typeof t){if(this.__nativeObj.packageSendCheck()&&4==e)return this.__sendBinaryFrame(t);this.txdataQ.push(new i(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,o,a){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),o&&(this.stretchX=o),a&&(this.stretchY=a),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,o=t.frameInfo.sourceSize,a=this.__nativeObj.contentSize;e=a.width*e/o.w,i=a.height*i/o.h,r=a.width*r/o.w,n=a.height*n/o.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){var e=(this.textureInfo=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 o=0;o<r.length;o++){var a=r[o];if(t==a.filename){var s={x:0,y:1,w:0,h:0},h=a.rotated,l=a.trimmed,c=a.spriteSourceSize,u=a.sourceSize;return s.h=(s.w=(s.y=h?(s.x=a.frame.x,this.fullHeight-a.frame.y-a.frame.w):(s.x=a.frame.x,this.fullHeight-a.frame.y-a.frame.h),a.frame.w),a.frame.h),c.y=u.h-c.y-c.h,{filename:t,frame:s,rotated:h,trimmed:l,spriteSourceSize:c,sourceSize:u}}}}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,o,a){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===o&&(o=1),void 0===a&&(a=1);var l=new BK.Texture(e,i,r,n,o,a);this.sheets[e]=l}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)){var 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)){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,o=r.frameInfo,a=r.texturePath,s=new BK.Texture(a);return e||(e=o.frame.w),i||(i=o.frame.h),BK.Script.log(0,0,"getSprite texture:"+s+" width:"+e+" height:"+i),o.trimmed?n=new BK.SheetSprite(r,e,i):((n=new BK.Sprite(e,i,s,0,1,1,1)).adjustTexturePosition(o.frame.x,o.frame.y,o.frame.w,o.frame.h,o.rotated),n)}return null},t.prototype.createSheetSprite=function(t,e,i){var r=this.getTextureFrameInfoByFileName(t);if(r){var n=r.frameInfo,o=r.texturePath,a=new BK.Texture(o);return e||(e=n.frame.w),i||(i=n.frame.h),BK.Script.log(0,0,"SheetSprite texture:"+a+" 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,o){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==o?(this._leftTop.adjustTexturePosition(n.x+(e-r.top),n.y+(t-r.left),r.left,r.top,o),this._centerTop.adjustTexturePosition(n.x+(e-r.top),n.y+r.right,t-r.left-r.right,r.top,o),this._rightTop.adjustTexturePosition(n.x+(e-r.top),n.y,r.right,r.top,o),this._leftCenter.adjustTexturePosition(n.x+r.bottom,n.y+(t-r.left),r.left,e-r.top-r.bottom,o),this._centerCenter.adjustTexturePosition(n.x+r.bottom,n.y+r.right,t-r.left-r.right,e-r.top-r.bottom,o),this._rightCenter.adjustTexturePosition(n.x+r.bottom,n.y,r.right,e-r.bottom-r.top,o),this._leftBottom.adjustTexturePosition(n.x,n.y+(t-r.left),r.left,r.bottom,o),this._centerBottom.adjustTexturePosition(n.x,n.y+r.right,t-r.left-r.right,r.bottom,o),this._rightBottom.adjustTexturePosition(n.x,n.y,r.right,r.bottom,o)):(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){var e=(this._size=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}();if(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(0<this.textureInfoArr.length){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,o=e.frameInfo.spriteSourceSize.y,a=e.frameInfo.spriteSourceSize.w,s=e.frameInfo.spriteSourceSize.h,h=e.frameInfo.sourceSize,l=this.__nativeObj.contentSize;n=l.width*n/h.w,o=l.height*o/h.h,a=l.width*a/h.w,s=l.height*s/h.h,this.contentSprite.position={x:n,y:o},this.contentSprite.contentSize={width:a,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,-1<t&&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),0<this.repeatCount&&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}()}),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."),BK.ScreenShot=function(){if(this.origin={x:0,y:0},this.size={width:0,height:0},GameStatusInfo){var r;function y(t){if(Object.prototype.hasOwnProperty.call(t,"__rawBKData"))return t.__rawBKData;if(Object.prototype.hasOwnProperty.call(t,"__nativeObj"))return t.__nativeObj;if(0==function(){if(null==r){"android"==GameStatusInfo.platform&&(r=!0);var t=BK.Director.queryDeviceInfo(),e=t.version.split(".");r="ios"==t.platform&&10<=Number(e[0])||"android"==t.platform||(BK.Script.log(1,0,"Current Device dont supoort TypedArray.[info = "+JSON.stringify(t)+"]"),!1)}return r}()){if(t instanceof Uint16Array==1){for(var e=new BK.Buffer(t.byteLength,!1),i=0;i<t.length;i++)e.writeUint16Buffer(t[i]);return e}if(t instanceof Float32Array==1){for(e=new BK.Buffer(t.byteLength,!1),i=0;i<t.length;i++)e.writeFloatBuffer(t[i]);return e}}return t}if(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)),o=0;o<n;o++)if(i[o]!=r[o])return i[o]<r[o];return!0}),gl||((gl=new BK.WebGL).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=function(t){var e=function(){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}();gl.glUseProgram(e);var i=gl.glGetAttribLocation(e,"pos"),r=gl.glGetAttribLocation(e,"inUVs"),n=gl.glGetUniformLocation(e,"uSampler");gl.glActiveTexture(gl.TEXTURE0);var o=gl.glCreateTexture(),a=gl.glGetParameterInt(gl.TEXTURE_BINDING_2D,1);gl.glBindTexture(gl.TEXTURE_2D,o),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(n,0);var s=gl.glGetParameterInt(gl.ARRAY_BUFFER_BINDING,1),h=gl.glGetParameterInt(gl.ELEMENT_ARRAY_BUFFER_BINDING,1),l=new Float32Array([-1,-1,0,1,1,-1,1,1,1,1,1,0,-1,1,0,0]),c=gl.glCreateBuffer();gl.glBindBuffer(gl.ARRAY_BUFFER,c),gl.glEnableVertexAttribArray(i),gl.glVertexAttribPointer(i,2,gl.FLOAT,!1,16,0),gl.glVertexAttribPointer(r,2,gl.FLOAT,!1,16,8),gl.glBufferData(gl.ARRAY_BUFFER,y(l),gl.STATIC_DRAW);var u=new Uint16Array([0,1,2,0,2,3]),_=gl.glCreateBuffer();gl.glBindBuffer(gl.ELEMENT_ARRAY_BUFFER,_),gl.glBufferData(gl.ELEMENT_ARRAY_BUFFER,y(u),gl.STATIC_DRAW);var d=new BK.Buffer(t.width*t.height*4),f=gl.glGetParameterInt(gl.FRAMEBUFFER_BINDING,1),p=function(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 o=gl.glCheckFramebufferStatus(gl.FRAMEBUFFER);return o!=gl.FRAMEBUFFER_COMPLETE&&BK.Script.log(1,-1,"_createFramebuffer!failed, status = "+o),gl.glActiveTexture(gl.TEXTURE1),gl.glBindTexture(gl.TEXTURE_2D,r),{tex:i,fbo:n}}(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,d),gl.glBindFramebuffer(gl.FRAMEBUFFER,f);for(var g=0,m=1;m<=10;m++){gl.glUseProgram(m);var v=gl.glGetAttribLocation(m,"Position"),S=gl.glGetAttribLocation(m,"SourceColor"),b=gl.glGetAttribLocation(m,"TexCoordIn");if(-1!=v&&-1!=S&&-1!=b){g=1;break}}return gl.glBindBuffer(gl.ARRAY_BUFFER,s),1==g?(gl.glEnableVertexAttribArray(v),gl.glEnableVertexAttribArray(S),gl.glEnableVertexAttribArray(b),gl.glVertexAttribPointer(v,3,gl.FLOAT,!1,36,0),gl.glVertexAttribPointer(S,4,gl.FLOAT,!1,36,12),gl.glVertexAttribPointer(b,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,h),gl.glActiveTexture(gl.TEXTURE0),gl.glBindTexture(gl.TEXTURE_2D,a),gl.glDeleteProgram(e),gl.glDeleteTexture(o),gl.glDeleteTexture(p.tex),gl.glDeleteFramebuffer(p.fbo),d}}BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.1")&&(this.bufferFromScreenShot_760=function(t,e,i,r,n){var o=gl.glCreateTexture();gl.glActiveTexture(gl.TEXTURE1),gl.glBindTexture(gl.TEXTURE_2D,o),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 a=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 l,c=gl.glCreateFramebuffer();gl.glBindFramebuffer(gl.FRAMEBUFFER,c),gl.glFramebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,o,0),gl.glFramebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_ATTACHMENT,gl.RENDERBUFFER,h),gl.glFramebufferRenderbuffer(gl.FRAMEBUFFER,gl.STENCIL_ATTACHMENT,gl.RENDERBUFFER,h);var u=gl.glCheckFramebufferStatus(gl.FRAMEBUFFER);return u==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 = "+u),gl.glBindFramebuffer(gl.FRAMEBUFFER,a),gl.glDeleteTexture(o),gl.glDeleteRenderbuffer(h),gl.glDeleteFramebuffer(c),l})}this.isInScreen=function(){(null==this.origin.x||this.origin.x<0||this.origin.x>BK.Director.screenPixelSize.width)&&(this.origin.x=0),(null==this.origin.y||this.origin.y<0||this.origin.y>BK.Director.screenPixelSize.height)&&(this.origin.y=0),(null==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),(null==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){(null==this.origin.x||this.origin.x<0||this.origin.x>t.contentSize.width)&&(this.origin.x=0),(null==this.origin.y||this.origin.y<0||this.origin.y>t.contentSize.height)&&(this.origin.y=0),(null==this.size.width||this.size.width<=0)&&(this.size.width=t.contentSize.width),(null==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);null!=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);null!=n&&(r="GameSandBox://"+e,this.saveImage(n,r,i))}else{r="GameSandBox://"+e+"."+i;var o=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(t,o),o.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,r,n,o){BK.Notification.on("frame_final",this,function(){this.isInScreen();var t=new BK.WebGL,e="GameSandBox://"+r,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,6408,5121,i),this.saveImage(i,e,n),o&&o(e+"."+n)}.bind(this),!0)},this.shotToBuffFromGL=function(t,e){BK.Notification.on("frame_final",this,function(){this.isInScreen();var t=new BK.Buffer(this.size.height*this.size.width*4);(new BK.WebGL).glReadPixels(this.origin.x,this.origin.y,this.size.width,this.size.height,6408,5121,t),e&&e(t)}.bind(this),!0)}},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(){return{openTransparent:function(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)},closeTransparent:function(t){var e={taskId:t};BK.MQQ.SsoRequest.send(e,"cs.closeWebview.local")},sendMessageToWebView:function(t,e){var i={taskId:t,msg:e};BK.MQQ.SsoRequest.send(i,"cs.apolloGameTargetWebMessage.local")},onMessageHandle:function(r){BK.MQQ.SsoRequest.addListener("sc.web_callback_game.local",null,function(t,e,i){r&&r(e,i)})}}}),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 n=BK.Audio,t=function(){function o(t,e,i){this.__nativeObj=new n(t,e,i),this._type=t,this.path=e,this._loopCount=i}return Object.defineProperty(o.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(o.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(o.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(o.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(o.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(o.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(o.prototype,"duration",{get:function(){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5"))return this.__nativeObj.duration},enumerable:!0,configurable:!0}),o.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()}},o.resumeAllBackground=function(){if(this.playingBackgrounds)for(var t=0;t<this.playingBackgrounds.length;t++){var e=this.playingBackgrounds[t];"string"!=typeof e.music?(e.music.resumeMusic(),BK.Script.log(0,0," music.resumeMusic not string")):(BK.Script.log(0,0," music.resumeMusic "+typeof e.music),n.playMusic(e.type,e.music,e.loop))}},o.removeBackgrounFromArray=function(t){if(this.playingBackgrounds){for(var e=0;e<o.playingBackgrounds.length;e++){o.playingBackgrounds[e].music}0}},o.addBackgroundToArray=function(t,e,i){var r={music:t,type:e,loop:i};void 0===this.playingBackgrounds&&(this.playingBackgrounds=[]);for(var n=0;n<o.playingBackgrounds.length;n++){o.playingBackgrounds[n].music}this.playingBackgrounds.push(r)},o.playMusic=function(t,e,i){var r=new n(t,e,i);r.startMusic(function(){}),0==t&&o.addBackgroundToArray(r,t,i)},o.prototype.startMusic=function(t){"ios"===GameStatusInfo.platform&&-1<GameStatusInfo.QQVer.indexOf("7.5.8")?n.playMusic(this._type,this.path,this._loopCount):(null!=t&&null!=t?this.__nativeObj.startMusic(t):this.__nativeObj.startMusic(),0==this._type&&o.addBackgroundToArray(this.__nativeObj,this._type,this._loopCount))},o.prototype.pauseMusic=function(){"ios"===GameStatusInfo.platform&&-1<GameStatusInfo.QQVer.indexOf("7.5.8")||(this.__nativeObj.pauseMusic(),0==this._type&&o.removeBackgrounFromArray(this.__nativeObj))},o.prototype.resumeMusic=function(){"ios"===GameStatusInfo.platform&&-1<GameStatusInfo.QQVer.indexOf("7.5.8")||(this.__nativeObj.resumeMusic(),0==this._type&&o.addBackgroundToArray(this.__nativeObj,this._type,this._loopCount))},o.prototype.stopMusic=function(){"ios"===GameStatusInfo.platform&&-1<GameStatusInfo.QQVer.indexOf("7.5.8")||(0==this._type&&o.removeBackgrounFromArray(this.__nativeObj),this.__nativeObj.stopMusic())},o.prototype.seekTo=function(t){1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")&&this.__nativeObj.seekTo(t)},o}();return Object.defineProperty(t,"switch",{get:function(){return n.switch},set:function(t){n.switch=t},enumerable:!0,configurable:!0}),t}),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(o,a){BK.MQQ.Account.getHead(o,function(t,e){if(e&&e.buffer&&e.width&&e.height)if(BK.Image.saveImage)BK.Image.saveImage(e.buffer,e.width,e.height,headCacheDir_1+t,"jpg"),a(t,headCacheDir_1+t+".jpg");else{var i=new BK.Texture(e.buffer,e.width,e.height),r=new BK.Sprite(e.width,e.height,i,0,0,1,1),n=new BK.RenderTexture(e.width,e.height);BK.Render.renderToTexture(r.__nativeObj?r.__nativeObj:r,n),n.saveTo(headCacheDir_1+t),a(o,headCacheDir_1+t)}else a(o,"")})}),BK.MQQ.Account.getUserInfo=function(r){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var t="cs.get_user_info.local";r&&(BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r(t,i)}),BK.MQQ.SsoRequest.send(null,t))}else r(-1,null)},BK.MQQ.Account.getFriends=function(r){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var t="cs.get_app_friends.local";r&&(BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r(t,i)}),BK.MQQ.SsoRequest.send(null,t))}else r(-1,null)},BK.MQQ.Account.getLocation=function(r){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var t="cs.get_location.local";r&&(BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r(t,i)}),BK.MQQ.SsoRequest.send(null,t))}else r(-1,null)},BK.MQQ.Account.getCity=function(r){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var t="cs.get_city.local";r&&(BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r(t,i)}),BK.MQQ.SsoRequest.send(null,t))}else r(-1,null)},BK.MQQ.Account.preloadUserInfoList=function(t,r){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var e="cs.preload_userInfoList.local";if(r){var i={openIdList:t};BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(t,e,i){r(t)}),BK.MQQ.SsoRequest.send(i,e)}}else r(-1)},BK.MQQ.Account.queryNick=function(t,e,i,r,n){var o=new BK.QQNickCanvas(t,e,i,r,function(t,e){n(o.__nativeObj,e)})},BK.MQQ.Account.queryHead=function(t,e,i,r,n){var o=new BK.QQAvatarCanvas(t,e,i,r,null,function(t,e){n(o.__nativeObj,e)})},BK.MQQ.Account.login=function(r){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")){var t="cs.xy_login.local";BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){i&&i.type&&("complete"==i.type&&r&&r.complete&&r.complete(i),"unauthorized"==i.type&&r&&r.fail&&r.fail(i),"failure"==i.type&&r&&r.fail&&r.fail(i),"success"==i.type&&r&&r.success&&r.success(i))}),BK.MQQ.SsoRequest.send(null,t)}else r&&r.fail&&r.fail({ret:1,type:"verionErr"})}}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)),o=0;o<n;o++)if(i[o]!=r[o])return i[o]<r[o];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)),o=0;o<n;o++){if(i[o]<r[o])return!0;if(i[o]>r[o])return!1}return!1}),function(t,e){var i,r,n;"object"==typeof t&&(t.TouchEventDispatch=(i=BK.TouchEvent.getAllTouchEvent,r=BK.TouchEvent.getTouchEvent,n=BK.TouchEvent.updateTouchStatus,{TouchEventDispatch:function(){function t(){}return t.listenAllTouch=function(t,e){void 0===this.listenerInfos&&(this.listenerInfos=[]);var i={obj:t,callback:e};this.listenerInfos.push(i)},t.remove=function(t){for(var e=-1,i=this.listenerInfos.length,r=0;r<i;r++){var n=this.listenerInfos[r];n.obj==t&&(e=r)}-1!=e&&this.listenerInfos.splice(e,1)},t.dispatch=function(e){e&&this.listenerInfos.forEach(function(t){t.callback(e)})},t.getTouchEvent=function(){var t=r();return t&&this.dispatch([t]),t},t.getAllTouchEvent=function(){var t=i();return t&&this.dispatch(t),t},t.updateTouchStatus=function(){n()},t.listenerInfos=[],t}()}).TouchEventDispatch)}(BK),BK.TouchEvent=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}(),function(i,t){var r=!1,n=function(){};BK.Notification=new BK.Emitter;var o=i._tickerCallback_;i._tickerCallback_=function(t,e){try{i.gl&&0==r&&(r=!0,function(){this.__gl=bkWebGLGetInstance(),this.__oldGlCommit=this.__gl.glCommit,this.__gl.glCommit=n,this.__gl.__oldGlCommit=this.__oldGlCommit,n.bind(this.__gl)}()),o(t,e),i.gl&&i.gl.__oldGlCommit()}catch(t){}BK.Notification.emitAll("frame_final",{})}}(this),function(e,i){var r=void 0;function n(t){if(r&&r(t.message?t.message:t,t.stack),e.Script&&e.Script.onerror)try{e.Script.onerror(t)}catch(t){i.Script.log(1,1,"global exception catcher:"+t)}}i.Script.setErrorObserver=function(t){r=t},e._globalErrorCallback_=n,i.MQQ.SsoRequest.addListener("cs.xy_error_info.local",this,function(t,e,i){n(i.data)})}(this,BK);var gl,isSupportTA,scriptObj=BK.Script;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(null==isSupportTA){"android"==GameStatusInfo.platform&&(isSupportTA=!0);var t=BK.Director.queryDeviceInfo(),e=t.version.split(".");isSupportTA="ios"==t.platform&&10<=Number(e[0])||"android"==t.platform||(BK.Script.log(1,0,"Current Device dont supoort TypedArray.[info = "+JSON.stringify(t)+"]"),!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())return t;var e=t instanceof ArrayBuffer;return BK.Misc.arrayBufferToBKBuffer(e?t:t.buffer,e?0:t.byteOffset,t.byteLength)}BK.Script.innerLoadLib=scriptObj.loadlib,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(){BK.Notification.emitAll("game_close",{}),BK.MQQ.SsoRequest.send({},"cs.close_room.local")}.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))}}(),BK.FileUtil.upload=function(){function h(t,e,i){for(var r=1024<t.length?1024:t.length,n=new Uint8Array(r),o=0;o<r/2;o++)n[o]=t.readUint8Buffer();t.jumpBytes(t.length-r);for(var o=r/2;o<r;o++)n[o]=t.readUint8Buffer();t.rewind();var a=new Date,s=a.getFullYear()+(a.getMonth()+1<10?0+(a.getMonth()+1):a.getMonth()+1)+a.getDate(),h=e.signTime,l=e.tmpSecretId,c=e.sessionToken,u="/"+GameStatusInfo.gameId+"_"+BK.Crypt.bin2hex(BK.Crypt.core_md5(n,r))+GameStatusInfo.gameId+"_"+s+".png",_=e.upLoadPrefUrl.replace(new RegExp("http://","gm"),""),d=e.downloadUrl,f=e.signature,p="put\n"+u+"\n\nhost="+_+"&x-cos-storage-class=nearline\n",g="sha1\n"+h+"\n"+BK.Crypt.hex_sha1(p)+"\n",m=BK.Crypt.hex_hmac_sha1(f,g),v="q-sign-algorithm=sha1&q-ak="+l+"&q-sign-time="+h+"&q-key-time="+h+"&q-header-list=host;x-cos-storage-class&q-url-param-list=&q-signature="+m,S=new BK.HttpUtil("https://"+_+u);S.setHttpMethod("put"),S.setHttpHeader("host",_),S.setHttpHeader("x-cos-storage-class","nearline"),S.setHttpHeader("x-cos-security-token",c),S.setHttpHeader("authorization",v),S.setBodyCompatible(!1),S.setHttpRawBody(t),S.requestAsync(function(t,e){i(e,d+u)})}return BK.FileUtil.uploadFromFile=function(t,e){var i=BK.FileUtil.readFile(t);i&&0<i.length?BK.FileUtil.uploadFromBuff(i,e):(BK.Script.log(1,1,"uploadFromFile failed.file is empty!"),e(-1,""))},BK.FileUtil.uploadFromBuff=function(i,r){BK.QQ.queryCloudSignature(function(t,e){h(i,e,r)})},BK.FileUtil.uploadFromNode=function(t,i){var e=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(t,e),e.writeToDiskWithXY("GameSandBox://temp.png",t.position.x,t.position.y,t.contentSize.width,t.contentSize.height);var r=BK.FileUtil.readFile("GameSandBox://temp.png");BK.QQ.queryCloudSignature(function(t,e){h(r,e,i)})},BK.FileUtil.uploadNode=function(t,e,i,r,n,o){var a=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(t,a),a.writeToDiskWithXY("GameSandBox://temp.png",e,i,r,n);var s=BK.FileUtil.readFile("GameSandBox://temp.png");BK.QQ.queryCloudSignature(function(t,e){h(s,e,o)})},h}(),BK.QQ.shareToArkFromFile=function(i,r,n,t){BK.FileUtil.uploadFromFile(t,function(t,e){BK.QQ.shareToArk(i,r,e,!0,n)})},BK.QQ.shareToArkFromBuff=function(i,r,n,t){BK.FileUtil.uploadFromBuff(t,function(t,e){200==t&&BK.QQ.shareToArk(i,r,e,!0,n)})},BK.QQ.shareToArkFromNode=function(i,r,n,t){BK.FileUtil.uploadFromNode(t,function(t,e){200==t&&BK.QQ.shareToArk(i,r,e,!0,n)})},BK.QQ.shareToArkFromGLShot=function(i,r,n,t){var e=new BK.ScreenShot;e.origin={x:t.x,y:t.y},e.size={width:t.width,height:t.height};var o="GameSandBox://"+BK.Time.timestamp;e.shotToFileFromGL(void 0,o,"png",function(t){BK.FileUtil.uploadFromFile(t,function(t,e){200==t&&BK.QQ.shareToArk(i,r,e,!0,n),BK.FileUtil.isFileExist(o)&&BK.FileUtil.deleteFile(o)})})},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(){return new function(){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;0<=r;r--){var n=i[r],o=this.nodeTreeHittest(n,e);if(null!=o)return o}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,o=0;o<this._eventMap[e].length;o++)this._eventMap[e][o].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);0<=i&&(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 o=this._eventMap[e][n];if(t&&o.obj==t){var a=o.func;a&&a(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(null!=t)for(var e=0;e<t.length;e++)for(var i=t[e],r=0;r<i.length;r++){var n=i[r].x,o=i[r].y;if(2==i[r].status)if(-1==this.isFirstTouchDown){this.isFirstTouchDown=i[r].id;var a=this.treeHittest({x:n,y:o});a?(this.currentNode=a,this.triggerEvent(this.currentNode,1,n,o)):this.currentNode=void 0}else BK.Script.log(0,0,"detectGesture begin not first id:"+i[r].id+" x:"+n+" y:"+o);else 3==i[r].status?-1!=this.isFirstTouchDown&&i[r].id==this.isFirstTouchDown?this.currentNode&&this.triggerEvent(this.currentNode,2,n,o):BK.Script.log(0,0,"detectGesture moved! Failed touchArr[i].id = "+i[r].id):1==i[r].status&&(-1!=this.isFirstTouchDown&&i[r].id==this.isFirstTouchDown?(this.isFirstTouchDown=-1,this.currentNode&&(this.triggerEvent(this.currentNode,3,n,o),this.currentNode=void 0)):BK.Script.log(0,0,"detectGesture end!!!Failed!!! touchArr[i].id= "+i[r].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))}}),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;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);var 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);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,n){this.normalUrl=t,new BK.HttpUtil(this.normalUrl).requestAsync(function(t,e){if(200==e){var i="GameSandBox://btntmp/"+this.normalUrl;BK.FileUtil.writeBufferToFile(i,t);var r=new BK.Texture(i);this.setNormalTexture(r)}else BK.Script.log(1,1,"Fetch advertisemSent image failed.");n&&n(this,e)}.bind(this))},t.prototype.setPressTextureFromUrl=function(t,n){this.pressUrl=t,new BK.HttpUtil(this.pressUrl).requestAsync(function(t,e){if(200==e){var i="GameSandBox://btntmp/"+this.pressUrl;BK.FileUtil.writeBufferToFile(i,t);var r=new BK.Texture(i);this.setPressTexture(r)}else BK.Script.log(1,1,"Fetch advertisement image failed.");n&&n(this,e)}.bind(this))},t.prototype.setDisableTextureFromUrl=function(t,n){this.disableUrl=t,new BK.HttpUtil(this.disableUrl).requestAsync(function(t,e){if(200==e){var i="GameSandBox://btntmp/"+this.disableUrl;BK.FileUtil.writeBufferToFile(i,t);var r=new BK.Texture(i);this.setDisableTexture(r)}else BK.Script.log(1,1,"Fetch advertisement image failed.");n&&n(this,e)}.bind(this))},t});var firstFrameUpload=!1;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,o,a){glpause||gl.glCompressedTexImage2D(t,e,i,r,n,o,a)}function compressedTexSubImage2D(t,e,i,r,n,o,a,s){glpause||gl.glCompressedTexSubImage2D(t,e,i,r,n,o,a,s)}function copyTexImage2D(t,e,i,r,n,o,a,s){glpause||gl.glCopyTexImage2D(t,e,i,r,n,o,a,s)}function copyTexSubImage2D(t,e,i,r,n,o,a,s){glpause||gl.glCopyTexSubImage2D(t,e,i,r,n,o,a,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),0<i&&checkFirstFrames())}function drawElements(t,e,i,r){glpause||(gl.glDrawElements(t,e,i,r),0<e&&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,o,a){}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],o=arguments[5];Object.prototype.hasOwnProperty.call(o,"__nativeObj")?gl.glTexImage2D(t,e,i,r,n,o.__nativeObj):Object.prototype.hasOwnProperty.call(o,"buffer")&&Object.prototype.hasOwnProperty.call(o.buffer,"eof")&&Object.prototype.hasOwnProperty.call(o.buffer,"pointer")&&Object.prototype.hasOwnProperty.call(o.buffer,"netOrder")&&0<o.width&&0<o.height?gl.glTexImage2D(t,e,i,r,n,o):Object.prototype.hasOwnProperty.call(o,"buffer")&&o.buffer.__proto__.hasOwnProperty("eof")&&o.buffer.__proto__.hasOwnProperty("pointer")&&o.buffer.__proto__.hasOwnProperty("netOrder")&&0<o.width&&0<o.height&&gl.glTexImage2D(t,e,i,r,n,o);break;case 9:var a=arguments[3],s=arguments[4],h=arguments[5],l=(r=arguments[6],n=arguments[7],arguments[8]);gl.glTexImage2D(t,e,i,a,s,h,r,n,l)}}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],o=arguments[5],a=arguments[6];Object.prototype.hasOwnProperty.call(a,"__nativeObj")?gl.glTexSubImage2D(t,e,i,r,n,o,a.__nativeObj):gl.glTexSubImage2D(t,e,i,r,n,o,a);break;case 9:var s=arguments[4],h=arguments[5],l=(n=arguments[6],o=arguments[7],arguments[8]);gl.glTexSubImage2D(t,e,i,r,s,h,n,o,l)}}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,o,a){if(!glpause){if(void 0===a){var s={index:t,size:e,type:i,normalized:r,stride:n,offset:o};void 0===gl.recordVertexAttribPointer&&(gl.recordVertexAttribPointer=[]);for(var h=!1,l=0;l<gl.recordVertexAttribPointer.length;l++){if(gl.recordVertexAttribPointer[l].index==s.index){h=!0,gl.recordVertexAttribPointer[l]=s;break}}0==h&&gl.recordVertexAttribPointer.push(s)}gl.glVertexAttribPointer(t,e,i,r,n,o)}}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:var e=gl.glGetParameterInt(gl.NUM_SHADER_BINARY_FORMATS,1);return gl.glGetParameterInt(t,e);case gl.COMPRESSED_TEXTURE_FORMATS:e=gl.glGetParameterInt(gl.NUM_COMPRESSED_TEXTURE_FORMATS,1);return gl.glGetParameterInt(t,e)}}function voidFunc(t,e,i,r,n,o,a,s,h,l){}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.glReadPixels=voidFunc,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}var buffer_data,bufferdata_array,bufferdata_view,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,bufferdata_pointer=0;function OpenOptMode(){gl.flushCommand&&isSupportTypeArray()&&attachMethodOpt(),buffer_data=new Float32Array(total_size)}function closeOptMode(){attachMethod()}function flushCommand(){0<next_index&&(gl.flushCommand(next_index,buffer_data),next_index=0)}function glCommitOpt(){flushCommand(),gl.commit()}function activeTextureOpt(t){total_size<next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ACTIVE_TEXTURE,buffer_data[next_index+1]=t,next_index+=2}function attachShaderOpt(t,e){total_size<next_index+3&&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){total_size<next_index+3&&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){total_size<next_index+3&&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){total_size<next_index+5&&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){total_size<next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_EQUATION,buffer_data[next_index+1]=t,next_index+=2}function blendEquationSeparateOpt(t,e){total_size<next_index+3&&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){total_size<next_index+3&&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){total_size<next_index+5&&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){total_size<next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR,buffer_data[next_index+1]=t,next_index+=2}function clearColorOpt(t,e,i,r){total_size<next_index+5&&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){total_size<next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR_DEPTH,buffer_data[next_index+1]=t,next_index+=2}function clearStencilOpt(t){total_size<next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR_STENCIL,buffer_data[next_index+1]=t,next_index+=2}function colorMaskOpt(t,e,i,r){total_size<next_index+5&&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){total_size<next_index+2&&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,o,a){flushCommand(),compressedTexImage2D(t,e,i,r,n,o,a)}function compressedTexSubImage2DOpt(t,e,i,r,n,o,a,s){flushCommand(),compressedTexSubImage2D(t,e,i,r,n,o,a,s)}function copyTexImage2DOpt(t,e,i,r,n,o,a,s){total_size<next_index+9&&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]=o,buffer_data[next_index+7]=a,buffer_data[next_index+8]=s,next_index+=9}function copyTexSubImage2DOpt(t,e,i,r,n,o,a,s){total_size<next_index+9&&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]=o,buffer_data[next_index+7]=a,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){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CULL_FACE,buffer_data[next_index+1]=t,next_index+=2}function deleteBufferOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_BUFFER,buffer_data[next_index+1]=t,next_index+=2}function deleteFramebufferOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_FRAME_BUFFER,buffer_data[next_index+1]=t,next_index+=2}function deleteProgramOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function deleteRenderbufferOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_RENDER_BUFFER,buffer_data[next_index+1]=t,next_index+=2}function deleteShaderOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_SHADER,buffer_data[next_index+1]=t,next_index+=2}function deleteTextureOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_TEXTURE,buffer_data[next_index+1]=t,next_index+=2}function depthFuncOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DEPTH_FUNC,buffer_data[next_index+1]=t,next_index+=2}function depthMaskOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DEPTH_MASK,buffer_data[next_index+1]=t?1:0,next_index+=2}function depthRangeOpt(t,e){total_size<=next_index+3&&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){total_size<=next_index+3&&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){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DISABLE,buffer_data[next_index+1]=t,next_index+=2}function disableVertexAttribArrayOpt(t){total_size<=next_index+2&&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){total_size<=next_index+4&&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,0<i&&checkFirstFrames()}function drawElementsOpt(t,e,i,r){total_size<=next_index+5&&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,0<e&&checkFirstFrames()}function enableOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ENABLE,buffer_data[next_index+1]=t,next_index+=2}function enableVertexAttribArrayOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ENABLE_VERTEX_ATTRIB_ARRAY,buffer_data[next_index+1]=t,next_index+=2}function finishOpt(){total_size<=next_index+1&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FINISH,next_index+=1}function flushOpt(){total_size<=next_index+1&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FLUSH,next_index+=1}function framebufferRenderbufferOpt(t,e,i,r){total_size<=next_index+5&&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){total_size<=next_index+6&&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){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FRONT_FACE,buffer_data[next_index+1]=t,next_index+=2}function generateMipmapOpt(t){total_size<=next_index+2&&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){total_size<=next_index+3&&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){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_LINE_WIDTH,buffer_data[next_index+1]=t,next_index+=2}function linkProgramOpt(t){total_size<=next_index+2&&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){total_size<=next_index+3&&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,o,a){}function renderbufferStorageOpt(t,e,i,r){total_size<=next_index+5&&flushCommand(),buffer_data[next_index]=GL_COMMAND_RENDER_BUFFER_STORAGE,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 sampleCoverageOpt(t,e){total_size<=next_index+3&&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){total_size<=next_index+5&&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){total_size<=next_index+4&&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){total_size<=next_index+5&&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){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_MASK,buffer_data[next_index+1]=t,next_index+=2}function stencilMaskSeparateOpt(t,e){total_size<=next_index+3&&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){total_size<=next_index+4&&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){total_size<=next_index+5&&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],o=arguments[5];Object.prototype.hasOwnProperty.call(o,"__nativeObj")?gl.glTexImage2D(t,e,i,r,n,o.__nativeObj):Object.prototype.hasOwnProperty.call(o,"buffer")&&Object.prototype.hasOwnProperty.call(o.buffer,"eof")&&Object.prototype.hasOwnProperty.call(o.buffer,"pointer")&&Object.prototype.hasOwnProperty.call(o.buffer,"netOrder")&&0<o.width&&0<o.height&&gl.glTexImage2D(t,e,i,r,n,o);break;case 9:var a=arguments[3],s=arguments[4],h=arguments[5],l=(r=arguments[6],n=arguments[7],arguments[8]);gl.glTexImage2D(t,e,i,a,s,h,r,n,l)}}function texParameterfOpt(t,e,i){total_size<=next_index+4&&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){total_size<=next_index+4&&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,o,a,s,h){flushCommand(),texSubImage2D(t,e,i,r,n,o,a,s,h)}function texSubImage2DOpt(t,e,i,r,n,o,a){flushCommand(),texSubImage2D(t,e,i,r,n,o,a)}function uniform1fOpt(t,e){total_size<=next_index+3&&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){total_size<=next_index+4&&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){total_size<=next_index+5&&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){total_size<=next_index+6&&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){total_size<=next_index+3&&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){total_size<=next_index+4&&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){total_size<=next_index+5&&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){total_size<=next_index+6&&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){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_USE_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function validateProgramOpt(t){total_size<=next_index+2&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VALIDATE_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function vertexAttrib1fOpt(t,e){total_size<=next_index+3&&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){total_size<=next_index+4&&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){total_size<=next_index+5&&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){total_size<=next_index+6&&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,o){total_size<=next_index+7&&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]=o,next_index+=7}function viewportOpt(t,e,i,r){total_size<=next_index+5&&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&&10<=Number(e[0])}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(t,e){if("object"==typeof t){var i=function(){function f(t){return.01745329251994*t}return{Matrix:function(){function d(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this.data=new Float32Array(16),arguments.length){if(1==arguments.length){if(arguments[0]instanceof d==1)for(var i=0;i<16;i++)this.data[i]=arguments[0].data[i]}else if(16==arguments.length)for(var i=0;i<16;i++)this.data[i]=arguments[i]}else this.data[0]=1,this.data[5]=1,this.data[10]=1,this.data[15]=1}return d.prototype.clone=function(){return new d(this)},d.prototype.mul=function(t){var e=this.data[0],i=this.data[1],r=this.data[2],n=this.data[3],o=this.data[4],a=this.data[5],s=this.data[6],h=this.data[7],l=this.data[8],c=this.data[9],u=this.data[10],_=this.data[11],d=this.data[12],f=this.data[13],p=this.data[14],g=this.data[15],m=t.data[0],v=t.data[1],S=t.data[2],b=t.data[3],y=t.data[4],T=t.data[5],B=t.data[6],E=t.data[7],x=t.data[8],C=t.data[9],R=t.data[10],A=t.data[11],I=t.data[12],O=t.data[13],M=t.data[14],P=t.data[15];return this.data[0]=e*m+o*v+l*S+d*b,this.data[1]=i*m+a*v+c*S+f*b,this.data[2]=r*m+s*v+u*S+p*b,this.data[3]=n*m+h*v+_*S+g*b,this.data[4]=e*y+o*T+l*B+d*E,this.data[5]=i*y+a*T+c*B+f*E,this.data[6]=r*y+s*T+u*B+p*E,this.data[7]=n*y+h*T+_*B+g*E,this.data[8]=e*x+o*C+l*R+d*A,this.data[9]=i*x+a*C+c*R+f*A,this.data[10]=r*x+s*C+u*R+p*A,this.data[11]=n*x+h*C+_*R+g*A,this.data[12]=e*I+o*O+l*M+d*P,this.data[13]=i*I+a*O+c*M+f*P,this.data[14]=r*I+s*O+u*M+p*P,this.data[15]=n*I+h*O+_*M+g*P,this},d.prototype.mulPoint=function(t){var e=this.data[0],i=this.data[1],r=this.data[2],n=this.data[3],o=this.data[4],a=this.data[5],s=this.data[6],h=this.data[7],l=this.data[8],c=this.data[9],u=this.data[10],_=this.data[11],d=this.data[12],f=this.data[13],p=this.data[14],g=this.data[15];void 0===t.z&&(t.z=0);var m={x:0,y:0,z:0};m.x=e*t.x+o*t.y+l*t.z+d,m.y=i*t.x+a*t.y+c*t.z+f,m.z=r*t.x+s*t.y+u*t.z+p;t.x,t.y,t.z;return m},d.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],o=this.data[2]*this.data[7]-this.data[6]*this.data[3],a=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],l=this.data[1]*this.data[15]-this.data[13]*this.data[3],c=this.data[1]*this.data[11]-this.data[9]*this.data[3],u=this.data[1]*this.data[7]-this.data[5]*this.data[3],_=this.data[9]*this.data[14]-this.data[13]*this.data[10],d=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],p=this.data[1]*this.data[14]-this.data[13]*this.data[2],g=this.data[1]*this.data[10]-this.data[9]*this.data[2],m=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]*o,y=this.data[5]*n-this.data[1]*i-this.data[9]*o,T=this.data[8]*e-this.data[4]*t-this.data[12]*i,B=this.data[0]*t-this.data[8]*r+this.data[12]*n,E=this.data[4]*r-this.data[0]*e-this.data[12]*o,x=this.data[0]*i-this.data[4]*n+this.data[8]*o,C=this.data[4]*a-this.data[8]*s+this.data[12]*h,R=this.data[8]*l-this.data[0]*a-this.data[12]*c,A=this.data[0]*s-this.data[4]*l+this.data[12]*u,I=this.data[4]*c-this.data[0]*h-this.data[8]*u,O=this.data[8]*d-this.data[4]*_-this.data[12]*f,M=this.data[0]*_-this.data[8]*p+this.data[12]*g,P=this.data[4]*p-this.data[0]*d-this.data[12]*m,w=this.data[0]*f-this.data[4]*g+this.data[8]*m,N=this.data[0]*v+this.data[1]*T+this.data[2]*C+this.data[3]*O;return 0!=N&&(this.data[0]=v/N,this.data[4]=T/N,this.data[8]=C/N,this.data[12]=O/N,this.data[1]=S/N,this.data[5]=B/N,this.data[9]=R/N,this.data[13]=M/N,this.data[2]=b/N,this.data[6]=E/N,this.data[10]=A/N,this.data[14]=P/N,this.data[3]=y/N,this.data[7]=x/N,this.data[11]=I/N,this.data[15]=w/N),this},d.prototype.scale=function(t,e,i){var r=d.fromScale(t,e,i);return this.mul(r)},d.prototype.rotate=function(t,e,i){var r=d.fromEulerAngle(t,e,i);return this.mul(r)},d.prototype.translate=function(t,e,i){var r=d.fromTranslate(t,e,i);return this.mul(r)},d.prototype.transform=function(t,e,i){var r=t*this.data[0]+e*this.data[4]+i*this.data[8]+1*this.data[12],n=t*this.data[1]+e*this.data[5]+i*this.data[9]+1*this.data[13],o=t*this.data[2]+e*this.data[6]+i*this.data[10]+1*this.data[14];return{x:r,y:n,z:o}},d.prototype.toEulerAngle=function(){var t=0,e=0,i=0,r=this.data[0],n=this.data[4],o=this.data[8],a=this.data[5],s=this.data[2],h=this.data[6],l=this.data[10],c=-h;e=c<=-1?-1.570796:1<=c?1.570796:Math.asin(c),.9999<Math.abs(c)?(i=0,t=Math.atan2(-o,r)):(t=Math.atan2(s,l),i=Math.atan2(n,a));var u=new Float32Array(3);return u[0]=e,u[1]=t,u[2]=i,u},d.fromScale=function(t,e,i){var r=new d;return r.data[0]=t,r.data[5]=e,r.data[10]=i,r},d.fromTranslate=function(t,e,i){var r=new d;return r.data[12]=t,r.data[13]=e,r.data[14]=i,r},d.fromEulerAngle=function(t,e,i){var r=-f(t),n=-f(e),o=-f(i),a=Math.cos(r),s=Math.sin(r),h=Math.cos(n),l=Math.sin(n),c=Math.cos(o),u=Math.sin(o),_=new d(a*c+s*l*u,-a*u+s*l*c,s*h,0,u*h,c*h,-l,0,-s*c+a*l*u,u*s+a*l*c,a*h,0,0,0,0,1);return _},d.fromViewport=function(t,e,i,r,n,o){var a=new d;return a.data[0]=(e-t)/2,a.data[5]=(r-i)/2,a.data[10]=(o-n)/2,a.data[12]=(t+e)/2,a.data[13]=(r+i)/2,a.data[14]=(n+o)/2,a.data[15]=1,a},d.fromOrthographic=function(t,e,i,r,n,o){var a=new d;return a.data[0]=2/(e-t),a.data[5]=2/(r-i),a.data[10]=2/(n-o),a.data[12]=(t+e)/(t-e),a.data[13]=(r+i)/(i-r),a.data[14]=(n+o)/(n-o),a.data[15]=1,a},d}()}}();t.JSMatrix=i.Matrix}}(BK),function(t,e){"object"==typeof t&&(t.JSTransform=function(){function i(t){if(null==t)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(t instanceof i!=1)throw new Error("BK.Transform.constructor!paramater error");this.transform=new Float32Array(19),this._localAnchorOrPivot=t._localAnchorOrPivot,this._parentAnchorOrPivot=t._parentAnchorOrPivot,this._needUpdate=t._needUpdate;for(var e=0;e<19;e++)this.transform[e]=t.transform[e]}this.matrix={get:function(){return null},set:function(t,e,i,r,n,o){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]=o,this.transform[10]=0}}}return Object.defineProperty(i.prototype,"needUpdate",{get:function(){return this._needUpdate},set:function(t){this._needUpdate=t},enumerable:!0,configurable:!0}),i.prototype.getNeedUpdate=function(){return this._needUpdate},i.prototype.setNeedUpdate=function(t){this._needUpdate=t},Object.defineProperty(i.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]=null==t.x?1:t.x,this.transform[3]=null==t.y?1:t.y,this.transform[4]=null==t.z?1:t.z)},enumerable:!0,configurable:!0}),Object.defineProperty(i.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]=null==t.x?0:t.x,this.transform[6]=null==t.y?0:t.y,this.transform[7]=null==t.z?0:t.z)},enumerable:!0,configurable:!0}),Object.defineProperty(i.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]=null==t.x?0:t.x,this.transform[9]=null==t.y?0:t.y,this.transform[10]=null==t.z?0:t.z)},enumerable:!0,configurable:!0}),i.prototype.getPosition=function(){return{x:this.transform[8],y:this.transform[9],z:this.transform[10]}},i.prototype.setPosition=function(t,e,i){this.transform[8]==t&&this.transform[9]==e&&this.transform[10]==i||(this._needUpdate=!0,this.transform[8]=null==t?0:t,this.transform[9]=null==e?0:e,this.transform[10]=null==i?0:i)},Object.defineProperty(i.prototype,"localPivot",{get:function(){if(null!=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]=null==t.x?0:t.x,this.transform[12]=null==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"localAnchor",{get:function(){if(null!=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]=null==t.x?0:t.x,this.transform[14]=null==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pivotParent",{get:function(){if(null!=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]=null==t.x?0:t.x,this.transform[16]=null==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"anchorParent",{get:function(){if(null!=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]=null==t.x?0:t.x,this.transform[18]=null==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(i.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]=null==t.width?0:t.width,this.transform[1]=null==t.height?0:t.height)},enumerable:!0,configurable:!0}),i.prototype.getContentSize=function(){return{width:this.transform[0],height:this.transform[1]}},i.prototype.setContentSize=function(t,e){this.transform[0]==t&&this.transform[1]==e||(this._needUpdate=!0,this.transform[0]=null==t?0:t,this.transform[1]=null==e?0:e)},i.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},i}())}(BK);__extends=this&&this.__extends||function(){var r=function(t,e){return(r=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])})(t,e)};return function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}}();!function(t,e){if("object"==typeof t){var i=(r=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); }",o=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!=o&&(this._gl.shaderSource(o,r),this._gl.compileShader(o));var a=this._gl.createShader(this._gl.FRAGMENT_SHADER);0!=a&&(this._gl.shaderSource(a,n),this._gl.compileShader(a));var s=this._gl.createProgram();return this._gl.attachShader(s,o),this._gl.attachShader(s,a),this._gl.linkProgram(s),this._gl.deleteShader(o),this._gl.deleteShader(a),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),o=this._gl.getVertexAttrib(n,this._gl.VERTEX_ATTRIB_ARRAY_SIZE),a=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),l=this._gl.getVertexAttribOffset(n,gl.VERTEX_ATTRIB_ARRAY_POINTER);if(i.name=r,i.index=n,i.size=o,i.type=a,i.normalized=s,i.stride=h,i.offset=l,void 0!==this._gl.recordVertexAttribPointer)for(var c=0;c<this._gl.recordVertexAttribPointer.length;c++){var u=this._gl.recordVertexAttribPointer[c];if(i.index==u.index&&i.type==u.type&&i.stride==u.stride&&i.offset==u.offset){i.index=u.index,i.size=u.size,i.type=u.type,i.normalized=u.normalized,i.stride=u.stride,i.offset=u.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),0<this._activeAttribusInfo.length){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,o=e.normalized,a=e.offset,s=e.stride,h=0!=o;this.debugLog("restore name:"+e.name+" index:"+i+" size:"+r+" type:"+n+" normalized:"+o+" stride:"+s+" offset:"+a),this._gl.vertexAttribPointer(i,r,n,h,s,a,!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,e=t.data;this._gl.useProgram(this._program);var i=this._gl.getUniformLocation(this._program,"projMat");this._gl.uniformMatrix4fv(i,!1,e);var r=this._gl.getUniformLocation(this._program,"uSampler");this._gl.uniform1i(r,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 o=this._gl.getUniformLocation(this._program,"worldMat");this._gl.uniformMatrix4fv(o,!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}(),{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(r,n){var t=new BK.HttpUtil(r);t.requestAsync(function(t,e){if(1!=this._hasDispose){if(200==e){var i="GameSandBox://ad/"+r;BK.FileUtil.writeBufferToFile(i,t),this.path=i}else BK.Script.log(1,1,"Fetch advertisement Sent image failed.");n&&n(this,e)}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++){var e=this.children[t];e.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)._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)return 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},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 o=0;o<this._childrens.length;o++)this._childrens[o].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),o=e.mulPoint(r);return t.x>=n.x&&t.x<=o.x&&t.y>=n.y&&t.y<=o.y},t}(),GLRenderContext:r});t.GLRenderNode=i.GLRenderNode,t.GLRenderContext=i.GLRenderContext}var r}(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(n){function t(t,e,i){var r=n.call(this,t)||this;return r.updateTexture=function(t){},r.__nativeObj=new BK.GLRenderNode(t),r.contentSize={width:e,height:i},r.isCancelClick=void 0,r.touchStatus=0,r.canUserInteract=!0,r.enable=!0,r.canClick=!0,r.addTouchListener(),r}return __extends(t,n),t.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")},t.prototype.dispose=function(){UIEventHandler.removeNodeEvent(this,1),UIEventHandler.removeNodeEvent(this,2),UIEventHandler.removeNodeEvent(this,3),n.prototype.dispose.call(this)},t.prototype.changeStatus=function(t){this.touchStatus=t,this.updateTexture(t)},t.prototype.setTouchInsideCallback=function(t){this.touchInsideCallback=t},t}(BK.GLRenderNode)}),function(t,e){if("object"==typeof t){var i=(r="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; }",n="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); }",s=function(){function t(){this.videoViews=new Array,void 0!==BK.Director.setQAVDelegate&&BK.Director.setQAVDelegate(this)}return t.prototype.addView=function(e){var t=this.videoViews.filter(function(t){return e==t});return t.length||this.videoViews.push(e),0==t.length},t.prototype.delView=function(e){var t=this.videoViews.length;return this.videoViews=this.videoViews.filter(function(t){return e!=t}),t!=this.videoViews.length},t.prototype.onRemoveVideoPreview=function(e){this.videoViews.forEach(function(t){t.identifier==e.identifier&&t.render(e)})},t.prototype.onLocalVideoPreview=function(r){this.videoViews.forEach(function(t){if(t.identifier==r.identifier){var e=r,i=t;i.onPrePreview&&(e=i.onPrePreview.call(i,r)),t.render(e)}})},t.prototype.onLocalVideoPreProcess=function(i){this.videoViews.forEach(function(t){if(t.identifier==i.identifier){var e=t;e.onPreProcess&&e.onPreProcess.call(e,i)}})},t.Instance=new t,t}(),o=function(){function t(t,e,i,r,n,o,a){this.identifier=t,this.__nativeObj=new BK.Sprite(e,i,null,0,0,1,1),this._innerBindMethods4NativeObj(),null!=r&&null!=r||(r=!0),o&&(this.position=o),n?n.addChild(this):BK.Director.root.addChild(this),a&&(this.zOrder=a),1==r&&s.Instance.addView(this)}return t.prototype._innerBindMethods4NativeObj=function(n){var o=this,t=Object.getOwnPropertyNames(this.__nativeObj);t.forEach(function(t,e,i){var r=t;n&&-1!=n.indexOf(r)||Object.defineProperty(o,r,{get:function(){return this.__nativeObj[r]},set:function(t){this.__nativeObj[r]=t},enumerable:!0,configurable:!0})})},t.prototype.addChild=function(t){this.__nativeObj&&this.__nativeObj.addChild(t)},t.prototype._restartRenderTimer=function(){this.__renderTimeoutCallback&&0<this.__renderTimeoutThreshold&&(BK.Director.ticker.removeTimeout(this),BK.Director.ticker.setTimeout(function(t,e,i){this.__renderTimeoutCallback&&this.__renderTimeoutCallback.call(this)},this.__renderTimeoutThreshold,this))},t.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)},t.prototype._innerUseYUVMaterial_I420=function(t,e){if(this.__yuvMaterial||(this.__yuvMaterial=new BK.Render.Material(r,n,!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 i=this.__bitmapY.size;i.width==t&&i.height==e||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_I420!Y size change, ow = "+i.width+", oh = "+i.height+", nw = "+t+", nh = "+e),this.__bitmapY=BK.Texture.createBitmapTexture(t,e,7),this.__yuvMaterial.setTexture(0,this.__bitmapY))}else this.__bitmapY=BK.Texture.createBitmapTexture(t,e,7),this.__yuvMaterial.setTexture(0,this.__bitmapY);if(this.__bitmapU){var i=this.__bitmapU.size;i.width==t/2&&i.height==e/2||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_I420!U size change, ow = "+i.width+", oh = "+i.height+", nw = "+t+", nh = "+e),this.__bitmapU=BK.Texture.createBitmapTexture(t/2,e/2,7),this.__yuvMaterial.setTexture(1,this.__bitmapU))}else this.__bitmapU=BK.Texture.createBitmapTexture(t/2,e/2,7),this.__yuvMaterial.setTexture(1,this.__bitmapU);if(this.__bitmapV){var i=this.__bitmapV.size;i.width==t/2&&i.height==e/2||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_I420!V size change, ow = "+i.width+", oh = "+i.height+", nw = "+t+", nh = "+e),this.__bitmapV=BK.Texture.createBitmapTexture(t/2,e/2,7),this.__yuvMaterial.setTexture(2,this.__bitmapV))}else this.__bitmapV=BK.Texture.createBitmapTexture(t/2,e/2,7),this.__yuvMaterial.setTexture(2,this.__bitmapV)},t.prototype._innerUseYUVMaterial_NVxx=function(t,e){if(this.__yuvMaterial||(this.__yuvMaterial=new BK.Render.Material(r,n,!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 i=this.__bitmapY.size;i.width==t&&i.height==e||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_NVxx!Y size change, ow = "+i.width+", oh = "+i.height+", nw = "+t+", nh = "+e),this.__bitmapY=BK.Texture.createBitmapTexture(t,e,7),this.__yuvMaterial.setTexture(0,this.__bitmapY))}else this.__bitmapY=BK.Texture.createBitmapTexture(t,e,7),this.__yuvMaterial.setTexture(0,this.__bitmapY);if(this.__bitmapUV){var i=this.__bitmapUV.size;i.width==t/2&&i.height==e/2||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_NVxx!UV size change, ow = "+i.width+", oh = "+i.height+", nw = "+t+", nh = "+e),this.__bitmapUV=BK.Texture.createBitmapTexture(t/2,e/2,2),this.__yuvMaterial.setTexture(3,this.__bitmapUV))}else this.__bitmapUV=BK.Texture.createBitmapTexture(t/2,e/2,2),this.__yuvMaterial.setTexture(3,this.__bitmapUV)},t.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.setUVFlip(0,0),this.__nativeObj.setUVRotate(1);break;case 3:this.cameraPos&&1==this.cameraPos?this.__nativeObj.setUVFlip(0,1):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)}}},t.prototype.renderAsCache=function(t,e,i,r,n,o,a,s){switch(o){case 0:this._innerUseYUVMaterial_I420(t,e),this.__yuvMaterial.uniforms.formatYUV=o,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=o,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 = "+o),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,a))}else this.__cacheTexture=new BK.RenderTexture(i,r,a);if(this.__cacheSprite){var h=this.__cacheSprite.size;h.width==i&&h.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;this.__graphic.drawRenderTexture(this.__cacheTexture,function(){this.drawSprite(l.__cacheSprite)});var c=this.__cacheTexture.readPixels(0,0,i,r,a);return c},t.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},t.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},t.prototype.removeFromParent=function(){this.__nativeObj&&this.__nativeObj.removeFromParent()},t.prototype.setRenderTimeout=function(t,e){this.__renderTimeoutCallback=e,this.__renderTimeoutThreshold=t,0<this.__renderTimeoutThreshold&&this._restartRenderTimer()},t}(),a=function(){function t(){this.skipNum=-1}return t.prototype.start=function(t){var e=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=e,this.view=new o(e,t.width,t.height,!1,t.parent,t.position),s.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,function(t,e,r){if(BK.Script.log(0,0,"BK.Camera.switchCameraEvent222!data = "+JSON.stringify(r)),0==t){BK.Script.log(0,0,"BK.Camera.switchCameraEvent!data = "+JSON.stringify(r));var n=this;BK.Director.ticker.removeTimeout(this),BK.Director.ticker.setTimeout(function(t,e,i){n.view.cameraPos=r.cameraPos,n=null},160,this)}}.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),o={frameDesc:{},extraData:{}};return o.frameDesc.width=n.width*e,o.frameDesc.height=n.height*e,o.frameDesc.rotate=0,o.frameDesc.colorFormat=10,o.frameDesc.videoSrcType=t.frameDesc.videoSrcType,o.extraData.buffer=this.view.renderAsCache(i,r,n.width*e,n.height*e,t.frameDesc.rotate,t.frameDesc.colorFormat,6,t.extraData),o},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)),null==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}(),{QAVView:o,QAVCamera:new a});t.QAVView=i.QAVView,t.AVCamera=i.QAVCamera}var r,n,s,o,a}(BK),"object"==typeof BK&&(BK.QQAVManager=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(r,n){this.__enterQAVRoomIfNeed(function(t){if(0==t){var e={switch:r},i="cs.audioRoom_set_mic.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,n),BK.MQQ.SsoRequest.send(e,i)}else this.errorLog("setMic failed!start qav room failed")}.bind(this))},t.prototype.setSpeaker=function(r,n){this.__enterQAVRoomIfNeed(function(t){if(0==t){var e={switch:r},i="cs.audioRoom_set_speaker.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,n),BK.MQQ.SsoRequest.send(e,i)}else this.errorLog("setSpeaker failed!start qav room failed")}.bind(this))},t.prototype.switchCamera=function(r,n){this.__enterQAVRoomIfNeed(function(t){if(0==t){var e={cameraPos:r},i="cs.audioRoom_camera_switch.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,e,i){0==t&&(this._isFrontCamera=0==r),n(t,e,i)}.bind(this)),BK.MQQ.SsoRequest.send(e,i)}else this.errorLog("switchCamera failed!start qav room failed")}.bind(this))},t.prototype.enableCamera=function(r,n){this.__enterQAVRoomIfNeed(function(t){if(0==t){var e={switch:r},i="cs.audioRoom_camera_enable.local";this._isFrontCamera=!0,BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,n),BK.MQQ.SsoRequest.send(e,i)}else this.errorLog("enableCamera failed!start qav room failed")}.bind(this))},t.prototype.setBeauty=function(i){this.__enterQAVRoomIfNeed(function(t){if(0==t){var e={beauty:i};BK.MQQ.SsoRequest.send(e,"cs.audioRoom_set_beauty.local")}else this.errorLog("setBeauty failed!start qav room failed")}.bind(this))},t.prototype.setLocalVideo=function(i){this.__enterQAVRoomIfNeed(function(t){if(0==t){var e={switch:i};BK.MQQ.SsoRequest.send(e,"cs.audioRoom_set_local_video.local")}else this.errorLog("setLocalVideo failed!start qav room failed")}.bind(this))},t.prototype.watchRemoteVideo=function(i){this.__enterQAVRoomIfNeed(function(t){if(0==t){this.log("watchRemoteVideo ok1");var e={openIdList:i};BK.MQQ.SsoRequest.send(e,"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(i){this.__enterQAVRoomIfNeed(function(t){if(0==t){var e={switch:i};BK.MQQ.SsoRequest.send(e,"cs.audioRoom_set_remote_video.local")}else this.errorLog("setMic failed!start qav room failed")}.bind(this))},t.prototype.exitRoom=function(r){this._hasInitFlag=!1,this.__exitQAVRoom(function(t,e,i){this.log("exit qav room errCode:"+t),r(t,e,i)}.bind(this))},t.prototype.getEndpointList=function(t){var e="cs.audioRoom_get_endpointList.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send({},e)},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++){var n=this._callbackQueue[r];n(t)}this._callbackQueue.splice(0,this._callbackQueue.length)}.bind(this))))},t.prototype.initQAVRoom=function(t,r){var e="cs.audioRoom_init.local";if("ios"==GameStatusInfo.platform&&1==this._iosHasInitFlag)return this.log("ios init once "),void r(0,e,this._initData);1!=this._hasInitFlag?(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(t,e,i){this.log("cmd:"+e+" errCode:"+t+" data:"+JSON.stringify(i)),0==t&&(this._hasInitFlag=!0,this._initData=i,"ios"==GameStatusInfo.platform&&(this._iosHasInitFlag=!0,this.log("_iosHasInitFlag"))),r(t,e,i)}.bind(this)),BK.MQQ.SsoRequest.send(t,e)):this.log("AVRoom has been init .can't init Room twice !!")},t.prototype.enterQAVRoom=function(t,r){var e=t.gameRoomId,i=t.avRoomId,n=t.avRoleName,o=t.avKey,a={avRoomId:i,gameRoomId:e,avRoleName:n,avKey:o};this.avRoomId=i,this.gameRoomId=e,this.avRoleName=n;var s="cs.audioRoom_enter.local";BK.MQQ.SsoRequest.removeListener(s,this),BK.MQQ.SsoRequest.addListener(s,this,function(t,e,i){this.log("cmd:"+e+" errCode:"+t+" data:"+JSON.stringify(i)),r(t,e,i)}.bind(this)),BK.MQQ.SsoRequest.send(a,s),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(){if(!GameStatusInfo.avAppId)return this.log("GameStatusInfo.avAppId is null"),null;if(!GameStatusInfo.avAccountType)return this.log("GameStatusInfo.avAccountType is null"),null;if(!GameStatusInfo.avRoomId)return this.log("GameStatusInfo.avRoomId is null"),null;if(!GameStatusInfo.roomId)return this.log("GameStatusInfo.roomId is null"),null;var t={sdkAppId:GameStatusInfo.avAppId,accountType:GameStatusInfo.avAccountType,avRoomId:GameStatusInfo.avRoomId,gameRoomId:GameStatusInfo.roomId};return t},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(r){if(GameStatusInfo.devPlatform){var t={sdkAppId:1400035750,accountType:14181,avRoomId:122333,gameRoomId:54321,selfOpenId:GameStatusInfo.openId};t=this.__addQAVCfg(t),this.initAndEnterRoom(t,r)}else{var t=this.__checkGameStatusInfoParam();t?(t=this.__addQAVCfg(t),this.initAndEnterRoom(t,function(t,e,i){r(t,e,i)}.bind(this))):BK.QQ.addSSOJoinRoomCallBack(function(t,e,i){i.gameRoomId&&i.avRoomId&&i.sdkAppId&&i.accountType?(i=this.__addQAVCfg(i),this.initAndEnterRoom(i,r)):BK.Script.log(0,0,"addSSOJoinRoomCallBack data is incorrect.")}.bind(this))}},t.prototype.initAndEnterRoom=function(r,n){null!=r.sdkAppId?null!=r.accountType?null!=r.avRoomId?null!=r.gameRoomId?(this.setQAVCfg(r),this.log("initAndEnterRoom step1 initRoom cfg:"+JSON.stringify(r)),this.initQAVRoom(r,function(t,e,i){0==t?(this.log("initAndEnterRoom step2 enterRoom"),this.enterQAVRoom(r,function(t,e,i){0==t?(this.log("initAndEnterRoom step2 enterRoom succ!"),this._hasSuccEnter=!0):this._hasStartQAVRoomFlag=!1,n(t,e,i)}.bind(this))):(this.log("initAndEnterRoom failed cmd:"+e+" errCode:"+t+" data:"+JSON.stringify(i)),this._hasStartQAVRoomFlag=!1,n(t,e,i))}.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("\u8fdb\u5165\u623f\u95f4\u4e8b\u4ef6:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventEnterCallback&&this.eventCallbackConfig.eventEnterCallback(i.eventId,i)):2==i.eventId?(this.log("\u9000\u51fa\u623f\u95f4\u4e8b\u4ef6:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventExitCallback&&this.eventCallbackConfig.eventExitCallback(i.eventId,i)):3==i.eventId?(this.log("\u6709\u53d1\u6444\u50cf\u5934\u89c6\u9891\u4e8b\u4ef6\u3002:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventHasCameraVideoCallback&&this.eventCallbackConfig.eventHasCameraVideoCallback(i.eventId,i)):4==i.eventId?(this.log("\u65e0\u53d1\u6444\u50cf\u5934\u89c6\u9891\u4e8b\u4ef6\u3002:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNoCameraVideoCallback&&this.eventCallbackConfig.eventNoCameraVideoCallback(i.eventId,i)):5==i.eventId?(this.log("\u6709\u53d1\u8bed\u97f3\u4e8b\u4ef6\u3002:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventHasAudioCallback&&this.eventCallbackConfig.eventHasAudioCallback(i.eventId,i)):6==i.eventId?(this.log("\u65e0\u53d1\u8bed\u97f3\u4e8b\u4ef6\u3002:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNoAudioCallback&&this.eventCallbackConfig.eventNoAudioCallback(i.eventId,i)):7==i.eventId?(this.log("\u6709\u53d1\u5c4f\u5e55\u89c6\u9891\u4e8b\u4ef6\u3002:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventHasScreenVideoCallback&&this.eventCallbackConfig.eventHasScreenVideoCallback(i.eventId,i)):8==i.eventId?(this.log("\u65e0\u53d1\u5c4f\u5e55\u89c6\u9891\u4e8b\u4ef6\u3002:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNoScreenVideoCallback&&this.eventCallbackConfig.eventNoScreenVideoCallback(i.eventId,i)):9==i.eventId?(this.log("\u6709\u53d1\u6587\u4ef6\u89c6\u9891\u4e8b\u4ef6\u3002:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventHasMediaFileCallback&&this.eventCallbackConfig.eventHasMediaFileCallback(i.eventId,i)):10==i.eventId?(this.log("\u65e0\u53d1\u6587\u4ef6\u89c6\u9891\u4e8b\u4ef6\u3002:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNoMediaFileCallback&&this.eventCallbackConfig.eventNoMediaFileCallback(i.eventId,i)):42==i.eventId?(this.log("\u65b0\u6210\u5458\u8bf4\u8bdd:"+JSON.stringify(i.userInfo)),this.eventCallbackConfig&&this.eventCallbackConfig.eventNewSpeakCallback&&this.eventCallbackConfig.eventNewSpeakCallback(i.eventId,i)):43==i.eventId&&(this.log("\u65e7\u6210\u5458\u505c\u6b62\u8bf4\u8bdd:"+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}())),function(t,e){var i={setAccessoryAsync:function(t,c){this.loadJsonAtlasArray(t,function(t,e){for(var i=0;i<e.length;i++){var r=e[i],n=r.jsonInfo,o=r.atlasInfo,a=n.data,s=o.data,h=n.path,l=o.path;this.loadAccessory(a,h,s,l)}c(t,e)}.bind(this))},loadJsonAtlas:function(t,e,s){BK.fileSystem.readFile({file:[{path:t},{path:e}],success:function(t){var e,i;BK.Script.log(1,0,"res = "+JSON.stringify(t));for(var r=0;r<t.length;r++){var n=t[r],o=n.path,a=o.substring(o.lastIndexOf("."));".json"==a?e=n:".atlas"==a&&(i=n)}s(0,e,i)}})},loadSkeletonAsync:function(c,u){var t=[c];this.loadJsonAtlasArray(t,function(t,e){if(0==t){var i=e[0],r=i.jsonInfo,n=i.atlasInfo,o=r.data,a=n.data,s=r.path,h=n.path,l=this.load(o,s,a,h);u(l,c)}else u(-1,null)}.bind(this))},setAccessoryAnimationAsync:function(c,u,_){var t=[c];this.loadJsonAtlasArray(t,function(t,e){if(0==t){var i=e[0],r=i.jsonInfo,n=i.atlasInfo,o=r.data,a=n.data,s=r.path,h=n.path,l=this.loadAccessoryAnimation(o,s,a,h,u);_(l,u,c)}else _(-1,u,null)}.bind(this))},loadJsonAtlasArray:function(c,u){for(var t=[],e=0;e<c.length;e++){var i=c[e],r={path:i.json},n={path:i.atlas};t.push(r),t.push(n)}BK.fileSystem.readFile({file:t,success:function(t){BK.Script.log(1,0,"res = "+JSON.stringify(t));for(var e=0;e<t.length;e++){var i=t[e],r=i.path,n=r.substring(r.lastIndexOf(".")),o=!1;".json"==n?o=!0:".atlas"==n&&(o=!1);for(var a=0;a<c.length;a++){var s=c[a],h=null;if(o){var l=(h=s.json).substring(h.indexOf("://")+3,h.length);0<r.indexOf(l)&&(c[a].jsonInfo=i)}else{var l=(h=s.atlas).substring(h.indexOf("://")+3,h.length);0<r.indexOf(l)&&(c[a].atlasInfo=i)}}}u(0,c)}})}};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(){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,r=BK.Director.screenPixelSize.height;r<i&&(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(i){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(t,e){this._onLoadBackgroundCallback(t,e,i)}.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(i){this.context=new BK.GLRenderContext;var t=BK.JSMatrix.fromOrthographic(0,BK.Director.screenPixelSize.width,0,BK.Director.screenPixelSize.height,-1,1);this.context.setProjection(t);var e=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(t,e){this.glRootNode.canClick=!0,this._onLoadBackgroundCallback(t,e,i)}.bind(this)),this.glRootNode.position={x:(e-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");var n=new BK.HttpUtil(r);n.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,o=t.toString(),a="",s="",h="";e&&(a=e),i&&(s=i),r&&(h=r),BK.QQ.uploadData("banner_SPA",n,o,a,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}())}(BK),function(t,e){"object"==typeof t&&(t.AdAnimateBanner=function(){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 t=BK.Director.queryDeviceInfo();"ios"===t.platform&&t.screenWidth===IPHONE_X_WIDTH&&t.screenHeight===IPHONE_X_HEIGHT?IS_IPHONE_X=!0:IS_IPHONE_X=!1;function l(){return IS_IPHONE_X}function g(){return!!l()}function c(){return l()?BK.Director.screenPixelSize.height>BK.Director.screenPixelSize.width?.015*BK.Director.screenPixelSize.height:.035*BK.Director.screenPixelSize.height:0}function _(t,e,i,r,n,o,a,s,h,l,c,u,_,d,f,p){this._data=void 0!==t?[t,e,i,r,n,o,a,s,h,l,c,u,_,d,f,p]:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function d(t){return.01745329251994*t}function i(t,e){var i=(this._gl=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(var n=0;n<e.attributes.length;++n){var o=e.attributes[n],a=t.getAttribLocation(this._shader_program,o.name);this._attributes.push({name:o.name,size:o.size,location:a})}this._uniforms=[];for(var n=0;n<e.uniforms.length;++n){var s=e.uniforms[n];this._uniforms.push({name:s.name,type:s.type,location:t.getUniformLocation(this._shader_program,s.name),value:s.default_value})}}function m(){this._parent=null,this._children=[],this._rotation_matrix=new _,this._scalar_matrix=new _,this._local_matrix=new _,this._world_matrix=new _,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,this._visible=!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 f(t,e,i,r,n,o,a){m.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!==o&&o,this._stretch_y=void 0!==a&&a,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 o(t,e,i,r,n,o,a){f.call(this,t,e,i,r,n,o,a),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 p(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 e(t){this._ad_final_size=[],this._clickInsideCallback=void 0;for(var e=0;e<AD_DESIGN_SIZE.length;++e)this._ad_final_size.push({width:Math.ceil(AD_DESIGN_SIZE[e].width*STANDARD_SCALE),height:Math.ceil(AD_DESIGN_SIZE[e].height*STANDARD_SCALE)});this._is_webgl=void 0!==gl,this._is_webgl&&this.webGL_init();var i="GameRes://res/bg_left.png",r="GameRes://res/bg_bg_1.png",n="GameRes://res/bg_bg_2.png",o="GameRes://res/bg_fg_1.png",a="GameRes://res/bg_fg_2.png",s="GameRes://res/bg_right.png";t&&(i=t.bg_left_path,s=t.bg_right_path,r=t.bg_bg_1_path,n=t.bg_bg_2_path,o=t.bg_fg_1_path,a=t.bg_fg_2_path),this._tex_bg_left=this.create_texture(i,!1),this._tex_bg_bg_1=this.create_texture(r,!1),this._tex_bg_bg_2=this.create_texture(n,!1),this._tex_bg_fg_1=this.create_texture(o,!1),this._tex_bg_fg_2=this.create_texture(a,!1),this._tex_bg_right=this.create_texture(s,!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:l()?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,g()?this._mv_node.position={x:.5*BK.Director.screenPixelSize.width,y:c()}: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 h=new BK.Ticker;h.interval=.033,h.setTickerCallBack(function(t,e){this.update(e)}.bind(this))}return STANDARD_HEIGHT=l()?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,_.prototype={constructor:_,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,o,a,s,h,l,c,u,_,d,f,p){this._data[0]=t,this._data[1]=e,this._data[2]=i,this._data[3]=r,this._data[4]=n,this._data[5]=o,this._data[6]=a,this._data[7]=s,this._data[8]=h,this._data[9]=l,this._data[10]=c,this._data[11]=u,this._data[12]=_,this._data[13]=d,this._data[14]=f,this._data[15]=p},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],o=this._data[0]*t._data[4]+this._data[4]*t._data[5]+this._data[8]*t._data[6]+this._data[12]*t._data[7],a=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],l=this._data[0]*t._data[8]+this._data[4]*t._data[9]+this._data[8]*t._data[10]+this._data[12]*t._data[11],c=this._data[1]*t._data[8]+this._data[5]*t._data[9]+this._data[9]*t._data[10]+this._data[13]*t._data[11],u=this._data[2]*t._data[8]+this._data[6]*t._data[9]+this._data[10]*t._data[10]+this._data[14]*t._data[11],_=this._data[3]*t._data[8]+this._data[7]*t._data[9]+this._data[11]*t._data[10]+this._data[15]*t._data[11],d=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],p=this._data[2]*t._data[12]+this._data[6]*t._data[13]+this._data[10]*t._data[14]+this._data[14]*t._data[15],g=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,o,a,s,h,l,c,u,_,d,f,p,g),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,i.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(var t=0;t<this._uniforms.length;++t)this.update_uniform(this._uniforms[t]);var e=0;for(t=0;t<this._attributes.length;++t){var i=this._attributes[t];this._gl.vertexAttribPointer(i.location,i.size,this._gl.FLOAT,!1,36,e),this._gl.enableVertexAttribArray(i.location),e+=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,m.prototype={constructor:m,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(){var t,e,i,r,n,o,a,s,h,l,c,u;return this._local_matrix=new _(1,0,0,0,0,1,0,0,0,0,1,0,(t=this.position).x,t.y,t.z,1),0===this.rotation.x&&0===this.rotation.y&&0===this.rotation.z||(this._rotation_matrix=(e=this.rotation,i=d(-e.y),r=d(-e.x),n=d(-e.z),o=Math.cos(i),a=Math.sin(i),s=Math.cos(r),h=Math.sin(r),l=Math.cos(n),c=Math.sin(n),new _(o*l+a*h*c,-o*c+a*h*l,a*s,0,c*s,l*s,-h,0,-a*l+o*h*c,c*a+o*h*l,o*s,0,0,0,0,1)),this._local_matrix.multiply(this._rotation_matrix)),1===this.scale.x&&1===this.scale.y&&1===this.scale.z||(this._scalar_matrix=new _((u=this.scale).x,0,0,0,0,u.y,0,0,0,0,1,0,0,0,0,1),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,((f.prototype=Object.create(m.prototype)).constructor=f).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),m.prototype.dispose.call(this)},f.prototype.setTexture=function(t){void 0!==this._tex&&this._tex.need_delete&&bkWebGLGetInstance().deleteTexture(this._tex.texture),this._tex=t,this._tex_height=t?(this._tex_width=t.width,t.height):this._tex_width=0},f.prototype.adjustTexturePosition=function(t,e,i,r,n){this._origin_tex_uv[3].y=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,(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,(e+r)/this._tex_height),this.dirty(DIRTY_UV)},f.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)},l={x:this._content_size.width*(1-this._anchor.x),y:this._content_size.height*(1-this._anchor.y)},c={x:-this._content_size.width*this._anchor.x,y:-this._content_size.height*this._anchor.y},u={x:this._content_size.width*(1-this._anchor.x),y:-this._content_size.height*this._anchor.y};h=s.multiplyXY(h),l=s.multiplyXY(l),c=s.multiplyXY(c),u=s.multiplyXY(u),this._vertices[0]=h.x,this._vertices[1]=h.y,this._vertices[9]=l.x,this._vertices[10]=l.y,this._vertices[18]=u.x,this._vertices[19]=u.y,this._vertices[27]=c.x,this._vertices[28]=c.y,this._dirty_flags&=~(DIRTY_CONTENT_SIZE|DIRTY_ANCHOR)}if(this._dirty_flags&DIRTY_COLOR){var _=this.color.a,d=this.color.r*_,f=this.color.g*_,p=this.color.b*_;this._vertices[3]=d,this._vertices[4]=f,this._vertices[5]=p,this._vertices[6]=a,this._vertices[12]=d,this._vertices[13]=f,this._vertices[14]=p,this._vertices[15]=a,this._vertices[21]=d,this._vertices[22]=f,this._vertices[23]=p,this._vertices[24]=a,this._vertices[30]=d,this._vertices[31]=f,this._vertices[32]=p,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),m.prototype.render.call(this,t,e,i)}},f.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},((o.prototype=Object.create(f.prototype)).constructor=o).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")},o.prototype.setTouchInsideCallback=function(t){this.touchInsideCallback=t},o.prototype.dispose=function(){UIEventHandler.removeNodeEvent(this,1),UIEventHandler.removeNodeEvent(this,2),UIEventHandler.removeNodeEvent(this,3),f.prototype.dispose.call(this)},o.prototype.changeStatus=function(t){this.touchStatus=t,this.updateTexture(t)},o.prototype.updateTexture=function(t){},e.prototype={constructor:e,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,o=i.UNSIGNED_BYTE,a=BK.Image.loadImage(t,6),s=i.createTexture();return i.bindTexture(i.TEXTURE_2D,s),i.texImage2D(i.TEXTURE_2D,0,r,n,o,a),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:a.width,height:a.height,texture:s,tex_file:t,need_delete:e}}return new BK.Texture(t)},create_clip_node:function(t,e){if(this._is_webgl){g()&&(e.x+=.5*BK.Director.screenPixelSize.width,e.y=c());var i=new m;return this._clip_rect=e,t.addChild(i),i}return(i=new BK.ClipRectNode(e.x,e.y,e.width,e.height)).enableClip=!0,t.addChild(i),i},create_node:function(t){if(this._is_webgl){var e=new m;return void 0!==t?t.addChild(e):this._gl_root_node.addChild(e),e}return e=new BK.Node,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 o(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){var r=new f(i.width,i.height,e,0,1,1,1);return void 0!==t?t.addChild(r):this._gl_root_node.addChild(r),r}return r=new BK.Sprite(i.width,i.height,e,0,1,1,1),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(),o=this._gl,a=o.RGBA,s=o.RGBA,h=o.UNSIGNED_BYTE,l=o.createTexture();o.bindTexture(o.TEXTURE_2D,l),o.texImage2D(o.TEXTURE_2D,0,a,s,h,n),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR);var c={width:n.width,height:n.height,texture:l,tex_file:e,need_delete:!0},u=new f(n.width,n.height,c,0,1,1,1);return u.anchor={x:0,y:0},u.width=r.width,u.height=r.height,u}return t.textColor=p(t.textColor),t.strokeColor=p(t.strokeColor),t.shadowColor=p(t.shadowColor),new BK.TextNode(t,e)},show:function(t){if(!this._is_webgl){var e=BK.Director.root.scale;this._root_node.scale={x:1/e.x,y:1/e.y,z:1/e.z},this._root_node.enableClip=g()}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&&20<t.content.length&&(t.content=t.content.substring(0,20),t.content=t.content+"...");var i=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:this.create_sprite(this._real_content_node,t.tex_files[0],i,!0).anchor={x:0,y:1};break;case AD_BANNER_TYPE_DYNAMIC_194_147_147:case AD_BANNER_TYPE_STATIC_194_147_147:this.create_sprite(this._real_content_node,t.tex_files[0],i,!0).anchor={x:0,y:1};var r=15*STANDARD_SCALE,n=0;n=t.ad_type===AD_BANNER_TYPE_DYNAMIC_194_147_147?this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width-i.width-80*STANDARD_SCALE-r:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width-i.width-2*r;var o=26,a=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:n,maxHeight:30*STANDARD_SCALE,width:n,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);a.position={x:i.width+r,y:-50*STANDARD_SCALE},this._real_content_node.addChild(a),(f=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.4,g:.4,b:.4,a:1},maxWidth:n,maxHeight:60*STANDARD_SCALE,width:n,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},f.position={x:i.width+r,y:-65*STANDARD_SCALE},this._real_content_node.addChild(f);break;case AD_BANNER_TYPE_DYNAMIC_184_240_180:case AD_BANNER_TYPE_STATIC_184_240_180:this.create_sprite(this._real_content_node,t.tex_files[0],i,!0).anchor={x:0,y:1},r=15*STANDARD_SCALE,n=0,n=t.ad_type===AD_BANNER_TYPE_DYNAMIC_184_240_180?this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width-i.width-60*STANDARD_SCALE-r:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width-i.width-2*r,o=26,(f=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:n,maxHeight:60*STANDARD_SCALE,width:n,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},f.position={x:i.width+r,y:.5*(f.height-i.height)},this._real_content_node.addChild(f);break;case AD_BANNER_TYPE_DYNAMIC_285_240_180_3:case AD_BANNER_TYPE_STATIC_285_240_180_3:var s=23*STANDARD_SCALE,h=0,l=0,c=3*STANDARD_SCALE;t.ad_type===AD_BANNER_TYPE_STATIC_285_240_180_3&&(s=11*STANDARD_SCALE,h=11*STANDARD_SCALE,l=-6*STANDARD_SCALE,c=4*STANDARD_SCALE);var u=this.create_sprite(this._real_content_node,t.tex_files[0],i,!0);u.anchor={x:0,y:1},u.position={x:h,y:l};var _=this.create_sprite(this._real_content_node,t.tex_files[1],i,!0);_.anchor={x:0,y:1},_.position={x:h+i.width+s,y:l};var d=this.create_sprite(this._real_content_node,t.tex_files[2],i,!0);d.anchor={x:0,y:1},d.position={x:h+2*(i.width+s),y:l},n=0,n=t.ad_type===AD_BANNER_TYPE_DYNAMIC_285_240_180_3?this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width-40*STANDARD_SCALE:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width-40*STANDARD_SCALE,o=24,(f=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:n,maxHeight:30*STANDARD_SCALE,width:n,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},f.position={x:.5*n,y:-i.height-c},this._real_content_node.addChild(f);break;case AD_BANNER_TYPE_DYNAMIC_210_640_288:case AD_BANNER_TYPE_STATIC_210_640_288:this.create_sprite(this._real_content_node,t.tex_files[0],i,!0).anchor={x:0,y:1},r=10*STANDARD_SCALE,n=0,n=t.ad_type===AD_BANNER_TYPE_DYNAMIC_210_640_288?this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width-i.width-50*STANDARD_SCALE-r:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width-i.width-2*r,o=24,(f=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:n,maxHeight:120*STANDARD_SCALE,width:n,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},f.position={x:i.width+r,y:.5*-i.height},this._real_content_node.addChild(f);break;case AD_BANNER_TYPE_DYNAMIC_65_1000_560:case AD_BANNER_TYPE_STATIC_65_1000_560:var f;this.create_sprite(this._real_content_node,t.tex_files[0],i,!0).anchor={x:0,y:1},r=10*STANDARD_SCALE,n=0,n=t.ad_type===AD_BANNER_TYPE_DYNAMIC_65_1000_560?this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width-i.width-50*STANDARD_SCALE-r:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width-i.width-2*r,o=26,(f=this.create_text({fontSize:o*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:n,maxHeight:120*STANDARD_SCALE,width:n,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},f.position={x:i.width+r,y:.5*-i.height},this._real_content_node.addChild(f)}var p=t.ad_type>=AD_BANNER_TYPE_DYNAMIC_193_582_166&&t.ad_type<=AD_BANNER_TYPE_DYNAMIC_65_1000_560;this.anim_node_1(p),this.anim_node_2(p,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(p)},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,o,a){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:o,loop_count:a,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,0<=i.loop_count?(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(0<i.pass_time){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=.5*-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width+.4*this._ad_final_size[AD_BANNER_TYPE_RESERVED_0].width,i=0-.7*this._ad_final_size[AD_BANNER_TYPE_RESERVED_0].height;this._node_1.anchor={x:.8,y:.2},this._node_1.visible=!0,this._node_1.position={x:e,y:i},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,i,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=.8,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-.5);this._node_2.position={x:n,y:0},this._node_2_2.position=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),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,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],{x:this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_1].width*(.5-r),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),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,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),{x:5*STANDARD_SCALE+this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width*-r+e,y:5*STANDARD_SCALE+i})},anim_node_3:function(t){if(t){var e=.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width+.15*this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].width,i=.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height-.1*this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].height,r=.3*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width,n=-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height,o=Math.sqrt((e-r)*(e-r)+(i-n)*(i-n)),a=(e-r)/o,s=(i-n)/o,h=e+this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].width*a*.2,l=i+this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].height*s*.2,c=e-this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].width*a*.1,u=i-this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].height*s*.1;this._node_3.anchor={x:.5,y:.5},this._node_3.visible=!0,this._node_3.position={x:r,y:n},this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_X,.3,.1,0,r,h,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.3,.1,0,n,l,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_X,.15,.4,0,h,c,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.15,.4,0,l,u,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,c,e,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.08,.55,0,u,i,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,r,n,o,a,s,h=(i=0,r=BK.Director.screenPixelSize.width,n=0,o=BK.Director.screenPixelSize.height,new _(2/(r-i),0,0,0,0,2/(o-n),0,0,0,0,2/((a=-1)-(s=1)),0,(i+r)/(i-r),(o+n)/(n-o),(a+s)/(a-s),1));t._webgl_shader.set_uniform("Projection",h);var l=new _;t._webgl_shader.set_uniform("ModelView",l),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 m,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 _,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 i(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(){g()&&(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),e=0;e<t;++e){var i=this._gl.getActiveAttrib(this._prevProgram,e),r=i.name,n=this._gl.getAttribLocation(this._prevProgram,r),o=this._gl.getVertexAttrib(n,this._gl.VERTEX_ATTRIB_ARRAY_SIZE),a=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),l=this._gl.getVertexAttribOffset(n,gl.VERTEX_ATTRIB_ARRAY_POINTER);if(i.name=r,i.index=n,i.size=o,i.type=a,i.normalized=s,i.stride=h,i.offset=l,void 0!==this._gl.recordVertexAttribPointer)for(var c=0;c<this._gl.recordVertexAttribPointer.length;c++){var u=this._gl.recordVertexAttribPointer[c];if(i.index==u.index&&i.type==u.type&&i.stride==u.stride&&i.offset==u.offset){i.index=u.index,i.size=u.size,i.type=u.type,i.normalized=u.normalized,i.stride=u.stride,i.offset=u.offset;break}}this._activeAttribusInfo.push(i)}},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),0<this._activeAttribusInfo.length){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,o=e.normalized,a=e.offset,s=e.stride,h=0!=o;this._gl.vertexAttribPointer(i,r,n,h,s,a,!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),g()&&(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:e}}().AdAnimateBanner)}(BK);__extends=this&&this.__extends||function(){var r=function(t,e){return(r=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])})(t,e)};return function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}}();!function(t,e){var n,o;"object"==typeof t&&(t.AdAnimateBannerHandler=(n=function(){function t(t,e){this.info=t,this.download(e)}return t.prototype.download=function(r){var n="GameSandBox://__bkDownloadCache/"+BK.Crypt.hex_md5(this.info.url);this.info.savePath&&(n=this.info.savePath);var t=!!this.info.useCache&&this.info.useCache,e=!0;if(1==t&&1==BK.FileUtil.isFileExist(n)){e=!1;var i={url:this.info.url,statueCode:200,savePath:n};r(i)}if(1==e){var o=new BK.HttpUtil(this.info.url);o.requestAsync(function(t,e){200==e?BK.FileUtil.writeBufferToFile(n,t):BK.Script.log(1,1,"Fetch banner image failed.url:"+this.info.url);var i={url:this.info.url,statueCode:e,savePath:n};r(i)}.bind(this))}},t}(),o=function(){function t(){}return t.download=function(t,e){this.completeTasks=[],this.reqTasks=t;for(var i=0;i<t.length;i++){var r=t[i];new n(r,function(t){this.completeTasks.push(t),this.check()&&e(this.completeTasks)}.bind(this))}BK.Director.ticker.setTimeout(function(){this.fillUncomplete(),e(this.completeTasks)}.bind(this),3e4,this)},t.cancelTimeOut=function(){BK.Director.ticker.removeTimeout(this)},t.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 o={url:e.url,statueCode:-1,savePath:e.savePath};this.completeTasks.push(o)}}},t.check=function(){return this.completeTasks.length==this.reqTasks.length&&(this.cancelTimeOut(),!0)},t}(),{AdAnimateBannerHandler:function(r){function t(t,e){var i=r.call(this,t,e)||this;return i.bannerContentInfo=i.parseInfo(i.adInfo),i.banner=null,i}return __extends(t,r),t.prototype.setHidden=function(t){this.banner?this.banner.setHidden(t):BK.Script.log(1,1,"set hidden fail ,this.banner is null")},t.prototype.show=function(n){this.bannerType=1,this._show(function(t,e,i){if(0==t)if(void 0!==this.bannerContentInfo.staticBannerType){this.banner=new BK.AdAnimateBanner(e),this.bannerContentInfo.ad_type=this.bannerContentInfo,this.bannerContentInfo.tex_files=i;var r={ad_type:this.bannerContentInfo.staticBannerType,tex_files:i,title:this.bannerContentInfo.title,content:this.bannerContentInfo.content};this.banner.setClickContentCallback(this._onClickContentCallback.bind(this)),this.banner.show(r),this._onShowCallback(),n(t,"show ok",this)}else n(-1,"show failed",null);else n(t,"show _show failed",null)}.bind(this))},t.prototype.showAnimate=function(n){this.bannerType=2,this._show(function(t,e,i){if(0==t)if(void 0!==this.bannerContentInfo.dynamicBannerType){this.banner=new BK.AdAnimateBanner(e),this.bannerContentInfo.ad_type=this.bannerContentInfo,this.bannerContentInfo.tex_files=i;var r={ad_type:this.bannerContentInfo.dynamicBannerType,tex_files:i,title:this.bannerContentInfo.title,content:this.bannerContentInfo.content};this.banner.setClickContentCallback(this._onClickContentCallback.bind(this)),this.banner.show(r),this._onShowCallback(),n(t,"showAnimate ok",this)}else n(-1,"fshowAnimate ailed",null);else n(t,"showAnimate _show failed",null)}.bind(this))},t.prototype._onShowCallback=function(){this.cmshowReport(1,"","",this.bannerType.toString()),this.exposeureReport()},t.prototype._jumpToGDTDestPage=function(){var t=this.adInfo;BK.MQQ.SsoRequest.send(t,"cs.xy_ad_banner_jump.local")},t.prototype._onClickContentCallback=function(){this.cmshowReport(3,"","",this.bannerType.toString()),this.clickReport(),1==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")||"android"===GameStatusInfo.platform&&1==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")?this._onClickContentBtn():(this._emmitClickEvent(),this._jumpToGDTDestPage())},t.prototype._show=function(r){if(!this.bannerContentInfo)return BK.Script.log(1,1,"show failed.ad info is illegal!"),void r(-2,null,null);this.loadRes(function(t,i){0==t?this.loadImage(function(t,e){r(t,i,e)}.bind(this)):r(-1,null,null)}.bind(this))},t.prototype.close=function(){this.banner?(this.banner.dispose(),this.banner=null):BK.Script.log(1,1,"close banner failed. banner has not been inited!")},t.prototype.loadImage=function(s){for(var h=[],t=0;t<this.bannerContentInfo.image.length;t++){var e=this.bannerContentInfo.image[t],i={url:e};h.push(i)}o.download(h,function(t){for(var e=!0,i=[],r=0;r<h.length;r++)for(var n=h[r],o=0;o<t.length;o++){var a=t[o];n.url==a.url&&(200!=a.statueCode?(BK.Script.log(1,1,"banner load image failed.url:"+a.url),e=!1):i.push(a.savePath))}s(1==e?0:-1,i)}.bind(this))},t.prototype.loadRes=function(c){o.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(t){for(var e="",i="",r="",n="",o="",a="",s=!0,h=0;h<t.length;h++){var l=t[h];200!=l.statueCode&&(s=!1),0<l.savePath.indexOf("bg_bg_1")?r=l.savePath:0<l.savePath.indexOf("bg_bg_2")?n=l.savePath:0<l.savePath.indexOf("bg_fg_1")?o=l.savePath:0<l.savePath.indexOf("bg_fg_2")?a=l.savePath:0<l.savePath.indexOf("bg_left")?e=l.savePath:0<l.savePath.indexOf("bg_right")&&(i=l.savePath)}c(1==s?0:-1,{bg_left_path:e,bg_right_path:i,bg_bg_1_path:r,bg_bg_2_path:n,bg_fg_1_path:o,bg_fg_2_path:a})}.bind(this))},t.prototype.parseInfo=function(t){var e=t.display_info.creative_size,i={creative_size:this.creativeSize=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},t}(BK.AdBannerHandler)}).AdAnimateBannerHandler)}(BK)}BK.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,o=271733878,a=0;a<t.length;a+=16){var s=i,h=r,l=n,c=o;i=this.md5_ff(i,r,n,o,t[a+0],7,-680876936),o=this.md5_ff(o,i,r,n,t[a+1],12,-389564586),n=this.md5_ff(n,o,i,r,t[a+2],17,606105819),r=this.md5_ff(r,n,o,i,t[a+3],22,-1044525330),i=this.md5_ff(i,r,n,o,t[a+4],7,-176418897),o=this.md5_ff(o,i,r,n,t[a+5],12,1200080426),n=this.md5_ff(n,o,i,r,t[a+6],17,-1473231341),r=this.md5_ff(r,n,o,i,t[a+7],22,-45705983),i=this.md5_ff(i,r,n,o,t[a+8],7,1770035416),o=this.md5_ff(o,i,r,n,t[a+9],12,-1958414417),n=this.md5_ff(n,o,i,r,t[a+10],17,-42063),r=this.md5_ff(r,n,o,i,t[a+11],22,-1990404162),i=this.md5_ff(i,r,n,o,t[a+12],7,1804603682),o=this.md5_ff(o,i,r,n,t[a+13],12,-40341101),n=this.md5_ff(n,o,i,r,t[a+14],17,-1502002290),r=this.md5_ff(r,n,o,i,t[a+15],22,1236535329),i=this.md5_gg(i,r,n,o,t[a+1],5,-165796510),o=this.md5_gg(o,i,r,n,t[a+6],9,-1069501632),n=this.md5_gg(n,o,i,r,t[a+11],14,643717713),r=this.md5_gg(r,n,o,i,t[a+0],20,-373897302),i=this.md5_gg(i,r,n,o,t[a+5],5,-701558691),o=this.md5_gg(o,i,r,n,t[a+10],9,38016083),n=this.md5_gg(n,o,i,r,t[a+15],14,-660478335),r=this.md5_gg(r,n,o,i,t[a+4],20,-405537848),i=this.md5_gg(i,r,n,o,t[a+9],5,568446438),o=this.md5_gg(o,i,r,n,t[a+14],9,-1019803690),n=this.md5_gg(n,o,i,r,t[a+3],14,-187363961),r=this.md5_gg(r,n,o,i,t[a+8],20,1163531501),i=this.md5_gg(i,r,n,o,t[a+13],5,-1444681467),o=this.md5_gg(o,i,r,n,t[a+2],9,-51403784),n=this.md5_gg(n,o,i,r,t[a+7],14,1735328473),r=this.md5_gg(r,n,o,i,t[a+12],20,-1926607734),i=this.md5_hh(i,r,n,o,t[a+5],4,-378558),o=this.md5_hh(o,i,r,n,t[a+8],11,-2022574463),n=this.md5_hh(n,o,i,r,t[a+11],16,1839030562),r=this.md5_hh(r,n,o,i,t[a+14],23,-35309556),i=this.md5_hh(i,r,n,o,t[a+1],4,-1530992060),o=this.md5_hh(o,i,r,n,t[a+4],11,1272893353),n=this.md5_hh(n,o,i,r,t[a+7],16,-155497632),r=this.md5_hh(r,n,o,i,t[a+10],23,-1094730640),i=this.md5_hh(i,r,n,o,t[a+13],4,681279174),o=this.md5_hh(o,i,r,n,t[a+0],11,-358537222),n=this.md5_hh(n,o,i,r,t[a+3],16,-722521979),r=this.md5_hh(r,n,o,i,t[a+6],23,76029189),i=this.md5_hh(i,r,n,o,t[a+9],4,-640364487),o=this.md5_hh(o,i,r,n,t[a+12],11,-421815835),n=this.md5_hh(n,o,i,r,t[a+15],16,530742520),r=this.md5_hh(r,n,o,i,t[a+2],23,-995338651),i=this.md5_ii(i,r,n,o,t[a+0],6,-198630844),o=this.md5_ii(o,i,r,n,t[a+7],10,1126891415),n=this.md5_ii(n,o,i,r,t[a+14],15,-1416354905),r=this.md5_ii(r,n,o,i,t[a+5],21,-57434055),i=this.md5_ii(i,r,n,o,t[a+12],6,1700485571),o=this.md5_ii(o,i,r,n,t[a+3],10,-1894986606),n=this.md5_ii(n,o,i,r,t[a+10],15,-1051523),r=this.md5_ii(r,n,o,i,t[a+1],21,-2054922799),i=this.md5_ii(i,r,n,o,t[a+8],6,1873313359),o=this.md5_ii(o,i,r,n,t[a+15],10,-30611744),n=this.md5_ii(n,o,i,r,t[a+6],15,-1560198380),r=this.md5_ii(r,n,o,i,t[a+13],21,1309151649),i=this.md5_ii(i,r,n,o,t[a+4],6,-145523070),o=this.md5_ii(o,i,r,n,t[a+11],10,-1120210379),n=this.md5_ii(n,o,i,r,t[a+2],15,718787259),r=this.md5_ii(r,n,o,i,t[a+9],21,-343485551),i=this.safe_add(i,s),r=this.safe_add(r,h),n=this.safe_add(n,l),o=this.safe_add(o,c)}return Array(i,r,n,o)},t.prototype.md5_cmn=function(t,e,i,r,n,o){return this.safe_add(this.rol(this.safe_add(this.safe_add(e,t),this.safe_add(r,o)),n),i)},t.prototype.md5_ff=function(t,e,i,r,n,o,a){return this.md5_cmn(e&i|~e&r,t,e,n,o,a)},t.prototype.md5_gg=function(t,e,i,r,n,o,a){return this.md5_cmn(e&r|i&~r,t,e,n,o,a)},t.prototype.md5_hh=function(t,e,i,r,n,o,a){return this.md5_cmn(e^i^r,t,e,n,o,a)},t.prototype.md5_ii=function(t,e,i,r,n,o,a){return this.md5_cmn(i^(e|~r),t,e,n,o,a)},t.prototype.core_hmac_md5=function(t,e){var i=this.str2bin(t);16<i.length&&(i=this.core_md5(i,t.length*this.chrsz));for(var r=Array(16),n=Array(16),o=0;o<16;o++)r[o]=909522486^i[o],n[o]=1549556828^i[o];var a=this.core_md5(r.concat(this.str2bin(e)),512+e.length*this.chrsz);return this.core_md5(n.concat(a),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,o=-1732584194,a=271733878,s=-1009589776,h=0;h<t.length;h+=16){for(var l=r,c=n,u=o,_=a,d=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 p=this.safe_add(this.safe_add(this.rol(r,5),this.sha1_ft(f,n,o,a)),this.safe_add(this.safe_add(s,i[f]),this.sha1_kt(f)));s=a,a=o,o=this.rol(n,30),n=r,r=p}r=this.safe_add(r,l),n=this.safe_add(n,c),o=this.safe_add(o,u),a=this.safe_add(a,_),s=this.safe_add(s,d)}return Array(r,n,o,a,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);16<i.length&&(i=this.core_sha1(i,t.length*this.chrsz));for(var r=Array(16),n=Array(16),o=0;o<16;o++)r[o]=909522486^i[o],n[o]=1549556828^i[o];var a=this.core_sha1(r.concat(this.str2bin(e)),512+e.length*this.chrsz);return this.core_sha1(n.concat(a),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}();__extends=this&&this.__extends||function(){var r=function(t,e){return(r=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])})(t,e)};return function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}}();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}))}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&&0<i.display_info.button_info.length&&(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 o=0;if(0<i.display_info.button_info.length)for(var a=i.display_info.button_info,s=0;s<a.length;s++){var h=a[s];if(null!=typeof h.pos){o=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:o,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,video_preview_url:i.display_info.basic_info.img,pkg_download_schema:i.app_info.pkg_download_schema},this.adFullVideoInfo=i,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&_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))):"apolloGamePlatform.report"==i.op?this._onWebViewReport(i.data):"apolloGamePlatform.openUrl"==i.op&&this._onWebViewOpenUrl(i.data))}.bind(this)),BK.MQQ.SsoRequest.send(r,"cs.openWebViewWithoutUrl.local")}else this.log("jump failed!Can't call jump twice!")},t.prototype._isEmptyObject=function(t){for(var e in t)return!0;return!1},t.prototype._formatUrl=function(t){var e="";return"exposure_url"==t.type?e=this.adFullVideoInfo.report_info.exposure_url:"click_url"==t.type&&(e=this.adFullVideoInfo.report_info.click_url),delete t.type,0==this._isEmptyObject(t)&&(e=e+"&video="+encodeURIComponent(JSON.stringify(t))),e},t.prototype._onWebViewReport=function(t){var e=this._formatUrl(t);BK.Script.log(1,1,"_onWebViewReport req url:"+e),new BK.HttpUtil(e).requestAsync(function(t,e){BK.Script.log(1,1,"_onWebViewReport resp code:"+e)})},t.prototype._onWebViewOpenUrl=function(t){var e=this._formatUrl(t);BK.Script.log(1,1,"_onWebViewOpenUrl url:"+e),BK.MQQ.Webview.open(e)},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(o){function t(t,e,i,r){var n=o.call(this,t,e,i,r)||this;return n.CMSHOW_SC_CMD_AD_VIDEO_START="sc.game_ad_video_start.local",n.CMSHOW_SC_CMD_AD_VIDEO_END="sc.game_ad_video_end.local",n.CMSHOW_SC_CMD_AD_VIDEO_CLOSE="sc.game_ad_video_view_close.local",n.CMSHOW_SC_CMD_SHELL_CLOSE="sc.game_shell_close.local",n.CMSHOW_CS_CMD_AD_VIDEO_JUMP="cs.game_ad_video_jump.local",n.CMSHOW_CS_CMD_AD_VIDEO_CLOSE="cs.game_ad_video_close.local",n.posid=e,n.adInfo=i,n}return __extends(t,o),t.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)},t.prototype.close=function(){BK.MQQ.SsoRequest.send({},this.CMSHOW_CS_CMD_AD_VIDEO_CLOSE)},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._startVideo=function(t,e,i){this.event&&this.event.onStartPlay?this.event.onStartPlay(t,""):this.log("lack of onStartPlay callback"),this.log("_onStartPlay")},t.prototype._endVideo=function(t,e,i){this.event&&this.event.onEndVideo?this.event.onEndVideo(t,""):this.log("lack of onEnd callback"),this.log("_endVideo")},t.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()},t.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},t.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)},t.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))},t}(t)}}),function(t,e){"object"==typeof t&&(t.Advertisement=function(){function t(){}return t.fetch=function(t,r){if(this.forbiden(t))r(-1,"ad not found.Current posid is forbidden.",null);else if(GameStatusInfo.devPlatform){var e=this.getDebugRetData();this.parseQQAdGetRsp(e,r)}else{var i="apollo_router_game.game_ad_linkcmd_get_ad";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,e,i){0==t?this.parseQQAdGetRsp(i,r):r(t,"sso respose not 0.",null)}.bind(this));var n={game_id:GameStatusInfo.gameId,posid:t};BK.isBrowser?BK.MQQ.SsoRequest.sendSSO(n,i):BK.MQQ.SsoRequest.send(n,i)}},t.forbiden=function(t){if(t&&GameStatusInfo.adForbitPosId){var e=GameStatusInfo.adForbitPosId.split(";");if(!e)return!1;for(var i=0;i<e.length;i++){var r=e[i];if(r===t)return BK.Script.log(1,1,"current game"),!0}}return!1},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(0<t.pos_ads_info.length){var i=t.pos_ads_info[0];if(0==i.ret){BK.Script.log(1,1,"fetch ad \u5e7f\u544a\u4f4did:"+i.pos_id);var r=i.ads_info;if(0<r.length){var n=r[0];e(0,"OK",n)}}else BK.Script.log(1,1,"\u5e7f\u544a\u4f4d\u4fe1\u606f\u8fd4\u56de\u5931\u8d25\u4e3a\u7a7a 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 \u5e7f\u544a\u4fe1\u606f\u4e3a\u7a7a"),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;if(null==this.lastBannerReqTs)return this.lastBannerReqTs=BK.Time.timestamp,t;var e=BK.Time.timestamp,i=e-this.lastBannerReqTs;return 1<i?(t=!0,this.lastBannerReqTs=BK.Time.timestamp):t=!1,t},t.fetchBannerAd=function(o){if(0!=this.canReqBanner()){var a="6060137618613664";this.fetch(a,function(t,e,i){if(0==t){var r=this.bannerCreativeSizeFilter(i);if(0==r)return void o(-1,"ad data is creative is illegal.",null);this.currentAdBannerHandle&&(this.currentAdBannerHandle.close(),this.currentAdBannerHandle=void 0);var n=new BK.AdAnimateBannerHandler(a,i);this.currentAdBannerHandle=n,o(t,e,n)}else o(t,e,null)}.bind(this))}else o(-1,"frequency is limited",null)},t.videoCreativeSizeFilter=function(t){var e=[];return e=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")?[185,585]:[185,585,564,565],this.createSizeFilter(e,t)},t.bannerCreativeSizeFilter=function(t){return this.createSizeFilter([193,65,184,194,210,285],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(c,u){var _="2090532727455152";this.videoCMReport(c,4),this.fetch(_,function(t,e,i){if(i){var r=this.videoCreativeSizeFilter(i);if(0!=r){var n=1;i&&i.display_info&&i.display_info.creative_size?185==i.display_info.creative_size?n=3:585==i.display_info.creative_size&&(n=1):BK.Script.log(1,1,"fetch ad has problem.lack of display_info.creative_size property.");var o=1,a=this.getGameConfig();a&&void 0!==a.viewMode&&(o=a.viewMode);var s=!0,h="";if(i.display_info&&i.display_info.video_info&&i.display_info.video_info.tencent_video_id&&"string"==typeof i.display_info.video_info.tencent_video_id&&0<i.display_info.video_info.tencent_video_id.length?s=!0:(s=!1,h="can not find video id"),1==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.0")&&(3!=o&&2!=o||1!=n||(s=!1,h="device oriation compare failed.device :"+o.toString()+" ad:"+n.toString())),1==s)if(0==t){this.videoCMReport(c,5);var l=void 0;l=1==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.0")?new BK.AdVideoHandler(c,_,i,o):new BK.AdVideoHandlerNative(c,_,i,o),u(t,e,l)}else u(t,e,null);else u(-1,"no ads found."+h,null)}else u(-1,"ad data is creative is illegal.",null)}else u(-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&&0<t.length){var e=t.readAsString(),i=JSON.parse(e);return i}}},t.getDebugRetData=function(){var t=BK.FileUtil.readFile("GameRes://script/demo/data/adBanner285.json");if(t&&0<t.length){var e=t.readAsString(),i=JSON.parse(e);return i}var r={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:"\u5e7f\u544a\u7d20\u6750\u7684\u6807\u9898",desc:"\u5e7f\u544a\u7684\u8be6\u7ec6\u63cf\u8ff0"},button_info:[{txt:"\u6309\u94ae",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},n={ret:0,msg:"string",pos_id:"string",ads_info:[r]},o={ret:0,msg:"s",pos_ads_info:[n],gdt_cookie:"string",busi_cookie:"string"};return o},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}())}(BK),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)==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,o,a){if(7!=arguments.length)return 0;switch(1==n?2-o:o){case 1:e-=.5*r;break;case 2:e-=1*r}switch(a){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},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,o=e.__inner_image_height;return this.__nativeObj.putImageData(arguments[0],i,r,n,o)}},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(){function t(t,e,i,r,n){this.__nativeObj=new BK.SandBoxCanvas(e,i),this.maxHeight=2048,this.maxWidth=1024;var o=0,a=0;1==r.useH5Mode&&this.__nativeObj.useH5Mode(),r.x&&(o=r.x),r.y&&(a=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.textShadowColor(r.shadowColor),r.shadowRadius&&this.__nativeObj.textShadowRadius(r.shadowColor),r.shadowOffsetX&&this.__nativeObj.textShadowOffsetX(r.shadowOffsetX),r.shadowOffsetY&&this.__nativeObj.textShadowOffsetY(r.shadowOffsetY),r.fontPath&&(this.__nativeObj.fontPath=r.fontPath),this.callback=n,BK.MQQ.Account.drawNick(this.__nativeObj.__nativeObj,t,o,a,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(t,e,i,r,n,o){this.openid=t,this.__nativeObj=new BK.SandBoxCanvas(e,i),this.post=o,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))})}(BK),isBrowser){var __browserMsgHdl={};function __dispatchEvent(i,r,n){"string"==typeof i&&(i=parseInt(i)),BK.Script.log(0,0,"__dispatchEvent err:"+i+" cmd:"+r+" data:"+n),Array.isArray(__browserMsgHdl.listenerInfos)&&__browserMsgHdl.listenerInfos.length<=0&&"sc.init_global_var.local"==r&&(GameStatusInfo=JSON.parse(n)),__browserMsgHdl.listenerInfos.forEach(function(t){if(t.cmd==r){var e=t.callback;try{e(i,r,JSON.parse(n))}catch(t){console.log(t),BK.Script.log(0,0,"JSON parse error:"+t+" data: "+n)}}},this),BK.MQQ.SsoRequest.listenerInfos.forEach(function(t){if(t.cmd==r){var e=t.callback;try{e(i,r,"cs.get_file_data.local"==r?n:JSON.parse(n))}catch(t){console.log(t),BK.Script.log(0,0,"JSON parse error:"+t+" data: "+n)}}},this)}BK.MQQ.SsoRequest.listenerInfos=[],BK.MQQ.SsoRequest.addListener=function(e,i,r){var t={cmd:e,target:i,callback:r};BK.MQQ.SsoRequest.listenerInfos.forEach(function(t){t.cmd==e&&t.target==i&&(t.callback=r)},this),BK.MQQ.SsoRequest.listenerInfos.push(t)},BK.MQQ.SsoRequest.removeListener=function(t,e){for(var i=BK.MQQ.SsoRequest.listenerInfos.length,r=-1,n=0;n<i;n++){var o=BK.MQQ.SsoRequest.listenerInfos[n];o.cmd==t&&o.target==e&&(r=n)}-1!=r&&BK.MQQ.SsoRequest.listenerInfos.splice(r,1)},__browserMsgHdl.listenerInfos=[],__browserMsgHdl.addListener=function(e,i,r){var t={cmd:e,target:i,callback:r},n=!1;__browserMsgHdl.listenerInfos.forEach(function(t){t.cmd==e&&t.target==i&&(t.callback=r,n=!0)},this),0==n&&__browserMsgHdl.listenerInfos.push(t)},__browserMsgHdl.removeListener=function(t,e){for(var i=__browserMsgHdl.listenerInfos.length,r=-1,n=0;n<i;n++){var o=__browserMsgHdl.listenerInfos[n];o.cmd==t&&o.target==e&&(r=n)}-1!=r&&__browserMsgHdl.listenerInfos.splice(r,1)}}function registerRedPackageListener(){BK.isBrowser?(BK.Script.log(1,0,"set listener for notifyJSEVent redpackage h5"),BK.MQQ.SsoRequest.addListener("sc.init_global_var.local",this,function(){BK.Script.log(1,0,"on onGameLoad for redpackage "+localStorage.loadRedpackage),"1"!==localStorage.loadRedpackage&&(localStorage.loadRedpackage="1",BK.QQ.isOpenActivityPage()&&BK.QQ.showRedPackageActivityPage())}),BK.MQQ.SsoRequest.addListener("sc.game_enter_foreground.local",this,function(){BK.Script.log(1,0,"on onGameForeground for redpackage "+localStorage.loadRedpackage),localStorage.loadRedpackage="0"})):(BK.Script.log(1,0,"set listener for notifyJSEVent redpackage not h5"),BK.Script.log(1,0,"on onGameLoad for redpackage not H5"),BK.QQ.isOpenActivityPage()&&BK.QQ.showRedPackageActivityPage()),BK.MQQ.SsoRequest.addListener("apollo_router_light.apollo_activity_linkcmd_query_new_redpacket",BK.QQ,BK.QQ.onNewRedPackage.bind(BK.QQ))}!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,e,i,r;return(e=t||(t={}))[e.load=0]="load",e[e.min=1]="min",e[e.max=2]="max",e[e.share=3]="share",e[e.enterBackground=4]="enterBackground",e[e.enterForeground=5]="enterForeground",(r=i||(i={}))[r.native=0]="native",r[r.browser=1]="browser",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()?i.browser:i.native},t.prototype.addAllListener=function(){this.platform()==i.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()==i.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="GameSandBox://qrcode.png",e="http://cmshow.qq.com/apollo/html/game-platform/scan-game.html?gameId="+GameStatusInfo.gameId.toString()+"&src=203";return BK.QRCode.createQRCodeToFile(t,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}),t},t.prototype._onShare=function(){var r=void 0;if(this.cfg.onShare&&(r=this.cfg.onShare(this)),r||(r={}),void 0===r.localPicPath){var t=r.gameName,e=r.summary;BK.QQ.defaultSharePic(t,e,function(t,e,i){3==e&&(r.localPicPath=i),this.confirmShare(r)}.bind(this))}else this.confirmShare(r)},t.prototype._onShareComplete=function(t,e,i){if(this.cfg.onShareComplete)if(0==i.reqCode){var r=i.ret,n=0==i.isFirstTimeShare,o=i.shareTo;this.cfg.onShareComplete(this,r,o,n)}else this.cfg.onShareComplete(this,t,-1,!1)},t.prototype._onClose=function(){this.cfg.onClose&&this.cfg.onClose(this),BK.MQQ.SsoRequest.send({},"cs.close_room.local")},t.prototype.confirmShare=function(t){var e=t||{};e.reqCode=0,this.platform(),i.native,BK.MQQ.SsoRequest.send(e,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}()}),registerRedPackageListener(),function(i){BK.buildInfo={debug:!1,branch:"master",version:"3fd501f",creater:"northka",buildTime:"Thu Dec 20 2018 19:45:07 GMT+0800 (GMT+08:00)"};var r={};function n(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return i[t].call(e.exports,e,e.exports,n),e.l=!0,e.exports}n.m=i,n.c=r,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=13)}([function(t,e,i){"use strict";var n=function(t,e,i){this.event=t,this.listener=e,this.once=i},r=function(){function t(){this._emits={}}return t.prototype.__emit_get=function(t){return this._emits[t]||(this._emits[t]=new Array),this._emits[t]},t.prototype.__emit_exists=function(t){var e=this.__emit_get(t);return!!(e&&0<e.length)},t.prototype.__emit_put=function(t,e,i){var r=new n(t,e,i);return this.__emit_get(t).push(r),this},t.prototype.__emit_remove=function(t,e){if(1!=this.__emit_exists(t))return!1;for(var i=-1,r=this.__emit_get(t),n=r.length-1;0<=n;n--)if(e==r[n].listener){i=n;break}return-1<i&&r.splice(i,1),!0},t.prototype.on=function(t,e){return this.__emit_put(t,e,!1),this},t.prototype.once=function(t,e){return this.__emit_put(t,e,!0),this},t.prototype.off=function(t,e){return this.__emit_remove(t,e),this},t.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(this.__emit_exists(t)){for(var r=[],n=this.__emit_get(t),o=n.length,a=0;a<o;a++){var s=n[a];s&&s.listener&&s.listener.apply(s,e),s.once&&r.push(s)}for(a=0;a<r.length;a++){var h=r[a];this.__emit_remove(t,h.listener)}return!0}return!1},t}();t.exports=r},,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=BK.Director.queryDeviceInfo(),n=!("ios"===r.platform&&Number(r.version.split(".")[0])<10);e.isSupportArrayBuffer=n;var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function o(t,e,i){var r,n=new Uint8Array(t,e||0,i||t.byteLength),o=n.length,a="";for(r=0;r<o;r+=3)a+=u[n[r]>>2],a+=u[(3&n[r])<<4|n[r+1]>>4],a+=u[(15&n[r+1])<<2|n[r+2]>>6],a+=u[63&n[r+2]];return o%3==2?a=a.substring(0,a.length-1)+"=":o%3==1&&(a=a.substring(0,a.length-2)+"=="),a}function a(t,e){if(n&&BK.Misc.toArrayBuffer){var i=new ArrayBuffer(t.length);return BK.Misc.toArrayBuffer(t,i),i}return BK.Misc.toArrayBufferCompatible?BK.Misc.toArrayBufferCompatible(t,e):BK.Misc.BKBufferToArrayBuffer(t)}function s(t){if(n&&BK.Misc.toBKBuffer)return BK.Misc.toBKBuffer(t,t.byteOffset,t.byteLength);if(0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.5"))return function(t){function e(t,e){var i=e.length,r={type:t,length:e.byteLength,offset:0};switch(t){case 0:for(var n=0;0<i;){var o=Math.min(i,40960),a=new Int8Array(e.buffer,n*Int8Array.BYTES_PER_ELEMENT,o);r.offset=n,BK.Misc.transferArrayBuffer.apply(r,a),n+=40960,i-=40960}break;case 1:for(n=0;0<i;){o=Math.min(i,40960);var s=new Int16Array(e.buffer,n*Int16Array.BYTES_PER_ELEMENT,o);r.offset=n,BK.Misc.transferArrayBuffer.apply(r,s),n+=40960,i-=40960}break;case 2:for(n=0;0<i;){o=Math.min(i,40960);var h=new Int32Array(e.buffer,n*Int32Array.BYTES_PER_ELEMENT,o);r.offset=n,BK.Misc.transferArrayBuffer.apply(r,h),n+=40960,i-=40960}break;case 3:for(n=0;0<i;){o=Math.min(i,40960);var l=new Uint8Array(e.buffer,n*Uint8Array.BYTES_PER_ELEMENT,o);r.offset=n,BK.Misc.transferArrayBuffer.apply(r,l),n+=40960,i-=40960}break;case 5:for(n=0;0<i;){o=Math.min(i,40960);var c=new Uint16Array(e.buffer,n*Uint16Array.BYTES_PER_ELEMENT,o);r.offset=n,BK.Misc.transferArrayBuffer.apply(r,c),n+=40960,i-=40960}break;case 6:for(n=0;0<i;){o=Math.min(i,40960);var u=new Uint32Array(e.buffer,n*Uint32Array.BYTES_PER_ELEMENT,o);r.offset=n,BK.Misc.transferArrayBuffer.apply(r,u),n+=40960,i-=40960}break;case 7:for(n=0;0<i;){o=Math.min(i,40960);var _=new Float32Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT,o);r.offset=n,BK.Misc.transferArrayBuffer.apply(r,_),n+=40960,i-=40960}}}return t instanceof Int8Array==1?e(0,t):t instanceof Int16Array==1?e(1,t):t instanceof Int32Array==1?e(2,t):t instanceof Uint8Array==1?e(3,t):t instanceof Uint16Array==1?e(5,t):t instanceof Uint32Array==1?e(6,t):t instanceof Float32Array==1&&e(7,t),BK.Misc.getTransferedArrayBuffer()}(t);var e=o(t.buffer,t.byteOffset,t.byteLength);return BK.Misc.decodeBase64FromString(e)}BK.Misc.BKBufferToArrayBuffer=function(t){t.rewind();var e=BK.Misc.encodeBase64FromBuffer(t);return e?function(t){var e,i,r,n,o,a=.75*t.length,s=t.length,h=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var l=new ArrayBuffer(a),c=new Uint8Array(l);for(e=0;e<s;e+=4)i=u.indexOf(t[e]),r=u.indexOf(t[e+1]),n=u.indexOf(t[e+2]),o=u.indexOf(t[e+3]),c[h++]=i<<2|r>>4,c[h++]=(15&r)<<4|n>>2,c[h++]=(3&n)<<6|63&o;return l}(e):new ArrayBuffer(0)},BK.Misc.arrayBufferToBKBuffer=function(t,e,i){if(n&&BK.Misc.toBKBuffer)return BK.Misc.toBKBuffer(t,e,i);var r=o(t,e,i);return BK.Misc.decodeBase64FromString(r)},BK.Misc.typedArrayToBKBuffer=function(t){if(n&&BK.Misc.toBKBuffer)return BK.Misc.toBKBuffer(t,t.byteOffset,t.byteLength);var e=o(t.buffer,t.byteOffset,t.byteLength);return BK.Misc.decodeBase64FromString(e)},e.typedArrayToBKBuffer=s,e.BKBufferToInt8Array=function(t){return new Int8Array(a(t,0))},e.BKBufferToInt16Array=function(t){return new Int16Array(a(t,1))},e.BKBufferToInt32Array=function(t){return new Int32Array(a(t,2))},e.BKBufferToUint8Array=function(t){return new Uint8Array(a(t,3))},e.BKBufferToUint16Array=function(t){return new Uint16Array(a(t,5))},e.BKBufferToUint32Array=function(t){return new Uint32Array(a(t,6))},e.BKBufferToFloat32Array=function(t){return new Float32Array(a(t,7))},e.BKBufferToArrayBuffer=function(t){return a(t,0)},e.arrayBufferToBKBuffer=function(t){return s(new Int8Array(t))}},,function(t,e,i){"use strict";var r,n=this&&this.__extends||(r=function(t,e){return(r=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])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var o=function(e){function t(){var t=e.call(this)||this;return t.seqId=1,t.setCallback(),t}return n(t,e),t.prototype.request=function(t){var e=this;t.respCmd=t.respCmd?t.respCmd:t.reqCmd,null!=t.isListener&&null!=t.isListener||(t.isListener=!0);var i=t.reqCmd,r=t.respCmd,n=t.data,o=t.isListener,a=t.success,s=t.fail,h=t.complete;if(!i&&!r)throw new Error("Sso request cmd is required");if(o){var l=this.getEvent(r,n),c=function(t){0==t.code?a&&a({code:t.code,cmd:t.cmd,data:t.data}):s&&s({code:t.code,cmd:t.cmd,data:t.data}),h&&h()};return this.once(l,c),this.send(i,n),{abort:function(){e.off(l,c)}}}return this.send(i,n),null},t.prototype.send=function(t,e){BK.isBrowser?-1!==t.indexOf("cs.")&&-1!==t.indexOf(".local")?"undefined"!=typeof __browserMsg?__browserMsg.send(JSON.stringify(e),t):void 0!==window.webkit.messageHandlers&&window.webkit.messageHandlers.cmWebGameSend.postMessage({data:JSON.stringify(e),cmd:t}):BK.MQQ.SsoRequest.send(e,cmd):BK.MQQ.SsoRequest.send(e,t)},t.prototype.getEvent=function(t,e){return e&&0==t.indexOf("apollo")?(e.seqId=this.seqId++,JSON.stringify({cmd:t,seqId:e.seqId})):t},t.prototype.setCallback=function(){var r=this,n=BK.MQQ.SsoRequest.callback;BK.MQQ.SsoRequest.callback=function(t,e,i){r.dispatchEvent(t,e,i),n(t,e,i)};var o=__dispatchEvent;__dispatchEvent=function(t,e,i){r.dispatchEvent(t,e,i),o(t,e,i)}},t.prototype.dispatchEvent=function(t,e,i){i?"number"==typeof i.seqId?this.emit(JSON.stringify({cmd:e,seqId:i.seqId}),{code:t,cmd:e,data:i}):this.emit(e,{code:t,cmd:e,data:i}):this.emit(e,{code:t,cmd:e,null:null})},t}(i(0));e.SsoRequest=o,t.exports=new o},function(t,e,i){"use strict";var n=BK.HttpUtil,r=function(){function t(t,e,i){this._headers={},this._isBodyCompatible=!1,this._url=t,this._method=e,"string"==typeof i?this._argu=i:i&&(this._body=i)}return t.prototype.setHttpHeader=function(t,e){this._headers[t]=e},t.prototype.setHttpRawBody=function(t){this._body=t},t.prototype.setHttpUploadProgressListener=function(t){this._uploadProgressListener=t},t.prototype.setHttpDownloadProgressListener=function(t){this._downloadProgressListener=t},t.prototype.sendRequest=function(i){var t=this._request=new n(this._url,this._method?this._method.toUpperCase():"GET");for(var e in this._headers)t.setHttpHeader(e,this._headers[e]);if(this._body)"string"==typeof this._body?((r=new BK.Buffer).writeAsString(this._body,!1),t.setHttpRawBody(r)):t.setHttpRawBody(this._body);else if(this._argu){var r;this._isBodyCompatible&&t.setHttpHeader("PostBody",this._argu),(r=new BK.Buffer).writeAsString(this._argu,!1),t.setHttpRawBody(r)}t.setHttpUploadProgressListener&&this._uploadProgressListener&&t.setHttpUploadProgressListener(this._uploadProgressListener),t.setHttpDownloadProgressListener&&this._downloadProgressListener&&t.setHttpDownloadProgressListener(this._downloadProgressListener),t.sendRequest?t.sendRequest(i):t.requestAsync(function(t,e){i(e,{},t)})},t.prototype.setHttpUrl=function(t){this._url=t},t.prototype.setHttpMethod=function(t){this._method=t},t.prototype.requestAsync=function(r){this.sendRequest(function(t,e,i){r(i,t)})},t.prototype.setHttpReferer=function(t){this.setHttpHeader("Referer",t)},t.prototype.setHttpCookie=function(t){this.setHttpHeader("Cookie",t)},t.prototype.setBodyCompatible=function(t){this._isBodyCompatible=t},t.prototype.setHttpPostData=function(t){this._argu=t},t.prototype.setHttpRawBodyFix=function(t){this.setHttpRawBody(t)},t}();t.exports=r},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var _=i(5),d=i(2),f=function(){function t(t,e,i){this.statusCode=t,this.headers=e,this._body=i}return t.prototype.text=function(){var t=this._body.readAsString(!0);return void 0===t?"":t},t.prototype.jsonObject=function(){var t=this._body.readAsString(!0);return t?JSON.parse(t):null},t.prototype.arrayBuffer=function(){return d.BKBufferToArrayBuffer(this._body)},t}();e.request=function(t){var e=t.url,i=t.method,r=t.headers,n=t.body,o=t.success,a=t.fail,s=t.complete,h=t.uploadProgress,l=t.downloadProgress;if(!e)throw new Error("HTTP request url is required");var c=new _(e,i);if(n&&c.setHttpRawBody("string"==typeof n?n:d.arrayBufferToBKBuffer(n)),r)for(var u in r)c.setHttpHeader(u,r[u]);c.setHttpUploadProgressListener(h),c.setHttpDownloadProgressListener(l),o||a||s||BK.Script.log(0,1,"[WARNING] send HTTP request without any callback"),c.sendRequest(function(t,e,i){t<0?a&&a({msg:i.readAsString(!0)}):o&&o(new f(t,e,i)),s&&s()})}},function(t,e,x){"use strict";var i;!function(t){var e,n="sc.game_shell_share.local",o="sc.share_game_to_friend_result.local",a="sc.game_shell_close.local",s="sc.game_enter_background.local",h="sc.game_enter_foreground.local",l="sc.game_maximize.local",c="sc.game_minimize.local",u="sc.network_change.local",_="cs.xy_life_cycle_event_activity.local",d="cs.xy_life_cycle_event_disactivity.local";(e=t.NetworkState||(t.NetworkState={}))[e.NoneToMobileNetwork=1]="NoneToMobileNetwork",e[e.NoneToWifi=2]="NoneToWifi",e[e.MobileNetworkToWifi=3]="MobileNetworkToWifi",e[e.MobileNetworkToNone=4]="MobileNetworkToNone",e[e.WifiToNone=5]="WifiToNone",e[e.WifiToMobileNetwork=6]="WifiToMobileNetwork";var f=new(x(0)),p="foreground",g="background",m="maximize",v="minimize",S="share",b="shareComplete",y="networkChange",T="close",B="leave",E="resume";function i(t){var e=t.cmd,i=t.data;switch(e){case h:f.emit(p);break;case s:f.emit(g);break;case l:f.emit(m);break;case c:f.emit(v);break;case a:f.emit(T);break;case n:f.emit(S);break;case o:if(0==i.reqCode){var r={retCode:i.ret,isFirstShare:0==i.isFirstTimeShare,shareDest:i.shareTo};f.emit(b,r)}break;case u:void 0===i.type?BK.Script.log(1,1,"net work change .data is worng!"):(r={state:i.type},f.emit(y,r));break;case _:f.emit(E);break;case d:f.emit(B)}}function r(t){if(void 0===t)throw new Error("callback can't be undefined!")}BK.SsoRequest.on(h,i),BK.SsoRequest.on(s,i),BK.SsoRequest.on(l,i),BK.SsoRequest.on(c,i),BK.SsoRequest.on(a,i),BK.SsoRequest.on(n,i),BK.SsoRequest.on(o,i),BK.SsoRequest.on(u,i),BK.SsoRequest.on(_,i),BK.SsoRequest.on(d,i),t.onEnterBackground=function(t){r(t),f.on(g,t)},t.offEnterBackground=function(t){r(t),f.off(g,t)},t.onEnterForeground=function(t){r(t),f.on(p,t)},t.offEnterForeground=function(t){r(t),f.off(p,t)},t.onGameClose=function(t){r(t),f.on(T,t)},t.offGameClose=function(t){r(t),f.off(T,t)},t.onGameShare=function(t){r(t),f.on(S,t)},t.offGameShare=function(t){r(t),f.off(S,t)},t.onGameShareComplete=function(t){r(t),f.on(b,t)},t.offGameShareComplete=function(t){r(t),f.off(b,t)},t.onNetworkChange=function(t){r(t),f.on(y,t)},t.offNetworkChange=function(t){r(t),f.off(y,t)},t.onMaximize=function(t){r(t),f.on(m,t)},t.offMaximize=function(t){r(t),f.off(m,t)},t.onMinimize=function(t){r(t),f.on(v,t)},t.offMinimize=function(t){r(t),f.off(v,t)},t.onResume=function(t){r(t),f.on(E,t)},t.offResume=function(t){r(t),f.off(E,t)},t.onLeave=function(t){r(t),f.on(B,t)},t.offLeave=function(t){r(t),f.off(B,t)}}(i||(i={})),BK.NetworkState=i.NetworkState,t.exports=i},function(t,e,i){"use strict";var o,r,n,a,s=function(){function t(t){this.mode=o.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);65536<n?(r[0]=240|(1835008&n)>>>18,r[1]=128|(258048&n)>>>12,r[2]=128|(4032&n)>>>6,r[3]=128|63&n):2048<n?(r[0]=224|(61440&n)>>>12,r[1]=128|(4032&n)>>>6,r[2]=128|63&n):128<n?(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))}return t.prototype.getLength=function(t){return this.parsedData.length},t.prototype.write=function(t){for(var e=0;e<this.parsedData.length;e++)t.put(this.parsedData[e],8)},t}(),h=function(){function h(t,e){this.moduleCount=0,this.dataList=new Array,this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=new Array}return h.prototype.addData=function(t){var e=new s(t);this.dataList.push(e),this.dataCache=null},h.prototype.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]},h.prototype.getModuleCount=function(){return this.moduleCount},h.prototype.make=function(){this.makeImpl(!1,this.getBestMaskPattern())},h.prototype.makeImpl=function(t,e){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++){this.modules[i]=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++)this.modules[i][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),7<=this.typeNumber&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=h.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},h.prototype.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)},h.prototype.getBestMaskPattern=function(){for(var t=0,e=0,i=0;i<8;i++){this.makeImpl(!0,i);var r=m.getLostPoint(this);(0==i||r<t)&&(t=r,e=i)}return e},h.prototype.createMovieClip=function(t,e,i){var r=t.createEmptyMovieClip(e,i);this.make();for(var n=0;n<this.modules.length;n++)for(var o=1*n,a=0;a<this.modules[n].length;a++){var s=1*a;this.modules[n][a]&&(r.beginFill(0,100),r.moveTo(s,o),r.lineTo(s+1,o),r.lineTo(s+1,o+1),r.lineTo(s,o+1),r.endFill())}return r},h.prototype.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)},h.prototype.setupPositionAdjustPattern=function(){for(var t=m.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 o=-2;o<=2;o++)for(var a=-2;a<=2;a++)this.modules[r+o][n+a]=-2==o||2==o||-2==a||2==a||0==o&&0==a}},h.prototype.setupTypeNumber=function(t){for(var e=m.getBCHTypeNumber(this.typeNumber),i=0;i<18;i++){var 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++)r=!t&&1==(e>>i&1),this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r},h.prototype.setupTypeInfo=function(t,e){for(var i=this.errorCorrectLevel<<3|e,r=m.getBCHTypeInfo(i),n=0;n<15;n++){var o=!t&&1==(r>>n&1);n<6?this.modules[n][8]=o:n<8?this.modules[n+1][8]=o:this.modules[this.moduleCount-15+n][8]=o}for(n=0;n<15;n++)o=!t&&1==(r>>n&1),n<8?this.modules[8][this.moduleCount-n-1]=o:n<9?this.modules[8][15-n-1+1]=o:this.modules[8][15-n-1]=o;this.modules[this.moduleCount-8][8]=!t},h.prototype.mapData=function(t,e){for(var i=-1,r=this.moduleCount-1,n=7,o=0,a=this.moduleCount-1;0<a;a-=2)for(6==a&&a--;;){for(var s=0;s<2;s++)if(null==this.modules[r][a-s]){var h=!1;o<t.length&&(h=1==(t[o]>>>n&1)),m.getMask(e,r,a-s)&&(h=!h),this.modules[r][a-s]=h,-1==--n&&(o++,n=7)}if((r+=i)<0||this.moduleCount<=r){r-=i,i=-i;break}}},h.createData=function(t,e,i){for(var r=u.getRSBlocks(t,e),n=new _,o=0;o<i.length;o++){var a=i[o];n.put(a.mode,4),n.put(a.getLength(),m.getLengthInBits(a.mode,t)),a.write(n)}var s=0;for(o=0;o<r.length;o++)s+=r[o].dataCount;if(n.getLengthInBits()>8*s)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+8*s+")");for(n.getLengthInBits()+4<=8*s&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*s||(n.put(h.PAD0,8),n.getLengthInBits()>=8*s));)n.put(h.PAD1,8);return h.createBytes(n,r)},h.createBytes=function(t,e){for(var i=0,r=0,n=0,o=new Array(e.length),a=new Array(e.length),s=0;s<e.length;s++){var h=e[s].dataCount,l=e[s].totalCount-h;r=Math.max(r,h),n=Math.max(n,l),o[s]=new Array(h);for(var c=0;c<o[s].length;c++)o[s][c]=255&t.buffer[c+i];i+=h;var u=m.getErrorCorrectPolynomial(l),_=new v(o[s],u.getLength()-1).mod(u);for(a[s]=new Array(u.getLength()-1),c=0;c<a[s].length;c++){var d=c+_.getLength()-a[s].length;a[s][c]=0<=d?_.get(d):0}}var f=0;for(c=0;c<e.length;c++)f+=e[c].totalCount;var p=new Array(f),g=0;for(c=0;c<r;c++)for(s=0;s<e.length;s++)c<o[s].length&&(p[g++]=o[s][c]);for(c=0;c<n;c++)for(s=0;s<e.length;s++)c<a[s].length&&(p[g++]=a[s][c]);return p},h.PAD0=236,h.PAD1=17,h}();(a=o||(o={}))[a.MODE_NUMBER=1]="MODE_NUMBER",a[a.MODE_ALPHA_NUM=2]="MODE_ALPHA_NUM",a[a.MODE_8BIT_BYTE=4]="MODE_8BIT_BYTE",a[a.MODE_KANJI=8]="MODE_KANJI",(n=r||(r={}))[n.L=1]="L",n[n.M=0]="M",n[n.Q=3]="Q",n[n.H=2]="H";for(var m=function(){function i(){}return i.getBCHTypeInfo=function(t){for(var e=t<<10;0<=i.getBCHDigit(e)-i.getBCHDigit(i.G15);)e^=i.G15<<i.getBCHDigit(e)-i.getBCHDigit(i.G15);return(t<<10|e)^i.G15_MASK},i.getBCHTypeNumber=function(t){for(var e=t<<12;0<=i.getBCHDigit(e)-i.getBCHDigit(i.G18);)e^=i.G18<<i.getBCHDigit(e)-i.getBCHDigit(i.G18);return t<<12|e},i.getBCHDigit=function(t){for(var e=0;0!=t;)e++,t>>>=1;return e},i.getPatternPosition=function(t){return i.PATTERN_POSITION_TABLE[t-1]},i.getMask=function(t,e,i){switch(t){case 0:return(e+i)%2==0;case 1:return e%2==0;case 2:return i%3==0;case 3:return(e+i)%3==0;case 4:return(Math.floor(e/2)+Math.floor(i/3))%2==0;case 5:return e*i%2+e*i%3==0;case 6:return(e*i%2+e*i%3)%2==0;case 7:return(e*i%3+(e+i)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},i.getErrorCorrectPolynomial=function(t){for(var e=new v([1],0),i=0;i<t;i++)e=e.multiply(new v([1,l.gexp(i)],0));return e},i.getLengthInBits=function(t,e){if(1<=e&&e<10)switch(t){case o.MODE_NUMBER:return 10;case o.MODE_ALPHA_NUM:return 9;case o.MODE_8BIT_BYTE:case o.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(e<27)switch(t){case o.MODE_NUMBER:return 12;case o.MODE_ALPHA_NUM:return 11;case o.MODE_8BIT_BYTE:return 16;case o.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(e<41))throw new Error("type:"+e);switch(t){case o.MODE_NUMBER:return 14;case o.MODE_ALPHA_NUM:return 13;case o.MODE_8BIT_BYTE:return 16;case o.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},i.getLostPoint=function(t){for(var e=t.getModuleCount(),i=0,r=0;r<e;r++)for(var n=0;n<e;n++){for(var o=0,a=t.isDark(r,n),s=-1;s<=1;s++)if(!(r+s<0||e<=r+s))for(var h=-1;h<=1;h++)n+h<0||e<=n+h||0==s&&0==h||a==t.isDark(r+s,n+h)&&o++;5<o&&(i+=3+o-5)}for(r=0;r<e-1;r++)for(n=0;n<e-1;n++){var l=0;t.isDark(r,n)&&l++,t.isDark(r+1,n)&&l++,t.isDark(r,n+1)&&l++,t.isDark(r+1,n+1)&&l++,0!=l&&4!=l||(i+=3)}for(r=0;r<e;r++)for(n=0;n<e-6;n++)t.isDark(r,n)&&!t.isDark(r,n+1)&&t.isDark(r,n+2)&&t.isDark(r,n+3)&&t.isDark(r,n+4)&&!t.isDark(r,n+5)&&t.isDark(r,n+6)&&(i+=40);for(n=0;n<e;n++)for(r=0;r<e-6;r++)t.isDark(r,n)&&!t.isDark(r+1,n)&&t.isDark(r+2,n)&&t.isDark(r+3,n)&&t.isDark(r+4,n)&&!t.isDark(r+5,n)&&t.isDark(r+6,n)&&(i+=40);var c=0;for(n=0;n<e;n++)for(r=0;r<e;r++)t.isDark(r,n)&&c++;return i+Math.abs(100*c/e/e-50)/5*10},i.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]],i.G15=1335,i.G18=7973,i.G15_MASK=21522,i}(),l={glog:function(t){if(t<1)throw new Error("glog("+t+")");return l.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;256<=t;)t-=255;return l.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},c=0;c<8;c++)l.EXP_TABLE[c]=1<<c;for(c=8;c<256;c++)l.EXP_TABLE[c]=l.EXP_TABLE[c-4]^l.EXP_TABLE[c-5]^l.EXP_TABLE[c-6]^l.EXP_TABLE[c-8];for(c=0;c<255;c++)l.LOG_TABLE[l.EXP_TABLE[c]]=c;var v=function(){function n(t,e){if(null==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]}return n.prototype.get=function(t){return this.num[t]},n.prototype.getLength=function(){return this.num.length},n.prototype.multiply=function(t){for(var e=new Array(this.getLength()+t.getLength()-1),i=0;i<this.getLength();i++)for(var r=0;r<t.getLength();r++)e[i+r]^=l.gexp(l.glog(this.get(i))+l.glog(t.get(r)));return new n(e,0)},n.prototype.mod=function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=l.glog(this.get(0))-l.glog(t.get(0)),i=new Array(this.getLength()),r=0;r<this.getLength();r++)i[r]=this.get(r);for(r=0;r<t.getLength();r++)i[r]^=l.gexp(l.glog(t.get(r))+e);return new n(i,0).mod(t)},n}(),u=function(){function c(t,e){this.totalCount=t,this.dataCount=e}return c.getRSBlocks=function(t,e){var i=c.getRsBlockTable(t,e);if(null==i)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var r=i.length/3,n=[],o=0;o<r;o++)for(var a=i[3*o+0],s=i[3*o+1],h=i[3*o+2],l=0;l<a;l++)n.push(new c(s,h));return n},c.getRsBlockTable=function(t,e){switch(e){case r.L:return c.RS_BLOCK_TABLE[4*(t-1)+0];case r.M:return c.RS_BLOCK_TABLE[4*(t-1)+1];case r.Q:return c.RS_BLOCK_TABLE[4*(t-1)+2];case r.H:return c.RS_BLOCK_TABLE[4*(t-1)+3];default:return}},c.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,7,37,13],[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]],c}(),_=function(){function t(){this.buffer=new Array,this.length=0}return t.prototype.get=function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},t.prototype.put=function(t,e){for(var i=0;i<e;i++)this.putBit(1==(t>>>e-i-1&1))},t.prototype.getLengthInBits=function(){return this.length},t.prototype.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++},t}();t.exports={QRCodeModel:h,QRErrorCorrectLevel:r}},function(t,e,i){"use strict";var r=function(){function t(t,e){if(2==arguments.length)this.__nativeObj=new BK.SandBoxCanvasNode(t,e);else{var i=BK.Director.screenPixelSize;this.__nativeObj=new BK.SandBoxCanvasNode(i.width,i.height)}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=!1,this._a=1,this._b=0,this._c=0,this._d=1,this._tx=0,this._ty=0,this.setFlipXY(0,1);var r=Object.getOwnPropertyNames(this.__nativeObj),n=this;r.forEach(function(t){var e=t;"scale"!=e&&"transform"!=e&&"contentSize"!=e&&"size"!=e&&"fontPath"!=e&&Object.defineProperty(n,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this)}return Object.defineProperty(t.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(t.prototype,"contentSize",{get:function(){return this.__nativeObj.contentSize},set:function(t){this.__nativeObj.contentSize=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.__nativeObj.size},set:function(t){this.__nativeObj.size=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(t.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(t.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(t.prototype,"lineWidth",{get:function(){return this.__nativeObj.lineWidth},set:function(t){this.__nativeObj.lineWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"globalAlpha",{get:function(){return this.__nativeObj.globalAlpha},set:function(t){var e=Math.min(1,t);e=Math.max(0,t),this.__nativeObj.globalAlpha=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fillColor",{get:function(){return this.__nativeObj.fillColor},set:function(t){this.__nativeObj.fillColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"strokeColor",{get:function(){return this.__nativeObj.strokeColor},set:function(t){this.__nativeObj.strokeColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineCap",{get:function(){return this.__nativeObj.lineCap},set:function(t){this.__nativeObj.lineCap=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this.__nativeObj.lineJoin},set:function(t){this.__nativeObj.lineJoin=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this.__nativeObj.miterLimit},set:function(t){this.__nativeObj.miterLimit=t},enumerable:!0,configurable:!0}),t.prototype.setImagePath=function(t){if(t){this.imagePath=t;var e=new BK.Texture(t);this.__nativeObj.setTexture(e)}},t.prototype.getImagePath=function(){return this.imagePath},t.prototype.setTexture=function(t){this.__nativeObj.setTexture(t)},t.prototype.setFlipXY=function(t,e){this.__nativeObj.setUVFlip(t,e)},t.prototype.setUVFlip=function(t,e){this.__nativeObj.setUVFlip(t,e)},t.prototype.setUVWrap=function(t,e){this.__nativeObj.setUVWrap(t,e)},t.prototype.setXYStretch=function(t,e){this.__nativeObj.setXYStretch(t,e)},t.prototype.adjustTexturePosition=function(t,e,i,r,n){this.__nativeObj.adjustTexturePosition(t,e,i,r,n)},t.prototype.addChild=function(t){return this.__nativeObj.addChild(t)},t.prototype.dispose=function(){return this.__nativeObj.dispose()},t.prototype.removeChild=function(t){return this.__nativeObj.removeChild(t)},t.prototype.removeChildById=function(t){return this.__nativeObj.removeChildById(t)},t.prototype.removeChildByName=function(t){return this.__nativeObj.removeChildByName(t)},t.prototype.queryChildAtIndex=function(t){return this.__nativeObj.queryChildAtIndex(t)},t.prototype.queryChlidById=function(t){return this.__nativeObj.queryChildById(t)},t.prototype.queryChildByName=function(t){return this.__nativeObj.queryChildByName(t)},t.prototype.getChildCount=function(){return this.__nativeObj.getChildCount()},t.prototype.removeFromParent=function(){this.__nativeObj.removeFromParent()},t.prototype.attachComponent=function(t){this.__nativeObj.attachComponent(t)},t.prototype.detachComponent=function(t){this.__nativeObj.detachComponent(t)},t.prototype.queryComponent=function(t){return this.__nativeObj.queryComponent(t)},t.prototype.queryComponentList=function(t){return this.__nativeObj.queryComponentList(t)},t.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},t.prototype.isEqual=function(t){return this.__nativeObj.isEqual(t)},t.prototype.convertToWorldSpace=function(t){return this.__nativeObj.convertToWorldSpace(t)},t.prototype.convertToNodeSpace=function(t){return this.__nativeObj.convertToNodeSpace(t)},t.prototype.useH5Mode=function(){if(this._useH5Mode=!0,1==arguments.length){this._useH5Mode=arguments[0];var t=arguments[0]?1:0;this.__nativeObj.useH5Mode(t)}else this.__nativeObj.useH5Mode()},t.prototype.getUseH5ModeNumber=function(){return this._useH5Mode?1:0},t.prototype.drawCircle=function(t,e,i){this.__nativeObj.drawCircle(t,e,i)},t.prototype.drawEllipse=function(t,e,i,r){this.__nativeObj.drawEllipse(t,e,i,r)},t.prototype.drawImage=function(){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()},t.prototype.fill=function(){this.__nativeObj.fill()},t.prototype.stroke=function(){this.__nativeObj.stroke()},t.prototype.rect=function(t,e,i,r){this.__nativeObj.rect(t,e,i,r)},t.prototype.fillRect=function(t,e,i,r){this.__nativeObj.fillRect(t,e,i,r)},t.prototype.strokeRect=function(t,e,i,r){this.__nativeObj.strokeRect(t,e,i,r)},t.prototype.clearRect=function(t,e,i,r){this.__nativeObj.clearRect(t,e,i,r)},t.prototype.beginPath=function(){this.__nativeObj.beginPath()},t.prototype.closePath=function(){this.__nativeObj.closePath()},t.prototype.moveTo=function(t,e){this.__nativeObj.moveTo(t,e)},t.prototype.lineTo=function(t,e){this.__nativeObj.lineTo(t,e)},t.prototype.arcTo=function(t,e,i,r,n){this.__nativeObj.arcTo(t,e,i,r,n)},t.prototype.arc=function(t,e,i,r,n,o){5==arguments.length?this.__nativeObj.arc(t,e,i,r,n):this.__nativeObj.arc(t,e,i,r,n,o)},t.prototype.quadraticCurveTo=function(t,e,i,r){this.__nativeObj.quadraticCurveTo(t,e,i,r)},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){this.__nativeObj.bezierCurveTo(t,e,i,r,n,o)},t.prototype.save=function(){this.__nativeObj.save()},t.prototype.restore=function(){this.__nativeObj.restore()},t.prototype.fillTextWithSize=function(t,e,i,r,n,o,a){if(7==arguments.length){switch(n?2-o:o){case 1:e-=.5*r;break;case 2:e-=1*r}switch(a){case 1:t-=.5*i;break;case 2:t-=1*i}var s={x:0,y:0,width:0,height:0};return s.x=t,s.y=e,s.width=Math.min(2048,i),s.height=Math.min(1024,r),s}},t.prototype.fillText=function(t,e,i,r){var n=2048;r&&(n=r);var o=this.measureText(t,n,1024);switch(this._useH5Mode?2-this._textBaseLine:this._textBaseLine){case 1:i-=.5*o.height;break;case 2:i-=1*o.height}switch(this._textAlign){case 1:e-=.5*o.width;break;case 2:e-=1*o.width}this.__nativeObj.fillText(t,e,i,Math.min(n,o.width),Math.min(n,o.height)),this._innerSetTransform()},t.prototype.clip=function(){this.__nativeObj.clip()},t.prototype.isPointInPath=function(t,e){return this.__nativeObj.isPointInPath(t,e)},t.prototype.createImageData=function(t,e){if(2==arguments.length){var i=new BK.Buffer(t*e*4);return i.__inner_image_width=t,i.__inner_image_height=e,i}},t.prototype.getImageData=function(){},t.prototype.putImageData=function(t,e,i){if(3==arguments.length){var r=t.__inner_image_width,n=t.__inner_image_height;this.__nativeObj.putImageData(t,e,i,r,n)}},t.prototype.scale=function(t,e){this.__nativeObj.scales(t,e)},t.prototype.scales=function(t,e){this.__nativeObj.scales(t,e)},t.prototype.rotate=function(t){this.__nativeObj.rotate(t)},t.prototype.translate=function(t,e){var i=GameStatusInfo.QQVer.split(".");7==Number(i[0])&&7==Number(i[1])&&Number(i[2])<=5?(this._tx=t,this._ty=e,this._innerSetTransform()):this.__nativeObj.translate(t,e)},t.prototype.transform=function(t,e,i,r,n,o){this.__nativeObj.transforms(t,e,i,r,n,o)},t.prototype.transforms=function(t,e,i,r,n,o){var a=GameStatusInfo.QQVer.split(".");Number(a[0])<7||7==Number(a[0])&&Number(a[1])<7?this.__nativeObj.transforms(t,e,i,r,n,o):this.setTransform(t,e,i,r,n,o)},t.prototype.setTransform=function(t,e,i,r,n,o){this._a=t,this._b=e,this._c=i,this._d=r,this._tx=n,this._ty=o,this.__nativeObj.setTransform(t,e,i,r,n,o)},t.prototype._innerSetTransform=function(){var t=GameStatusInfo.QQVer.split(".");7==Number(t[0])&&7==Number(t[1])&&Number(t[2])<=5&&this.__nativeObj.setTransform(this._a,this._b,this._c,this._d,this._tx,this._ty)},t.prototype.textShadowColor=function(t){this._shadowColor=t,this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},t.prototype.textShadowRadius=function(t){this._shadowRadius=t,this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},t.prototype.textShadowOffsetX=function(t){this._shadowOffset.x=t,this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},t.prototype.textShadowOffsetY=function(t){this._shadowOffset.y=t,this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},t.prototype.clear=function(){this.__nativeObj.clear()},t.prototype.getTexture=function(){},t.prototype.drawText=function(t,e,i,r,n){this.__nativeObj.drawText(t,e,i,r,n),this._innerSetTransform()},t.prototype.setTextSize=function(t){this.__nativeObj.setTextSize(t)},t.prototype.setTextAlign=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)},t.prototype.setTextBold=function(t){this.__nativeObj.setTextBold(t)},t.prototype.setTextItalic=function(t){this.__nativeObj.setTextItalic(t)},t.prototype.measureText=function(t,e,i){var r=2048,n=1024;return e&&(r=e),i&&(n=i),this.__nativeObj.measureText(t,r,n)},t.prototype.updateCanvasTexture=function(){this.__nativeObj.updateCanvasTexture()},t.prototype.saveTo=function(t){},t.prototype.getObject=function(){return this.__nativeObj},t}();t.exports=r},,,,function(t,e,i){if(BK.isBrowser,BK.Console=i(14),BK.SsoRequest=i(4),!BK.isBrowser){BK.HttpUtil=i(5),BK.Http=i(6),BK.Util=i(15),BK.Util.Buffer=i(2),BK.UI=i(16);var r=i(7);if(BK.Canvas=i(18).Canvas,BK.onEnterForeground=r.onEnterForeground,BK.onEnterBackground=r.onEnterBackground,BK.onMaximize=r.onMaximize,BK.onMinimize=r.onMinimize,BK.onGameClose=r.onGameClose,BK.onNetworkChange=r.onNetworkChange,BK.onGameShare=r.onGameShare,BK.onGameShareComplete=r.onGameShareComplete,BK.onLeave=r.onLeave,BK.onResume=r.onResume,BK.offEnterForeground=r.offEnterForeground,BK.offEnterBackground=r.offEnterBackground,BK.offMaximize=r.offMaximize,BK.offMinimize=r.offMinimize,BK.offGameClose=r.offGameClose,BK.offNetworkChange=r.offNetworkChange,BK.offGameShare=r.offGameShare,BK.offGameShareComplete=r.offGameShareComplete,BK.offLeave=r.offLeave,BK.offResume=r.offResume,BK.Crypt=i(20),0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")){var n=i(21)();BK.createAudioContext=n.AudioFactory.createAudioContext,BK.Audio=n.Audio2,BK.AudioManager=n.AudioManager,BK.onAudioInterruptionStart=n.AudioManager.onAudioInterruptionStart,BK.onAudioInterruptionEnd=n.AudioManager.onAudioInterruptionEnd}BK.Device=i(22);var o=i(23);BK.taskManager=new o;var a=i(24);BK.fileSystem=new a,BK.QRCode=i(25);var s=i(26);BK.localStorage=s.localStorage,BK.sessionStorage=s.sessionStorage,BK.storageEventListener=i(28),BK.AnimationSprite=i(29),BK.SpriteSet=i(30),BK.SpriteSetCache=i(31),BK.SpriteNine=i(32),BK.loadSubpackage=i(33),BK.Texture=i(35),BK.Image=i(36),BK.createWebView=i(37)}BK.Share=i(38),BK.Upload=i(39),BK.Screenshot=i(40);var h=i(41);BK.Advertisement.createBannerAd=h.createBannerAd,BK.Advertisement.createVideoAd=h.createVideoAd,BK.getSystemInfoSync=i(42).getSystemInfoSync;var l=i(43);BK.MQQ.Account.queryAvatarAndNickCanvas=l.queryAvatarAndNickCanvas,BK.MQQ.Account.queryNickCanvas=l.queryNickCanvas,BK.MQQ.Account.queryAvatarCanvas=l.queryAvatarCanvas,BK.Product={redPacket:i(47)},BK.report=i(48).report},function(t,e,i){"use strict";function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;Object.defineProperty(e,"__esModule",{value:!0}),function(t){var h=2048,e={};function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r(1,0,t)}function r(t,e,i){for(var r="",n=0,o=i;n<o.length;n++){var a=o[n];-1!=r.indexOf("%d")&&"number"==typeof a?r=r.replace("%d",a.toString()):-1!=r.indexOf("%s")&&"string"==typeof a?r=r.replace("%s",a):-1!=r.indexOf("%o")&&"object"==l(a)?r=r.replace("%o",JSON.stringify(a)):"object"==l(a)?r=r+JSON.stringify(a)+" ":null==a?r+="undefined ":r=r+a.toString()+" "}if(r.length>h)for(var s=0;s<=r.length/h;s++)BK.Script.log(t,e,r.slice(s*h,(s+1)*h));else BK.Script.log(t,e,r)}t.log=i,t.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r(0,0,t)},t.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r(1,-1,t)},t.time=function(t){e[t]=BK.Time.timestamp},t.timeEnd=function(t){i(t,":",1e3*(BK.Time.timestamp-e[t]),"ms"),delete e[t]}}(r=e.Console||(e.Console={})),t.exports=r},function(t,e,i){"use strict";var r;(r||(r={})).buffer=function(){},t.exports=r},function(t,e,s){"use strict";var i;!function(t){var e=new(s(0)),i="keyboardInput",r="keyboardConfirm",n=s(17);function o(t){e.emit(r,{text:t})}function a(t){e.emit(i,{text:t})}t.onKeyboardInput=function(t){if(!t)throw new Error("listener can't be undefined!");e.on(i,t)},t.offKeyboardInput=function(t){if(!t)throw new Error("listener can't be undefined!");e.off(i,t)},t.onKeyboardConfirm=function(t){if(!t)throw new Error("listener can't be undefined!");e.on(r,t)},t.offKeyboardConfirm=function(t){if(!t)throw new Error("listener can't be undefined!");e.off(r,t)},t.showKeyboard=function(t){t&&t.defaultText&&BK.Editor.setText(t.defaultText+""),BK.Editor.showKeyBoard(o,a),t&&t.complete&&t.complete()},t.hideKeyboard=function(t){BK.Editor.hideKeyBoard(),t&&t.complete&&t.complete()},t.updateKeyboard=function(t){t&&(t.text?BK.Editor.setText(t.text+""):BK.Editor.setText(""),t.complete&&t.complete())},t.showToast=function(t){n.toast.show(t)},t.hideToast=function(t){n.toast.hide(t)},t.showLoading=function(t){n.loading.show(t)},t.hideLoading=function(t){n.loading.hide(t)},t.showAlert=function(t){n.alert.show(t)}}(i||(i={})),t.exports=i},function(t,e,i){"use strict";var r;!function(t){var e=function(){function t(){}return t.show=function(r){if(r&&r.complete){var t="sc.xy_toast_show_complete.local";BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r.complete()})}else BK.MQQ.SsoRequest.removeListener("sc.xy_toast_show_complete.local",this);BK.MQQ.dialog.show("toast",JSON.stringify(r))},t.hide=function(r){if(r&&r.complete){var t="sc.xy_toast_hide_complete.local";BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r.complete()})}else BK.MQQ.SsoRequest.removeListener("sc.xy_toast_hide_complete.local",this);BK.MQQ.dialog.hide("toast")},t}();t.toast=e;var i=function(){function t(){}return t.show=function(r){if(r&&r.complete){var t="sc.xy_loading_show_complete.local";BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r.complete()})}else BK.MQQ.SsoRequest.removeListener("sc.xy_loading_show_complete.local",this);BK.MQQ.dialog.show("loading",JSON.stringify(r))},t.hide=function(r){if(r&&r.complete){var t="sc.xy_loading_hide_complete.local";BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r.complete()})}else BK.MQQ.SsoRequest.removeListener("sc.xy_loading_hide_complete.local",this);BK.MQQ.dialog.hide("loading")},t}();t.loading=i;var r=function(){function t(){}return t.show=function(r){if(r&&r.success){var t="sc.xy_alert_show_success.local";BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r.success(i)})}else BK.MQQ.SsoRequest.removeListener("sc.xy_alert_show_success.local",this);r&&r.complete?(t="sc.xy_alert_show_complete.local",BK.MQQ.SsoRequest.removeListener(t,this),BK.MQQ.SsoRequest.addListener(t,this,function(t,e,i){r.complete()})):BK.MQQ.SsoRequest.removeListener("sc.xy_alert_show_complete.local",this),BK.MQQ.dialog.show("alert",JSON.stringify(r))},t}();t.alert=r}(r||(r={})),t.exports=r},function(t,e,i){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n=i(19),o=n.normalizeColor,a=n.bkCanvasColor,s=n.formatRGBAColorHexString,h={copy:1,"source-over":3,"destination-over":4,"source-in":5,"destination-in":6,"source-out":7,"destination-out":8,"source-atop":9,"destination-atop":10,xor:11,lighter:12},l={"source-over":0,copy:17,"source-in":18,"source-out":19,"source-atop":20,"destination-over":21,"destination-in":22,"destination-out":23,"destination-atop":24,xor:25,lighter:27},c={"no-repeat":0,"repeat-x":1,"repeat-y":2,repeat:3};function u(){var t=arguments,e=arguments.length,i=0<e&&void 0!==t[0]?t[0]:0,r=1<e&&void 0!==t[1]?t[1]:0;this.__nativeObj=new BK.CanvasNode(i,r),this._textShadowColor={r:0,g:0,b:0,a:0},this._textShadowOffset={x:0,y:0},this._textShadowRadius=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,this._fillStyle="#000",this._strokeStyle="#000",this._shadowColor="#000",this.setFlipXY(0,1),Object.getOwnPropertyNames(this.__nativeObj).forEach(function(t){var e=t;"scale"!=e&&"transform"!=e&&"contentSize"!=e&&"size"!=e&&"fontPath"!=e&&"fillStyle"!=e&&"globalCompositeOperation"!=e&&"shadowColor"!=e&&Object.defineProperty(this,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this)}Object.defineProperty(u.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(u.prototype,"shadowColor",{get:function(){return this.__nativeObj.canvasShadowColor},set:function(t){this.__nativeObj.canvasShadowColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"shadowBlur",{get:function(){return this.__nativeObj.canvasShadowBlur},set:function(t){this.__nativeObj.canvasShadowBlur=t},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"shadowOffsetX",{get:function(){return this.__nativeObj.canvasShadowOffsetX},set:function(t){this.__nativeObj.canvasShadowOffsetX=t},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"shadowOffsetY",{get:function(){return this.__nativeObj.canvasShadowOffsetY},set:function(t){this.__nativeObj.canvasShadowOffsetY=t},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"contentSize",{get:function(){return this.__nativeObj.contentSize},set:function(t){this.__nativeObj.contentSize=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"size",{get:function(){return this.__nativeObj.size},set:function(t){this.__nativeObj.size=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(u.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(u.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(u.prototype,"lineWidth",{get:function(){return this.__nativeObj.lineWidth},set:function(t){this.__nativeObj.lineWidth=t},enumerable:!0,configurable:!0}),Object.defineProperties(u.prototype,{fillStyle:{get:function(){return this._fillStyle},set:function(t){if("string"==typeof t){var e=o(t);e&&(this.__nativeObj.fillColor=a(e),this._fillStyle=s(e))}else{var i={};t instanceof _?(i.type=3,i.tag=t.tag,"string"==typeof t.image?i.imagePath=t.image:"object"===r(t.image)&&(i.image=t.image),i.repetition=t.repetition,this._fillStyle=t,this.__nativeObj.fillStyle=i):t instanceof d?(i.type=2,i.tag=t.tag,i.x0=t.x0,i.y0=t.y0,i.x1=t.x1,i.y1=t.y1,i.subType=t.subType,i.r0=t.r0,i.r1=t.r1,i.colorStop=t.colorStop,this._fillStyle=t,this.__nativeObj.fillStyle=i):1===GameStatusInfo.isWhiteUser&&BK.UI.showAlert({title:"\u8b66\u544a",content:"Canvas fillStyle \u4f20\u5165\u4e0d\u5408\u6cd5\u6570\u636e"})}},configurable:!0},strokeStyle:{get:function(){return this._strokeStyle},set:function(t){if("string"==typeof t){var e=o(t);e&&(this.__nativeObj.strokeColor=a(e),this._strokeStyle=s(e))}},configurable:!0}}),Object.defineProperty(u.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(u.prototype,"shadowColor",{get:function(){return this._shadowColor},set:function(t){if("string"==typeof t){var e=o(t);e&&(this.__nativeObj.shadowColor=a(e),this._shadowColor=s(e))}else if("object"===r(t)&&(this._shadowColor=t,this.__nativeObj))return this.__nativeObj.setTextShadow==="object"(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"globalCompositeOperation",{get:function(){var t=this.__nativeObj.globalCompositeOperation;return"android"==GameStatusInfo.platform?f(h,t):f(l,t)},set:function(t){var e;e="android"==GameStatusInfo.platform?h[t]||3:l[t]||0,this.__nativeObj.globalCompositeOperation=e},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"fillColor",{get:function(){return this.__nativeObj.fillColor},set:function(t){this.__nativeObj.fillColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"strokeColor",{get:function(){return this.__nativeObj.strokeColor},set:function(t){this.__nativeObj.strokeColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"lineCap",{get:function(){return this.__nativeObj.lineCap},set:function(t){this.__nativeObj.lineCap=t},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"lineJoin",{get:function(){return this.__nativeObj.lineJoin},set:function(t){this.__nativeObj.lineJoin=t},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"miterLimit",{get:function(){return this.__nativeObj.miterLimit},set:function(t){this.__nativeObj.miterLimit=t},enumerable:!0,configurable:!0}),Object.defineProperties(u.prototype,{width:{get:function(){return this.size.width},set:function(t){var e=this.size;e.width=t,this.size=e},configurable:!0},height:{get:function(){return this.size.height},set:function(t){var e=this.size;e.height=t,this.size=e},configurable:!0}}),u.prototype.setImagePath=function(t){if(t){this.imagePath=t;var e=new BK.Texture(t);this.__nativeObj.setTexture(e)}},u.prototype.getImagePath=function(){return this.imagePath},u.prototype.setTexture=function(t){this.__nativeObj.setTexture(t)},u.prototype.setFlipXY=function(t,e){this.__nativeObj.setUVFlip(t,e)},u.prototype.setUVFlip=function(t,e){this.__nativeObj.setUVFlip(t,e)},u.prototype.setUVWrap=function(t,e){this.__nativeObj.setUVWrap(t,e)},u.prototype.setXYStretch=function(t,e){this.__nativeObj.setXYStretch(t,e)},u.prototype.adjustTexturePosition=function(t,e,i,r,n){this.__nativeObj.adjustTexturePosition(t,e,i,r,n)},u.prototype.addChild=function(t){return this.__nativeObj.addChild(t)},u.prototype.dispose=function(){return this.__nativeObj.dispose()},u.prototype.removeChild=function(t){return this.__nativeObj.removeChild(t)},u.prototype.removeChildById=function(t){return this.__nativeObj.removeChildById(t)},u.prototype.removeChildByName=function(t){return this.__nativeObj.removeChildByName(t)},u.prototype.removeChildByTag=function(t){return this.__nativeObj.removeChildByTag(t)},u.prototype.queryChildAtIndex=function(t){return this.__nativeObj.queryChildAtIndex(t)},u.prototype.queryChildById=function(t){return this.__nativeObj.queryChildById(t)},u.prototype.queryChildByName=function(t){return this.__nativeObj.queryChildByName(t)},u.prototype.queryChildByTag=function(t){return this.__nativeObj.queryChildByTag(t)},u.prototype.getChildCount=function(){return this.__nativeObj.getChildCount()},u.prototype.removeFromParent=function(){return this.__nativeObj.removeFromParent()},u.prototype.attachComponent=function(t){return this.__nativeObj.attachComponent(t)},u.prototype.detachComponent=function(t){return this.__nativeObj.detachComponent(t)},u.prototype.queryComponent=function(t){return this.__nativeObj.queryComponent(t)},u.prototype.queryComponentList=function(t){return this.__nativeObj.queryComponentList(t)},u.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},u.prototype.isEqual=function(t){return this.__nativeObj.isEqual(t)},u.prototype.convertToWorldSpace=function(t){return this.__nativeObj.convertToWorldSpace(t)},u.prototype.convertToNodeSpace=function(t){return this.__nativeObj.convertToNodeSpace(t)},u.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},u.prototype.useH5Mode=function(){return this.__nativeObj?(this._useH5Mode=1)==arguments.length?(this._useH5Mode=arguments[0],this.__nativeObj.useH5Mode(arguments[0])):this.__nativeObj.useH5Mode():0},u.prototype.drawCircle=function(){return this.__nativeObj?this.__nativeObj.drawCircle(arguments[0],arguments[1],arguments[2]):0},u.prototype.drawEllipse=function(){return this.__nativeObj?this.__nativeObj.drawEllipse(arguments[0],arguments[1],arguments[2],arguments[3]):0},u.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},u.prototype.fill=function(){return this.__nativeObj?this.__nativeObj.fill():0},u.prototype.stroke=function(){return this.__nativeObj?this.__nativeObj.stroke():0},u.prototype.rect=function(){return this.__nativeObj?this.__nativeObj.rect(arguments[0],arguments[1],arguments[2],arguments[3]):0},u.prototype.fillRect=function(){return this.__nativeObj?this.__nativeObj.fillRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},u.prototype.strokeRect=function(){return this.__nativeObj?this.__nativeObj.strokeRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},u.prototype.clearRect=function(){return this.__nativeObj?this.__nativeObj.clearRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},u.prototype.beginPath=function(){return this.__nativeObj?this.__nativeObj.beginPath():0},u.prototype.closePath=function(){return this.__nativeObj?this.__nativeObj.closePath():0},u.prototype.moveTo=function(){return this.__nativeObj?this.__nativeObj.moveTo(arguments[0],arguments[1]):0},u.prototype.lineTo=function(){return this.__nativeObj?this.__nativeObj.lineTo(arguments[0],arguments[1]):0},u.prototype.arcTo=function(){return this.__nativeObj?this.__nativeObj.arcTo(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]):0},u.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},u.prototype.quadraticCurveTo=function(){return this.__nativeObj?this.__nativeObj.quadraticCurveTo(arguments[0],arguments[1],arguments[2],arguments[3]):0},u.prototype.bezierCurveTo=function(){return this.__nativeObj?this.__nativeObj.bezierCurveTo(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]):0},u.prototype.save=function(){return this.__nativeObj?this.__nativeObj.save():0},u.prototype.restore=function(){return this.__nativeObj?this.__nativeObj.restore():0},u.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},u.prototype.clip=function(){return this.__nativeObj?this.__nativeObj.clip():0},u.prototype.isPointInPath=function(){if(this.__nativeObj)return this.__nativeObj.isPointInPath(arguments[0],arguments[1])},u.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}},u.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}},u.prototype.putImageData=function(){var t=arguments.length;if(this.__nativeObj&&3==t){var e=arguments[0],i=arguments[1],r=arguments[2];e instanceof ArrayBuffer&&(e=BK.Util.Buffer.typedArrayToBKBuffer(new Uint8Array(e)),arguments[0]=e);var n=e.__inner_image_width,o=e.__inner_image_height;return this.__nativeObj.putImageData(arguments[0],i,r,n,o)}},u.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])},u.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])},u.prototype.rotate=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. rotate :"+arguments[0]),this.__nativeObj.rotate(arguments[0])},u.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])}},u.prototype.transform=function(){if(this.__nativeObj)return this.__nativeObj.transforms(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},u.prototype.transforms=function(){return this.setTransform(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},u.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=(i=this._a,r=this._b,n=this._c,o=this._d,_=-1*(1*n-0*(a=this._tx))/(h=i*o*1+n*(s=this._ty)*0+a*r*0-a*o*0-n*r*1-i*s*0),u=-1*(1*r-0*s)/h,l=_,1*(0*r-0*o)/h,c=_=1*(n*s-a*o)/h,_=-1*(0*i-0*n)/h,[1*(1*o-0*s)/h,u,l,1*(1*i-0*a)/h,c,-1*(i*s-a*r)/h]);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])}var i,r,n,o,a,s,h,l,c,u,_},u.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)}},u.prototype.textShadowColor=function(){if(this._textShadowColor=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._textShadowOffset.x,this._textShadowOffset.y,this._textShadowRadius,this._textShadowColor)},u.prototype.textShadowRadius=function(){if(this._textShadowRadius=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._textShadowOffset.x,this._textShadowOffset.y,this._textShadowRadius,this._textShadowColor)},u.prototype.textShadowOffsetX=function(){if(this._textShadowOffset.x=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._textShadowOffset.x,this._textShadowOffset.y,this._textShadowRadius,this._textShadowColor)},u.prototype.textShadowOffsetY=function(){if(this._textShadowOffset.y=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._textShadowOffset.x,this._textShadowOffset.y,this._textShadowRadius,this._textShadowColor)},u.prototype.clear=function(){if(this.__nativeObj)return this.__nativeObj.clear()},u.prototype.getTexture=function(){return this.__nativeObj?this.__nativeObj.getTexture():null},u.prototype.drawText=function(){return this.__nativeObj&&(this.__nativeObj.drawText(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]),this._innerSetTransform()),null},u.prototype.setTextSize=function(){return this.__nativeObj?this.__nativeObj.setTextSize(arguments[0]):null},u.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},u.prototype.setTextBold=function(){return this.__nativeObj?this.__nativeObj.setTextBold(arguments[0]):null},u.prototype.setTextItalic=function(){return this.__nativeObj?this.__nativeObj.setTextItalic(arguments[0]):null},u.prototype.measureText=function(){return this.__nativeObj?this.__nativeObj.measureText(arguments[0],arguments[1],arguments[2]):null},u.prototype.updateCanvasTexture=function(){return this.__nativeObj?this.__nativeObj.updateCanvasTexture():null},u.prototype.saveTo=function(){var t=arguments.length;return this.__nativeObj&&1==t&&this.__nativeObj.saveTo(arguments[0]),null},u.prototype.toDataURL=function(){if(this.__nativeObj){var t="GameSandBox://cmdataUrltest.png";this.__nativeObj.saveTo(t);var e=BK.FileUtil.readFile(t);BK.FileUtil.deleteFile(t);var i=BK.Misc.encodeBase64FromBuffer(e);return i&&(i="data:image/png;base64,"+i),i}return""};var _=function(){function t(t,e){this.image=t||"";var i=c[e||"repeat"];this.repetition=i,this.tag="813858ef942fd556"}return t.prototype.setTransform=function(t){},t}();u.prototype.createPattern=function(t,e){return new _(t,e)};var d=function(){function t(t,e,i,r,n,o,a){this.x0=t,this.y0=e,this.x1=i,this.y1=r,this.subType=n||1,this.r0=o||0,this.r1=a||0,this.colorStop=[],this.tag="813858ef942fd556"}return t.prototype.addColorStop=function(t,e){if(t<0||1<t)throw new Error("INDEX_SIZE_ERR: CanvasGradient.addColorStop call with: ".concat(t,"."));var i=o(e);if(!i)throw new Error("SYNTAX_ERR: CanvasGradient.addColorStop call with: ".concat(e,"."));var r={offset:t,color:a(i)};this.colorStop.push(r)},t}();function f(e,i){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(t,e){return t===e};return Object.keys(e).find(function(t){return r(e[t],i)})}u.prototype.createLinearGradient=function(t,e,i,r){return new d(t,e,i,r,1)},u.prototype.createRadialGradient=function(t,e,i,r,n,o){return new d(t,e,r,n,2,i,o)},t.exports={Canvas:u}},function(t,e,i){"use strict";function h(t,e,i){return i<0&&(i+=1),1<i&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function r(t,e,i){var r=i<.5?i*(1+e):i+e-i*e,n=2*i-r,o=h(n,r,t+1/3),a=h(n,r,t),s=h(n,r,t-1/3);return Math.round(255*o)<<24|Math.round(255*a)<<16|Math.round(255*s)<<8}Object.defineProperty(e,"__esModule",{value:!0});var n="[-+]?\\d*\\.?\\d+",o=n+"%";function a(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"\\(\\s*("+t.join(")\\s*,\\s*(")+")\\s*\\)"}var s={rgb:new RegExp("rgb"+a(n,n,n)),rgba:new RegExp("rgba"+a(n,n,n,n)),hsl:new RegExp("hsl"+a(n,o,o)),hsla:new RegExp("hsla"+a(n,o,o,n)),hex3:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex4:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#([0-9a-fA-F]{6})$/,hex8:/^#([0-9a-fA-F]{8})$/};function l(t){var e=parseInt(t,10);return e<0?0:255<e?255:e}function c(t){return(parseFloat(t)%360+360)%360/360}function u(t){var e=parseFloat(t);return e<0?0:1<e?255:Math.round(255*e)}function _(t){var e=parseFloat(t);return e<0?0:100<e?1:e/100}var d={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};e.normalizeColor=function(t){var e;return"number"==typeof t?t>>>0===t&&0<=t&&t<=4294967295?t:null:(e=s.hex6.exec(t))?parseInt(e[1]+"ff",16)>>>0:d.hasOwnProperty(t)?d[t]:(e=s.rgb.exec(t))?(l(e[1])<<24|l(e[2])<<16|l(e[3])<<8|255)>>>0:(e=s.rgba.exec(t))?(l(e[1])<<24|l(e[2])<<16|l(e[3])<<8|u(e[4]))>>>0:(e=s.hex3.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=s.hex8.exec(t))?parseInt(e[1],16)>>>0:(e=s.hex4.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=s.hsl.exec(t))?(255|r(c(e[1]),_(e[2]),_(e[3])))>>>0:(e=s.hsla.exec(t))?(r(c(e[1]),_(e[2]),_(e[3]))|u(e[4]))>>>0:null},e.bkCanvasColor=function(t){return t?{r:Math.round((4278190080&t)>>>24)/255,g:Math.round((16711680&t)>>>16)/255,b:Math.round((65280&t)>>>8)/255,a:((255&t)>>>0)/255}:null},e.formatRGBAColorHexString=function(t){var e=t.toString(16);return"#"+"0".repeat(8-e.length)+e}},function(t,e,i){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=function(){function r(){this.hexcase=0,this.b64pad="",this.chrsz=8,this.cryptQueue=Array(),this.safe_add=function(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i},this.rol=function(t,e){return t<<e|t>>>32-e};var n=this;"undefined"!=typeof BK&&BK.Director.ticker.add(function(t,e){if(0<n.cryptQueue.length){var i=n.cryptQueue[0];n.cryptQueue.splice(0,1);var r=void 0;try{r=i.doCrypt.call(n,i.param)}catch(t){if(!i.param.fail)throw t;i.param.fail({msg:t.message})}r&&i.param.success&&i.param.success({data:r}),i.param.complete&&i.param.complete()}}.bind(n))}return r.prototype.checkParam=function(t){if(!t)throw new Error("param can not be undefined");if("object"!==n(t))throw new Error("param must be a object,can not be "+n(t))},r.prototype.checkType=function(t,e){if(!("number"==typeof t||"string"==typeof t||t instanceof Array))throw Error(e+" must be string or binary array!")},r.md5ToHex=function(t){r.crypt.checkParam(t),r.crypt.checkType(t.data,"data"),r.crypt.cryptQueue.push({param:t,doCrypt:r.md5ToHexSync})},r.md5ToHexSync=function(t){r.crypt.checkParam(t);var e=t.data;return r.crypt.checkType(e,"data"),r.crypt.bin2hexLittle(r.crypt.core_md5(r.crypt.str2binLittle(e),e.length*r.crypt.chrsz))},r.md5ToBase64=function(t){r.crypt.checkParam(t),r.crypt.checkType(t.data,"data"),r.crypt.cryptQueue.push({param:t,doCrypt:r.md5ToBase64Sync})},r.md5ToBase64Sync=function(t){r.crypt.checkParam(t);var e=t.data;return r.crypt.checkType(e,"data"),r.crypt.bin2b64Little(r.crypt.core_md5(r.crypt.str2binLittle(e),e.length*r.crypt.chrsz))},r.hmacMd5ToHex=function(t){r.crypt.checkParam(t),r.crypt.checkType(t.data,"data"),r.crypt.checkType(t.key,"key"),r.crypt.cryptQueue.push({param:t,doCrypt:r.hmacMd5ToHexSync})},r.hmacMd5ToHexSync=function(t){r.crypt.checkParam(t);var e=t.key,i=t.data;return r.crypt.checkType(i,"data"),r.crypt.checkType(e,"key"),r.crypt.bin2hexLittle(r.crypt.core_hmac_md5(e,i))},r.hmacMd5ToBase64=function(t){r.crypt.checkParam(t),r.crypt.checkType(t.data,"data"),r.crypt.checkType(t.key,"key"),r.crypt.cryptQueue.push({param:t,doCrypt:r.hmacMd5ToBase64Sync})},r.hmacMd5ToBase64Sync=function(t){r.crypt.checkParam(t);var e=t.key,i=t.data;return r.crypt.checkType(i,"data"),r.crypt.checkType(e,"key"),r.crypt.bin2b64Little(r.crypt.core_hmac_md5(e,i))},r.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,o=271733878,a=0;a<t.length;a+=16){var s=i,h=r,l=n,c=o;i=this.md5_ff(i,r,n,o,t[a+0],7,-680876936),o=this.md5_ff(o,i,r,n,t[a+1],12,-389564586),n=this.md5_ff(n,o,i,r,t[a+2],17,606105819),r=this.md5_ff(r,n,o,i,t[a+3],22,-1044525330),i=this.md5_ff(i,r,n,o,t[a+4],7,-176418897),o=this.md5_ff(o,i,r,n,t[a+5],12,1200080426),n=this.md5_ff(n,o,i,r,t[a+6],17,-1473231341),r=this.md5_ff(r,n,o,i,t[a+7],22,-45705983),i=this.md5_ff(i,r,n,o,t[a+8],7,1770035416),o=this.md5_ff(o,i,r,n,t[a+9],12,-1958414417),n=this.md5_ff(n,o,i,r,t[a+10],17,-42063),r=this.md5_ff(r,n,o,i,t[a+11],22,-1990404162),i=this.md5_ff(i,r,n,o,t[a+12],7,1804603682),o=this.md5_ff(o,i,r,n,t[a+13],12,-40341101),n=this.md5_ff(n,o,i,r,t[a+14],17,-1502002290),r=this.md5_ff(r,n,o,i,t[a+15],22,1236535329),i=this.md5_gg(i,r,n,o,t[a+1],5,-165796510),o=this.md5_gg(o,i,r,n,t[a+6],9,-1069501632),n=this.md5_gg(n,o,i,r,t[a+11],14,643717713),r=this.md5_gg(r,n,o,i,t[a+0],20,-373897302),i=this.md5_gg(i,r,n,o,t[a+5],5,-701558691),o=this.md5_gg(o,i,r,n,t[a+10],9,38016083),n=this.md5_gg(n,o,i,r,t[a+15],14,-660478335),r=this.md5_gg(r,n,o,i,t[a+4],20,-405537848),i=this.md5_gg(i,r,n,o,t[a+9],5,568446438),o=this.md5_gg(o,i,r,n,t[a+14],9,-1019803690),n=this.md5_gg(n,o,i,r,t[a+3],14,-187363961),r=this.md5_gg(r,n,o,i,t[a+8],20,1163531501),i=this.md5_gg(i,r,n,o,t[a+13],5,-1444681467),o=this.md5_gg(o,i,r,n,t[a+2],9,-51403784),n=this.md5_gg(n,o,i,r,t[a+7],14,1735328473),r=this.md5_gg(r,n,o,i,t[a+12],20,-1926607734),i=this.md5_hh(i,r,n,o,t[a+5],4,-378558),o=this.md5_hh(o,i,r,n,t[a+8],11,-2022574463),n=this.md5_hh(n,o,i,r,t[a+11],16,1839030562),r=this.md5_hh(r,n,o,i,t[a+14],23,-35309556),i=this.md5_hh(i,r,n,o,t[a+1],4,-1530992060),o=this.md5_hh(o,i,r,n,t[a+4],11,1272893353),n=this.md5_hh(n,o,i,r,t[a+7],16,-155497632),r=this.md5_hh(r,n,o,i,t[a+10],23,-1094730640),i=this.md5_hh(i,r,n,o,t[a+13],4,681279174),o=this.md5_hh(o,i,r,n,t[a+0],11,-358537222),n=this.md5_hh(n,o,i,r,t[a+3],16,-722521979),r=this.md5_hh(r,n,o,i,t[a+6],23,76029189),i=this.md5_hh(i,r,n,o,t[a+9],4,-640364487),o=this.md5_hh(o,i,r,n,t[a+12],11,-421815835),n=this.md5_hh(n,o,i,r,t[a+15],16,530742520),r=this.md5_hh(r,n,o,i,t[a+2],23,-995338651),i=this.md5_ii(i,r,n,o,t[a+0],6,-198630844),o=this.md5_ii(o,i,r,n,t[a+7],10,1126891415),n=this.md5_ii(n,o,i,r,t[a+14],15,-1416354905),r=this.md5_ii(r,n,o,i,t[a+5],21,-57434055),i=this.md5_ii(i,r,n,o,t[a+12],6,1700485571),o=this.md5_ii(o,i,r,n,t[a+3],10,-1894986606),n=this.md5_ii(n,o,i,r,t[a+10],15,-1051523),r=this.md5_ii(r,n,o,i,t[a+1],21,-2054922799),i=this.md5_ii(i,r,n,o,t[a+8],6,1873313359),o=this.md5_ii(o,i,r,n,t[a+15],10,-30611744),n=this.md5_ii(n,o,i,r,t[a+6],15,-1560198380),r=this.md5_ii(r,n,o,i,t[a+13],21,1309151649),i=this.md5_ii(i,r,n,o,t[a+4],6,-145523070),o=this.md5_ii(o,i,r,n,t[a+11],10,-1120210379),n=this.md5_ii(n,o,i,r,t[a+2],15,718787259),r=this.md5_ii(r,n,o,i,t[a+9],21,-343485551),i=this.safe_add(i,s),r=this.safe_add(r,h),n=this.safe_add(n,l),o=this.safe_add(o,c)}return Array(i,r,n,o)},r.prototype.md5_cmn=function(t,e,i,r,n,o){return this.safe_add(this.rol(this.safe_add(this.safe_add(e,t),this.safe_add(r,o)),n),i)},r.prototype.md5_ff=function(t,e,i,r,n,o,a){return this.md5_cmn(e&i|~e&r,t,e,n,o,a)},r.prototype.md5_gg=function(t,e,i,r,n,o,a){return this.md5_cmn(e&r|i&~r,t,e,n,o,a)},r.prototype.md5_hh=function(t,e,i,r,n,o,a){return this.md5_cmn(e^i^r,t,e,n,o,a)},r.prototype.md5_ii=function(t,e,i,r,n,o,a){return this.md5_cmn(i^(e|~r),t,e,n,o,a)},r.prototype.core_hmac_md5=function(t,e){var i=this.str2binLittle(t);16<i.length&&(i=this.core_md5(i,t.length*this.chrsz));for(var r=Array(16),n=Array(16),o=0;o<16;o++)r[o]=909522486^i[o],n[o]=1549556828^i[o];var a=this.core_md5(r.concat(this.str2binLittle(e)),512+e.length*this.chrsz);return this.core_md5(n.concat(a),640)},r.sha1ToHex=function(t){r.crypt.checkParam(t),r.crypt.checkType(t.data,"data"),r.crypt.cryptQueue.push({param:t,doCrypt:r.sha1ToHexSync})},r.sha1ToHexSync=function(t){r.crypt.checkParam(t);var e=t.data;return r.crypt.checkType(e,"data"),r.crypt.bin2hex(r.crypt.core_sha1(r.crypt.str2bin(e),e.length*r.crypt.chrsz))},r.sha1ToBase64=function(t){r.crypt.checkParam(t),r.crypt.checkType(t.data,"data"),r.crypt.cryptQueue.push({param:t,doCrypt:r.sha1ToBase64Sync})},r.sha1ToBase64Sync=function(t){r.crypt.checkParam(t);var e=t.data;return r.crypt.checkType(e,"data"),r.crypt.bin2b64(r.crypt.core_sha1(r.crypt.str2bin(e),e.length*r.crypt.chrsz))},r.hmacSha1ToHex=function(t){r.crypt.checkParam(t),r.crypt.checkType(t.data,"data"),r.crypt.checkType(t.key,"key"),r.crypt.cryptQueue.push({param:t,doCrypt:r.hmacSha1ToHexSync})},r.hmacSha1ToHexSync=function(t){r.crypt.checkParam(t);var e=t.key,i=t.data;return r.crypt.checkType(i,"data"),r.crypt.checkType(e,"key"),r.crypt.bin2hex(r.crypt.core_hmac_sha1(e,i))},r.hmacSha1ToBase64=function(t){r.crypt.checkParam(t),r.crypt.checkType(t.data,"data"),r.crypt.checkType(t.key,"key"),r.crypt.cryptQueue.push({param:t,doCrypt:r.hmacSha1ToBase64Sync})},r.hmacSha1ToBase64Sync=function(t){r.crypt.checkParam(t);var e=t.key,i=t.data;return r.crypt.checkType(i,"data"),r.crypt.checkType(e,"key"),r.crypt.bin2b64(r.crypt.core_hmac_sha1(e,i))},r.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,o=-1732584194,a=271733878,s=-1009589776,h=0;h<t.length;h+=16){for(var l=r,c=n,u=o,_=a,d=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 p=this.safe_add(this.safe_add(this.rol(r,5),this.sha1_ft(f,n,o,a)),this.safe_add(this.safe_add(s,i[f]),this.sha1_kt(f)));s=a,a=o,o=this.rol(n,30),n=r,r=p}r=this.safe_add(r,l),n=this.safe_add(n,c),o=this.safe_add(o,u),a=this.safe_add(a,_),s=this.safe_add(s,d)}return Array(r,n,o,a,s)},r.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},r.prototype.sha1_kt=function(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514},r.prototype.core_hmac_sha1=function(t,e){var i=this.str2bin(t);16<i.length&&(i=this.core_sha1(i,t.length*this.chrsz));for(var r=Array(16),n=Array(16),o=0;o<16;o++)r[o]=909522486^i[o],n[o]=1549556828^i[o];var a=this.core_sha1(r.concat(this.str2bin(e)),512+e.length*this.chrsz);return this.core_sha1(n.concat(a),672)},r.prototype.str2bin=function(t){var e=Array(),i=(1<<this.chrsz)-1;if("number"==typeof t&&(t=t.toString()),"string"==typeof t){for(var r=0;r<t.length*this.chrsz;r+=this.chrsz)e[r>>5]|=(t.charCodeAt(r/this.chrsz)&i)<<24-r%32;return e}for(var n=0;n<t.length*this.chrsz;n+=this.chrsz)e[n>>5]|=(t[n/this.chrsz]&i)<<24-n%32;return e},r.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},r.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},r.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},r.prototype.bin2b64Little=function(t){for(var e=this.bin2strLittle(t),i="",r=e.length,n=0;n<r;n+=3)for(var o=e.charCodeAt(n)<<16|(n+1<r?e.charCodeAt(n+1)<<8:0)|(n+2<r?e.charCodeAt(n+2):0),a=0;a<4;a++)8*n+6*a>8*e.length?i+=this.b64pad:i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(o>>>6*(3-a)&63);return i},r.prototype.str2binLittle=function(t){"number"==typeof t&&(t=t.toString());var e=Array();if("string"==typeof t){for(var i=0;i<8*t.length;i+=8)e[i>>5]|=(255&t.charCodeAt(i/8))<<i%32;return e}for(i=0;i<8*t.length;i+=8)e[i>>5]|=(255&t[i/8])<<i%32;return e},r.prototype.bin2strLittle=function(t){for(var e="",i=0;i<32*t.length;i+=8)e+=String.fromCharCode(t[i>>5]>>>i%32&255);return e},r.prototype.bin2hexLittle=function(t){for(var e,i=this.hexcase?"0123456789ABCDEF":"0123456789abcdef",r=this.bin2strLittle(t),n="",o=0;o<r.length;o++)e=r.charCodeAt(o),n+=i.charAt(e>>>4&15)+i.charAt(15&e);return n},r.crypt=new r,r}();BK.Crypt.md5ToHex=function(t){r.md5ToHex(t)},BK.Crypt.md5ToBase64=function(t){r.md5ToBase64(t)},BK.Crypt.hmacMd5ToHex=function(t){r.hmacMd5ToHex(t)},BK.Crypt.hmacMd5ToBase64=function(t){r.hmacMd5ToBase64(t)},BK.Crypt.sha1ToHex=function(t){r.sha1ToHex(t)},BK.Crypt.sha1ToBase64=function(t){r.sha1ToBase64(t)},BK.Crypt.hmacSha1ToHex=function(t){r.hmacSha1ToHex(t)},BK.Crypt.hmacSha1ToBase64=function(t){r.hmacSha1ToBase64(t)},BK.Crypt.md5ToHexSync=function(t){return r.md5ToHexSync(t)},BK.Crypt.md5ToBase64Sync=function(t){return r.md5ToBase64Sync(t)},BK.Crypt.hmacMd5ToHexSync=function(t){return r.hmacMd5ToHexSync(t)},BK.Crypt.hmacMd5ToBase64Sync=function(t){return r.hmacMd5ToBase64Sync(t)},BK.Crypt.sha1ToHexSync=function(t){return r.sha1ToHexSync(t)},BK.Crypt.sha1ToBase64Sync=function(t){return r.sha1ToBase64Sync(t)},BK.Crypt.hmacSha1ToHexSync=function(t){return r.hmacSha1ToHexSync(t)},BK.Crypt.hmacSha1ToBase64Sync=function(t){return r.hmacSha1ToBase64Sync(t)},t.exports=BK.Crypt},function(t,e,i){"use strict";var r,n,o,s,h,l,c,a,u,_,d,f=this&&this.__extends||(r=function(t,e){return(r=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])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),p=i(0);o=n||(n={}),s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},h={"Audio.play":"cs.audio_play.local","Audio.pause":"cs.audio_pause.local","Audio.load":"cs.audio_load.local","Audio.seek":"cs.audio_seek.local","Audio.destroy":"cs.audio_destroy.local","Audio.create":"cs.audio_create.local","Audio.onend":"cs.audio_onend.local","Audio.stop":"cs.audio_stop.local","Audio.resume":"cs.audio_effect_resume.local","NativeMethod.state":"cs.native_method_state.local","Audio.attribute.set":"cs.audio_attribute_set.local","Audio.attribute.get":"cs.audio_attribute_get.local","Audio.sys_event":"sc.audio_event.local"},l=function(){function a(t){this.callbackMap={},this.currentObjId=0,this.destroyed=!1,this.currentObjId=++a.OBJECT_ID,this.objContext=t,this.callAlive(a.NATIVE_INFO,function(t){t&&t.data&&t.data.message&&s("native method info:"+t.data.message)})}return a.prototype.getCurrentTime=function(){return Date.now()},a.prototype.setObjectId=function(t){this.currentObjId=t},a.prototype.call=function(t,e,i){this.releaseCallback();var r=this.getKey(t);this.callbackMap[this.getCallbackId()]={CALLBACK:i,LOCK:!0,CMD:h[r]},this.innerCall(h[r],e)},a.prototype.callAlive=function(t,r){var e=this.getKey(t);BK.MQQ.SsoRequest.addListener(h[e],this,function(t,e,i){r&&r({code:t,cmd:e,data:i})})},a.prototype.offAlive=function(t){var e=this.getKey(t);BK.MQQ.SsoRequest.removeListener(h[e],this.objContext)},a.prototype.callSync=function(t,e){this.releaseCallback();var i=this.getKey(t);return this.callbackMap[this.getCallbackId()]={CALLBACK:{},LOCK:!0,CMD:h[i]},this.innerCallSync(h[i],e)},a.prototype.callBack=function(t,e,i){var r=i;r.code=t;var n=r[a.N_REQUEST_SE],o=this.callbackMap[n];o?(o.CALLBACK&&"function"==typeof o.CALLBACK&&o.CALLBACK.call(this.objContext,r),o.LOCK=!1):s("no callback "+n),this.releaseCallback(),s("receive callback # "+n+" # "+e+" # "+JSON.stringify(i)+" cost "+(this.getCurrentTime()-i[a.N_R_TIME])+" ms")},a.prototype.getKey=function(t){return t},a.prototype.getCallbackId=function(){return++a.CALLBACK_ID},a.prototype.innerCall=function(t,e){e[a.N_REQUEST_SE]=a.CALLBACK_ID,e[a.N_REQUEST_O]=this.currentObjId,e[a.N_R_TIME]=this.getCurrentTime(),s("send message "+a.CALLBACK_ID+" # "+t+" # "+JSON.stringify(e));var i=this;BK.MQQ.SsoRequest.removeListener(t,this.objContext),BK.MQQ.SsoRequest.addListener(t,this.objContext,function(){i.callBack.apply(i,arguments)}),BK.MQQ.SsoRequest.send(e,t)},a.prototype.innerCallSync=function(t,e){if(e[a.N_REQUEST_SE]=a.CALLBACK_ID,e[a.N_REQUEST_O]=this.currentObjId,e[a.N_R_SYNC]=!0,e[a.N_R_TIME]=this.getCurrentTime(),s("send message sync "+a.CALLBACK_ID+" # "+t+" # "+JSON.stringify(e)),BK.MQQ.Native.syncSend)return BK.MQQ.Native.syncSend(e,t)},a.prototype.releaseCallback=function(){for(var t in this.callbackMap)t&&!this.callbackMap[t].LOCK&&delete this.callbackMap[t]},a.N_REQUEST_SE="N_R_SE",a.N_REQUEST_O="N_R_OBJ",a.CALLER="CALLER",a.CALLBACK="CALLBACK",a.NATIVE_INFO="NativeMethod.state",a.N_R_SYNC="N_R_SYNC",a.N_R_ALIVE="N_R_ALIVE",a.N_R_T="N_R_T",a.N_R_TIME="N_R_TIME",a.CALLBACK_ID=0,a.OBJECT_ID=0,a}(),c={NAME_SPACE:"MediaEvent",abort:"abort",canplay:"canplay",canplaythrough:"canplaythrough",durationchange:"durationchange",emptied:"emptied",encrypted:"encrypted",ended:"ended",error:"error",interruptbegin:"interruptbegin",interruptend:"interruptend",loadeddata:"loadeddata",loadedmetadata:"loadedmetadata",loadstart:"loadstart",mozaudioavailable:"mozaudioavailable",pause:"pause",play:"play",playing:"playing",progress:"progress",ratechange:"ratechange",seeked:"seeked",seeking:"seeking",stalled:"stalled",suspend:"suspend",timeupdate:"timeupdate",volumechange:"volumechange",waiting:"waiting",created:"created",destroyed:"destroyed"},a=function(o){function a(t){var e=o.call(this)||this;e._src="",e._volume=1,e._muted=!1,e._loop=!1,e._autoplay=!1,e._buffered={},e._controls={},e._preload=!1,e._played={},e._duration=0,e._paused=!1,e._currenTime=0,e._playing=!1,e._loaded=!1,e._loading=!1,e._playerType="normal",e._streamId=0,e._lastLeftVolume=1,e._lastRightVolume=1,e._loopCound=0,e._destroyed=!1,e._$sn=a.SN_SEED++,e.HAVE_NOTHING=0,e.HAVE_METADATA=1,e.HAVE_CURRENT_DATA=2,e.HAVE_FUTURE_DATA=3,e.HAVE_ENOUGH_DATA=4,e.readyState=0,e.nativeMethod=new l(e);var i="normal",r="";t.src&&(r=t.src),t.type&&(i=i===t.type?i:"effect"),e.create(t);var n=e;return r?n.src=r:n._src="",e}return f(a,o),a.prototype.create=function(t,e){void 0===t&&(t={}),void 0===e&&(e=!1);var i=t.type;i||(i="normal",t.type=i),t.id=GameStatusInfo.gameId,this._playerType=i,(!this.isIOSEffect()||e)&&(this.nativeMethod.callSync("Audio.create",t),this.onCreate())},a.prototype.onCanPlay=function(){this.emit("load"),this.emit("loadend"),this.emit("canplay"),this.emit("canplaythrough"),this.emit(c.loadeddata),this.emit(c.loadedmetadata),this.readyState=2},a.prototype.onPlay=function(){this.emit(c.play),this.emit(c.playing),this._playing=!0},a.prototype.onCreate=function(){this.emit(c.created)},a.prototype.onDestroy=function(){this.emit(c.destroyed),BK.Director.ticker.remove(this),this._destroyed=!0},a.prototype.onPause=function(){this.emit(c.pause),this._paused=!0,this._playing=!1},a.prototype.onEnded=function(){this.emit("ended"),this.readyState=4,this._playing=!1,BK.Director.ticker.remove(this)},a.prototype.onError=function(t){this.emit("error"),BK.Director.ticker.remove(this)},a.prototype.onSeeking=function(){this.emit(c.seeking)},a.prototype.onSeeked=function(){this.emit(c.seeked),this.emit(c.playing)},a.prototype.onTimeUpdate=function(t){this.emit(c.timeupdate,{currentTime:t})},a.prototype.onLoad=function(){this._loaded=!0,this._loading=!1,this.onCanPlay(),this.nativeMethod.callSync("Audio.duration",{})},a.prototype.onVolumeChange=function(){this.emit(c.volumechange)},a.prototype.load=function(){var e=this;this._loaded&&this.emit(c.emptied),this._loading=!0,this.emit(c.loadstart),this.nativeMethod.call("Audio.load",{},function(t){0===t.code?e.onLoad():e.onError(t.message)})},a.prototype.play=function(t){if(void 0===t&&(t={}),!this.destroyed){var r=this;if(this._playing=!0,this._paused=!1,"effect"!==this._playerType){this.autoplay=!0,this.nativeMethod.callSync("Audio.play",t),this.nativeMethod.call("Audio.onend",{},r.onEnded);var n=(new Date).getTime();BK.Director.ticker.remove(this),BK.Director.ticker.add(function(t,e){var i=(new Date).getTime();2e3<=i-n&&(r.getAttribute({currentTime:0}),n=i)},this)}else{if(this.isIOSEffect()){var e=--a.IOS_OBJ_ID;this.nativeMethod.setObjectId(e),this.create({type:this._playerType,src:this._src,loop:this._loop},!0),t.complete&&t.complete({id:a.IOS_OBJ_ID})}var i={loop:t.loopCount||(this._loop?-1:0),src:this._src,volume:this._volume,complete:t.complete?t.complete:function(t){t&&(r._streamId=t.id,0===t.code||r.onError(t.message))}};this.nativeMethod.call("Audio.play",i,i.complete)}return this.onPlay(),this._streamId}},a.prototype.pause=function(t){void 0===t&&(t={}),this.destroyed||("effect"===this._playerType&&(t.id=t.id,t.id&&0!==t.id||(delete t.id,t.auto=!0)),BK.Director.ticker.remove(this),this._paused=!0,this.nativeMethod.callSync("Audio.pause",t),this.onPause())},a.prototype.seek=function(t){var e=this;this.nativeMethod.call("Audio.seek",{seek:t},function(t){0===t.code?e.onSeeked():e.onError(t.message)}),this.onSeeking()},a.prototype.destroy=function(t){void 0===t&&(t={}),this.destroyed||("effect"===this._playerType&&t.id&&(t.id=t.id),this.nativeMethod.callSync("Audio.destroy",{id:this._$sn}),BK.Director.ticker.remove(this),u.CURRENT_NUM--,u.removeAudio(this),this.onDestroy())},a.prototype.canPlayType=function(t){return void 0===t&&(t=""),"string"!=typeof t?"":-1<"audio/mpeg".indexOf(t)||-1<"audio/mp4".indexOf(t)?"probably":""},a.prototype.stop=function(t){void 0===t&&(t={}),"effect"===this._playerType&&t.id&&(t.id=t.id),this.nativeMethod.callSync("Audio.stop",t)},a.prototype.resume=function(t){void 0===t&&(t={}),"effect"===this._playerType&&(t.id&&0!==t.id?this.isIOSEffect()&&this.nativeMethod.setObjectId(t.id):(delete t.id,t.audo=!0)),this.nativeMethod.callSync("Audio.resume",t)},a.prototype.setAttribute=function(t){this.nativeMethod.callSync("Audio.attribute.set",t)},a.prototype.getAttribute=function(t){void 0===t&&(t={});var e=this.nativeMethod.callSync("Audio.attribute.get",t);e&&!isNaN(e.duration)&&(this._duration=e.duration),e&&!isNaN(e.currentTime)&&(this._currenTime=e.currentTime,this.onTimeUpdate(e.currentTime)),e&&void 0!==e.paused&&(this._paused=e.paused)},Object.defineProperty(a.prototype,"currentTime",{get:function(){return this.getAttribute({currentTime:1}),this._currenTime},set:function(t){this.setAttribute({currentTime:t}),this.seek(t)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"duration",{get:function(){return this.getAttribute({duration:1}),this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"src",{get:function(){return this._src},set:function(t){t&&"android"===GameStatusInfo.platform&&(t=t.replace("GameSandBox://","GameRes://sandbox/")),"effect"!==this._playerType&&(this.setAttribute({src:t,autoPlay:this.autoplay,loop:this.loop}),this.load()),this._src=t},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"loop",{get:function(){return this._loop},set:function(t){"effect"!==this._playerType&&this.setAttribute({loop:t}),this._loop=t},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"autoplay",{get:function(){return this._autoplay},set:function(t){this.setAttribute({autoPlay:t}),this._autoplay=t},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"paused",{get:function(){return this.getAttribute({paused:!1}),this._paused},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"volume",{get:function(){return this._volume},set:function(t){this._muted||("effect"!==this._playerType&&(this.setAttribute({leftVolume:t,rightVolume:t,volume:t}),this.onVolumeChange()),this._lastLeftVolume=this.volume,this._lastRightVolume=this.volume,this._volume=t)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"muted",{get:function(){return this._muted},set:function(t){this._muted=t,"effect"!==this._playerType&&this.setAttribute({muted:t,leftVolume:this._lastLeftVolume,rightVolume:this._lastRightVolume})},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"buffered",{get:function(){return this._buffered},set:function(t){this._buffered=t},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"played",{get:function(){return this._played},set:function(t){this._played=t},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"preload",{get:function(){return this._preload},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"streamId",{get:function(){return this._streamId},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"type",{get:function(){return this._playerType},enumerable:!0,configurable:!0}),a.prototype.isIOSEffect=function(){return"effect"===this._playerType&&"ios"===GameStatusInfo.platform},Object.defineProperty(a.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"id",{get:function(){return this._$sn},enumerable:!0,configurable:!0}),a.SN_SEED=1,a.IOS_OBJ_ID=Math.pow(2,53)-1,a}(p),u=function(){function r(){}return r.createAudioContext=function(t){if(void 0===t&&(t={}),t.type&&"normal"!==t.type)return"effect"===t.type?(void 0===r.effect_instance||r.effect_instance.destroyed||(r.effect_instance.destroy(),r.removeAudio(r.effect_instance)),r.effect_instance=new a(t),r.audioMap.push(r.effect_instance),r.effect_instance):(s("invalid type "+t.type),new a({}));if(r.CURRENT_NUM<r.MAX_AUDIO_NUM){var e=new a(t);return r.CURRENT_NUM++,r.audioMap.push(e),e}return s("reach the max num of audio"),new a({})},r.getAudioList=function(){return r.audioMap},r.removeAudio=function(t){for(var e=-1,i=0;i<r.audioMap.length;i++)if(t.id==r.audioMap[i].id){e=i;break}-1!=e&&(r.audioMap=r.audioMap.slice(e,1))},r.MAX_AUDIO_NUM=8,r.MAX_EFFECT_NUM=3,r.CURRENT_NUM=0,r.audioMap=[],r.effectMap=[],r.CURRENT_EFFECT_NUM=0,r.effect_index=0,r}(),_=function(){function e(){this.nativeMethod=new l(this),this.nativeMethod.callAlive("Audio.sys_event",this.onEvent)}return e.prototype.onEvent=function(t){switch(void 0===t&&(t={}),(t.data||{}).event){case 1:e.AUDIO_INT_START&&"function"==typeof e.AUDIO_INT_START&&e.AUDIO_INT_START();break;case 2:e.AUDIO_INT_END&&"function"==typeof e.AUDIO_INT_END&&e.AUDIO_INT_END()}},e.newInstance=function(){e.INSTANCE||(e.INSTANCE=new e)},e.onAudioInterruptionStart=function(t){e.AUDIO_INT_START=t},e.onAudioInterruptionEnd=function(t){e.AUDIO_INT_END=t},e.pauseAllAudio=function(){for(var t=0,e=u.getAudioList();t<e.length;t++){var i=e[t];i&&!i.paused&&i.pause()}},e.resumeAllAudio=function(){for(var t=0,e=u.getAudioList();t<e.length;t++){var i=e[t];i&&("normal"===i.type?i.play():"effect"===i.type&&i.resume())}},e.destroyAllAudio=function(){for(var t=0,e=u.getAudioList();t<e.length;t++){var i=e[t];i&&i.destroy()}},e.INSTANCE=new e,e}(),d=function(){function r(t,e,i,r){void 0===i&&(i=1),void 0===r&&(r=!1),this._currentTime=0,this._volume=1,this._audioType=0,this._destroyAtComplete=!1,this._type=t,this._musicPath=e,this._loopCount=i,this._destroyAtComplete=r,BK.onEnterForeground(function(){_.resumeAllAudio()}),BK.onMaximize(function(){_.resumeAllAudio()})}return r.prototype.isEffect=function(){return 1===this._audioType},r.prototype.seekTo=function(t){this.audioObject&&this.audioObject.seek(t)},r.prototype.startMusic=function(t){if(void 0===t&&(t=function(){}),this.isEffect())(void 0===this.effectObject||this.effectObject.destroyed)&&(this.effectObject=u.createAudioContext({type:"effect",src:this._musicPath})||null),void 0!==this.effectObject&&(this.effectObject.loop=-1===this._loopCount,this.effectObject.muted=!r.switch,this.effectObject.src!==this._musicPath&&(this.effectObject.src=this._musicPath),this.effectObject.play({loopCount:this._loopCount}));else{(void 0===this.audioObject||this.audioObject.destroyed)&&(this.audioObject=u.createAudioContext({type:"normal",src:this._musicPath})||null);var e=this;void 0!==this.audioObject?(this.audioObject.muted=!r.switch,-1==this._loopCount?this._loopCount=Math.pow(2,53)-1:s("loo for "+this._loopCount),this.audioObject.on(c.loadeddata,function(){e.loopPlay(e._loopCount,t)})):s("create failed")}return this},r.prototype.loopPlay=function(e,i){if(void 0!==this.audioObject){var r=this;0<--e&&this.audioObject.on(c.ended,function t(){void 0!==r.audioObject&&(r.audioObject.off(c.ended,t),r.loopPlay(e,i))}),e<=0&&this.audioObject.on(c.ended,function t(){void 0!==r.audioObject&&(r.audioObject.off(c.ended,t),i&&i())}),this.audioObject.play()}},r.prototype.pauseMusic=function(){if(this.isEffect()){if(!this.effectObject)return void s("not init effect call play first");this.effectObject.pause()}else{if(!this.audioObject)return void s("not init audio call play first");this.audioObject.pause()}},r.prototype.resumeMusic=function(){if(this.isEffect()){if(!this.effectObject)return void s("not init effect call play first");this.effectObject.resume()}else{if(!this.audioObject)return void s("not init audio call play first");this.audioObject.play()}},r.prototype.stopMusic=function(){this.audioObject&&this.audioObject.destroy(),this.effectObject&&this.effectObject.destroy()},r.prototype.destroy=function(){this.audioObject&&this.audioObject.destroy(),this.effectObject&&this.effectObject.destroy()},Object.defineProperty(r.prototype,"volume",{set:function(t){this.audioObject?this.audioObject.volume=t:s("audio not init")},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"loopCount",{set:function(t){this.audioObject&&(this._loopCount=t)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"type",{set:function(t){this._type=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"musicPath",{set:function(t){this._musicPath=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"audioType",{get:function(){return this._audioType},set:function(t){this._audioType=t},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this.audioObject?this.audioObject.currentTime:(s("audio not init"),0)},set:function(t){this.audioObject?this.audioObject.currentTime=t:s("audio not init")},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"duration",{get:function(){return this.audioObject?this.audioObject.duration:(s("audio not init"),0)},enumerable:!0,configurable:!0}),r.playMusic=function(t,e,i){1===t?(void 0===r.effectAudioInstance&&(r.effectAudioInstance=new r(t,e,i)),r.effectAudioInstance.musicPath=e,r.effectAudioInstance.loopCount=i,r.effectAudioInstance.audioType=1,r.effectAudioInstance.startMusic()):new r(t,e,i).startMusic()},r.pauseAllBackground=function(){BK.AudioManager.pauseAllAudio()},r.resumeAllBackground=function(){BK.AudioManager.resumeAllAudio()},r.switch=!0,r}(),o.createContext=function(){return{MediaEvent:c,AudioFactory:u,NativeMethod:l,Audio2:d,AudioManager:_}},t.exports=n.createContext},function(t,e,i){"use strict";var r,n,o,a,s,h;n=r||(r={}),o=i(7),a=o.onResume,s=o.onLeave,h=function(){function e(){BK.Director.isKeepScreenOn=!1,this.initEvent()}return e.innerSetKeepScreenOn=function(t){e.isKeepScreenOnInit?(BK.QQ.uploadData("call_screen_on",GameStatusInfo.src.toString(),t?"1":"0","","",""),BK.Director.isKeepScreenOn=t):BK.Script.log(1,1,"user unset keepScreenOn,ignore the value")},e.prototype.keepScreenOn=function(t){if(!t)throw Error("param can not be undefined!");e.isKeepScreenOnInit=!0,e.userSetDeviceScreenValue=t.isKeepOn,e.innerSetKeepScreenOn(t.isKeepOn)},e.prototype.onLeave=function(){e.innerSetKeepScreenOn(!1)},e.prototype.onResume=function(){e.innerSetKeepScreenOn(!!e.isKeepScreenOnInit&&e.userSetDeviceScreenValue)},e.prototype.initEvent=function(){s(this.onLeave),a(this.onResume)},e.isKeepScreenOnInit=!1,e.userSetDeviceScreenValue=!1,e}(),n.device=new h,t.exports=r.device},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){this.taskQ=[],this.initTaskObserver()}return t.prototype.initTaskObserver=function(){0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")&&BK.Director.ticker.add(function(){for(var t=BK.TaskManager.getCompleteQueue();0<t.length;)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);var n=e.res.length;if(n!==r.taskInfo.length)BK.Console.error("task not complete");else for(var o=0;o<n;o++)e.res[o].encoding=r.taskInfo[n-1-o].encoding;r.callback(e.res);break}}}.bind(this))},t.prototype.pushTask=function(t,e,i){-1!=t&&this.taskQ.push({taskId:t,taskInfo:e,callback:i})},t.prototype.cancelTask=function(t){-1!=t&&0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")&&BK.TaskManager.cancelTask(t)},t}();e.TaskManager=r,t.exports=r},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var h=i(2),l=function(){function r(){}return r.decode=function(t,e){if(t&&e){var i=t;switch(e){case"utf8":i=t.readAsString(!0);break;case"ascii":i=r.toASCII(t.readAsString(!0));break;case"binary":i=BK.Misc.BKBufferToArrayBuffer(t);break;case"base64":i=BK.Misc.encodeBase64FromBuffer(t)}return i}return BK.Console.error("invalid source or encode "+e),null},r.toASCII=function(t){return r.ESC.lastIndex=0,r.ESC.test(t)?t.replace(r.ESC,function(t){var e=r.META[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}):t},r.ESC=/[\\\"\x00-\x1f\x7f-\uffff]/g,r.META={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},r}(),r=function(){function t(){}return t.prototype.readFile=function(n){if(0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")){if(n&&n.file){for(var t=[],e=0;e<n.file.length;e++)null!=n.file[e].path&&("utf8"===n.file[e].encoding&&(n.file[e].encoding="utf-8"),t.push({path:n.file[e].path,encoding:null==n.file[e].encoding?"binary":n.file[e].encoding}));var i=BK.FileUtil.addReadIOTask(t);BK.taskManager.pushTask(i,t,function(t){for(var e=0;e<t.length;e++)if(t[e].data){var i=t[e].data;if(i)switch(t[e].encoding){case"ascii":var r={data:l.decode(BK.FileUtil.readFile(t[e].path),"ascii"),errcode:0,path:t[e].path,errmsg:t[e].errmsg,encoding:"ascii"};t[e]=r;break;case"binary":t[e].data=BK.Misc.BKBufferToArrayBuffer(i);break;default:"utf-8"===t[e].encoding&&(t[e].encoding="utf8"),t[e].data=i.readAsString(!0)}else BK.Console.error("raw is invalid")}n.success&&n.success(t),n.complete&&n.complete()})}}else{var r=[];if(n&&n.file)for(e=0;e<n.file.length;e++){var o=n.file[e];if(o.path){var a=BK.FileUtil.readFile(o.path),s=l.decode(a,o.encoding||"binary");r.push({errcode:s?0:-1,errmsg:s?"":"read failed!",path:o.path,data:s})}}n.success&&n.success(r),n.complete&&n.complete()}},t.prototype.writeFile=function(e){if(0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")){if(e&&e.file){for(var t=[],i=0;i<e.file.length;i++)null!=e.file[i].path&&e.file[i].data&&t.push({path:e.file[i].path,encoding:null==e.file[i].encoding?"binary":e.file[i].encoding,data:h.arrayBufferToBKBuffer(e.file[i].data)});var r=BK.FileUtil.addWriteIOTask(t);BK.taskManager.pushTask(r,t,function(t){e.success&&e.success(t),e.complete&&e.complete()})}}else{var n=[];if(e&&e.file)for(i=0;i<e.file.length;i++){var o=e.file[i];if(o.path){var a=h.arrayBufferToBKBuffer(o.data),s=BK.FileUtil.writeBufferToFile(o.path,a);n.push({errcode:s?0:-1,errmsg:s?"":"write failed!",path:o.path})}}e.success&&e.success(n),e.complete&&e.complete()}},t.prototype.zip=function(e){if(0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")){if(e&&e.file){for(var t=[],i=0;i<e.file.length;i++)e.file[i].path&&e.file[i].zipPath&&t.push({path:e.file[i].path,zipPath:e.file[i].zipPath});var r=BK.FileUtil.addZipIOTask(t);BK.taskManager.pushTask(r,t,function(t){e.success&&e.success(t),e.complete&&e.complete()})}}else{var n=[];if(e&&e.file)for(i=0;i<e.file.length;i++){var o=e.file[i];if(o.path&&o.zipPath){var a=BK.FileUtil.zip(o.path,o.zipPath);n.push({errcode:a?0:-1,errmsg:a?"":"zip failed!",path:o.path,zipPath:o.zipPath})}}e.success&&e.success(n),e.complete&&e.complete()}},t.prototype.unzip=function(e){if(0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")){if(e&&e.file){for(var t=[],i=0;i<e.file.length;i++)e.file[i].path&&e.file[i].zipPath&&t.push({path:e.file[i].path,zipPath:e.file[i].zipPath});var r=BK.FileUtil.addUnzipIOTask(t);BK.taskManager.pushTask(r,t,function(t){e.success&&e.success(t),e.complete&&e.complete()})}}else{var n=[];if(e&&e.file)for(i=0;i<e.file.length;i++){var o=e.file[i];if(o.path&&o.zipPath){var a=BK.FileUtil.unzip(o.zipPath,o.path);n.push({errcode:a?0:-1,errmsg:a?"":"unzip failed!",path:o.path,zipPath:o.zipPath})}}e.success&&e.success(n),e.complete&&e.complete()}},t.prototype.readFileSync=function(t,e){return l.decode(BK.FileUtil.readFile(t),e||"binary")},t.prototype.writeFileSync=function(t,e){if(e instanceof String||"string"==typeof e)BK.FileUtil.writeFile(t,e);else{var i=h.arrayBufferToBKBuffer(e);BK.FileUtil.writeBufferToFile(t,i)}},t.prototype.zipSync=function(t,e){BK.FileUtil.zip(t,e)},t.prototype.unzipSync=function(t,e){BK.FileUtil.unzip(t,e)},t.prototype.makeDirSync=function(t){BK.FileUtil.makeDir(t)},t.prototype.unlinkSync=function(t){return BK.FileUtil.deleteFile(t)},t.prototype.copyFileSync=function(t,e){if(0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0"))BK.FileUtil.copyFile(t,e);else{var i=BK.FileUtil.readFile(t);i&&BK.FileUtil.writeBufferToFile(e,i)}},t.prototype.accessSync=function(t){return BK.FileUtil.isFileExist(t)},t.prototype.isDirectory=function(t){return BK.FileUtil.isDirectory(t)},t.prototype.getFileInfoSync=function(t){return BK.FileUtil.getFileInfo(t)},t.prototype.readDir=function(i){return BK.FileUtil.getFileList(i,function(t,e){0==t?i.success&&i.success({files:e.files}):i.fail&&i.fail({msg:e.errMsg,errcode:t}),i.complete&&i.complete()})},t}();e.FileSystem=r,BK.FileUtil.readFileAsync=function(){return null},BK.FileUtil.removeFromCache=function(){return null},t.exports=r},function(t,e,i){"use strict";var l=[[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]],n=i(8).QRCodeModel,g=i(8).QRErrorCorrectLevel;var r=function(){function p(){BK.Director.ticker.add(function(t,e){if(0!==p.taskQueue.length){var i=p.taskQueue[0];p.taskQueue.splice(0,1);var r=!1;try{p.makeQRCodeToFileSync(i)}catch(t){if(r=!0,!i.fail)throw t;i.fail({msg:t.message})}r||i.success&&i.success({path:i.path}),i.complete&&i.complete()}})}return p.createQRModel=function(t,e){var i,r=new n(function(t,e){for(var i=1,r=(s=t,(h=encodeURI(s).toString().replace(/\%[0-9a-fA-F]{2}/g,"a")).length+(h.length!=s?3:0)),n=0,o=l.length;n<o;n++){var a=0;switch(e){case g.L:a=l[n][0];break;case g.M:a=l[n][1];break;case g.Q:a=l[n][2];break;case g.H:a=l[n][3]}if(r<=a)break;i++}var s,h;if(l.length<i)throw new Error("Too long data");return i}(t,(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).correctLevel),i.correctLevel);return r.addData(t),r.make(),r},p.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:g.H}:e;for(var r=new BK.Canvas(i.width,i.height),n=p.createQRModel(t,e),o=n.getModuleCount(),a=i.width/o,s=i.height/o,h=Math.round(a),l=Math.round(s),c=0;c<o;c++)for(var u=0;u<o;u++){var _=n.isDark(c,u),d=u*a,f=c*s;r.lineWidth=1,r.fillColor=_?i.colorDark:i.colorLight,r.drawStyle=0,r.fillRect(d,f,a,s),r.strokeColor=_?i.colorDark:i.colorLight,r.strokeRect(Math.ceil(d)-.5,Math.ceil(f)-.5,h,l),r.strokeRect(Math.ceil(d)+.5,Math.ceil(f)+.5,h,l)}return r},p.createQRCodeToFile=function(t,e,i){if(!t)throw new Error("path can not be undefined!");if(!e)throw new Error("content can not be undefined!");i||(i={});var r=i.width,n=void 0===r?256:r,o=i.height,a=void 0===o?256:o,s=i.colorDark,h=void 0===s?{r:0,g:0,b:0,a:1}:s,l=i.colorLight,c=void 0===l?{r:1,g:1,b:1,a:1}:l,u=i.correctLevel,_=void 0===u?g.H:u,d=p.createQRCodeNode(e,{width:n,height:a,colorDark:h,colorLight:c,correctLevel:_});d.saveTo(t),d.dispose()},p.makeQRCodeToFileSync=function(t){if(!t)throw new Error("param can not be undefined!");var e=t.path,i=t.content,r=t.config;if(!e)throw new Error("path can not be undefined!");if(0!==e.indexOf("GameSandBox://"))throw new Error("path must start with GameSandBox://");this.createQRCodeToFile(e,i,r)},p.makeQRCodeToFile=function(t){p.taskQueue.push(t)},p.compose=function(t,e){var i=BK.Director.screenPixelSize.width,r=BK.Director.screenPixelSize.height,n=new BK.Canvas(i,r);n.drawImage(t,0,0),n.drawImage(e,0,0),n.saveTo("GameSandBox://compose.png"),n.dispose()},p.taskQueue=new Array,p.instance=new p,p}();"undefined"!=typeof BK&&(BK.QRErrorCorrectLevel=g),t.exports=r},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=i(27),r=function(){function t(t){if(this._storageType=t,this._kv={},this._bytes=2,this._url="default",(this.length=0)===this._storageType&&BK.getStorageData){var e=BK.getStorageData(GameStatusInfo.gameId);if(!e)return;var i=null;try{i=JSON.parse(e)}catch(t){throw this.flush(),BK.Script.log(1,1,"parse string failed, storage load failed!"),BK.Script.log(1,1,"parse string failed,data:"+e),Error("parse string failed!"+t)}this._bytes=e.length,this._kv=i,this.length=Object.keys(this._kv).length}}return t.prototype.key=function(t){return t>=this.length?null:Object.keys(this._kv)[t]},t.prototype.getItem=function(t){return this._kv[t]},t.prototype.setItem=function(t,e){var i,r=e.length,n=0;if(this._kv[t]&&(n=JSON.stringify(this._kv[t]).length),!((i=r-n)<0||i+this._bytes<4194304))throw BK.Script.log(1,1,"Storage setItem failed, item bytes is too large!"),Error("Storage setItem failed, item bytes is too large");var o=this._kv[t];this._kv[t]=e,this.length=Object.keys(this._kv).length,this.flush(),BK.storageEventListener.dispatchEvent("storage",new a(t,o,e,this._url,this))},t.prototype.removeItem=function(t){delete this._kv[t],this.length=Object.keys(this._kv).length,this.flush()},t.prototype.clear=function(){this._kv={},this.length=Object.keys(this._kv).length,this.flush()},t.prototype.flush=function(){var t=JSON.stringify(this._kv);this._bytes=t.length,0===this._storageType&&BK.setStorageData&&BK.setStorageData(t,GameStatusInfo.gameId)},t.prototype.bindUrl=function(t){t!==this._url&&""!==t&&(this._url=t)},t}();function n(t,e){if(e){if("length"===(e=e.toString()))return t[e];if("_kv"===e||"_storageType"===e)return t.getItem(e);for(var i=["setItem","getItem","removeItem","key","clear"],r=0;r<i.length;r++)if(e===i[r])return t[e].bind(t);return t.getItem(e)}}function o(t,e,i){if(e&&i)if(e=e.toString(),i=i.toString(),"length"!==e)if("_kv"!==e&&"_storageType"!==e){for(var r=["setItem","getItem","removeItem","key","clear"],n=0;n<r.length;n++)if(e===r[n])return t[e].bind(t);t.setItem(e,i)}else t.setItem(e,i);else BK.Script.log(1,0,"property "+e+" readOnly")}e.BKStorage=r;var s={get:e.getProperty=n,set:e.setProperty=o};function h(t){if("android"===GameStatusInfo.platform)return BK.Script.log(1,0,"Proxy create "),new Proxy(new r(t),s);var e=GameStatusInfo.osVersion.split(".");return 0<e.length&&9<Number(e[0])?(BK.Script.log(1,0,"Proxy create "),new Proxy(new r(t),s)):BK.Proxy?(BK.Script.log(1,0,"BK.Proxy create "),new BK.Proxy(new r(t),o,n)):{}}t.exports={localStorage:h(0),sessionStorage:h(1)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t,e,i,r,n){this.key=t,this.oldValue=e,this.newValue=i,this.url=r,this.storageArea=n};e.BKStorageEvent=r,t.exports=r},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(0),n=function(){function t(){this.storageEmitter=new r}return t.prototype.addEventListener=function(t,e){this.storageEmitter.on(t,e)},t.prototype.removeEventListener=function(t,e){this.storageEmitter.off(t,e)},t.prototype.dispatchEvent=function(t,e){this.storageEmitter.emit(t,e)},t}();e.BKStorageEventLisener=n,t.exports=new n},function(t,e,i){"use strict";var r=function(){function t(t){this.paused=!1,this.delayUnits=1/30,this.tmpPlayingIdx=0,this.previousTs=-1,this.playedCount=0,this.currDisplayIdx=0,this.currTexturePath="",this.currDisplaySum=0,this.repeatCount=0,this.stoped=!1,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.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.onInit=function(t,e){this.createSprites(t,e);var i=Object.getOwnPropertyNames(this.__nativeObj),r=this;i.forEach(function(t){var e=t;Object.defineProperty(r,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.displayFrame=function(t){if(0<this.textureInfoArr.length){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,o=e.frameInfo.spriteSourceSize.y,a=e.frameInfo.spriteSourceSize.w,s=e.frameInfo.spriteSourceSize.h,h=e.frameInfo.sourceSize,l=this.__nativeObj.contentSize;n=l.width*n/h.w,o=l.height*o/h.h,a=l.width*a/h.w,s=l.height*s/h.h,this.contentSprite.position={x:n,y:o},this.contentSprite.contentSize={width:a,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.doPlay=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.doStop=function(t){this.stoped=!0,void 0===t&&(t=-1),this.paused=!0,-1<t&&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),0<this.repeatCount&&this.repeatCount<=this.playedCount&&(this.endCallback&&this.endCallback(this,this.playedCount),this.stop()))},t.prototype.setCompleteCallback=function(i){this.completeCallback=function(t,e){i({animationSprite:t,count:e})}},t.prototype.setEndCallback=function(i){this.endCallback=function(t,e){i({animationSprite:t,count:e})}},t.prototype.play=function(t){t?this.doPlay(t.beginFrameIndex,t.repeatCount):this.doPlay()},t.prototype.stop=function(t){this.doStop(t)},t.prototype.setPosition=function(t){if(!t)throw new Error("position can not be undefined!");if("number"!=typeof t.x)throw new Error("position.x must be a number!");if("number"!=typeof t.y)throw new Error("position.y must be a number!");this.position=t},t.prototype.setSize=function(t){if(!t)throw new Error("size can not be undefined!");if("number"!=typeof t.width)throw new Error("size.width must be a number!");if("number"!=typeof t.height)throw new Error("size.height must be a number!");this.size=t},t.prototype.setAnchor=function(t){if(!t)throw new Error("anchor can not be undefined!");if("number"!=typeof t.x)throw new Error("anchor.x must be a number!");if("number"!=typeof t.y)throw new Error("anchor.y must be a number!");this.anchor=t},t.prototype.setFrameDuration=function(t){if("number"!=typeof t)throw new Error("duration must be a number!");this.delayUnits=t},t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.stoped?BK.Script.log(1,1,"animationSprite is stopped,can't continue!"):this.paused=!1},t}();t.exports=r},function(t,e,i){"use strict";var r=function(){function t(t){if(this.flipU=0,this.flipV=1,this.stretchX=1,this.stretchY=1,this.size={width:0,height:0},this.currTexturePath="",!t)throw Error("initParam can not be undefined!");if(!t.textureInfo)throw Error("initParam.textureInfo can not be undefined!");t.flipU&&(this.flipU=t.flipU),t.flipV&&(this.flipV=t.flipV),t.stretchX&&(this.stretchX=t.stretchX),t.stretchY&&(this.stretchY=t.stretchY),t.width&&(this.size.width=t.width),t.height&&(this.size.height=t.height),this.textureInfo=t.textureInfo,this.onInit(this.size.width,this.size.height),this.adjustWithTextureInfo(t.textureInfo)}return t.prototype.onInit=function(t,e){this.createSprites({width:t,height:e});var i=this;Object.getOwnPropertyNames(this.__nativeObj).forEach(function(t){var e=t;Object.defineProperty(i,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,o=t.frameInfo.sourceSize,a=this.__nativeObj.contentSize;e=a.width*e/o.w,i=a.height*i/o.h,r=a.width*r/o.w,n=a.height*n/o.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){var e=(this.textureInfo=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){if(!t)throw Error("size can not be undefined!");if("number"!=typeof t.width)throw Error("size.width must be a number!");if("number"!=typeof t.height)throw Error("size.height must be a number!");this.__nativeObj=new BK.SpriteNode(t.width,t.height,{},this.flipU,this.flipV,this.stretchX,this.stretchY),this.contentSprite=new BK.SpriteNode(t.width,t.height,{},this.flipU,this.flipV,this.stretchX,this.stretchY),this.__nativeObj.addChild(this.contentSprite)},t}();t.exports=r},function(t,e,i){"use strict";var r,n;(n=r||(r={}))[n.mirrorRepeat=0]="mirrorRepeat",n[n.repeatToEdge=1]="repeatToEdge",n[n.selfRepeat=2]="selfRepeat";var o=function(){function t(){this.fullWidth=0,this.fullHeight=0,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 o=0;o<r.length;o++){var a=r[o];if(t==a.filename){var s={x:0,y:1,width:0,height:0},h=a.rotated,l=a.trimmed,c=a.spriteSourceSize,u=a.sourceSize;return s.height=(s.width=(s.y=h?(s.x=a.frame.x,this.fullHeight-a.frame.y-a.frame.w):(s.x=a.frame.x,this.fullHeight-a.frame.y-a.frame.h),a.frame.w),a.frame.h),c.y=u.h-c.y-c.h,u.width=u.w,u.height=u.h,c.width=c.w,c.height=c.h,{filename:t,frame:s,rotated:h,trimmed:l,spriteSourceSize:c,sourceSize:u}}}}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.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.getTextureInfoByFilename=function(t){var e=this.getFrameInfoByFilename(t),i=this.getTexturePathByFilename(t);return e&&i?{frameInfo:e,texturePath:i,texture:this.getTextureByFilename(t)}:null},t.prototype.loadSet=function(t){if(!t)throw Error("loadSetParam can not be undefined!");var e=t.jsonPath,i=t.texturePath,r=t.format,n=t.minFilter,o=t.magFilter,a=t.uWrap,s=t.vWrap,h=BK.FileUtil.readFile(e).readAsString();if(h){var l=JSON.parse(h);void 0===i&&(i=e.replace(/.json$/,".png")),this.jsonConfigs[i]=l,void 0===r&&(r=4),r=4,void 0===n&&(n=1),void 0===o&&(o=1),void 0===a&&(a=1),void 0===s&&(s=1);var c=new BK.Texture(i,r,n,o,a,s);this.sheets[i]=c}else BK.Script.log(0,0,"loadSheet Failed.Please check path")},t.prototype.removeSet=function(t){if(this.jsonConfigs[t])for(var e in this.jsonConfigs)if(this.jsonConfigs.hasOwnProperty(e)){var i=this.jsonConfigs[e];e==t&&(delete this.jsonConfigs[t],BK.Script.log(0,0,"Delete jsonConfigs key:"+e+" val:"+i))}if(this.sheets[t])for(var e in this.sheets)this.sheets.hasOwnProperty(e)&&(i=this.sheets[e],e==t&&(delete this.sheets[t],BK.Script.log(0,0,"Delete sheets key:"+e+" val:"+i)))},t.prototype.getSprite=function(t){if(!t)throw Error("spriteInfo can not be undefined!");var e=t.filename,i=t.width,r=t.height,n=this.getTextureInfoByFilename(e);if(n){var o,a=n.frameInfo,s=n.texturePath,h=new BK.Texture(s);return i||(i=a.frame.width),r||(r=a.frame.height),BK.Script.log(0,0,"getSprite texture:"+h+" width:"+i+" height:"+r),a.trimmed?o=new BK.SpriteSet({textureInfo:n,width:i,height:r}):((o=new BK.Sprite(i,r,h,0,1,1,1)).adjustTexturePosition(a.frame.x,a.frame.y,a.frame.width,a.frame.height,a.rotated),o)}return null},t.prototype.createSpriteSet=function(t){if(!t)throw Error("spriteInfo can not be undefined!");var e=t.filename,i=t.width,r=t.height,n=this.getTextureInfoByFilename(e);if(n){var o=n.frameInfo,a=n.texturePath,s=new BK.Texture(a);return i||(i=o.frame.width),r||(r=o.frame.height),BK.Script.log(0,0,"SheetSprite texture:"+s+" width:"+i+" height:"+r),new BK.SpriteSet({textureInfo:n,width:i,height:r})}return null},t}();BK&&(BK.RepeatMode=r),t.exports=new o},function(t,e,i){"use strict";var r=function(){function t(t){if(!t)throw Error("initParam can not be undefined!");if(!t.texture)throw Error("initParam.texture can not be undefined!");var e=t.textureWidth,i=t.textureHeight,r=t.texture,n=t.grid,o=t.offset,a=t.rotated;this._size={width:0,height:0},this.__nativeObj=new BK.Node,this.onInit(),i||(i=r.size.height),e||(e=r.size.width),n?this._grid=n:(this._grid={left:0,top:0,right:0,bottom:0},n=this._grid),o||(o={x:0,y:0}),this._size={width:i,height:i},this._leftTop=new BK.Sprite(n.left,n.top,r,0,1,1,1),this._leftTop.position={x:0,y:i-n.top},this._leftTop.zOrder=99999,this._leftTop.name="_leftTop",this.__nativeObj.addChild(this._leftTop),this._centerTop=new BK.Sprite(e-n.left-n.right,n.top,r,0,1,1,1),this._centerTop.position={x:n.left,y:i-n.top},this._centerTop.zOrder=99999,this._centerTop.name="_centerTop",this.__nativeObj.addChild(this._centerTop),this._rightTop=new BK.Sprite(n.right,n.top,r,0,1,1,1),this._rightTop.position={x:e-n.right,y:i-n.top},this._rightTop.zOrder=99999,this._rightTop.name="_rightTop",this.__nativeObj.addChild(this._rightTop),this._leftCenter=new BK.Sprite(n.left,i-n.top-n.bottom,r,0,1,1,1),this._leftCenter.position={x:0,y:n.bottom},this._leftCenter.name="_leftCenter",this.__nativeObj.addChild(this._leftCenter),this._centerCenter=new BK.Sprite(e-n.left-n.right,i-n.top-n.bottom,r,0,1,1,1),this._centerCenter.position={x:n.left,y:n.bottom},this._centerCenter.name="_centerCenter",this.__nativeObj.addChild(this._centerCenter),this._rightCenter=new BK.Sprite(n.right,i-n.bottom-n.top,r,0,1,1,1),this._rightCenter.position={x:e-n.right,y:n.bottom},this._rightCenter.name="_rightCenter",this.__nativeObj.addChild(this._rightCenter),this._leftBottom=new BK.Sprite(n.left,n.bottom,r,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(e-n.left-n.right,n.bottom,r,0,1,1,1),this._centerBottom.position={x:n.left,y:0},this._centerBottom.name="_centerBottom",this.__nativeObj.addChild(this._centerBottom),this._rightBottom=new BK.Sprite(n.right,n.bottom,r,0,1,1,1),this._rightBottom.position={x:e-n.right,y:0},this._rightBottom.name="_rightBottom",this.__nativeObj.addChild(this._rightBottom),1==a?(this._leftTop.adjustTexturePosition(o.x+(i-n.top),o.y+(e-n.left),n.left,n.top,a),this._centerTop.adjustTexturePosition(o.x+(i-n.top),o.y+n.right,e-n.left-n.right,n.top,a),this._rightTop.adjustTexturePosition(o.x+(i-n.top),o.y,n.right,n.top,a),this._leftCenter.adjustTexturePosition(o.x+n.bottom,o.y+(e-n.left),n.left,i-n.top-n.bottom,a),this._centerCenter.adjustTexturePosition(o.x+n.bottom,o.y+n.right,e-n.left-n.right,i-n.top-n.bottom,a),this._rightCenter.adjustTexturePosition(o.x+n.bottom,o.y,n.right,i-n.bottom-n.top,a),this._leftBottom.adjustTexturePosition(o.x,o.y+(e-n.left),n.left,n.bottom,a),this._centerBottom.adjustTexturePosition(o.x,o.y+n.right,e-n.left-n.right,n.bottom,a),this._rightBottom.adjustTexturePosition(o.x,o.y,n.right,n.bottom,a)):(this._leftTop.adjustTexturePosition(0+o.x,i-n.top+o.y,n.left,n.top),this._centerTop.adjustTexturePosition(n.left+o.x,i-n.top+o.y,e-n.left-n.right,n.top),this._rightTop.adjustTexturePosition(e-n.right+o.x,i-n.top+o.y,n.right,n.top),this._leftCenter.adjustTexturePosition(0+o.x,n.bottom+o.y,n.left,i-n.top-n.bottom),this._centerCenter.adjustTexturePosition(n.left+o.x,n.bottom+o.y,e-n.left-n.right,i-n.top-n.bottom),this._rightCenter.adjustTexturePosition(e-n.right+o.x,n.bottom+o.y,n.right,i-n.bottom-n.top),this._leftBottom.adjustTexturePosition(0+o.x,0+o.y,n.left,n.bottom),this._centerBottom.adjustTexturePosition(n.left+o.x,0+o.y,e-n.left-n.right,n.bottom),this._rightBottom.adjustTexturePosition(e-n.right+o.x,0+o.y,n.right,n.bottom))}return t.prototype.onInit=function(){var t=Object.getOwnPropertyNames(this.__nativeObj),i=this;t.forEach(function(t){var e=t;"size"!=e&&Object.defineProperty(i,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this)},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.prototype.setSize=function(t){if(!t)throw Error("size can not be undefined!");if("number"!=typeof t.width)throw Error("size.width must be a number!");if("number"!=typeof t.height)throw Error("size.height must be a number!");this.size=t},t.prototype.setPosition=function(t){if(!t)throw Error("position can not be undefined!");if("number"!=typeof t.x)throw Error("position.x must be a number!");if("number"!=typeof t.y)throw Error("position.y must be a number!");this.position=t},t}();Object.defineProperty(r.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(r.prototype,"size",{get:function(){return this._size},set:function(t){var e=(this._size=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.exports=r},function(t,e,i){"use strict";var r,n,o,a,s,h,l,c=this&&this.__extends||(r=function(t,e){return(r=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])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});o=n||(n={}),a=i(0),s=i(34),h=new(function(e){function t(){var t=e.call(this)||this;return BK.SsoRequest.on(s.CMSHOW_CS_CMD_LOAD_PERCENTAGE_NOTIFY,t.onLoadPackagePercentage.bind(t)),t._subPackagesInfo=void 0,t}return c(t,e),t.prototype.setSubPackageInfo=function(t){this._subPackagesInfo=t},t.prototype.getEntryMainPath=function(t){this._subPackagesInfo||(this._subPackagesInfo=this.subPackageDataReadConfig());for(var e=0;e<this._subPackagesInfo.length;e++){var i=this._subPackagesInfo[e];if(i.name===t)return"GameRes://"+i.root+"/main.js"}},t.prototype.subPackageDataReadConfig=function(){if(this._subPackagesInfo)return this._subPackagesInfo;var t=BK.FileUtil.readFile("GameRes://gameConfig.json");if(t){var e=JSON.parse(t.readAsString(!0));return e&&e.subpackages?(this._subPackagesInfo=e.subpackages,e.subpackages):void 0}},t.prototype.checkPackage=function(r){var t={xyId:GameStatusInfo.gameId,packName:r.packageName},e=s.CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK;BK.SsoRequest.request({data:t,reqCmd:e,success:function(t){t.code,t.cmd;var e=t.data;r.success&&r.success(e)},fail:function(t){var e=t.code;if(t.cmd,t.data,r.fail){var i={name:r.packageName,code:e,msg:"failed"};r.fail(i)}},complete:function(){r.complete&&r.complete()}})},t.prototype.downloadPackage=function(i){var t={xyId:GameStatusInfo.gameId,packName:i},e=s.CMSHOW_CS_CMD_LOAD_PACKAGE;BK.SsoRequest.request({data:t,reqCmd:e,success:function(t){if(t.data.packName){var e="download_finish_"+t.data.packName;this.emit(e,t.data.result)}}.bind(this),fail:function(t){if(t.data.packName){var e="download_finish_"+t.data.packName;this.emit(e,t.code)}else e=i,this.emit(e,t.code)},complete:function(){}})},t.prototype._innserLoadLibFunc=function(t){return t.Script.loadlib},t.prototype.loadPackage=function(t){var e=this.getEntryMainPath(t);return!!e&&!!BK.fileSystem.accessSync(e)&&(BK.Script.innerLoadLib(e),!0)},t.prototype.onLoadPackagePercentage=function(t){if(t.data.packName){var e="percentage_"+t.data.packName;this.emit(e,t.data.percentage)}},t.prototype.onLoadPackageFinish=function(t,e,i){if(i.packName){var r="download_finish_"+i.packName;this.emit(r,i.result)}},t}(a)),l=function(){function t(t){this.packName=t}return t.prototype.onProgressUpdate=function(t){h.on("percentage_"+this.packName,t)},t}(),o.loadSubpackage=function(e){var t=new l(e.name);if(!GameStatusInfo||"xcode"===GameStatusInfo.devPlatform){var i={name:e.name,code:-1,msg:"develop environment no support!"};return e.complete&&e.complete(),e.fail&&e.fail(i),BK.Script.log(1,1,"bk.qq.loadpackage xcode demo."),t}var r=GameStatusInfo.QQVer.split(".");return Number(r[0])<7||7==Number(r[0])&&Number(r[1])<7||7==Number(r[0])&&7==Number(r[1])&&Number(r[2])<5?(BK.Script.log(1,0,"775 \u4ee5\u4e0b\u624bq \u7248\u672c"),i={name:e.name,code:-2,msg:"current qq no support subpackage feature!Upgrade to QQ 7.7.5"},e.complete&&e.complete(),e.fail&&e.fail(i)):h.subPackageDataReadConfig()?(e.complete&&e.complete(),h.downloadPackage(e.name),h.on("download_finish_"+e.name,function(t){h.checkPackage({packageName:e.name,success:function(){if(h.loadPackage(e.name),e.success)try{e.success({name:e.name})}catch(t){BK.Console.log("ERROR:"+t)}},fail:function(){var t={name:e.name,code:-4,msg:"load subpackge failed.correctness failed"};if(e.fail)try{e.fail(t)}catch(t){BK.Console.log("ERROR:"+t)}}})})):(i={name:e.name,code:-3,msg:"gameConfig.json can not find configure!"},e.complete&&e.complete(),e.fail&&e.fail(i)),t},t.exports=n.loadSubpackage},function(t,e,i){},function(t,e,i){"use strict";BK.Texture.createTextures=function(n){if(!n)return BK.Script.log(1,1,"object.file is null"),n.fail&&n.fail({errmsg:"object.file is null"}),void(n.complete&&n.complete());if(n&&n.file){for(var t=[],e=0;e<n.file.length;e++)n.file[e].path&&t.push({path:n.file[e].path,format:n.file[e].format?n.file[e].format:6});BK.Image.loadImages({file:t,success:function(t){for(var e=0;e<t.length;e++)if(0==t[e].errcode){var i=t[e].image,r=null;(r=0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")?BK.Texture.createBitmapTexture(i.width,i.height,i.format,t[e].path):BK.Texture.createBitmapTexture(i.width,i.height,i.format))?(r.uploadData(i.buffer),t[e].texture=r):(t[e].errcode=-2,t[e].errmsg="createTexture null, failed"),delete t[e].image}else t[e].errcode=-3,t[e].errmsg="createImage null, failed";n.success&&n.success(t),n.complete&&n.complete()},fail:function(t){n.fail&&n.fail(t),n.complete&&n.complete()}})}else n.fail&&n.fail({errmsg:"object.file is null"}),n.complete&&n.complete()},t.exports=BK.Texture},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=i(2);BK.ImageNativeClass=BK.Image;var r=function(){function t(){}return t.dispose=function(t){return BK.ImageNativeClass.dispose(t)},t.saveImage=function(t,e,i,r,n,o){return t instanceof ArrayBuffer?t=a.arrayBufferToBKBuffer(t):t instanceof Object&&void 0===e&&(e=t.width,i=t.height,r=t.path,n=t.ext,o=t.isFlipY?t.isFlipY:0),BK.ImageNativeClass.saveImage(t,e,i,r,n,o)},t.loadImageWithBase64=function(t){if(!t)return BK.Script.log(1,0,"buffer is empty"),null;if(t.buffer&&(t=t.buffer),t instanceof ArrayBuffer&&(t=a.arrayBufferToBKBuffer(t)),t.readAsString&&(t=t.readAsString()),t){var e=t.indexOf("data:image"),i=t.indexOf("base64,");0==e&&0<i&&(t=t.substring(i+"base64,".length,t.length-1)),BK.Script.log(1,1,"loadImageWithBase64 "+t);var r=BK.Misc.decodeBase64FromString(t);return BK.ImageNativeClass.loadImage(r)}return null},t.loadImage=function(t,e){if(t)return t.image&&(e=t.format?t.format:void 0),t instanceof ArrayBuffer&&(t=a.arrayBufferToBKBuffer(t)),e?BK.ImageNativeClass.loadImage(t,e):BK.ImageNativeClass.loadImage(t);BK.Script.log(1,1,"BK.Image.loadImage failed! ")},t.loadImages=function(e){if(!e)return BK.Script.log(1,1,"object.file is null"),e.fail&&e.fail({errmsg:"object.file is null"}),void(e.complete&&e.complete());if(0==BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0"))if(e&&e.file){for(var t=new Array,i=0;i<e.file.length;i++)e.file[i].path&&t.push({tag:3,path:e.file[i].path,format:e.file[i].format?e.file[i].format:6});var r=BK.ImageNativeClass.loadImageAsync(t);BK.taskManager.pushTask(r,t,function(t){e.success&&e.success(t),e.complete&&e.complete()})}else e.fail&&e.fail({errmsg:"object.file is null"}),e.complete&&e.complete();else{var n=[];if(e&&e.file)for(i=0;i<e.file.length;i++){var o=e.file[i];if(o.path){var a=BK.ImageNativeClass.loadImage(o.path,e.file[i].format?e.file[i].format:6);n.push({errcode:a?0:-1,errmsg:a?"":"load image failed!",path:o.path,image:a})}}e.success&&e.success(n),e.complete&&e.complete()}},t}();t.exports=r},function(t,e,i){"use strict";var r=function(){function t(t){this.taskId=-1,this.opt=t}return t.prototype._requestOpen=function(t){if(!t||!t.url)throw Error("Url is null or undefined!");var e;t.transparent,e=t.transparent&&1==t.transparent?1:0;var i=1;t.orientation&&(i=t.orientation);var r={gameOrientation:i,openId:GameStatusInfo.openId,transparent:e,businessType:2,url:t.url};BK.SsoRequest.request({data:r,reqCmd:"cs.openWebViewWithoutUrl.local",success:function(t){BK.Console.log("requestOpen! success ",t.code,t.cmd,JSON.stringify(t.data)),this.taskId=t.data.taskId}.bind(this),fail:function(t){var e=t.code,i=t.cmd,r=t.data;BK.Console.log("requestOpen! fail",e,i,JSON.stringify(r))},complete:function(){BK.Console.log("requestOpen! complete")}})},t.prototype._prepareReceive=function(){var t;t="ios"==GameStatusInfo.platform?"sc.catchPeopleWebMessage.local":"sc.apolloGameWebMessage.local",BK.SsoRequest.on(t,function(t){this.receiveCallback&&this.receiveCallback(t.code,t.data)}.bind(this))},t.prototype.onReceiveMsg=function(t){this.receiveCallback=t},t.prototype.send=function(t){t.taskId=this.taskId,BK.SsoRequest.request({data:t,reqCmd:"cs.apolloGameTargetWebMessage.local",success:function(t){BK.Console.log("send! success ",t.code,t.cmd,JSON.stringify(t.data))}.bind(this),fail:function(t){var e=t.code,i=t.cmd,r=t.data;BK.Console.log("send! fail",e,i,JSON.stringify(r))},complete:function(){BK.Console.log("send! complete")}})},t.prototype.open=function(){this._requestOpen(this.opt),this._prepareReceive()},t.prototype.close=function(){var t={taskId:this.taskId};BK.SsoRequest.request({data:t,reqCmd:"cs.closeWebViewWithoutUrl.local",success:function(t){BK.Console.log("close! success ",t.code,t.cmd,JSON.stringify(t.data))}.bind(this),fail:function(t){var e=t.code,i=t.cmd,r=t.data;BK.Console.log("close! fail",e,i,JSON.stringify(r))},complete:function(){BK.Console.log("send! complete")}})},t}();t.exports=function(t){return new r(t)}},function(t,e,l){"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),function(t){function e(t){try{var e="cs.share_game_result.local",i={cmd:e,from:GameStatusInfo.platform,roomId:GameStatusInfo.roomId,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,gameVersion:GameStatusInfo.gameVersion,title:t.title?t.title:"\u8f7b\u6e38\u620f",summary:t.summary?t.summary:"\u4e00\u8d77\u6765\u73a9\u6e38\u620f\u5427~",picUrl:"",detailUrl:t.msgUrl?t.msgUrl:""};if(BK.isBrowser)return t.qqImgUrl&&(i.picUrl=t.qqImgUrl),void BK.SsoRequest.request({reqCmd:e,data:i});t.qqImgUrl?(i.picUrl=t.qqImgUrl,BK.SsoRequest.request({reqCmd:e,data:i})):o({title:t.title?t.title:"\u8f7b\u6e38\u620f",subTitle:t.summary?t.summary:"\u4e00\u8d77\u6765\u73a9\u6e38\u620f\u5427~"},{reqCmd:e,data:i},2)}catch(e){t.fail&&t.fail({code:-1,msg:JSON.stringify(e)}),t.complete&&t.complete()}}function i(e){try{e.range?BK.Screenshot.shot({path:"GameSandBox://screenshot.png",range:e.range,isUpload:!0,success:function(t){BK.Share.share({qqImgUrl:t.path,socialPicPath:"GameSandBox://screenshot.png",title:e.title?e.title:"\u8f7b\u6e38\u620f",summary:e.summary?e.summary:"\u4e00\u8d77\u6765\u73a9\u6e38\u620f\u5427~",extendInfo:e.extendInfo?e.extendInfo:"",success:function(t){e.success&&e.success(t),e.complete&&e.complete()},fail:function(t){e.fail&&e.fail(t),e.complete&&e.complete()}})},fail:function(t){e.fail&&e.fail(t),e.complete&&e.complete()}}):(e.fail&&e.fail({code:-1,msg:"fail to shot, need range"}),e.complete&&e.complete())}catch(t){e.fail&&e.fail({code:-1,msg:JSON.stringify(t)}),e.complete&&e.complete()}}function r(t){try{var e="cs.share_game_in_ark.local",i=t.success?"sc.share_game_to_friend_result.local":e;BK.isBrowser&&"android"===GameStatusInfo.platform&&0===GameStatusInfo.QQVer.indexOf("7.6.0")&&(e="cs.game_shell_share_callback.local"),s({cmd:e,gameId:GameStatusInfo.gameId,roomId:GameStatusInfo.roomId,gameMode:GameStatusInfo.gameMode,isSelectFriend:t.isToFriend?1:0,summary:t.summary?t.summary:"\u4e00\u8d77\u6765\u73a9\u6e38\u620f\u5427~",extendInfo:t.extendInfo?t.extendInfo:"",picUrl:t.qqImgUrl},e,i,t)}catch(e){t.fail&&t.fail({code:-1,msg:JSON.stringify(e)}),t.complete&&t.complete()}}function s(t,e,i,r){BK.SsoRequest.request({data:t,reqCmd:e,respCmd:i,success:function(t){var e=t.code,i=(t.cmd,t.data);r.success&&(n(0===e?0:1),r.success({code:e,data:i}))},fail:function(t){var e=t.code,i=(t.cmd,t.data);r.fail&&(n(0===e?0:1),r.fail({code:e,msg:i}))},complete:function(){r.complete&&r.complete()}})}function n(t){var e=t.toString();BK.QQ.uploadData("clickShowOffButton","",e,"","","")}function o(i,r,n){var o="";function a(t){var e=BK.Image.loadImage(t);if(e){var i=e.height,r=e.width;if(Math.abs(i/r-304/540)<.01)return t}return""}l(6).request({url:"http://i.hudongcdn.com/"+GameStatusInfo.gameId+"/sp_main_16_9.480.jpg",method:"GET",success:function(t){BK.fileSystem.writeFileSync("GameSandBox://shareImg-"+GameStatusInfo.gameId+".jpg",t.arrayBuffer()),BK.SsoRequest.request({data:{gameId:[GameStatusInfo.gameId]},reqCmd:"apollo_game_info.get_base_info",respCmd:"apollo_game_info.get_base_info",success:function(t){if(BK.Image.loadImage("GameSandBox://shareImg-"+GameStatusInfo.gameId+".jpg")){var e="GameSandBox://shareImg-"+GameStatusInfo.gameId+".jpg";o=a(e)}else o=a("GameRes://inviteIcon.png");t.data&&t.data.data&&(i.title=t.data.data.gameList[0].name),1===n?(r.reqData.localPicPath=h(i,o),s(r.reqData,r.reqCmd,r.respCmd,r.options)):(r.data.picUrl=h(i,o),BK.SsoRequest.request({reqCmd:r.reqCmd,data:r.data}))},fail:function(t){if(BK.Image.loadImage("GameSandBox://shareImg-"+GameStatusInfo.gameId+".jpg")){var e="GameSandBox://shareImg-"+GameStatusInfo.gameId+".jpg";o=a(e)}else o=a("GameRes://inviteIcon.png");1===n?(r.reqData.localPicPath=h(i,o),s(r.reqData,r.reqCmd,r.respCmd,r.options)):(r.data.picUrl=h(i,o),BK.SsoRequest.request({reqCmd:r.reqCmd,data:r.data}))}})},fail:function(t){BK.SsoRequest.request({data:{gameId:[GameStatusInfo.gameId]},reqCmd:"apollo_game_info.get_base_info",success:function(t){o=a("GameRes://inviteIcon.png"),t.data&&t.data.data&&(i.title=t.data.data.gameList[0].name),1===n?(r.reqData.localPicPath=h(i,o),s(r.reqData,r.reqCmd,r.respCmd,r.options)):(r.data.picUrl=h(i,o),BK.SsoRequest.request({reqCmd:r.reqCmd,data:r.data}))},fail:function(){o=a("GameRes://inviteIcon.png"),1===n?(r.reqData.localPicPath=h(i,o),s(r.reqData,r.reqCmd,r.respCmd,r.options)):(r.data.picUrl=h(i,o),BK.SsoRequest.request({reqCmd:r.reqCmd,data:r.data}))}})}})}function h(t,e){var i=t.title,r=t.subTitle,n=new BK.Canvas(750,750);if(n.fillColor={r:1,g:1,b:1,a:1},n.fillRect(0,0,750,750),BK.FileUtil.isFileExist("GameRes://share_logo.png")&&n.drawImage("GameRes://share_logo.png",0,0,125,28,32,32,126,27),!BK.FileUtil.isFileExist(e))return"";var o=BK.Image.loadImage(e);o&&n.drawImage(e,0,0,o.width,o.height,0,330,750,420),n.fillColor={r:0,g:0,b:0,a:1},n.drawStyle=0,n.setTextAlign(1),n.setTextSize(40),n.textBaseLine="bottom",n.textAlign="left",n.fillText(i,35,258),n.fillColor={r:137/255,g:137/255,b:137/255,a:.5},n.drawStyle=0,n.setTextAlign(1),n.setTextSize(30),n.textBaseLine="bottom",n.textAlign="left",n.fillText(r,35,215),n.fillColor={r:1,g:1,b:1,a:1};var a="http://cmshow.qq.com/apollo/html/game-platform/scan-game.html?gameId="+GameStatusInfo.gameId.toString()+"&src=203";return BK.QRCode.makeQRCodeToFileSync({path:"GameSandBox://qrcode.png",content:a,config:{width:256,height:256,colorDark:{r:0,g:0,b:0,a:1},colorLight:{r:1,g:1,b:1,a:1},correctLevel:2}}),n.drawImage("GameSandBox://qrcode.png",0,0,256,256,600,64,120,120),n.fillColor={r:0,g:0,b:0,a:1},n.drawStyle=0,n.setTextAlign(1),n.setTextSize(19),n.textBaseLine="bottom",n.textAlign="left",n.fillText("\u957f\u6309\u626b\u7801\u5373\u73a9",600,28),n.saveTo("GameSandBox://compose.png"),n.dispose(),"GameSandBox://compose.png"}t.shareLink=e,t.shareShot=i,t.share=function(t){void 0!==t.msgUrl?e(t):void 0!==t.range?i(t):void 0!==t.isToFriend?r(t):function(t,e){for(var i=GameStatusInfo.QQVer.split("."),r="7.6.3".split("."),n=Math.min(3,Math.min(i.length,r.length)),o=0;o<n;o++)if(i[o]>r[o])return!1;return!0}()?r(t):function(t){try{var e="cs.game_shell_share_callback.local",i=t.success?"sc.share_game_to_friend_result.local":e,r={gameName:t.title?t.title:"\u8f7b\u6e38\u620f",summary:t.summary?t.summary:"\u4e00\u8d77\u6765\u73a9\u6e38\u620f\u5427~",extendInfo:t.extendInfo?t.extendInfo:"",localPicPath:"",picUrl:t.qqImgUrl,activityId:0,reqCode:1,inner:1};if(BK.isBrowser)return t.socialPicPath&&(r.localPicPath=t.socialPicPath),s(r,e,i,t);t.socialPicPath?(r.localPicPath=t.socialPicPath,s(r,e,i,t)):o({title:t.title?t.title:"\u8f7b\u6e38\u620f",subTitle:t.summary?t.summary:"\u4e00\u8d77\u6765\u73a9\u6e38\u620f\u5427~"},{reqData:r,reqCmd:e,respCmd:i,options:t},1)}catch(e){t.fail&&t.fail({code:-1,msg:JSON.stringify(e)}),t.complete&&t.complete()}}(t)}}(i=e.Share||(e.Share={})),t.exports=i},function(t,e,i){"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),(r=e.Upload||(e.Upload={})).upload=function(o){try{!function(t,i){if(BK.isBrowser){var e="cs.get_file_data.local",r={cmd:e,path:t};BK.SsoRequest.request({data:r,reqCmd:e,respCmd:e,success:function(t){t.code,t.cmd;var e=function(t){var e,i,r,n,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=.75*t.length,h=t.length,l=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var c=new ArrayBuffer(s),u=new Uint8Array(c);for(e=0;e<h;e+=4)i=a.indexOf(t[e]),r=a.indexOf(t[e+1]),n=a.indexOf(t[e+2]),o=a.indexOf(t[e+3]),u[l++]=i<<2|r>>4,u[l++]=(15&r)<<4|n>>2,u[l++]=(3&n)<<6|63&o;return u}(t.data);i(0,e)},fail:function(t){t.code,t.cmd,t.data,i()},complete:function(){}})}else{var n=BK.FileUtil.readFile(t);i(0,n)}}(o.path,function(t,i){var r,e,n;i&&0<i.length?(r=function(t,e){0===t&&e?function(t,e,n){for(var i=1024<t.length?1024:t.length,r=new Uint8Array(i),o=0;o<i/2;o++)r[o]=t.readUint8Buffer();for(t.jumpBytes(t.length-i),o=i/2;o<i;o++)r[o]=t.readUint8Buffer();t.rewind();var a=new Date,s=a.getFullYear().toString()+(a.getMonth()+1<10?"0"+(a.getMonth()+1):""+a.getMonth()+1)+(a.getDate()<10?"0"+a.getDate():""+a.getDate())+(a.getHours()<10?"0"+a.getHours():""+a.getHours())+(a.getMinutes()<10?"0"+a.getMinutes():""+a.getMinutes()),h=e.signTime,l=e.tmpSecretId,c=e.sessionToken,u="/"+GameStatusInfo.gameId+"_"+BK.Crypt.md5ToHexSync({data:function(t){for(var e=[],i=0;i<t.byteLength;i++)e[i]=t[i];return e}(r)})+"_"+s+".png",_=e.upLoadPrefUrl.replace(new RegExp("http://","gm"),""),d=e.downloadUrl,f=e.signature,p="put\n"+u+"\n\nhost="+_+"&x-cos-storage-class=nearline\n",g="sha1\n"+h+"\n"+BK.Crypt.sha1ToHexSync({data:p})+"\n",m="q-sign-algorithm=sha1&q-ak="+l+"&q-sign-time="+h+"&q-key-time="+h+"&q-header-list=host;x-cos-storage-class&q-url-param-list=&q-signature="+BK.Crypt.hmacSha1ToHexSync({key:f,data:g}),v=new BK.HttpUtil("https://"+_+u,"put");v.setHttpHeader("host",_),v.setHttpHeader("x-cos-storage-class","nearline"),v.setHttpHeader("x-cos-security-token",c),v.setHttpHeader("authorization",m),v.setHttpRawBody(t),v.requestAsync(function(t,e){var i,r;i=d+u,r=n,200===e?r.success&&r.success({code:0,url:i}):r.fail&&r.fail({code:-1,msg:"fail to upload"}),r.complete&&r.complete()})}(i,e,o):(o.fail&&o.fail({code:-1,msg:"fail to fetch signature"}),o.complete&&o.complete())},n={cmd:e="cs.fetch_cloud_signature.local",now:(new Date).getTime()/1e3-1,delta:600},BK.SsoRequest.request({data:n,reqCmd:e,respCmd:e,success:function(t){var e=t.code,i=(t.cmd,t.data);r(e,i)},fail:function(t){var e=t.code,i=(t.cmd,t.data);r(e,i)},complete:function(){}})):(o.fail&&o.fail({code:-1,msg:"fail to get file data "+o.path}),o.complete&&o.complete())})}catch(t){o.fail&&o.fail({code:-1,msg:JSON.stringify(t)}),o.complete&&o.complete()}},t.exports=r},function(t,e,i){"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),function(t){var y;function r(t){(void 0===t.x||t.x<0||t.x>BK.Director.screenPixelSize.width)&&(t.x=0),(void 0===t.y||t.y<0||t.y>BK.Director.screenPixelSize.height)&&(t.y=0),(void 0===t.width||t.width<=0||t.width>BK.Director.screenPixelSize.width-t.x)&&(t.x=0,t.width=BK.Director.screenPixelSize.width),(void 0===t.height||t.height<=0||t.height>BK.Director.screenPixelSize.height-t.y)&&(t.y=0,t.height=BK.Director.screenPixelSize.height)}function e(e){try{if(r(e.range),BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.6.1")){var t=function(t,e,i,r,n){var o=y.glCreateTexture();y.glActiveTexture(y.TEXTURE1),y.glBindTexture(y.TEXTURE_2D,o),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.LINEAR),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.LINEAR),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),y.glTexImage2D(y.TEXTURE_2D,0,y.RGBA,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height,0,y.RGBA,y.UNSIGNED_BYTE,new Int8Array(0));var a=y.glGetParameterInt(y.FRAMEBUFFER_BINDING,1),s=y.glGetParameterInt(y.RENDERBUFFER_BINDING,1),h=y.glCreateRenderbuffer();y.glBindRenderbuffer(y.RENDERBUFFER,h),y.glRenderbufferStorage(y.RENDERBUFFER,35056,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height),y.glBindRenderbuffer(y.RENDERBUFFER,s);var l,c=y.glCreateFramebuffer();y.glBindFramebuffer(y.FRAMEBUFFER,c),y.glFramebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,o,0),y.glFramebufferRenderbuffer(y.FRAMEBUFFER,y.DEPTH_ATTACHMENT,y.RENDERBUFFER,h),y.glFramebufferRenderbuffer(y.FRAMEBUFFER,y.STENCIL_ATTACHMENT,y.RENDERBUFFER,h);var u=y.glCheckFramebufferStatus(y.FRAMEBUFFER);return u==y.FRAMEBUFFER_COMPLETE?(BK.Render.render(t,0),l=new BK.Buffer(r*n*4),y.glReadPixels(e,i,r,n,y.RGBA,y.UNSIGNED_BYTE,l)):BK.Console.log("Error: _compacibilityShot! framebuffer failed, code = "+u),y.glBindFramebuffer(y.FRAMEBUFFER,a),y.glDeleteTexture(o),y.glDeleteRenderbuffer(h),y.glDeleteFramebuffer(c),l}(BK.Director.root,e.range.x,e.range.y,e.range.width,e.range.height);t?(o(t,e),n(e)):(e.fail&&e.fail({code:-1,msg:"Error: fail to _compacibilityShot! framebuffer failed"}),e.complete&&e.complete())}else{var i=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(BK.Director.root,i),i.writeToDiskWithXY(e.path,e.range.x,e.range.y,e.range.width,e.range.height),n(e)}}catch(t){e.fail&&e.fail({code:-1,msg:JSON.stringify(t)}),e.complete&&e.complete()}}function i(e){BK.Notification.on("frame_final",BK.Screenshot.shotGL,function(){try{r(e.range),(y=new BK.WebGL).DEPTH_BUFFER_BIT=256,y.STENCIL_BUFFER_BIT=1024,y.COLOR_BUFFER_BIT=16384,y.TRIANGLES=4,y.TEXTURE_BINDING_2D=32873,y.ARRAY_BUFFER=34962,y.ARRAY_BUFFER_BINDING=34964,y.ELEMENT_ARRAY_BUFFER=34963,y.ELEMENT_ARRAY_BUFFER_BINDING=34965,y.STATIC_DRAW=35044,y.UNSIGNED_BYTE=5121,y.UNSIGNED_SHORT=5123,y.FLOAT=5126,y.RGBA=6408,y.FRAGMENT_SHADER=35632,y.VERTEX_SHADER=35633,y.LINK_STATUS=35714,y.CURRENT_PROGRAM=35725,y.NEAREST=9728,y.LINEAR=9729,y.TEXTURE_MAG_FILTER=10240,y.TEXTURE_MIN_FILTER=10241,y.TEXTURE_WRAP_S=10242,y.TEXTURE_WRAP_T=10243,y.TEXTURE_2D=3553,y.TEXTURE0=33984,y.TEXTURE1=33985,y.ACTIVE_TEXTURE=34016,y.REPEAT=10497,y.CLAMP_TO_EDGE=33071,y.MIRRORED_REPEAT=33648,y.FRAMEBUFFER=36160,y.RENDERBUFFER=36161,y.COLOR_ATTACHMENT0=36064,y.DEPTH_ATTACHMENT=36096,y.STENCIL_ATTACHMENT=36128,y.NONE=0,y.FRAMEBUFFER_COMPLETE=36053,y.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054,y.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055,y.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057,y.FRAMEBUFFER_UNSUPPORTED=36061,y.FRAMEBUFFER_BINDING=36006,y.RENDERBUFFER_BINDING=36007,y.INVALID_FRAMEBUFFER_OPERATION=1286;var t=new BK.Buffer(e.range.height*e.range.width*4);y.glReadPixels(e.range.x,e.range.y,e.range.width,e.range.height,y.RGBA,y.UNSIGNED_BYTE,t),o(t,e),n(e)}catch(t){e.fail&&e.fail({code:-1,msg:JSON.stringify(t)}),e.complete&&e.complete()}}.bind(BK.Screenshot.shotGL),!0)}function n(r){BK.FileUtil.isFileExist(r.path)?r.isUpload?BK.Upload.upload({path:r.path,success:function(t){var e=t.code,i=t.url;r.success&&r.success({code:e,path:i}),r.complete&&r.complete()},fail:function(t){var e=t.code,i=t.msg;r.fail&&r.fail({code:e,msg:i}),r.complete&&r.complete()}}):(r.success&&r.success({code:0,path:r.path}),r.complete&&r.complete()):(r.fail&&r.fail({code:-1,msg:"Error: fail to shot, no such file or directory "+r.path}),r.complete&&r.complete())}function o(t,e){var i=e.path,r=e.range,n=i.substr(0,i.lastIndexOf(".")),o=i.substr(i.lastIndexOf(".")+1);BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.6.1")?(t=function(t){var e=function(){var t=y.glCreateShader(y.VERTEX_SHADER);0!=t&&(y.glShaderSource(t,"attribute vec2 pos; attribute vec2 inUVs; varying lowp vec2 outUVs; void main() { gl_Position = vec4(pos, 0, 1); outUVs = inUVs; }"),y.glCompileShader(t));var e=y.glCreateShader(y.FRAGMENT_SHADER);0!=e&&(y.glShaderSource(e,"varying lowp vec2 outUVs; uniform sampler2D uSampler; void main() { gl_FragColor = texture2D(uSampler, outUVs); }"),y.glCompileShader(e));var i=y.glCreateProgram();return y.glAttachShader(i,t),y.glAttachShader(i,e),y.glLinkProgram(i),y.glDeleteShader(t),y.glDeleteShader(e),i}();y.glUseProgram(e);var i=y.glGetAttribLocation(e,"pos"),r=y.glGetAttribLocation(e,"inUVs"),n=y.glGetUniformLocation(e,"uSampler");y.glActiveTexture(y.TEXTURE0);var o=y.glCreateTexture(),a=y.glGetParameterInt(y.TEXTURE_BINDING_2D,1);y.glBindTexture(y.TEXTURE_2D,o),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.LINEAR),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.LINEAR),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),y.glTexImage2D(y.TEXTURE_2D,0,y.RGBA,y.RGBA,y.UNSIGNED_BYTE,t.buffer),y.glUniform1i(n,0);var s=y.glGetParameterInt(y.ARRAY_BUFFER_BINDING,1),h=y.glGetParameterInt(y.ELEMENT_ARRAY_BUFFER_BINDING,1),l=new Float32Array([-1,-1,0,1,1,-1,1,1,1,1,1,0,-1,1,0,0]),c=y.glCreateBuffer();y.glBindBuffer(y.ARRAY_BUFFER,c),y.glEnableVertexAttribArray(i),y.glVertexAttribPointer(i,2,y.FLOAT,!1,16,0),y.glVertexAttribPointer(r,2,y.FLOAT,!1,16,8),y.glBufferData(y.ARRAY_BUFFER,BK.Misc.typedArrayToBKBuffer(l),y.STATIC_DRAW);var u=new Uint16Array([0,1,2,0,2,3]),_=y.glCreateBuffer();y.glBindBuffer(y.ELEMENT_ARRAY_BUFFER,_),y.glBufferData(y.ELEMENT_ARRAY_BUFFER,BK.Misc.typedArrayToBKBuffer(u),y.STATIC_DRAW);var d=new BK.Buffer(t.width*t.height*4),f=y.glGetParameterInt(y.FRAMEBUFFER_BINDING,1),p=function(t,e){y.glActiveTexture(y.TEXTURE1);var i=y.glCreateTexture(),r=y.glGetParameterInt(y.TEXTURE_BINDING_2D,1);y.glBindTexture(y.TEXTURE_2D,i),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.LINEAR),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.LINEAR),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),y.glTexParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),y.glTexImage2D(y.TEXTURE_2D,0,y.RGBA,t,e,0,y.RGBA,y.UNSIGNED_BYTE,new Int8Array(0));var n=y.glCreateFramebuffer();y.glBindFramebuffer(y.FRAMEBUFFER,n),y.glFramebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,i,0);var o=y.glCheckFramebufferStatus(y.FRAMEBUFFER);return o!=y.FRAMEBUFFER_COMPLETE&&BK.Console.log("Error: _createFramebuffer! failed, status = "+o),y.glActiveTexture(y.TEXTURE1),y.glBindTexture(y.TEXTURE_2D,r),{tex:i,fbo:n}}(t.width,t.height);y.glClearColor(1,1,1,1),y.glClear(y.COLOR_BUFFER_BIT|y.DEPTH_BUFFER_BIT|y.STENCIL_BUFFER_BIT),y.glDrawElements(y.TRIANGLES,6,y.UNSIGNED_SHORT,0),y.glReadPixels(0,0,t.width,t.height,y.RGBA,y.UNSIGNED_BYTE,d),y.glBindFramebuffer(y.FRAMEBUFFER,f);for(var g=0,m=0,v=0,S=0,b=1;b<=10;b++)if(y.glUseProgram(b),m=y.glGetAttribLocation(b,"Position"),v=y.glGetAttribLocation(b,"SourceColor"),S=y.glGetAttribLocation(b,"TexCoordIn"),-1!=m&&-1!=v&&-1!=S){g=1;break}return y.glBindBuffer(y.ARRAY_BUFFER,s),1==g?(y.glEnableVertexAttribArray(m),y.glEnableVertexAttribArray(v),y.glEnableVertexAttribArray(S),y.glVertexAttribPointer(m,3,y.FLOAT,!1,36,0),y.glVertexAttribPointer(v,4,y.FLOAT,!1,36,12),y.glVertexAttribPointer(S,2,y.FLOAT,!1,36,28)):(y.glEnableVertexAttribArray(0),y.glEnableVertexAttribArray(1),y.glEnableVertexAttribArray(2),y.glVertexAttribPointer(0,3,y.FLOAT,!1,36,0),y.glVertexAttribPointer(1,4,y.FLOAT,!1,36,12),y.glVertexAttribPointer(2,2,y.FLOAT,!1,36,28)),y.glBindBuffer(y.ELEMENT_ARRAY_BUFFER,h),y.glActiveTexture(y.TEXTURE0),y.glBindTexture(y.TEXTURE_2D,a),y.glDeleteProgram(e),y.glDeleteTexture(o),y.glDeleteTexture(p.tex),y.glDeleteFramebuffer(p.fbo),d}({buffer:t,width:r.width,height:r.height}),BK.Image.saveImage(t,r.width,r.height,n,o)):BK.Image.saveImage(t,r.width,r.height,n,o,1)}t.shot=function(t){BK.isBrowser?i(t):e(t)},t.shotBK=e,t.shotGL=i}(r=e.Screenshot||(e.Screenshot={})),t.exports=r},function(t,e,i){"use strict";var r,n,a=this&&this.__extends||(r=function(t,e){return(r=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])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),s=i(0);!function(t){var o=["succeed","internal error","frequency error","network error","invalid request","no ad fill","server error","formet mismatch","h5 game nonsupport"],r=function(e){function t(){var t=e.call(this)||this;return t.eventQueue=[],t}return a(t,e),t._bannerId=function(){return this.incBannerId||(this.incBannerId=0),this.incBannerId++,this.incBannerId},t.prototype.reEmit=function(t){for(var e=-1,i=0;i<this.eventQueue.length;i++){var r=this.eventQueue[i];if(r.name===t){if(!0===r.hasOwnProperty("info")){var n=r.info;this.emit(t,n)}else this.emit(t);e=i}}-1<e&&this.eventQueue.splice(e)},t.prototype.saveEvent=function(t,e){var i={name:t};e&&(i.info=e),this.eventQueue.push(i)},t}(s),e=function(i){function t(t){var e=i.call(this)||this;return e.ssoCMD={LOAD_REQ:"cs.game_ad_banner_load.local",LOAD_RESP:"sc.game_ad_banner_load.local",SHOW_REQ:"cs.game_ad_banner_show.local",HIDE_REQ:"cs.game_ad_banner_hide.local",RESIZE_REQ:"cs.game_ad_banner_resize.local",RESIZE_RESP:"sc.game_ad_banner_resize.local",CLOSE_REQ:"cs.game_ad_banner_close.local"},e.hasShow=!1,e.hasHide=!1,e.param=t,e.bannerId=r._bannerId(),e.param.viewId||(e.param.viewId=1001),e.eventCallBack={load:void 0,error:void 0},e.useNative=!1,e.param.viewId&&1003==e.param.viewId&&(e.useNative=!0),e.needAutoShow=!1,e.isLoadSucc=!1,e.eventQueue=[],e.fetch(function(t,e){if(BK.isBrowser&&"android"===GameStatusInfo.platform&&e.errCode&&(t=e.errCode),0==t)this.isLoadSucc=!0,0==this.emit("load")&&this.saveEvent("load",void 0),1==this.needAutoShow&&this.show();else{var i="unknown error",r=t;e.errCode&&(r=e.errCode),r<o.length&&(i=o[r]);var n={msg:i,code:r};0==this.emit("error",n)&&this.saveEvent("error",n)}}.bind(e)),e}return a(t,i),t.prototype.log=function(t){BK.Script.log(1,1,"BannerAd:"+t)},t.prototype.show=function(){this.hasShow?this.log("show error.can't show twice!"):1!=this.hasHide?1==this.isLoadSucc?(this.hasShow=!0,this.hasHide=!1,this.useNative?this._ssoShow():this._innerGameBanner?1001==this.param.viewId?this._innerGameBanner.show(function(t,e,i){BK.Script.log(1,1,"show static inner banner succCode"+t+" msg:"+e)}):1002==this.param.viewId&&this._innerGameBanner.showAnimate(function(t,e,i){BK.Script.log(1,1,"show animate banner succCode"+t+" msg:"+e)}):BK.Script.log(1,1,"show inner banner failed. handle is undefined")):this.needAutoShow=!0:this._setHidden(!1)},t.prototype.hide=function(){1!=this.hasHide?this._setHidden(!0):this.log("hide error.can't hide twice!")},t.prototype._setHidden=function(t){1==t?this.useNative?this._ssoHide():this._innerGameBanner?this._innerGameBanner.setHidden(!0):BK.Script.log(1,1,"hide inner banner failed. handle is undefined"):this.useNative?this._ssoShow():this._innerGameBanner?this._innerGameBanner.setHidden(!1):BK.Script.log(1,1,"hide inner banner failed. handle is undefined"),this.hasShow=!t,this.hasHide=t},t.prototype.destory=function(){this.useNative?this._ssoClose():this._innerGameBanner?this._innerGameBanner.close():BK.Script.log(1,1,"close inner banner failed. handle is undefined")},t.prototype.onError=function(t){this.on("error",t),this.reEmit("error")},t.prototype.offError=function(t){this.off("error",t)},t.prototype.onLoad=function(t){this.on("load",t),this.reEmit("load")},t.prototype.offLoad=function(t){this.off("load",t)},t.prototype.fetch=function(r){this.useNative?this._ssoLoad(r):BK.isBrowser?r(8,o[8]):BK.Advertisement.fetchBannerAd(function(t,e,i){0==t?this._innerGameBanner=i:BK.Script.log(1,1,"fetchBannerAd failed. retCode:"+t+"msg:"+e),r(t,e)}.bind(this))},t.prototype._sendSso=function(r){BK.MQQ.SsoRequest.send(r.reqData,r.reqCmd),r.respCmd&&BK.MQQ.SsoRequest.addListener(r.respCmd,this,function(t,e,i){void 0!==i&&void 0!==i.bannerId&&r.callback&&this.bannerId==i.bannerId&&r.callback(t,i)}.bind(this))},t.prototype._ssoLoad=function(t){var e=1001;this.param.viewId&&(e=this.param.viewId),this._sendSso({reqCmd:this.ssoCMD.LOAD_REQ,reqData:{bannerId:this.bannerId,viewId:e},respCmd:this.ssoCMD.LOAD_RESP,callback:t})},t.prototype._ssoShow=function(){this._sendSso({reqCmd:this.ssoCMD.SHOW_REQ,reqData:{bannerId:this.bannerId,style:this.param.style}})},t.prototype._ssoClose=function(){this._sendSso({reqCmd:this.ssoCMD.CLOSE_REQ,reqData:{bannerId:this.bannerId}})},t.prototype._ssoHide=function(){this._sendSso({reqCmd:this.ssoCMD.HIDE_REQ,reqData:{bannerId:this.bannerId}})},t}(t.AdBase=r);t.BannerAd=e,t.createBannerAd=function(t){return new e(t)};var i=function(e){function t(){var t=e.call(this)||this;return t.autoShow=!1,BK.Advertisement.fetchVideoAd(1,function(t,e,i){0==t?(0==this.emit("load")&&this.saveEvent("load",void 0),i.setEventCallack(function(t,e){this.emit("close_game")}.bind(this),function(t,e){this.emit("play_finish")}.bind(this),function(t,e){0==t?this.emit("video_close"):this.emit("error",{msg:"close error",code:-1})}.bind(this),function(t,e){0==t&&this.emit("play_start")}.bind(this)),this.handle=i,1==this.autoShow&&this.handle.jump()):0==this.emit("error",{msg:e,code:t})&&this.saveEvent("error",{msg:e,code:t})}.bind(t)),t}return a(t,e),t.prototype.show=function(){this.handle?this.handle.jump():this.autoShow=!0},t.prototype.onPlayStart=function(t){this.on("play_start",t)},t.prototype.offPlayStart=function(t){this.off("play_start",t)},t.prototype.onPlayFinish=function(t){this.on("play_finish",t)},t.prototype.offPlayFinish=function(t){this.off("play_finish",t)},t.prototype.onLoad=function(t){this.on("load",t),this.reEmit("load")},t.prototype.offLoad=function(t){this.off("load",t)},t.prototype.onError=function(t){this.on("error",t),this.reEmit("error")},t.prototype.offError=function(t){this.off("error",t)},t.prototype.onClose=function(t){this.on("video_close",t)},t.prototype.offClose=function(t){this.off("video_close",t)},t}(r);t.createVideoAd=function(){return new i}}(n||(n={})),t.exports={createBannerAd:n.createBannerAd,createVideoAd:n.createVideoAd}},function(t,e,i){"use strict";t.exports={getSystemInfoSync:function(){return GameStatusInfo}}},function(t,e,i){"use strict";var r=i(44);t.exports={queryAvatarAndNickCanvas:function(t){r.instance.queryAvatarAndNickCanvas(t)},queryNickCanvas:function(t){r.instance.queryNickCanvas(t)},queryAvatarCanvas:function(t){r.instance.queryAvatarCanvas(t)}}},function(t,e,i){"use strict";var n=i(45),o=i(46),r=function(){function s(){this.pending=new Array,this.isQuerying=!1,this.counter=0}return s.getInstance=function(){return s.instance},s.prototype.queryNickCanvas=function(e){s.instance.isQuerying?s.instance.pending.push({type:0,params:e}):(s.instance.isQuerying=!0,s.instance.counter=1,BK.MQQ.Account.preloadUserInfoList(e.openIds,function(t){0==t&&s.instance._makeNickCanvas(e)}))},s.prototype.queryAvatarCanvas=function(e){s.instance.isQuerying?s.instance.pending.push({type:1,params:e}):(s.instance.isQuerying=!0,s.instance.counter=1,BK.MQQ.Account.preloadUserInfoList(e.openIds,function(t){0==t&&s.instance._makeAvatarCanvas(e)}))},s.prototype.queryAvatarAndNickCanvas=function(r){s.instance.isQuerying?s.instance.pending.push({type:2,params:r}):(s.instance.isQuerying=!0,s.instance.counter=2,BK.MQQ.Account.preloadUserInfoList(r.openIds,function(t){if(0==t){var e={openIds:r.openIds,style:r.nickStyle,complete:r.nickComplete},i={openIds:r.openIds,style:r.avatarStyle,complete:r.avatarComplete};s.instance._makeAvatarCanvas(i),s.instance._makeNickCanvas(e)}}))},s.prototype._makeNickCanvas=function(t){for(var e=new Array,i=0;i<t.openIds.length;i++){var r=new o(t.openIds[i],t.style,t.openIds.length,t.complete);e.push(r)}s.instance._drawNick(t,e)},s.prototype._makeAvatarCanvas=function(t){for(var e=new Array,i=0;i<t.openIds.length;i++){t.previous&&t.previous();var r=new n(t.openIds[i],t.style,t.openIds.length,t.complete);e.push(r)}s.instance._drawHead(t,e)},s.prototype._drawHead=function(n,o){for(var a=new Array,t=0;t<o.length;t++){var e=o[t].property;BK.MQQ.Account.drawHead(e.canvasObj.getObject(),e.openId,e.style.width,e.style.height,function(t,e,i,r){a.push(t),a.length==o.length&&n.complete&&(n.complete(a),s.instance.counter--,s.instance._judgeExecutePendingList()),n.post&&n.post()})}},s.prototype._drawNick=function(i,r){for(var n=new Array,t=0;t<r.length;t++){var e=r[t].property;BK.MQQ.Account.drawNick(e.canvasObj.getObject(),e.openId,e.x,e.y,e.maxWidth,e.maxHeight,e.canvasObj.getUseH5ModeNumber(),e.canvasObj.textBaseLine,e.canvasObj.textAlign,e.canvasObj.fillTextWithSize,function(t,e){n.push(t),n.length==r.length&&i.complete&&(i.complete(n),s.instance.counter--,s.instance._judgeExecutePendingList())})}},s.prototype._judgeExecutePendingList=function(){if(0==s.instance.counter&&(s.instance.isQuerying=!1,0<s.instance.pending.length)){var t=s.instance.pending[0];s.instance.pending.splice(0,1),0==t.type?s.instance.queryNickCanvas(t.params):1==t.type?s.instance.queryAvatarCanvas(t.params):s.instance.queryAvatarAndNickCanvas(t.params)}},s.instance=new s,s}();t.exports=r},function(t,e,i){"use strict";var r=i(9),n=function(t,e,i){this.openId=t,this.__nativeObj=new r(e.width,e.height),e.isRound&&(this.__nativeObj.beginPath(),this.__nativeObj.arc(e.width/2,e.width/2,e.width/2,0,2*Math.PI),this.__nativeObj.closePath(),this.__nativeObj.clip()),this.property={openId:this.openId,style:e,canvasObj:this.__nativeObj}};t.exports=n},function(t,e,i){"use strict";var o=i(9),r=function(t,e,i){this.__nativeObj=new o(e.width,e.height),this.openId=t,this.maxWidth=2048,this.maxHeight=1024;var r=0,n=0;1==e.useH5Mode&&this.__nativeObj.useH5Mode(),e.x&&(r=e.x),e.y&&(n=e.y),e.fontSize&&this.__nativeObj.setTextSize(e.fontSize),e.textColor&&(this.__nativeObj.fillColor=e.textColor),e.textAlign&&(this.__nativeObj.textAlign=e.textAlign),e.textBaseLine&&(this.__nativeObj.textBaseLine=e.textBaseLine),e.bold&&this.__nativeObj.setTextBold(e.bold),e.italic&&this.__nativeObj.setTextItalic(e.italic),e.strokeColor&&(this.__nativeObj.strokeColor=e.strokeColor),e.shadowColor&&this.__nativeObj.textShadowColor(e.shadowColor),e.shadowRadius&&this.__nativeObj.textShadowRadius(e.shadowRadius),e.shadowOffsetX&&this.__nativeObj.textShadowOffsetX(e.shadowOffsetX),e.shadowOffsetY&&this.__nativeObj.textShadowOffsetY(e.shadowOffsetY),e.fontPath&&(this.__nativeObj.fontPath=e.fontPath),this.property={openId:this.openId,x:r,y:n,canvasObj:this.__nativeObj,maxWidth:this.maxWidth,maxHeight:this.maxHeight}};t.exports=r},function(t,e,i){"use strict";var r=function(){function t(){}return t.getResource=function(t,r){var n=this;void 0===t&&(t={gameId:GameStatusInfo.gameId}),t.gameId=GameStatusInfo.gameId,BK.MQQ.SsoRequest.addListener("ltgame_redpkg_resource.get_game_path",this,function(t,e,i){BK.MQQ.SsoRequest.removeListener("ltgame_redpkg_resource.get_game_path",n),r(t,e,i)}),BK.MQQ.SsoRequest.send(t,"ltgame_redpkg_resource.get_game_path")},t.getRankList=function(t,r){var n=this;void 0===t&&(t={gameId:GameStatusInfo.gameId}),t.gameId=GameStatusInfo.gameId,BK.MQQ.SsoRequest.addListener("ltgame_redpkg_rankinglist.get_ranking",this,function(t,e,i){BK.MQQ.SsoRequest.removeListener("ltgame_redpkg_rankinglist.get_ranking",n),r(t,e,i)}),BK.MQQ.SsoRequest.send(t,"ltgame_redpkg_rankinglist.get_ranking")},t}();t.exports=r},function(t,e,i){"use strict";var r=i(4);t.exports=function(){function t(){}return t.report=function(e){var i=this;BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.9.5")||(BK.MQQ.SsoRequest.addListener("cs.report_event.local",this,function(t){BK.MQQ.SsoRequest.removeListener("cs.report_event.local",i),0!==t?e&&e.fail&&e.fail():e&&e.success&&e.success()}),r.send("cs.report_event.local",{mid:e.mid,value:e.isSuccess?0:1,failCode:e.code,extInfo:e.extInfo}))},t}()}]);BK.Script.log(1,1,"qqPlayCore.js load end");