window.biliMiniGame=function(e,t){"use strict";class i{static isLocalNativeFile(e){for(var t=0,i=r.nativefiles.length;t=52428800&&(t.size>r.minClearSize&&(r.minClearSize=t.size),i.onClearCacheRes()),i.deleteFile(e,a,n,o,t.size)},fail:function(e){null!=n&&n.runWith([1,e])}}):null!=n&&n.runWith([0]):i.fs.getFileInfo({filePath:e,success:function(t){s&&f+4194304+t.size>=52428800&&(t.size>r.minClearSize&&(r.minClearSize=t.size),i.onClearCacheRes()),i.fs.copyFile({srcPath:e,destPath:h,success:function(e){i.onSaveFile(a,d,!0,o,n,t.size)},fail:function(e){null!=n&&n.runWith([1,e])}})},fail:function(e){null!=n&&n.runWith([1,e])}})}static onClearCacheRes(){var e=r.minClearSize,t=[];for(var a in i.filesListObj)"fileUsedSize"!=a&&t.push(i.filesListObj[a]);i.sortOn(t,"times",i.NUMERIC);for(var n=0,o=1,s=t.length;o=e)break;n+=l.size,i.deleteFile("",l.readyUrl)}}static sortOn(e,t,a=0){return a==i.NUMERIC?e.sort((function(e,i){return e[t]-i[t]})):a==(i.NUMERIC|i.DESCENDING)?e.sort((function(e,i){return i[t]-e[t]})):e.sort((function(e,i){return e[t]-i[t]}))}static getFileNativePath(e){return i.fileNativeDir+"/"+e}static deleteFile(e,t="",a=null,n="",o=0){var s=i.getFileInfo(t),l=i.getFileNativePath(s.md5),r=""!=e;i.onSaveFile(t,e,r,n,a,o),i.fs.unlink({filePath:l,success:function(t){if(""!=e){var n=i.getFileNativePath(e);i.fs.copyFile({srcPath:e,destPath:n,success:function(e){},fail:function(e){null!=a&&a.runWith([1,e])}})}},fail:function(e){}})}static deleteAll(){var e=[];for(var t in i.filesListObj)"fileUsedSize"!=t&&e.push(i.filesListObj[t]);for(var a=1,n=e.length;a0&&this.loops--,this.startTime=0,this.play()}play(){this.isStopped=!1,t.SoundManager.addChannel(this),this._audio.play()}set startTime(e){this._audio&&(this._audio.startTime=e)}set autoplay(e){this._audio.autoplay=e}get autoplay(){return this._audio.autoplay}get position(){return this._audio?this._audio.currentTime:0}get duration(){return this._audio?this._audio.duration:0}stop(){this.isStopped=!0,t.SoundManager.removeChannel(this),this.completeHandler=null,this._audio&&(this._audio.stop(),this.loop||(this._audio.offEnded(null),this._miniSound.dispose(),this._audio=null,this._miniSound=null,this._onEnd=null))}pause(){this.isStopped=!0,this._audio.pause()}get loop(){return this._audio.loop}set loop(e){this._audio.loop=e}resume(){this._audio&&(this.isStopped=!1,t.SoundManager.addChannel(this),this._audio.play())}set volume(e){this._audio&&(this._audio.volume=e)}get volume(){return this._audio?this._audio.volume:1}}class n extends t.EventDispatcher{constructor(){super(),this.loaded=!1}static _createSound(){return n._id++,r.window.bl.createInnerAudioContext()}load(e){if(n._musicAudio||(n._musicAudio=n._createSound()),i.isLocalNativeFile(e)){if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))if(""!=i.loadPath)e=e.split(i.loadPath)[1];else{var a=""!=t.URL.rootPath?t.URL.rootPath:t.URL._basePath;""!=a&&(e=e.split(a)[1])}}else e=t.URL.formatURL(e);if(this.url=e,this.readyUrl=e,n._audioCache[this.readyUrl])this.event(t.Event.COMPLETE);else if(r.autoCacheFile&&i.getFileInfo(e))this.onDownLoadCallBack(e,0);else if(r.autoCacheFile)if(i.isLocalNativeFile(e)){var o=e;if(""!=(a=""!=t.URL.rootPath?t.URL.rootPath:t.URL._basePath)&&(e=e.split(a)[1]),e||(e=o),r.subNativeFiles&&0==r.subNativeheads.length)for(var s in r.subNativeFiles){var l=r.subNativeFiles[s];r.subNativeheads=r.subNativeheads.concat(l);for(var d=0;d>>"+n)}}return t},r.EnvConfig.pixelRatioInt=0,t.Browser._pixelRatio=r.pixelRatio(),r._preCreateElement=t.Browser.createElement,t.Browser.createElement=r.createElement,t.RunDriver.createShaderCondition=r.createShaderCondition,t.Utils.parseXMLFromString=r.parseXMLFromString,t.Input._createInputElement=o._createInputElement,t.Loader.prototype._loadResourceFilter=s.prototype._loadResourceFilter,t.Loader.prototype._loadSound=s.prototype._loadSound,t.Loader.prototype.originComplete=t.Loader.prototype.complete,t.Loader.prototype.complete=s.prototype.complete,t.Loader.prototype._loadHttpRequestWhat=s.prototype._loadHttpRequestWhat,t.LocalStorage._baseClass=l,l.__init__(),t.Config.useRetinalCanvas=!0,r.window.bl.onMessage&&r.window.bl.onMessage(r._onMessage))))}static _onMessage(e){switch(e.type){case"changeMatrix":t.Laya.stage.transform.identity(),t.Laya.stage._width=e.w,t.Laya.stage._height=e.h,t.Laya.stage._canvasTransform=new t.Matrix(e.a,e.b,e.c,e.d,e.tx,e.ty);break;case"display":t.Laya.stage.frameRate=e.rate||t.Stage.FRAME_FAST;break;case"undisplay":t.Laya.stage.frameRate=t.Stage.FRAME_SLEEP}"opendatacontext"==e.isLoad?e.url&&(i.ziyuFileData[e.url]=e.atlasdata,i.ziyuFileTextureData[e.imgReadyUrl]=e.imgNativeUrl):"openJsondatacontext"==e.isLoad?e.url&&(i.ziyuFileData[e.url]=e.atlasdata):"openJsondatacontextPic"==e.isLoad&&(i.ziyuFileTextureData[e.imgReadyUrl]=e.imgNativeUrl)}static getUrlEncode(e,t){return"arraybuffer"==t?"":"utf8"}static downLoadFile(e,t="",a=null,n="utf8"){i.getFileInfo(e)?null!=a&&a.runWith([0]):i.downLoadFile(e,t,a,n)}static remove(e,t=null){i.deleteFile("",e,t,"",0)}static removeAll(){i.deleteAll()}static hasNativeFile(e){return i.isLocalNativeFile(e)}static getFileInfo(e){return i.getFileInfo(e)}static getFileList(){return i.filesListObj}static exitMiniProgram(){r.window.bl.exitMiniProgram()}static onMkdirCallBack(e,t){e?(i.fakeObj={},i.filesListObj={}):(i.filesListObj=JSON.parse(t.data),i.fakeObj=JSON.parse(t.data)||{}),i.fs.readdir({dirPath:i.fileNativeDir,success:function(e){var t={};for(let e in i.filesListObj)"fileUsedSize"!=e&&(t[i.filesListObj[e].md5]=!0);var a,n=e.files;if(n)for(let e=0,s=n.length;e=0?"/":"\\",o=e.lastIndexOf(n),s=o>=0?e.substr(0,o+1):"",l=0,d=a.length;l\s+<");try{t=(new r.window.Parser.DOMParser).parseFromString(e,"text/xml")}catch(e){throw"需要引入xml解析库文件"}return t},r.idx=1;class d extends t.EventDispatcher{constructor(){super()}static __init__(){try{var e;if(!(e=t.Accelerator))return;e.prototype.on=d.prototype.on,e.prototype.off=d.prototype.off}catch(e){}}static startListen(e){if(d._callBack=e,!d._isListening){d._isListening=!0;try{r.window.bl.onAccelerometerChange(d.onAccelerometerChange)}catch(e){}}}static stopListen(){d._isListening=!1;try{r.window.bl.stopAccelerometer({})}catch(e){}}static onAccelerometerChange(e){var t;(t={}).acceleration=e,t.accelerationIncludingGravity=e,t.rotationRate={},null!=d._callBack&&d._callBack(t)}on(e,t,i,a=null){return super.on(e,t,i,a),d.startListen(this.onDeviceOrientationChange),this}off(e,t,i,a=!1){return this.hasListener(e)||d.stopListen(),super.off(e,t,i,a)}}d._isListening=!1;class u{_loadImage(e){if(r.isZiYu)u.onCreateImage(e,this,!0);else{var a;if(i.isLocalNativeFile(e)){if(-1==e.indexOf(r.window.bl.env.USER_DATA_PATH)&&(-1!=e.indexOf("http://")||-1!=e.indexOf("https://")))if(""!=i.loadPath)e=e.split(i.loadPath)[1];else{var n=""!=t.URL.rootPath?t.URL.rootPath:t.URL._basePath,o=e;""!=n&&(e=e.split(n)[1]),e||(e=o)}if(r.subNativeFiles&&0==r.subNativeheads.length)for(var s in r.subNativeFiles){var l=r.subNativeFiles[s];r.subNativeheads=r.subNativeheads.concat(l);for(var d=0;d