收藏
回答

unity转微信小游戏 编译报错 怎么解决

"use strict";require("@babel/runtime/helpers/Objectvalues"),require("@babel/runtime/helpers/Arrayincludes"),require("@babel/runtime/helpers/Objectentries");var e=require("@babel/runtime/helpers/regeneratorRuntime"),t=require("@babel/runtime/helpers/construct"),n=require("@babel/runtime/helpers/slicedToArray"),i=require("@babel/runtime/helpers/defineProperty"),a=require("@babel/runtime/helpers/createForOfIteratorHelper"),r=require("@babel/runtime/helpers/typeof"),o=require("@babel/runtime/helpers/toConsumableArray"),s=require("@babel/runtime/helpers/assertThisInitialized"),u=require("@babel/runtime/helpers/inherits"),c=require("@babel/runtime/helpers/createSuper"),l=require("@babel/runtime/helpers/classCallCheck"),d=require("@babel/runtime/helpers/createClass");!function(){var h={48:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=i(n(4339)),o=i(n(8788)),s=function(){function e(t){l(this,e),this.director=t}return d(e,[{key:"handler",get:function(){return this.userHandler}},{key:"created",value:function(e){}},{key:"$update",value:function(){r.default.eventEmitter.emit(this.director,a.DirctorCaseType.UpdateParams)}}]),e}();s.componentName="",s.eventEmitter=new o.default,t.default=s},6486:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(9497),o=n(2993),h=i(n(48)),f=i(n(2979)),p=function(e){u(n,e);var t=c(n);function n(e){var i;return l(this,n),(i=t.call(this,e)).userHandler=new f.default(s(i)),i.registerProgressEventListener(),i}return d(n,[{key:"created",value:function(e){this.operaData=e,this.backFrame=e.createFrame(r.FrameType.createRect,{visible:!1}),this.frontFrame=e.createFrame(r.FrameType.createRect,{visible:!1})}},{key:"refresh",value:function(){var e=this.userHandler.style;if(e.hidden)this.frontFrame.setParams({visible:!1}),this.backFrame.setParams({visible:!1});else{var t={visible:!0,height:e.height,left:0};e.position===o.Position.bottom?t.bottom=0:t.top=0,this.frontFrame.setParams(Object.assign(Object.assign({},t),{color:e.color,width:"".concat(Math.floor(this.userHandler.percentage),"%")})),this.backFrame.setParams(Object.assign(Object.assign({},t),{color:e.backgroundColor,width:"100%"}))}this.$update()}},{key:"registerProgressEventListener",value:function(){var e=this;h.default.eventEmitter.registerEvent(this,(function(t){t===a.ProgressCaseType.RefreshProgress&&e.refresh()}))}}]),n}(h.default);p.componentName="progress",t.default=p},2979:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(2993),o=i(n(48));t.default=function(){function e(t){l(this,e),this.percentageValue=0,this.styleValue={position:r.Position.bottom,hidden:!1,color:"#FFFFFF",backgroundColor:"#000000",height:3},this.progress=t}return d(e,[{key:"percentage",get:function(){return this.percentageValue},set:function(e){var t="number"==typeof e?e<0?0:e>100?100:e:0;t!==this.percentageValue&&(this.percentageValue=t,this.refresh())}},{key:"style",get:function(){return this.styleValue},set:function(e){var t=this,n=!1;Object.keys(e).forEach((function(i){t.styleValue[i]!==e[i]&&(t.styleValue[i]=e[i],n=!0)})),n&&this.refresh()}},{key:"refresh",value:function(){o.default.eventEmitter.emit(this.progress,a.ProgressCaseType.RefreshProgress)}}]),e}()},7024:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){u(n,e);var t=c(n);function n(e,i){return l(this,n),t.call(this,e,i)}return d(n)}(i(n(4107)).default);t.default=a},4107:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(8251),o=n(3380),s=i(n(6520)),u=i(n(6705)),c=i(n(8788)),h=n(587),f=function(){function e(t,n,i){if(l(this,e),this.TYPE=o.OperaDataType.Frame,this.operaData=n,null!==t){this.frameType=t,this.uid=String(e.UidIncIndex++);try{this.element=new((0,h.GetFrameElementClass)(t))(this)}catch(n){throw{type:r.ExceptionType.Frame,errmsg:"动作帧 ".concat(t," 不存在特定的构造函数。")}}}else{if(!i)throw"Frame 快速实例模式缺失数据信息";var a=Number(i.uid);e.UidIncIndex<=a&&(e.UidIncIndex=a+1),this.uid=i.uid,this.frameType=i.frameType;try{this.element=new((0,h.GetFrameElementClass)(i.frameType))(this)}catch(t){throw{type:r.ExceptionType.Frame,errmsg:"快速模式动作帧 ".concat(i.frameType," 不存在特定的构造函数。")}}this.element.importParams(i.params),this.element.importEvents(i.events)}this.registerElementEventListener(),e.proxyFunc(this)}return d(e,[{key:"getUid",value:function(){return this.uid}},{key:"getFrameType",value:function(){return this.frameType}},{key:"getOperaData",value:function(){return this.operaData}},{key:"setParams",value:function(e){this.element.setParams(e)}},{key:"setEvents",value:function(e){this.element.setEvent(e)}},{key:"exportData",value:function(){return{frameType:this.frameType,uid:this.uid,params:this.element.exportParams(),events:this.element.exportEvents()}}},{key:"registerElementEventListener",value:function(){var t=this;e.eventEmitter.registerEvent(this,(function(e){for(var n,i,r,o=arguments.length,c=new Array(o>1?o-1:0),l=1;l<o;l++)c[l-1]=arguments[l];switch(e){case a.FrameBaseCaseType.ParamChange:(n=u.default.eventEmitter).emit.apply(n,[t.operaData,a.OperaPlayerCaseType.ElementParamChange].concat(c));break;case a.FrameBaseCaseType.EventLaunch:(i=u.default.eventEmitter).emit.apply(i,[t.operaData,a.OperaPlayerCaseType.EventLaunch].concat(c));break;case a.FrameBaseCaseType.End:(r=s.default.eventEmitter).emit.apply(r,[t.operaData,a.OperaPlayerCaseType.End].concat(c))}}))}},{key:"play",value:function(){this.element.actived(),u.default.eventEmitter.emit(this.operaData,a.OperaPlayerCaseType.PlayFrame,this)}},{key:"nextFrame",value:function(){return null}},{key:"toString",value:function(){return this.element.toString()}}],[{key:"proxyFunc",value:function(e){}}]),e}();f.eventEmitter=new c.default,f.UidIncIndex=1,t.default=f},587:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GetFrameElementParamsAndEventsStruct=t.GetFrameElementClass=void 0;var a=n(9497),r=i(n(7880)),o=i(n(1935)),s=i(n(2911)),u=i(n(3285)),c=i(n(8998)),l=i(n(7165)),d=i(n(8003)),h=i(n(4480)),f=i(n(1846)),p=i(n(8030)),m=i(n(3293)),g=i(n(9906)),v=i(n(1997)),y=i(n(6027)),T=i(n(1008)),S=i(n(1662)),P=i(n(1013)),k=i(n(4005)),E=i(n(9433)),b=i(n(1258)),C=i(n(7311)),w=i(n(8898));function I(e){switch(e){case a.FrameType.media:return d.default;case a.FrameType.createVideo:return g.default;case a.FrameType.end:return s.default;case a.FrameType.var:return m.default;case a.FrameType.createImage:return l.default;case a.FrameType.setParamPosition:return h.default;case a.FrameType.setParamSize:return f.default;case a.FrameType.setParamSizeAndPosition:return p.default;case a.FrameType.createRect:return o.default;case a.FrameType.pauseVide:return v.default;case a.FrameType.playVideo:return y.default;case a.FrameType.createAnimationFunction:return r.default;case a.FrameType.exception:return u.default;case a.FrameType.if:return c.default;case a.FrameType.setParam:return T.default;case a.FrameType.report:return S.default;case a.FrameType.checkPoint:return P.default;case a.FrameType.setTimeout:return k.default;case a.FrameType.createAudio:return E.default;case a.FrameType.playAudio:return b.default;case a.FrameType.pauseAudio:return C.default;case a.FrameType.reportCheckPointCount:return w.default}return null}t.GetFrameElementClass=I,t.GetFrameElementParamsAndEventsStruct=function(e){var t=I(e),n=null,i=null;if(null!==t){var a=Object.keys(t);a.indexOf("ParamsStruct")>=0&&(n=t.ParamsStruct),a.indexOf("EventsStruct")>=0&&(i=t.EventsStruct)}return{paramsStruct:n,eventsStruct:i}}},7880:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=i(n(5483)),s=n(4722),h=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n)}(o.default);h.ParamsStruct=Object.assign(Object.assign(Object.assign(Object.assign({},s.PostionStruct),s.SizeStruct),s.AnimationStruct),{frame:{type:[a.FrameType.createImage],desc:"需要变动的Frame对象。"},playing:{type:r.ParamInputType.Boolean,desc:"是否正在执行动画。"}}),h.EventsStruct={onEnded:{desc:"当动画结束后。"}},t.default=h},9433:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n,[{key:"pause",value:function(){return this.frame.getOperaData().createFrame(a.FrameType.pauseAudio,{audio:this.frame})}},{key:"play",value:function(){return this.frame.getOperaData().createFrame(a.FrameType.playAudio,{audio:this.frame})}}]),n}(i(n(5483)).default);o.ParamsStruct={url:{type:[r.ParamInputType.String,a.FrameType.var],desc:"需要载入的音频资源地址。"},autoPlay:{type:r.ParamInputType.Boolean,desc:"是否加载完毕后立即播放。"},playing:{type:r.ParamInputType.Boolean,desc:"是否是播放中,修改该属性可以继续/暂停播放。",default:!1},seek:{type:[r.ParamInputType.Number,r.ParamInputType.String,a.FrameType.var],desc:"音频跳转到特定秒数,如果 < 0 则不跳转。",default:-1},volume:{type:[r.ParamInputType.Number],desc:"音频的音量,0~1之间的数值,默认为1。",default:1},loop:{type:r.ParamInputType.Boolean,desc:"是否循环播放,默认不循环。",default:!1}},o.EventsStruct={onPlayTimeAt:{params:{sec:{type:r.ParamInputType.Number,desc:"监听的秒数。"}},desc:"当音频播放到特定秒数时触发下一帧。"},onEnded:{desc:"当音频播放结束后。"},onPlay:{desc:"开始播放"}},t.default=o},7311:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct)}return d(n,[{key:"actived",value:function(){this.getParam("audio").value.setParams({playing:!1})}}]),n}(i(n(5483)).default);r.ParamsStruct={audio:{type:a.FrameType.createAudio,desc:"需要暂停的音频 Frame 实例。"}},t.default=r},1258:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct)}return d(n,[{key:"actived",value:function(){this.getParam("audio").value.setParams({playing:!0})}}]),n}(i(n(5483)).default);r.ParamsStruct={audio:{type:a.FrameType.createAudio,desc:"需要继续播放的音频 Frame 实例。"}},t.default=r},1013:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n)}(i(n(5483)).default);a.ParamsStruct={},a.EventsStruct={},t.default=a},2911:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=i(n(4107)),o=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e)}return d(n,[{key:"actived",value:function(){r.default.eventEmitter.emit(this.frame,a.FrameBaseCaseType.End)}}]),n}(i(n(5483)).default);t.default=o},3285:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(911),r=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n)}(i(n(5483)).default);r.ParamsStruct={throw:{type:a.ParamInputType.Boolean,desc:"是否将捕获到的异常继续向上抛出,将被 director.onErr() 捕获。",default:!0}},r.EventsStruct={catch:{desc:"当捕获到异常时。"}},t.default=r},5483:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(7590),o=n(3380),s=n(911),u=i(n(4107)),c=n(587),h=i(n(9308));t.default=function(){function e(t,n,i){if(l(this,e),this.params={},this.frame=t,Array.isArray(n)){var a={},o={};n.forEach((function(e){var t=(0,c.GetFrameElementParamsAndEventsStruct)(e);t.eventsStruct&&(0,r.mergeEventsStructA2B)(o,t.eventsStruct),t.paramsStruct&&(0,s.mergeParamsStructA2B)(a,t.paramsStruct)})),n=a,i=o}this.paramsStruct=n||{},this.eventsStruct=i||{},this.eventsManager=new h.default(this,this.eventsStruct),this.initParams()}return d(e,[{key:"actived",value:function(){}},{key:"setParams",value:function(e){var t=this,n=(0,s.checkParams)(this.paramsStruct,e);n&&Object.keys(n).forEach((function(e){null!==n[e]?t.params[e]=n[e]:delete t.params[e]}))}},{key:"getParam",value:function(e){return this.params[e]}},{key:"exportParams",value:function(){var e=this,t={};return Object.keys(this.params).forEach((function(n){null!==e.params[n]&&(e.params[n].type===s.ParamInputType.Frame?t[n]={value:e.getFrameUid(e.params[n].value),type:s.ParamInputType.Frame,frameType:e.params[n].frameType}:t[n]={type:e.params[n].type,value:e.params[n].value})})),t}},{key:"importParams",value:function(e){var t=this;Object.keys(e).forEach((function(n){var i=e[n];t.params[n]={type:i.type,value:i.value,frameType:i.frameType},i.type===s.ParamInputType.Frame&&t.frame.getOperaData().delegateUid2Ob(o.OperaDataType.Frame,i.value,t.params[n],"value")}))}},{key:"setEvent",value:function(e){this.eventsManager.registerEvent(e)}},{key:"getEvents",value:function(e){return this.eventsManager.getEvents(e)}},{key:"$emitEvent",value:function(e){this.eventsManager.launchEvent(e)}},{key:"exportEvents",value:function(){return this.eventsManager.exportEvents()}},{key:"importEvents",value:function(e){this.eventsManager.importEvents(e)}},{key:"getFrameBase",value:function(){return this.frame}},{key:"initParams",value:function(){var e=this,t={};Object.keys(this.paramsStruct).forEach((function(n){var i=e.paramsStruct[n];if(t[n]=null,void 0!==i.default){var a=(0,s.checkParamInTypes)(i.default,i.type);if(null===a)return void console.error("默认配置项目 ".concat(i," 中 default 值 ").concat(i.default," 没有通过类型检查"));t[n]={value:i.default,type:a.type,frameType:a.frameType}}}));var n=this;this.params=new Proxy(t,{get:function(e,t){return e[t]},set:function(e,t,i){var r=e[t];return(null==r?void 0:r.value)!==(null==i?void 0:i.value)&&(e[t]=i),u.default.eventEmitter.emit(n.frame,a.FrameBaseCaseType.ParamChange,n.frame,t,r,i),!0}})}},{key:"getFrameUid",value:function(e){return e.getUid()}}]),e}()},8998:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n,[{key:"actived",value:function(){var e,t,n=this,i=this.getParam("valueA"),a=this.getParam("valueB"),r=(null===(e=null==i?void 0:i.value)||void 0===e?void 0:e.toString())===(null===(t=null==a?void 0:a.value)||void 0===t?void 0:t.toString()),o=this.getEvents(),s=r?"isTrue":"isFalse";o.forEach((function(e){e.event===s&&n.$emitEvent(e)}))}}]),n}(i(n(5483)).default);o.ParamsStruct={valueA:{type:[r.ParamInputType.String,a.FrameType.var],desc:"被比较的值或变量A。"},valueB:{type:[r.ParamInputType.String,a.FrameType.var],desc:"被比较的值或变量B。"}},o.EventsStruct={isTrue:{desc:"当 valueA == valueB 时执行的事件。"},isFalse:{desc:"当 valueA != valueB 时执行的事件。"}},t.default=o},7165:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=i(n(5483)),s=n(4722),h=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n,[{key:"visible",value:function(e){return this.frame.getOperaData().createFrame(a.FrameType.setParamPosition,{visible:!!e,frame:this.frame})}}]),n}(o.default);h.ParamsStruct=Object.assign(Object.assign(Object.assign({},s.PostionStruct),s.SizeStruct),{url:{type:[r.ParamInputType.String,a.FrameType.var],desc:"需要载入的图像资源地址。"}}),h.EventsStruct={onClick:{desc:"当图片被点击。"}},t.default=h},8003:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct)}return d(n)}(i(n(5483)).default);o.ParamsStruct={device:{type:r.ParamInputType.Selecet,desc:"需要查询的设备类型,目前可查询 phone、pad。",selectItems:["phone","pad"]},var:{type:a.FrameType.var,desc:"当前运行设备满足 Device 条件时被设定的变量(关键帧)。"},value:{type:r.ParamInputType.String,desc:"变量(关键帧)设定值。"}},t.default=o},1935:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=i(n(5483)),s=n(4722),h=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n)}(o.default);h.ParamsStruct=Object.assign(Object.assign(Object.assign({},s.PostionStruct),s.SizeStruct),{color:{type:[r.ParamInputType.String,a.FrameType.var],desc:"颜色,默认为透明。"}}),h.EventsStruct={onClick:{desc:"当区域被点击。"}},t.default=h},1662:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n)}(i(n(5483)).default);o.ParamsStruct={sceneId:{type:[r.ParamInputType.String,a.FrameType.var],desc:"自定义上报场景ID。"},dimension:{type:[r.ParamInputType.String,a.FrameType.var],desc:"自定义上报维度JSON字符串,请阅读上报说明填写。"},metric:{type:[r.ParamInputType.String,a.FrameType.var],desc:"自定义上报指标JSON字符串,请阅读上报说明填写。"}},o.EventsStruct={},t.default=o},8898:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(911),r=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n)}(i(n(5483)).default);r.ParamsStruct={num:{type:a.ParamInputType.Number,desc:"累计创建的检查点个数。"}},r.EventsStruct={},t.default=r},1008:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n,[{key:"actived",value:function(){var e,t,n=null===(e=this.getParam("frame"))||void 0===e?void 0:e.value;if(n){var i,a=null===(t=this.getParam("param"))||void 0===t?void 0:t.value.toString(),o=this.getParam("value");i=!o||o.type!==r.ParamInputType.Boolean&&o.type!==r.ParamInputType.Number&&o.type!==r.ParamInputType.String?null==o?void 0:o.value.toString():o.value;var s={};s[a]=i,n.setParams(s)}}}]),n}(i(n(5483)).default);o.ParamsStruct={frame:{type:r.ParamInputType.Frame,desc:"被修改的 Frame 对象。"},param:{type:[r.ParamInputType.String,a.FrameType.var],desc:"被设置的属性名。"},value:{type:[r.ParamInputType.String,a.FrameType.var,r.ParamInputType.Boolean,r.ParamInputType.Number],desc:"被设置的属性值。"}},o.EventsStruct={},t.default=o},4480:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(911),r=i(n(5483)),o=n(4722),s=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct)}return d(n,[{key:"actived",value:function(){var e,t,n,i,a,r,o=null===(e=this.getParam("frame"))||void 0===e?void 0:e.value;if(o){var s=null===(t=this.getParam("top"))||void 0===t?void 0:t.value,u=null===(n=this.getParam("bottom"))||void 0===n?void 0:n.value,c=null===(i=this.getParam("left"))||void 0===i?void 0:i.value,l=null===(a=this.getParam("right"))||void 0===a?void 0:a.value,d=null===(r=this.getParam("visible"))||void 0===r?void 0:r.value,h={};void 0!==s&&(h.top=s),void 0!==u&&(h.bottom=u),void 0!==c&&(h.left=c),void 0!==l&&(h.right=l),void 0!==d&&(h.visible=d),Object.keys(h).length>0&&o.setParams(h)}}}]),n}(r.default);s.ParamsStruct=Object.assign(Object.assign({},o.PostionStruct),{frame:{type:a.ParamInputType.Frame,desc:"被修改的 Frame 对象。"}}),t.default=s},1846:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(911),r=i(n(5483)),o=n(4722),s=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct)}return d(n,[{key:"actived",value:function(){var e,t,n,i,a,r,o=null===(e=this.getParam("frame"))||void 0===e?void 0:e.value;if(o){var s=null===(t=this.getParam("width"))||void 0===t?void 0:t.value,u=null===(n=this.getParam("height"))||void 0===n?void 0:n.value,c=null===(i=this.getParam("scaleHeight"))||void 0===i?void 0:i.value,l=null===(a=this.getParam("scaleWidth"))||void 0===a?void 0:a.value,d=null===(r=this.getParam("opacity"))||void 0===r?void 0:r.value;void 0!==s&&o.setParams({width:s}),void 0!==u&&o.setParams({height:u}),void 0!==c&&o.setParams({scaleHeight:c}),void 0!==l&&o.setParams({scaleWidth:l}),void 0!==d&&o.setParams({opacity:d})}}}]),n}(r.default);s.ParamsStruct=Object.assign(Object.assign({},o.SizeStruct),{frame:{type:a.ParamInputType.Frame,desc:"被修改的 Frame 对象。"}}),t.default=s},8030:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,[a.FrameType.setParamSize,a.FrameType.setParamPosition])}return d(n,[{key:"actived",value:function(){var e,t,n,i,a,r,o,s,u,c,l,d=null===(e=this.getParam("frame"))||void 0===e?void 0:e.value;if(d){var h=null===(t=this.getParam("top"))||void 0===t?void 0:t.value,f=null===(n=this.getParam("bottom"))||void 0===n?void 0:n.value,p=null===(i=this.getParam("left"))||void 0===i?void 0:i.value,m=null===(a=this.getParam("right"))||void 0===a?void 0:a.value,g=null===(r=this.getParam("visible"))||void 0===r?void 0:r.value,v=null===(o=this.getParam("width"))||void 0===o?void 0:o.value,y=null===(s=this.getParam("opacity"))||void 0===s?void 0:s.value,T=null===(u=this.getParam("scaleWidth"))||void 0===u?void 0:u.value,S=null===(c=this.getParam("scaleHeight"))||void 0===c?void 0:c.value,P=null===(l=this.getParam("height"))||void 0===l?void 0:l.value,k={};void 0!==h&&(k.top=h),void 0!==f&&(k.bottom=f),void 0!==p&&(k.left=p),void 0!==m&&(k.right=m),void 0!==g&&(k.visible=g),void 0!==v&&(k.width=v),void 0!==P&&(k.height=P),void 0!==S&&(k.scaleHeight=S),void 0!==T&&(k.scaleWidth=T),void 0!==y&&(k.opacity=y),Object.keys(k).length>0&&d.setParams(k)}}}]),n}(i(n(5483)).default);t.default=r},4005:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n,[{key:"cancel",value:function(){return this.frame.getOperaData().createFrame(a.FrameType.setParam,{frame:this,param:"cancel",value:!0})}}]),n}(i(n(5483)).default);o.ParamsStruct={timeout:{type:[r.ParamInputType.String,a.FrameType.var,r.ParamInputType.Number],desc:"延迟时长,单位 ms。"},cancel:{type:[r.ParamInputType.Boolean],desc:"提前取消执行。",default:!1}},o.EventsStruct={onEnded:{desc:"当延迟结束后。"},onCancel:{desc:"当主动取消时。"}},t.default=o},4722:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.AnimationStruct=t.SizeStruct=t.PostionStruct=void 0;var i=n(9497),a=n(911);t.PostionStruct={top:{type:[a.ParamInputType.Number,a.ParamInputType.None,a.ParamInputType.Percent],desc:"屏幕顶边距离。"},bottom:{type:[a.ParamInputType.Number,a.ParamInputType.None,a.ParamInputType.Percent],desc:"屏幕底边距离,若同时设定Top Bottom 则该属性失效。"},left:{type:[a.ParamInputType.Number,a.ParamInputType.None,a.ParamInputType.Percent],desc:"屏幕左边距离。"},right:{type:[a.ParamInputType.Number,a.ParamInputType.None,a.ParamInputType.Percent],desc:"屏幕右边距离,若同时设定 Left Right 则该属性失效。"},visible:{type:a.ParamInputType.Boolean,desc:"是否可见。",default:!0}},t.SizeStruct={width:{type:[a.ParamInputType.Number,a.ParamInputType.Percent],desc:"宽度。"},height:{type:[a.ParamInputType.Number,a.ParamInputType.Percent],desc:"高度。"},scaleHeight:{type:a.ParamInputType.Number,desc:"缩放值,标准为1。"},scaleWidth:{type:a.ParamInputType.Number,desc:"缩放值,标准为1。"},opacity:{type:a.ParamInputType.Number,desc:"透明度,1 为不透明,0 为完全透明。"}},t.AnimationStruct={duration:{type:[a.ParamInputType.String,i.FrameType.var],desc:"动画持续时间,ms。"},easing:{type:[a.ParamInputType.String,i.FrameType.var],desc:"曲率函数名。"}}},3293:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(911),r=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct)}return d(n,[{key:"toString",value:function(){return this.getParam("value").value}}]),n}(i(n(5483)).default);r.ParamsStruct={value:{type:a.ParamInputType.String,desc:"全局字符串变量。"},globalName:{type:a.ParamInputType.String,desc:"全局变量名,设置后可对其进行直接赋值。"}},r.EventsStruct={onChange:{desc:"当全局变量值被赋值时的事件,即使赋值后仍保持原始值也会产生事件。"},onChanged:{desc:"当全局变量值改变时的事件,仅在变量值真实发生变化时产生事件。"}},t.default=r},9906:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=i(n(5483)),s=n(4722),h=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct,n.EventsStruct)}return d(n,[{key:"pause",value:function(){return this.frame.getOperaData().createFrame(a.FrameType.pauseVide,{video:this.frame})}},{key:"play",value:function(){return this.frame.getOperaData().createFrame(a.FrameType.playVideo,{video:this.frame})}},{key:"visible",value:function(e){return this.frame.getOperaData().createFrame(a.FrameType.setParamPosition,{visible:!!e,frame:this.frame})}}]),n}(o.default);h.ParamsStruct=Object.assign(Object.assign(Object.assign({},s.PostionStruct),s.SizeStruct),{url:{type:[r.ParamInputType.String,a.FrameType.var],desc:"需要载入的视频资源地址。"},autoPlay:{type:r.ParamInputType.Boolean,desc:"是否加载完毕后立即播放。"},playing:{type:r.ParamInputType.Boolean,desc:"是否是播放中。",default:!1},objectFit:{type:[r.ParamInputType.String,a.FrameType.var],desc:"视频的缩放模式,可选值:fill、contain、cover",default:"cover"},seek:{type:[r.ParamInputType.Number,r.ParamInputType.String,a.FrameType.var],desc:"视频跳转到特定秒数,如果 < 0 则不跳转。",default:-1},loop:{type:r.ParamInputType.Boolean,desc:"是否循环播放。",default:!1}}),h.EventsStruct={onPlayTimeAt:{params:{sec:{type:r.ParamInputType.Number,desc:"监听的秒数。"}},desc:"当视频播放到特定秒数时触发下一帧。"},onEnded:{desc:"当视频播放结束后。"},onPlay:{desc:"开始播放。"}},t.default=h},1997:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct)}return d(n,[{key:"actived",value:function(){this.getParam("video").value.setParams({playing:!1})}}]),n}(i(n(5483)).default);r.ParamsStruct={video:{type:a.FrameType.createVideo,desc:"需要暂停的视频 Frame 实例。"}},t.default=r},6027:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,n.ParamsStruct)}return d(n,[{key:"actived",value:function(){this.getParam("video").value.setParams({playing:!0})}}]),n}(i(n(5483)).default);r.ParamsStruct={video:{type:a.FrameType.createVideo,desc:"需要继续播放的视频 Frame 实例。"}},t.default=r},9308:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(3380),s=n(911),u=i(n(4107)),c=function(){function e(t,n){l(this,e),this.events=[],this.frameBase=t,this.eventsStruct=n}return d(e,[{key:"registerEvent",value:function(t){var n=[];Array.isArray(t.bind)?n.push.apply(n,o(t.bind)):n.push(t.bind),t.bind=n;var i=e.EventCheck(this.eventsStruct,t);null!==i&&this.events.push(i)}},{key:"getEvents",value:function(e){if(!e)return this.events;var t=[];return this.events.forEach((function(n){n.event===e&&t.push(n)})),t}},{key:"exportEvents",value:function(){var e=[];return this.events.forEach((function(t){e.push({event:t.event,params:t.params,bind:t.bind.map((function(e){return{type:e.type,uid:e.uid}})),keep:!!t.keep})})),e}},{key:"importEvents",value:function(e){var t=this;e.forEach((function(e){var n={event:e.event,params:e.params,bind:e.bind.map((function(e){var n={type:e.type,uid:e.uid};return t.frameBase.getFrameBase().getOperaData().delegateUid2Ob(e.type,e.uid,n,"ob"),n})),keep:!!e.keep};t.events.push(n)}))}},{key:"launchEvent",value:function(e){for(var t=0;t<this.events.length;t++)if(this.events[t]===e)return e.keep||this.events.splice(t,1),void u.default.eventEmitter.emit(this.frameBase.getFrameBase(),a.FrameBaseCaseType.EventLaunch,e)}}],[{key:"EventCheck",value:function(e,t){var n=Object.keys(e);if(n.indexOf(t.event)<0)return console.error("事件定义范围 ".concat(JSON.stringify(n)," 不存在注册目标 event 类型 ").concat(t.event)),null;var i=e[t.event],a=(0,s.checkParams)(i.params,t.params)||{},u=[];Array.isArray(t.bind)?u.push.apply(u,o(t.bind)):u.push(t.bind);var c=[];return u.forEach((function(e){c.push({type:r.OperaDataType.StoryLine,uid:e.getUid(),ob:e})})),{event:t.event,params:a,bind:c,keep:!!t.keep}}}]),e}();t.default=c},4303:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){u(n,e);var t=c(n);function n(e,i){var a;return l(this,n),(a=t.call(this,e)).relatedEvent=i,a}return d(n)}(i(n(1433)).default);t.default=a},1433:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(3380),o=i(n(6705)),s=function(){function e(t,n){var i=this;if(l(this,e),this.TYPE=r.OperaDataType.StoryLine,this.operaData=t,this.datas=[],n){var a=Number(n.uid);e.UidIncIndex<=a&&(e.UidIncIndex=a+1),this.uid=n.uid,n.datas.forEach((function(e){e.type===r.OperaDataType.Frame?i.datas.push(i.operaData.getFrameById(e.uid)):e.type===r.OperaDataType.StoryLine&&(i.datas.push(null),i.operaData.delegateUid2Ob(r.OperaDataType.StoryLine,e.uid,i.datas,i.datas.length-1))}))}else this.uid=String(e.UidIncIndex++)}return d(e,[{key:"add",value:function(){var e;(e=this.datas).push.apply(e,arguments)}},{key:"getUid",value:function(){return this.uid}},{key:"getRelatedEvent",value:function(){return this.relatedEvent}},{key:"nextFrame",value:function(){return this.currentData=this.datas.shift(),this.currentData?(this.currentData.play(),this.currentData):(o.default.eventEmitter.emit(this.operaData,a.OperaPlayerCaseType.ReportStoryEnd,this),null)}},{key:"play",value:function(){o.default.eventEmitter.emit(this.operaData,a.OperaPlayerCaseType.PlayStoryLine,this)}},{key:"exportData",value:function(){return{uid:this.getUid(),datas:this.datas.map((function(e){return{type:e.TYPE,uid:e.getUid()}}))}}}]),e}();s.UidIncIndex=1,t.default=s},8353:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Report=t.Logger=t.OperaData=t.Director=void 0;var a=i(n(4339));t.Director=a.default;var r=i(n(6520));t.OperaData=r.default;var o=i(n(7164));t.Logger=o.default;var s=i(n(8852));t.Report=s.default},5033:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DOMElementType=void 0,function(e){e[e.video=0]="video",e[e.image=1]="image",e[e.view=2]="view"}(n||(t.DOMElementType=n={}))},4469:function(e,t){var n,i,a,r,o,s,u,c;Object.defineProperty(t,"__esModule",{value:!0}),t.LoggerCaseType=t.ProgressCaseType=t.ReportCaseType=t.ViewerElementBaseCaseType=t.ViewerBaseCaseType=t.DirctorCaseType=t.OperaPlayerCaseType=t.FrameBaseCaseType=void 0,function(e){e[e.ParamChange=0]="ParamChange",e[e.EventLaunch=1]="EventLaunch",e[e.End=2]="End"}(n||(t.FrameBaseCaseType=n={})),function(e){e[e.ElementParamChange=0]="ElementParamChange",e[e.PlayFrame=1]="PlayFrame",e[e.PlayStoryLine=2]="PlayStoryLine",e[e.EventLaunch=3]="EventLaunch",e[e.Exception=4]="Exception",e[e.End=5]="End",e[e.ReportStoryStart=6]="ReportStoryStart",e[e.ReportStoryEnd=7]="ReportStoryEnd"}(i||(t.OperaPlayerCaseType=i={})),function(e){e[e.FrameElementParamChange=0]="FrameElementParamChange",e[e.FrameElementParamChangeUpdate=1]="FrameElementParamChangeUpdate",e[e.FrameCreate=2]="FrameCreate",e[e.PlayFrame=3]="PlayFrame",e[e.PlayStoryLine=4]="PlayStoryLine",e[e.OperaDataMounted=5]="OperaDataMounted",e[e.ViewerReady=6]="ViewerReady",e[e.Exception=7]="Exception",e[e.End=8]="End",e[e.UpdateParams=9]="UpdateParams",e[e.Report=10]="Report",e[e.ReportStoryStart=11]="ReportStoryStart",e[e.ReportStoryEnd=12]="ReportStoryEnd",e[e.CheckPoint=13]="CheckPoint",e[e.ReportCheckPointCount=14]="ReportCheckPointCount",e[e.LoggerPush=15]="LoggerPush",e[e.ReportLogger=16]="ReportLogger",e[e.LoggerEmitEvent=17]="LoggerEmitEvent",e[e.WeakNetwork=18]="WeakNetwork"}(a||(t.DirctorCaseType=a={})),function(e){e[e.FrameCreate=0]="FrameCreate",e[e.PlayFrame=1]="PlayFrame",e[e.OperaDataMounted=2]="OperaDataMounted",e[e.FrameElementParamChange=3]="FrameElementParamChange",e[e.FrameElementParamChangeUpdate=4]="FrameElementParamChangeUpdate",e[e.Exception=5]="Exception",e[e.End=6]="End",e[e.UpdateParams=7]="UpdateParams",e[e.Report=8]="Report",e[e.CheckPoint=9]="CheckPoint",e[e.ReportCheckPointCount=10]="ReportCheckPointCount",e[e.LoggerPush=11]="LoggerPush",e[e.LoggerEmitEvent=12]="LoggerEmitEvent",e[e.WeakNetWork=13]="WeakNetWork"}(r||(t.ViewerBaseCaseType=r={})),function(e){e[e.Created=0]="Created",e[e.Actived=1]="Actived",e[e.DomReady=2]="DomReady",e[e.ParamChange=3]="ParamChange",e[e.DestoryView=4]="DestoryView",e[e.ParamsUpdate=5]="ParamsUpdate",e[e.LoggerEmitEvent=6]="LoggerEmitEvent"}(o||(t.ViewerElementBaseCaseType=o={})),function(e){e[e.custom=0]="custom",e[e.sys=1]="sys",e[e.err=2]="err",e[e.logger=3]="logger",e[e.end=4]="end"}(s||(t.ReportCaseType=s={})),function(e){e[e.RefreshProgress=0]="RefreshProgress"}(u||(t.ProgressCaseType=u={})),function(e){e[e.Reset=0]="Reset",e[e.End=1]="End",e[e.LoggerPush=2]="LoggerPush"}(c||(t.LoggerCaseType=c={}))},7590:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.mergeEventsStructA2B=void 0,t.mergeEventsStructA2B=function(e,t){var n=Object.keys(e);Object.keys(t).forEach((function(i){n.indexOf(i)<0&&(e[i]=t[i])}))}},8251:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ExceptionType=void 0,function(e){e[e.Unknown=0]="Unknown",e[e.Viewer=1]="Viewer",e[e.Director=2]="Director",e[e.Video=3]="Video",e[e.Image=4]="Image",e[e.Frame=5]="Frame",e[e.Report=6]="Report",e[e.Audio=7]="Audio"}(n||(t.ExceptionType=n={}))},9497:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.SysFrameType=t.FrameType=void 0,function(e){e[e.media=0]="media",e[e.createVideo=13]="createVideo",e[e.pauseVide=5]="pauseVide",e[e.playVideo=1]="playVideo",e[e.createAudio=20]="createAudio",e[e.pauseAudio=21]="pauseAudio",e[e.playAudio=22]="playAudio",e[e.createImage=2]="createImage",e[e.createRect=6]="createRect",e[e.end=7]="end",e[e.var=8]="var",e[e.setParam=16]="setParam",e[e.setTimeout=19]="setTimeout",e[e.setParamSize=9]="setParamSize",e[e.setParamPosition=10]="setParamPosition",e[e.setParamSizeAndPosition=11]="setParamSizeAndPosition",e[e.createAnimationFunction=12]="createAnimationFunction",e[e.exception=14]="exception",e[e.if=15]="if",e[e.report=17]="report",e[e.checkPoint=18]="checkPoint",e[e.reportCheckPointCount=23]="reportCheckPointCount"}(n||(t.FrameType=n={})),t.SysFrameType=Object.assign({},n)},3603:function(e,t){var n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.RunningType=t.LoggerType=void 0,function(e){e[e.BaseInfo=0]="BaseInfo",e[e.ViewAction=2]="ViewAction",e[e.GlobalVarAction=3]="GlobalVarAction"}(n||(t.LoggerType=n={})),function(e){e[e.Record=0]="Record",e[e.Execute=1]="Execute"}(i||(t.RunningType=i={}))},3380:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.OperaDataType=void 0,function(e){e[e.Frame=0]="Frame",e[e.StoryLine=1]="StoryLine"}(n||(t.OperaDataType=n={}))},911:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.checkParams=t.mergeParamsStructA2B=t.checkParamInTypes=t.checkParamType=t.ParamInputType=void 0;var i,o=n(9497);function s(e,t){var n=r(e);switch(t){case i.Boolean:if("boolean"===n)return{type:i.Boolean};break;case i.Number:if("number"===n||Number(e)==e)return{type:i.Number};break;case i.Percent:if("string"===n&&(/^(100|[1-9]?\d)%$/.test(e)||/^calc\([\s\S]*?\)$/.test(e)))return{type:i.Percent};break;case i.String:if("string"===n||"number"===n)return{type:i.String};break;case i.Selecet:return{type:i.Selecet}}if("object"===n){var a=e.getFrameType?e.getFrameType():null;if(null===a||!(a in o.FrameType))return null;if(i.Frame===t||t===a)return{type:i.Frame,frameType:a}}return null}function u(e,t){if(!Array.isArray(t))return s(e,t);var n,i=a(t);try{for(i.s();!(n=i.n()).done;){var r=s(e,n.value);if(null!==r)return r}}catch(e){i.e(e)}finally{i.f()}return null}!function(e){e.String="String",e.Selecet="Selecet",e.Boolean="Boolean",e.Number="Number",e.None="None",e.Percent="Percent",e.Frame="Frame"}(i||(t.ParamInputType=i={})),t.checkParamType=s,t.checkParamInTypes=u,t.mergeParamsStructA2B=function(e,t){var n=Object.keys(e);Object.keys(t).forEach((function(i){n.indexOf(i)<0&&(e[i]=t[i])}))},t.checkParams=function(e,t){if(e&&t){var n={};return Object.keys(t).forEach((function(i){var a=e[i];if(a)if(null!==a.type){var r=t[i];if(null!=r){var o=u(r,a.type);null===o?console.error("输入项",t,"中字段 ".concat(i," 值"),r,"没有通过类型检查。"):n[i]={value:r,type:o.type,frameType:o.frameType}}else n[i]=null}else console.error("用于约束输入项的 ".concat(JSON.stringify(a)," Struct 没有定义 type 字段。"))})),n}}},2993:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Position=void 0,function(e){e[e.top=0]="top",e[e.bottom=1]="bottom"}(n||(t.Position=n={}))},8792:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ReportStatusType=void 0,function(e){e[e.start=0]="start",e[e.end=1]="end",e[e.checkPoint=2]="checkPoint",e[e.checkPointCount=3]="checkPointCount"}(n||(t.ReportStatusType=n={}))},5667:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.WeakTimeoutMap=t.WeakNetWorkLevel=void 0,function(e){e[e.normal=0]="normal",e[e.slight=1]="slight",e[e.serious=2]="serious"}(n||(t.WeakNetWorkLevel=n={})),t.WeakTimeoutMap=i(i(i({},n.normal,0),n.slight,2500),n.serious,6e3)},7164:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(3603),o=i(n(4339)),s=i(n(8788)),u=function(){function e(t){l(this,e),this.startTimestamp=-1,this.idIndex=0,this.recordQueue=[],this.mode=r.RunningType.Record,this.running=!1,this.setTimeoutHandler=[],this.registerLoggerEventListener(),t&&this.import(t)}return d(e,[{key:"bindDirector",value:function(e){this.director=e}},{key:"export",value:function(){return JSON.stringify({recordQueue:this.recordQueue})}},{key:"exec",value:function(){if(!this.running){if(this.mode!==r.RunningType.Execute)throw"当前 Logger 不是 Execute 模式,无法执行该操作。";for(this.running=!0;this.recordQueue.length>0;)this.emitEvent()}}},{key:"import",value:function(e){var t=JSON.parse(e);this.recordQueue=t.recordQueue,this.mode=r.RunningType.Execute}},{key:"registerLoggerEventListener",value:function(){var t=this;e.eventEmitter.registerEvent(this,(function(e){switch(e){case a.LoggerCaseType.Reset:t.reset();break;case a.LoggerCaseType.End:t.end();break;case a.LoggerCaseType.LoggerPush:var n=arguments.length<=1?void 0:arguments[1];t.pushEvent(n)}}))}},{key:"reset",value:function(){-1===this.startTimestamp&&(this.startTimestamp=(new Date).getTime(),this.idIndex=0)}},{key:"end",value:function(){this.startTimestamp=-1,0!==this.setTimeoutHandler.length&&(this.setTimeoutHandler.forEach((function(e){clearTimeout(e)})),this.setTimeoutHandler=[])}},{key:"emitEvent",value:function(){var e=this,t=this.recordQueue.shift(),n=setTimeout((function(){o.default.eventEmitter.emit(e.director,a.DirctorCaseType.LoggerEmitEvent,t.e)}),t.tm);this.setTimeoutHandler.push(n)}},{key:"pushEvent",value:function(e){var t={tm:this.getTm(),e:e,i:this.idIndex++};this.recordQueue.push(t),o.default.eventEmitter.emit(this.director,a.DirctorCaseType.ReportLogger,t)}},{key:"getTm",value:function(){return-1===this.startTimestamp?0:(new Date).getTime()-this.startTimestamp}}],[{key:"Stream2Data",value:function(e){}}]),e}();u.eventEmitter=new s.default,t.default=u},6520:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(4339)),o=i(n(7024)),s=i(n(4107)),u=i(n(4303)),c=i(n(1433)),h=n(4469),f=n(9497),p=n(3380),m=i(n(8788)),g=n(5327),v=function(){function e(t,n){l(this,e),this.name="",this.author="",this.hash="none",this.delegateQueue=[],this.frames=[],this.storyLines=[],this.director=n,t?this.loadOperaData(t):this.EndFrame=this.createFrame(f.FrameType.end)}return d(e,[{key:"createFrame",value:function(e,t,n){var i=this,a=new o.default(e,this);return this.frames.push(a),r.default.eventEmitter.emit(this.director,h.DirctorCaseType.FrameCreate,a),t&&this.setFrameParams(a,t),n&&(Array.isArray(n)?n.forEach((function(e){i.setFrameEvents(a,e)})):this.setFrameEvents(a,n)),a}},{key:"setFrameParams",value:function(e,t){e.setParams(t)}},{key:"setFrameEvents",value:function(e,t){e.setEvents(t)}},{key:"createStoryLine",value:function(){var e=new u.default(this);return this.storyLines.push(e),this.mainStoryLine||(this.mainStoryLine=e),e}},{key:"createTempStoryLine",value:function(e){return new u.default(this,e)}},{key:"getFrameById",value:function(e){var t,n=a(this.frames);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.getUid()===e)return i}}catch(e){n.e(e)}finally{n.f()}return null}},{key:"getStoryLineById",value:function(e){var t,n=a(this.storyLines);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.getUid()===e)return i}}catch(e){n.e(e)}finally{n.f()}return null}},{key:"exportData",value:function(t,n){var i={frames:this.exportDataFrame(),storyLines:this.exportDataStoryLines(),mainStoryLine:this.mainStoryLine.getUid()};n&&(this.hash=n(JSON.stringify(i)).substring(0,8));var a={name:(null==t?void 0:t.name)||this.name,author:(null==t?void 0:t.author)||this.author,version:e.Version,hash:this.hash,opera:i};return JSON.stringify(a)}},{key:"exportDataFrame",value:function(){var e=[];return this.frames.forEach((function(t){e.push(t.exportData())})),e}},{key:"exportDataStoryLines",value:function(){var e=[];return this.storyLines.forEach((function(t){e.push(t.exportData())})),e}},{key:"loadOperaData",value:function(t){var n=this,i=JSON.parse(t);if(!e.CheckOperaDataStruct(i))throw"传入数据不符合 OperaData 结构要求。";var a=i.name,o=i.author,u=i.version,l=i.hash,d=i.opera;if((0,g.compareVersion)(u,e.Version)>0){var f="剧本版本 ".concat(u," 大于当前 OperaData 解释器版本 ").concat(e.Version,",无法导入数据。");throw console.warn("[launch-opera] ".concat(f)),f}this.name=a,this.author=o,this.hash=l;var p=d.frames,m=d.storyLines,v=d.mainStoryLine;p.forEach((function(e){var t=new s.default(null,n,e);n.frames.push(t),r.default.eventEmitter.emit(n.director,h.DirctorCaseType.FrameCreate,t)})),m.forEach((function(e){var t=new c.default(n,e);n.storyLines.push(t)})),this.todoDelegate(),this.mainStoryLine=this.getStoryLineById(v),r.default.eventEmitter.emit(this.director,h.DirctorCaseType.OperaDataMounted,this)}},{key:"delegateUid2Ob",value:function(e,t,n,i){this.delegateQueue.push({type:e,uid:t,toBase:n,toProp:i})}},{key:"todoDelegate",value:function(){var e=this;this.delegateQueue.forEach((function(t){t.type===p.OperaDataType.Frame?t.toBase[t.toProp]=e.getFrameById(t.uid):t.type===p.OperaDataType.StoryLine&&(t.toBase[t.toProp]=e.getStoryLineById(t.uid))})),this.delegateQueue=[]}},{key:"registerOperaPlayerEventListener",value:function(){}}],[{key:"CheckOperaDataStruct",value:function(e){return"string"==typeof e.name&&"string"==typeof e.author&&"string"==typeof e.version&&e.opera&&e.opera.frames&&e.opera.storyLines&&"string"==typeof e.opera.mainStoryLine}}]),e}();v.Version="1.0.6",v.eventEmitter=new m.default,t.default=v},6705:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(4339)),o=n(4469),s=n(8251),h=n(9497),f=n(3380),p=i(n(6520)),m=function(e){u(n,e);var t=c(n);function n(e,i){var a;return l(this,n),(a=t.call(this,e,i)).currentRuntime=null,a.collectsParams=[],a.registerOperaPlayerEventListener(),a}return d(n,[{key:"setGlobalVar",value:function(e,t){this.frames.forEach((function(n){var i,a;n.getFrameType()===h.FrameType.var&&(null===(a=null===(i=n.element.getParam("globalName"))||void 0===i?void 0:i.value)||void 0===a?void 0:a.toString())===e&&n.setParams({value:t})}))}},{key:"getGlobalVar",value:function(e){var t,n,i,r,o,s=a(this.frames);try{for(s.s();!(o=s.n()).done;){var u=o.value;if(u.getFrameType()===h.FrameType.var&&(null===(n=null===(t=u.element.getParam("globalName"))||void 0===t?void 0:t.value)||void 0===n?void 0:n.toString())===e)return null===(r=null===(i=u.element.getParam("value"))||void 0===i?void 0:i.value)||void 0===r?void 0:r.toString()}}catch(e){s.e(e)}finally{s.f()}}},{key:"getCurrentStoryLine",value:function(){return null===this.currentRuntime||0===this.currentRuntime.storyLineStack.length?null:this.currentRuntime.storyLineStack[0]}},{key:"nextFrame",value:function(){if(null===this.currentRuntime){if(null===this.mainStoryLine){var e={type:s.ExceptionType.Director,errmsg:"剧本没有主故事线无法播放,请先创建主故事线。"};return void r.default.eventEmitter.emit(this.director,o.DirctorCaseType.Exception,e)}this.currentRuntime={storyLineStack:[],frame:null},n.eventEmitter.emit(this,o.OperaPlayerCaseType.PlayStoryLine,this.mainStoryLine)}if(this.currentRuntime.storyLineStack.length>0){var t=this.currentRuntime.storyLineStack[0].nextFrame();return null===t&&this.currentRuntime.storyLineStack.shift(),this.pushCollectChangedParams(),!!t}return this.pushCollectChangedParams(),!1}},{key:"registerOperaPlayerEventListener",value:function(){var e=this;p.default.eventEmitter.registerEvent(this,(function(t){for(var n,i,a,s,u,c,l,d=arguments.length,h=new Array(d>1?d-1:0),f=1;f<d;f++)h[f-1]=arguments[f];switch(t){case o.OperaPlayerCaseType.ElementParamChange:(n=r.default.eventEmitter).emit.apply(n,[e.director,o.DirctorCaseType.FrameElementParamChange].concat(h)),e.collectChangedParams(h[0],h[1],h[2],h[3]);break;case o.OperaPlayerCaseType.PlayFrame:var p=h[0];e.updateRunttimeFrame(p),(i=r.default.eventEmitter).emit.apply(i,[e.director,o.DirctorCaseType.PlayFrame].concat(h));break;case o.OperaPlayerCaseType.PlayStoryLine:var m=h[0];e.currentRuntime.storyLineStack.unshift(m),(a=r.default.eventEmitter).emit.apply(a,[e.director,o.DirctorCaseType.PlayStoryLine].concat(h));break;case o.OperaPlayerCaseType.EventLaunch:var g=h[0];e.todoEventLaunch(g);break;case o.OperaPlayerCaseType.Exception:(s=r.default.eventEmitter).emit.apply(s,[e.director,o.DirctorCaseType.Exception].concat(h));break;case o.OperaPlayerCaseType.End:(u=r.default.eventEmitter).emit.apply(u,[e.director,o.DirctorCaseType.End].concat(h));break;case o.OperaPlayerCaseType.ReportStoryEnd:(c=r.default.eventEmitter).emit.apply(c,[e.director,o.DirctorCaseType.ReportStoryEnd].concat(h));break;case o.OperaPlayerCaseType.ReportStoryStart:(l=r.default.eventEmitter).emit.apply(l,[e.director,o.DirctorCaseType.ReportStoryStart].concat(h))}}))}},{key:"updateRunttimeFrame",value:function(e){this.currentRuntime.frame=e}},{key:"todoEventLaunch",value:function(e){var t=this,n=this.createTempStoryLine(e);e.bind.forEach((function(e){n.add(t.getBindEventOb(e))})),n.play()}},{key:"getBindEventOb",value:function(e){return e.type===f.OperaDataType.StoryLine?this.getFrameById(e.uid):e.type===f.OperaDataType.Frame?this.getStoryLineById(e.uid):void 0}},{key:"collectChangedParams",value:function(e,t,n,i){var a;null===(a=this.collectsParams)||void 0===a||a.push({frame:e,paramName:t,oldValue:n,newValue:i})}},{key:"pushCollectChangedParams",value:function(){var e=this,t=new Map;this.collectsParams.forEach((function(e){if(t.has(e.frame)){var n=t.get(e.frame);n[e.paramName]?n[e.paramName].value=e.newValue:n[e.paramName]={value:e.newValue,oldValue:e.oldValue}}else{var i={};i[e.paramName]={value:e.newValue,oldValue:e.oldValue},t.set(e.frame,i)}})),t.forEach((function(t,n){r.default.eventEmitter.emit(e.director,o.DirctorCaseType.FrameElementParamChangeUpdate,n,t)})),this.collectsParams=[]}}]),n}(p.default);t.default=m},4339:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(9497),s=n(3603),u=n(8792),c=i(n(7164)),h=i(n(8852)),f=i(n(8788)),p=i(n(4767)),m=i(n(6705)),g=function(){function e(t){return l(this,e),this.operaPlayerReady=!1,this.viewerReady=!1,this.callbackErr=[],this.callbackEnd=[],this.callbackWeakNetwork=[],this.callbackGlobalVar=[],this.component={},this.componentPrototype=t,this.initProxy()}return d(e,[{key:"init",value:function(e,t,n){var i=this;return new Promise((function(a,r){i.onReady=a,i.onFail=r,n&&(n.logger&&(i.logger=n.logger,i.logger.bindDirector(i)),n.report&&(i.report=n.report,i.report.bindDirector(i)));try{i.viewer=e,i.viewer.setDirctor(i),i.registerOperaDataEventListener(),i.initCompnents(i.componentPrototype),i.operaPlayer=new m.default(t,i),i.report&&(i.report.hash=i.operaPlayer.hash)}catch(e){i.onFail(e)}}))}},{key:"play",value:function(e){c.default.eventEmitter.emit(this.logger,a.LoggerCaseType.Reset),e&&(e.bindDirector(this),e.exec());for(var t=!0;t;)t=this.operaPlayer.nextFrame()}},{key:"end",value:function(){e.eventEmitter.emit(this,a.DirctorCaseType.End)}},{key:"nextFrame",value:function(){this.operaPlayer.nextFrame()}},{key:"print",value:function(){console.log(this.operaPlayer.exportData())}},{key:"onErr",value:function(e){-1===this.callbackErr.indexOf(e)&&this.callbackErr.push(e)}},{key:"throwErr",value:function(e){var t={errinfo:e};h.default.eventEmitter.emit(this.report,a.ReportCaseType.err,t),this.callbackErr.forEach((function(t){"function"==typeof t&&t(e)}))}},{key:"onEnd",value:function(e){-1===this.callbackEnd.indexOf(e)&&this.callbackEnd.push(e)}},{key:"throwEnd",value:function(){var e=this,t={id:"0",event:"-",status:u.ReportStatusType.end};h.default.eventEmitter.emit(this.report,a.ReportCaseType.sys,t),this.callbackEnd.forEach((function(t){"function"==typeof t&&t(e.logger)})),c.default.eventEmitter.emit(this.logger,a.LoggerCaseType.End),h.default.eventEmitter.emit(this.report,a.ReportCaseType.end)}},{key:"offErr",value:function(e){var t=this.callbackErr.indexOf(e);-1!==t&&this.callbackErr.splice(t,1)}},{key:"onWeakNetwork",value:function(e){-1===this.callbackWeakNetwork.indexOf(e)&&this.callbackWeakNetwork.push(e)}},{key:"throwWeakNetwork",value:function(e){this.callbackWeakNetwork.forEach((function(t){"function"==typeof t&&t(e)}))}},{key:"offWeakNetwork",value:function(e){var t=this.callbackWeakNetwork.indexOf(e);-1!==t&&this.callbackWeakNetwork.splice(t,1)}},{key:"setGlobalVar",value:function(e,t){c.default.eventEmitter.emit(this.logger,a.LoggerCaseType.LoggerPush,{t:s.LoggerType.GlobalVarAction,l:{n:e,v:t}}),this.operaPlayer.setGlobalVar(e,t)}},{key:"getGlobalVar",value:function(e){return this.operaPlayer.getGlobalVar(e)}},{key:"onGlobalVarChange",value:function(e,t){this.callbackGlobalVar.push({globalName:e,callback:t})}},{key:"offGlobalVarChange",value:function(e,t){var n=this,i=[];this.callbackGlobalVar.forEach((function(n,a){n.globalName===e&&n.callback===t&&i.unshift(a)})),i.forEach((function(e){n.callbackErr.splice(e,1)}))}},{key:"checkReady",value:function(){if(this.operaPlayerReady&&this.viewerReady){var e={id:"0",event:"-",status:u.ReportStatusType.start};h.default.eventEmitter.emit(this.report,a.ReportCaseType.sys,e),this.onReady(!0)}}},{key:"registerOperaDataEventListener",value:function(){var t=this;e.eventEmitter.registerEvent(this,(function(e){for(var n,i,o,s,l,d,f,m,g,v,y,T=arguments.length,S=new Array(T>1?T-1:0),P=1;P<T;P++)S[P-1]=arguments[P];switch(e){case a.DirctorCaseType.FrameElementParamChange:t.operaPlayerReady&&(n=p.default.eventEmitter).emit.apply(n,[t.viewer,a.ViewerBaseCaseType.FrameElementParamChange].concat(S));break;case a.DirctorCaseType.UpdateParams:t.operaPlayer.pushCollectChangedParams();break;case a.DirctorCaseType.FrameCreate:(i=p.default.eventEmitter).emit.apply(i,[t.viewer,a.ViewerBaseCaseType.FrameCreate].concat(S));break;case a.DirctorCaseType.PlayFrame:(o=p.default.eventEmitter).emit.apply(o,[t.viewer,a.ViewerBaseCaseType.PlayFrame].concat(S));break;case a.DirctorCaseType.PlayStoryLine:t.play();break;case a.DirctorCaseType.OperaDataMounted:Object.keys(t.component).forEach((function(e){t.component[e].created(S[0])})),(s=p.default.eventEmitter).emit.apply(s,[t.viewer,a.ViewerBaseCaseType.OperaDataMounted].concat(S)),t.operaPlayerReady=!0,t.checkReady();break;case a.DirctorCaseType.ViewerReady:t.viewerReady=!0,t.checkReady();break;case a.DirctorCaseType.Exception:t.throwErr(S[0]);break;case a.DirctorCaseType.End:(l=p.default.eventEmitter).emit.apply(l,[t.viewer,a.ViewerBaseCaseType.End].concat(S)),t.throwEnd();break;case a.DirctorCaseType.FrameElementParamChangeUpdate:(d=p.default.eventEmitter).emit.apply(d,[t.viewer,a.ViewerBaseCaseType.FrameElementParamChangeUpdate].concat(S));var k=S[0];if(k.getFrameType()===r.FrameType.var){var E=null===(y=null===(v=k.element.getParam("globalName"))||void 0===v?void 0:v.value)||void 0===y?void 0:y.toString(),b=S[1].value;E&&b&&t.callbackGlobalVar.forEach((function(e){E===e.globalName&&e.callback(b)}))}break;case a.DirctorCaseType.Report:(f=h.default.eventEmitter).emit.apply(f,[t.report,a.ReportCaseType.custom].concat(S));break;case a.DirctorCaseType.ReportStoryEnd:t.reportStoryLine(S[0],u.ReportStatusType.end);break;case a.DirctorCaseType.ReportStoryStart:t.reportStoryLine(S[0],u.ReportStatusType.start);break;case a.DirctorCaseType.CheckPoint:t.reportStoryLine(t.operaPlayer.getCurrentStoryLine(),u.ReportStatusType.checkPoint);break;case a.DirctorCaseType.ReportCheckPointCount:var C={id:"0",event:S[0]||"-1",status:u.ReportStatusType.checkPointCount};h.default.eventEmitter.emit(t.report,a.ReportCaseType.sys,C);break;case a.DirctorCaseType.LoggerPush:(m=c.default.eventEmitter).emit.apply(m,[t.logger,a.LoggerCaseType.LoggerPush].concat(S));break;case a.DirctorCaseType.ReportLogger:(g=h.default.eventEmitter).emit.apply(g,[t.report,a.ReportCaseType.logger].concat(S));break;case a.DirctorCaseType.LoggerEmitEvent:t.loggerEmitEvent(S[0]);break;case a.DirctorCaseType.WeakNetwork:t.throwWeakNetwork(S[0])}}))}},{key:"reportStoryLine",value:function(e,t){var n,i={id:(null==e?void 0:e.getUid())||"-1",event:(null===(n=e.getRelatedEvent())||void 0===n?void 0:n.event)||"-",status:t};h.default.eventEmitter.emit(this.report,a.ReportCaseType.sys,i)}},{key:"initCompnents",value:function(e){var t=this,n=[];e&&(Array.isArray(e)?n.push.apply(n,o(e)):n.push(e),n.forEach((function(e){-1===Object.keys(t.component).indexOf(e.componentName)&&(t.component[e.componentName]=new e(t))})))}},{key:"initProxy",value:function(){var e=this;return new Proxy(this,{get:function(t,n,i){var a=Reflect.get(t,n,i);if(void 0!==a)return a;var r=e.component[n];return r?r.handler:void 0}})}},{key:"loggerEmitEvent",value:function(e){switch(console.log(e,e.l),e.t){case s.LoggerType.GlobalVarAction:var t=e.l;this.setGlobalVar(t.n,t.v);break;case s.LoggerType.ViewAction:p.default.eventEmitter.emit(this.viewer,a.ViewerBaseCaseType.LoggerEmitEvent,e.l)}}}]),e}();g.eventEmitter=new f.default,t.default=g},8852:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(8251),o=i(n(4339)),s=i(n(8788)),u=n(5327),c=function(){function e(){l(this,e),this.startTimestamp=0,this.hash="",this.startTimestamp=(new Date).getTime(),this.registerReportEventListener()}return d(e,[{key:"bindDirector",value:function(e){this.director=e}},{key:"registerReportEventListener",value:function(){var t=this;e.eventEmitter.registerEvent(this,(function(e){switch(e){case a.ReportCaseType.custom:t.reportScene(arguments.length<=1?void 0:arguments[1]);break;case a.ReportCaseType.end:t.destory()}}))}},{key:"destory",value:function(){}},{key:"reportScene",value:function(e){var t=this;if("function"==typeof(0,u.wx)().reportScene)(0,u.wx)().reportScene({sceneId:e.sceneId,dimension:e.dimension?JSON.parse(e.dimension):{},metric:e.metric?JSON.parse(e.metric):{},costTime:this.calCostTime(),fail:function(n){var i={type:r.ExceptionType.Report,errmsg:"自定义上报失败 sceneId: ".concat(e.sceneId," dimension: ").concat(e.dimension),err:n};o.default.eventEmitter.emit(t.director,a.DirctorCaseType.Exception,i)}});else{var n={type:r.ExceptionType.Report,errmsg:"自定义上报失败,当前基础库版本过低。"};o.default.eventEmitter.emit(this.director,a.DirctorCaseType.Exception,n)}}},{key:"calCostTime",value:function(){return(new Date).getTime()-this.startTimestamp}}]),e}();c.eventEmitter=new s.default,t.default=c},8788:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){function e(){l(this,e),this.events=new WeakMap}return d(e,[{key:"registerEvent",value:function(e,t){if(this.events.has(e)){var n=this.events.get(e);-1===n.indexOf(t)&&(n.push(t),this.events.set(e,n))}else this.events.set(e,[t])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e&&this.events.has(e)&&this.events.get(e).forEach((function(e){e.apply(void 0,n)}))}}]),e}()},5327:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.compareVersion=t.wx=t.common=void 0,t.common={wx:null},t.wx=function(){return t.common.wx?t.common.wx:{}},t.compareVersion=function(e,t){if("string"!=typeof e||"string"!=typeof t)return"string"!=typeof e&&"string"!=typeof t?0:"string"!=typeof e?1:-1;for(var n=e.split("."),i=t.split("."),a=Math.max(n.length,i.length);n.length<a;)n.push("0");for(;i.length<a;)i.push("0");for(var r=0;r<a;r++){var o=parseInt(n[r],10),s=parseInt(i[r],10);if(o>s)return 1;if(o<s)return-1}return 0}},6492:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=i(n(8788)),o=i(n(4767)),s=function(){function e(){l(this,e),this.watch={},this.viewer=arguments.length<=0?void 0:arguments[0],this.frame=arguments.length<=1?void 0:arguments[1],this.registerViewerEventListener()}return d(e,[{key:"getFrameBase",value:function(){return this.frame}},{key:"$emit",value:function(e){this.frame.element.$emitEvent(e)}},{key:"$logger",value:function(e){o.default.eventEmitter.emit(this.viewer,a.ViewerBaseCaseType.LoggerPush,this.frame.getUid(),e)}},{key:"$update",value:function(){o.default.eventEmitter.emit(this.viewer,a.ViewerBaseCaseType.UpdateParams)}},{key:"created",value:function(){}},{key:"updated",value:function(e){}},{key:"actived",value:function(){}},{key:"destory",value:function(){}},{key:"domMounted",value:function(){}},{key:"onLoggerEvent",value:function(e){}},{key:"animation",value:function(e,t){return new Promise((function(e){e(!0)}))}},{key:"getEvents",value:function(e){return this.frame.element.getEvents(e)}},{key:"getParams",value:function(e){var t=this;Array.isArray(e)||(e=[e]);var n={};return e.forEach((function(e){var i=t.frame.element.getParam(e);i&&(n[e]=i)})),n}},{key:"registerViewerEventListener",value:function(){var t=this;e.eventEmitter.registerEvent(this,(function(e){switch(e){case a.ViewerElementBaseCaseType.Created:t.created();break;case a.ViewerElementBaseCaseType.Actived:t.actived();break;case a.ViewerElementBaseCaseType.DomReady:t.domMounted();break;case a.ViewerElementBaseCaseType.ParamChange:var n=arguments.length<=2?void 0:arguments[2],i=arguments.length<=3?void 0:arguments[3],r=arguments.length<=4?void 0:arguments[4];t.watch[n]&&t.watch[n](r,i);break;case a.ViewerElementBaseCaseType.DestoryView:t.destory();break;case a.ViewerElementBaseCaseType.ParamsUpdate:t.updated(arguments.length<=2?void 0:arguments[2]);break;case a.ViewerElementBaseCaseType.LoggerEmitEvent:t.onLoggerEvent(arguments.length<=1?void 0:arguments[1])}}))}}]),e}();s.eventEmitter=new r.default,t.default=s},4767:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=n(4469),o=n(3603),s=i(n(4339)),u=i(n(8788)),c=i(n(6492)),h=function(){function e(t){l(this,e),this.elements=[],this.frameMap=new WeakMap,this.viewerElementsClass=t}return d(e,[{key:"setDirctor",value:function(e){this.dirctor=e,this.registerDirctorEventListener()}},{key:"getViewerElementByFrameBase",value:function(e){return this.frameMap.has(e)?this.frameMap.get(e):null}},{key:"emitterTodoFrameCreate",value:function(e){var t=this;this.viewerElementsClass.forEach((function(n){n.ListenerFrameType===e.getFrameType()&&t.createViewer(n,e)}))}},{key:"createViewer",value:function(e,t){var n=new e(this,t);this.elements.push(n),this.frameMap.set(t,n),e.eventEmitter.emit(n,r.ViewerElementBaseCaseType.Created)}},{key:"mounted",value:function(){}},{key:"destory",value:function(){}},{key:"registerDirctorEventListener",value:function(){var t=this;e.eventEmitter.registerEvent(this,(function(e){for(var n,i,a,o,u,l,d,h=arguments.length,f=new Array(h>1?h-1:0),p=1;p<h;p++)f[p-1]=arguments[p];switch(e){case r.ViewerBaseCaseType.FrameCreate:t.emitterTodoFrameCreate(f[0]);break;case r.ViewerBaseCaseType.PlayFrame:t.frameMap.has(f[0])&&c.default.eventEmitter.emit(t.frameMap.get(f[0]),r.ViewerElementBaseCaseType.Actived);break;case r.ViewerBaseCaseType.OperaDataMounted:t.mounted();break;case r.ViewerBaseCaseType.FrameElementParamChange:t.frameMap.has(f[0])&&(n=c.default.eventEmitter).emit.apply(n,[t.frameMap.get(f[0]),r.ViewerElementBaseCaseType.ParamChange].concat(f));break;case r.ViewerBaseCaseType.Exception:(i=s.default.eventEmitter).emit.apply(i,[t.dirctor,r.DirctorCaseType.Exception].concat(f));break;case r.ViewerBaseCaseType.End:t.destory();break;case r.ViewerBaseCaseType.FrameElementParamChangeUpdate:t.frameMap.has(f[0])&&(a=c.default.eventEmitter).emit.apply(a,[t.frameMap.get(f[0]),r.ViewerElementBaseCaseType.ParamsUpdate].concat(f));break;case r.ViewerBaseCaseType.UpdateParams:s.default.eventEmitter.emit(t.dirctor,r.DirctorCaseType.UpdateParams);break;case r.ViewerBaseCaseType.Report:(o=s.default.eventEmitter).emit.apply(o,[t.dirctor,r.DirctorCaseType.Report].concat(f));break;case r.ViewerBaseCaseType.CheckPoint:(u=s.default.eventEmitter).emit.apply(u,[t.dirctor,r.DirctorCaseType.CheckPoint].concat(f));break;case r.ViewerBaseCaseType.ReportCheckPointCount:(l=s.default.eventEmitter).emit.apply(l,[t.dirctor,r.DirctorCaseType.ReportCheckPointCount].concat(f));break;case r.ViewerBaseCaseType.LoggerPush:t.loggerPush(f[0],f[1]);break;case r.ViewerBaseCaseType.LoggerEmitEvent:t.loggerEmitEvent(f[0]);break;case r.ViewerBaseCaseType.WeakNetWork:(d=s.default.eventEmitter).emit.apply(d,[t.dirctor,r.DirctorCaseType.WeakNetwork].concat(f))}}))}},{key:"loggerEmitEvent",value:function(e){var t,n=a(this.elements);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.getFrameBase().getUid()===e.u){c.default.eventEmitter.emit(i,r.ViewerElementBaseCaseType.LoggerEmitEvent,e.a);break}}}catch(e){n.e(e)}finally{n.f()}}},{key:"loggerPush",value:function(e,t){s.default.eventEmitter.emit(this.dirctor,r.DirctorCaseType.LoggerPush,{t:o.LoggerType.ViewAction,l:{u:e,a:t}})}}]),e}();h.eventEmitter=new u.default,t.default=h},7151:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a,r=i(n(8851)),o=n(2327),h=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.call(this)).destoryed=!1,e.globalPrivate=(0,o.getPrivateThis)(s(e)),e.globalPrivate.xom="",e.globalPrivate.style="",e.supportAnimation=!o.env.isDevtools,e}return d(n,[{key:"loadXML",value:function(){var e=r.default.getXml(),t=r.default.getStyle(),n=(0,o.xmlParser)(e).root,i=r.default.idBody;return o.init.call(this,n,t),o.webviewLayout.add(this.globalPrivate[i]),this.globalPrivate[i].ready()}},{key:"showBody",value:function(){this.globalPrivate[r.default.idBody].style.hidden=!1}},{key:"getHandler",value:function(e){return this.globalPrivate[e]}},{key:"destory",value:function(){var e=this;this.destoryed||(this.destoryed=!0,this.globalPrivate[r.default.idBody]&&this.globalPrivate[r.default.idBody].animate({opacity:0,duration:300}).then((function(){o.webviewLayout.remove(e.globalPrivate[r.default.idBody]),(0,o.removePrivateThis)(e)})))}}]),n}(o.Component);t.default=function(){return a||(a=new h),a}},6355:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.screenHeight=t.screenWidth=void 0;var i=n(2327).env.systemInfo,a=i.screenWidth,r=i.screenHeight;t.screenWidth=a,t.screenHeight=r},8851:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=n(5033),a=n(6355),r="wx_lac_opera_",o=function(){function e(){l(this,e),this.DOMElements=[],this.style={},this.idBody="".concat(r,"body");var t={};t[this.idBody]={width:a.screenWidth,height:a.screenHeight,zIndex:100,position:"absolute",top:0,left:0,hidden:!0,backgroundColor:"#ffffff",opacity:1},Object.assign(this.style,t)}return d(e,[{key:"addVideo",value:function(){var t="".concat(r).concat(e.uidInc++);return this.DOMElements.push({type:i.DOMElementType.video,uid:t}),this.style[t]={position:"absolute"},t}},{key:"addImage",value:function(t){var n="".concat(r).concat(e.uidInc++);return this.DOMElements.push({type:i.DOMElementType.image,uid:n,src:t}),this.style[n]={position:"absolute"},n}},{key:"addClickRect",value:function(){var t="".concat(r).concat(e.uidInc++);return this.DOMElements.push({type:i.DOMElementType.view,uid:t}),this.style[t]={position:"absolute"},t}},{key:"getXml",value:function(){var e="";return this.DOMElements.forEach((function(t){switch(t.type){case i.DOMElementType.video:e+='\n            <video\n              id="'.concat(t.uid,'"\n              controls="false"\n              obeyMuteSwitch="true"\n              pageGesture="false"\n              loop="true"\n              muted="true"\n              autoplay="false"\n              object-fit="cover"\n              enable-progress-gesture="false"\n              enable-play-gesture="false"\n              show-center-play-btn="false"\n              auto-insert="false"\n            ></video>\n          ');break;case i.DOMElementType.image:e+='\n            <image\n              id="'.concat(t.uid,'"\n              src="').concat(t.src,'"\n            ></image>\n          ');break;case i.DOMElementType.view:e+='\n            <view\n              id="'.concat(t.uid,'"\n            ></view>\n          ')}})),'\n      <view id="'.concat(this.idBody,'">\n        ').concat(e,"\n      </view>\n      ")}},{key:"getStyle",value:function(){return this.style}}]),e}();o.uidInc=1,t.default=new o},4936:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=i(n(4339)),o=i(n(6492)),s=i(n(4767)),h=i(n(7151)),f=i(n(2837)),p=i(n(4814)),m=i(n(6881)),g=i(n(2862)),v=i(n(5374)),y=i(n(4281)),T=i(n(1187)),S=i(n(2520)),P=i(n(5754)),k=i(n(1762)),E=function(e){u(n,e);var t=c(n);function n(){return l(this,n),t.call(this,n.ViewerElementsClass)}return d(n,[{key:"mounted",value:function(){var e=this;console.log("[Launch Opera] Opera loaded all assets."),console.log("[Launch Opera] Init cover view documents."),(0,h.default)().loadXML().then((function(){r.default.eventEmitter.emit(e.dirctor,a.DirctorCaseType.ViewerReady),e.elements.forEach((function(e){o.default.eventEmitter.emit(e,a.ViewerElementBaseCaseType.DomReady)})),(0,h.default)().showBody()}))}},{key:"destory",value:function(){this.elements.forEach((function(e){e.destory()})),console.log("[Launch Opera] Opera viewer-coverview destory."),(0,h.default)().destory()}}]),n}(s.default);E.ViewerElementsClass=[p.default,f.default,m.default,g.default,v.default,y.default,T.default,S.default,P.default,k.default],t.default=E},5374:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=n(911),o=i(n(6492)),s=n(4566),h=function(e){u(n,e);var t=c(n);function n(){var e;l(this,n);for(var i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return(e=t.call.apply(t,[this].concat(a))).isDestory=!1,e}return d(n,[{key:"actived",value:function(){var e=this,t=this.getParams("frame").frame;if(t.type===r.ParamInputType.Frame){var n=this.viewer.getViewerElementByFrameBase(t.value);if(n){var i=this.getParams(s.PositionAndSizeKeys),a={};Object.keys(i).forEach((function(e){null!==i[e]&&(a[e]=i[e])})),n.animation(a,this.getParams(["duration","easing"])).then((function(){e.isDestory||e.getEvents("onEnded").forEach((function(t){e.$emit(t)}))}))}}}},{key:"destory",value:function(){this.isDestory=!0}}]),n}(o.default);h.ListenerFrameType=a.FrameType.createAnimationFunction,t.default=h},4814:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(8251),o=n(9497),s=i(n(6492)),h=i(n(4767)),f=n(2327),p=function(e){u(n,e);var t=c(n);function n(){var e;l(this,n);for(var i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return(e=t.call.apply(t,[this].concat(a))).progressTime=0,e.onProgressToPlay=!1,e.onWating=!1,e.playAtTimes=[],e.watch={playing:function(t,n){var i,a;t.value?null===(a=e.audio)||void 0===a||a.play():null===(i=e.audio)||void 0===i||i.pause()},seek:function(t,n){var i,a=Number(t.value.toString());null===(i=e.audio)||void 0===i||i.seek(a)},loop:function(t,n){e.audio&&(e.audio.loop=t.value)}},e.nextPlayPosition=-1,e}return d(n,[{key:"created",value:function(){var e=this,t=f.wx.createInnerAudioContext();if(t)this.audio=t,this.audio.onPlay((function(){e.getEvents("onPlay").forEach((function(t){e.$emit(t)})),e.onWating=!1})),this.audio.onEnded((function(){e.getEvents("onEnded").forEach((function(t){e.$emit(t)}))})),this.audio.onError((function(){e.onError()})),this.audio.onWaiting((function(){e.onWating=!0})),this.audio.onTimeUpdate((function(){e.checkPlayAtTimes()})),this.audio.onCanplay((function(){e.onProgressToPlay&&e.audio.play()}));else{var n={type:r.ExceptionType.Audio,errmsg:"音频组件创建失败"};h.default.eventEmitter.emit(this.viewer,a.ViewerBaseCaseType.Exception,n)}}},{key:"onError",value:function(){this.$logger("onError");var e=this.getParams(["url"]).url,t={type:r.ExceptionType.Audio,errmsg:"音频URL:[".concat(e.value.toString(),"] 播放失败")};h.default.eventEmitter.emit(this.viewer,a.ViewerBaseCaseType.Exception,t)}},{key:"onLoggerEvent",value:function(e){"onError"===e&&this.onError()}},{key:"actived",value:function(){var e=this,t=this.getParams(["autoPlay","url","volume","loop"]),n=t.autoPlay,i=t.url,a=t.volume,r=t.loop;this.getEvents("onPlayTimeAt").forEach((function(t){e.playAtTimes.push({eventHander:t,sec:t.params.sec.value})})),this.audio.src=i.value.toString(),this.onProgressToPlay=n.value,this.audio.volume=a.value,this.progress=0,this.audio.loop=r.value}},{key:"destory",value:function(){this.audio&&this.audio.destroy()}},{key:"progress",get:function(){return this.progressTime},set:function(e){this.progressTime=e,this.progressTime>0&&this.onProgressToPlay&&(this.onProgressToPlay=!1,this.nextPlayPosition=-1,this.audio.play())}},{key:"checkPlayAtTimes",value:function(){var e=this,t=this.audio.currentTime;this.playAtTimes.forEach((function(n,i){var a=n.sec;a>=e.nextPlayPosition&&a<t&&(e.playAtTimes.splice(i,1),e.$emit(n.eventHander))})),this.nextPlayPosition=t}}]),n}(s.default);p.ListenerFrameType=o.FrameType.createAudio,t.default=p},1187:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(9497),o=i(n(6492)),s=i(n(4767)),h=function(e){u(n,e);var t=c(n);function n(){l(this,n);for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];return t.call.apply(t,[this].concat(i))}return d(n,[{key:"actived",value:function(){s.default.eventEmitter.emit(this.viewer,a.ViewerBaseCaseType.CheckPoint)}}]),n}(o.default);h.ListenerFrameType=r.FrameType.checkPoint,t.default=h},6881:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=i(n(6492)),o=n(821),s=n(4566),h=i(n(7151)),f=i(n(8851)),p=n(2327),m=function(e){u(n,e);var t=c(n);function n(){var e;l(this,n);for(var i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return(e=t.call.apply(t,[this].concat(a))).watch={visible:function(t,n){e.image.style.hidden=!t.value}},e}return d(n,[{key:"created",value:function(){var e=this.getParams(["url"]).url;this.uid=f.default.addImage(e.value.toString())}},{key:"domMounted",value:function(){var e=this;this.image=(0,h.default)().getHandler(this.uid),this.updatePositionAndSize(),this.image.style.hidden=!0,this.image.on("click",(function(t){(0,o.isValidClick)(t)&&e.click()}))}},{key:"click",value:function(){var e=this;this.$logger("click"),this.getEvents("onClick").forEach((function(t){e.$emit(t)}))}},{key:"onLoggerEvent",value:function(e){"click"===e&&this.click()}},{key:"actived",value:function(){this.updatePositionAndSize()}},{key:"updated",value:function(e){(0,s.isPositionAndSizeChange)(e)&&this.updatePositionAndSize()}},{key:"animation",value:function(e,t){var n=this;return new Promise((function(i,a){var r,o,u,c;if(n.getParams("visible").visible.value){var l=n.getParams(s.PositionAndSizeKeys),d=(0,s.calPositionAndSizeByParams)(l),h=(0,s.calPositionAndSizeByParams)(l,e),f={};Object.keys(h).forEach((function(e){h[e]!==d[e]&&(f[e]=h[e])}));var m=Number(null===(o=null===(r=null==t?void 0:t.duration)||void 0===r?void 0:r.value)||void 0===o?void 0:o.toString()),g=null===(c=null===(u=null==t?void 0:t.easing)||void 0===u?void 0:u.value)||void 0===c?void 0:c.toString();p.env.isDevtools?setTimeout((function(){n.frame.setParams(h),n.updatePositionAndSize(),i(!0)}),m):setTimeout((function(){var e=Object.assign({easing:g,duration:m},f);n.image.animate(e).then((function(){n.frame.setParams(h),n.updatePositionAndSize(),i(!0)}))}),p.env.isIOS?30:1)}else a()}))}},{key:"updatePositionAndSize",value:function(){var e=this,t=(0,s.calPositionAndSizeByParams)(this.getParams(s.PositionAndSizeKeys));Object.keys(t).forEach((function(n){e.image.style[n]=t[n]}));var n=this.getParams("visible").visible;this.image.style.hidden=!(null==n?void 0:n.value)}}]),n}(r.default);m.ListenerFrameType=a.FrameType.createImage,t.default=m},2862:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=i(n(6492)),o=i(n(8851)),s=i(n(7151)),h=n(4566),f=n(821),p=function(e){u(n,e);var t=c(n);function n(){var e;l(this,n);for(var i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return(e=t.call.apply(t,[this].concat(a))).first=!0,e.watch={visible:function(t,n){e.view.style.hidden=!t.value}},e}return d(n,[{key:"created",value:function(){this.uid=o.default.addClickRect()}},{key:"domMounted",value:function(){var e=this;this.view=(0,s.default)().getHandler(this.uid),this.view.style.hidden=!0,this.view.style.backgroundColor="#00000000",this.view.on("click",(function(t){(0,f.isValidClick)(t)&&e.click()}))}},{key:"click",value:function(){var e=this;this.$logger("click");var t=this.getEvents("onClick"),n=!1;t.forEach((function(t){e.$emit(t),t.keep&&(n=!0)})),n||(this.view.style.hidden=!0)}},{key:"onLoggerEvent",value:function(e){"click"===e&&this.click()}},{key:"updated",value:function(e){(0,h.isPositionAndSizeChange)(e)&&this.updatePositionAndSize()}},{key:"actived",value:function(){this.updatePositionAndSize()}},{key:"updatePositionAndSize",value:function(){var e=this,t=(0,h.calPositionAndSizeByParams)(this.getParams(h.PositionAndSizeKeys));Object.keys(t).forEach((function(n){e.view.style[n]=t[n]}));var n=this.getParams(["visible","color"]),i=n.visible,a=n.color;this.view.style.hidden=!(null==i?void 0:i.value),(null==a?void 0:a.value)&&(this.view.style.backgroundColor=a.value)}}]),n}(r.default);p.ListenerFrameType=a.FrameType.createRect,t.default=p},4281:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(9497),o=i(n(6492)),s=i(n(4767)),h=function(e){u(n,e);var t=c(n);function n(){l(this,n);for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];return t.call.apply(t,[this].concat(i))}return d(n,[{key:"actived",value:function(){var e,t,n,i=this.getParams(["sceneId","dimension","metric"]),r=i.sceneId,o=i.dimension,u=i.metric;s.default.eventEmitter.emit(this.viewer,a.ViewerBaseCaseType.Report,{sceneId:Number(null===(e=null==r?void 0:r.value)||void 0===e?void 0:e.toString()),dimension:null===(t=null==o?void 0:o.value)||void 0===t?void 0:t.toString(),metric:null===(n=null==u?void 0:u.value)||void 0===n?void 0:n.toString()})}}]),n}(o.default);h.ListenerFrameType=r.FrameType.report,t.default=h},5754:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(4469),r=n(9497),o=i(n(6492)),s=i(n(4767)),h=function(e){u(n,e);var t=c(n);function n(){l(this,n);for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];return t.call.apply(t,[this].concat(i))}return d(n,[{key:"actived",value:function(){var e,t=(null===(e=this.getParams("num"))||void 0===e?void 0:e.num.value.toString())||"0";s.default.eventEmitter.emit(this.viewer,a.ViewerBaseCaseType.ReportCheckPointCount,t)}}]),n}(o.default);h.ListenerFrameType=r.FrameType.reportCheckPointCount,t.default=h},2520:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=function(e){u(n,e);var t=c(n);function n(){var e;l(this,n);for(var i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return(e=t.call.apply(t,[this].concat(a))).watch={cancel:function(t,n){e.timeoutHandler&&t.value&&(clearTimeout(e.timeoutHandler),e.timeoutHandler=null,e.getEvents("onCancel").forEach((function(t){e.$emit(t)})))}},e}return d(n,[{key:"actived",value:function(){var e=this,t=this.getParams(["timeout","cancel"]),n=t.timeout;if(!t.cancel.value){var i=Math.max(Number(n.value.toString())||0,1);this.timeoutHandler=setTimeout((function(){e.timeoutHandler=null,e.getEvents("onEnded").forEach((function(t){e.$emit(t)}))}),i)}}}]),n}(i(n(6492)).default);r.ListenerFrameType=a.FrameType.setTimeout,t.default=r},1762:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(9497),r=function(e){u(n,e);var t=c(n);function n(){var e;l(this,n);for(var i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return(e=t.call.apply(t,[this].concat(a))).watch={value:function(t,n){t.value!=n.value&&e.getEvents("onChanged").forEach((function(t){e.$emit(t)})),e.getEvents("onChange").forEach((function(t){e.$emit(t)}))}},e}return d(n)}(i(n(6492)).default);r.ListenerFrameType=a.FrameType.var,t.default=r},2837:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a,r=n(4469),o=n(8251),s=n(9497),h=n(5667),f=i(n(6492)),p=i(n(4767)),m=n(4566),g=i(n(7151)),v=i(n(8851));!function(e){e[e.env=0]="env",e[e.user=1]="user",e[e.record=2]="record"}(a||(a={}));var y=function(e){u(n,e);var t=c(n);function n(){var e;l(this,n);for(var i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return(e=t.call.apply(t,[this].concat(a))).playStatus=!1,e.actualPlayStatus=!1,e.lastSeriousTimePosition=-1,e.autoPlay=!1,e.loggerMode=!1,e.playAtTimes=[],e.watch={playing:function(t,n){var i,a;t.value?(null===(a=e.video)||void 0===a||a.play(),e.playStatus=!0):(null===(i=e.video)||void 0===i||i.pause(),e.playStatus=!1)},visible:function(t,n){e.video&&(e.video.style.hidden=!t.value)},objectFit:function(t,n){e.video&&(e.video.objectFit=t.value)},seek:function(t,n){var i,a=Number(t.value.toString());null===(i=e.video)||void 0===i||i.seek(a)},loop:function(t,n){e.video&&(e.video.loop=!!t.value)},autoPlay:function(t,n){e.video&&(e.video.autoplay=!!t.value)}},e.nextPlayPosition=-1,e}return d(n,[{key:"created",value:function(){this.uid=v.default.addVideo(),this.$logger({t:a.record})}},{key:"domMounted",value:function(){var e=this;this.video=(0,g.default)().getHandler(this.uid),this.video.muted=!1,this.updatePositionAndSize(),this.video.style.hidden=!0,this.video.onEnded((function(){e.getParams(["loop"]).loop.value||(e.playStatus=!1),e.getEvents("onEnded").forEach((function(t){e.$emit(t)}))})),this.video.onError((function(t){var n=e.getParams(["url"]).url,i={type:o.ExceptionType.Video,errmsg:"视频URL:[".concat(n.value.toString(),"] 播放失败")};p.default.eventEmitter.emit(e.viewer,r.ViewerBaseCaseType.Exception,i)})),this.video.onProgress((function(){e.weakNetworkHandlerLevel2||(e.weakNetworkHandlerLevel2=setTimeout((function(){e.weakNetworkHandlerLevel2=null,e.nextPlayPosition!==e.lastSeriousTimePosition&&(e.lastSeriousTimePosition=e.nextPlayPosition,e.pushWeakNetworkMsg(h.WeakNetWorkLevel.serious))}),h.WeakTimeoutMap[h.WeakNetWorkLevel.serious]))})),this.video.onPlay((function(){e.$logger({t:a.env,a:"onPlay"}),e.getEvents("onPlay").forEach((function(t){e.$emit(t)})),e.playStatus=!0,e.onTimeUpdate({position:0})})),this.video.onWaiting((function(){e.weakNetworkHandlerLevel1=setTimeout((function(){e.weakNetworkHandlerLevel1=null,e.pushWeakNetworkMsg(h.WeakNetWorkLevel.slight)}),h.WeakTimeoutMap[h.WeakNetWorkLevel.slight])})),this.video.onTimeUpdate(this.onTimeUpdate.bind(this))}},{key:"onTimeUpdate",value:function(e){this.actualPlaySetting(),this.checkPlayAtTimes(e),this.clearWeakNetworkCheck()}},{key:"actualPlaySetting",value:function(){var e=this;this.actualPlayStatus||this.$logger({t:a.env,a:"play"}),this.actualPlayStatus=!0,this.actualPlayTimeoutHandler&&clearTimeout(this.actualPlayTimeoutHandler),this.playStatus&&(this.actualPlayTimeoutHandler=setTimeout((function(){e.actualPlayStatus=!1,e.actualPlayTimeoutHandler=null,e.$logger({t:a.env,a:"pause"})}),1e3))}},{key:"actived",value:function(){var e=this;this.updatePositionAndSize();var t=this.getParams(["autoPlay","url","objectFit","loop"]),n=t.autoPlay,i=t.url,a=t.objectFit,r=t.loop;this.getEvents("onPlayTimeAt").forEach((function(t){e.playAtTimes.push({eventHander:t,sec:t.params.sec.value})})),this.video.loop=!!r.value,this.video.style.hidden=!1,this.video.objectFit=a,this.autoPlay=!!n.value,this.video.autoplay=!this.loggerMode&&this.autoPlay,this.video.src=i.value.toString()}},{key:"updated",value:function(e){(0,m.isPositionAndSizeChange)(e)&&this.updatePositionAndSize()}},{key:"onLoggerEvent",value:function(e){switch(e.t){case a.record:this.loggerMode=!0;break;case a.env:switch(e.a){case"weak":this.pushWeakNetworkMsg(e.p);break;case"onPlay":this.autoPlay&&this.video&&(this.video.autoplay=!0,this.video.play(),this.playStatus=!0);break;case"pause":this.video&&this.video.pause();break;case"play":this.video&&this.video.play()}}}},{key:"destory",value:function(){this.playStatus=!1,this.clearWeakNetworkCheck(),this.actualPlayTimeoutHandler&&clearTimeout(this.actualPlayTimeoutHandler)}},{key:"updatePositionAndSize",value:function(){var e=this,t=(0,m.calPositionAndSizeByParams)(this.getParams(m.PositionAndSizeKeys));Object.keys(t).forEach((function(n){e.video.style[n]=t[n]}));var n=this.getParams("visible").visible;this.video.style.hidden=!n}},{key:"checkPlayAtTimes",value:function(e){var t=this;this.playAtTimes.forEach((function(n,i){var a=n.sec;t.nextPlayPosition<=e.position?a>=t.nextPlayPosition&&a<e.position&&(t.playAtTimes.splice(i,1),t.$emit(n.eventHander)):(a>=t.nextPlayPosition||a<e.position)&&(t.playAtTimes.splice(i,1),t.$emit(n.eventHander))})),this.nextPlayPosition=e.position}},{key:"clearWeakNetworkCheck",value:function(){this.weakNetworkHandlerLevel1&&(clearTimeout(this.weakNetworkHandlerLevel1),this.weakNetworkHandlerLevel1=null),this.weakNetworkHandlerLevel2&&(clearTimeout(this.weakNetworkHandlerLevel2),this.weakNetworkHandlerLevel2=null)}},{key:"pushWeakNetworkMsg",value:function(e){if(this.playStatus){this.$logger({t:a.env,a:"weak",p:e});var t={url:this.getParams(["url"]).url.value.toString(),level:e};p.default.eventEmitter.emit(this.viewer,r.ViewerBaseCaseType.WeakNetWork,t)}}}]),n}(f.default);y.ListenerFrameType=s.FrameType.createVideo,t.default=y},2327:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getWxCommonFont=t.getPrivateFileSystemManager=t.instanceId=t.setFileSpaceStatistics=t.env=t.xmlParser=t.webviewLayout=t.init=t.create=t.removePrivateThis=t.getPrivateThis=t.Component=t.coverview=t.gameTransfer=t.document=t.reportKeyValue=t.canvas=t.pluginWx=t.wx=void 0;var a,r,o=i(n(4293)),s=n(5327),u=o.default.env;if(t.env=u,u.isMiniGamePlugin){var c=u.pluginEnv,h=c.customEnv;t.wx=a=u.wx,t.canvas=h.canvas,t.document=h.document,t.instanceId=c.instanceId||"",t.setFileSpaceStatistics=c.setFileSpaceStatistics,t.getPrivateFileSystemManager=c.getPrivateFileSystemManager,t.coverview=r=c.coverview,t.getWxCommonFont=c.getWxCommonFont,r?(t.Component=r.Component,t.getPrivateThis=r.getPrivateThis,t.removePrivateThis=r.removePrivateThis,t.create=r.create,t.init=r.init,t.webviewLayout=r.webviewLayout,t.xmlParser=r.xmlParser):t.Component=d((function e(){l(this,e)}))}else t.reportKeyValue=function(){},t.gameTransfer=function(){},t.Component=function(){},t.getPrivateThis=function(e){return e},t.instanceId="";s.common.wx=a},821:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isValidClick=void 0,t.isValidClick=function(e){var t=e.absoluteX,n=e.absoluteY,i=e.absoluteEndX,a=e.absoluteEndY,r=e.pressInterval,o=!1;return Math.abs(a-n)<30&&Math.abs(i-t)<30&&r<300&&(o=!0),o}},4566:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.isPositionAndSizeChange=t.PositionAndSizeKeys=t.isPercent=t.percentCal=t.calPositionAndSize=t.calPositionAndSizeByParams=void 0;var i=n(6355);function a(e){Object.keys(e).forEach((function(t){if("opacity"!==t&&void 0!==e[t]){var n="width"===t||"left"===t||"right"===t?i.screenWidth:i.screenHeight,a=function(e,t){var n=/^(calc\()([\s\S]*?)(\))$/.exec(e);if(null==n)return null;for(var i=n[2].replace(/(\d+)%/g,(function(e,n){return String(n/100*t)})).replace(/\.\d+/,""),a=!0;a;){var r=i.replace(/\.\d+/,"");if(i==r){a=!1;break}i=r}for(var o=[],s=[],u="",c={"+":1,"-":1,"*":2,"/":2},l=function(){var e,t=o.pop(),n=o.pop();switch(s.pop()){case"+":e=n+t;break;case"-":e=n-t;break;case"*":e=n*t;break;case"/":e=n/t}o.push(e)},d=0;d<i.length;d++){var h=i[d];if(/\d/.test(h))u+=h;else{for(u&&(o.push(parseInt(u)),u="");s.length>0&&c[s[s.length-1]]>=c[h];)l();s.push(h)}}for(u&&o.push(parseInt(u));s.length>0;)l();return o.pop()}(e[t],n);a&&(e[t]=a)}}));var t=e.width,n=e.height,a=e.left,u=e.top,c=e.right,l=e.bottom,d=o(a),h=o(u),f=o(c),p=o(l);if(void 0===t){if(void 0===a||void 0===c)return null;if(d||f)return null;t=i.screenWidth-Number(a)-Number(c)}else"string"==typeof t&&(t=r(t,i.screenWidth)),f&&!d&&(a=100-s("".concat(c))+"%",d=!0),d&&(a=i.screenWidth*s("".concat(a))/100-t/2),void 0!==a?c=i.screenWidth-t-Number(a):void 0!==c&&(a=i.screenWidth-t-Number(c));if(void 0===n){if(void 0===u||void 0===l)return null;if(h||p)return null;n=i.screenHeight-Number(u)-Number(l)}else"string"==typeof n&&(n=r(n,i.screenHeight)),p&&!h&&(u=100-s("".concat(l))+"%",h=!0),h&&(u=i.screenHeight*s("".concat(u))/100-n/2),void 0!==u?l=i.screenHeight-n-Number(u):void 0!==l&&(u=i.screenHeight-n-Number(l));return Object.assign(e,{width:t,height:n,left:Number(a),right:Number(c),top:Number(u),bottom:Number(l)})}function r(e,t){return"number"==typeof e?e:s(e)/100*t}function o(e){return"string"==typeof e&&/^(100|[1-9]?\d)%$/.test(e)}function s(e){var t=/^(\d+)%$/.exec(e);return t?parseInt(t[1],10):0}t.calPositionAndSizeByParams=function(e,t){var n,i,r,o,s,u,c,l,d;return a({width:(null==t?void 0:t.width)?t.width.value:null===(n=e.width)||void 0===n?void 0:n.value,height:(null==t?void 0:t.height)?t.height.value:null===(i=e.height)||void 0===i?void 0:i.value,left:(null==t?void 0:t.left)?t.left.value:null===(r=e.left)||void 0===r?void 0:r.value,right:(null==t?void 0:t.right)?t.right.value:null===(o=e.right)||void 0===o?void 0:o.value,top:(null==t?void 0:t.top)?t.top.value:null===(s=e.top)||void 0===s?void 0:s.value,bottom:(null==t?void 0:t.bottom)?t.bottom.value:null===(u=e.bottom)||void 0===u?void 0:u.value,scaleHeight:(null==t?void 0:t.scaleHeight)?t.scaleHeight.value:null===(c=e.scaleHeight)||void 0===c?void 0:c.value,scaleWidth:(null==t?void 0:t.scaleWidth)?t.scaleWidth.value:null===(l=e.scaleWidth)||void 0===l?void 0:l.value,opacity:(null==t?void 0:t.opacity)?t.opacity.value:null===(d=e.opacity)||void 0===d?void 0:d.value})||{}},t.calPositionAndSize=a,t.percentCal=r,t.isPercent=o,t.PositionAndSizeKeys=["left","right","top","bottom","width","height","opacity","scaleHeight","scaleWidth"],t.isPositionAndSizeChange=function(e){for(var n=0,i=Object.keys(e);n<i.length;n++){var a=i[n];if(-1!==t.PositionAndSizeKeys.indexOf(a))return!0}return!1}},1388:function(e,t,a){var r,o;a.d(t,{QD:function(){return r},C2:function(){return o},ZP:function(){return u},Mi:function(){return h}}),function(e){e.STRING="STRING",e.LONGLONG="LONGLONG",e.UINT="UINT",e.INT="INT"}(r||(r={})),function(e){e.SvrReport="SvrReport",e.KvStat="KvStat"}(o||(o={}));var s=i(i(i(i({},r.STRING,(function(e){return"string"==typeof e&&e.length<=1024})),r.LONGLONG,(function(e){return"number"==typeof e&&Math.floor(e)===e})),r.UINT,(function(e){return"number"==typeof e&&Math.floor(e)===e&&e>=0})),r.INT,(function(e){return"number"==typeof e&&Math.floor(e)===e})),u=function(){function e(t){var n=t.logid,i=t.schemas,a=void 0===i?{}:i,r=t.base,o=t.debug,s=void 0!==o&&o,u=t.namespace,c=void 0===u?"":u,d=t.skipValidateInProdEnv,h=void 0===d||d;l(this,e),this.debug=!1,this.base={},this.namespace="",this.skipValidateInProdEnv=!0,this.asyncGetBase=function(){return Promise.resolve({})},this.logid=n,this.schemas=a,r&&this.setBase(r),this.debug=s,this.skipValidateInProdEnv=h,this.namespace=c?" ".concat(c," "):" "}return d(e,[{key:"setBase",value:function(e){this.validate(e),this.base=Object.assign(Object.assign({},this.base),e)}},{key:"validate",value:function(e){if((this.debug||!this.skipValidateInProdEnv)&&Object.keys(this.schemas).length)for(var t=0,i=Object.entries(e);t<i.length;t++){var a=n(i[t],2),r=a[0],o=a[1];if(void 0!==o){var s=this.schemas[r];s?this.validateColumn(s,o)||console.error("[minigamefe".concat(this.namespace,"SchemaValidator]: logid ").concat(this.logid,": ").concat(r," should be ").concat(s,", but now ").concat(o)):console.warn("[minigamefe".concat(this.namespace,"SchemaValidator]: logid").concat(this.logid,": ").concat(r," 缺少类型定义"))}}}},{key:"validateColumn",value:function(e,t){return s[e](t)}}]),e}(),c="";function h(e,t,n){c?e&&e(c):(t({success:function(t){c=t.networkType,e&&e(c)}}),n((function(t){c=t.networkType,t.isConnected||(c="none"),e&&e(c)})))}},9512:function(e,t,i){function a(){}function o(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=arguments.length>1?arguments[1]:void 0,n=(t?"":"!#%()*+,-./:;=?@[]^_`{|}~")+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=n.length,a=[],r=0;r<e;r++)a[r]=n.charAt(Math.random()*i);return a.join("")}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0.0.0",t=arguments.length>1?arguments[1]:void 0;if("string"!=typeof e||"string"!=typeof t)return"string"!=typeof e&&"string"!=typeof t?0:"string"!=typeof e?1:-1;for(var n=e.split("."),i=t.split("."),a=Math.max(n.length,i.length);n.length<a;)n.push("0");for(;i.length<a;)i.push("0");for(var r=0;r<a;r++){var o=parseInt(n[r],10),s=parseInt(i[r],10);if(o>s)return 1;if(o<s)return-1}return 0}function u(e){return"number"==typeof e&&isFinite(e)}function c(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length,a=new Array(i>3?i-3:0),r=3;r<i;r++)a[r-3]=arguments[r];return new Promise((function(i,r){!function t(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e.apply(null,[].concat(a,[o])).then(i).catch((function(e){o>0?setTimeout((function(){t(o-1)}),n):r(e)}))}(t)}))}function l(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e,null]}))}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd";if(!e)return"";for(var i=t,a=10===String(e).toString().length?new Date(1e3*e):new Date(e),r={"y+":a.getFullYear(),"M+":a.getMonth()+1,"d+":a.getDate(),"h+":a.getHours(),"m+":a.getMinutes(),"s+":a.getSeconds(),"q+":Math.floor((a.getMonth()+3)/3),"S+":a.getMilliseconds()},o=function(){var e=n(u[s],2),t=e[0],a=e[1],r=new RegExp("(".concat(t,")"));if(r.test(i)){var o=i.match(r),c=n(o,1)[0];i=i.replace(r,(function(){return"00".concat(a).slice(-"".concat(c).length)}))}},s=0,u=Object.entries(r);s<u.length;s++)o();return i}function h(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return!e;if(e instanceof Error)return""===e.message;switch(Object.prototype.toString.call(e)){case"[object String]":case"[object Array]":return!e.length;case"[object File]":case"[object Map]":case"[object Set]":return!e.size;case"[object Object]":return!Object.keys(e).length}return!1}function f(e){return"[object String]"===Object.prototype.toString.call(e)}function p(e){return"[object Object]"===Object.prototype.toString.call(e)}function m(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function g(e){return void 0===e}function v(e){var t=e;try{"object"==r(e)&&(t="string"==typeof e.errMsg?e.errMsg:"string"==typeof e.errmsg?e.errmsg:"string"==typeof e.message?e.message:JSON.stringify(e))}catch(e){console.error(e)}return t}function y(e,t,n){if(!n)return e;var i=e,a=new RegExp("([?&])".concat(t,"=.*?(&|$)"),"i");if(i.match(a))return i.replace(a,"$1".concat(t,"=").concat(n,"$2"));var r=-1!==i.indexOf("?")?"&":"?",o=i.split("#");return i="".concat(o[0]+r+t,"=").concat(n),o[1]&&(i+="#".concat(o[1])),i}i.d(t,{YP:function(){return a},hQ:function(){return o},yC:function(){return s},hj:function(){return u},gj:function(){return c},zI:function(){return l},p6:function(){return d},xb:function(){return h},HD:function(){return f},Kn:function(){return p},mf:function(){return m},o8:function(){return g},bV:function(){return v},vr:function(){return y}})},9580:function(e,t,n){var i,a,r,o,s;n.d(t,{t4:function(){return i},tE:function(){return r},dg:function(){return o},vm:function(){return s}}),function(e){e.devtools="devtools",e.android="android",e.ios="ios",e.windows="windows",e.mac="mac"}(i||(i={})),function(e){e.portrait="portrait",e.landscape="landscape",e.landscapeLeft="landscapeLeft",e.landscapeRight="landscapeRight"}(a||(a={})),function(e){e.DEVELOP="develop",e.TRIAL="trial",e.RELEASE="release"}(r||(r={})),function(e){e[e.release=1]="release",e[e.develop=2]="develop",e[e.trial=3]="trial"}(o||(o={})),function(e){e[e.Android=0]="Android",e[e.IOSJscore=1]="IOSJscore",e[e.IOSWK=2]="IOSWK",e[e.UnKnow=3]="UnKnow",e[e.PC=4]="PC",e[e.Devtools=5]="Devtools",e[e.IPadJscore=6]="IPadJscore",e[e.IPadWK=7]="IPadWK",e[e.IOSWKPlus=8]="IOSWKPlus",e[e.IPadWKPlus=9]="IPadWKPlus"}(s||(s={}))},2662:function(e,t,n){n.d(t,{Z:function(){return T}});var i,a,r,o,s,u=n(9512),c=n(7974),l=n(9580),d="undefined"!=typeof mb&&void 0!==mb.env,h=!("undefined"==typeof pluginEnv),f=!d&&"undefined"!=typeof wx&&"undefined"!=typeof Page,p=!(d||"undefined"==typeof wx||f)||h,m={isMagicBrush:d,isMiniGamePlugin:h,isMiniGame:p,isMiniProgram:f,isIOS:!1,isAndroid:!1,isDevtools:!1,isWindows:!1,isMac:!1,isPC:!1,isWK:!1,isWKPlus:!1,isIPad:!1,systemInfo:{},accountInfo:{},wx:{},runtimeType:l.vm.UnKnow,pluginWx:{},pluginAppId:"",pluginVersion:""};function g(e){var t;if(m.systemInfo=e,m.systemInfo.screenWidth||m.systemInfo.screenWidth||(m.systemInfo.screenWidth=0,m.systemInfo.screenHeight=0),m.runtimeType=(0,c.$)(m.systemInfo),v(m.systemInfo),(0,u.yC)(m.systemInfo.SDKVersion,"2.24.4")>=0&&(null===(t=m.pluginWx)||void 0===t?void 0:t.getAccountInfoSync))try{var n=(m.pluginWx.getAccountInfoSync()||{}).plugin,i=void 0===n?{}:n;m.pluginAppId=i.appId,m.pluginVersion=i.version}catch(e){console.error(e)}}function v(e){var t,i=null===(t=e.platform)||void 0===t?void 0:t.toLocaleLowerCase();i===l.t4.devtools?m.isDevtools=!0:i===l.t4.ios?(m.isIOS=!0,m.isWK=!!(null===n.g||void 0===n.g?void 0:n.g.isIOSHighPerformanceMode),m.isWKPlus=!!(null===n.g||void 0===n.g?void 0:n.g.isIOSHighPerformanceModePlus)):i===l.t4.android?m.isAndroid=!0:i===l.t4.windows?m.isWindows=!0:i===l.t4.mac?m.isMac=!0:void 0===i&&(m.isIOS=!0),(m.isWindows||m.isMac)&&(m.isPC=!0),e.model&&e.model.indexOf("iPad")>-1&&(m.isIPad=!0)}if(p||f){if(h){var y=pluginEnv.customEnv;y&&y.customEnv&&(pluginEnv.customEnv=y.customEnv),"undefined"!=typeof wx&&(m.pluginWx=wx),pluginEnv.customEnv?m.wx=pluginEnv.customEnv.wx?pluginEnv.customEnv.wx:m.pluginWx:m.wx=m.pluginWx}else m.wx=wx;if(m.wx){try{g(m.wx.getSystemInfoSync()),m.wx.getSystemInfo({success:function(e){g(e)}})}catch(e){console.error(e)}try{m.accountInfo=null!==(r=null===(a=(i=m.wx).getAccountInfoSync)||void 0===a?void 0:a.call(i))&&void 0!==r?r:{}}catch(e){console.error(e)}}}else d&&mb.JSBridge.invoke("getSystemInfoSync",{},(function(e){m.systemInfo=e,m.runtimeType=(0,c.$)(m.systemInfo),v(m.systemInfo)}));null===(s=(o=m.wx).onDeviceOrientationChange)||void 0===s||s.call(o,(function(){m.wx.getSystemInfo({success:function(e){m.systemInfo=e||{}}})})),h&&(m.pluginEnv=pluginEnv);var T=m},6835:function(e,t,n){n.d(t,{Z:function(){return s}});var i=n(9512),a=n(1388),o=n(9580),s=function(e){u(n,e);var t=c(n);function n(e){var i,r=e.reportFunc,o=e.logid,s=e.schemas,u=void 0===s?{}:s,c=e.base,d=e.reportType,h=e.asyncGetBase,f=void 0===h?function(){return Promise.resolve({})}:h,p=e.debug,m=e.namespace,g=void 0===m?"":m,v=e.skipValidateInProdEnv,y=void 0===v||v;return l(this,n),(i=t.call(this,{logid:o,schemas:u,base:c,debug:p,namespace:g,skipValidateInProdEnv:y})).reportType=a.C2.SvrReport,i.asyncGetBase=f,r||console.error("[minigamefe".concat(i.namespace,"GameTransferReport]: 未传入上报函数。")),i.reportFunc=r,void 0!==d&&(i.reportType=d),i}return d(n,[{key:"setKvStatBase",value:function(e,t){if(this.reportType===a.C2.KvStat){var n=(e.system||"").split(" ");Object.assign(this.schemas,{DeviceModel:a.QD.STRING,DeviceBrand:a.QD.STRING,OsName:a.QD.STRING,OsVersion:a.QD.STRING,LanguageVersion:a.QD.STRING,Count:a.QD.UINT,AppId:a.QD.STRING,AppVersion:a.QD.UINT,AppState:a.QD.UINT}),this.setBase({DeviceModel:e.model||"",DeviceBrand:e.brand||"",OsName:n[0]||"",OsVersion:n[1]||"",LanguageVersion:e.language||"",Count:1}),(null==t?void 0:t.miniProgram)&&this.setBase({AppState:o.dg[t.miniProgram.envVersion]||o.dg.release,AppId:t.miniProgram.appId,AppVersion:0})}}},{key:"send",value:function(e,t){var n=this;if(this.reportFunc&&"function"==typeof this.reportFunc){var o,s=[],u=this.logid;o=Array.isArray(e)?e:[e],this.asyncGetBase().then((function(e){n.setBase(e),o.forEach((function(e){var t=Object.assign(Object.assign({},n.base),e);if(t.ExternInfo&&"object"==r(t.ExternInfo)&&n.schemas.ExternInfo===a.QD.STRING&&(t.ExternInfo=encodeURIComponent(JSON.stringify(t.ExternInfo))),n.validate(t),n.reportType===a.C2.KvStat){var i=Math.floor(Date.now()/1e3);Object.assign(t,{StartTime:i,EndTime:i})}var o={log_id:n.logid,custom_data:t};s.push(o),n.debug&&console.log("[minigamefe".concat(n.namespace,"GameTransferReport]: ").concat(u,","),t)}));var c={report_list:s};n.reportFunc({req_path:"comm_datareport",json_data:JSON.stringify(c),success:function(){t&&t(u,JSON.stringify(c))},fail:function(e){console.error(e),t&&t(u,(0,i.bV)(e))}})}))}else console.error("[minigamefe GameTransferReport]: 未传入上报函数!!!")}}]),n}(a.ZP)},9054:function(e,t,n){n.d(t,{Z:function(){return r}});var i=n(1388),a={19283:"GameComponent",19335:"GameWhatsNew",20285:"MidasFriendPayment",21494:"WXGameWASMLaunchClose",21493:"WXGameWASMLaunchException",21492:"WXGameWASMLaunchTime",21898:"GameLifeMiniGameCardAction",20267:"GameAdsSkipCard"},r=function(e){u(n,e);var t=c(n);function n(e){var i,r=e.reportFunc,o=e.logid,s=e.protocolParams,u=e.schemas,c=e.base,d=e.asyncGetBase,h=void 0===d?function(){return Promise.resolve({})}:d,f=e.debug,p=e.namespace,m=void 0===p?"":p,g=e.skipValidateInProdEnv,v=void 0===g||g;l(this,n);var y=o;return"number"==typeof o&&a[o]&&(y=a[o],f&&console.warn("[minigamefe".concat(m?" ".concat(m," "):" ","KeyValueReporter]: logid ").concat(o," auto map to ").concat(y,"!"))),(i=t.call(this,{logid:y,schemas:u,base:c,debug:f,namespace:m,skipValidateInProdEnv:v})).asyncGetBase=h,r||console.error("[minigamefe".concat(i.namespace,"KeyValueReporter]: 未传入上报函数。")),i.reportFunc=r||function(){},i.protocolParams=s,i.sendCbk=null,i}return d(n,[{key:"setAppInfoBase",value:function(e){Object.assign(this.schemas,{AppId:i.QD.STRING,AppVersion:i.QD.UINT,AppState:i.QD.UINT}),this.protocolParams.unshift("AppId","AppVersion","AppState"),this.setBase(e)}},{key:"send",value:function(e,t){var n,i=this;n=Array.isArray(e)?e:[e],this.asyncGetBase().then((function(e){i.setBase(e),n.forEach((function(e){var n=Object.assign(Object.assign({},i.base),e);i.validate(n);var a=[];i.protocolParams.forEach((function(e){var t=void 0!==n[e]?n[e]:"";a.push(t)})),i.reportFunc({key:i.logid,value:a.map(encodeURIComponent).join(","),immediately:!0});var r=t||i.sendCbk;r&&r(i.logid,a.map(encodeURIComponent).join(",")),i.debug&&(n.IsError?console.error:console.log)("[minigamefe".concat(i.namespace,"keyValueReport]: ").concat(i.logid),n)}))}))}}]),n}(i.ZP)},4293:function(e,t,i){i.r(t),i.d(t,{default:function(){return Z}});var a={};i.r(a),i.d(a,{navigateToMiniProgram:function(){return s}});var o=i(2662);function s(e){o.Z.wx.navigateToMiniProgram&&(o.Z.pluginEnv&&o.Z.pluginEnv.navigateToMiniProgramDirectly?o.Z.pluginEnv.navigateToMiniProgramDirectly({appId:e}):o.Z.wx.navigateToMiniProgram({appId:e}))}JSON.parse;var h,f=JSON.stringify,p=(Object.keys,String),m="object",g=function(e,t){return t},v=function(e,t,n){var i=p(t.push(n)-1);return e.set(n,i),i};!function(e){e.log="log",e.info="info",e.warn="warn",e.error="error"}(h||(h={}));var y,T,S=function(){function e(t){var n=t.reportFunc,i=t.base,a=t.debug,r=t.delimiter,o=t.namespace;l(this,e),this.reportFunc=null,this.debug=!1,this.base={},this.delimiter=" ",this.namespace="",n?(this.reportFunc=n,i&&this.setBase(i),this.debug=!!a,r&&(this.delimiter=r),this.namespace=o?" ".concat(o," "):" "):console.error("[minigamefe XLog]: 未传入上报函数。")}return d(e,[{key:"setBase",value:function(e){this.base=Object.assign(Object.assign({},this.base),e)}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.report(h.log,t)}},{key:"info",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.report(h.info,t)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.report(h.warn,t)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.report(h.error,t)}},{key:"getLogStr",value:function(e,t){var n,i=this;if(!this.reportFunc)return console.error("[minigamefe".concat(this.namespace,"XLog]: 未传入上报函数。")),"";if(!t)return"";var a="";t.forEach((function(e){a.length>0&&(a+=i.delimiter);var t=e;"object"==r(t)&&(t=t instanceof TypeError?t.message:function(e,t,n){for(var i=t&&r(t)===m?function(e,n){return""===e||-1<t.indexOf(e)?n:void 0}:t||g,a=new Map,o=[],s=[],u=+v(a,o,i.call({"":e},"",e)),c=!u;u<o.length;)c=!0,s[u]=f(o[u++],l,n);return"["+s.join(",")+"]";function l(e,t){if(c)return c=!c,t;var n=i.call(this,e,t);switch(r(n)){case m:if(null===n)return n;case"string":return a.get(n)||v(a,o,n)}return n}}(t)),a+="".concat(String(t).trim())}));var o="[minigamefe".concat(this.namespace,"XLog]: ").concat(JSON.stringify(Object.assign(Object.assign({},this.base),{type:e,content:a})));return this.debug&&(null===(n=console[e])||void 0===n||n.call(console,o)),o}},{key:"report",value:function(e,t){var n=this.reportFunc;if(n)if(n[e]&&"function"==typeof n[e]){var i=this.getLogStr(e,t);i&&n[e](i)}else console.error("[minigamefe".concat(this.namespace,"XLog]: 传入的上报函数格式不对。"));else console.error("[minigamefe".concat(this.namespace,"XLog]: 未传入上报函数。"))}}]),e}(),P=i(820),k=new(function(){function e(){l(this,e),this.options={debug:!1,logReport:!1,qualityReportType:P.ql.KeyValueReport,pluginAppId:"",pluginVersion:"",xlogName:"minigamefe"}}return d(e,[{key:"set",value:function(e){Object.assign(this.options,e)}},{key:"get",value:function(e){return this.options[e]}}]),e}()),E=function(){function e(t){l(this,e),this.identifier="".concat(k.get("pluginAppId")||o.Z.pluginAppId,"/plugin.js"),this.quality=t,this.init()}return d(e,[{key:"init",value:function(){var e,t,n=this;null===(t=null===(e=o.Z.wx)||void 0===e?void 0:e.onError)||void 0===t||t.call(e,(function(e){n.processError(e.message)}))}},{key:"processError",value:function(e){var t;if(e.indexOf(this.identifier)>-1){var n=e.split("\n"),i=n[0],a=null===(t=n[2])||void 0===t?void 0:t.split(":")[0];this.quality.innerReport({Type:P.C2.BadJs,Target:i,CostTime:0,Result:e,CustomKey1:a})}}}]),e}(),b=i(4279);!function(e){e.GAMETRANSFER_IS_NOT_EXIST="gameTransfer is not exist",e.REQUEST_IS_NOT_EXIST="request is not exist",e.UPLOADFILE_IS_NOT_EXIST="uploadFile is not exist",e.LOGIN_IS_NOT_EXIST="login is not exist",e.URL_IS_EMPTY="request url is empty.",e.HEADER_INVALID="request header is invalid",e.METHOD_IS_NOT_EXIST="method is not exist"}(y||(y={}));var C=function(e){u(n,e);var t=c(n);function n(){return l(this,n),t.apply(this,arguments)}return d(n)}(b.TinyEmitter);!function(e){e.login="login",e.gameTransfer="gameTransfer",e.request="request",e.uploadFile="uploadFile",e.downloadFile="downloadFile",e.webTransfer="webTransfer"}(T||(T={}));var w={QualityReportType:P.ql,RequestRejectType:y,ReportType:P.C2,PluginReportType:P.jJ},I=i(6835),R=i(9054),L=i(9512),M="https://game.weixin.qq.com",A="minigamefe_session_id",_=i(1388),D=i(9580),F=function(e){u(n,e);var t=c(n);function n(e){var i,a=e.reportFunc,r=e.logid,o=e.schemas,s=void 0===o?{}:o,u=e.base,c=e.debug,d=e.namespace,h=e.asyncGetBase,f=void 0===h?function(){return Promise.resolve({})}:h,p=e.reportType,m=e.skipValidateInProdEnv,g=void 0===m||m;return l(this,n),(i=t.call(this,{logid:r,schemas:s,base:u,debug:c,namespace:d,skipValidateInProdEnv:g})).reportType=_.C2.SvrReport,i.reportFunc=a,a||console.error("[minigamefe".concat(i.namespace,"RequestReport]: 未传入上报函数。")),i.asyncGetBase=f,void 0!==p&&(i.reportType=p),i}return d(n,[{key:"setKvStatBase",value:function(e,t){if(this.reportType===_.C2.KvStat){var n=(e.system||"").split(" ");Object.assign(this.schemas,{DeviceModel:_.QD.STRING,DeviceBrand:_.QD.STRING,OsName:_.QD.STRING,OsVersion:_.QD.STRING,LanguageVersion:_.QD.STRING,Count:_.QD.UINT,AppId:_.QD.STRING,AppVersion:_.QD.UINT,AppState:_.QD.UINT}),this.setBase({DeviceModel:e.model||"",DeviceBrand:e.brand||"",OsName:n[0]||"",OsVersion:n[1]||"",LanguageVersion:e.language||"",Count:1}),(null==t?void 0:t.miniProgram)&&this.setBase({AppState:D.dg[t.miniProgram.envVersion]||D.dg.release,AppId:t.miniProgram.appId,AppVersion:0})}}},{key:"send",value:function(e,t){var n=this;if(this.reportFunc&&"function"==typeof this.reportFunc){var i,a=[],r=this.logid;i=Array.isArray(e)?e:[e],this.asyncGetBase().then((function(e){var o;n.setBase(e),i.forEach((function(e){var t=Object.assign(Object.assign({},n.base),e);n.validate(t);var i={log_id:r,custom_data:t};a.push(i)}));var s=JSON.stringify({report_list:a});n.debug&&(o=console).log.apply(o,["[minigamefe".concat(n.namespace,"RequestReport]: ").concat(r)].concat(a)),n.reportFunc({url:"".concat(M,"/cgi-bin/comm/datareport"),method:"POST",header:{"content-type":"application/x-www-form-urlencoded"},data:s,success:function(){t&&t(r,JSON.stringify(s))},fail:function(e){console.error(e),t&&t(r,(0,L.bV)(e))}})}))}else console.error("[minigamefe RequestReport]: 未传入上报函数!!!")}}]),n}(_.ZP),x=["BenchmarkLevel","NetworkType","RuntimeType","PluginAppId","PluginVersion","Scene","SDKVersion","IsVisible","Type","Target","Params","Result","CostTime","ExternInfo","CustomKey1","CustomKey2","CustomKey3","IsError","FELibVersion","Query"],O={BenchmarkLevel:_.QD.UINT,NetworkType:_.QD.STRING,RuntimeType:_.QD.UINT,PluginAppId:_.QD.STRING,PluginVersion:_.QD.STRING,Scene:_.QD.UINT,SDKVersion:_.QD.STRING,IsVisible:_.QD.UINT,Type:_.QD.UINT,Target:_.QD.STRING,Params:_.QD.STRING,Result:_.QD.STRING,CostTime:_.QD.UINT,ExternInfo:_.QD.STRING,CustomKey1:_.QD.STRING,CustomKey2:_.QD.STRING,CustomKey3:_.QD.STRING,IsError:_.QD.UINT,FELibVersion:_.QD.STRING,Query:_.QD.STRING},N=i(7974),W="1.1.63";function B(e,t){var n=e||"";if((0,L.Kn)(n))try{n=JSON.stringify(n)}catch(e){console.error("[minigamefe stringify error]: ".concat(e)),n=""}else n=String(n);return n.length&&n.length>=1024&&(n=n.substr(0,1024),console.warn("[minigamefe stringify warning]: ".concat(t," 上报长度超过1024, 已裁剪"))),n}var V=function(){function e(t){var n,i,a;l(this,e),this.benchmarkLevel=0,this.network="",this.runtimeType=D.vm.UnKnow,this.sdkVersion="0.0.0",this.isVisible=P.Xu.Front,this.scene=0,this.query="",this.pluginAppId="",this.pluginVersion="",this.inited=!1;var r=t.systemInfo,o=t.launchInfo,s=t.onShow,u=t.onHide,c=t.pluginAppId,d=void 0===c?"":c,h=t.pluginVersion,f=void 0===h?"":h;if(!s||!u)return console.error("[minigamefe stringify warning]: please inject QualityConfig correctly"),void(this.inited=!1);this.inited=!0,this.onShow=s,this.onHide=u,this.benchmarkLevel=(r.benchmarkLevel||1)+100,this.sdkVersion=r.SDKVersion||"0.0.0",this.launchInfo=o,this.scene=(null===(n=this.launchInfo)||void 0===n?void 0:n.scene)||0,(0,L.xb)(null===(i=this.launchInfo)||void 0===i?void 0:i.query)||(this.query=encodeURIComponent(JSON.stringify(null===(a=this.launchInfo)||void 0===a?void 0:a.query))),this.runtimeType=(0,N.$)(r),this.pluginAppId=d,this.pluginVersion=f,this.bindNativeEvent(),this.reporter=function(e){var t,n=e.type,i=void 0===n?P.ql.KeyValueReport:n,a=e.reportKeyValue,r=e.debug,o=e.gameTransfer,s=e.systemInfo,u=e.accountInfo,c=e.getNetworkType,l=e.onNetworkStatusChange,d=e.request,h=e.namespace,f="";function p(){return new Promise((function(e){f?e({NetworkType:f}):c({success:function(t){f=t.networkType,e({NetworkType:f})},fail:function(){e({NetworkType:f="unknown"})}})}))}return i===P.ql.KeyValueReport?t=new R.Z({reportFunc:a,logid:26340,schemas:O,protocolParams:x,debug:r,namespace:h,asyncGetBase:p}):i===P.ql.GameTransferReport?(t=new I.Z({reportFunc:o,logid:26340,schemas:O,reportType:_.C2.KvStat,debug:r,namespace:h,asyncGetBase:p})).setKvStatBase(s,u):(console.warn("[minigamefe]: 当前选择 reqeust 进行质量上报, 请自行确保兼容性"),(t=new F({reportFunc:d,logid:26340,schemas:O,debug:r,namespace:h,asyncGetBase:p,reportType:_.C2.KvStat})).setKvStatBase(s,u)),i!==P.ql.GameTransferReport&&i!==P.ql.WxRequestReport||(0,_.Mi)((function(e){f=e,t.setBase({NetworkType:e})}),c,l),t}(t),this.reporter.setBase({BenchmarkLevel:this.benchmarkLevel,RuntimeType:this.runtimeType,Scene:+this.scene,SDKVersion:this.sdkVersion,IsVisible:this.isVisible,PluginAppId:d,PluginVersion:f,FELibVersion:W,Query:this.query})}return d(e,[{key:"bindNativeEvent",value:function(){var e=this;this.onHide((function(){e.isVisible=P.Xu.Background,e.reporter.setBase({IsVisible:e.isVisible})})),this.onShow((function(t){(0,L.xb)(null==t?void 0:t.query)||(e.query=encodeURIComponent(JSON.stringify(t.query))),e.isVisible=P.Xu.Front,e.reporter.setBase({IsVisible:e.isVisible,Query:e.query})}))}},{key:"innerReport",value:function(e){this.reporter.send(Object.assign(e,{CostTime:(0,L.hj)(e.CostTime)?e.CostTime:0,Params:B(e.Params,"Params"),Result:B(e.Result,"Result"),ExternInfo:B(e.ExternInfo,"ExternInfo")}))}},{key:"report",value:function(e){P.EM.indexOf(e.Type)>-1&&console.error("[minigamefe quality report]: 若为自定义上报, Type 请不要使用内置枚举值 ".concat(e.Type,", 内置枚举可见 mgp.consts.ReportType")),this.inited&&this.innerReport(e)}},{key:"setCustomKey",value:function(e){this.inited&&this.reporter.setBase({CustomKey1:e.CustomKey1&&B(e.CustomKey1,"CustomKey1")||"",CustomKey2:e.CustomKey2&&B(e.CustomKey2,"CustomKey2")||"",CustomKey3:e.CustomKey3&&B(e.CustomKey3,"CustomKey3")||""})}},{key:"clearCustomKey",value:function(){this.inited&&this.reporter.setBase({CustomKey1:"",CustomKey2:"",CustomKey3:""})}}]),e}(),U=function(){function e(t){l(this,e),this.sessionId="",this.login=t.login,this.request=t.request}return d(e,[{key:"getSessionId",value:function(e){var t=this;return this.checkSession().catch((function(){return t.loginWxGame(e)}))}},{key:"clearSessionId",value:function(){var e,t;this.sessionId="",null===(t=(e=o.Z.wx).removeStorageSync)||void 0===t||t.call(e,A)}},{key:"checkSession",value:function(){var e=this;return new Promise((function(t,n){var i,a,r,s,u=e.sessionId||(null===(a=(i=o.Z.wx).getStorageSync)||void 0===a?void 0:a.call(i,A));u?null===(s=(r=o.Z.wx).checkSession)||void 0===s||s.call(r,{success:function(){t({sessionId:u})},fail:function(t){e.clearSessionId(),n(t)}}):n({errMsg:"尚未保存sessionId"})}))}},{key:"loginWxGame",value:function(e){var t=this;return this.isLoginPromise||(this.isLoginPromise=new Promise((function(i,a){t.login({}).then((function(i){var a={code:n(i,1)[0].code};return e&&(a.appid=e),t.request({url:"".concat(M,"/cgi-bin/gameweappauthwap/login"),data:a,method:"POST"})})).then((function(e){var r,s,u=n(e,1)[0];u&&u.data?(o.Z.isMiniGamePlugin||null===(s=(r=o.Z.wx).setStorageSync)||void 0===s||s.call(r,A,u.data.session_id),t.sessionId=u.data.session_id||"",i({sessionId:u.data.session_id})):a({errMsg:"登录出错"})})).catch((function(){a({errMsg:"登录出错"})}))}))),this.isLoginPromise.finally((function(){t.isLoginPromise=void 0}))}}]),e}();function G(e,t){var n,i;if(!e)return"";var a=e,r=t;return r||(r=null===(i=(n=o.Z.wx).getStorageSync)||void 0===i?void 0:i.call(n,A)),r&&(a=(0,L.vr)(a,"session_id",r)),a}var j=function(e){u(n,e);var t=c(n);function n(e,i){var a;return l(this,n),(a=t.call(this)).startTime=0,a.costTime=0,a.resAsResponse=!1,a.options=e,a.requestFunc=i,a}return d(n,[{key:"optionsFilter",value:function(e){return e.sessionId&&(e.url=G(e.url,e.sessionId)),e}},{key:"send",value:function(){var e=this;this.startTime=Date.now();var t=this.options,n=Object.assign(t,{success:function(t){e.sourceResponse=t,e.costTime=Date.now()-e.startTime;var n=(e.resAsResponse?t:t.data)||{};if((0,L.HD)(n))try{n=JSON.parse(n)}catch(t){n={}}e.response=n,e.emit("success"),e.emit("complete",0)},fail:function(t){e.costTime=Date.now()-e.startTime,e.emit("error",t),e.emit("complete",1)}});this.requestFunc(n)}}]),n}(C),z=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,o.Z.isMiniGamePlugin?o.Z.pluginWx.request:o.Z.wx.request)}return d(n,[{key:"optionsFilter",value:function(e){return e.timeout=e.timeout||3e4,e.header&&(e.header=Object.assign({"content-type":"application/json; charset=utf-8"},e.header||{})),e.method=e.method?e.method.toUpperCase():"GET",e.sessionId&&(e.url=G(e.url,e.sessionId)),e}}]),n}(j),H=function(e){u(n,e);var t=c(n);function n(e){return l(this,n),t.call(this,e,o.Z.isMiniGamePlugin?o.Z.pluginWx.uploadFile:o.Z.wx.uploadFile)}return d(n)}(j),q=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.call(this,{},o.Z.isMiniGamePlugin?o.Z.pluginWx.login:o.Z.wx.login)).resAsResponse=!0,e}return d(n)}(j),K=function(e){u(n,e);var t=c(n);function n(e){var i;return l(this,n),(i=t.call(this,e,o.Z.isMiniGamePlugin?o.Z.pluginWx.downloadFile:o.Z.wx.downloadFile)).resAsResponse=!0,i}return d(n)}(j),Q=function(e){u(n,e);var t=c(n);function n(e){var i;return l(this,n),(i=t.call(this)).startTime=0,i.costTime=0,i.isSupportNoStringifyReqData=!1,i.options=e,i.isSupportNoStringifyReqData=!!((0,L.yC)(o.Z.systemInfo.SDKVersion,"2.29.1")>=0),i}return d(n,[{key:"optionsFilter",value:function(e){return e.sessionId&&e.data&&!e.data.session_id&&(e.data.session_id=e.sessionId),e.timeout=e.timeout||3e4,e}},{key:"send",value:function(){var e=this;this.startTime=Date.now();var t=this.options,n=t.url,i=t.data,a=t.flat,r=void 0!==a&&a,s=t.timeout,u=i||{},c=u&&(0,L.Kn)(u);c&&(u["requestTime_".concat((0,L.hQ)(10,!0))]=Date.now());var l={req_path:n,timeout:s,success:function(t){e.costTime=Date.now()-e.startTime,e.sourceResponse=t,e.response=function(e){var t=e.rawData,n=void 0===t?"":t,i=e.respData,a=n||(void 0===i?{}:i).data||"";if(!a)return{};try{return JSON.parse(a)}catch(e){return{}}}(t),e.emit("success"),e.emit("complete",0)},fail:function(t){e.costTime=Date.now()-e.startTime,e.emit("error",t),e.emit("complete",1)}};if(!r){var d=c?JSON.stringify(u):u;this.isSupportNoStringifyReqData?(l.reqData={req_path:n,json_data:d},delete l.req_path):l.json_data=d}r&&c&&(this.isSupportNoStringifyReqData?(l.reqData=Object.assign({req_path:n},u),delete l.req_path):l=Object.assign(Object.assign({},u),l)),o.Z.pluginEnv.gameTransfer(l)}}]),n}(C),J=function(e){u(n,e);var t=c(n);function n(e){var i;return l(this,n),(i=t.call(this,e)).gameTransfer=i.initGameTransfer(),i}return d(n,[{key:"initGameTransfer",value:function(){var e=this;if(o.Z.pluginEnv.gameTransfer){var t={Constructor:Q,funcName:T.gameTransfer,reportType:P.C2.GameTransfer};return this.initMethodNeedSession((function(n){return e.innerRequest(n,t)}))}return console.warn("[minigamfe".concat(this.namespace,"]: 当前插件不支持 gameTransfer。")),function(){return new Promise((function(e,t){t(y.GAMETRANSFER_IS_NOT_EXIST)}))}}}]),n}(function(e){u(i,e);var t=c(i);function i(e){var n;l(this,i),(n=t.call(this,e)).login=n.initWxMethod({funcName:T.login,Constructor:q,reportType:P.C2.Login}),n.request=n.initWxMethod({funcName:T.request,Constructor:z,reportType:P.C2.Request}),n.uploadFile=n.initWxMethod({funcName:T.uploadFile,Constructor:H,reportType:P.C2.UploadFile}),n.downloadFile=n.initWxMethod({funcName:T.downloadFile,Constructor:K,reportType:P.C2.DownloadFile}),n.session=new U({login:n.login,request:n.request});var a=e.pluginAppId,r=void 0===a?"":a;return n.pluginAppId=r,n}return d(i,[{key:"initWxMethod",value:function(e){var t=this,n=e.funcName,i=e.Constructor,a=e.reportType,r=o.Z.isMiniGamePlugin?o.Z.pluginWx:o.Z.wx;if(void 0!==r&&r[n]){var s={Constructor:i,funcName:n,reportType:a},u=function(e){return t.innerRequest(e||{},s)};return n===T.request||n===T.uploadFile?this.initMethodNeedSession(u):u}return console.warn("[minigamfe".concat(this.namespace,"]: 当前环境不支持 ").concat(n,"。")),function(){return new Promise((function(e,t){t(y.METHOD_IS_NOT_EXIST)}))}}},{key:"initMethodNeedSession",value:function(e){var t=this;return function(i){return i.needSession?t.session.getSessionId(t.pluginAppId).then((function(t){return e(Object.assign(i,t))})).then((function(a){var r,o=n(a,2),s=o[0],u=o[1];return 401===(null==u?void 0:u.statusCode)||"-1702220400"=="".concat(r=s.errcode)||"-1702220401"=="".concat(r)||"-1702220407"=="".concat(r)||"-1702220402"=="".concat(r)||"40001"=="".concat(r)?(t.session.clearSessionId(),t.session.getSessionId(t.pluginAppId).then((function(t){return e(Object.assign(i,t))}))):[s,u]})):e(i)}}}]),i}(function(){function e(t){var n=t.debug,i=void 0!==n&&n,a=t.quality,r=t.namespace;l(this,e),this.namespace="",this.errCodeIgnoreList=[],this.debug=i,this.quality=a,this.namespace=r?" ".concat(r," "):" "}return d(e,[{key:"innerRequest",value:function(e,t){var n=this;return new Promise((function(i,a){var r=t.Constructor,o=t.funcName,s=t.reportType;if(o===T.login||e.url){var u=new r(e);u.optionsFilter(e),u.on("success",(function(){var t;n.debug&&!0!==e.silent&&console.log("[minigamefe".concat(n.namespace,"Network]: ").concat(o," end with success"),u.response);var a=u.response,r=u.sourceResponse,c=u.costTime,l=a.errcode,d=a.errmsg;e.reduceErrmsgBeforeReport&&(0,L.mf)(e.reduceErrmsgBeforeReport)&&(d=e.reduceErrmsgBeforeReport(a)),o!==T.login||a.code||(d=a.errMsg,l=9999),(0,L.hj)(l)&&0!==Number(l)&&!0!==e.silent&&-1===n.errCodeIgnoreList.indexOf(Number(l))&&(null===(t=n.quality)||void 0===t||t.innerReport({Type:s,Target:e.url||"",Params:e.data,CostTime:c,Result:{errcode:l,errmsg:d},IsError:1})),i([a,r])})),u.on("error",(function(t){var i;!0!==e.silent&&(n.debug&&console.error("[minigamefe".concat(n.namespace,"Network]: ").concat(o," end with error"),e,t),null===(i=n.quality)||void 0===i||i.innerReport({Type:s,Target:e.url||"",CostTime:u.costTime,Params:e.data,Result:(0,L.bV)(t),IsError:1})),a(t)})),u.on("complete",(function(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;!0!==e.silent&&Math.random()<.1&&(null===(t=n.quality)||void 0===t||t.innerReport({Type:P.C2.CgiSpeedMeasure,Target:e.url||"",Params:e.data,CostTime:u.costTime,IsError:i}))})),n.debug&&!0!==e.silent&&console.log("[minigamefe".concat(n.namespace,"Network]: ").concat(o," start"),e),u.send()}else a(y.URL_IS_EMPTY)}))}},{key:"addIgnoreErrCode",value:function(e){var t=this;(Array.isArray(e)?e:[e]).forEach((function(e){-1===t.errCodeIgnoreList.indexOf(e)&&t.errCodeIgnoreList.push(e)}))}},{key:"removeIgnoreErrCode",value:function(e){var t=this;(Array.isArray(e)?e:[e]).forEach((function(e){t.errCodeIgnoreList.indexOf(e)>-1&&t.errCodeIgnoreList.splice(t.errCodeIgnoreList.indexOf(e),1)}))}},{key:"setRequestQualityReporter",value:function(e){this.quality=e}}]),e}())),X=Date.now(),Z=new(function(){function e(){l(this,e),this.version=W,this.consts=w,this.env=o.Z,this.util=a,this.config=k,this.reporter={GameTransferReport:I.Z,KeyValueReporter:R.Z}}return d(e,[{key:"init",value:function(e){var t;if(console.log("[minigamefe mgp]: inited"),i.g.mgp=this,this.config.set(e),this.network=new J({pluginAppId:this.config.get("pluginAppId")||o.Z.pluginAppId||"",debug:this.config.get("debug")||!1,namespace:"mgp"}),o.Z.isMiniGamePlugin){var n=o.Z.pluginEnv;n.gameTransfer||n.reportKeyValue?(this.quality=new V({debug:this.config.get("debug")&&this.config.get("logReport"),type:this.config.get("qualityReportType"),pluginAppId:this.config.get("pluginAppId")||o.Z.pluginAppId||"",pluginVersion:this.config.get("pluginVersion")||o.Z.pluginVersion||"",launchInfo:o.Z.wx.getLaunchOptionsSync(),accountInfo:o.Z.accountInfo,systemInfo:o.Z.systemInfo,onShow:o.Z.wx.onShow,onHide:o.Z.wx.onHide,getNetworkType:o.Z.wx.getNetworkType,onNetworkStatusChange:o.Z.wx.onNetworkStatusChange,gameTransfer:null===o.Z||void 0===o.Z?void 0:o.Z.pluginEnv.gameTransfer,reportKeyValue:null===(t=null===o.Z||void 0===o.Z?void 0:o.Z.pluginEnv)||void 0===t?void 0:t.reportKeyValue,request:o.Z.pluginWx.request,namespace:"mgp"}),this.network.setRequestQualityReporter(this.quality),this.quality.innerReport({Type:P.C2.Default,Target:"init",CostTime:Date.now()-X}),new E(this.quality)):(console.warn("[minigamefe mgp]: 当前环境不支持质量上报。"),this.quality={report:L.YP});var a=this.config.get("debug");n.getXLogManager?(this.xlog=new S({reportFunc:n.getXLogManager(),namespace:"mgp",base:{name:this.config.get("xlogName")},debug:a}),a&&console.info("[minigamefe mgp]: 当前插件已支持 xlog, 建议在关键操作打客户端日志。")):(this.xlog=console,a&&console.info("[minigamefe MGP]: 当前客户端不支持 xlog, 降级为 console。"))}else console.warn("[minigamefe mgp]: please use mgp in minigame plugin")}}]),e}())},820:function(e,t,n){n.d(t,{Xu:function(){return i},C2:function(){return a},jJ:function(){return r},ql:function(){return o},EM:function(){return u}});var i,a,r,o,s=n(9512);!function(e){e[e.Front=1]="Front",e[e.Background=2]="Background"}(i||(i={})),function(e){e[e.Default=0]="Default",e[e.GameTransfer=1]="GameTransfer",e[e.Request=2]="Request",e[e.DownloadFile=3]="DownloadFile",e[e.CgiSpeedMeasure=4]="CgiSpeedMeasure",e[e.BadJs=5]="BadJs",e[e.Init=6]="Init",e[e.CostTime=7]="CostTime",e[e.Error=8]="Error",e[e.UploadFile=9]="UploadFile",e[e.Login=10]="Login",e[e.WebTransfer=11]="WebTransfer"}(a||(a={})),function(e){e[e.Info=101]="Info",e[e.Warn=102]="Warn",e[e.Error=103]="Error"}(r||(r={})),function(e){e.GameTransferReport="GameTransferReport",e.KeyValueReport="KeyValueReport",e.WxRequestReport="WxRequestReport"}(o||(o={}));var u=Object.values(a).filter((function(e){return(0,s.hj)(e)}))},7974:function(e,t,n){n.d(t,{$:function(){return a}});var i=n(9580);function a(e){var t,a,r,o,s,u=null===(t=e.platform)||void 0===t?void 0:t.toLocaleLowerCase();return u===i.t4.devtools?i.vm.Devtools:u===i.t4.ios?e.model&&e.model.indexOf("iPad")>-1?(null===(a=n.g)||void 0===a?void 0:a.isIOSHighPerformanceModePlus)?i.vm.IPadWKPlus:(null===(r=n.g)||void 0===r?void 0:r.isIOSHighPerformanceMode)?i.vm.IPadWK:i.vm.IPadJscore:(null===(o=n.g)||void 0===o?void 0:o.isIOSHighPerformanceModePlus)?i.vm.IOSWKPlus:(null===(s=n.g)||void 0===s?void 0:s.isIOSHighPerformanceMode)?i.vm.IOSWK:i.vm.IOSJscore:u===i.t4.android?i.vm.Android:u===i.t4.windows||u===i.t4.mac?i.vm.PC:i.vm.UnKnow}},6729:function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,i,r,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new a(i,r||e,o),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,a=[];if(0===this._eventsCount)return a;for(i in e=this._events)t.call(e,i)&&a.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var a=0,r=i.length,o=new Array(r);a<r;a++)o[a]=i[a].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,a,r,o){var s=n?n+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,a),!0;case 5:return l.fn.call(l.context,t,i,a,r),!0;case 6:return l.fn.call(l.context,t,i,a,r,o),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,i);break;case 4:l[c].fn.call(l[c].context,t,i,a);break;default:if(!u)for(h=1,u=new Array(d-1);h<d;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,a){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return o(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||a&&!s.once||i&&s.context!==i||o(this,r);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||a&&!s[u].once||i&&s[u].context!==i)&&c.push(s[u]);c.length?this._events[r]=1===c.length?c[0]:c:o(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s},4279:function(e){function t(){}t.prototype={on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var i=this;function a(){i.off(e,a),t.apply(n,arguments)}return a._=t,this.on(e,a,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,a=n.length;i<a;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],a=[];if(i&&t)for(var r=0,o=i.length;r<o;r++)i[r].fn!==t&&i[r].fn._!==t&&a.push(i[r]);return a.length?n[e]=a:delete n[e],this}},e.exports=t,e.exports.TinyEmitter=t}},f={};function p(e){var t=f[e];if(void 0!==t)return t.exports;var n=f[e]={exports:{}};return h[e].call(n.exports,n,n.exports,p),n.exports}p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.g=function(){if("object"==("undefined"==typeof globalThis?"undefined":r(globalThis)))return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==("undefined"==typeof window?"undefined":r(window)))return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var m={};(function(){p.r(m),p.d(m,{default:function(){return La}});var r,o,h,f,g,v,y,T,S,P,k,E,b,C,w,I,R,L=p(4293).default,M=L.env,A="1.2.54";if(L.init({debug:!1,pluginAppId:"wxe5a48f1ed5f544b7",pluginVersion:A,xlogName:"unityPlugin"}),M.isMiniGamePlugin){var _,D=M.pluginEnv,F=D.customEnv;r=M.wx,o=F.unityNamespace,h=F.canvas,F.document,I=F.events,R=F.WXWASMSDK,f=D.reportKeyValue||function(){console.warn("当前环境没有reportKeyValue函数!!")},g=D.gameTransfer||function(){console.warn("当前环境没有gameTransfer函数")},b=D.instanceId||"",E=D.setFileSpaceStatistics,C=D.getPrivateFileSystemManager,v=D.coverview,w=D.getWxCommonFont,v?(y=(_=v).Component,T=_.getPrivateThis,_.removePrivateThis,_.create,S=_.init,P=_.webviewLayout,k=_.xmlParser):y=d((function e(){l(this,e)}))}else r=wx,o=GameGlobal.unityNamespace,h=GameGlobal.canvas,GameGlobal.document,f=function(){},g=function(){},y=function(){},T=function(e){return e},b="";o.isCacheableFile=o.isCacheableFile||function(e){return e.includes("StreamingAssets")};var x=p(9512),O=p(9580),N=M.systemInfo,W=M.accountInfo,B=N.pixelRatio,V=(N.platform,N.benchmarkLevel),U=N.screenHeight,G=N.screenWidth,j=N.enableDebug,z=N.SDKVersion,H=N.version,q=(W||{}).miniProgram,K=r.getFileSystemManager(),Q=q.envVersion,J=Q===O.tE.RELEASE,X=Q===O.tE.DEVELOP,Z=M.isWK&&(0,x.yC)(z,"2.19.1")>=0,Y=j,$=!!o.enableDebugLog,ee=!!Y||!!M.isDevtools,te=(0,x.yC)(z,"2.21.2")>=0,ne=!!v,ie=M.isAndroid&&0===(0,x.yC)(H,"8.0.25"),ae=!!r.reportScene&&(0,x.yC)(H,"8.0.27")>-1,re=!!o.instantiateWasm,oe=M.isAndroid&&(0,x.yC)(H,"8.0.34")>-1||M.isIOS&&(0,x.yC)(H,"8.0.39")>-1,se=p(4293).default,ue=r.getLogManager({level:1}),ce=r.getRealtimeLogManager?r.getRealtimeLogManager():{info:function(){console.warn("当前环境不支持实时日志")},error:function(){console.warn("当前环境不支持实时日志")}};setTimeout((function(){try{ue.log("[PLUGIN LOG] systemInfo=",se.env.systemInfo);var e=se.env.pluginEnv;ue.log("[PLUGIN LOG] check permission: coverview=".concat(!!e.coverview,", gameTransfer=").concat(!!e.gameTransfer,", reportKeyValue=").concat(!!e.reportKeyValue)),ee&&(console.log("[PLUGIN LOG] systemInfo=",se.env.systemInfo),console.log("[PLUGIN LOG] check permission: coverview=".concat(!!e.coverview,", gameTransfer=").concat(!!e.gameTransfer,", reportKeyValue=").concat(!!e.reportKeyValue)))}catch(e){}}),0);var le,de=function(){function e(){l(this,e)}return d(e,null,[{key:"getInstance",value:function(){return this.instance||(this.instance=new this),this.instance}}]),e}();!function(e){e.Fps="fps",e.EnableMonitor="enableMonitor",e.MonitorDuration="monitorDuration",e.ShowResultAfterLaunch="showResultAfterLaunch",e.ShowSuggestModal="showSuggestModal",e.ShowReportModal="SHOW_REPORT_MODAL"}(le||(le={}));var he,fe,pe,me=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.call(this)).config={fps:10,monitorDuration:3e4,showResultAfterLaunch:!0,showSuggestModal:!0},e.init(),e}return d(n,[{key:"getConfig",value:function(e){return this.config[e]}},{key:"setConfig",value:function(e,t){this.config[e]=t}},{key:"init",value:function(){try{var e=o.monitorConfig,t=void 0===e?{}:e,n=JSON.parse(JSON.stringify(t)),i=!!n.INJECT_CONIFG&&!!n.FORCE_ENABLE;n.enableMonitor=!J&&!!n.enableMonitor||i,this.config=Object.assign(Object.assign({},this.config),n),this.config.SHOW_REPORT_MODAL=!!n.SHOW_REPORT_MODAL}catch(e){this.config.enableMonitor=!1}}}]),n}(de).getInstance(),ge=r.env.USER_DATA_PATH,ve="__GAME_FILE_CACHE",ye="".concat(ge,"/__GAME_FILE_CACHE"),Te="wxfile://__wxprivate__",Se=1024,Pe=((M.isPC?2048:o.maxStorage||200)-5)*Se*Se;!function(e){e[e.LONG_VIDEO=0]="LONG_VIDEO",e[e.INTERACTIVE_VIDEO=1]="INTERACTIVE_VIDEO",e[e.COVER_VIEW=2]="COVER_VIEW",e[e.LaunchOpera=10]="LaunchOpera"}(he||(he={})),function(e){e[e.NEED_NOT_DOWNLOAD=0]="NEED_NOT_DOWNLOAD",e[e.NEED_DOWNLOAD=1]="NEED_DOWNLOAD"}(fe||(fe={})),function(e){e[e.AllCached=0]="AllCached",e[e.DownloadAll=1]="DownloadAll",e[e.DownloadDataPackage=2]="DownloadDataPackage",e[e.DownloadWasmCode=3]="DownloadWasmCode"}(pe||(pe={}));var ke,Ee,be,Ce,we,Ie,Re,Le,Me,Ae={0:"资源有缓存",1:"资源无缓存",2:"仅下载首资源包",3:"仅下载wasm包"};!function(e){e[e.GAME_LAUNCH=0]="GAME_LAUNCH",e[e.LOAD_SUBPACKAGE=1]="LOAD_SUBPACKAGE",e[e.COMPILE_WASM=2]="COMPILE_WASM",e[e.LOAD_ASSETS=3]="LOAD_ASSETS",e[e.UNZIP_ASSETS=4]="UNZIP_ASSETS",e[e.READ_ASSETS=5]="READ_ASSETS",e[e.PREPARE_GAME=6]="PREPARE_GAME",e[e.GAME_START=7]="GAME_START",e[e.LOAD_ASSET_BUNDLE=8]="LOAD_ASSET_BUNDLE",e[e.FILE_SYSTEM_INIT=9]="FILE_SYSTEM_INIT",e[e.GET_CONTEXT=10]="GET_CONTEXT",e[e.LOAD_BACKGROUND_IMAGE=11]="LOAD_BACKGROUND_IMAGE",e[e.COVER_VIEW_INIT=12]="COVER_VIEW_INIT",e[e.LAUNCH_OPERA_FRAME_START=13]="LAUNCH_OPERA_FRAME_START",e[e.LAUNCH_OPERA_FRAME_END=14]="LAUNCH_OPERA_FRAME_END",e[e.LAUNCH_OPERA_FRAME_CHECKPOINT=15]="LAUNCH_OPERA_FRAME_CHECKPOINT",e[e.LAUNCH_OPERA_FRAME_CHECKPOINT_COUNT=16]="LAUNCH_OPERA_FRAME_CHECKPOINT_COUNT"}(ke||(ke={})),function(e){e[e.DEFAULT=50]="DEFAULT",e[e.UNZIP=51]="UNZIP",e[e.WRITEFILE=52]="WRITEFILE",e[e.RELEASE_ERROR=53]="RELEASE_ERROR",e[e.DELETE_FILE=54]="DELETE_FILE",e[e.EXCEED_MAX=55]="EXCEED_MAX",e[e.QUOTA_CONTROL=56]="QUOTA_CONTROL",e[e.STAT_SIZE_EXCEED=57]="STAT_SIZE_EXCEED",e[e.STAT_SIZE_NORMAL=58]="STAT_SIZE_NORMAL",e[e.OUT_OF_RANGE=59]="OUT_OF_RANGE"}(Ee||(Ee={})),function(e){e[e.FONT=80]="FONT"}(be||(be={})),function(e){e[e.BASE_INFO=70]="BASE_INFO",e[e.ASSETS_INFO=71]="ASSETS_INFO",e[e.FRAME_INFO=72]="FRAME_INFO"}(Ce||(Ce={})),function(e){e[e.ON_ABORT=100]="ON_ABORT",e[e.WaitingRemoveDependencies=101]="WaitingRemoveDependencies",e[e.WxABReadEmptyContent=102]="WxABReadEmptyContent"}(we||(we={})),function(e){e[e.WAIT_SUB_WASM_END=30]="WAIT_SUB_WASM_END",e[e.BEFORE_LOAD_SUB_WASM=31]="BEFORE_LOAD_SUB_WASM",e[e.LOAD_SUB_WASM_VERY_EARLY=32]="LOAD_SUB_WASM_VERY_EARLY",e[e.SUB_WASM_LOAD=33]="SUB_WASM_LOAD",e[e.SUB_WASM_COMPILED=34]="SUB_WASM_COMPILED",e[e.FETCH_JS=35]="FETCH_JS",e[e.WRITE_PATCH=36]="WRITE_PATCH",e[e.COMPILE_PATCH=37]="COMPILE_PATCH",e[e.DOWNLOAD_PATCH=38]="DOWNLOAD_PATCH",e[e.MISS_PATCH_FUNC=39]="MISS_PATCH_FUNC",e[e.REFRESH_TOKEN=40]="REFRESH_TOKEN"}(Ie||(Ie={})),function(e){e[e.Malloc=110]="Malloc"}(Re||(Re={})),function(e){e[e.normal=0]="normal",e[e.codeSplit=1]="codeSplit"}(Le||(Le={})),function(e){e[e.Normal=0]="Normal",e[e.WK=1]="WK"}(Me||(Me={}));var _e,De,Fe,xe,Oe,Ne={1:"webgl",2:"webgl2"};!function(e){e.AdSpaceType="adSpaceType",e.AdType="adType",e.MaterialType="materialType"}(_e||(_e={})),function(e){e[e.Default=0]="Default",e[e.Min=1]="Min",e[e.Max=200]="Max"}(De||(De={})),function(e){e[e.Subpackage=0]="Subpackage",e[e.Cdn=1]="Cdn"}(Fe||(Fe={})),function(e){e.Wasm="长时间未完成wasm代码下载",e.DataPackage="长时间未完成资源包下载"}(xe||(xe={})),function(e){e.close="0",e.open="1"}(Oe||(Oe={}));var We="wasmsplit",Be="filequota",Ve="wasmpatch",Ue=function(){function e(){l(this,e),this.config=i(i(i(i({},We,Oe.open),Be,Oe.open),Ve,Oe.open),"wxfont",Oe.open)}return d(e,[{key:"init",value:function(e){var t=this;(null==e?void 0:e.length)&&e.forEach((function(e){var n=e.key,i=e.value;t.set(n,i)}))}},{key:"get",value:function(e){return this.config[e]||Oe.open}},{key:"set",value:function(e,t){this.config[e]=t||Oe.open}},{key:"getFeatureString",value:function(){return Object.entries(this.config).map((function(e){var t=n(e,2),i=t[0],a=t[1];return"".concat(i,"_").concat(a)})).join(",")}},{key:"getFeatures",value:function(){return Object.assign({},this.config)}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}().getInstance(),Ge=p(4293).default,je=function(){function e(){l(this,e)}return d(e,null,[{key:"timeStart",value:function(t){if(!e.timeMap.has(t)){var n=Date.now();return e.timeMap.set(t,n),n}return 0}},{key:"printTime",value:function(t){var n=t.indexOf("callMain耗时")>-1&&o.DO_RUN_START,i=t.indexOf("wasm编译耗时")>-1&&o.WASM_BEGIN_TIME;if(e.timeMap.has(t)||i||n){var a=e.timeEnd(t,!1),r="[PLUGIN TIME LOG ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ").concat(t,": ").concat(a,"ms");Ge.xlog.info(r),ue.log(r),console.log(r),e.timeStrList.push(r)}}},{key:"timeEnd",value:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=t.indexOf("callMain耗时")>-1&&o.DO_RUN_START,a=t.indexOf("wasm编译耗时")>-1&&o.WASM_BEGIN_TIME;if(e.timeMap.has(t)||i||a){var r=Date.now(),s=e.timeMap.get(t);return i&&(s=o.DO_RUN_START),a&&(s=o.WASM_BEGIN_TIME),n&&e.timeMap.delete(t),r-s}return 0}},{key:"getRuntime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=Date.now()-e.logStartTime;return t?+(n/1e3).toFixed(2):n}},{key:"printRuntime",value:function(t){var n="[PLUGIN TIME LOG ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ").concat(t,": ").concat(e.getRuntime(),"ms");Ge.xlog.info(n),ue.log(n),console.log(n),n.indexOf("游戏启动耗时")>-1&&(e.timeStrList.push(n),o.hideTimeLogModal||!o.showTimeLogInAllVersion&&Q!==O.tE.DEVELOP||(r.showModal({title:"timelog",content:e.timeStrList.join("\r\n")}),e.timeStrList=[]))}},{key:"storeTime",value:function(t){e.storeTimeMap.has(t)||e.storeTimeMap.set(t,{CostTimeMs:e.timeEnd(t),RunTimeMs:e.getRuntime()})}},{key:"popTime",value:function(t){if(e.storeTimeMap.has(t)){var n=e.storeTimeMap.get(t);return e.storeTimeMap.delete(t),n}return null}}]),e}();je.logStartTime=Date.now(),je.timeMap=new Map,je.storeTimeMap=new Map,je.timeStrList=[];var ze,He,qe=function(){function e(){l(this,e)}return d(e,null,[{key:"eventLog",value:function(){for(var e,t,n,i,a,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];var u=o[0],c=void 0===u?"":u;o.length>1&&(null===(n=null==c?void 0:c.includes)||void 0===n?void 0:n.call(c,"fetch js:"))&&(null===(a=null===(i=si.wasmSplitMonitor)||void 0===i?void 0:i.recordSyncFetchTime)||void 0===a||a.call(i)),(e=Ge.xlog).info.apply(e,["[PLUGIN LOG] "].concat(o)),ue.log.apply(ue,["[PLUGIN LOG] "].concat(o)),ee&&(t=console).log.apply(t,["[PLUGIN LOG ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(o))}},{key:"debugLog",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ee&&$&&(e=console).log.apply(e,["[DEBUG LOG ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(n))}},{key:"debugWarn",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ee&&$&&(e=console).warn.apply(e,["[DEBUG WARN ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(n))}},{key:"debugError",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ee&&$&&(e=console).error.apply(e,["[DEBUG ERROR ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(n))}},{key:"pluginLog",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ue.log.apply(ue,n),ee&&$&&(e=console).log.apply(e,["[PLUGIN LOG ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(n))}},{key:"pluginWarn",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ue.warn.apply(ue,["".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS")," ")].concat(n)),ee&&(e=console).warn.apply(e,["[PLUGIN WARN ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(n))}},{key:"pluginError",value:function(){for(var e,t,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];ue.warn.apply(ue,["".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS")," ")].concat(i)),ce.error.apply(ce,["[PLUGIN ERROR] "].concat(i)),(e=Ge.xlog).error.apply(e,["[PLUGIN ERROR] "].concat(i)),ee&&(t=console).error.apply(t,["[PLUGIN ERROR ".concat((0,x.p6)(Date.now(),"hh:mm.ss.SSS"),"] ")].concat(i))}},{key:"monitorLog",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ee&&(e=console).log.apply(e,["[PLUGIN MONITOR] "].concat(n))}},{key:"monitorWarn",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ee&&(e=console).warn.apply(e,["[PLUGIN MONITOR] "].concat(n))}}]),e}(),Ke=p(6729),Qe=p.n(Ke),Je=new(Qe());!function(e){e.launchPlugin="launchPlugin",e.loadWasm="loadWasm",e.compileWasm="compileWasm",e.loadAssets="loadAssets",e.readAssets="readAssets",e.prepareGame="prepareGame",e.launchOperaInit="launchOperaInit",e.launchOperaMsgBridgeFromWasm="launchOperaMsgBridgeFromWasm",e.launchOperaPushMsgToWasm="launchOperaPushMsgToWasm",e.CreateWorker="createWorker"}(ze||(ze={})),function(e){e.PluginLaunch="onPluginLaunch",e.LoadingPageReady="onLoadingPageReady",e.ParallelLoading="onParallelLoading",e.ParallelLoaded="onParallelLoaded",e.WasmLoading="onWasmLoading",e.WasmLoaded="onWasmLoaded",e.AssetLoading="onAssetLoading",e.AssetLoaded="onAssetLoaded",e.AssetProcessed="onAssetProcessed",e.WasmInstantiated="onWasmInstantiated",e.CalledMain="onCalledMain",e.FileSystemReady="onFileSystemReady",e.FeatureFlagReady="onFeatureFlagReady",e.ReporterReady="onReporterReady",e.InstanceReady="onInstanceReady",e.ModulePrepared="onModulePrepared",e.LaunchProgress="onLaunchProgress"}(He||(He={}));var Xe=i(i(i(i(i(i({},ke.GAME_LAUNCH,ze.launchPlugin),ke.LOAD_SUBPACKAGE,ze.loadWasm),ke.COMPILE_WASM,ze.compileWasm),ke.LOAD_ASSETS,ze.loadAssets),ke.READ_ASSETS,ze.readAssets),ke.PREPARE_GAME,ze.prepareGame),Ze=function(){function e(){l(this,e)}return d(e,[{key:"init",value:function(e){var t=e;this.unityManager=t,this.bindFunction()}},{key:"triggerEvent",value:function(e,t){var n;Je.emit(e,t),e===He.LaunchProgress&&(null===(n=t)||void 0===n?void 0:n.type)&&Xe[t.type]&&(null==I||I.emit(Xe[t.type],t))}},{key:"bindFunction",value:function(){var e=this;Object.values(He).forEach((function(t){t===He.LaunchProgress?e.unityManager[t]=function(n){"function"==typeof n&&Je.on(t,n),e.unityManager.launchData.length&&e.unityManager.launchData.forEach((function(n){return e.triggerEvent(t,n)}))}:e.unityManager[t]=function(e){"function"==typeof e&&Je.on(t,e)}}))}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}().getInstance();function Ye(e,n){for(var i=arguments.length,a=new Array(i>2?i-2:0),r=2;r<i;r++)a[r-2]=arguments[r];return t(e,[n].concat(a))}var $e=d((function e(t){l(this,e),this.isVisible=!!t.isVisible,this.useCodeSplit=!!t.codeType,this.isHighPerformance=!!M.isWK,this.loadDataPackageFromSubpackage=!!this.loadDataPackageFromSubpackage;var n=!!Kn.getPrimaryDataCachePath();this.needDownloadDataPackage=!!n,this.loadingPageType=t.loadingPageType,this.features=Ue.getFeatures()})),et=function(e){u(n,e);var t=c(n);function n(e,i,a){var r;return l(this,n),(r=t.call(this,e)).type=i,r.data={costTimeMs:a,runTimeMs:je.getRuntime(),isVisible:r.isVisible,useCodeSplit:r.useCodeSplit,isHighPerformance:r.isHighPerformance,loadDataPackageFromSubpackage:r.loadDataPackageFromSubpackage,needDownloadDataPackage:r.needDownloadDataPackage},delete r.isVisible,delete r.useCodeSplit,delete r.isHighPerformance,delete r.loadDataPackageFromSubpackage,delete r.needDownloadDataPackage,delete r.loadingPageType,delete r.features,r}return d(n)}($e),tt=N.pixelRatio;function nt(e){return e*tt}function it(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e,null]}))}var at=function(){var e=[];return function(t){return!("string"!=typeof t||!(t.includes("end of list")||t.includes("still waiting on run dependencies")||t.includes("dependency"))||!e.includes(t)&&(e.push(t),1))}}();function rt(e){return!isNaN(e)}function ot(e){return rt(e)&&Number.isInteger(e)}function st(e){var t=Number(e);return t&&!Number.isNaN(t)?Number((t/Se/Se).toFixed(2)):0}function ut(e){var t=Number(e);return t&&!Number.isNaN(t)?Number((t/Se).toFixed(2)):0}function ct(e,t){return e?e.getResponseHeader(t)||e.getResponseHeader(t.toLowerCase()):""}function lt(e,t){return e?e[t]||e[t.toLowerCase()]:""}function dt(e){return e>=200&&e<300||304===e}var ht=p(1388),ft=p(2662).Z.wx;function pt(e){(0,ht.Mi)(e,ft.getNetworkType,ft.onNetworkStatusChange)}var mt=!0;function gt(e){mt=e}function vt(){return mt}var yt,Tt=0;function St(e){(function(e){var t=Number(e);return!(!ot(t)||t<200||t>1e4)})(e)&&(Tt=Number(e))}function Pt(){return Tt}function kt(e){return!!(ot(e)&&e>=0&&e<=1e4)}!function(e){e.wifi="wifi",e.unknown="unknow",e.none="none",e["2g"]="2g",e["3g"]="3g",e["4g"]="4g",e["5g"]="5g"}(yt||(yt={}));var Et=function(){function e(){l(this,e)}return d(e,null,[{key:"init",value:function(){pt((function(t){e.networkType=t}))}}]),e}();Et.networkType=yt["4g"],Et.init();var bt,Ct=p(9054),wt=p(6835),It=r.getAccountInfoSync()||{},Rt=ee&&$,Lt=M.isWK&&-1===(0,x.yC)(N.SDKVersion,"2.20.1");!function(e){e.False="0",e.True="1"}(bt||(bt={}));var Mt=d((function e(t){var n=this;l(this,e),Object.keys(t).forEach((function(e){n[e]=t[e]}))}));function At(){var e=vt()?1:0,t=o,n=t.unityVersion,i=t.convertPluginVersion,a=new Mt({PluginVersion:A,IsVisible:e,RuntimeType:M.isWK?Me.WK:Me.Normal,UnityVersion:n,ConvertPluginVersion:i,LibVersion:N.SDKVersion,WechatClientVersion:N.version,InstanceId:b||""});return new Promise((function(e){pt((function(t){e(Object.assign(Object.assign({},a),{NetworkType:t}))}))}))}var _t,Dt,Ft,xt=Lt?{AppId:ht.QD.STRING,AppVersion:ht.QD.UINT,AppState:ht.QD.UINT}:{},Ot={logid:21492,protocolParams:(Lt?["AppId","AppVersion","AppState"]:[]).concat(["PluginVersion","IsDownloadCode","ReportType","CostTimeMs","NetworkType","RunTimeMs","PreloadedSize","Scene","LoadingPageType","ExternInfo","CodeType","IsVisible","BenchmarkLevel","RuntimeType","UnityVersion","ConvertPluginVersion","LibVersion","WechatClientVersion","DataPackageLoadType","AdSpaceType","AdType","MaterialType","ABTest","InstanceId"]),schemas:Object.assign(Object.assign({PluginVersion:ht.QD.STRING,IsDownloadCode:ht.QD.UINT,ReportType:ht.QD.UINT,CostTimeMs:ht.QD.UINT,NetworkType:ht.QD.STRING,RunTimeMs:ht.QD.UINT,PreloadedSize:ht.QD.UINT,Scene:ht.QD.UINT,LoadingPageType:ht.QD.UINT,ExternInfo:ht.QD.STRING,CodeType:ht.QD.UINT,IsVisible:ht.QD.UINT,BenchmarkLevel:ht.QD.INT,RuntimeType:ht.QD.UINT,UnityVersion:ht.QD.STRING,ConvertPluginVersion:ht.QD.STRING,LibVersion:ht.QD.STRING,WechatClientVersion:ht.QD.STRING,DataPackageLoadType:ht.QD.UINT,AdSpaceType:ht.QD.UINT,AdType:ht.QD.UINT,MaterialType:ht.QD.UINT,ABTest:ht.QD.STRING,InstanceId:ht.QD.STRING},xt)),asyncGetBase:At,debug:Rt},Nt={logid:21493,protocolParams:(Lt?["AppId","AppVersion","AppState"]:[]).concat(["PluginVersion","NetworkType","IsDownloadCode","ReportType","ErrorMsg","RunTimeMs","Scene","LoadingPageType","ExternInfo","CodeType","ErrorType","IsVisible","BenchmarkLevel","RuntimeType","UnityVersion","ConvertPluginVersion","LibVersion","WechatClientVersion","DataPackageLoadType","AdSpaceType","AdType","MaterialType","ABTest","InstanceId"]),schemas:Object.assign(Object.assign({PluginVersion:ht.QD.STRING,NetworkType:ht.QD.STRING,IsDownloadCode:ht.QD.UINT,ReportType:ht.QD.UINT,ErrorMsg:ht.QD.STRING,RunTimeMs:ht.QD.UINT,Scene:ht.QD.UINT,LoadingPageType:ht.QD.UINT,ExternInfo:ht.QD.STRING,CodeType:ht.QD.UINT,ErrorType:ht.QD.UINT,IsVisible:ht.QD.UINT,BenchmarkLevel:ht.QD.INT,RuntimeType:ht.QD.UINT,UnityVersion:ht.QD.STRING,ConvertPluginVersion:ht.QD.STRING,LibVersion:ht.QD.STRING,WechatClientVersion:ht.QD.STRING,DataPackageLoadType:ht.QD.UINT,AdSpaceType:ht.QD.UINT,AdType:ht.QD.UINT,MaterialType:ht.QD.UINT,ABTest:ht.QD.STRING,InstanceId:ht.QD.STRING},xt)),asyncGetBase:At,debug:Rt},Wt={logid:21494,protocolParams:(Lt?["AppId","AppVersion","AppState"]:[]).concat(["PluginVersion","IsDownloadCode","NetworkType","RunTimeMs","StageType","Scene","LoadingPageType","ActionType","PositionID","ActionID","ExternInfo","CodeType","IsVisible","BenchmarkLevel","RuntimeType","UnityVersion","ConvertPluginVersion","LibVersion","WechatClientVersion","DataPackageLoadType","AdSpaceType","AdType","MaterialType","ABTest","InstanceId"]),schemas:Object.assign(Object.assign({PluginVersion:ht.QD.STRING,IsDownloadCode:ht.QD.UINT,NetworkType:ht.QD.STRING,RunTimeMs:ht.QD.UINT,StageType:ht.QD.STRING,Scene:ht.QD.UINT,LoadingPageType:ht.QD.UINT,ActionType:ht.QD.UINT,PositionID:ht.QD.UINT,ActionID:ht.QD.UINT,ExternInfo:ht.QD.STRING,CodeType:ht.QD.UINT,IsVisible:ht.QD.UINT,BenchmarkLevel:ht.QD.INT,RuntimeType:ht.QD.UINT,UnityVersion:ht.QD.STRING,ConvertPluginVersion:ht.QD.STRING,LibVersion:ht.QD.STRING,WechatClientVersion:ht.QD.STRING,DataPackageLoadType:ht.QD.UINT,AdSpaceType:ht.QD.UINT,AdType:ht.QD.UINT,MaterialType:ht.QD.UINT,ABTest:ht.QD.STRING,InstanceId:ht.QD.STRING},xt)),asyncGetBase:At,debug:Rt};if(Lt){_t=new wt.Z(Object.assign(Object.assign({},Ot),{reportType:ht.C2.KvStat,reportFunc:g})),Dt=new wt.Z(Object.assign(Object.assign({},Nt),{reportType:ht.C2.KvStat,reportFunc:g})),Ft=new wt.Z(Object.assign(Object.assign({},Wt),{reportType:ht.C2.KvStat,reportFunc:g})),_t.setKvStatBase(N),Dt.setKvStatBase(N),Ft.setKvStatBase(N);var Bt=new Mt({AppId:It.miniProgram.appId,AppState:O.dg[Q]});_t.setBase(Bt),Dt.setBase(Bt),Ft.setBase(Bt)}else _t=new Ct.Z(Object.assign(Object.assign({},Ot),{reportFunc:f,logid:"WXGameWASMLaunchTime"})),Dt=new Ct.Z(Object.assign(Object.assign({},Nt),{reportFunc:f,logid:"WXGameWASMLaunchException"})),Ft=new Ct.Z(Object.assign(Object.assign({},Wt),{reportFunc:f,logid:"WXGameWASMLaunchClose"}));var Vt=o,Ut=Vt.bundleHashLength,Gt=void 0===Ut?32:Ut,jt=Vt.texturesHashLength,zt=void 0===jt?8:jt,Ht=Vt.texturesPath,qt=void 0===Ht?"Assets/Textures":Ht,Kt=Vt.needCacheTextures,Qt="/",Jt="data.unityweb",Xt="wasm.code.unityweb",Zt=/[^:]\/{2,}/gi,Yt=/\.[./]+/gi,$t=/[<>]+/gi,en=/\\+/gi,tn=new RegExp("/?__GAME_FILE_CACHE");function nn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(null==t?void 0:t.length)?an(t.filter((function(e){var t;return!!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e))})).join(Qt)):""}function an(e){return(null==e?void 0:e.trim())?e.replace(Yt,"").replace($t,"").replace(Zt,(function(e){return e.replace(/\/+/g,Qt)})):""}function rn(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e))||e.endsWith(Qt))return"";var i=n;i&&(i=i.startsWith(".")?i:".".concat(i));var a=e.substring(e.lastIndexOf(Qt)+1);return a.includes("?")&&(a=a.substring(0,a.indexOf("?"))),a.includes("#")&&(a=a.substring(0,a.indexOf("#"))),a.replace(null==i?void 0:i.toLowerCase(),"").replace(null==i?void 0:i.toUpperCase(),"")}function on(e){return e.substring(e.lastIndexOf(Qt)+1)}function sn(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e)))return"";var i=o.STREAMING_CDN||o.DATA_CDN,a=e.replace(i,"").replace(ye,"").replace(ge,"").replace(Te,"");return n&&(a=a.replace(tn,"")),(a=a.substring(0,a.lastIndexOf(Qt)))?a.startsWith(Qt)?a:"/".concat(a):a}function un(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e)))return"";if(e.includes(ge))return e;var i=sn(e,n),a=rn(e),r=nn(n?ye:ge,i,a);return i.includes("/http:")||i.includes("/https:")?(J||qe.pluginError("缓存路径不合法 请检查DATA_CDN配置和请求URL是否匹配",{url:e,cachePath:r,dataCDN:o.DATA_CDN}),""):r}function cn(e){var t=rn(e);if(!t)return"";var n=t.includes(Jt)||t.includes(Xt),i=e.includes(qt),a=((n?/([a-zA-Z0-9]{16}\.)/gi:i?new RegExp("(\\.[a-zA-Z0-9]{".concat(zt,"})(\\.\\w+)*$")):new RegExp("([_-][a-zA-Z0-9]{".concat(Gt,"})(\\.\\w+)*$"))).exec(t)||[])[1];return a?t.replace(a,""):t}function ln(e){var t=rn(e);if(!t)return"";var i=t.includes(Jt)||t.includes(Xt),a=e.includes(qt),r=(i?/([a-zA-Z0-9]{16})\./gi:a?new RegExp("\\.([a-zA-Z0-9]{".concat(zt,"})(\\.\\w+)*$")):new RegExp("[_-]([a-zA-Z0-9]{".concat(Gt,"})(\\.\\w+)*$"))).exec(t),o="";return r&&(o=n(r,2)[1]),o||""}function dn(e){var t;return!(!(null===(t=null==e?void 0:e.trim)||void 0===t?void 0:t.call(e))||"string"!=typeof e||!e.includes("http"))}function hn(e){return!!dn(e)&&(!(!Kt||!fn(e))||o.isCacheableFile(e))}function fn(e){return!!dn(e)&&!!e.includes(qt)}function pn(e){var t=o.STREAMING_CDN||o.DATA_CDN,n=o.streamingUrlPrefixPath||"",i=e.match(/(http|https|ftp|file):\/\//),a=e;return i||(a=nn(t,n,e)),a}function mn(e){return M.isPC?e.replace(en,Qt):e}function gn(e){return!!e.includes("cloud.unity3d.com")}var vn,yn,Tn,Sn=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},Pn=function(){function t(){l(this,t),this.inited=!1,this.fileStats=[],this.fileInfoMap=new Map,this.shortFileInfoMap=new Map,this.dirs=[],this.fs=K,this.totalSize=0,this.isOldUser=!1,this.cacheDirInited=!1,this.firstInitPromise=this.init()}return d(t,[{key:"cleanAllCache",value:function(){return Sn(this,void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.cleanAllCachePromise||(this.cleanAllCachePromise=this.executeCleanAllTask()),this.cleanAllCachePromise));case 1:case"end":return e.stop()}}),t,this)})))}},{key:"executeCleanAllTask",value:function(){return Sn(this,void 0,void 0,e().mark((function t(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.fs.rmdirSync(ye,!0),n=this.isOldUser,this.cacheDirInited=!1,e.next=6,this.init();case 6:return this.isOldUser=n,this.cleanAllCachePromise=null,e.abrupt("return",!0);case 11:return e.prev=11,e.t0=e.catch(0),e.abrupt("return",(qe.pluginError("删除插件缓存目录失败: ",e.t0.errMsg||e.t0.message,e.t0),this.cleanAllCachePromise=null,!1));case 14:case"end":return e.stop()}}),t,this,[[0,11]])})))}},{key:"createCacheDir",value:function(){var e=this.fs,t=ye;try{e.accessSync(t),this.isOldUser=!0}catch(n){e.mkdirSync(t,!0),qe.pluginWarn("".concat(t,"目录不存在,创建目录")),this.isOldUser=!1}return this.isOldUser}},{key:"init",value:function(){return Sn(this,void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.initPromise||(this.initPromise=this.executeInit()),this.initPromise));case 1:case"end":return e.stop()}}),t,this)})))}},{key:"executeInit",value:function(){return Sn(this,void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.cacheDirInited||(this.cacheDirInited=!0,this.createCacheDir()),this.dirs=[],this.fileStats=[],this.fileInfoMap=new Map,this.shortFileInfoMap=new Map,this.totalSize=0,e.next=8,this.getStats();case 8:this.handleStats(),this.calculateSize(),this.fileStats=[],this.initPromise=null,this.inited&&this.checkNeedReportStat(),this.inited=!0,qe.eventLog("缓存文件数=",this.fileInfoMap.size,",总文件大小=",this.totalSize);case 15:case"end":return e.stop()}}),t,this)})))}},{key:"checkNeedReportStat",value:function(){this.totalSize>=Pe?Dt.send(new Mt({ReportType:Ee.STAT_SIZE_EXCEED,ErrorMsg:"ecceed_max_size",RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({fileCount:this.fileInfoMap.size,totalSize:this.totalSize,maxAllowSize:Pe})})):Dt.send(new Mt({ReportType:Ee.STAT_SIZE_NORMAL,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({fileCount:this.fileInfoMap.size,totalSize:this.totalSize,maxAllowSize:Pe})}))}},{key:"removeOldCache",value:function(){var e=this,t=this.getErasableFiles(Array.from(this.fileInfoMap.values())),n={};t.forEach((function(e){var t="".concat(e.dirname,"/").concat(e.shortFilename),i="".concat(e.dirname,"/").concat(e.filename);if(n[t]){n[t].sameFiles.push(i);var a=n[t].latestTime;e.lastAccessedTime>a&&(n[t].latestFile=i,n[t].latestTime=e.lastAccessedTime)}else n[t]={sameFiles:[i],latestFile:i,latestTime:e.lastAccessedTime}})),Object.keys(n).forEach((function(t){n[t].sameFiles.length>1&&e.removeFilesExclude(n[t].latestFile)}))}},{key:"mkdir",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ye;return new Promise((function(i,a){var r=nn(n,e);t.dirs.includes(r)?i(null):t.fs.access({path:r,success:function(){t.dirs.push(r),i(null)},fail:function(){t.fs.mkdir({dirPath:r,recursive:!0,success:function(){t.dirs.push(r),i(null)},fail:function(e){if(e.errMsg.includes("exist"))return i(null);a(e)}})}})}))}},{key:"removeFile",value:function(t,n){var i=this;return new Promise((function(a,r){return Sn(i,void 0,void 0,e().mark((function i(){var o,s,u=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",void a());case 2:if(e.t0=this.initPromise,!e.t0){e.next=6;break}return e.next=6,this.initPromise;case 6:if((o=this.findFile(t,!0))&&((s=o).isReadyToDelete=!0,n))try{je.timeStart("删除文件".concat(s.path)),this.fs.unlink({filePath:s.path,success:function(){var e=s.size,t=u.totalSize-e;u.fileInfoMap.delete(s.subPath),u.removeShortFileInfo(s),u.totalSize=t,qe.debugLog("删除文件: ".concat(s.shortFilename,", md5:").concat(s.md5,",size:").concat(ut(s.size),"KB,耗时:").concat(je.timeEnd("删除文件".concat(s.path),!0),"ms")),a()},fail:function(e){if(Dt.send(new Mt({ReportType:Ee.DELETE_FILE,ErrorMsg:e.errMsg,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({type:"deletefile",filepath:s.path,totalSize:u.totalSize})})),e.errMsg.includes("no such file or directory")){var t=s.size,n=u.totalSize-t;u.fileInfoMap.delete(s.subPath),u.removeShortFileInfo(s),u.totalSize=n}r(e)}})}catch(e){qe.pluginError("删除文件失败: ".concat(s.path),e.errMsg||e.message,e),this.init(),Dt.send(new Mt({ReportType:Ee.DELETE_FILE,ErrorMsg:"".concat(e.message||e.errMsg),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({type:"deletefile",filepath:s.path,totalSize:this.totalSize})})),r(e)}case 8:case"end":return e.stop()}}),i,this)})))}))}},{key:"removeFilesExclude",value:function(t){return Sn(this,void 0,void 0,e().mark((function n(){var i,a,r,o,s,u=this;return e().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(i=cn(t),a=ln(t),r=sn(t),t&&t.trim()&&i&&a){n.next=3;break}return n.abrupt("return");case 3:if(!(null==(o=this.shortFileInfoMap.get(nn(r,i)))?void 0:o.length)){n.next=9;break}return(s=this.getErasableFiles(o).filter((function(e){return a&&e.md5&&e.md5!==a}))).length&&qe.pluginLog("删除".concat(i,"旧缓存")),n.next=9,Promise.all(s.map((function(t){return Sn(u,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.removeFile(t.path,!0);case 2:case"end":return e.stop()}}),n,this)})))})));case 9:case"end":return n.stop()}}),n,this)})))}},{key:"getErasableFiles",value:function(e){return e.filter((function(e){var t=e.erasable,n=e.isReadyToDelete;return!!t&&!n})).filter((function(e){return!o.isErasableFile||o.isErasableFile({path:"".concat(e.dirname,"/").concat(e.filename),filename:e.filename,shortFilename:e.shortFilename,dirname:e.dirname,lastAccessedTime:e.lastAccessedTime,size:e.size,md5:e.md5})})).sort((function(e,t){return e.lastAccessedTime-t.lastAccessedTime}))}},{key:"releaseMemory",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.releaseMemorySize||31457280;return Sn(this,void 0,void 0,e().mark((function i(){var a,r,o,s,u,c=this;return e().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=t-Pe+this.totalSize,t&&!(a<=0)){i.next=3;break}return i.abrupt("return",Cn.NO_NEED_RELEASE_MEMORY);case 3:if((r=this.getErasableFiles(Array.from(this.fileInfoMap.values())))&&r.length){i.next=6;break}return i.abrupt("return",Cn.NO_NEED_RELEASE_MEMORY);case 6:if(!(t>Pe)){i.next=8;break}return i.abrupt("return",(qe.pluginWarn("所需存储容量".concat(st(t),"MB超过最大值").concat(st(Pe),"MB, 不执行清理")),Cn.EXCEED_MEMORY));case 8:o=[],s=a=n+a;case 11:if(!(a>0)){i.next=18;break}if(u=r.shift()){i.next=15;break}return i.abrupt("break",18);case 15:u.isReadyToDelete||(u.isReadyToDelete=!0,o.push(u)),a-=u.size;case 16:i.next=11;break;case 18:return o.length&&qe.eventLog("需要释放".concat(st(s),"MB存储空间")),i.next=21,Promise.all(o.map((function(t){return Sn(c,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.removeFile(t.path,!0);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),n,this)})))})));case 21:return i.abrupt("return",Cn.RELEASED_MEMORY);case 22:case"end":return i.stop()}}),i,this)})))}},{key:"addFile",value:function(e){var t=e.size,n=e.path,i=e.erasable,a=void 0===i||i,r=un(n);if(!this.findFile(n)){var o=rn(n),s=sn(n),u={path:r,subPath:nn(s,o),size:t,filename:o,dirname:s,shortFilename:cn(o),md5:ln(o),lastAccessedTime:parseInt(String(Date.now()/1e3),10),erasable:a};this.fileInfoMap.set(u.subPath,u),this.addShortFileInfo(u),this.totalSize+=t}}},{key:"addShortFileInfo",value:function(e){var t=nn(e.dirname,e.shortFilename),n=this.shortFileInfoMap.get(t)||[];n.push(e),this.shortFileInfoMap.set(t,n)}},{key:"removeShortFileInfo",value:function(e){var t=nn(e.dirname,e.shortFilename),n=this.shortFileInfoMap.get(t)||[];n=n.filter((function(t){return t.subPath!==e.subPath})),this.shortFileInfoMap.set(t,n)}},{key:"removeFileInfo",value:function(e){var t=this.findFile(e);t&&(this.fileInfoMap.delete(t.subPath),this.totalSize=this.totalSize-t.size)}},{key:"modifyFileInfo",value:function(e){var t=Number(e.size)||0,n=this.findFile(e.path);if(n){var i=t-n.size;n.size=t,this.totalSize=this.totalSize+i}}},{key:"calculateSize",value:function(){var e,t=this.fileInfoMap.values(),n=0,i=a(t);try{for(i.s();!(e=i.n()).done;){n+=e.value.size}}catch(e){i.e(e)}finally{i.f()}this.totalSize=n}},{key:"getUsedSize",value:function(){return qe.pluginLog("getUsedSize: ".concat(ge,"目录总大小: ").concat(st(this.totalSize),"MB")),this.totalSize}},{key:"updateAccessTime",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(e.includes("wxfile://")||e.includes("http://")||e.includes("https://"))||e.includes(ge)){var n=this.findFile(e);n&&(n.lastAccessedTime=parseInt(String(Date.now()/1e3),10),t&&this.fs.readFile({filePath:n.path,success:function(){}}))}}},{key:"findFile",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||!e.trim())return null;var n=e.includes(ve),i=sn(e,n),a=rn(e),r=this.fileInfoMap.get(nn(i,a));return!r||!t&&r.isReadyToDelete?null:r}},{key:"getFileInfo",value:function(e){return this.findFile(e)||null}},{key:"findFilesByShortFilename",value:function(e,t){return this.getErasableFiles(Array.from(this.fileInfoMap.values())).filter((function(n){return n.shortFilename===e&&n.dirname===t}))}},{key:"isSameFile",value:function(e,t){var n=sn(e),i=rn(e),a=t.filename;return n===t.dirname&&i===a}},{key:"checkFileExistInSystem",value:function(t){var n;return Sn(this,void 0,void 0,e().mark((function i(){var a;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=null==t?void 0:t.trim)||void 0===n?void 0:n.call(t)){e.next=2;break}return e.abrupt("return",!1);case 2:return a=un(t),e.next=5,this.statAsyncCatch(a);case 5:return e.abrupt("return",!!e.sent);case 6:case"end":return e.stop()}}),i,this)})))}},{key:"statAsyncCatch",value:function(e,t){var n=this;return new Promise((function(i){n.fs.stat({path:e,recursive:t,success:function(e){i(e.stats)},fail:function(t){qe.pluginError("FileSystem_statAsyncCatch: ".concat(e," "),t.errMsg,t),i(null)}})}))}},{key:"statSyncCatch",value:function(e,t){var n=this.fs.statSync;try{return n(e,t)}catch(t){return qe.pluginError("FileSystem_statSyncCatch: ".concat(e," "),t.errMsg||t.message,t),Dt.send(new Mt({ReportType:Ee.DEFAULT,ErrorMsg:t.errMsg||t.message,ExternInfo:JSON.stringify({path:e,async:!1})})),null}}},{key:"handleStats",value:function(){var e=this,t=this.fileStats;t&&Array.isArray(t)&&t.forEach((function(t){var n=e.handleFileInfo(t);e.fileInfoMap.set(n.subPath,n),e.addShortFileInfo(n)}))}},{key:"handleFileInfo",value:function(e){var t=e.path,n=e.stats,i=mn(t),a=rn(i),r=i.includes(ve),o=sn(i,r);return{path:un(i,r)||nn(ge,i),subPath:nn(o,a),filename:a,dirname:o,shortFilename:cn(i),md5:ln(i),size:n.size,lastAccessedTime:n.lastAccessedTime,erasable:r}}},{key:"getStats",value:function(){return Sn(this,void 0,void 0,e().mark((function t(){var n,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=[],!this.inited){e.next=7;break}return e.next=4,this.statAsyncCatch(ge,!0);case 4:e.t0=e.sent,e.next=8;break;case 7:e.t0=this.statSyncCatch(ge,!0);case 8:(n=e.t0)&&(i=Array.from(n).filter((function(e){return e.stats.isFile()}))),this.fileStats=i;case 11:case"end":return e.stop()}}),t,this)})))}}],[{key:"getIntance",value:function(){return t.instance||(t.instance=new t),t.instance}}]),t}(),kn=[Math.pow(216,3),Math.pow(216,2),216,1];function En(e){var t=e.byteLength;if(e.slice(-8).every((function(e,t){return 11+t===e}))){for(var n=1,i=e.slice(-12,-8).reduce((function(e,t,n){return e+t*kn[n]}),0);n<=i;){var a=t-12-6*n,r=e[a],o=e[a+1]+200,s=e[a+2],u=e[a+3],c=e[a+4],l=e[a+5],d=s*kn[0]+u*kn[1]+c*kn[2]+l;e[d]=r,e[d+1]=o,n+=1}for(var h=(e[t-12-6*(n-1)-1]<<8)+e[t-12-6*(n-1)-2],f=1;f<=h;f++)if(0!==e[t-12-6*(n-1)-2-f])return[e.buffer,!1];return[e.slice(0,t-12-6*(n-1)-h-2).buffer,!0]}if(e.slice(-8).every((function(e,t){return 21+t===e}))){for(var p=(e[t-9]<<8)+e[t-10],m=1;m<=p;m++)if(0!==e[t-10-m])return[e.buffer,!1];return[e.slice(0,t-8-p-2).buffer,!0]}return[e.buffer,!1]}!function(e){e[e.config=0]="config",e[e.writeFile=1]="writeFile"}(vn||(vn={}));var bn=function(){function e(){l(this,e),this.listener=new Set,this.inited=!1,this.supportWorkerFs=!1,this.supportSharedBuffer=!1,this.hasSetQuotaStatus=!1}return d(e,[{key:"init",value:function(){var e=this;try{if(this.worker=r.createWorker("workers/response/index.js"),this.worker&&(this.inited=!0,this.postSystemInfo(),this.bindEvent(),I&&I.emit(ze.CreateWorker,this.worker)),E){var t=Ue.get(Be)===Oe.open;E({enable:t,success:function(){e.hasSetQuotaStatus=!0,e.supportWorkerFs=!t},fail:function(e){Ue.set(Be,Oe.close),qe.pluginWarn("切换quotacontrol失败: ",e)},complete:function(){e.printStatus()}})}}catch(e){qe.pluginError("创建worker失败",e),this.printStatus()}}},{key:"postSystemInfo",value:function(){this.worker.postMessage({type:vn.config,payload:{systemInfo:N}})}},{key:"printStatus",value:function(){if(this.supportWorkerFs)return qe.eventLog("使用worker写文件");var e=Ue.get(Be)===Oe.open;qe.eventLog(E&&e&&M.isAndroid?"使用主线程+quotacontrol写文件":"使用主线程写文件")}},{key:"bindEvent",value:function(){var e=this;this.worker.onMessage((function(t){var n=t.type,i=t.payload;n===vn.writeFile&&Je.emit("writeFile:".concat(i.filePath),i),n===vn.config&&(e.hasSetQuotaStatus||(e.supportWorkerFs=i.supportWorkerFs),e.supportSharedBuffer=i.supportSharedBuffer,E||e.printStatus())}))}},{key:"writeFile",value:function(e){var t=this;return new Promise((function(n,i){var a=e.filePath,o=e.data;if(!t.listener.has(a)){t.listener.add(a);var s=o;t.supportSharedBuffer&&(s=r.createSharedArrayBuffer(o.byteLength),new Uint8Array(s.buffer).set(new Uint8Array(o))),t.worker.postMessage({type:vn.writeFile,payload:{isSharedBuffer:t.supportSharedBuffer,filePath:a,data:s}}),Je.once("writeFile:".concat(a),(function(e){t.listener.delete(a),e.isok?n():i(e.err)}))}}))}}],[{key:"instance",get:function(){return e.privateInstance||(e.privateInstance=new e),e.privateInstance}}]),e}();!function(e){e.InvalidCachePath="invalid cache path",e.EmptyPath="empty path",e.EmptyContent="empty content",e.ExceedMemory="exceed memory",e.FrequentWrite="frequent writes in a short time",e.OutOfRange="out of range"}(yn||(yn={})),function(e){e.QuotaControlError="quota_control_error",e.WriteFile="writeFile",e.ExceedMaxStorage="exceed_max_storage"}(Tn||(Tn={}));var Cn,wn=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},In=r.getFileSystemManager();!function(e){e[e.NO_NEED_RELEASE_MEMORY=1]="NO_NEED_RELEASE_MEMORY",e[e.EXCEED_MEMORY=2]="EXCEED_MEMORY",e[e.RELEASED_MEMORY=3]="RELEASED_MEMORY",e[e.CANNOT_RELEASE=4]="CANNOT_RELEASE"}(Cn||(Cn={}));var Rn=function(){function t(){l(this,t)}return d(t,null,[{key:"checkIsNewUser",value:function(){return!t.fileSystem.isOldUser}},{key:"statAsyncCatch",value:function(e,t,n){return new Promise((function(i){In.stat({path:e,recursive:t,success:function(e){i(e.stats)},fail:function(a){n||Dt.send(new Mt({ReportType:Ee.DEFAULT,ErrorMsg:"".concat(a.errMsg),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({type:"statAsyncCatch",path:e,recursive:t})})),i(null)}})}))}},{key:"checkFileExist",value:function(e){try{return In.accessSync(e),!0}catch(e){return!1}}},{key:"getFileSize",value:function(n){return wn(this,void 0,void 0,e().mark((function i(){var a;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.statAsyncCatch(n);case 2:return a=e.sent,e.abrupt("return",a&&(null==a?void 0:a.size)||0);case 4:case"end":return e.stop()}}),i)})))}},{key:"getMd5",value:function(e){return new Promise((function(t,n){e?(0,In.getFileInfo)({filePath:e,success:function(e){var n=e.digest;t(n)},fail:n,complete:function(){}}):t("")}))}},{key:"readFile",value:function(e,i){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise((function(r,s){var u=e;a||(u=un(e)),In.readFile({filePath:u,encoding:i,success:function(i){var s;if(a&&(u=nn(null!==(s=o.dataFileSubPrefix)&&void 0!==s?s:"",rn(e,".txt"))),t.fileSystem.findFile(u)&&t.fileSystem.updateAccessTime(u,a),M.isIOS&&!M.isWK){var c=En(new Uint8Array(i.data)),l=n(c,1)[0];i.data=l}r(i.data)},fail:s})}))}},{key:"readCompressedFile",value:function(e){return new Promise((function(t,n){In.readCompressedFile({filePath:e,compressionAlgorithm:"br",success:function(e){return t(e.data)},fail:n})}))}},{key:"readCompressedFileSync",value:function(e){return In.readCompressedFileSync({filePath:e,compressionAlgorithm:"br"})}},{key:"readFileBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;return new Promise((function(i,a){In.readFile({filePath:e,position:t,length:n,success:function(e){i(e.data)},fail:a})}))}},{key:"readFileTrunk",value:function(i){var a,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return wn(this,void 0,void 0,e().mark((function s(){var u,c,l,d,h,f,p,m,g,v,y,T,S;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getFileSize(i);case 2:if(u=e.sent){e.next=5;break}return e.abrupt("return",new ArrayBuffer(0));case 5:c=i,r&&(c=nn(null!==(a=o.dataFileSubPrefix)&&void 0!==a?a:"",rn(i,".txt"))),(l=t.fileSystem.findFile(c))&&t.fileSystem.updateAccessTime(l.path,r),d=new ArrayBuffer(u),h=new Uint8Array(d),f=8e6,p=0;case 11:if(!(p<u)){e.next=21;break}return m=Math.min(f,u-p),qe.pluginLog("read part:",p,m),e.next=16,t.readFileBuffer(i,p,m);case 16:g=e.sent,h.set(new Uint8Array(g).subarray(0,m),p),g.byteLength>m&&(qe.pluginWarn("读取".concat(i,"超过边界, byteLength: ").concat(g.byteLength,"; offset: ").concat(p,"; toread: ").concat(m)),Dt.send(new Mt({ReportType:Ee.OUT_OF_RANGE,ErrorMsg:yn.OutOfRange,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({size:g.byteLength,offset:p,toread:m,filePath:i})})));case 18:p+=f,e.next=11;break;case 21:if(!M.isIOS||M.isWK){e.next=24;break}return v=En(h),y=n(v,2),T=y[0],S=y[1],e.abrupt("return",(S&&t.cleanAllCache(),T));case 24:return e.abrupt("return",d);case 25:case"end":return e.stop()}}),s)})))}},{key:"downloadFileByXMLHttpRequest",value:function(e){return new Promise((function(t,n){var i=new o.XMLHttpRequest;i.open("GET",e),i.responseType="arraybuffer",i.onload=function(){t(i)},i.onerror=function(e){n(e)},i.ontimeout=function(){n(new Error("timeout"))},i.onabort=function(){n(new Error("abort"))},i.send()}))}},{key:"downloadFileAsync",value:function(e){return new Promise((function(t,n){r.downloadFile({url:e,timeout:6e4,success:t,fail:n})}))}},{key:"removeExpiredFile",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=In.stat,n=In.unlinkSync;t({path:ye,recursive:!0,success:function(t){Object.keys(t.stats).forEach((function(i){var a=t.stats[i].stats;"/"!==a.path&&a.isFile()&&(Date.now()/1e3-1e3*a.lastAccessedTime)/86400>e&&(qe.pluginWarn("删除长时间未使用资源 ".concat(ye,"/").concat(a.path)),n("".concat(ye,"/").concat(a.path)))}))}})}},{key:"saveFileFS",value:function(e,t){return new Promise((function(n,i){In.saveFile({tempFilePath:e,filePath:t,success:n,fail:i})}))}},{key:"saveFile",value:function(i,a){return wn(this,void 0,void 0,e().mark((function r(){var o,s,u,c,l,d,h,f,p,m;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=sn(i),s=rn(i),u=un(i),!(c=t.fileSystem.findFile(i))){e.next=3;break}return e.abrupt("return",(qe.pluginLog("".concat(s,"已有缓存, 无须重复缓存")),Promise.resolve(c.path)));case 3:return t.fileSystem.removeFilesExclude(i),l=mn(a),e.next=7,t.getFileSize(l);case 7:return d=e.sent,e.next=10,t.fileSystem.releaseMemory(d);case 10:if(e.t0=e.sent,e.t1=Cn.EXCEED_MEMORY,e.t0!==e.t1){e.next=14;break}return e.abrupt("return",(qe.pluginWarn("saveFile: 空间不足,缓存".concat(s,"失败")),t.fileSystem.init(),Promise.resolve(l)));case 14:return e.next=16,t.fileSystem.mkdir(o);case 16:return je.timeStart("saveFile ".concat(u)),e.next=19,it(t.saveFileFS(l,u));case 19:return h=e.sent,f=n(h,2),p=f[0],m=f[1],e.abrupt("return",m?(qe.debugLog("缓存文件:".concat(s,"成功,size: ").concat(ut(d),"KB,耗时:").concat(je.timeEnd("saveFile ".concat(u)),"ms")),t.fileSystem.addFile({size:d,path:i}),Promise.resolve(m.savedFilePath)):(qe.pluginError("".concat(s,"缓存失败:"),p.errMsg||p.message,p),t.fileSystem.init(),Promise.resolve(l)));case 24:case"end":return e.stop()}}),r)})))}},{key:"writeFile",value:function(n){return wn(this,void 0,void 0,e().mark((function i(){var a,r,o,s,u,c,l,d,h;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n.filePath,r=n.data,o=n.skipCleanOld,a&&(null==a?void 0:a.trim())){e.next=3;break}return e.abrupt("return",Promise.reject(yn.EmptyPath));case 3:if(e.t0=t.fileSystem.initPromise,!e.t0){e.next=7;break}return e.next=7,t.fileSystem.initPromise;case 7:if(s=sn(a),u=rn(a),c=un(a),!(l=t.fileSystem.findFile(a))){e.next=10;break}return e.abrupt("return",(qe.pluginLog("".concat(u,"已有缓存")),Promise.resolve(l.path)));case 10:if(e.t1=o,!e.t1){e.next=14;break}return e.next=14,t.fileSystem.removeFilesExclude(a);case 14:return d=r.byteLength,e.next=17,t.fileSystem.releaseMemory(d);case 17:if((h=e.sent)!==Cn.EXCEED_MEMORY){e.next=22;break}e.t2=(qe.pluginError("空间不足,写入".concat(u,"失败;")),t.fileSystem.init(),Promise.reject(new Error(yn.ExceedMemory))),e.next=31;break;case 22:if(h!==Cn.CANNOT_RELEASE){e.next=26;break}e.t3=Promise.reject(new Error(yn.FrequentWrite)),e.next=30;break;case 26:return e.next=28,t.fileSystem.mkdir(s);case 28:je.timeStart("writeFile ".concat(u)),e.t3=bn.instance.supportWorkerFs?t.workerWriteFile({cachePath:c,content:r,fileSize:d,filename:u,path:a}):t.normalWriteFile({cachePath:c,content:r,fileSize:d,filename:u,path:a});case 30:e.t2=e.t3;case 31:return e.abrupt("return",e.t2);case 32:case"end":return e.stop()}}),i)})))}},{key:"workerWriteFile",value:function(e){var n=e.cachePath,i=e.content,a=e.fileSize,r=e.path,o=e.filename;return new Promise((function(e,s){bn.instance.writeFile({filePath:n,data:i}).then((function(){qe.debugLog("缓存 ".concat(o,"成功;size: ").concat(ut(a),"KB,耗时: ").concat(je.timeEnd("writeFile ".concat(o)),"ms")),t.fileSystem.addFile({size:i.byteLength,path:r}),e(n)})).catch((function(e){var n;qe.pluginError("缓存 ".concat(o,"失败:"),e,",totalSize=",t.fileSystem.totalSize,",size: ",ut(a),"KB,耗时:",je.timeEnd("writeFile ".concat(o)),"ms"),(null===(n=e.errMsg)||void 0===n?void 0:n.includes("maximum"))&&t.fileSystem.totalSize+i.byteLength<=Pe&&Dt.send(new Mt({ReportType:Ee.QUOTA_CONTROL,ErrorMsg:e.errMsg,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({type:Tn.QuotaControlError,filename:o,size:i.byteLength,totalSize:t.fileSystem.totalSize,maxAllowSize:Pe})})),t.fileSystem.totalSize+i.byteLength>=Pe&&Dt.send(new Mt({ReportType:Ee.EXCEED_MAX,ErrorMsg:e.errMsg,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({type:Tn.ExceedMaxStorage,filename:o,size:i.byteLength,totalSize:t.fileSystem.totalSize})})),Dt.send(new Mt({ReportType:Ee.WRITEFILE,ErrorMsg:"".concat(e.errMsg),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({type:Tn.WriteFile,filename:o,size:i.byteLength,totalSize:t.fileSystem.totalSize,maxAllowSize:Pe})})),t.fileSystem.init(),s(e)}))}))}},{key:"normalWriteFile",value:function(e){var n=e.cachePath,i=e.content,a=e.fileSize,r=e.path,o=e.filename;return new Promise((function(e,s){In.writeFile({filePath:n,data:i,encoding:"binary",success:function(){qe.debugLog("缓存 ".concat(o,"成功;size: ").concat(ut(a),"KB,耗时: ").concat(je.timeEnd("writeFile ".concat(o)),"ms")),t.fileSystem.addFile({size:i.byteLength,path:r}),e(n)},fail:function(e){var n;qe.pluginError("缓存 ".concat(o,"失败:"),e.errMsg,",totalSize=",t.fileSystem.totalSize,",size: ",ut(a),"KB,耗时:",je.timeEnd("writeFile ".concat(o)),"ms",e),(null===(n=e.errMsg)||void 0===n?void 0:n.includes("maximum"))&&t.fileSystem.totalSize+i.byteLength<=Pe&&Dt.send(new Mt({ReportType:Ee.QUOTA_CONTROL,ErrorMsg:e.errMsg,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({type:Tn.QuotaControlError,filename:o,size:i.byteLength,totalSize:t.fileSystem.totalSize,maxAllowSize:Pe})})),Dt.send(new Mt({ReportType:Ee.WRITEFILE,ErrorMsg:"".concat(e.errMsg),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({type:Tn.WriteFile,filename:o,size:i.byteLength,totalSize:t.fileSystem.totalSize,maxAllowSize:Pe})})),t.fileSystem.init(),s(e)}})}))}},{key:"cleanAllCache",value:function(){return t.fileSystem.cleanAllCache()}},{key:"removeFile",value:function(e){return t.fileSystem.removeFile(e,!0)}},{key:"getFileInfo",value:function(e){return t.fileSystem.getFileInfo(e)}},{key:"removeFileInfo",value:function(e){return t.fileSystem.removeFileInfo(e)}},{key:"modifyFileInfo",value:function(e){return t.fileSystem.modifyFileInfo(e)}},{key:"addFileInfo",value:function(e){return t.fileSystem.addFile(e)}},{key:"getCachePath",value:function(e){var n=t.getFileInfo(e);return n?n.path:""}},{key:"readJson",value:function(i){var a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return wn(this,void 0,void 0,e().mark((function r(){var o,s,u,c;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i){e.next=10;break}return e.next=3,it(t.readFile(i,"utf-8"));case 3:if(o=e.sent,s=n(o,2),u=s[0],!(c=s[1])){e.next=9;break}return e.abrupt("return",JSON.parse(c));case 9:u&&a&&qe.pluginWarn("读取json: ".concat(i,"失败"),u.errMsg||u.message,u);case 10:return e.abrupt("return",null);case 11:case"end":return e.stop()}}),r)})))}},{key:"writeJson",value:function(e,t){if(e&&t){var n=JSON.stringify(t);In.writeFile({filePath:e,data:n,encoding:"utf-8",success:function(){qe.pluginLog("写入json: ".concat(e,"成功"))},fail:function(t){qe.pluginWarn("写入json: ".concat(e,"失败"),t.errMsg,t)}})}}},{key:"mkdir",value:function(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ye;return wn(this,void 0,void 0,e().mark((function a(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.fileSystem.mkdir(n,i));case 1:case"end":return e.stop()}}),a)})))}}]),t}();Rn.fileSystem=Pn.getIntance();var Ln=N.pixelRatio,Mn={},An=[-1,-1,0,1,-1,0,1,1,0,-1,1,0],_n=[0,1,2,0,2,3],Dn=[0,0,1,0,1,1,0,1];function Fn(e,t,n){var i=e.createShader(n);return e.shaderSource(i,t),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||console.error("Error compiling shader: ".concat(e.getShaderInfoLog(i))),i}function xn(e,t,n){if(e){e.frontFace(e.CCW),e.canvas.width=t*Ln,e.canvas.height=n*Ln,e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight);var i=Fn(e,"\n  attribute vec3 aPos;\n  attribute vec2 aVertexTextureCoord;\n  varying highp vec2 vTextureCoord;\n\n  void main(void){\n    gl_Position = vec4(aPos, 1);\n    vTextureCoord = aVertexTextureCoord;\n  }\n",e.VERTEX_SHADER),a=Fn(e,"\n  varying highp vec2 vTextureCoord;\n  uniform sampler2D uSampler;\n\n  void main(void) {\n    gl_FragColor = texture2D(uSampler, vTextureCoord);\n  }\n",e.FRAGMENT_SHADER),r=e.createProgram();if(e.attachShader(r,i),e.attachShader(r,a),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS)){e.useProgram(r);var o=e.createTexture();e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),Mn.vertexBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,Mn.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(An),e.STATIC_DRAW),Mn.vertexIndiceBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,Mn.vertexIndiceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array(_n),e.STATIC_DRAW);var s=e.getAttribLocation(r,"aPos");e.vertexAttribPointer(s,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s),Mn.trianglesTexCoordBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,Mn.trianglesTexCoordBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(Dn),e.STATIC_DRAW);var u=e.getAttribLocation(r,"aVertexTextureCoord");e.enableVertexAttribArray(u),e.vertexAttribPointer(u,2,e.FLOAT,!1,0,0);var c=e.getUniformLocation(r,"uSampler");return e.uniform1i(c,0),function(t){e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1)}}console.error("Unable to initialize the shader program.")}else console.error("Unable to get webgl context.")}var On,Nn=function(){function e(t){l(this,e),this.useCoverView=t,this.renderer=null,this.offscreenCanvas=null,this.useCoverView||this.init()}return d(e,[{key:"getRenderer",value:function(){return e.instance}},{key:"refresh",value:function(){if(!this.useCoverView){var e=h.getContext("webgl",{alpha:1});this.renderer=xn(e,G,U)}}},{key:"init",value:function(){if(!e.instance){var t=o.globalGL,n=G,i=U,a=xn(t,n,i),s=r.createCanvas();s.width=n*B,s.height=i*B;var u=s.getContext("2d");this.renderer=a,this.offscreenCanvas=s,this.offscreenCtx=u,e.instance=this}}}],[{key:"getInstance",value:function(){return e.instance}},{key:"getRenderer",value:function(){return e.instance}}]),e}(),Wn=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.apply(this,arguments)).destroyed=!1,e}return d(n,[{key:"renderProgress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{progress:0,originContent:""},n=t.progress,i=t.originContent,a=G,r=U,o=this.renderer,s=this.offscreenCanvas,u=this.offscreenCtx,c=N.safeArea,l=r-c.bottom;if(u){u.clearRect(0,0,nt(a),nt(r)),u.fillStyle="rgba(0, 0, 0, 0.3)",u.fillRect(0,nt(r-48-l),nt(a),nt(48+l)),u.fillStyle="rgb(151, 151, 151)",u.fillRect(nt((a-320)/2),nt(r-36-l),nt(320),nt(4)),u.fillStyle="rgba(255, 255, 255, 1)",u.fillRect(nt((a-320)/2),nt(r-36-l),nt(parseInt(String(320*n),10)),nt(4)),u.font="".concat(nt(14),"px serif"),u.fillStyle="#fff";var d=0;i?(d=u.measureText(i).width,u.textAlign="start"):u.textAlign="center",u.fillText("".concat(e),nt((a-d/B)/2),nt(r-12-l)),o(s)}}},{key:"hideProgress",value:function(){if(!this.destroyed&&!this.useCoverView){this.destroyed=!0;var e=o.globalGL;this.offscreenCtx.clearRect(0,0,nt(G),nt(U)),this.renderer=null,this.offscreenCanvas=null,this.offscreenCtx=null,e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)}}}]),n}(Nn);!function(e){e.DEFAULT="DEFAULT",e.PENDING="PENDING",e.FULFILLED="FULFILLED",e.REJECTED="REJECTED"}(On||(On={}));var Bn=function(e){u(n,e);var t=c(n);function n(){return l(this,n),t.apply(this,arguments)}return d(n,[{key:"setProgress",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{progress:0,status:On.DEFAULT},a=i.progress,r=i.status,o=n.launchProgress[e];if(this.updateStatus(o,r),this.updateProgress(o,a||0),!this.useCoverView){var s=o.title,u=o.status,c=o.progress,l=void 0===c?0:c,d=o.fakeProgress,h=o.previousStatus,f=o.timer,p=e>ke.PREPARE_GAME;u===On.FULFILLED&&f&&(p||this.renderProgress("".concat(s),{progress:100}),clearInterval(f),o.timer=null),p||(null==h?void 0:h.some((function(e){return n.launchProgress[e].status!==On.FULFILLED})))||(void 0!==d&&u!==On.FULFILLED?(this.renderProgress("".concat(s),{progress:0}),o.timer=setInterval((function(){var e=d||0,n=o.title;if(o.status!==On.FULFILLED){var i=e+5>100?100:e+5;o.fakeProgress=i;var a=(n.match(/(\.)+/g)||[""])[0].length,r=n.includes(".")?n.replace(/(\.)+$/g,"...".substr(2-a)):"".concat(n,".");o.title=r,t.renderProgress("".concat(r),{progress:i/100,originContent:n.replace(/(\.)+$/g,"")})}}),700)):this.renderProgress("".concat(s," ").concat(l?"".concat(l.toFixed(2),"%"):""),{progress:l/100}))}}},{key:"updateStatus",value:function(e,t){t&&(e.status!==On.DEFAULT&&e.status!==On.PENDING||(e.status=t))}},{key:"updateProgress",value:function(e,t){t&&t<=100&&(e.progress=t>100?100:Math.max(t,0))}}]),n}(Wn);Bn.launchProgress=i(i(i(i(i(i({},ke.LOAD_SUBPACKAGE,{stage:"LOAD_SUBPACKAGE",status:On.DEFAULT,title:"分包下载中",progress:0,previousStatus:[ke.LOAD_ASSETS],priority:1}),ke.LOAD_ASSETS,{stage:"LOAD_ASSETS",status:On.DEFAULT,title:"资源下载中",progress:0,priority:2}),ke.UNZIP_ASSETS,{stage:"UNZIP_ASSETS",status:On.DEFAULT,title:"资源解析中",fakeProgress:0,timer:null,previousStatus:[ke.LOAD_SUBPACKAGE],priority:3}),ke.READ_ASSETS,{stage:"READ_ASSETS",status:On.DEFAULT,title:"资源解析中",fakeProgress:0,timer:null,previousStatus:[ke.LOAD_SUBPACKAGE],priority:4}),ke.COMPILE_WASM,{stage:"COMPILE_WASM",status:On.DEFAULT,title:"资源编译中",fakeProgress:0,timer:null,previousStatus:[ke.READ_ASSETS],priority:5}),ke.PREPARE_GAME,{stage:"PREPARE_GAME",status:On.DEFAULT,title:"游戏初始化",fakeProgress:0,timer:null,previousStatus:[ke.COMPILE_WASM,ke.READ_ASSETS],priority:6});var Vn,Un=function(e){u(n,e);var t=c(n);function n(){return l(this,n),t.apply(this,arguments)}return d(n,[{key:"init",value:function(e){this.unityManager=e,this.bindFunction()}},{key:"bindFunction",value:function(){}}]),n}(de),Gn=p(4293).default,jn=function(e){u(i,e);var t=c(i);function i(){var e;return l(this,i),(e=t.apply(this,arguments)).beforeLoadSubWasm=function(){si.wasmSplitMonitor.startLoadSubWasm(),je.printRuntime("首次加载subwasm"),_t.send(new Mt({ReportType:Ie.BEFORE_LOAD_SUB_WASM,CostTimeMs:0,RunTimeMs:je.getRuntime()})),(!e.unityManager.mainCalled||je.timeEnd("游戏主场景耗时",!1)<100)&&(qe.eventLog("subwasm在callmain完成前加载"),_t.send(new Mt({ReportType:Ie.LOAD_SUB_WASM_VERY_EARLY,CostTimeMs:0,RunTimeMs:je.getRuntime()})))},e.reportMissElem=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{miss_elem_list:[],sub_version:0},t=e.miss_elem_list,i=e.sub_version,a=N.model;Gn.network.gameTransfer({url:"gamewxagwasmsplitwap_reportsplitmisselem",data:{device:a,miss_elem_list:t,meta_info:{md5:o.CODE_FILE_MD5,sub_version:Number(i)}}}).then((function(e){var t=n(e,1)[0];qe.eventLog("reportsplitmisselem success ",t)})).catch((function(e){qe.pluginError("reportsplitmisselem fail ",e)}))},e.reportCalledFuncs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{called_func_list:[],sub_version:0,func_type:0},t=e.called_func_list,i=e.sub_version,a=e.func_type,r=N.model;Gn.network.gameTransfer({url:"gamewxagwasmsplitwap_reportsplitcalledfuncs",data:{device:r,called_func_list:t,func_type:a,meta_info:{md5:o.CODE_FILE_MD5,sub_version:Number(i)}}}).then((function(e){var t=n(e,1)[0];qe.eventLog("reportsplitcalledfuncs success ",t)})).catch((function(e){qe.pluginError("reportsplitcalledfuncs fail ",e)}))},e}return d(i,[{key:"startFetchJsCode",value:function(){je.printRuntime("首次拉取js函数"),_t.send(new Mt({ReportType:Ie.FETCH_JS,RunTimeMs:je.getRuntime()})),(!this.unityManager.mainCalled||je.timeEnd("游戏主场景耗时",!1)<100)&&(qe.eventLog("在callmain完成前fetchjs"),_t.send(new Mt({ReportType:Ie.LOAD_SUB_WASM_VERY_EARLY,CostTimeMs:0,RunTimeMs:je.getRuntime()})))}},{key:"reportWaitTime",value:function(e){qe.eventLog("加载subwasm时,signal wait时长: ".concat(e)),_t.send(new Mt({ReportType:Ie.WAIT_SUB_WASM_END,CostTimeMs:e,RunTimeMs:je.getRuntime()}))}},{key:"subWasmDownloaded",value:function(e){var t=e.costTime,n=e.runtime,i=e.fileSize;si.wasmSplitMonitor.finishLoadSubWasm(),qe.eventLog("subwasm下载耗时 ",t),_t.send(new Mt({ReportType:Ie.SUB_WASM_LOAD,CostTimeMs:t,RunTimeMs:n,ExternInfo:JSON.stringify({fileSize:i})}))}},{key:"subWasmDownloadError",value:function(e){qe.pluginError("subwasm下载失败 ",e),Dt.send(new Mt({ReportType:Ie.SUB_WASM_LOAD,ErrorMsg:"".concat(e.statusCode,"__").concat(e.errMsg),RunTimeMs:je.getRuntime()}))}},{key:"subWasmCompiled",value:function(e){qe.eventLog("subwasm编译耗时 ",e),_t.send(new Mt({ReportType:Ie.SUB_WASM_COMPILED,CostTimeMs:e,RunTimeMs:je.getRuntime()}))}},{key:"reportMissFuncInPatch",value:function(e){_t.send(new Mt({ReportType:Ie.MISS_PATCH_FUNC,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({index:e})}))}},{key:"bindFunction",value:function(){this.unityManager.reporter.wasmcode={reportMissElem:this.reportMissElem.bind(this),reportCalledFuncs:this.reportCalledFuncs.bind(this),startFetchJsCode:this.startFetchJsCode.bind(this),reportWaitTime:this.reportWaitTime.bind(this),beforeLoadSubWasm:this.beforeLoadSubWasm.bind(this),subWasmDownloaded:this.subWasmDownloaded.bind(this),subWasmDownloadError:this.subWasmDownloadError.bind(this),subWasmCompiled:this.subWasmCompiled.bind(this)},Object.defineProperties(this.unityManager,{reportMissElem:{value:this.reportMissElem.bind(this)},reportCalledFuncs:{value:this.reportCalledFuncs.bind(this)},startFetchJsCode:{value:this.startFetchJsCode.bind(this)},reportWaitTime:{value:this.reportWaitTime.bind(this)},beforeLoadSubWasm:{value:this.beforeLoadSubWasm.bind(this)},subWasmDownloaded:{value:this.subWasmDownloaded.bind(this)},subWasmDownloadError:{value:this.subWasmDownloadError.bind(this)},subWasmCompiled:{value:this.subWasmCompiled.bind(this)}})}}]),i}(Un).getInstance(),zn=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},Hn=function(t){u(i,t);var n=c(i);function i(){var t;return l(this,i),(t=n.apply(this,arguments)).subWasmModuleName="wasmcode1",t.retryCount=1,t.retryDuration=1500,t.pendingDuration=6e4,t.unityModuleInited=!1,t.invokeLoadWasmCode=function(n){return new Promise((function(i,a){var o=0===n,u=!1,c=s(t).unityManager;Ze.triggerEvent(He.WasmLoading,Ye($e,c)),c.launchStage.setProgress(ke.LOAD_SUBPACKAGE,{progress:0,status:On.PENDING}),je.timeStart("下载wasm代码包"),qe.eventLog("开始下载wasm代码包"),r.loadSubpackage({name:t.moduleName,success:function(){return zn(s(t),void 0,void 0,e().mark((function t(){var n,a,r;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.setWasmInfo(),Ze.triggerEvent(He.WasmLoaded,Ye($e,c)),je.printTime("下载wasm代码包"),c.launchStage.setProgress(ke.LOAD_SUBPACKAGE,{progress:100,status:On.FULFILLED}),c.triggerLaunchProgress(ke.LOAD_SUBPACKAGE,je.timeEnd("下载wasm代码包",!1)),!si.enableMonitor){e.next=6;break}return si.commonMonitor.recordWasm({duration:je.timeEnd("下载wasm代码包",!1)}),e.next=4,Rn.getFileSize("".concat(this.wasmPath));case 4:n=e.sent,si.commonMonitor.recordWasm({contentLength:n});case 6:a=je.timeEnd("下载wasm代码包"),r=je.getRuntime(),Rn.getFileSize(this.wasmPath).then((function(e){_t.send(new Mt({ReportType:ke.LOAD_SUBPACKAGE,CostTimeMs:a,RunTimeMs:r,ExternInfo:JSON.stringify({fileSize:e})}))})),setTimeout((function(){i()}),0);case 8:case"end":return e.stop()}}),t,this)})))},fail:function(e){t.handleDownloadError(e,o),a(e)},complete:function(){u=!0,c.loadingCount-=1,c.launchStage.setProgress(ke.LOAD_SUBPACKAGE,{progress:100,status:On.FULFILLED})}}).onProgressUpdate((function(e){var t=(e.totalBytesWritten/1048576).toFixed(2),n=(e.totalBytesExpectedToWrite/1048576).toFixed(2);J||qe.pluginLog("wasm代码包下载进度",e.progress,t,"MB;",n,"MB"),c.launchStage.setProgress(ke.LOAD_SUBPACKAGE,{progress:100*e.progress})})),setTimeout((function(){u||(o&&t.handleDownloadError(xe.Wasm,o),qe.pluginError(xe.Wasm),a(new Error(xe.Wasm)))}),t.pendingDuration)})).then((function(){var e=s(t).unityManager;e.loadingPageType===he.COVER_VIEW&&e.loadingPage.showCompileWasm(),e.launchStage.setProgress(ke.COMPILE_WASM,{status:On.PENDING}),qe.eventLog("start invoke UnityModule"),o.useDotnetRuntime?(qe.eventLog("invoke UnityModule for dotnet"),e.gameInstance.Module.preInit=[function(){qe.eventLog("UnityModule preInit"),t.unityModuleInited=!0,Ze.triggerEvent(He.ModulePrepared),Kn.processRawData()}],o.UnityModule(e.gameInstance.Module)):(qe.eventLog("invoke UnityModule for il2cpp"),o.UnityModule(e.gameInstance.Module),t.unityModuleInited=!0,Ze.triggerEvent(He.ModulePrepared),Kn.processRawData())}))},t}return d(i,[{key:"init",value:function(e){this.unityManager=e,this.initConfig()}},{key:"loadWasmCode",value:function(){return(0,x.gj)(this.invokeLoadWasmCode,this.retryCount,this.retryDuration)}},{key:"parallelFetchSubWasm",value:function(){var e=this;return qe.eventLog("loadSubPackage1"),new Promise((function(t,n){jn.beforeLoadSubWasm(),je.timeStart("subWasmLoad"),o._subWasmLoading=!0;var i=r.loadSubpackage({name:e.subWasmModuleName,success:function(){o._subWasmLoading=!1,o._subWasmLoaded=!0,console.log("[PLUGIN TIME LOG]下载小游戏分包1: ",je.timeEnd("subWasmLoad",!1),"ms"),qe.eventLog("下载代码分包1完毕");var n=je.timeEnd("subWasmLoad"),i=je.getRuntime();Rn.getFileSize("".concat(e.subWasmModuleName,"/").concat(e.filename)).then((function(e){qe.eventLog("subwasm download size=".concat(e)),jn.subWasmDownloaded({costTime:n,runtime:i,fileSize:e})})),t()},fail:function(e){o._subWasmLoading=!1,console.error("[PLUGIN SUBWASM ERROR]load subwasm subpackage fail: ",e),jn.subWasmDownloadError(e),n()},complete:function(){}}),a=0;i.onProgressUpdate((function(e){var t=Math.floor(e.progress/10);if(t!==a){var n=(e.totalBytesWritten/1048576).toFixed(2),i=(e.totalBytesExpectedToWrite/1048576).toFixed(2);console.log("代码分包1下载进度",e.progress,n,"MB;",i,"MB")}a=t}))}))}},{key:"setWasmInfo",value:function(){Rn.writeFile({filePath:this.filename,data:new ArrayBuffer(1)})}},{key:"initConfig",value:function(){var e=o,t=e.CODE_FILE_MD5,n=e.GAME_NAME,i=Z&&this.unityManager.codeType===Le.codeSplit;this.moduleName=!re&&i?"wasmcode_wk":"wasmcode",this.md5=t,this.filename="".concat(this.md5,".").concat(n,".wasm.code.unityweb.wasm.br"),this.wasmPath="".concat(this.moduleName,"/").concat(this.filename),this.unityManager.gameInstance.Module.wasmPath=this.wasmPath}},{key:"handleDownloadError",value:function(e,t){var n=e;if("number"==typeof e||"string"==typeof e||(n=e.errMsg||e.message),qe.pluginError("下载wasm代码包失败",": networkType=",Et.networkType,", isVisible=",vt(),", errMsg=",n,", error=",e),Dt.send(new Mt({ReportType:ke.LOAD_SUBPACKAGE,ErrorMsg:n,RunTimeMs:je.getRuntime()})),t){var i=!M.isPC&&n===xe.Wasm&&!!r.restartMiniProgram;qe.pluginError("wasm代码包下载最终失败"),r.showModal({title:"下载wasm代码包失败",confirmText:i?"重启游戏":"确定",content:"".concat(n).concat(M.isPC&&n===xe.Wasm?"\n请从 微信-小程序-最近使用 重新打开":""),showCancel:!1,success:function(){i&&r.restartMiniProgram({})}})}}}]),i}(de).getInstance(),qn=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},Kn=function(t){u(a,t);var i=c(a);function a(){var t;return l(this,a),(t=i.apply(this,arguments)).loadDataPackageFromSubpackage=!1,t.compressDataPackage=!1,t.retryCount=1,t.retryDuration=1500,t.pendingDuration=6e4,t.dataPackageLoaded=!1,t.preloadDataProcessed=!1,t.releaseAblePaths=[],t.processRawData=function(){var e,n=s(t).unityManager;if(!t.preloadDataProcessed&&t.dataPackageLoaded&&Hn.unityModuleInited){var i=n.gameInstance.Module.rawData,a=new Uint8Array(i),r=new DataView(i),u=0,c="";i&&t.checkPackageSize(i.byteLength)||(c="mismatch data size");for(var l="",d="",h=0,f=["UnityWebData1.0\0","TuanjieWebData1.0\0"];h<f.length;h++){var p=f[h];if((d=String.fromCharCode.apply(null,a.subarray(u,u+p.length)))===p){l=d;break}}if(qe.pluginLog("prefix",d),l||c||(c="unknown data format"),c.length)throw t.handleDataError({errMsg:c,byteLength:null==i?void 0:i.byteLength,defaultSize:t.defaultSize,prefix:d}),c;u+=l.length;var m=r.getUint32(u,!0);for(u+=4,je.timeStart("解析资源");u<m;){var g=r.getUint32(u,!0);u+=4;var v=r.getUint32(u,!0);u+=4;var y=r.getUint32(u,!0);u+=4;var T=String.fromCharCode.apply(null,a.subarray(u,u+y));u+=y;for(var S=0,P=T.indexOf("/",S)+1;P>0;S=P,P=T.indexOf("/",S)+1)o.FS.createPath(T.substring(0,S),T.substring(S,P-1),!0,!0);(null===(e=null==T?void 0:T.includes)||void 0===e?void 0:e.call(T,"metadata.dat"))&&t.releaseAblePaths.push(T),o.FS.createDataFile(T,null,a.slice(g,g+v),!0,!0,!0)}t.preloadDataProcessed=!0,n.gameInstance.Module.rawData=null,je.printTime("解析资源"),je.timeEnd("解析资源"),Ze.triggerEvent(He.AssetProcessed,Ye($e,n)),n.gameInstance.Module.removeRunDependency("wasm-preloadAssets")}},t.releaseDataPackage=function(){t.releaseAblePaths.forEach((function(e){var t,n;try{null===(n=null==o?void 0:(t=o.FS).unlink)||void 0===n||n.call(t,e)}catch(e){qe.pluginError("删除首资源包meta段错误: ".concat(e.message))}}))},t.loadAssetsByDownloadFile=function(i){return qn(s(t),void 0,void 0,e().mark((function t(){var a=this;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,s){var u=0===i,c=a.unityManager,l=nn(o.DATA_CDN,a.downloadPath);qe.eventLog("资源包下载url:".concat(l)),je.timeStart("下载资源包耗时"),c.launchStage.setProgress(ke.LOAD_ASSETS,{status:On.PENDING}),r.downloadFile({url:l,timeout:6e4,success:function(i){return qn(a,void 0,void 0,e().mark((function a(){var r,o,l,d,h,f;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.statusCode,o=i.tempFilePath,l=i.profile,!dt(r)){e.next=10;break}if(je.printTime("下载资源包耗时"),c.triggerLaunchProgress(ke.LOAD_ASSETS,je.timeEnd("下载资源包耗时",!1)),qe.eventLog("data download size=".concat(null==l?void 0:l.receivedBytedCount)),_t.send(new Mt({ReportType:ke.LOAD_ASSETS,CostTimeMs:je.timeEnd("下载资源包耗时"),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({fileSize:(null==l?void 0:l.receivedBytedCount)||0,defaultSize:this.defaultSize,optimalSize:this.optimalSize,compressDataPackage:this.compressDataPackage})})),!this.compressDataPackage){e.next=9;break}return e.next=5,(0,x.zI)(this.decompressPackage(o));case 5:return d=e.sent,h=n(d,1),f=h[0],e.abrupt("return",f?s(f):t());case 9:return e.abrupt("return",t(o));case 10:return e.abrupt("return",(this.handleDownloadError(r,u),s(r)));case 11:case"end":return e.stop()}}),a,this)})))},fail:function(e){return a.handleDownloadError(e,u),s(e)}}).onHeadersReceived((function(e){var t=lt(e.header,"Content-Encoding")||"",n=!t.includes("gzip")&&!t.includes("br");si.commonMonitor.recordAsset({useContentEncoding:!n||a.compressDataPackage}),n&&!a.compressDataPackage&&console.error("你的CDN未开启对txt文件的gzip/br,会增加文件:".concat(l," 的加载耗时!"))}))})));case 1:case"end":return t.stop()}}),t)})))},t.loadAssetsByXhr=function(n){return qn(s(t),void 0,void 0,e().mark((function t(){var i,a,r,s=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=0===n,a=this.unityManager,r=nn(o.DATA_CDN,this.downloadPath),e.abrupt("return",(qe.eventLog("资源包下载url:".concat(r)),je.timeStart("下载资源包耗时"),new Promise((function(e,t){a.launchStage.setProgress(ke.LOAD_ASSETS,{status:On.PENDING});var n=new o.XMLHttpRequest;n.open("GET",r),n.responseType="arraybuffer",n.timeout=6e4,n.onload=function(){var o,u,c=n.status;if(dt(c)){je.printTime("下载资源包耗时"),a.triggerLaunchProgress(ke.LOAD_ASSETS,je.timeEnd("下载资源包耗时",!1)),si.commonMonitor.recordAsset({duration:je.timeEnd("下载资源包耗时",!1),contentLength:n.response.byteLength}),qe.eventLog("data download size=".concat(null===(o=n.response)||void 0===o?void 0:o.byteLength)),_t.send(new Mt({ReportType:ke.LOAD_ASSETS,CostTimeMs:je.timeEnd("下载资源包耗时"),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({fileSize:(null===(u=n.response)||void 0===u?void 0:u.byteLength)||0,defaultSize:s.defaultSize,optimalSize:s.optimalSize,compressDataPackage:s.compressDataPackage})})),a.gameInstance.Module.rawData=n.response,s.printBufferContent(n.response),a.launchStage.setProgress(ke.READ_ASSETS,{status:On.FULFILLED}),a.triggerLaunchProgress(ke.READ_ASSETS,0),_t.send(new Mt({ReportType:ke.READ_ASSETS,CostTimeMs:0,RunTimeMs:je.getRuntime()})),Rn.writeFile({filePath:s.cachePath,data:n.response});var l=ct(n,"Content-Encoding")||"",d=!l.includes("gzip")&&!l.includes("br");si.commonMonitor.recordAsset({useContentEncoding:!d||s.compressDataPackage}),d&&!s.compressDataPackage&&console.error("你的CDN未开启对txt文件的gzip/br,会增加文件:".concat(r," 的加载耗时!")),e()}else s.handleDownloadError(c,i),t(n)};var u=function(e){s.handleDownloadError(e,i),t(e)};n.onerror=function(e){u(e)},n.ontimeout=function(){u(new Error("timeout"))},n.onabort=function(){u(new Error("abort"))},n.send()}))));case 2:case"end":return e.stop()}}),t,this)})))},t.invokeLoadDataPackage=function(i){return qn(s(t),void 0,void 0,e().mark((function t(){var a=this;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){var s=0===i,u=a.unityManager,c=!1;u.launchStage.setProgress(ke.LOAD_ASSETS,{status:On.PENDING}),je.timeStart("下载资源包");var l=r.loadSubpackage({name:"data-package",success:function(){return qn(a,void 0,void 0,e().mark((function i(){var a,r,s,c,l,d=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(je.printTime("下载资源包"),u.triggerLaunchProgress(ke.LOAD_ASSETS,je.timeEnd("下载资源包",!1)),si.commonMonitor.recordAsset({duration:je.timeEnd("下载资源包",!1),useContentEncoding:!0}),a=je.timeEnd("下载资源包"),r=je.getRuntime(),Rn.getFileSize("data-package/".concat(this.downloadFilename)).then((function(e){qe.eventLog("data download size=".concat(e)),_t.send(new Mt({ReportType:ke.LOAD_ASSETS,CostTimeMs:a,RunTimeMs:r,ExternInfo:JSON.stringify({fileSize:e,defaultSize:d.defaultSize,optimalSize:d.optimalSize,compressDataPackage:d.compressDataPackage,statCost:je.getRuntime()-r})}))})),!this.compressDataPackage){e.next=9;break}return e.next=5,(0,x.zI)(this.decompressPackage("data-package/".concat(this.downloadFilename)));case 5:return s=e.sent,c=n(s,1),l=c[0],e.abrupt("return",l?o(l):t());case 9:Rn.writeFile({filePath:this.cachePath,data:new ArrayBuffer(1)}),t("data-package/".concat(this.downloadFilename));case 10:case"end":return e.stop()}}),i,this)})))},fail:function(e){a.handleDownloadError(e,s),o(e)},complete:function(){c=!0,u.launchStage.setProgress(ke.LOAD_ASSETS,{progress:100,status:On.FULFILLED})}});setTimeout((function(){c||(s&&a.handleDownloadError(xe.DataPackage,s),qe.pluginError(xe.DataPackage),o(new Error(xe.DataPackage)))}),a.pendingDuration),l.onProgressUpdate((function(e){var t=(e.totalBytesWritten/1048576).toFixed(2),n=(e.totalBytesExpectedToWrite/1048576).toFixed(2);J||qe.eventLog("资源包下载进度",e.progress,t,"MB;",n,"MB"),u.launchStage.setProgress(ke.LOAD_ASSETS,{progress:100*e.progress})}))})));case 1:case"end":return t.stop()}}),t)})))},t}return d(a,[{key:"init",value:function(e,t){this.unityManager=e,this.initConfig(t)}},{key:"loadDataPackage",value:function(){return qn(this,void 0,void 0,e().mark((function t(){var n,i,a,r,o,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.unityManager,i=this.downloadFilename,e.prev=1,Ze.triggerEvent(He.AssetLoading,Ye($e,n)),this.loadDataPackageFromSubpackage?qe.eventLog("通过小游戏分包加载资源",i,", 是否压缩=",this.compressDataPackage):qe.eventLog("通过CDN加载资源",i),a=this.getPrimaryDataCachePath(),o=Rn.getFileInfo(a),!a||!(null==o?void 0:o.size)){e.next=17;break}if(r=this.loadDataPackageFromSubpackage&&!this.compressDataPackage?"data-package/".concat(i):a,qe.eventLog("从缓存加载首包资源"),qe.pluginLog("加载路径: ",r),e.t0=this.loadDataPackageFromSubpackage&&!this.compressDataPackage,!e.t0){e.next=13;break}return e.next=13,this.invokeLoadDataPackage(0);case 13:n.launchStage.setProgress(ke.LOAD_ASSETS,{progress:100,status:On.FULFILLED}),n.loadingCount-=1,e.next=41;break;case 17:if(qe.eventLog("首包资源无缓存,开始下载"),!this.loadDataPackageFromSubpackage){e.next=24;break}return e.next=21,(0,x.gj)(this.invokeLoadDataPackage,this.retryCount,this.retryDuration);case 21:r=e.sent,e.next=32;break;case 24:if(!M.isWK||this.compressDataPackage){e.next=29;break}return e.next=27,(0,x.gj)(this.loadAssetsByXhr,this.retryCount,this.retryDuration);case 27:e.next=32;break;case 29:return e.next=31,(0,x.gj)(this.loadAssetsByDownloadFile,this.retryCount,this.retryDuration);case 31:s=e.sent;case 32:if(n.launchStage.setProgress(ke.LOAD_ASSETS,{progress:100,status:On.FULFILLED}),n.loadingCount-=1,e.t1=this.loadDataPackageFromSubpackage||M.isWK&&!this.compressDataPackage||!s,e.t1){e.next=41;break}return je.timeStart("saveDataPackage"),e.next=39,Rn.saveFile(this.cachePath,s);case 39:r=e.sent,qe.eventLog("资源包拷贝耗时".concat(je.timeEnd("saveDataPackage"),"ms"));case 41:if(e.t2=r,!e.t2){e.next=45;break}return e.next=45,this.readDataPackage(r);case 45:return this.dataPackageLoaded=!0,si.commonMonitor.recordAsset({contentLength:n.gameInstance.Module.rawData.byteLength}),Ze.triggerEvent(He.AssetLoaded,Ye($e,n)),this.processRawData(),e.abrupt("return",Promise.resolve());case 52:return e.prev=52,e.t3=e.catch(1),e.abrupt("return",(qe.pluginError("加载资源异常 ",e.t3.errMsg||e.t3.message,e.t3),Promise.reject(e.t3)));case 55:case"end":return e.stop()}}),t,this,[[1,52]])})))}},{key:"getPrimaryDataCachePath",value:function(){return Rn.getCachePath(this.cachePath)}},{key:"readDataPackage",value:function(t){return qn(this,void 0,void 0,e().mark((function n(){var i,a,r;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.unityManager,!t){e.next=27;break}if(i.launchStage.setProgress(ke.READ_ASSETS,{status:On.PENDING}),je.timeStart("读取资源文件"),e.prev=3,!M.isWK&&!M.isPC){e.next=10;break}return e.next=7,Rn.readFile(t,void 0,this.loadDataPackageFromSubpackage);case 7:i.gameInstance.Module.rawData=e.sent,e.next=13;break;case 10:return e.next=12,Rn.readFileTrunk(t,this.loadDataPackageFromSubpackage);case 12:i.gameInstance.Module.rawData=e.sent;case 13:i.launchStage.setProgress(ke.READ_ASSETS,{status:On.FULFILLED}),je.printTime("读取资源文件"),this.printBufferContent(i.gameInstance.Module.rawData),i.triggerLaunchProgress(ke.READ_ASSETS,je.timeEnd("读取资源文件",!1)),qe.eventLog("data content size=".concat(i.gameInstance.Module.rawData.byteLength)),_t.send(new Mt({ReportType:ke.READ_ASSETS,CostTimeMs:je.timeEnd("读取资源文件"),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({fileSize:i.gameInstance.Module.rawData.byteLength,defaultSize:this.defaultSize,optimalSize:this.optimalSize,compressDataPackage:this.compressDataPackage})})),e.next=26;break;case 21:e.prev=21,e.t0=e.catch(3),a="string"==typeof e.t0,r=e.t0,"number"==typeof e.t0||a||(r=e.t0.errMsg||e.t0.message),this.handleDataError({errMsg:r});case 26:return e.abrupt("return",Promise.resolve());case 27:return e.abrupt("return",Promise.reject("need asset path"));case 28:case"end":return e.stop()}}),n,this,[[3,21]])})))}},{key:"decompressPackage",value:function(t){return qn(this,void 0,void 0,e().mark((function i(){var a,r,o,s,u,c;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(a=this.unityManager).launchStage.setProgress(ke.UNZIP_ASSETS,{status:On.PENDING}),je.timeStart("解压资源包耗时"),e.next=4,(0,x.zI)(Rn.readCompressedFile(t));case 4:if(r=e.sent,o=n(r,2),s=o[0],u=o[1],a.launchStage.setProgress(ke.UNZIP_ASSETS,{status:On.FULFILLED}),je.printTime("解压资源包耗时"),!s&&(null==u?void 0:u.byteLength)){e.next=11;break}return c=(null==s?void 0:s.errMsg)||"empty content",e.abrupt("return",(Dt.send({ReportType:ke.UNZIP_ASSETS,ErrorMsg:c,RunTimeMs:je.getRuntime()}),qe.pluginError("解压资源失败, 加载方式: ".concat(this.loadDataPackageFromSubpackage?"分包":"CDN",", errMsg: "),c),Promise.reject(s||c)));case 11:return e.abrupt("return",(qe.eventLog("data decompressed size=".concat(u.byteLength)),a.triggerLaunchProgress(ke.UNZIP_ASSETS,je.timeEnd("下载资源包耗时",!1)),_t.send(new Mt({ReportType:ke.UNZIP_ASSETS,CostTimeMs:je.timeEnd("解压资源包耗时"),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({fileSize:u.byteLength,defaultSize:this.defaultSize,optimalSize:this.optimalSize,compressDataPackage:this.compressDataPackage})})),a.gameInstance.Module.rawData=u,this.printBufferContent(u),Rn.writeFile({filePath:this.cachePath,data:u}),Promise.resolve(u)));case 12:case"end":return e.stop()}}),i,this)})))}},{key:"handleDownloadError",value:function(e,t){var n="number"==typeof e,i="string"==typeof e,a=e;if(n||i||(a=e.errMsg||e.message),qe.pluginError("loadType=",this.loadDataPackageFromSubpackage?"subpackage":"cdn","下载资源包失败: ","statusCode=",!!n&&a,", networkType=",Et.networkType,", isVisible=",vt(),", errMsg=",a,", error=",e),n||i||console.error(e),Dt.send(new Mt({ReportType:ke.LOAD_ASSETS,ErrorMsg:"".concat(a),RunTimeMs:je.getRuntime()})),t){var o=!M.isPC&&a===xe.DataPackage&&!!r.restartMiniProgram;qe.pluginError("资源包下载最终失败",", networkType=",Et.networkType,", isVisible=",vt()),r.showModal({title:"资源下载失败",content:"".concat(a).concat(M.isPC&&a===xe.DataPackage?"\n请从 微信-小程序-最近使用 重新打开":""),confirmText:o?"重启游戏":"确定",showCancel:!1,success:function(){o&&r.restartMiniProgram({})}})}}},{key:"checkPackageSize",value:function(e){var t=!Number.isNaN(this.defaultSize)&&e===this.defaultSize,n=!Number.isNaN(this.optimalSize)&&e===this.optimalSize;return qe.eventLog("[datapackage] fileSize=".concat(e,", defaultSize=").concat(this.defaultSize,", optimalSize=").concat(this.optimalSize)),t||n}},{key:"initConfig",value:function(e){var t=e||{},n=t.loadDataPackageFromSubpackage,i=t.compressDataPackage;this.loadDataPackageFromSubpackage=!!n,this.compressDataPackage=!!i;var a=o,r=a.DATA_FILE_MD5,s=a.GAME_NAME,u=a.DATA_FILE_SIZE,c=a.OPT_DATA_FILE_SIZE;this.md5=r,this.cacheFilename="".concat(this.md5,".").concat(s,".data.unityweb.bin");var l=o.dataFileSubPrefix||"";this.compressDataPackage?this.downloadFilename="".concat(this.cacheFilename,".br"):this.downloadFilename="".concat(this.cacheFilename,".txt"),this.unityManager.gameInstance.Module.preLoaDataPath=this.downloadFilename,this.cachePath=nn(l,this.cacheFilename),this.downloadPath=nn(l,this.downloadFilename),this.defaultSize=Number(u),this.optimalSize=Number(c)}},{key:"handleDataError",value:function(e){var t,n=e.errMsg,i=e.byteLength,a=e.defaultSize,r=e.optimalSize,s=e.prefix;this.loadDataPackageFromSubpackage&&!this.compressDataPackage||Rn.removeFile(this.cachePath),ue.warn(n),ce.error(n),null===(t=null==o?void 0:o.onCrash)||void 0===t||t.call(o),Dt.send(new Mt({ReportType:ke.READ_ASSETS,ErrorMsg:n,ExternInfo:JSON.stringify({byteLength:i,defaultSize:a,optimalSize:r,prefix:s,compressDataPackage:this.compressDataPackage})}))}},{key:"printBufferContent",value:function(e){e&&qe.eventLog("[datapackage] content=",new Uint8Array(e,0,64).toString())}}]),a}(de).getInstance(),Qn={haventUseCodeSplit:"未使用wasm代码分包",largeAssetPackage:"首资源包较大",noContentEncoding:"首资源包未开启服务器压缩",longCallmainCost:"callmain耗时较长,请用安卓cpuprofile分析热点函数"},Jn=function(){function e(t,n){l(this,e),this.unityManager=t,this.monitor=n,this.result={},this.assetPerformance={},this.wasmPerformance={},this.callmainPerformance={}}return d(e,[{key:"recordAsset",value:function(e){this.assetPerformance=Object.assign(Object.assign({},this.assetPerformance),e)}},{key:"recordWasm",value:function(e){this.wasmPerformance=Object.assign(Object.assign(Object.assign({},this.wasmPerformance),e),{useCodeSplit:this.unityManager.codeType===Le.codeSplit})}},{key:"recordCallmain",value:function(e){this.callmainPerformance=Object.assign(Object.assign({},this.callmainPerformance),e)}},{key:"reset",value:function(){this.assetPerformance={},this.wasmPerformance={},this.callmainPerformance={},Qn=null}},{key:"showResult",value:function(){return this.result=this.getResultInfo(),this.checkResult()}},{key:"checkResult",value:function(){qe.monitorLog("----启动数据监控 start----"),qe.monitorLog("启动基本信息: ",this.result);var e=[],t=this.result,n=Kn.getPrimaryDataCachePath();return t.useCodeSplit||e.push(Qn.haventUseCodeSplit),+t.assetContentLength>15728640&&e.push(Qn.largeAssetPackage),Kn.loadDataPackageFromSubpackage||t.useContentEncoding||n||e.push(Qn.noContentEncoding),M.isIOS&&+t.callmainCost>1500&&e.push(Qn.longCallmainCost),M.isAndroid&&+t.callmainCost>3e3&&e.push(Qn.longCallmainCost),e.length&&(qe.monitorWarn("启动优化建议:"),qe.monitorWarn(e.join("\n"))),qe.monitorLog("----启动数据监控 end----"),e}},{key:"getResultInfo",value:function(){return{assetLoadCost:this.assetPerformance.duration||0,assetContentLength:this.assetPerformance.contentLength||0,useContentEncoding:!!this.assetPerformance.useContentEncoding,wasmLoadCost:this.wasmPerformance.duration||0,wasmContentLength:this.wasmPerformance.contentLength||0,useCodeSplit:!!this.wasmPerformance.useCodeSplit,callmainCost:this.callmainPerformance.duration,launchTime:this.callmainPerformance.launchTime}}}]),e}();!function(e){e[e.Ok=0]="Ok",e[e.Fail=1]="Fail"}(Vn||(Vn={}));var Xn=new(function(){function e(){var t=this;l(this,e),this.loadingCount=0,this.loadedCount=0,this.totalNetworkTime=0,this.maxLoadingCount=0,this.avgLoadingCount=1,this.timer=0,this.loadingStartTime=0,this.tasks=new Map,this.taskIdMap=new Map,this.doRecord=function(){t.loadingCount>t.maxLoadingCount&&(t.maxLoadingCount=t.loadingCount),t.avgLoadingCount=Math.ceil((t.loadingCount+t.avgLoadingCount)/2),t.timer=setTimeout(t.doRecord,1e3)}}return d(e,[{key:"genTask",value:function(e,t){var n=new Zn({url:e,taskId:t});return t||this.addTaskId(n),this.addTask(n),n}},{key:"addTask",value:function(e){0===this.loadingCount&&(this.loadingStartTime=Date.now()),this.loadingCount+=1,1===this.loadingCount&&this.doRecord(),this.tasks.set("".concat(e.info.url,"@").concat(e.taskId),e)}},{key:"removeTask",value:function(e){if(this.loadingCount-=1,this.loadedCount+=1,0===this.loadingCount){var t=Date.now()-this.loadingStartTime;this.totalNetworkTime+=t,this.stopRecord()}this.removeTaskId(e),this.tasks.delete("".concat(e.info.url,"@").concat(e.taskId))}},{key:"getTask",value:function(e,t){var n=t||this.getCurrentTaskId(e);return this.tasks.get("".concat(e,"@").concat(n))}},{key:"addTaskId",value:function(e){var t=this.taskIdMap.get(e.info.url);t?(t.push(e.taskId),this.taskIdMap.set(e.info.url,t)):this.taskIdMap.set(e.info.url,[e.taskId])}},{key:"removeTaskId",value:function(e){var t=this.taskIdMap.get(e.info.url);(null==t?void 0:t.length)&&(t.pop(),0===t.length&&this.taskIdMap.delete(e.info.url))}},{key:"getCurrentTaskId",value:function(e){var t=this.taskIdMap.get(e),n=null==t?void 0:t.length;if(n&&t)return t[n-1]}},{key:"stopRecord",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=0)}}]),e}()),Zn=function(){function e(t){l(this,e),this.init(t),this.triggerBeforeRequest()}return d(e,[{key:"init",value:function(e){this.info={url:e.url,startTime:Date.now()},this.taskId=e.taskId||(0,x.hQ)(10,!0)}},{key:"genResult",value:function(){}},{key:"requestSuccess",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.status=Vn.Ok,t?this.xhrRequestSuccess(e):this.wxRequestSuccess(e),this.handleComplete(),this.triggerAfterSuccess()}},{key:"requestFail",value:function(e){this.status=Vn.Fail,this.handleComplete(),this.triggerAfterFail()}},{key:"triggerBeforeRequest",value:function(){var e;this.beforeRequest&&(null===(e=this.beforeRequest)||void 0===e||e.call(this,this))}},{key:"triggerAfterSuccess",value:function(){var e;this.afterSuccess&&(null===(e=this.afterSuccess)||void 0===e||e.call(this,this))}},{key:"triggerAfterFail",value:function(){var e;this.afterFail&&(null===(e=this.afterFail)||void 0===e||e.call(this,this))}},{key:"xhrRequestSuccess",value:function(e){if(this.info.statusCode=e.status,dt(this.info.statusCode)){var t=e.originXhr||e;this.setProfile(t.profile),this.checkContentEncoding(ct(t,"Content-Encoding")),this.checkCDNCache(ct(t,"X-Cache-Lookup")||ct(t,"X-Cache"),ct(t,"Age")),this.setContentLength(e.response),this.info.cacheable=e.cacheable,this.info.isReadFromCache=!!e.isReadFromCache,this.info.isTexture=!!fn(this.info.url)}}},{key:"wxRequestSuccess",value:function(e){this.info.statusCode=e.statusCode,200===this.info.statusCode&&(this.setProfile(e.profile),this.checkContentEncoding(lt(e.header,"Content-Encoding")),this.checkCDNCache(lt(e.header,"X-Cache-Lookup")||lt(e.header,"X-Cache"),lt(e.header,"Age")),this.setContentLength(e.data))}},{key:"checkContentEncoding",value:function(e){var t=(e||"").toLowerCase();this.info.enableContentEncoding=t.includes("gzip")||t.includes("br")}},{key:"checkCDNCache",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=(e||"").toLowerCase();this.info.hitCache=n?n.includes("hit"):!!t&&Number(t)>0}},{key:"setProfile",value:function(e){e&&(this.info.receivedBytedCount=e.receivedBytedCount||0,this.info.protocol=e.protocol,e.requestEnd&&e.requestStart&&(this.info.duration=e.requestEnd-e.requestStart,this.info.pendingDuration=e.requestStart-this.info.startTime))}},{key:"handleComplete",value:function(){this.info.endTime=Date.now(),this.info.duration=this.info.duration||this.info.endTime-this.info.startTime,this.info.pendingDuration=this.info.pendingDuration||0}},{key:"setContentLength",value:function(e){if("string"==typeof e)this.info.receivedBytedCount=e.length;else if(e.byteLength)this.info.receivedBytedCount=e.byteLength;else{var t=JSON.stringify(e);this.info.receivedBytedCount=t.length}}}]),e}(),Yn=function(){function e(t,n){l(this,e),this.unityManager=t,this.monitor=n,this.loadCount=0,this.loadedCount=0,this.cacheableCount=0,this.hitCacheCount=0,this.loadFromCacheCount=0,this.loadedSize=0,this.startTime=0,this.useH2=!1,this.enabledH2Count=0,this.checkedH2=!1,this.useContentEncoding=!1,this.enabledContentEncodingCount=0,this.needEnableContentEncodingCount=0,this.checkedContentEncoding=!1}return d(e,[{key:"baseReset",value:function(){this.loadCount=0,this.loadedCount=0,this.cacheableCount=0,this.hitCacheCount=0,this.loadFromCacheCount=0,this.loadedSize=0,this.startTime=0,this.needEnableContentEncodingCount=0}},{key:"baseLoad",value:function(){this.startTime||(this.startTime=Date.now()),this.loadCount+=1}},{key:"completeLoad",value:function(e,t,n,i){var a,r;this.loadedCount+=1;var o=Xn.getTask(e,i);if(!o)return!1;var s=(null===(a=t)||void 0===a?void 0:a.status)||(null===(r=t)||void 0===r?void 0:r.statusCode);return n||!dt(s)?o.requestFail(n):o.requestSuccess(t,!0),Xn.removeTask(o),!0}},{key:"baseCheck",value:function(e){this.checkHttp2(e),this.checkContentEncoding(e),this.checkCache(e)}},{key:"checkHttp2",value:function(e){var t;("h2"===e.info.protocol||(null===(t=e.info.protocol)||void 0===t?void 0:t.includes("http/2")))&&(this.enabledH2Count+=1)}},{key:"checkContentEncoding",value:function(e){var t=!!e.info.enableContentEncoding;t||!e.info.cacheable||e.info.isReadFromCache||(this.needEnableContentEncodingCount+=1),t&&(this.enabledContentEncodingCount+=1)}},{key:"checkCache",value:function(e){e.info.hitCache&&(this.hitCacheCount+=1),e.info.isReadFromCache&&(this.loadFromCacheCount+=1)}}]),e}(),$n={cpuprofile:"请使用安卓cpuprofile分析卡顿问题"},ei=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.apply(this,arguments)).result={},e.limit=parseInt(String(50),10),e}return d(n,[{key:"init",value:function(){var e=me.getConfig(le.Fps);this.limit=parseInt(String(1/e*1e3),10),this.currentFrame=0,this.wrongFrame={}}},{key:"start",value:function(){this.requestID||(this.startTime=Date.now(),requestAnimationFrame(this.counter.bind(this)))}},{key:"stop",value:function(){cancelAnimationFrame(this.requestID),this.requestID=0}},{key:"reset",value:function(){this.stop(),this.startTime=0,this.currentFrame=0,this.currentTime=0,this.wrongFrame={},$n=null}},{key:"showResult",value:function(){return this.stop(),this.result=this.getResultInfo(),this.checkResult()}},{key:"getRuntime",value:function(){return Date.now()-this.startTime}},{key:"getResultInfo",value:function(){var e=Object.keys(this.wrongFrame),t=Object.values(this.wrongFrame),n=Object.entries(this.wrongFrame).sort((function(e,t){return t[1].frameCost-e[1].frameCost})),i=n[0],a=t.reduce((function(e,t){return e+t.frameCost}),0),r=this.getRuntime(),o=je.getRuntime(),s=Number((a/r).toFixed(4));return{frames:e,frameCount:e.length,longestFrame:i?{frame:i[0],frameCost:i[1].frameCost,runtime:i[1].runtime}:{},topFrameCost:n.slice(0,5).map((function(e){return e[1].frameCost})),topFrameNetworkCount:n.slice(0,5).map((function(e){return e[1].loadingCount})),frameInfo:this.wrongFrame,totalJankTime:a,jankRate:s,timerRuntime:r,appRuntime:o,configMonitorDuration:me.getConfig(le.MonitorDuration),showResultAfterLaunch:me.getConfig(le.ShowResultAfterLaunch),configFps:me.getConfig(le.Fps)}}},{key:"checkResult",value:function(){qe.monitorLog("----帧率检测 start ----"),qe.monitorLog("帧率基本信息:",this.result);var e=[],t=this.result,n=t.longestFrame;return n.frameCost>1e3&&e.push("存在长耗时帧cost=".concat(n.frameCost,"ms,runtime=").concat(n.runtime,"ms")),+t.totalJankTime>5e3&&e.push("总卡顿时长".concat(t.totalJankTime,"ms")),+t.jankRate>.3&&e.push("卡顿时长占比".concat(parseInt(String(100*t.jankRate),10),"%")),e.length&&(qe.monitorWarn("帧率优化建议:"),e.push($n.cpuprofile),qe.monitorWarn(e.join("\n"))),qe.monitorLog("----帧率检测 end ----"),e}},{key:"counter",value:function(){this.currentFrame+=1;var e=Date.now(),t=e-this.currentTime;t>this.limit&&(qe.monitorWarn("frame=".concat(this.currentFrame,"; cost=").concat(t,"ms; runtime=").concat(this.getRuntime(),"ms")),this.wrongFrame[this.currentFrame]={frameCost:t,runtime:this.getRuntime(),loadingCount:Xn.loadingCount}),this.currentTime=e,this.requestID=requestAnimationFrame(this.counter.bind(this))}}]),n}(de).getInstance(),ti={disableH2:"未开启http2",noCDNCache:"未命中CDN缓存",cacheBundleSettings:"请勿缓存settings.json",noCacheCatalog:"可将catalog.json配置为可缓存文件",noCatalogHash:"catalog.json被缓存且无hash/版本信息, 会导致无法更新",requestCataHash:"请勿请求catalog.hash来做资源热更新,小游戏平台不支持",lessCacheableCount:"可缓存文件过少,检查缓存配置",lessParallelCount:"网络并发数过少",lessNetworkTime:"网络未充分利用"},ni=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.apply(this,arguments)).cacheableCount=0,e.cacheableSize=0,e.noCacheableAssetCount=0,e.noCacheableAssetSize=0,e.requestBundleSettings=!1,e.cacheSettings=!1,e.requestBundleCatalog=!1,e.cacheCatalog=!1,e.appendHashToCatalog=!1,e.requestCataHash=!1,e.result={},e.loadedTasks=[],e.loadedTasksMap=new Map,e.cacheableRemoteCount=0,e.cacaheableRemoteSize=0,e.texturesCount=0,e.texturesSize=0,e}return d(n,[{key:"startLoad",value:function(e,t){var n=this;if(!this.monitor.endMonitor){var i=Xn.genTask(e,t);this.baseLoad(),i.afterSuccess=function(e){var t=e.info.receivedBytedCount||0,i=!!e.info.cacheable,a=!!n.loadedTasksMap.has(e.info.url);(!i||i&&!a)&&(n.loadedTasks.push(e.info),n.loadedSize+=t),e.info.url.includes(o.DATA_CDN)?(i?(a||(n.loadedTasksMap.set(e.info.url,!0),n.cacheableCount+=1,n.cacheableSize+=t),e.info.isReadFromCache||(n.cacheableRemoteCount+=1,n.cacaheableRemoteSize+=t)):(n.noCacheableAssetCount+=1,n.noCacheableAssetSize+=t),e.info.isTexture&&(a||(n.loadedTasksMap.set(e.info.url,!0),n.texturesCount+=1,n.texturesSize+=t)),n.baseCheck(e),n.checkStreamingAssets(e)):(n.noCacheableAssetCount+=1,n.noCacheableAssetSize+=t)}}}},{key:"reset",value:function(){this.baseReset(),this.cacheableCount=0,this.requestBundleSettings=!1,this.cacheSettings=!1,this.requestBundleCatalog=!1,this.cacheCatalog=!1,this.appendHashToCatalog=!1,this.requestCataHash=!1,this.loadedTasks=[],this.loadedTasksMap.clear(),ti=null}},{key:"showResult",value:function(){return this.result=this.getResultInfo(),this.checkResult()}},{key:"checkResult",value:function(){qe.monitorLog("----网络监控 start----"),qe.monitorLog("网络基本信息:",this.result);var e=[],t=this.result,n=Kn.getPrimaryDataCachePath();return t.loadCount?(n||t.useH2||e.push(ti.disableH2),t.needEnableContentEncodingCount&&e.push("未开启服务器压缩资源个数: ".concat(t.needEnableContentEncodingCount)),t.hitCacheCount||e.push(ti.noCDNCache),t.requestBundleSettings&&t.cacheSettings&&e.push(ti.cacheBundleSettings),t.requestBundleCatalog&&!t.cacheCatalog&&e.push(ti.noCacheCatalog),t.requestBundleCatalog&&t.cacheCatalog&&!t.appendHashToCatalog&&e.push(ti.noCatalogHash),t.requestCataHash&&e.push(ti.requestCataHash),+t.cacheableCount<t.loadCount/2&&e.push(ti.lessCacheableCount),+t.avgLoadingCount<5&&e.push(ti.lessParallelCount),t.networkTime/t.duration<.7&&e.push(ti.lessNetworkTime),e.length&&(qe.monitorWarn("网络优化建议:"),qe.monitorWarn(e.join("\n"))),qe.monitorLog("----网络监控 end----"),e):(qe.monitorLog("----网络监控 end----"),e)}},{key:"getResultInfo",value:function(){var e=this.loadedTasks.slice().sort((function(e,t){return Number(t.duration)-Number(e.duration)})),t=e.filter((function(e){return!e.isReadFromCache})),n=e.filter((function(e){return!!e.isReadFromCache})),i=t.map((function(e){return e.pendingDuration})),a=n.map((function(e){return e.duration||0})).sort((function(e,t){return t-e}));return this.enabledH2Count&&(this.useH2=!0),this.enabledContentEncodingCount&&(this.useContentEncoding=!0),{useH2:this.useH2,enabledH2Count:this.enabledH2Count,enabledContentEncodingCount:this.enabledContentEncodingCount,useContentEncoding:this.useContentEncoding,cacheSettings:this.cacheSettings,cacheCatalog:this.cacheCatalog,appendHashToCatalog:this.appendHashToCatalog,requestCataHash:this.requestCataHash,requestBundleSettings:this.requestBundleSettings,requestBundleCatalog:this.requestBundleCatalog,loadCount:this.loadCount,loadedCount:this.loadedCount,loadedSizeStr:"".concat((this.loadedSize/1024/1024).toFixed(2),"MB"),loadedSize:this.loadedSize,totalSize:this.loadedSize+this.monitor.preloadMonitor.result.loadedSize,hitCacheCount:this.hitCacheCount,cacheableCount:this.cacheableCount,loadFromCacheCount:this.loadFromCacheCount,startTime:this.startTime,duration:this.startTime?Date.now()-this.startTime:0,networkTime:Xn.totalNetworkTime,maxLoadingCount:Xn.maxLoadingCount,avgLoadingCount:Xn.avgLoadingCount,loadedTasks:e,cacheableSize:this.cacheableSize,noCacheableAssetCount:this.noCacheableAssetCount,noCacheableAssetSize:this.noCacheableAssetSize,avgPendingDuration:i.length?Math.round(i.reduce((function(e,t){return e+t}),0)/i.length):0,topPendingDuration:i.slice(0,5),remoteRequestCount:t.length,cacheableRemoteCount:this.cacheableRemoteCount,cacaheableRemoteSize:this.cacaheableRemoteSize,needCacheTextures:o.needCacheTextures,texturesCount:this.texturesCount,texturesSize:this.texturesSize,avgReadCacheCost:a.length?Math.round(a.reduce((function(e,t){return e+t}),0)/a.length):0,topReadCacheCost:a.slice(0,5),topNetworkTime:t.sort((function(e,t){return t.duration-e.duration})).slice(0,5).map((function(e){return e.duration})),networkUsage:Number((Xn.totalNetworkTime/ei.getRuntime()).toFixed(4))}}},{key:"checkStreamingAssets",value:function(e){var t=e.info.url,n=t.substring(t.lastIndexOf("/"));!this.requestBundleSettings&&n.includes("settings")&&(this.requestBundleSettings=!0,e.info.cacheable&&(this.cacheSettings=!0)),!this.requestBundleCatalog&&n.includes("catalog")&&(this.requestBundleCatalog=!0,e.info.cacheable&&(this.cacheCatalog=!0),n.includes("catalog.")||(this.appendHashToCatalog=!0)),!this.requestCataHash&&n.includes("catalog")&&n.endsWith("hash")&&(this.requestCataHash=!0)}}]),n}(Yn),ii={noPreloadAssets:"未使用预下载能力",tooManyAssets:"预下载资源个数较多",tooLargeAssetSize:"预下载资源量较大",lowDownloadSpeed:"已发起预下载,但未完成,请检查预下载资源是否过大,或是否下载过慢",smallAssetSize:"预下载资源较小,请将大资源调整到预下载列表顶部"},ai=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.apply(this,arguments)).finished=!1,e.preloadInfoList=new Map,e.callmainInfo={},e.result={},e.preloadListLength=0,e}return d(n,[{key:"init",value:function(){}},{key:"setPreloadList",value:function(e){this.preloadInfoList=e,this.preloadListLength=this.preloadInfoList.size}},{key:"startLoad",value:function(e){var t=this,n=Xn.genTask(e);this.baseLoad(),n.afterSuccess=function(e){t.loadedSize+=e.info.receivedBytedCount||0,t.baseCheck(e)}}},{key:"genResultAfterCallmain",value:function(){(0,x.xb)(this.callmainInfo)&&(this.callmainInfo=this.getResultInfo())}},{key:"finishPreload",value:function(){this.finished||this.monitor.endMonitor||(this.finished=!0,this.result=this.getResultInfo())}},{key:"reset",value:function(){this.baseReset(),this.callmainInfo={},this.preloadInfoList=new Map,this.finished=!1,ii=null}},{key:"showResult",value:function(){return this.genResultAfterCallmain(),this.finishPreload(),this.checkResult()}},{key:"checkResult",value:function(){qe.monitorLog("----预下载监控 start----"),qe.monitorLog("预下载基本信息: ",this.result,", callmain完成时预下载信息",this.callmainInfo);var e=[],t=this.preloadListLength;t||e.push(ii.noPreloadAssets),t>15&&e.push(ii.tooManyAssets);var n=this.callmainInfo,i=this.result;return t&&n&&(n.loadingCount&&!n.loadedCount?e.push(ii.lowDownloadSpeed):+n.loadedSize<1048576&&e.push(ii.smallAssetSize)),t&&i&&(+i.loadedSize<5242880&&e.push(ii.smallAssetSize),+i.loadedSize>20971520&&e.push(ii.tooLargeAssetSize)),e.length&&(qe.monitorWarn("预下载优化建议:"),qe.monitorWarn(e.join("\n"))),qe.monitorLog("----预下载监控 end----"),e}},{key:"getResultInfo",value:function(){return{loadedCount:this.loadedCount,loadingCount:this.loadCount-this.loadedCount,loadedSizeStr:"".concat((this.loadedSize/1024/1024).toFixed(2),"MB"),loadedSize:this.loadedSize,hitCacheCount:this.hitCacheCount,useH2:this.useH2,useContentEncoding:this.useContentEncoding,preloadListLength:this.preloadListLength}}}]),n}(Yn),ri={loadDurationCallmain:"wasm子包在callmain期间加载,请使用分包工具继续收集",loadSubwasmEarly:"wasm子包加载时机过早,请使用分包工具继续收集",longFetchPending:"缺失函数过多,请使用分包工具继续收集"},oi=function(){function e(t,n){l(this,e),this.unityManager=t,this.monitor=n,this.loadSubWasmPackageStartTime=0,this.loadSubWasmPackageCostTime=0,this.timeAfterCallmain=0,this.loadDurationCallmain=!1,this.maxFetchPendingTime=0,this.result={},this.isFetching=!1}return d(e,[{key:"init",value:function(){}},{key:"startLoadSubWasm",value:function(){if(this.loadSubWasmPackageStartTime=Date.now(),this.unityManager.mainCalled){var e=je.getRuntime(),t=this.unityManager.launchData.find((function(e){return e.type===ke.PREPARE_GAME}));if(t){var n=e-t.data.runTimeMs;this.timeAfterCallmain=n}}else this.loadDurationCallmain=!0}},{key:"finishLoadSubWasm",value:function(){this.loadSubWasmPackageCostTime=Date.now()-this.loadSubWasmPackageStartTime}},{key:"recordSyncFetchTime",value:function(){var e=this;if(!this.isFetching&&!this.monitor.endMonitor){this.isFetching=!0;var t=Date.now();this.loadSubWasmPackageStartTime||(this.loadSubWasmPackageStartTime=t,this.startLoadSubWasm()),setTimeout((function(){if(!e.monitor.enableMonitor){var n=Date.now()-t;n>e.maxFetchPendingTime&&(e.maxFetchPendingTime=n),n>500&&qe.monitorWarn("fetchjs等待耗时: ",n),e.isFetching=!1}}),0)}}},{key:"reset",value:function(){this.loadSubWasmPackageStartTime=0,this.loadSubWasmPackageCostTime=0,this.timeAfterCallmain=0,this.loadDurationCallmain=!1,this.maxFetchPendingTime=0,this.result={},ri=null}},{key:"showResult",value:function(){return this.result=this.getResultInfo(),this.checkResult()}},{key:"checkResult",value:function(){qe.monitorLog("----wasm分包监控 start----"),qe.monitorLog("wasm分包基本信息: ",this.result);var e=this.result,t=[];return e.loadDurationCallmain&&t.push(ri.loadDurationCallmain),e.costTimeAfterCallmain&&+e.costTimeAfterCallmain<3e4&&t.push(ri.loadSubwasmEarly),+e.maxFetchPendingTime>2e3&&t.push(ri.longFetchPending),t.length&&(qe.monitorWarn("wasm分包优化建议:"),qe.monitorWarn(t.join("\n"))),qe.monitorLog("----wasm分包监控 end----"),t}},{key:"getResultInfo",value:function(){return{loadSubWasmPackageStartTime:this.loadSubWasmPackageStartTime,loadSubWasmPackageCostTime:this.loadSubWasmPackageCostTime,loadDurationCallmain:this.loadDurationCallmain,maxFetchPendingTime:this.maxFetchPendingTime,costTimeAfterCallmain:this.timeAfterCallmain}}}]),e}(),si=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.apply(this,arguments)).enableMonitor=me.getConfig(le.EnableMonitor),e.endMonitor=!1,e.reportData={},e.isGameInteractive=!1,e}return d(n,[{key:"init",value:function(e){this.enableMonitor?(qe.pluginWarn("[仅开发版/体验版生效]已开启最佳实践检测, 请前往github查阅说明文档:\nhttps://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/PerformanceMonitor.md"),this.unityManager=e,this.commonMonitor=new Jn(e,this),this.requestMonitor=new ni(e,this),this.preloadMonitor=new ai(e,this),this.wasmSplitMonitor=new oi(e,this),ei.init()):(this.commonMonitor={recordAsset:function(){},recordWasm:function(){},recordCallmain:function(){},showResult:function(){}},this.requestMonitor={startLoad:function(){},completeLoad:function(){},showResult:function(){}},this.preloadMonitor={setPreloadList:function(){},finishPreload:function(){},startLoad:function(){},completeLoad:function(){},genResultAfterCallmain:function(){},showResult:function(){}},this.wasmSplitMonitor={recordSyncFetchTime:function(){},startLoadSubWasm:function(){},finishLoadSubWasm:function(){},showResult:function(){}})}},{key:"showResultAfterDuration",value:function(){var e=this;if(!this.endMonitor&&this.enableMonitor){ei.start();var t=me.getConfig(le.ShowResultAfterLaunch)?6e4:me.getConfig(le.MonitorDuration);setTimeout((function(){e.showResult()}),t)}}},{key:"showResult",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.enableMonitor&&!this.endMonitor){this.isGameInteractive=e;var t=this.commonMonitor.showResult(),n=this.preloadMonitor.showResult(),i=this.wasmSplitMonitor.showResult(),a=this.requestMonitor.showResult(),o=ei.showResult(),s="";t.length&&(s+="===启动优化建议: ===\n",s+="".concat(t.join("\n"),"\n")),n.length&&(s+="===预下载优化建议: ===\n",s+="".concat(n.join("\n"),"\n")),i.length&&(s+="===wasm分包优化建议: ===\n",s+="".concat(i.join("\n"),"\n")),a.length&&(s+="===网络优化建议: ===\n",s+="".concat(a.join("\n"),"\n")),o.length&&(s+="===帧率优化建议: ===\n",s+="".concat(o.join("\n"),"\n")),s&&me.getConfig(le.ShowSuggestModal)&&(s="<打开调试查看功能文档>\n".concat(s),r.showModal({title:"优化建议"+(e?"[可交互]":""),content:s})),this.reportInfo(),this.showResultInfo(),e&&!me.getConfig(le.ShowResultAfterLaunch)||this.end(),this.isGameInteractive=!1}}},{key:"end",value:function(){!this.endMonitor&&this.enableMonitor&&(this.commonMonitor.reset(),this.preloadMonitor.reset(),this.wasmSplitMonitor.reset(),this.requestMonitor.reset(),ei.reset(),this.reportData={},this.endMonitor=!0)}},{key:"reportInfo",value:function(){this.reportBaseInfo(),this.reportAssetInfo(),this.reportFrameInfo()}},{key:"showResultInfo",value:function(){var e=this.showBaseInfo(),t=this.showAssetInfo(),n=this.showFrameInfo(),i=[].concat(e,t,n).join("\n");qe.monitorWarn("[monitor-report]","检测报告".concat(this.isGameInteractive?"[可交互]":"",": "),i),me.getConfig(le.ShowReportModal)&&r.showModal({title:"检测报告"+(this.isGameInteractive?"[可交互]":""),content:i,showCancel:!1,success:function(){r.setClipboardData({data:i})}})}},{key:"showBaseInfo",value:function(){var e=this.reportData.baseInfo,t=e.downloadWasm,n=e.wasmContentLength,i=e.downloadDataPackage,a=e.assetContentLength,r=e.useContentEncoding,o=e.callmain,s=e.preloadListLength,u=e.preloadCount,c=e.preloadSize,l=e.preloadCountAfterCallmain,d=e.preloadSizeAfterCallmain,h=e.launchTime,f=[];return f.push("wasm下载耗时: ".concat(t,"ms")),f.push("wasm包大小: ".concat((n/1024/1024).toFixed(2),"MB")),f.push("资源包下载耗时: ".concat(i||0,"ms")),f.push("资源包大小: ".concat((a/1024/1024).toFixed(2),"MB")),f.push("资源包是否压缩: ".concat(!!r)),f.push("引擎初始化耗时: ".concat(o,"ms")),f.push("引擎初始化完成耗时: ".concat(h,"ms")),f.push("预下载配置个数: ".concat(s)),f.push("总预下载完成个数: ".concat(u)),f.push("总预下载完成大小: ".concat((c/1024/1024).toFixed(2),"MB")),f.push("引擎初始化完成时预载个数: ".concat(l)),f.push("引擎初始化完成时预载大小: ".concat((d/1024/1024).toFixed(2),"MB")),f}},{key:"showAssetInfo",value:function(){var e=this.reportData.assetInfo,t=e.useH2,n=e.enabledH2Count,i=e.enabledContentEncodingCount,a=e.useContentEncoding,r=e.cacheSettings,o=e.cacheCatalog,s=e.appendHashToCatalog,u=e.requestCataHash,c=e.requestBundleSettings,l=e.requestBundleCatalog,d=e.loadCount,h=e.loadedSize,f=e.totalSize,p=e.cacheableCount,m=e.hitCacheCount,g=e.duration,v=e.networkTime,y=e.networkUsage,T=e.maxLoadingCount,S=e.cacheableSize,P=e.avgLoadingCount,k=e.texturesCount,E=e.texturesSize,b=e.needCacheTextures,C=e.cacaheableRemoteSize,w=e.cacheableRemoteCount,I=e.avgPendingDuration,R=e.topPendingDuration,L=e.avgReadCacheCost,M=e.topReadCacheCost,A=e.topNetworkTime,_=e.remoteRequestCount,D=e.noCacheableAssetCount,F=e.noCacheableAssetSize,x=[];return x.push("网络时长: ".concat(v,"ms")),x.push("网络时长占比: ".concat((100*y).toFixed(1),"%")),x.push("距首个网络请求开始时长: ".concat(g,"ms")),x.push("总请求个数(含命中本地缓存): ".concat(d)),x.push("实际网络请求个数(未命中本地缓存): ".concat(_)),x.push("自动缓存资源个数: ".concat(p)),x.push("未自动缓存资源个数: ".concat(D)),x.push("自动缓存资源网络个数: ".concat(w)),x.push("纹理个数: ".concat(k)),x.push("总资源大小(含预载): ".concat((f/1024/1024).toFixed(2),"MB")),x.push("总资源大小(不含预载): ".concat((h/1024/1024).toFixed(2),"MB")),x.push("自动缓存资源大小: ".concat((S/1024/1024).toFixed(2),"MB")),x.push("未自动缓存资源大小: ".concat((F/1024/1024).toFixed(2),"MB")),x.push("自动缓存资源网络大小: ".concat((C/1024/1024).toFixed(2),"MB")),x.push("纹理大小: ".concat((E/1024/1024).toFixed(2),"MB")),x.push("是否缓存纹理: ".concat(b)),x.push("平均并发数: ".concat(P)),x.push("最大并发数: ".concat(T)),x.push("平均请求阻塞时长: ".concat(I,"ms")),x.push("TOP5请求阻塞时长: [".concat(R.toString(),"]")),x.push("平均读缓存耗时: ".concat(L,"ms")),x.push("TOP5读缓存耗时: [".concat(M.toString(),"]")),x.push("TOP5网络耗时: [".concat(A.toString(),"]")),x.push("命中CDN缓存数: ".concat(m)),x.push("启用HTTP2.0个数: ".concat(n)),x.push("是否开启HTTP2.0: ".concat(!!t)),x.push("资源开启服务器压缩个数: ".concat(i)),x.push("资源是否开启服务器压缩: ".concat(!!a)),x.push("是否请求catalog: ".concat(!!l)),x.push("catalog是否带版本信息: ".concat(!!s)),x.push("是否请求catalog.hash热更: ".concat(!!u)),x.push("是否缓存catalog: ".concat(!!o)),x.push("是否请求settings: ".concat(!!c)),x.push("是否缓存settings: ".concat(!!r)),x}},{key:"showFrameInfo",value:function(){var e=this.reportData.frameInfo,t=[],n=e.frameCount,i=e.longestFrame,a=e.totalJankTime,r=e.jankRate,o=e.topFrameCost,s=e.topFrameNetworkCount,u=e.configMonitorDuration,c=e.showResultAfterLaunch,l=e.configFps,d=e.timerRuntime,h=e.appRuntime;return t.push("长耗时帧个数: ".concat(n)),t.push("最长帧耗时: ".concat(i.frameCost||0,"ms")),t.push("TOP5帧耗时: [".concat(o.toString(),"]")),t.push("TOP5帧网络并发: [".concat(s.toString(),"]")),t.push("总卡顿时长: ".concat(a,"ms")),t.push("卡顿率: ".concat((100*r).toFixed(1),"%")),t.push("设置监控FPS: ".concat(l,"FPS")),t.push("设置监控时长: ".concat(u,"ms")),t.push("可交互结束监控: ".concat(!!c)),t.push("实际监控时长: ".concat(d,"ms")),t.push("运行时长: ".concat(h,"ms")),t}},{key:"reportBaseInfo",value:function(){if(this.enableMonitor){var e=this.commonMonitor.result,t=this.preloadMonitor.result,n=this.preloadMonitor.callmainInfo,i=e.launchTime,a=e.wasmContentLength,r=e.assetContentLength,o=e.useContentEncoding,s=t.preloadListLength,u=t.loadedCount,c=t.loadedSize,l=t.useH2,d=t.useContentEncoding,h=n.loadedCount,f=n.loadedSize,p=Object.create(null),m={0:"pluginLaunch",1:"downloadWasm",2:"compileWasm",3:"downloadDataPackage",5:"readDataPackage",6:"callmain"};this.unityManager.launchData.forEach((function(e){m[e.type]&&(p[m[e.type]]=e.data.costTimeMs)})),Object.assign(p,{launchTime:i,wasmContentLength:a,assetContentLength:r,useContentEncoding:o,preloadListLength:s,preloadCount:u,preloadSize:c,useH2:l,preloadUseContentEncoding:d,preloadCountAfterCallmain:h,preloadSizeAfterCallmain:f,isGameInteractive:this.isGameInteractive}),this.reportData.baseInfo=p,_t.send(new Mt({ReportType:Ce.BASE_INFO,ExternInfo:JSON.stringify(p)}))}}},{key:"reportAssetInfo",value:function(){if(this.enableMonitor){var e=this.requestMonitor.result,t=e.useH2,n=e.enabledH2Count,i=e.enabledContentEncodingCount,a=e.useContentEncoding,r=e.cacheSettings,o=e.cacheCatalog,s=e.appendHashToCatalog,u=e.requestCataHash,c=e.requestBundleSettings,l=e.requestBundleCatalog,d=e.loadCount,h=e.loadedCount,f=e.loadedSize,p=e.cacheableSize,m=e.cacheableCount,g=e.hitCacheCount,v=e.duration,y=e.networkTime,T=e.networkUsage,S=e.maxLoadingCount,P=e.avgLoadingCount,k=e.totalSize,E=e.noCacheableAssetCount,b=e.noCacheableAssetSize,C=e.remoteContentSize,w=e.avgPendingDuration,I=e.topPendingDuration,R=e.remoteRequestCount,L=e.cacheableRemoteCount,M=e.cacaheableRemoteSize,A=e.needCacheTextures,_=e.texturesCount,D=e.texturesSize,F=e.avgReadCacheCost,x=e.topReadCacheCost,O=e.topNetworkTime,N=e.monitorDuration,W=e.showResultAfterLaunch,B=Object.create(null);Object.assign(B,{useH2:t,enabledH2Count:n,enabledContentEncodingCount:i,useContentEncoding:a,cacheSettings:r,cacheCatalog:o,appendHashToCatalog:s,requestCataHash:u,requestBundleSettings:c,requestBundleCatalog:l,loadCount:d,loadedCount:h,loadedSize:f,totalSize:k,cacheableCount:m,hitCacheCount:g,duration:v,networkTime:y,networkUsage:T,maxLoadingCount:S,cacheableSize:p,avgLoadingCount:P,texturesCount:_,texturesSize:D,needCacheTextures:A,cacaheableRemoteSize:M,cacheableRemoteCount:L,avgPendingDuration:w,topPendingDuration:I,avgReadCacheCost:F,topReadCacheCost:x,topNetworkTime:O,monitorDuration:N,showResultAfterLaunch:W,remoteRequestCount:R,remoteContentSize:C,noCacheableAssetCount:E,noCacheableAssetSize:b,isGameInteractive:this.isGameInteractive}),this.reportData.assetInfo=B,_t.send(new Mt({ReportType:Ce.ASSETS_INFO,ExternInfo:JSON.stringify(B)}))}}},{key:"reportFrameInfo",value:function(){if(this.enableMonitor){var e=ei.result,t=e.frameCount,n=e.frames,i=e.longestFrame,a=e.totalJankTime,r=e.jankRate,o=e.topFrameCost,s=e.topFrameNetworkCount,u=e.timerRuntime,c=e.appRuntime,l=e.configMonitorDuration,d=e.showResultAfterLaunch,h=e.configFps,f=Object.create(null);Object.assign(f,{frameCount:t,longestFrame:i,totalJankTime:a,jankRate:r,timerRuntime:u,appRuntime:c,frames:n,topFrameCost:o,topFrameNetworkCount:s,configMonitorDuration:l,showResultAfterLaunch:d,configFps:h,isGameInteractive:this.isGameInteractive}),this.reportData.frameInfo=f,_t.send(new Mt({ReportType:Ce.FRAME_INFO,ExternInfo:JSON.stringify(f)}))}}}]),n}(de).getInstance();h.id="",h.style.width=G,h.style.height=U,h.width=G*B,h.height=U*B,h.widthNative=0,h.heightNative=0,o.eventLog=function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var a=n[0],r=void 0===a?"":a;ue.log.apply(ue,["[PLUGIN LOG] "].concat(n)),r.includes("fetch js:")&&n.length>1&&si.wasmSplitMonitor.recordSyncFetchTime(),ee&&(e=console).log.apply(e,["[PLUGIN LOG]"].concat(n))},o.timeLog=function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];ue.log.apply(ue,["[PLUGIN TIME LOG] "].concat(n)),(e=console).log.apply(e,["[PLUGIN TIME LOG] "].concat(n))};var ui,ci,li=function(){function e(t){l(this,e),this.loadingPageType=he.LONG_VIDEO,this.inited=!1,this.visible=!1,this.playing=!1,this.loadingVideo=null,this.inited||this.init(t)}return d(e,[{key:"showLoadingPage",value:function(){var e=this;return new Promise((function(t){e.loadingVideo&&!e.visible?(e.visible=!0,e.loadingVideo.width=G,e.loadingVideo.height=U,e.loadingVideo.x=0,e.loadingVideo.y=0,e.loadingVideo.play(),e.loadingVideo.onplay((function(){e.playing=!0})),t()):t()}))}},{key:"hideLoadingPage",value:function(){this.loadingVideo&&this.visible&&(this.playing=!1,this.visible=!1,this.loadingVideo.pause(),this.loadingVideo.destroy(),this.loadingVideo=null)}},{key:"init",value:function(e){this.inited=!0,e.src&&(this.loadingVideo=r.createVideo({width:1,height:1,x:-1,y:-1,src:e.src,controls:!1,showProgress:!1,showProgressInControlMode:!1,autoplay:!1,loop:!0,enableProgressGesture:!1,showCenterPlayBtn:!1,underGameView:!0,objectFit:"cover"}))}}]),e}();!function(e){e.DEFAULT="default",e.OK="ok",e.ERROR="error"}(ui||(ui={})),function(e){e.LOADED="loaded",e.ERROR="error",e.COMPLETE="complete"}(ci||(ci={}));var di=function(){function e(t){l(this,e),this.emitter=Je,this.url=t,this.localStatus=ui.DEFAULT,this.localStatusCode=void 0,this.localResponse=""}return d(e,[{key:"status",get:function(){return this.localStatus},set:function(e){e&&!this.localStatus&&(this.localStatus=e)}},{key:"error",get:function(){return this.localError},set:function(e){this.localError=e}},{key:"statusCode",get:function(){return this.localStatusCode||0},set:function(e){void 0===this.localStatusCode&&Number.isInteger(e)&&(this.localStatusCode=e,this.status===ui.DEFAULT&&(this.status=e&&e>=200&&e<300?ui.OK:ui.ERROR))}},{key:"response",get:function(){return this.localResponse},set:function(e){this.status===ui.DEFAULT&&(e?(this.status=ui.OK,this.localResponse=e):(this.status=ui.ERROR,this.localResponse=""))}},{key:"on",value:function(e){var t=this;return new Promise((function(n){t.status!==ui.DEFAULT?n(t):t.emitter.on(e,(function(){n(t)}))}))}},{key:"once",value:function(e){var t=this;return new Promise((function(n){t.emitter.once(e,(function(){n(t)}))}))}},{key:"emit",value:function(e){this.emitter.emit(e)}}]),e}(),hi=function(){function e(){l(this,e),this.httpTasks=new Map}return d(e,[{key:"isSameTask",value:function(e,t){return e.url===t.url}},{key:"hasTask",value:function(e){return this.httpTasks.has(e.url)}},{key:"addTask",value:function(e){this.hasTask(e)||this.httpTasks.set(e.url,e)}},{key:"removeTask",value:function(e){this.hasTask(e)&&this.httpTasks.delete(e.url)}},{key:"getTaskByUrl",value:function(e){return e?this.httpTasks.get(e):null}}]),e}(),fi=function(){function t(){var i=this;l(this,t),this.loadedSize=0,this.inited=!1,this.localLoadingCount=0,this.defaultMaxParallelCount=10,this.timer=0,this.maxCount=this.defaultMaxParallelCount,this.preloadList=[],this.preloadInfoList=new Map,this.loadedUrls=new Map,this.httpTaskManager=null,this.setPreloadList=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e?void 0:e.length){e.filter((function(e){return!!(null==e?void 0:e.trim())})).map(i.handlePreloadInfo).forEach((function(e){hn(e.url)&&i.preloadInfoList.set(e.shortSubPath,e)}));var t=Ra.getInstance(),n=!i.preloadList.length&&!!t&&!(null==t?void 0:t.isAssetsLoading);i.preloadList=Array.from(i.preloadInfoList.values()).map((function(e){return e.url})),i.inited&&n&&i.load(),si.preloadMonitor.setPreloadList(i.preloadInfoList)}},this.handlePreloadInfo=function(e){var t=e.includes("http")?e:nn(pn("StreamingAssets"),e),n=rn(t=an(t)),i=sn(t),a=ln(t),r=cn(t);return{url:t,md5:a,shortFilename:r,filename:n,subPath:nn(i,n),shortSubPath:nn(i,r)}},this.releaseAll=function(){Array.from(i.loadedUrls.keys()).forEach((function(e){i.releaseTask(new di(e))})),i.timer=0},this.load=function(){return function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))}(i,void 0,void 0,e().mark((function t(){var i,a,r,o,s,u,c,l,d,h,f,p,m,g;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this.preloadList.shift()){e.next=3;break}return e.abrupt("return");case 3:if(r=this.handlePreloadInfo(a),o=new di(a),!this.getTaskByUrl(a)){e.next=6;break}return e.abrupt("return");case 6:if(!Rn.getCachePath(a)){e.next=8;break}return e.abrupt("return",void setTimeout(this.load,0));case 8:return s=rn(a),e.prev=9,si.preloadMonitor.startLoad(a),this.addTask(o),je.timeStart("preload:".concat(a)),qe.pluginLog("PreloadManager: ".concat(s,"开始预载")),e.next=13,it(Rn.downloadFileByXMLHttpRequest(a));case 13:if(u=e.sent,c=n(u,2),l=c[0],d=c[1],(h=this.preloadInfoList.has(r.shortSubPath)&&(null===(i=this.preloadInfoList.get(r.shortSubPath))||void 0===i?void 0:i.subPath)!==r.subPath)||si.preloadMonitor.completeLoad(a,d,l),(h||l)&&je.timeEnd("preload:".concat(a)),!h){e.next=20;break}return e.abrupt("return",(o.statusCode=400,this.removeTask(o)));case 20:if(!l){e.next=22;break}throw o.statusCode||(o.statusCode=400),o.error=l,l;case 22:this.loadedUrls.set(a,!0),this.checkNeedReleaseAll(),f=d.response,p=d.status,o.statusCode=p,dt(p)?(qe.pluginLog("PreloadManager: ".concat(s,"预载完成, 耗时: ").concat(je.timeEnd("preload:".concat(a)),"ms")),m=f.byteLength,this.countLoadedFileSize(m),o.response=f,je.timeStart("savepreload:".concat(a)),(g=un(a))&&it(Rn.writeFile({filePath:g,data:f})).then((function(e){var t=n(e,1)[0];qe.pluginLog("PreloadManager: ".concat(a,"缓存完成,耗时: ").concat(je.timeEnd("savepreload:".concat(a)),"ms")),t&&qe.pluginError("PreloadManager: ".concat(s,"未正常缓存"),t.errMsg||t.message,t)}))):this.reportHttpError({filename:s,url:a,error:p,type:"onerror"}),e.next=30;break;case 27:e.prev=27,e.t0=e.catch(9),this.reportHttpError({filename:s,url:a,error:e.t0,type:"catch"});case 30:this.removeTask(o,!1);case 31:case"end":return e.stop()}}),t,this,[[9,27]])})))}}return d(t,[{key:"loadingCount",get:function(){return this.localLoadingCount},set:function(e){Number.isInteger(e)&&e>=0&&(e<this.maxCount&&setTimeout(this.load,0),this.localLoadingCount=e)}},{key:"isPreloadedUrl",value:function(e){return this.loadedUrls.has(e)}},{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preloadList:[]},t=e.preloadList;this.inited||(this.setPreloadList(t),this.inited=!0,this.loadedSize=0,this.localLoadingCount=0,this.httpTaskManager=new hi)}},{key:"hasTask",value:function(e){return!!this.httpTaskManager&&this.httpTaskManager.hasTask(e)}},{key:"getTaskByUrl",value:function(e){return this.httpTaskManager?this.httpTaskManager.getTaskByUrl(e):null}},{key:"addTask",value:function(e){this.httpTaskManager&&(this.httpTaskManager.hasTask(e)||(this.httpTaskManager.addTask(e),this.loadingCount+=1))}},{key:"removeTask",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.httpTaskManager&&this.httpTaskManager.hasTask(e)){e.emit(ci.COMPLETE),this.loadingCount-=1,0===this.loadingCount&&si.preloadMonitor.finishPreload();var n=this.handlePreloadInfo(e.url);this.preloadInfoList.delete(n.shortSubPath),t&&this.releaseTask(e)}}},{key:"handleRemove",value:function(e){var t,n;(null===(n=null===(t=null==this?void 0:this.httpTaskManager)||void 0===t?void 0:t.hasTask)||void 0===n?void 0:n.call(t,e))&&this.httpTaskManager.removeTask(e)}},{key:"releaseTask",value:function(e){this.handleRemove(e),this.loadedUrls.delete(e.url)}},{key:"checkNeedReleaseAll",value:function(){this.timer||(this.timer=setTimeout(this.releaseAll,6e4))}},{key:"setConcurrent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=Number(e)||1;t=t>10?10:Math.max(1,t),this.maxCount=t}},{key:"unShift",value:function(e){this.preloadList.unshift(e),this.loadingCount=Number(this.loadingCount)}},{key:"countLoadedFileSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.loadedSize+=e,this.loadedSize}},{key:"reportHttpError",value:function(e){var t=e.filename,n=e.url,i=e.error,a=e.type,r="number"==typeof i,o=i;r||"string"==typeof i||(o=(null==i?void 0:i.errMsg)||(null==i?void 0:i.message)||"empty errMsg"),qe.pluginError("PreloadManager_".concat(a,": ").concat(t,"预载失败"),"; networkType: ",Et.networkType,"; isVisible: ",vt(),", error=",o),Ra.getInstance().needPluginReport()&&Dt.send(new Mt({ReportType:ke.LOAD_ASSET_BUNDLE,ErrorMsg:"".concat(o),ErrorType:r?o:0,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({event:"PreloadManager: ".concat(a),url:n,gameStage:Pt()})}))}}],[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}}]),t}();fi.instance=null;var pi,mi=fi.getInstance(),gi=d((function e(t){l(this,e);var n=t.getAllResponseHeaders(),i=new Map;n.trim().split(/[\r\n]+/).forEach((function(e){var t=e.split(": "),n=t.shift(),a=t.join(": ");i.set(n,a)})),this.headers=i,this.url=t.paramsCache.url,this.ok=!!(t.status>=200&&t.status<300),this.status=t.status,this.statusText=t.statusText,this.parsedBody=new Uint8Array(t.response),this.originXHR=t})),vi=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))};!function(e){e[e.Fail=0]="Fail",e[e.Ok=1]="Ok"}(pi||(pi={}));var yi=d((function e(t){l(this,e),this.status=t.status,this.errMsg=t.errMsg,this.cachePath=t.xhrObj.cachePath,this.response=t.xhrObj.response,this.cacheable=t.xhrObj.cacheable,this.isReadFromCache=t.xhrObj.isReadFromCache})),Ti=function(){function t(){var i=this;l(this,t),this.status=void 0,this.statusText=void 0,this.cacheable=!1,this.isReadFromCache=!1,this.isFetchApi=!1,this.ignoreCallback=!1,this.skipOldCacheClean=!1,this.signal={aborted:!1},this.openAndSend=function(e,t){return i.isFetchApi=!0,i.open(t.method,e,!0),i.responseType="arraybuffer",Object.keys(t.headers).forEach((function(e){i.setRequestHeader(e,t.headers[e])})),i.timeout=t.timeout,i.onprogress=t.onProgress,new Promise((function(e,n){i.onFetchResolve=function(){e(new gi(i))},i.onFetchReject=function(e){var t=new gi(i);t.message=(null==e?void 0:e.errMsg)||(null==e?void 0:e.message)||"",n(t)},i.send(t.body)}))},this.send=function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];return vi(i,void 0,void 0,e().mark((function t(){var i,r,o,s,u,c,l,d,h,f,p,m,g,v,y;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!gn(r=this.paramsCache.url)){e.next=3;break}return e.abrupt("return",(X&&qe.debugLog("[开发阶段提示]请求无效URL=",r,", 浏览器搜索 `Disable Editor analytics` 或忽略此日志"),this.triggerEvent("error")));case 3:if(o=Rn.getCachePath(r),s=null,u=200,c=rn(r),!hn(r)){e.next=35;break}if(je.timeStart("xhr_send:".concat(r)),!(l=mi.getTaskByUrl(r))){e.next=22;break}if(!mi.isPreloadedUrl(r)){e.next=13;break}qe.pluginLog("xhr: ".concat(c,"使用预载内容")),s=l.response,o="",mi.releaseTask(new di(r)),e.next=20;break;case 13:return qe.pluginLog("xhr: ".concat(c,"等待预载完成")),e.next=16,l.once(ci.COMPLETE);case 16:d=e.sent,h=d.statusCode,f=d.response,u=h,s=f;case 20:e.next=23;break;case 22:mi.addTask(new di(r));case 23:if(!o){e.next=31;break}return e.next=26,it(Rn.readFile(o));case 26:p=e.sent,m=n(p,2),g=m[0],v=m[1],g?(qe.pluginError("xhr: ".concat(c,"读缓存失败, err="),g.errMsg),Dt.send(new Mt({ReportType:ke.LOAD_ASSET_BUNDLE,ErrorMsg:g.errMsg,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({stage:"CacheXMLHttpRequest: read cacheFile error",filename:c,gameStage:Pt()})})),Rn.removeFile(o)):(null==v?void 0:v.byteLength)?(s=v,u=200):(qe.pluginError("xhr: ".concat(c,"清理空文件缓存")),Rn.removeFile(o));case 31:if(this.cachePath=o,!s){e.next=35;break}return this.isReadFromCache=!0,this.createResponse({data:s,statusCode:u}),this.triggerEvent(dt(u)?"load":"error"),y=mi.getTaskByUrl(r),e.abrupt("return",void(y&&(y.statusCode=u,y.response=s,mi.removeTask(y))));case 35:return e.abrupt("return",(i=this.originXhr).send.apply(i,a));case 36:case"end":return e.stop()}}),t,this)})))},this.open=function(e,t,n){var a,r=an(t);if(i.paramsCache={method:e,url:r,async:n},!dn(r))return qe.pluginError("URL不合法: ",r),i.triggerEvent("error");for(var o=arguments.length,s=new Array(o>3?o-3:0),u=3;u<o;u++)s[u-3]=arguments[u];hn(r)?i.cacheable=!0:mi.addTask(new di(r)),si.requestMonitor.startLoad(r,i.reqId),(a=i.originXhr).open.apply(a,[e,r,n].concat(s)),i.onload=function(){},i.onerror=function(){},i.ontimeout=function(){},i.onabort=function(){}},this.bindEvent=function(){var e=["readyState","response","responseText","responseURL","responseXML","status","statusText"];["readyState","response","responseText","responseType","responseURL","responseXML","status","statusText","timeout","upload","withCredentials","onloadstart","onprogress","onabort","onerror","onload","ontimeout","onloadend","onreadystatechange"].forEach((function(t){Object.defineProperty(i,t,{get:function(){return e.includes(t)&&i["_".concat(t)]||i.originXhr[t]},set:function(n){"onload"===t?i.originXhr[t]=function(e){i.isFetchApi?i.triggerEvent("FetchResolve"):n(e),i.handleTaskComplete();var t=i.paramsCache.url;if(si.requestMonitor.completeLoad(t,i,void 0,i.reqId),i.cacheable){var a=Rn.getFileInfo(t),r=rn(t);if(dt(i.status)){if(!i.response.byteLength)return i.triggerEvent("complete",new yi({xhrObj:i,status:pi.Fail,errMsg:yn.EmptyContent})),qe.pluginError("xhr_onload: ".concat(r,"是空文件,不使用缓存"));if(a)i.triggerEvent("complete",new yi({xhrObj:i,status:pi.Ok})),qe.pluginLog("xhr_onload: ".concat(r,",耗时=").concat(je.timeEnd("xhr_send:".concat(t)),"ms,size=").concat(i.response.byteLength,",有缓存"));else{qe.pluginLog("xhr_onload: ".concat(r,",耗时=").concat(je.timeEnd("xhr_send:".concat(t)),"ms,size=").concat(i.response.byteLength,",无缓存"));var o=un(t);if(i.cachePath=o,o)Rn.writeFile({filePath:i.cachePath,data:i.response,skipCleanOld:i.skipOldCacheClean}).then((function(){i.triggerEvent("save",o),i.triggerEvent("complete",new yi({xhrObj:i,status:pi.Ok}))})).catch((function(e){i.triggerEvent("savefail",e),i.triggerEvent("complete",new yi({xhrObj:i,status:pi.Fail,errMsg:e.errMsg||e.message}))}));else{var s=new Error(yn.InvalidCachePath);i.triggerEvent("savefail",s),i.triggerEvent("complete",new yi({xhrObj:i,status:pi.Fail,errMsg:s.message}))}}}else i.triggerEvent("complete",new yi({xhrObj:i,status:pi.Fail,errMsg:i.statusText})),i.reportHttpError({filename:r,url:t,error:i.status,type:"onload"})}else i.triggerEvent("complete",new yi({xhrObj:i,status:pi.Ok})),dt(i.status)||i.reportHttpError({filename:on(t),url:t,error:i.status,type:"onload"})}:"onerror"===t||"ontimeout"===t||"onabort"===t?i.originXhr[t]=function(e){var a=i.paramsCache.url;si.requestMonitor.completeLoad(a,i,e,i.reqId),i.isFetchApi?i.triggerEvent("FetchReject",e):n(e),i.handleTaskComplete(),i.triggerEvent("complete",new yi({xhrObj:i,status:pi.Fail,errMsg:"".concat(t,"_").concat(i.statusText)})),i.reportHttpError({filename:i.cacheable?rn(a):on(a),url:a,error:e,type:t})}:e.includes(t)?i["_".concat(t)]=n:i.originXhr[t]=n}})})),["abort","getAllResponseHeaders","getResponseHeader","overrideMimeType","addEventListener","setRequestHeader"].forEach((function(e){Object.defineProperty(i,e,{value:function(){var t;if("abort"===e&&(i.signal.aborted=!0),"setRequestHeader"===e){if("wechatminigame-preload"===(arguments.length<=0?void 0:arguments[0]))return void(i.ignoreCallback="1"===(arguments.length<=1?void 0:arguments[1]));if("wechatminigame-skipclean"===(arguments.length<=0?void 0:arguments[0]))return void(i.skipOldCacheClean="0"===(arguments.length<=1?void 0:arguments[1]))}return(t=i.originXhr)[e].apply(t,arguments)}})}))},this.createResponse=function(e){var t=e.data,n=e.statusCode,a=void 0===n?200:n;void 0!==a&&(i.status=a),t&&(i.response=t)},this.triggerEvent=function(e){for(var t=i["on".concat(e)],n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];t&&t.apply(i,a||[])},this.originXhr=new o.XMLHttpRequest,this.paramsCache={},this.bindEvent(),this.reqId=function(e){for(var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n="",i=0;i<10;i++)n+=t[Math.floor(36*Math.random())];return n}()}return d(t,[{key:"handleTaskComplete",value:function(){var e=mi.getTaskByUrl(this.paramsCache.url);e&&(e.statusCode=this.originXhr.status,e.response=this.originXhr.response,mi.removeTask(e))}},{key:"reportHttpError",value:function(e){var n,i=e.filename,a=e.url,r=e.error,s=e.type;if(gn(a))t.hasUnityAnalysisLoged||(t.hasUnityAnalysisLoged=!0,qe.debugWarn("[开发版提示]请求无用URL=",a));else{var u=!1,c=qe.pluginError,l="number"==typeof r,d=r;l||"string"==typeof r||(d=(null==r?void 0:r.errMsg)||(null==r?void 0:r.message)||"empty errMsg"),o.isReportableHttpError&&((null===(n=o.isReportableHttpError)||void 0===n?void 0:n.call(o,{url:a,filename:i,error:r}))||(u=!0,c=qe.debugError)),c("xhr_".concat(s,": ").concat(i,"下载失败: statusCode="),!!l&&this.status,", statusText=",this.statusText,", networkType=",Et.networkType,", isVisible=",vt(),", cost=",this.cacheable?je.timeEnd("xhr_send:".concat(a)):"-","ms, errMsg=",d,", error=",r),Ra.getInstance().needPluginReport()&&!u&&Dt.send(new Mt({ReportType:ke.LOAD_ASSET_BUNDLE,ErrorMsg:"".concat(d),ErrorType:Number(this.status),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({event:"CacheXMLHttpRequest_".concat(s,": ").concat(l?"statusCode":"network"," error"),isReadFromCache:this.isReadFromCache,cacheable:this.cacheable,type:s,url:a,gameStage:Pt()})}))}}}]),t}();Ti.hasUnityAnalysisLoged=!1;var Si,Pi=N,ki=Pi.screenWidth,Ei=Pi.screenHeight,bi={body:{position:"relative",overflow:"hidden",hidden:!1,opacity:1,width:ki,height:Ei},video:{position:"absolute",top:0,left:0,width:ki,height:Ei},container:{position:"absolute",overflow:"hidden",hidden:!1,top:0,left:0,backgroundColor:"#ffffff"},bgImg:{position:"absolute",top:0,left:0,width:ki,height:Ei},loadingWrap:{position:"absolute",overflow:"hidden",textAlign:"center",width:240,height:24,borderRadius:12,backgroundColor:"#000000",opacity:.5,bottom:64,left:(ki-240)/2},loadingInnerWrap:{position:"absolute",overflow:"hidden",width:236,height:20,bottom:66,borderRadius:10,left:(ki-240)/2+2},loadingInner:{position:"absolute",overflow:"hidden",width:236,height:20,borderRadius:10,backgroundColor:"#07c160",top:0,left:-236},loadingInnerFake:{position:"absolute",overflow:"hidden",width:236,height:20,borderRadius:10,backgroundColor:"#07c160",top:0,left:-236},loadingInnerSecond:{position:"absolute",overflow:"hidden",width:236,height:20,borderRadius:10,backgroundColor:"#07c160",top:0,left:-236},loadingText:{position:"absolute",textAlign:"center",color:"#ffffff",letterSpacing:1,fontSize:12,width:240,height:20,lineHeight:20},unityLogo:{position:"absolute",width:64,height:24,bottom:20,left:(ki-64)/2}},Ci=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},wi=N.screenWidth,Ii=N.screenHeight;function Ri(e,t){e.width=t.width,e.height=t.height,e.backgroundColor=t.backgroundColor,e.left=t.left}function Li(e,t,n){var i={},a=["width","right","left"];return["width","height","top","right","bottom","left","backgroundColor","color","padding","fontSize","lineHeight"].forEach((function(r){var o=e[r];if(void 0!==o||null!==o){if("string"==typeof o&&o.includes("%")){var s=+o.replace("%","")/100;o=a.includes(r)?t*s:n*s}i[r]=o}})),i}function Mi(e,t){(0,x.Kn)(t)&&Object.keys(t).forEach((function(n){(0,x.xb)(t[n])||(e[n]=t[n])}))}function Ai(e,t){var n,i,r=null,o=a(e.children);try{for(o.s();!(i=o.n()).done;){var s=i.value;if((null===(n=null==s?void 0:s.attributes)||void 0===n?void 0:n.id)===t){r=s;break}if(s.children.length>0){var u=Ai(s,t);if(null!==u){r=u;break}}}}catch(e){o.e(e)}finally{o.f()}return r}function _i(e,t){e.children=e.children.filter((function(e){return e.attributes.id!==t}))}!function(e){e.NO_BORDER="NO_BORDER",e.EXACT_FIT="EXACT_FIT",e.FIXED_HEIGHT="FIXED_HEIGHT",e.FIXED_WIDTH="FIXED_WIDTH",e.SHOW_ALL="SHOW_ALL",e.FIXED_NARROW="FIXED_NARROW",e.FIXED_WIDE="FIXED_WIDE"}(Si||(Si={}));var Di;function Fi(){var e,t,n,i=this,a=T(this),r=k('\n  <view id="body">\n    <view id="container">\n      <image\n        id="bg-img"\n      ></image>\n      <video\n        id="video"\n        controls="false"\n        obeyMuteSwitch="true"\n        pageGesture="false"\n        loop="true"\n        muted="true"\n        autoplay="false"\n        object-fit="cover"\n        enable-progress-gesture="false"\n        enable-play-gesture="false"\n        show-center-play-btn="false"\n        auto-insert="false"\n      ></video>\n      \n      <view\n        id="loading-wrap"\n      ></view>\n      <view\n        id="loading-inner-wrap"\n      >\n        <view\n          id="loading-inner"\n        ></view>\n        <view id="loading-inner-fake"></view>\n        <view id="loading-inner-second"></view>\n      </view>\n\n      <text\n        id="loading-text"\n        value="正在加载"\n      ></text>\n\n      <image\n        id="unity-logo"\n        src="images/unity_logo.png"\n      ></image>\n    </view>\n  </view>\n').root,o=JSON.parse(JSON.stringify(bi)),s=Ai(r,"container"),u=Ai(r,"video"),c=Ai(r,"bg-img"),l=Ai(r,"unity-logo");if(o.body.hidden=!this.isVisible,this.materialConfig.backgroundImage){c.attributes.src=this.materialConfig.backgroundImage;var d=this.backgroundImageInfo,h=d.width,f=d.height;if(this.isDefaultLoading){var p=h/f*Ii;if(p<wi){var m=f/h*wi;o.bgImg.width=wi/this.scaleX,o.bgImg.height=m/this.scaleY,o.bgImg.top=-(m-Ii)/2/this.scaleY}else o.bgImg.height=Ii/this.scaleY,o.bgImg.width=p/this.scaleX,o.bgImg.left=-(p-wi)/2/this.scaleX}else o.bgImg.height=this.designHeight,o.bgImg.width=this.designWidth,o.bgImg.left=0,o.bgImg.top=0}else _i(s,"bg-img");(null===(e=this.extensionButton)||void 0===e?void 0:e.length)&&this.extensionButton.forEach((function(e){s.children.push({name:"image",content:"",children:[],attributes:{id:e.id,src:e.image}});var t={};Object.keys(e.style).forEach((function(n){void 0!==e.style[n]&&(t[n]=e.style[n])})),o[e.id]=Object.assign({position:"absolute"},t)})),this.materialConfig.backgroundVideo?(this.isDefaultLoading?(o.video.height=Ii/this.scaleY,o.video.width=wi/this.scaleX):(o.video.height=this.designHeight,o.video.width=this.designWidth),u.attributes.src=this.materialConfig.backgroundVideo):_i(s,"video"),this.iconConfig.visible?l.attributes.src=this.materialConfig.iconImage:_i(s,"unity-logo"),o.container.width=this.designWidth,o.container.height=this.designHeight,o.container.left=(wi-this.designWidth)/2,o.container.top=(Ii-this.designHeight)/2,o.container.scaleWidth=this.scaleX,o.container.scaleHeight=this.scaleY;var g=this.barComputedStyle,v={width:g.width,height:g.height,borderRadius:g.borderRadius||g.height/2,left:g.left||(this.designWidth-g.width)/2,bottom:g.bottom,right:g.right,top:g.top};Mi(o.loadingWrap,v);var y={width:g.width-2*g.padding,height:g.height-2*g.padding,borderRadius:(g.height-2*g.padding)/2,backgroundColor:g.backgroundColor,left:-(g.width-2*g.padding)};Mi(o.loadingInnerWrap,{width:y.width,height:y.height,borderRadius:y.borderRadius,left:o.loadingWrap.left+g.padding,bottom:g.bottom+g.padding}),this.trueInnerImageWidth=y.width,Ri(o.loadingInner,y),Ri(o.loadingInnerFake,y),Ri(o.loadingInnerSecond,y);var E=this.textConfig.style;if(o.loadingText.width=E.width,o.loadingText.left=(this.designWidth-E.width)/2,o.loadingText.height=E.height,o.loadingText.lineHeight=E.height,o.loadingText.bottom=E.bottom,o.loadingText.color=E.color,o.loadingText.fontSize=E.fontSize,this.iconConfig.visible){var b=this.iconConfig.style;o.unityLogo.width=b.width,o.unityLogo.height=b.height,o.unityLogo.bottom=b.bottom,o.unityLogo.left=(this.designWidth-b.width)/2}if(S.call(this,r,o),P.add(a.body),M.isWK&&Y&&this.iconConfig.visible){var C=0;a.unityLogo.on("click",(function(){3===(C+=1)&&i.destory()}))}return null===(n=null===(t=null==this?void 0:this.extensionButton)||void 0===t?void 0:t.forEach)||void 0===n||n.call(t,(function(e){a[e.id].on("click",(function(){var t;null===(t=null==e?void 0:e.callback)||void 0===t||t.call(e)}))})),a.body.ready()}!function(e){e[e.Downloading=0]="Downloading",e[e.CompileWasm=1]="CompileWasm",e[e.PrepareGame=2]="PrepareGame"}(Di||(Di={}));var xi=function(t){u(i,t);var n=c(i);function i(t){var a,o=t.totalLaunchTime,u=void 0===o?15e3:o,c=t.animationDuration,d=void 0===c?300:c,h=t.needDownload,f=t.hideAfterCallmain,p=void 0!==f&&f,m=t.textConfig,g=t.barConfig,v=t.materialConfig,y=t.iconConfig,S=t.designWidth,k=t.designHeight,E=t.scaleMode,b=t.extensionButton,C=t.visible;l(this,i),(a=n.call(this)).totalLaunchTime=15e3,a.animationDuration=300,a.loadingOuterInfo={},a.loadingInnerInfo={},a.backgroundImageInfo={},a.useBackgroundImage=!1,a.hideAfterCallmain=!1,a.completed=!1,a.latestStage=Di.Downloading,a.visible=!1,a.load=function(){return a.isVisible?T(s(a)).loadPromise:Promise.resolve()},a.resume=function(){return Ci(s(a),void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.load();case 2:this.show(),e.t0=this.latestStage,e.next=e.t0===Di.Downloading?6:e.t0===Di.CompileWasm?8:e.t0===Di.PrepareGame?10:11;break;case 6:return this.startDownloadAnimation(),e.abrupt("break",11);case 8:return this.showCompileWasm(),e.abrupt("break",11);case 10:this.startCompileAnimation();case 11:case"end":return e.stop()}}),t,this)})))},a.loadImage=function(){return function(e){return new Promise((function(t){if(e){var n=r.createImage();n.onload=function(){t(n)},n.onerror=function(){t(null)},n.src=e}else t(null)}))}(a.materialConfig.backgroundImage).then((function(e){e&&(a.backgroundImageInfo={width:e.width,height:e.height})}))},a.destory=function(){var e=T(s(a));e.body.animate({opacity:0,duration:a.animationDuration}).then((function(){P.remove(e.body)}))},a.renderVideo=function(){if(a.isVisible){var e=T(s(a));e.video&&(e.video.muted=!1,e.video.play(),setTimeout((function(){e.video.play()}),250))}},a.show=function(){return a.isVisible?(T(s(a)).body.style.hidden=!1,a.materialConfig.backgroundVideo&&a.renderVideo(),Promise.resolve()):Promise.resolve()},a.hide=function(){T(s(a)).body.style.hidden=!0},a.showCompileWasm=function(){return Ci(s(a),void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.latestStage=Di.CompileWasm,e.t0=this.isVisible,!e.t0){e.next=6;break}return e.next=5,this.load();case 5:this.setLoadingText(this.textConfig.compilingText);case 6:case"end":return e.stop()}}),t,this)})))},a.setLoadingText=function(t){return Ci(s(a),void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.isVisible,!e.t0){e.next=5;break}return e.next=4,this.load();case 4:e.t0=t;case 5:if(!e.t0){e.next=7;break}T(this).loadingText.value=t;case 7:case"end":return e.stop()}}),n,this)})))},a.loopText=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,i=T(s(a));if(!i[n]&&(null==e?void 0:e.length)){var r=e[t];a.needDownload&&a.textConfig.firstStartText&&(r+="(".concat(a.textConfig.firstStartText,")")),a.setLoadingText(r||"正在加载资源"),a.loopTextTimer=setTimeout((function(){if(!i[n]){var r=t+1>=e.length?0:t+1;a.loopText(e,r,n)}}),a.textConfig.textDuration)}},a.startDownloadAnimation=function(){return Ci(s(a),void 0,void 0,e().mark((function t(){var n,i=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.latestStage=Di.Downloading,this.isVisible){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.load();case 4:n=T(this),this.loopText(this.textConfig.downloadingText,0,"downloaded"),n.loadingInner.nextLayout().then((function(){n.loadingInner.animate({left:-.30000000000000004*i.trueInnerImageWidth,duration:.7*i.totalLaunchTime})}));case 6:case"end":return e.stop()}}),t,this)})))},a.completeDownloadAnimation=function(){return Ci(s(a),void 0,void 0,e().mark((function t(){var n,i=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isVisible){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.load();case 4:(n=T(this)).downloaded=!0,n.loadingInnerFake.nextLayout().then((function(){n.loadingInnerFake.animate({left:-.30000000000000004*i.trueInnerImageWidth,duration:i.animationDuration})}));case 6:case"end":return e.stop()}}),t,this)})))},a.startCompileAnimation=function(){return Ci(s(a),void 0,void 0,e().mark((function t(){var n,i=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.latestStage=Di.PrepareGame,this.isVisible){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.load();case 4:return n=T(this),e.abrupt("return",new Promise((function(e){n.loadingInnerSecond.style.left=-.30000000000000004*i.trueInnerImageWidth,n.loadingInnerSecond.nextLayout().then((function(){i.setLoadingText(i.textConfig.initText),n.loadingInnerSecond.animate({left:-(1-.9)*i.trueInnerImageWidth,duration:.9*i.totalLaunchTime})})),e()})));case 6:case"end":return e.stop()}}),t,this)})))},a.completeCompileAnimation=function(){return Ci(s(a),void 0,void 0,e().mark((function t(){var n,i=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isVisible){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:return e.next=4,this.load();case 4:return n=T(this),e.abrupt("return",new Promise((function(e){n.downloaded||(i.loopTextTimer&&(clearTimeout(i.loopTextTimer),i.loopTextTimer=null),i.loopText(i.textConfig.downloadingText,0,"downloaded")),e()})));case 6:case"end":return e.stop()}}),t,this)})))},a.completeCallmainAnimation=function(){return Ci(s(a),void 0,void 0,e().mark((function t(){var n,i=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isVisible){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:return e.next=4,this.load();case 4:return n=T(this),e.abrupt("return",new Promise((function(e){i.setLoadingText(i.textConfig.completeText),i.hideAfterCallmain?n.loadingInnerFake.nextLayout().then((function(){n.loadingInnerFake.style.left=0,e()})):n.loadingInnerFake.nextLayout().then((function(){n.compiled=!0,n.loadingInnerFake.animate({left:0,duration:i.animationDuration}).then(e)}))})));case 6:case"end":return e.stop()}}),t,this)})))},a.complete=function(){return Ci(s(a),void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.completed,e.t0){e.next=7;break}return this.completed=!0,e.next=5,this.completeCallmainAnimation();case 5:return e.next=7,this.destory();case 7:case"end":return e.stop()}}),t,this)})))},a.hideAfterCallmain=p,a.totalLaunchTime=u,a.animationDuration=d,a.needDownload=h;var w=wi<Ii;if(a.isDefaultLoading=!S,a.visible=!!(0,x.o8)(C)||!!C,a.isDefaultLoading)a.designWidth=wi,a.designHeight=Ii;else{var I=w?375:667,R=w?667:375;a.designWidth=S||I,a.designHeight=k||R}a.barConfig=g,a.textConfig=m,a.materialConfig=v,a.iconConfig=y||{},a.extensionButton=b||[],a.scaleMode=E||w?Si.FIXED_WIDTH:Si.FIXED_HEIGHT;var L=T(s(a));return L.isLoaded=!1,L.isShowed=!1,L.loadPromise=new Promise((function(e,t){je.timeStart("loadImage"),a.loadImage().then((function(){var n,i,r,o;a.stageSize=function(e,t,n,i,a){var r=t,o=n,s=i,u=a,c=t/s||0,l=n/u||0;switch(e){case Si.EXACT_FIT:break;case Si.FIXED_HEIGHT:s=Math.round(t/l),c=l;break;case Si.FIXED_WIDTH:u=Math.round(n/c),l=c;break;case Si.NO_BORDER:c>l?(o=Math.round(u*c),l=c):(r=Math.round(s*l),c=l);break;case Si.SHOW_ALL:c>l?(r=Math.round(s*l),c=l):(o=Math.round(u*c),l=c);break;case Si.FIXED_NARROW:c>l?(s=Math.round(t/l),c=l):(u=Math.round(n/c),l=c);break;case Si.FIXED_WIDE:c>l?(u=Math.round(n/c),l=c):(s=Math.round(t/l),c=l);break;default:s=t,u=n}return{displayWidth:r,displayHeight:o,stageWidth:s,stageHeight:u,scaleX:c,scaleY:l}}(E,wi,Ii,a.designWidth,a.designHeight),a.offsetX=(wi-a.stageSize.displayWidth)/2,a.offsetY=(Ii-a.stageSize.displayHeight)/2,a.displayWidth=a.stageSize.displayWidth,a.displayHeight=a.stageSize.displayHeight,a.scaleX=a.stageSize.scaleX,a.scaleY=a.stageSize.scaleY,a.barComputedStyle=Li(a.barConfig.style,a.designWidth,a.designHeight),a.textComputedStyle=Li(a.barConfig.style,a.designWidth,a.designHeight),a.extensionButton=null===(o=null===(r=null===(i=null===(n=a.extensionButton)||void 0===n?void 0:n.filter)||void 0===i?void 0:i.call(n,(function(e){return!!e.style})))||void 0===r?void 0:r.map)||void 0===o?void 0:o.call(r,(function(e){return e.id="extension".concat((0,x.hQ)(10,!0)),e.style=Li(e.style,a.designWidth,a.designHeight),e}));var u=je.timeEnd("loadImage"),c=je.getRuntime();qe.eventLog("[coverview-loadImage] cost=",u),je.timeStart("coverviewInit"),Fi.call(s(a)).then((function(){var t=je.timeEnd("coverviewInit"),n=je.getRuntime();qe.eventLog("[coverview-init] cost=",t),Ra.getInstance().initReporterPromise.then((function(){_t.send([new Mt({ReportType:ke.LOAD_BACKGROUND_IMAGE,CostTimeMs:u,RunTimeMs:c,ExternInfo:JSON.stringify({height:a.backgroundImageInfo.height,width:a.backgroundImageInfo.width})}),new Mt({ReportType:ke.COVER_VIEW_INIT,CostTimeMs:t,RunTimeMs:n})])})),e()})).catch((function(e){qe.pluginError("[coverview-init]",e),Ra.getInstance().initReporterPromise.then((function(){var t=je.timeEnd("coverviewInit"),n=je.getRuntime();Dt.send(new Mt({ReportType:ke.COVER_VIEW_INIT,CostTimeMs:t,RunTimeMs:n,ErrorMsg:(null==e?void 0:e.errMsg)||(null==e?void 0:e.message)}))})),t(e)}))}))})),L.onProgress=function(){L.bgImg&&(L.bgImg.style.hidden=!0),L.video&&L.video.offProgress(L.onProgress)},a.load().then((function(){L.isLoaded=!0,L.video&&L.video.onProgress(L.onProgress)})),a}return d(i,[{key:"isVisible",get:function(){return this.visible},set:function(e){this.visible=e,this.visible?this.resume():this.hide()}}]),i}(y),Oi=N,Ni=Oi.screenWidth,Wi={body:{zIndex:1000009,position:"absolute",overflow:"visible",hidden:!1,width:184,height:110,top:Oi.screenHeight/3,left:(Ni-184)/2},title:{position:"absolute",left:0,top:0,width:184,height:40,lineHeight:40,textAlign:"center",color:"#ff0000",fontSize:18,fontWeight:500,backgroundColor:"#ffffff"},restartBtn:{position:"absolute",left:0,top:70,width:184,height:40,lineHeight:40,textAlign:"center",backgroundColor:"#07C160",borderRadius:4,color:"#ffffff",fontSize:16}};function Bi(){var e=T(this),t=k('\n  <view id="body">\n    <text id="title" value="程序遇到错误"></text>\n    <text id="restart-btn" value="重启游戏"></text>\n  </view>\n').root,n=JSON.parse(JSON.stringify(Wi));return S.call(this,t,n),P.add(e.body),e.restartBtn.on("click",(function(){r.restartMiniProgram&&r.restartMiniProgram({})})),e.body.ready()}var Vi=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.call(this)).create=function(){return T(s(e)).createPromise()},e.destory=function(){var t=T(s(e));t.body.animate({opacity:0,duration:300}).then((function(){P.remove(t.body)}))},T(s(e)).createPromise=new Promise((function(t,n){Bi.call(s(e)).then(t).catch(n)})),e}return d(n,null,[{key:"getInstance",value:function(){return n.instance||(n.instance=new n),n.instance}}]),n}(y);function Ui(e){var t=Number(e);return Number(e)?t<De.Min||t>De.Max?De.Default:t:De.Default}var Gi,ji=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},zi=function(){function t(){l(this,t),this.privateFs=null}return d(t,[{key:"setFs",value:function(e){this.privateFs=e}},{key:"statSync",value:function(e,t){try{return this.privateFs.statSync(e,t)}catch(t){return qe.pluginError("PrivateFs_statSync: ",e,t.errMsg,t),null}}},{key:"statAsyncCatch",value:function(e,t){var n=this;return new Promise((function(i){n.privateFs.stat({path:e,recursive:t,success:function(e){i(e.stats)},fail:function(){i(null)}})}))}},{key:"access",value:function(t){return ji(this,void 0,void 0,e().mark((function n(){var i=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){i.privateFs.access({path:t,success:e,fail:n})})));case 1:case"end":return e.stop()}}),n)})))}},{key:"mkdir",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Te;return ji(this,void 0,void 0,e().mark((function i(){var a,r=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=nn(n,sn(t)),e.abrupt("return",new Promise((function(e,t){r.access(a).then((function(){e(null)})).catch((function(){r.privateFs.mkdir({dirPath:a,recursive:!0,success:e,fail:function(n){if(n.errMsg.includes("exist"))return e(null);qe.pluginWarn("私有目录创建目录失败: ",a,n.errMsg,n),t(n)}})}))})));case 2:case"end":return e.stop()}}),i)})))}},{key:"writeFile",value:function(t,n){return ji(this,void 0,void 0,e().mark((function i(){var a=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.mkdir(t);case 2:return e.abrupt("return",new Promise((function(e,i){var r=rn(t);a.privateFs.writeFile({filePath:t,data:n,encoding:"binary",success:function(){qe.pluginLog("私有目录写入 ".concat(r," 成功")),e(null)},fail:function(e){qe.pluginWarn("私有目录写入 ".concat(r," 失败"),e),i(e)}})})));case 3:case"end":return e.stop()}}),i,this)})))}},{key:"readFile",value:function(e,t){var i=this;return new Promise((function(a,r){i.privateFs.readFile({filePath:e,encoding:t,success:function(e){if(M.isIOS&&!M.isWK){var t=En(new Uint8Array(e.data)),i=n(t,1)[0];e.data=i}a(e.data)},fail:r})}))}},{key:"readJson",value:function(t){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return ji(this,void 0,void 0,e().mark((function a(){var r,o,s,u;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=10;break}return e.next=3,it(this.readFile(t,"utf-8"));case 3:if(r=e.sent,o=n(r,2),s=o[0],!(u=o[1])||"string"!=typeof u){e.next=9;break}return e.abrupt("return",JSON.parse(u));case 9:s&&i&&qe.pluginWarn("私有目录读取json: ".concat(t,"失败"),s.errMsg||s.message,s);case 10:return e.abrupt("return",null);case 11:case"end":return e.stop()}}),a,this)})))}},{key:"writeJson",value:function(e,t){if(e&&t){var n=JSON.stringify(t);this.privateFs.writeFile({filePath:e,data:n,encoding:"utf-8",success:function(){qe.pluginLog("私有目录写入json: ".concat(e,"成功"))},fail:function(t){qe.pluginWarn("私有目录写入json: ".concat(e,"失败"),t.errMsg,t)}})}}}],[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}}]),t}().getInstance(),Hi=p(4293).default,qi=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},Ki=function(){function t(){var n=this;l(this,t),this.patchInstantiated=!1,this.patchFetched=!1,this.useCodeSplit=!0,this.isNewRuntime=!1,this.supportPrivateFs=!1,this.canUsePatch=te,this.patchBasePath="".concat(ye,"/__PATCH_DIR"),this.fs=Rn,this.createTime=0,this.isBr=!1,this.md5="",this.subVersion=0,this.patchPath="",this.brPatchPath="",this.defaultPatchPath="",this.needFetchPatch=!0,this.redirModIndexList=[],this.redirIndexPath="",this.patchFuncIndexList=[],this.patchFuncIndexPath="",this.instantiatePatch=function(t,i,a){return qi(n,void 0,void 0,e().mark((function t(){var n,r,o,s=this;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=!1,(r=qi(s,void 0,void 0,e().mark((function t(){var n,r,o;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Ue.get(Ve)!==Oe.open,this.canUsePatch&&!n){e.next=3;break}return e.abrupt("return",(qe.pluginWarn(n?"禁用patch包":"基础库版本过低,不支持使用patch包"),Promise.resolve(null)));case 3:return e.next=5,this.initConfigPromise;case 5:return e.next=7,this.fetchPatchPromise;case 7:return e.next=9,this.statPatchFile();case 9:if(e.sent){e.next=11;break}return e.abrupt("return",(qe.pluginWarn("[非报错可忽略]patch文件不存在"),Promise.resolve(null)));case 11:if(this.isPatchMatched()){e.next=13;break}return e.abrupt("return",(qe.pluginLog("[非报错可忽略]patch版本不匹配"),Promise.resolve(null)));case 13:return e.prev=13,qe.eventLog("开始编译patch"),je.timeStart("instantiatePatch"),e.next=17,WXWebAssembly.instantiate(this.patchPath,i);case 17:return r=e.sent,this.patchInstantiated=!0,o=je.timeEnd("instantiatePatch"),e.abrupt("return",(qe.eventLog("patch编译耗时: ",o,"ms"),_t.send(new Mt({ReportType:Ie.COMPILE_PATCH,CostTimeMs:o,RunTimeMs:je.getRuntime()})),this.modMemoryIndex(a),Promise.resolve(r)));case 23:return e.prev=23,e.t0=e.catch(13),e.abrupt("return",(qe.pluginWarn("[非报错可忽略]patch编译失败",e.t0),Dt.send(new Mt({ReportType:Ie.COMPILE_PATCH,ErrorMsg:"".concat(e.t0.errMsg||e.t0.message),RunTimeMs:je.getRuntime()})),je.timeEnd("instantiatePatch"),Promise.reject(e.t0)));case 26:case"end":return e.stop()}}),t,this,[[13,23]])})))).finally((function(){n=!0})),o=new Promise((function(e){setTimeout((function(){if(n)return e(null);qe.eventLog("长时间未完成下载/编译patch, 跳过patch能力"),e(null)}),1e4)})),t.abrupt("return",Promise.race([o,r]));case 5:case"end":return t.stop()}}),t)})))},this.checkNeedReportMissPatchFunc=function(e){var t;(null===(t=n.patchFuncIndexList)||void 0===t?void 0:t.length)&&n.patchInstantiated&&n.patchFuncIndexList.includes(e)&&(qe.pluginLog("miss patch func, index=",e),jn.reportMissFuncInPatch(e))};var i=!!C,a=null==C?void 0:C(),r=M.isIOS&&(0,x.yC)(M.systemInfo.version,"8.0.30")>=0,o=M.isAndroid&&(0,x.yC)(M.systemInfo.version,"8.0.27")>=0;i&&a&&(r||o)&&(this.supportPrivateFs=!0,this.patchBasePath="".concat(Te,"/__PATCH_DIR"),zi.setFs(a),this.fs=zi),this.patchConfigPath="".concat(this.patchBasePath,"/patchconfig.json"),this.brPatchPath="".concat(this.patchBasePath,"/patch.wasm.br"),this.defaultPatchPath="".concat(this.patchBasePath,"/patch.wasm"),this.redirIndexPath="".concat(this.patchBasePath,"/redirIndexList.json"),this.patchFuncIndexPath="".concat(this.patchBasePath,"/patchFuncIndexList.json"),this.fs.mkdir("",this.patchBasePath),qe.eventLog("使用".concat(this.supportPrivateFs?"私有":"公共","目录存储patch"))}return d(t,[{key:"updateCodeType",value:function(e){this.useCodeSplit=e,this.isNewRuntime=Z&&!!this.useCodeSplit,this.useCodeSplit&&this.checkNeedFetchPatch()}},{key:"isPatchMatched",value:function(){return this.subVersion===o.WASM_SPLIT_SUB_VERSION&&this.md5===o.CODE_FILE_MD5}},{key:"checkNeedFetchPatch",value:function(){return qi(this,void 0,void 0,e().mark((function t(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.initConfigPromise=this.initConfig(),e.next=3,this.initConfigPromise;case 3:n=e.sent,this.readPatchFuncIndexFile(),this.readRedirIndexFile(),qe.eventLog("本地".concat(n?"有patch, createTime=".concat(this.createTime):"无patch",", 拉取最新patch")),this.needFetchPatch=!0,this.fetchPatchPromise=this.fetchPatchFile();case 5:case"end":return e.stop()}}),t,this)})))}},{key:"initConfig",value:function(){return qi(this,void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.readConfig();case 2:return e.next=4,this.statPatchFile();case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),t,this)})))}},{key:"statPatchFile",value:function(){return qi(this,void 0,void 0,e().mark((function t(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fs.statAsyncCatch(this.isBr?this.brPatchPath:this.defaultPatchPath);case 2:return n=e.sent,e.abrupt("return",(qe.pluginLog("本地是否有patch文件=".concat(!!n,", isbrotli=").concat(this.isBr)),!!n));case 4:case"end":return e.stop()}}),t,this)})))}},{key:"readConfig",value:function(){return qi(this,void 0,void 0,e().mark((function t(){var n;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fs.readJson(this.patchConfigPath,!1);case 2:n=e.sent,qe.pluginLog("patch配置读取完毕",n),n&&(this.createTime=n.createTime,this.isBr=n.isBr,this.md5=n.md5,this.subVersion=n.subVersion,this.patchPath=this.isBr?this.brPatchPath:this.defaultPatchPath);case 4:case"end":return e.stop()}}),t,this)})))}},{key:"readRedirIndexFile",value:function(){var t;return qi(this,void 0,void 0,e().mark((function n(){var i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fs.readJson(this.redirIndexPath,!1);case 2:i=e.sent,qe.pluginLog("read redirModIndexList, has content=",!!i),i&&((null===(t=this.redirModIndexList)||void 0===t?void 0:t.length)||(this.redirModIndexList=i.redirModIndexList));case 4:case"end":return e.stop()}}),n,this)})))}},{key:"readPatchFuncIndexFile",value:function(){var t;return qi(this,void 0,void 0,e().mark((function n(){var i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fs.readJson(this.patchFuncIndexPath,!1);case 2:i=e.sent,qe.pluginLog("read patchFuncIndexList, has content=",!!i),i&&((null===(t=this.patchFuncIndexList)||void 0===t?void 0:t.length)||(this.patchFuncIndexList=i.patchFuncIndexList));case 4:case"end":return e.stop()}}),n,this)})))}},{key:"modMemoryIndex",value:function(e){var t,n;if((null===(t=this.redirModIndexList)||void 0===t?void 0:t.length)&&e){qe.eventLog("mod memory index, lenght=",null===(n=this.redirModIndexList)||void 0===n?void 0:n.length,", ptr=",null==o?void 0:o.getRedirBasePtr);var i=Number(null==o?void 0:o.getRedirBasePtr)||0,a=new Int32Array(e.buffer);this.redirModIndexList.forEach((function(e){a[e+i]|=268435456}))}}},{key:"fetchPatchFile",value:function(){return qi(this,void 0,void 0,e().mark((function t(){var i=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Hi.env.isMiniGamePlugin){e.next=2;break}return e.abrupt("return",(qe.pluginLog("非插件模式不拉取patch"),Promise.resolve(!1)));case 2:return e.abrupt("return",Ue.get(Ve)!==Oe.open?(qe.pluginLog("已禁用patch, 不拉取最新patch"),Promise.resolve(!1)):new Promise((function(e){je.timeStart("fetchwasmpatch"),Hi.network.gameTransfer({url:"gamewxagwasmsplit_getwasmpatch",data:{meta_info:{md5:o.CODE_FILE_MD5,sub_version:o.WASM_SPLIT_SUB_VERSION},is_ios_new_runtime:Boolean(i.isNewRuntime),last_patch_create_time:i.createTime}}).then((function(t){var a=n(t,1)[0];i.patchFetched=!0,qe.eventLog("gamewxagwasmsplit_getwasmpatch success, 有无更新: ".concat(!!a.buffer)),a.buffer?(i.savePatchPackageInfo(a),i.savePatchFile(a).then(e)):e(!1)})).catch((function(t){qe.pluginWarn("[不影响游戏可忽略]拉取patch更新失败: ",t),Dt.send(new Mt({ReportType:Ie.DOWNLOAD_PATCH,ErrorMsg:"".concat(t.errMsg||t.message),RunTimeMs:je.getRuntime()})),e(!1)}))})));case 3:case"end":return e.stop()}}),t)})))}},{key:"savePatchPackageInfo",value:function(e){var t=e.redir_mod_index_list,n=e.patch_func_index_list;(null==t?void 0:t.length)&&(qe.eventLog("has new redirModIndexList"),this.redirModIndexList=e.redir_mod_index_list,this.fs.writeJson(this.redirIndexPath,{redirModIndexList:this.redirModIndexList})),(null==n?void 0:n.length)&&(qe.eventLog("has new patchFuncIndexList"),this.patchFuncIndexList=n,this.fs.writeJson(this.patchFuncIndexPath,{patchFuncIndexList:n}))}},{key:"savePatchFile",value:function(e){var t=this;this.isBr=!!e.is_br;var n=function(e,t){for(var n,i,a,r=e.replace(/[^A-Za-z0-9+/]/g,""),o=r.length,s=1*Math.ceil((3*o+1>>>2)/1),u=new Uint8Array(s),c=0,l=0,d=0;d<o;d++)if(i=3&d,c|=((a=r.charCodeAt(d))>64&&a<91?a-65:a>96&&a<123?a-71:a>47&&a<58?a+4:43===a?62:47===a?63:0)<<18-6*i,3===i||o-d==1){for(n=0;n<3&&l<s;n++,l++)u[l]=c>>>(16>>>n&24)&255;c=0}return u}(e.buffer).buffer;return this.patchPath=this.isBr?this.brPatchPath:this.defaultPatchPath,qe.eventLog("最新patch大小: ".concat(n.byteLength,"byte, createTime=").concat(e.create_time,", isbrotli=").concat(this.isBr,", fetchcost=").concat(je.timeEnd("fetchwasmpatch"))),je.timeStart("writePatch"),this.fs.writeFile(this.patchPath,n).then((function(){return t.subVersion=o.WASM_SPLIT_SUB_VERSION,t.md5=o.CODE_FILE_MD5,qe.eventLog("patch包缓存成功"),_t.send(new Mt({ReportType:Ie.WRITE_PATCH,CostTimeMs:je.timeEnd("writePatch"),RunTimeMs:je.getRuntime()})),t.fs.writeJson(t.patchConfigPath,{createTime:e.create_time,isBr:t.isBr,md5:o.CODE_FILE_MD5,subVersion:o.WASM_SPLIT_SUB_VERSION}),!0})).catch((function(e){return qe.pluginWarn("[不影响游戏可忽略]patch包缓存失败: ",e),je.timeEnd("writePatch"),Dt.send(new Mt({ReportType:Ie.WRITE_PATCH,RunTimeMs:je.getRuntime(),ErrorMsg:"".concat(e.errMsg||e.message)})),!1}))}}],[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}}]),t}().getInstance();!function(e){e[e.FETCH_SNAPSHOT=70]="FETCH_SNAPSHOT",e[e.RESTORE_SNAPSHOT=71]="RESTORE_SNAPSHOT"}(Gi||(Gi={}));var Qi=function(e){u(n,e);var t=c(n);function n(){return l(this,n),t.apply(this,arguments)}return d(n,[{key:"fetchSnapshot",value:function(e){this.baseReporter(Gi.FETCH_SNAPSHOT,e)}},{key:"restoreSnapshot",value:function(e){this.baseReporter(Gi.RESTORE_SNAPSHOT,e)}},{key:"baseReporter",value:function(e,t){var n=new Mt({ReportType:e,RunTimeMs:je.getRuntime()});(0,x.o8)(t)||(n.CostTimeMs=t),_t.send(n)}},{key:"bindFunction",value:function(){this.unityManager.reporter.snapshot={fetchSnapshot:this.fetchSnapshot.bind(this),restoreSnapshot:this.restoreSnapshot.bind(this)}}}]),n}(Un).getInstance(),Ji="/System/Library/Fonts/LanguageSupport",Xi=function(){function e(){l(this,e),this.needReport=void 0,this.reportInfo={}}return d(e,[{key:"init",value:function(e){this.bindInterface(e)}},{key:"bindInterface",value:function(e){e.font=e.font||{},oe&&w&&Ue.get("wxfont")===Oe.open?(e.font.getCommonFont=this.getCommonFont.bind(this),e.font.canUseWxFont=!0):e.font.canUseWxFont=!1,e.font.reportGetFontCost=this.reportGetFontCost.bind(this)}},{key:"getCommonFont",value:function(e,t){var n=this,i=e.success,a=e.fail;je.timeStart("getSystemFontList"),w({path:M.isAndroid?"/system/fonts":Ji,success:function(e){var r=je.timeEnd("getSystemFontList");qe.pluginLog("[font]扫描字体列表耗时=".concat(r,"ms"));var o=M.isAndroid?"NotoSansCJK-Regular":"PingFang",s=e.data.find((function(e){return e.includes(o)}));if(s){var u=M.isIOS?t||[[19968,40959],[0,127],[12288,12351],[8192,8303],[12800,13055],[65040,65055],[65072,65103],[9728,9983],[13056,13311],[65280,65519],[9984,10175],[8448,8527],[9312,9471],[8528,8591],[8352,8399],[8592,8703],[9632,9727],[8704,8959]]:void 0,c=M.isAndroid?s:nn(Ji,s);je.timeStart("getSystemFontData"),w({path:c,subset:u,success:function(e){var t=e.data;if(t){var o=je.timeEnd("getSystemFontData");qe.pluginLog("[font]读取字体文件耗时=".concat(o,"ms, 字体大小=").concat((t.byteLength/1024/1024).toFixed(2),"MB")),i(t),n.reportFontUsage({scanDirCost:r,readFontDataCost:o,byteLength:t.byteLength})}else{je.timeEnd("getSystemFontData"),qe.pluginLog("[font]无字体文件内容");var s="empty font file";n.reportFontError({errMsg:s}),a({errmsg:s})}},fail:function(e){je.timeEnd("getSystemFontData"),n.reportFontError(e),a(e)}})}else{qe.pluginLog("[font]无中文字体");var l="no support font";n.reportFontError({errMsg:l}),a({errmsg:l})}},fail:function(e){je.timeEnd("getSystemFontList"),this.reportFontError(e),a(e)}})}},{key:"reportFontUsage",value:function(e){var t=e.scanDirCost,n=e.readFontDataCost,i=e.byteLength;this.needReport=!J||J&&Math.random()<.2,this.needReport&&(this.reportInfo={scanDirCost:t,readFontDataCost:n,byteLength:i})}},{key:"reportFontError",value:function(e){var t=e.errMsg;Dt.send(new Mt({ReportType:be.FONT,ErrorMsg:t,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({system:N.system})}))}},{key:"reportGetFontCost",value:function(e,t){void 0===this.needReport&&(this.needReport=!J||J&&Math.random()<.2),this.needReport&&(_t.send(new Mt({ReportType:be.FONT,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify(Object.assign(Object.assign({},this.reportInfo),{invokePendingCost:e,loadFromRemote:t.loadFromRemote,isReadFromCache:t.isReadFromCache,preload:t.preloadWXFont}))})),this.reportInfo=null)}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e}(),Zi=p(4293).default,Yi=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))};function $i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Yi(this,void 0,void 0,e().mark((function i(){var a;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return je.timeStart("refreshToken"),a={auth_payload:{md5:o.CODE_FILE_MD5,sub_version:o.WASM_SPLIT_SUB_VERSION}},e.abrupt("return",(t&&(a.last_token=t),Zi.network.gameTransfer({url:"unity.refreshcontexttoken",flat:!0,data:a}).then((function(e){var t,i=n(e,1)[0];if(qe.pluginLog("[auth] refresh token cost=".concat(je.timeEnd("refreshToken"),"ms")),null===(t=null==i?void 0:i.rsp_list)||void 0===t?void 0:t.length){var a=(i.rsp_list.find((function(e){return"auth_token"===e.key}))||{}).value;if(a)return Promise.resolve(a)}return Promise.reject({errmsg:"system error"})})).catch((function(e){return Promise.reject(e)}))));case 3:case"end":return e.stop()}}),i)})))}var ea=function(t){u(a,t);var i=c(a);function a(){var e;return l(this,a),(e=i.apply(this,arguments)).token="",e.skipAuth=!1,e.useWasmSplit=!1,e}return d(a,[{key:"init",value:function(e){this.useWasmSplit=e.codeType===Le.codeSplit,this.bindInterface(e),this.autoRefreshToken()}},{key:"autoRefreshToken",value:function(){var e=this;if(!M.isWK||!this.useWasmSplit)return this.refreshTokenPromise=Promise.resolve(""),void(this.skipAuth=!0);setTimeout((function(){e.autoRefreshToken()}),24e5),this.refreshTokenPromise=this.getAuthToken()}},{key:"getAuthToken",value:function(){return function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))}(this,void 0,void 0,e().mark((function t(){var i,a,r,o;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return je.timeStart("refreshToken"),e.next=3,(0,x.zI)((0,x.gj)($i,1,1,this.token));case 3:return i=e.sent,a=n(i,2),r=a[0],o=a[1],e.abrupt("return",(r?(qe.pluginError("获取authtoken失败, err=",r),this.skipAuth=!0,qe.eventLog("跳过鉴权"),Dt.send(new Mt({ReportType:Ie.REFRESH_TOKEN,CostTimeMs:je.timeEnd("refreshToken"),ErrorMsg:(null==r?void 0:r.message)||(null==r?void 0:r.errmsg)||r}))):(this.skipAuth=!1,this.token=o,qe.pluginLog("获取token成功, token=",this.token),_t.send(new Mt({ReportType:Ie.REFRESH_TOKEN,CostTimeMs:je.timeEnd("refreshToken"),ExternInfo:JSON.stringify({token:this.token})}))),this.token));case 8:case"end":return e.stop()}}),t,this)})))}},{key:"bindInterface",value:function(e){e.wasmsplit=e.wasmsplit||{},e.wasmsplit.innerInvokeWasmFunc=this.innerInvokeWasmFunc.bind(this),e.wasmsplit.instantiatePatch=Ki.instantiatePatch,e.wasmsplit.checkNeedReportMissPatchFunc=Ki.checkNeedReportMissPatchFunc,e.wasmsplit.innerInvokeWasmBuffer=this.innerInvokeWasmBuffer.bind(this),e.instantiatePatch=Ki.instantiatePatch}},{key:"innerInvokeWasmFunc",value:function(e){var t=e.name,n=e.invokeWasmFunc,i=e.fail,a={md5:JSON.stringify({md5:o.CODE_FILE_MD5,auth_token:encodeURIComponent(this.token)}),subVersion:o.WASM_SPLIT_SUB_VERSION,funcName:t,fail:i};this.skipAuth&&(a.md5=o.CODE_FILE_MD5),n(a)}},{key:"innerInvokeWasmBuffer",value:function(e){var t=e.invokeWasmBuffer,n=e.funcName,i=e.importObj,a=e.success,r=e.fail;try{t({md5:JSON.stringify({md5:o.CODE_FILE_MD5,auth_token:encodeURIComponent(this.token)}),useBuffer:!0,subVersion:o.WASM_SPLIT_SUB_VERSION,apiVersion:o.WASM_SPLIT_API_VERSION,funcName:n,importObj:i,success:function(e){try{var t=e.res,n=e.wasmInstance;if(0!==t.errcode)return qe.pluginError("invokeWasmBuffer, errcode=",t.errcode),void(null==r||r(t.errcode));var s=new Int8Array(i.primary.memory.buffer),u=o.getRedirBasePtr||0,c=t.data.table_index;(null==c?void 0:c.length)&&c.forEach((function(e){s[u+e]=1})),null==a||a(n)}catch(e){qe.pluginError("invokeWasmBuffer modify memory error=",e),null==r||r(e)}},fail:function(e){qe.pluginError("invokeWasmBuffer fail, ",e),null==r||r(e)}})}catch(t){qe.pluginError("invokeWasmBuffer, ",t),r(t.message)}}}]),a}(de).getInstance(),ta=function(e){u(n,e);var t=c(n);function n(){return l(this,n),t.apply(this,arguments)}return d(n,[{key:"malloc",value:function(e){if((0,x.xb)(e))return qe.pluginError("[malloc report]: invalid params");var t=new Mt({ReportType:Re.Malloc,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify(e)});Dt.send(t)}},{key:"bindFunction",value:function(){this.unityManager.reporter.alarm={malloc:this.malloc.bind(this)}}}]),n}(Un).getInstance(),na=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},ia=function(t){u(i,t);var n=c(i);function i(){var e;return l(this,i),(e=n.apply(this,arguments)).assetsLoadType=pe.DownloadAll,e}return d(i,[{key:"init",value:function(e){this.unityManager=e,this.initConfig()}},{key:"getAssetsLoadText",value:function(){return Ae[this.assetsLoadType]}},{key:"needDownload",get:function(){return this.assetsLoadType!==pe.AllCached}},{key:"initAssetsLoadType",value:function(){return na(this,void 0,void 0,e().mark((function t(){var n,i,a;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAssetsMd5();case 2:n=e.sent,i=n.wasmCached,a=n.dataPackageCached,i&&a?this.assetsLoadType=pe.AllCached:i||a?i&&!a?this.assetsLoadType=pe.DownloadDataPackage:!i&&a&&(this.assetsLoadType=pe.DownloadWasmCode):this.assetsLoadType=pe.DownloadAll;case 6:case"end":return e.stop()}}),t,this)})))}},{key:"initConfig",value:function(){return na(this,void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.initAssetsLoadType();case 1:case"end":return e.stop()}}),t,this)})))}},{key:"getAssetsMd5",value:function(){return na(this,void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){e({wasmCached:Rn.checkFileExist(un(Hn.filename)),dataPackageCached:Rn.checkFileExist(un(Kn.cachePath))})})));case 1:case"end":return e.stop()}}),t)})))}}]),i}(de).getInstance(),aa=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.apply(this,arguments)).unityFsInited=!1,e.runDependencies=0,e.denpendencyIds=[],e.onAbort=function(t){var n,i=e.gameInstance.Module,a="abort(".concat(t,") at ").concat((null===(n=null==t?void 0:t.stack)||void 0===n?void 0:n.toString)?t.stack.toString():i.stackTrace());Dt.send(new Mt({ReportType:Pt()||we.ON_ABORT,ErrorMsg:"".concat(a).slice(0,1024),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({isAbort:!0})})),ue.warn(a)},e.wasmInstantiated=function(){var t,n=s(e).unityManager;Ze.triggerEvent(He.WasmInstantiated,Ye($e,n)),n.launchStage.setProgress(ke.COMPILE_WASM,{status:On.FULFILLED}),n.launchStage.setProgress(ke.PREPARE_GAME,{status:On.PENDING}),n.loadingPageType===he.COVER_VIEW&&n.loadingPage.completeCompileAnimation(),je.printTime("wasm编译耗时"),n.triggerLaunchProgress(ke.COMPILE_WASM,je.timeEnd("wasm编译耗时",!1)),_t.send(new Mt({ReportType:ke.COMPILE_WASM,CostTimeMs:je.timeEnd("wasm编译耗时"),RunTimeMs:je.getRuntime()}));var i=Ra.getInstance();i&&i.wasmInited&&"function"==typeof i.wasmInited&&i.wasmInited(),n.codeType!==Le.codeSplit||!ie&&Ue.get(We)===Oe.open||(e.gameInstance.Module.addRunDependency("subWasmInstantiated"),null===(t=null==n?void 0:n.parallelFetchSubWasmTask)||void 0===t||t.then((function(){var t,n;null===(n=null===(t=null==o?void 0:o.compileSubWasm)||void 0===t?void 0:t.call(o))||void 0===n||n.then((function(){e.gameInstance.Module.removeRunDependency("subWasmInstantiated")}))})))},e.calledMainCb=function(){var t=s(e).unityManager;mi.setConcurrent(1),si.preloadMonitor.genResultAfterCallmain(),si.showResultAfterDuration(),t.mainCalled=!0,Ze.triggerEvent(He.CalledMain,Ye($e,t)),je.printTime("callMain耗时"),je.printRuntime("游戏启动耗时"),je.timeStart("游戏主场景耗时"),t.triggerLaunchProgress(ke.PREPARE_GAME,je.timeEnd("callMain耗时",!1)),si.commonMonitor.recordCallmain({duration:je.timeEnd("callMain耗时",!1),launchTime:je.getRuntime()}),_t.send(new Mt({ReportType:ke.PREPARE_GAME,CostTimeMs:je.timeEnd("callMain耗时"),RunTimeMs:je.getRuntime(),PreloadedSize:mi.loadedSize||0})),qe.pluginLog("callMain完成时已预载资源大小: ",mi.loadedSize),t.launchStage.setProgress(ke.PREPARE_GAME,{status:On.FULFILLED}),t.loadingPageType===he.LONG_VIDEO?(t.hideLoadingPage(),o.Browser&&(qe.pluginLog("是默认启动页,callMain完成开始游戏主循环"),o.Browser.mainLoop.resume())):t.loadingPageType===he.INTERACTIVE_VIDEO?(qe.pluginLog("是可交互视频启动页,重新创建渲染器"),Nn.getRenderer().refresh(),o.isInteractiveEnd&&(qe.pluginLog("callmain结束时已完成可交互阶段,直接显示游戏画面"),t.hideFinalPage())):t.loadingPageType===he.COVER_VIEW&&(t.hideAfterCallmain&&t.hideLoadingPage(),o.Browser&&o.Browser.mainLoop.resume()),Kn.releaseDataPackage(),M.isWK||setTimeout((function(){var e;null===(e=null==o?void 0:o.compileSubWasm)||void 0===e||e.call(o)}),3e4),J||setTimeout((function(){t.gameStarted||qe.pluginError("[开发阶段提示 不影响线上版本]请使用自定义上报能力 WX.ReportGameStart, 便于分析数据做启动优化, 文档: \nhttps://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/ReportStartupStat.md")}),6e4)},e.unityFileSystemInit=function(){var t=e.gameInstance.Module;t.indexedDB||qe.pluginWarn("IndexedDB is not available. Data will not persist in cache and PlayerPrefs will not be saved."),o.FS.mkdir("/idbfs"),o.FS.mount(o.IDBFS,{},"/idbfs"),e.unityFsInited=!0,t.rawData&&t.processRawData()},e.printErr=function(t){var n=s(e).unityManager,i="string"==typeof t?t:t.message;!n.gameStarted&&je.getRuntime()<6e4&&(at(t)||Dt.send(new Mt({ReportType:Pt()||Ra.getCurrentStage(!0),ErrorMsg:"".concat(i).slice(0,1024),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({mainCalled:n.mainCalled})}))),(null==n?void 0:n.onLogError)&&n.onLogError(i),console.error(t)},e.monitorRunDependencies=function(t,n){n&&(t<e.runDependencies?e.denpendencyIds=e.denpendencyIds.filter((function(e){return e!==n})):e.denpendencyIds.push(n)),e.runDependencies=t,0===e.runDependencies&&qe.eventLog("no dependencies, invoke run")},e}return d(n,[{key:"init",value:function(e){this.unityManager=e,this.initInstance(),this.checkDependenciesRemoved(),e.printErr=this.printErr.bind(this)}},{key:"checkDependenciesRemoved",value:function(){var e=this;setTimeout((function(){0!==e.runDependencies&&(qe.pluginError("still waiting runDependencies, ids=",e.denpendencyIds),Dt.send(new Mt({ReportType:we.WaitingRemoveDependencies,ExternInfo:JSON.stringify({runDependencies:e.runDependencies,denpendencyIds:e.denpendencyIds})})))}),3e4)}},{key:"initInstance",value:function(){var e=this;this.gameInstance={onProgress:void 0,compatibilityCheck:void 0,Module:{IsWxGame:!0,preLoadDataPath:Kn.downloadFilename,wasmPath:Hn.wasmPath,graphicsAPI:["WebGL 2.0","WebGL 1.0"],instantiateWasm:o.instantiateWasm,onAbort:this.onAbort.bind(this),monitorRunDependencies:this.monitorRunDependencies.bind(this),wasmInstantiated:this.wasmInstantiated.bind(this),onRuntimeInitialized:function(){},calledMainCb:this.calledMainCb.bind(this),unityFileSystemInit:this.unityFileSystemInit.bind(this),tuanjieFileSystemInit:this.unityFileSystemInit.bind(this),processRawData:Kn.processRawData,preRun:[],postRun:[],print:function(e){console.log(e)},printErr:this.printErr.bind(this),Jobs:{},canvas:h,buildDownloadProgress:{},resolveBuildUrl:pn,streamingAssetsUrl:function(){return pn("StreamingAssets")},pthreadMainPrefixURL:"Build/",webglContextAttributes:{premultipliedAlpha:1,preserveDrawingBuffer:1}},SetFullscreen:function(){for(var t,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];if(e.gameInstance.Module.SetFullscreen)return(t=e.gameInstance.Module.SetFullscreen).apply.apply(t,[e.gameInstance.Module].concat(i))},SendMessage:function(){for(var t,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];if(e.gameInstance.Module.SendMessage)return(t=e.gameInstance.Module.SendMessage).apply.apply(t,[e.gameInstance.Module].concat(i))}},this.unityManager.gameInstance=this.gameInstance}}]),n}(de).getInstance(),ra=function(e){u(n,e);var t=c(n);function n(){return l(this,n),t.apply(this,arguments)}return d(n,[{key:"reportEmptyContent",value:function(e){if((0,x.xb)(e))return qe.pluginError("[wxAssetBundle report]: invalid params");var t=new Mt({ReportType:we.WxABReadEmptyContent,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify(e)});Dt.send(t)}},{key:"bindFunction",value:function(){this.unityManager.reporter.wxAssetBundle={reportEmptyContent:this.reportEmptyContent.bind(this)}}}]),n}(Un).getInstance(),oa=p(4293).default,sa=[],ua=[],ca=function(e){u(n,e);var t=c(n);function n(e,i){var a,r,o;return l(this,n),(a=t.call(this)).id=(0,x.hQ)(10,!0),a.GLctx=i,ua.length>0?(sa[a.id]=ua.pop(),sa[a.id].src=e):(sa[a.id]=null===(o=(r=oa.env.pluginEnv).createWKVideo)||void 0===o?void 0:o.call(r),sa[a.id].style.display="none",sa[a.id].muted=!0,sa[a.id].setAttribute("muted",""),sa[a.id].setAttribute("playsinline",""),sa[a.id].crossOrigin="anonymous",sa[a.id].onseeked=function(){a.emit("seek")},sa[a.id].oncanplay=function(){a.emit("canplay")},sa[a.id].onerror=function(e){var t,n,i;"string"==typeof e?a.emit("error",e):a.emit("error",null!==(i=null===(n=null===(t=e.target)||void 0===t?void 0:t.error)||void 0===n?void 0:n.code)&&void 0!==i?i:"")},sa[a.id].onended=function(e){a.emit("ended",e)},sa[a.id].src=e),sa[a.id]||console.error("创建失败,基础库不支持或尚未初始化完"),a}return d(n,[{key:"render",value:function(){if(this.GLctx&&sa[this.id]){var e=this.GLctx.RGBA,t=this.GLctx.RGBA;this.GLctx.texImage2D(this.GLctx.TEXTURE_2D,0,e,t,this.GLctx.UNSIGNED_BYTE,sa[this.id])}}},{key:"seek",value:function(e){this.lastSeenPlaybackTime=e,sa[this.id]&&(sa[this.id].currentTime=e)}},{key:"play",value:function(){var e;return null===(e=sa[this.id])||void 0===e?void 0:e.play()}},{key:"pause",value:function(){var e;return null===(e=sa[this.id])||void 0===e?void 0:e.pause()}},{key:"isReady",get:function(){return!!sa[this.id]&&(!this.ready&&sa[this.id].readyState>=sa[this.id].HAVE_METADATA&&(this.ready=!0),!!this.ready)}},{key:"isPlaying",get:function(){return!!sa[this.id]&&this.isReady&&!sa[this.id].paused&&!sa[this.id].ended}},{key:"videoWidth",get:function(){var e,t;return null!==(t=null===(e=sa[this.id])||void 0===e?void 0:e.videoWidth)&&void 0!==t?t:0}},{key:"videoHeight",get:function(){var e,t;return null!==(t=null===(e=sa[this.id])||void 0===e?void 0:e.videoHeight)&&void 0!==t?t:0}},{key:"duration",get:function(){var e,t;return null!==(t=null===(e=sa[this.id])||void 0===e?void 0:e.duration)&&void 0!==t?t:0}},{key:"seeking",get:function(){var e;return null===(e=sa[this.id])||void 0===e?void 0:e.seeking}},{key:"currentTime",get:function(){var e,t;return null!==(t=null===(e=sa[this.id])||void 0===e?void 0:e.currentTime)&&void 0!==t?t:0}},{key:"volume",set:function(e){sa[this.id]&&(sa[this.id].volume=e)}},{key:"playbackRate",get:function(){return sa[this.id].playbackRate},set:function(e){sa[this.id]&&(sa[this.id].playbackRate=e)}},{key:"muted",set:function(e){sa[this.id]&&(sa[this.id].muted=e)}},{key:"loop",get:function(){var e,t;return null!==(t=null===(e=sa[this.id])||void 0===e?void 0:e.loop)&&void 0!==t&&t},set:function(e){sa[this.id]&&(sa[this.id].loop=e)}},{key:"onended",set:function(e){sa[this.id]&&(this.off("ended"),e&&this.on("ended",e))}},{key:"destroy",value:function(){this.loopEndPollInterval&&clearInterval(this.loopEndPollInterval),delete this.onendedCallback,sa[this.id]&&(sa[this.id].onended=null,sa[this.id].onerror=null,sa[this.id].oncanplay=null,sa[this.id].onseeked=null,sa[this.id].removeAttribute("src"),sa[this.id].load(),ua.push(sa[this.id])),sa[this.id]=null,delete sa[this.id]}}]),n}(Qe()),la=function(e){u(n,e);var t=c(n);function n(){return l(this,n),t.apply(this,arguments)}return d(n,[{key:"init",value:function(e){e.createWKVideo=function(e,t){return new ca(e,t)}}}]),n}(de),da=p(8353),ha=p(4936),fa=p.n(ha),pa=p(6486),ma=p.n(pa),ga=p(4469),va=p(8792),ya=p(820),Ta=p(4293).default,Sa=i(i(i(i({},va.ReportStatusType.start,ke.LAUNCH_OPERA_FRAME_START),va.ReportStatusType.end,ke.LAUNCH_OPERA_FRAME_END),va.ReportStatusType.checkPoint,ke.LAUNCH_OPERA_FRAME_CHECKPOINT),va.ReportStatusType.checkPointCount,ke.LAUNCH_OPERA_FRAME_CHECKPOINT_COUNT),Pa=function(e){u(n,e);var t=c(n);function n(){var e;return l(this,n),(e=t.call(this)).autoUploadLoggerHandler=null,e.loggerQueue=[],e.loggerId=0,e.registerSysReportEvent(),r.onHide(e.onHide.bind(s(e))),e}return d(n,[{key:"destory",value:function(){this.upload(),r.offHide(this.onHide.bind(this))}},{key:"onHide",value:function(){this.upload()}},{key:"registerSysReportEvent",value:function(){var e=this;da.Report.eventEmitter.registerEvent(this,(function(t){switch(t){case ga.ReportCaseType.sys:var i=arguments.length<=1?void 0:arguments[1];if("0"!==i.id&&i.status!==va.ReportStatusType.checkPoint&&(!i.event||-1===n.watchEvents.indexOf(i.event)))return;_t.send(new Mt({ReportType:Sa[i.status],ExternInfo:JSON.stringify({hash:e.hash,id:i.id,time:e.calCostTime(),event:i.event||"-"})}));break;case ga.ReportCaseType.err:var a=arguments.length<=1?void 0:arguments[1];Dt.send(new Mt({ReportType:ke.LAUNCH_OPERA_FRAME_START,ErrorMsg:JSON.stringify(a.errinfo),RunTimeMs:e.calCostTime()}));break;case ga.ReportCaseType.logger:e.pushLoggerMsg(arguments.length<=1?void 0:arguments[1])}}))}},{key:"pushLoggerMsg",value:function(e){var t=this;this.loggerQueue.push(e),this.throttle((function(){t.upload()}))}},{key:"throttle",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3;this.autoUploadLoggerHandler&&(this.autoUploadLoggerHandler=setTimeout((function(){t.autoUploadLoggerHandler=null,e()}),n))}},{key:"upload",value:function(){this.autoUploadLoggerHandler&&(clearTimeout(this.autoUploadLoggerHandler),this.autoUploadLoggerHandler=null);var e=JSON.stringify(this.loggerQueue);this.loggerQueue=[],Ta.quality.report({Type:ya.jJ.Info,Target:"lac-op",ExternInfo:e,Result:String(this.loggerId),CustomKey1:this.hash}),this.loggerId+=1}}]),n}(da.Report);Pa.watchEvents=["onClick"];var ka=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},Ea=function(){function t(){var e=this;l(this,t),this.viewer=null,this.logger=null,this.director=null,this.isRunning=!1,this.configInfo={playPath:"",decompress:"br",progressStyle:{},useCustomProgress:!1},this.levels=[],this.progressAnimaitonStatus={running:!1,toStop:!1,callback:null},this.customProgressValue=0,this.wasmReady=!1,this.pushMsgQueue=[],I&&(this.director=new da.Director(ma()),I.emit(ze.launchOperaInit,this),this.configInfo.playPath?this.init():this.destory(),I.on(ze.compileWasm,(function(){e.levels.push(ze.compileWasm),e.refreshProgress()})),I.on(ze.readAssets,(function(){e.levels.push(ze.readAssets),e.refreshProgress()})),I.on(ze.prepareGame,(function(){for(;e.levels.length<3;)e.levels.push(ze.prepareGame);e.refreshProgress()})),I.on(ze.launchOperaMsgBridgeFromWasm,(function(t){return e.parseWasmMsg(t)})),this.refreshProgress())}return d(t,[{key:"used",get:function(){var e;return!!(null===(e=this.configInfo)||void 0===e?void 0:e.playPath)}},{key:"running",get:function(){return this.isRunning}},{key:"config",get:function(){return this.configInfo},set:function(e){var t=this,n=Object.keys(this.configInfo);Object.keys(e).forEach((function(i){-1!==n.indexOf(i)&&(t.config[i]=e[i])}))}},{key:"onEnd",value:function(e){var t;return null===(t=this.director)||void 0===t?void 0:t.onEnd(e)}},{key:"onErr",value:function(e){var t;return null===(t=this.director)||void 0===t?void 0:t.onErr(e)}},{key:"offErr",value:function(e){var t;return null===(t=this.director)||void 0===t?void 0:t.offErr(e)}},{key:"end",value:function(){var e;return null===(e=this.director)||void 0===e?void 0:e.end()}},{key:"setGlobalVar",value:function(e,t){var n;return null===(n=this.director)||void 0===n?void 0:n.setGlobalVar(e,t)}},{key:"getGlobalVar",value:function(e){var t;return(null===(t=this.director)||void 0===t?void 0:t.getGlobalVar(e))||null}},{key:"onGlobalVarChange",value:function(e,t){var n;return null===(n=this.director)||void 0===n?void 0:n.onGlobalVarChange(e,t)}},{key:"offGlobalVarChange",value:function(e,t){var n;return null===(n=this.director)||void 0===n?void 0:n.offGlobalVarChange(e,t)}},{key:"onWeakNetwork",value:function(e){var t;return null===(t=this.director)||void 0===t?void 0:t.onWeakNetwork(e)}},{key:"offWeakNetwork",value:function(e){var t;return null===(t=this.director)||void 0===t?void 0:t.offWeakNetwork(e)}},{key:"isPlayStoryLine",value:function(e){return!!e}},{key:"setAudioMute",value:function(e){(null==R?void 0:R.WXSetAudioMute)&&R.WXSetAudioMute(!!e)}},{key:"customProgress",set:function(e){this.configInfo.useCustomProgress&&(this.customProgressValue=Math.min(Math.max(e,0),1),3===this.levels.length&&this.setPercentage(70+30*this.customProgressValue))}},{key:"refreshProgress",value:function(){var e=this;if(this.isRunning){if(0===this.levels.length&&this.progressToValueWithAnimation(1,1).then((function(){e.progressCacheAnimation(11)})).catch((function(){})),1===this.levels.length){if(this.levels[0]===ze.compileWasm)return void this.progressToValueWithAnimation(15,400).then((function(){e.progressCacheAnimation(25)})).catch((function(){}));if(this.levels[0]===ze.readAssets)return void this.progressToValueWithAnimation(25,400).then((function(){e.progressCacheAnimation(35)})).catch((function(){}))}if(2===this.levels.length){if(this.levels[1]===ze.compileWasm)return void this.progressToValueWithAnimation(50,400).then((function(){e.progressCacheAnimation(60)})).catch((function(){}));if(this.levels[1]===ze.readAssets)return void this.progressToValueWithAnimation(35,400).then((function(){e.progressCacheAnimation(45)})).catch((function(){}))}3===this.levels.length&&this.progressToValueWithAnimation(70,400).then((function(){e.configInfo.useCustomProgress?e.customProgress=e.customProgressValue:e.progressToValueWithAnimation(100,800).then((function(){})).catch((function(){}))})).catch((function(){}))}}},{key:"cancelProgressAnimation",value:function(){var e=this;return new Promise((function(t){e.progressAnimaitonStatus.running?(e.progressAnimaitonStatus.toStop=!0,e.progressAnimaitonStatus.callback=function(){t(!0)}):t(!0)}))}},{key:"progressToValueWithAnimation",value:function(t,n){return ka(this,void 0,void 0,e().mark((function i(){var a,r,o,s;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this.getPercentage(),!(t<a)){e.next=3;break}return e.abrupt("return",!0);case 3:return e.next=5,this.cancelProgressAnimation();case 5:this.progressAnimaitonStatus.running=!0,this.progressAnimaitonStatus.toStop=!1,r=Math.floor(n/25),o=(t-a)/r,s=0;case 9:if(!(s<r)||this.progressAnimaitonStatus.toStop){e.next=16;break}return this.setPercentage(a+s*o),e.next=13,this.delay(25);case 13:s++,e.next=9;break;case 16:return e.abrupt("return",(this.progressAnimaitonStatus.running=!1,!this.progressAnimaitonStatus.callback||(this.progressAnimaitonStatus.callback(),this.progressAnimaitonStatus.callback=null,!1)));case 17:case"end":return e.stop()}}),i,this)})))}},{key:"delay",value:function(e){return new Promise((function(t){setTimeout((function(){t(!0)}),e)}))}},{key:"progressCacheAnimation",value:function(e){this.progressToValueWithAnimation(e,3e3).then((function(){}))}},{key:"setPercentage",value:function(e){var t;(null===(t=this.director)||void 0===t?void 0:t.progress)&&(this.director.progress.percentage=e)}},{key:"getPercentage",value:function(){var e;return(null===(e=this.director)||void 0===e?void 0:e.progress.percentage)||0}},{key:"pushMsg",value:function(e,t){this.wasmReady?I.emit(ze.launchOperaPushMsgToWasm,e,t):this.pushMsgQueue.push({callback:e,args:t})}},{key:"parseWasmMsg",value:function(e){var t=JSON.parse(e);if(t.function)switch(t.function){case"WXLaunchOperaReady":return this.wasmReady=!0,this.pushMsgQueue.forEach((function(e){I.emit(ze.launchOperaPushMsgToWasm,e.callback,e.args)})),this.pushMsgQueue=[],this.responseWasmMsg("ok");case"getRunning":return this.responseWasmMsg(this.running);case"setPercentage":return this.customProgress=t.args[0],this.responseWasmMsg(null);case"end":return this.responseWasmMsg(this.end());case"setGlobalVar":return this.responseWasmMsg(this.setGlobalVar(t.args[0],t.args[1]));case"getGlobalVar":return this.responseWasmMsg(this.getGlobalVar(t.args[0]));case"isPlayStoryLine":return this.responseWasmMsg(this.isPlayStoryLine(t.args[0]));default:return}}},{key:"responseWasmMsg",value:function(e){if(e)return JSON.stringify({response:e})}},{key:"destory",value:function(){this.director=null,this.viewer=null,this.logger=null}},{key:"init",value:function(){var t,n,i;return ka(this,void 0,void 0,e().mark((function a(){var o,s,u,c=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=r.getFileSystemManager(),e.prev=1,o.accessSync(this.configInfo.playPath),e.next=8;break;case 5:return e.prev=5,e.t0=e.catch(1),e.abrupt("return",void this.destory());case 8:if(s="",!this.configInfo.decompress||"br"===this.configInfo.decompress){e.next=13;break}s=o.readFileSync(this.configInfo.playPath,"utf-8").toString(),e.next=21;break;case 13:e.prev=13,u=Rn.readCompressedFileSync(this.configInfo.playPath),s=r.decode({data:u,format:"utf-8"}),e.next=21;break;case 18:return e.prev=18,e.t1=e.catch(13),e.abrupt("return",(console.error("[Launch Opera]: An error occurred reading compressed file ".concat(this.configInfo.playPath),e.t1),void this.destory()));case 21:this.viewer=new(fa()),this.logger=new da.Logger,null===(t=this.director)||void 0===t||t.init(this.viewer,s,{report:new Pa,logger:this.logger}).then((function(){c.director&&(c.director.progress.style=c.configInfo.progressStyle,c.isRunning=!0,c.setAudioMute(!0),c.director.play())})).catch((function(){c.destory()})),null===(n=this.director)||void 0===n||n.onEnd((function(){c.pushMsg("onEnd"),c.isRunning=!1,c.setAudioMute(!1),c.destory()})),null===(i=this.director)||void 0===i||i.onErr((function(e){c.pushMsg("onErr",e)}));case 22:case"end":return e.stop()}}),a,this,[[1,5],[13,18]])})))}}]),t}(),ba=function(e){u(n,e);var t=c(n);function n(){return l(this,n),t.apply(this,arguments)}return d(n,[{key:"init",value:function(e){this.bindInterface(e)}},{key:"bindInterface",value:function(e){e.fs=e.fs||{},e.fs.getCachePath=this.getCachePath.bind(this),e.fs.cleanAllCache=this.cleanAllCache.bind(this),e.fs.cleanCache=this.cleanCache.bind(this),e.fs.removeFile=this.removeFile.bind(this),e.fs.writeFile=this.writeFile.bind(this),e.fs.removeFileInfo=this.removeFileInfo.bind(this),e.fs.modifyFileInfo=this.modifyFileInfo.bind(this),e.fs.addFileInfo=this.addFileInfo.bind(this),Object.defineProperties(e,{getCachePath:{value:this.getCachePath.bind(this)},cleanAllCache:{value:this.cleanAllCache.bind(this)},cleanCache:{value:this.cleanCache.bind(this)},removeFile:{value:this.removeFile.bind(this)},writeFile:{value:this.writeFile.bind(this)},removeFileInfo:{value:this.removeFileInfo.bind(this)},modifyFileInfo:{value:this.modifyFileInfo.bind(this)},addFileInfo:{value:this.addFileInfo.bind(this)}})}},{key:"getCachePath",value:function(e){return Rn.getCachePath(e)}},{key:"cleanAllCache",value:function(){return Rn.cleanAllCache()}},{key:"cleanCache",value:function(e){return Rn.fileSystem.releaseMemory(e,0)}},{key:"removeFile",value:function(e){return Rn.fileSystem.removeFile(e,!0)}},{key:"writeFile",value:function(e,t){return Rn.writeFile({filePath:e,data:t})}},{key:"removeFileInfo",value:function(e){return Rn.removeFileInfo(e)}},{key:"modifyFileInfo",value:function(e){return Rn.modifyFileInfo(e)}},{key:"addFileInfo",value:function(e){return Rn.addFileInfo(e)}}]),n}(de),Ca=p(4293).default,wa=function(e,t,n,i){return new(n||(n=Promise))((function(a,r){function o(e){try{u(i.next(e))}catch(e){r(e)}}function s(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))},Ia=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]])}return n},Ra=function(){function t(){var n=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l(this,t);var a=i.videoManager,s=i.finalPageVideoUrl,u=i.pageManager,c=i.loadingPageConfig,d=i.useCoverView,h=i.preloadDataList,f=i.loadDataPackageFromSubpackage,p=void 0!==f&&f,m=i.compressDataPackage,g=void 0!==m&&m,v=Ia(i,["videoManager","finalPageVideoUrl","pageManager","loadingPageConfig","useCoverView","preloadDataList","loadDataPackageFromSubpackage","compressDataPackage"]);this.font={},this.fs={},this.wasmsplit={},this.reporter={},this.useCoverView=!0,this.PLUGIN_CACHE_PATH=ye,this.hideAfterCallmain=!1,this.contextType=1,this.TimeLogger=je,this.Logger=qe,this.launchData=[],this.getFeatureFlags=this.invokeGetFeatureFlags(),this.initReporterPromise=wa(n,void 0,void 0,e().mark((function t(){var n,i,a,s,u,c,l,d,h,f,p,m,g,v,y,T,S,P,k,E,C,w,I,R;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return je.timeStart("fileSystemInit"),e.next=3,Rn.fileSystem.firstInitPromise;case 3:return je.storeTime("fileSystemInit"),e.next=6,this.getFeatureFlags;case 6:a=r.getLaunchOptionsSync(),s=a.scene,u=a.query,qe.eventLog("".concat(ia.getAssetsLoadText())),c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{adSpaceType:Ui(e[_e.AdSpaceType]),adType:Ui(e[_e.AdType]),materialType:Ui(e[_e.MaterialType])}}(u),l=c.adSpaceType,d=c.adType,h=c.materialType,f=Ue.getFeatureString(),m=(p=o).WASM_SPLIT_PLUGIN_VERSION,g=p.CODE_FILE_MD5,v=p.DATA_FILE_MD5,y=p.WASM_SPLIT_SUB_VERSION,T=p.WASM_SPLIT_API_VERSION,S=p.unityVersion,P=p.usedTextureCompression,k=p.usedAutoStreaming,E={canUseCommonPackage:re,wasmSplitPluginVersion:m,codeMd5:g,wasmSplitSubVersion:y,wasmSplitApiVersion:T,usedTextureCompression:P,usedAutoStreaming:k,dataMd5:v,contextType:Ne[this.contextType]},qe.eventLog("插件信息: ",Object.assign({pluginVersion:A,unityVersion:S,loadDataPackageFromSubpackage:Kn.loadDataPackageFromSubpackage,adSpaceType:l,adType:d,materialType:h,abTest:f,maxAllowSize:Pe,useWasmSplit:this.codeType===Le.codeSplit,canUseHighPerformance:Z,assetsLoadType:ia.assetsLoadType,instanceId:b},E)),J||Z&&this.codeType!==Le.codeSplit&&qe.pluginError("[开发阶段提示 不影响线上版本]高性能模式下不使用代码分包会严重影响性能, 请阅读高性能模式文档: \nhttps://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/iOSOptimization.md"),C=new Mt({IsDownloadCode:ia.assetsLoadType,LoadingPageType:Number(null!==(n=this.loadingPageType)&&void 0!==n?n:he.COVER_VIEW)+Number((null===(i=null==this?void 0:this.launchOpera)||void 0===i?void 0:i.used)?he.LaunchOpera:he.LONG_VIDEO),Scene:s,BenchmarkLevel:V,CodeType:this.codeType,DataPackageLoadType:Kn.loadDataPackageFromSubpackage?Fe.Subpackage:Fe.Cdn,AdSpaceType:l,AdType:d,MaterialType:h,ABTest:f}),_t.setBase(C),Dt.setBase(C),Ft.setBase(C),Ze.triggerEvent(He.PluginLaunch,Ye($e,this)),this.triggerLaunchProgress(ke.GAME_LAUNCH,0),w=[new Mt({ReportType:ke.GAME_LAUNCH,CostTimeMs:0,RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify(E)})],I=je.popTime("fileSystemInit"),R=je.popTime("getContext"),I&&w.push(new Mt({ReportType:ke.FILE_SYSTEM_INIT,CostTimeMs:I.CostTimeMs,RunTimeMs:I.RunTimeMs})),R&&w.push(new Mt({ReportType:ke.GET_CONTEXT,CostTimeMs:R.CostTimeMs,RunTimeMs:R.RunTimeMs})),Rn.fileSystem.checkNeedReportStat(),_t.send(w),r.onHide(this.onHide),r.onShow(this.onShow);case 14:case"end":return e.stop()}}),t,this)}))),this.loadingPage=null,this.launchOpera=null,this.launchStage=null,this.setPreloadList=mi.setPreloadList,this.codeType=0,this.mainCalled=!1,this.gameStarted=!1,this.localLoadingCount=2,this.showAbort=function(){ne?Vi.getInstance():r.showModal({title:"程序遇到错误",content:'可尝试重启游戏\n或通过"右上角菜单-反馈与投诉"提交功能异常反馈',showCancel:!1,confirmText:r.restartMiniProgram?"重启游戏":"确定",success:function(){r.restartMiniProgram&&r.restartMiniProgram({})}})},this.needPluginReport=function(){var e=je.getRuntime(),t=(n.launchData.find((function(e){return e.type===ke.PREPARE_GAME}))||{}).data,i=(null==t?void 0:t.runTimeMs)||0,a=n.gameStarted&&e-i<500&&e<6e4,r=!n.gameStarted&&e<6e4;return a||r},this.reportScene=function(e){rt(e.sceneId)&&e.sceneId<1e3&&qe.pluginError("[reportScene]请检查sceneId"),n.baseReportScene(e)},this.baseReportScene=function(e){ae&&r.reportScene(e)},this.reportPluginLaunchScene=function(e,t){var i={sceneId:e,costTime:t,dimension:{useCodeSplit:n.codeType?bt.True:bt.False,needDownloadDataPackage:ia.assetsLoadType!==pe.AllCached?bt.True:bt.False}};e===ke.PREPARE_GAME&&(i.metric={preloadedSize:String(mi.loadedSize)}),n.baseReportScene(i)},this.reportCustomLaunchInfo=function(){var e;if(!n.gameStarted){si.showResult(!0),n.gameStarted=!0;var t=je.timeEnd("游戏主场景耗时");_t.send(new Mt({ReportType:ke.GAME_START,CostTimeMs:t,RunTimeMs:je.getRuntime()})),n.reportPluginLaunchScene(ke.GAME_START,t),qe.eventLog("游戏可交互cost=".concat(t,"ms,runtime=").concat(je.getRuntime())),M.isWK||null===(e=null==o?void 0:o.compileSubWasm)||void 0===e||e.call(o)}},this.setGameStage=function(e){St(e)},this.reportGameStageCostTime=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";Pt()&&_t.send(new Mt({ReportType:Pt(),CostTimeMs:Number(e),RunTimeMs:je.getRuntime(),ExternInfo:t}))},this.reportGameStageError=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";Pt()&&kt(Number(e))&&Dt.send(new Mt({ReportType:Pt(),ErrorMsg:String(t).slice(0,1024),RunTimeMs:je.getRuntime(),ExternInfo:n,ErrorType:Number(e)}))},this.reportGameSceneError=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";kt(Number(t))&&Dt.send(new Mt({ReportType:e,ErrorMsg:String(n).slice(0,1024),RunTimeMs:je.getRuntime(),ExternInfo:i,ErrorType:Number(t)}))},this.onHide=function(){var e="游戏切后台 showTimes:".concat(t.showTimes);qe.pluginLog(e),ce.info(e);var n=Pt()||t.getCurrentStage();n&&Ft.send(new Mt({StageType:String(n),RunTimeMs:je.getRuntime(),ExternInfo:JSON.stringify({showTimes:t.showTimes})})),gt(!1)},this.onShow=function(){t.showTimes+=1;var e="游戏切前台 showTimes:".concat(t.showTimes);qe.pluginLog(e),ce.info(e),gt(!0)},this.setDataCDN=function(e){if(dn(e)){var t=e.endsWith("/")?e:"".concat(e,"/");o.DATA_CDN=t,Ze.triggerEvent(He.ModulePrepared)}},Ze.init(this),Qi.init(this),ta.init(this),si.init(this),jn.init(this),ra.init(this),Xi.getInstance().init(this),la.getInstance().init(this),ba.getInstance().init(this),this.init(Object.assign({videoManager:a,finalPageVideoUrl:s,pageManager:u,preloadDataList:h,loadingPageConfig:c,useCoverView:d,loadDataPackageFromSubpackage:p,compressDataPackage:g},v)),ea.init(this),this.getFeatureFlags.then((function(){Ze.triggerEvent(He.FeatureFlagReady,Ye($e,n)),bn.instance.init()}))}return d(t,[{key:"networkType",get:function(){return Et.networkType}},{key:"isVisible",get:function(){return vt()}},{key:"isAssetsLoading",get:function(){return this.loadingCount>0}},{key:"worker",get:function(){return bn.instance.worker}},{key:"loadingCount",get:function(){return this.localLoadingCount},set:function(e){this.localLoadingCount=e,0===this.localLoadingCount&&mi.load()}},{key:"invokeGetFeatureFlags",value:function(){var e=this;return new Promise((function(t){if(!Ca.env.isMiniGamePlugin)return qe.pluginLog("非插件模式跳过特性开关逻辑"),t();var i=r.getLaunchOptionsSync().scene,a=!1;setTimeout((function(){a||(qe.eventLog("特性开关拉取超时,使用默认值"),a=!0,t())}),700),Ca.network.gameTransfer({url:"unity.queryfeatureflags",flat:!0,data:{platform:N.platform,system:N.system,sdk_version:N.SDKVersion,unity_version:o.unityVersion,plugin_version:A,scene:i,runtime:M.isWK?Me.WK:Me.Normal,asset_load_type:Kn.loadDataPackageFromSubpackage?Fe.Subpackage:Fe.Cdn,use_wasm_split:e.codeType,version:N.version}}).then((function(e){var i,r=n(e,1)[0];a||(a=!0,(null===(i=null==r?void 0:r.feature_list)||void 0===i?void 0:i.length)&&Ue.init(r.feature_list),t())})).catch((function(e){return qe.pluginLog("特性开关拉取失败",e),t()}))}))}},{key:"writeLog",value:function(e){e&&(qe.eventLog("writeLog: ",e),ue.log(e))}},{key:"writeWarn",value:function(e){e&&(qe.pluginWarn("writeWarn: ",e),ue.warn(e))}},{key:"reportJump",value:function(){this.loadingPageType===he.INTERACTIVE_VIDEO&&Ft.send(new Mt({ActionType:1,PositionID:1,ActionID:2,RunTimeMs:je.getRuntime()}))}},{key:"setConcurrent",value:function(e){var t;null===(t=null==mi?void 0:mi.setConcurrent)||void 0===t||t.call(mi,e)}},{key:"initLoadingPage",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.loadingPageConfig;if(this.loadingPageType=he.LONG_VIDEO,this.useCoverView&&n&&(M.isMiniGamePlugin&&(this.loadingPageType=he.COVER_VIEW),o.isLoopRunnerEnable=!0),this.loadingPageType===he.LONG_VIDEO&&(this.loadingPage=new li({src:null===(e=null==n?void 0:n.materialConfig)||void 0===e?void 0:e.backgroundVideo}),o.isLoopRunnerEnable=!0),this.loadingPageType===he.COVER_VIEW){var i=n||{},a=i.totalLaunchTime,r=i.animationDuration,s=i.scaleMode,u=i.designWidth,c=i.designHeight,l=i.textConfig,d=i.barConfig,h=i.materialConfig,f=i.iconConfig,p=i.extensionButton,m=i.visible;this.loadingPage=new xi({totalLaunchTime:a,animationDuration:r,designWidth:u,designHeight:c,needDownload:ia.needDownload,hideAfterCallmain:this.hideAfterCallmain,textConfig:l,barConfig:d,materialConfig:h,scaleMode:s,iconConfig:f,extensionButton:p,visible:m})}this.launchOpera=new Ea}},{key:"initGameGlobal",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.entries(t).forEach((function(e){var t=n(e,2),i=t[0],a=t[1];if(["STREAMING_CDN","DATA_CDN"].includes(i)&&a.includes("http")){var r=a.endsWith("/")?a:"".concat(a,"/");o[i]=r}else o[i]=a})),o.launchOpera=this.launchOpera,o.UnityLoader={SystemInfo:{width:G,height:U,gpu:function(){var t=h.getContext(Ne[e.contextType]);if(t){var n=t.getExtension("WEBGL_debug_renderer_info");if(n)return t.getParameter(n.UNMASKED_RENDERER_WEBGL)}return"unknown"}(),browser:"wx",browserVersion:"0.0",language:o.navigator.userLanguage||o.navigator.language,hasWebGL:this.contextType},UnityCache:{XMLHttpRequest:Ti}}}},{key:"startGame",value:function(){return wa(this,void 0,void 0,e().mark((function t(){var n=this;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.mainCalled||(this.clearViewPort(),this.showLoadingPage().then((function(){return wa(n,void 0,void 0,e().mark((function t(){var n,i=this;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ze.triggerEvent(He.LoadingPageReady,Ye($e,this)),e.next=3,this.initReporterPromise;case 3:return this.prepareModule(),this.startCheckIs32Wechat(),Ki.updateCodeType(this.codeType===Le.codeSplit),n=[Hn.loadWasmCode(),Kn.loadDataPackage()],e.abrupt("return",(this.codeType!==Le.codeSplit||!ie&&Ue.get(We)===Oe.open||(qe.eventLog("禁用代码分包功能"),this.parallelFetchSubWasmTask=Hn.parallelFetchSubWasm(),n.push(this.parallelFetchSubWasmTask)),Ze.triggerEvent(He.ParallelLoading,Ye($e,this)),Promise.all(n).then((function(){Ze.triggerEvent(He.ParallelLoaded,Ye($e,i)),i.loadingPageType===he.COVER_VIEW&&i.loadingPage.completeDownloadAnimation(),ia.needDownload?i.start():setTimeout((function(){i.start()}),100)}))));case 8:case"end":return e.stop()}}),t,this)})))})).catch((function(e){qe.pluginError("start game fail: ",e)})));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"startCheckIs32Wechat",value:function(){var e=this;N.abi&&!N.abi.includes("64")&&setTimeout((function(){e.mainCalled||(qe.pluginError("当前是32位微信,请升级最新版本"),r.showModal({title:"提示",content:"当前微信为32位版本\n请升级最新版本",showCancel:!1,confirmText:"确认升级",success:function(){r.updateWeChatApp()}}))}),3e4)}},{key:"clearViewPort",value:function(){var e=o.globalGL;e&&(e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.COLOR_BUFFER_BIT),e.clear(e.COLOR_BUFFER_BIT))}},{key:"showLoadingPage",value:function(){var e=this;return new Promise((function(t){e.loadingPageType===he.COVER_VIEW?(e.loadingPage.load().then((function(){e.loadingPage.show(),e.loadingPage.startDownloadAnimation()})),t()):(e.loadingPage.showLoadingPage(),t())}))}},{key:"resumeLoadingPage",value:function(){this.loadingPage.isVisible=!0}},{key:"showFinalPage",value:function(){this.loadingPageType===he.INTERACTIVE_VIDEO&&this.loadingPage.showFinalPage(this.mainCalled)}},{key:"hideFinalPage",value:function(){this.loadingPageType===he.INTERACTIVE_VIDEO&&this.loadingPage.hideFinalPage()}},{key:"hideLoadingPage",value:function(){var e=this;setTimeout((function(){e.loadingPageType===he.LONG_VIDEO&&(e.launchStage.hideProgress(),e.loadingPage.hideLoadingPage()),e.loadingPageType===he.COVER_VIEW&&e.loadingPage.complete()}),0)}},{key:"prepareModule",value:function(){this.gameInstance.Module.gameInstance=this.gameInstance,this.gameInstance.popup=function(e,t){return o.UnityLoader.Error.popup(this.gameInstance,e,t)},o.Module=this.gameInstance.Module}},{key:"start",value:function(){return wa(this,void 0,void 0,e().mark((function t(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.loadingPageType===he.COVER_VIEW,!e.t0){e.next=5;break}return qe.eventLog("[coverview] start compile animation"),e.next=5,this.loadingPage.startCompileAnimation();case 5:this.doStart();case 6:case"end":return e.stop()}}),t,this)})))}},{key:"triggerLaunchProgress",value:function(e,t){var n=Ye(et,this,e,t);this.reportPluginLaunchScene(e,t),this.launchData.push(n),Ze.triggerEvent(He.LaunchProgress,n)}},{key:"init",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.videoManager,a=n.finalPageVideoUrl,s=n.pageManager,u=n.loadingPageConfig,c=(n.useCoverView,n.hideAfterCallmain),l=n.preloadDataList,d=n.loadDataPackageFromSubpackage,f=void 0!==d&&d,p=n.compressDataPackage,m=void 0!==p&&p,g=n.contextConfig,v=void 0===g?{}:g,y=Ia(n,["videoManager","finalPageVideoUrl","pageManager","loadingPageConfig","useCoverView","hideAfterCallmain","preloadDataList","loadDataPackageFromSubpackage","compressDataPackage","contextConfig"]);if(!t.instance){this.gameInstance=null,this.mainCalled=!1,this.gameStarted=!1,this.useCoverView=ne,this.hideAfterCallmain=!!c,this.contextType=v.contextType||1,this.codeType=o.useWasmCodeSplit?Le.codeSplit:Le.normal,je.timeStart("getContext");var T={alpha:!0,stencil:!0,antialias:!1,powerPreference:"high-performance"};if(o.globalGL=h.getContext(Ne[this.contextType],T),je.storeTime("getContext"),!o.globalGL){var S="不支持".concat(Ne[this.contextType],", 请升级").concat(M.isIOS?"系统":"微信");qe.pluginError(S),r.showModal({title:"提示",content:S,showCancel:!1,success:function(){}}),this.initReporterPromise.then((function(){Dt.send(new Mt({ReportType:ke.GET_CONTEXT,ExternInfo:JSON.stringify({contextType:Ne[e.contextType],contextNum:e.contextType,contextAttributes:T})}))})),setTimeout((function(){throw new Error(S)}),0)}this.initGameGlobal(y),aa.init(this),Kn.init(this,{loadDataPackageFromSubpackage:f,compressDataPackage:m}),Hn.init(this),ia.init(this),l&&mi.init({preloadList:l}),this.initLoadingPage({videoManager:i,pageManager:s,loadingPageConfig:u,finalPageVideoUrl:a}),this.launchStage=new Bn(this.useCoverView),t.instance=this}}},{key:"doStart",value:function(){}}],[{key:"getInstance",value:function(){return t.instance}},{key:"getCurrentStage",value:function(){var e,t,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=Object.values(Bn.launchProgress).filter((function(e){return e.status===On.PENDING})).map((function(e){return{stage:e.stage,priority:e.priority}}));if(!!(null===(t=null===(e=this.getInstance())||void 0===e?void 0:e.launchOpera)||void 0===t?void 0:t.running)&&a.push({stage:"LAUNCH_OPERA",priority:0}),!i)return a.map((function(e){return e.stage})).join("&");if(!a.length)return ke.GAME_START;var r=a.sort((function(e,t){return t.priority-e.priority})),o=n(r,1),s=o[0];return ke[s.stage]}}]),t}();Ra.showTimes=-1;var La=Ra})(),module.exports=m}(); 

  }); 


回答关注问题邀请回答
收藏
登录 后发表内容