@revues/web-sdk-core 1.3.1 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/web-sdk-core.js +3 -3
- package/package.json +3 -3
package/dist/web-sdk-core.js
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
18
18
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
19
19
|
PERFORMANCE OF THIS SOFTWARE.
|
20
|
-
***************************************************************************** */function s(e,n){function t(){this.constructor=e}a(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var u=function(){return u=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},u.apply(this,arguments)};function c(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}u((r=r.apply(e,n||[])).next())}))}function d(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function l(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),o=0;for(n=0;n<t;n++)for(var i=arguments[n],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}function f(){var e=window.navigator.userAgent.toLowerCase();return/(iphone|ipad)/.test(e)?"IOS":/android/.test(e)?"Android":"Windows For HUYA"}function p(){var e=f();return"IOS"===e||"Android"===e}function v(e){var n=e.split("?"),t=n[0],r=n[1],o={};return null!=r&&""!==r&&r.split("&").reduce((function(e,n){var t=n.split("=");return e[t[0]]=decodeURIComponent(t[1]),e}),o),{path:t,query:o}}function h(e){for(var n="",t=new Uint8Array(e),r=t.byteLength,o=0;o<r;o++)n+=String.fromCharCode(t[o]);return window.btoa(n)}var _=function(e,n,t){var r,o=new Promise((function(n,o){r=setTimeout((function(){t&&t(e),o(new Error("Timed out in "+e+"ms."))}),e)}));return new Promise((function(e,t){Promise.race([n,o]).then((function(n){clearTimeout(r),e(n)})).catch(t)}))};var m,g=function(e){return 1===String(e).length?"0"+e:e};function w(){return window.__extInfo||{}}function y(){return w().extUuid}function b(){var e=w().extType||"";return/\_inner\_/gi.test(e)}!function(e){e[e.debug=0]="debug",e[e.log=1]="log",e[e.info=2]="info",e[e.warn=3]="warn",e[e.error=4]="error"}(m||(m={}));var S=Date.now();var A=function(){var e=localStorage.getItem("wsc_loglevel");if("string"==typeof e&&""!==e){var n=Number(e);if(!isNaN(n))return n}return null}(),I=function(e){var n=e.onBefore,t=e.onAfter,r=e.prefix,o=e.logColor,i=e.level,a=e.enableLog,s=Object.assign({info:"blue",warn:"orange",error:"red",log:"green",debug:"green"},o);function u(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var o=e[0],s=e[1],u=e[2],d=e[3],l=c(),f={prefix:l,msg:s,data:u,desc:l+s};n&&n(f);var p=m[d]>=i;a(p)&&console.log("%c "+f.desc,"color: "+o+";",f.data),t&&t(f,p)}function c(){return"function"==typeof r?r():r||""}return{log:function(e,n){u(s.log,e,n,"log")},info:function(e,n){u(s.info,e,n,"info")},warn:function(e,n){u(s.warn,e,n,"warn")},error:function(e,n){u(s.error,e,n,"error")},debug:function(e,n){u(s.error,e,n,"debug")}}}({level:null!==A?A:m.info,onAfter:function(e,n){n&&null!=window.hyExt&&window.hyExt.logger.info(e.desc+" "+function(e){try{return JSON.stringify(e)}catch(e){return"stringify error"}}(e.data))},prefix:function(){return"web-sdk-core * date:"+(void 0===e&&(e=new Date),g(e.getHours())+":"+g(e.getMinutes())+":"+g(e.getSeconds())+" extName:")+w().extName+" extUuid:"+y()+" sessionId:"+S+" - ";var e},enableLog:function(e){return e}});var k,T,x=location.pathname.split("/"),P=x.slice(1,x.length-1),
|
20
|
+
***************************************************************************** */function s(e,n){function t(){this.constructor=e}a(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var u=function(){return u=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},u.apply(this,arguments)};function c(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}u((r=r.apply(e,n||[])).next())}))}function d(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function l(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),o=0;for(n=0;n<t;n++)for(var i=arguments[n],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}function f(){var e=window.navigator.userAgent.toLowerCase();return/(iphone|ipad)/.test(e)?"IOS":/android/.test(e)?"Android":"Windows For HUYA"}function p(){var e=f();return"IOS"===e||"Android"===e}function v(e){var n=e.split("?"),t=n[0],r=n[1],o={};return null!=r&&""!==r&&r.split("&").reduce((function(e,n){var t=n.split("=");return e[t[0]]=decodeURIComponent(t[1]),e}),o),{path:t,query:o}}function h(e){for(var n="",t=new Uint8Array(e),r=t.byteLength,o=0;o<r;o++)n+=String.fromCharCode(t[o]);return window.btoa(n)}var _=function(e,n,t){var r,o=new Promise((function(n,o){r=setTimeout((function(){t&&t(e),o(new Error("Timed out in "+e+"ms."))}),e)}));return new Promise((function(e,t){Promise.race([n,o]).then((function(n){clearTimeout(r),e(n)})).catch(t)}))};var m,g=function(e){return 1===String(e).length?"0"+e:e};function w(){return window.__extInfo||{}}function y(){return w().extUuid}function b(){var e=w().extType||"";return/\_inner\_/gi.test(e)}!function(e){e[e.debug=0]="debug",e[e.log=1]="log",e[e.info=2]="info",e[e.warn=3]="warn",e[e.error=4]="error"}(m||(m={}));var S=Date.now();var A=function(){var e=localStorage.getItem("wsc_loglevel");if("string"==typeof e&&""!==e){var n=Number(e);if(!isNaN(n))return n}return null}(),I=function(e){var n=e.onBefore,t=e.onAfter,r=e.prefix,o=e.logColor,i=e.level,a=e.enableLog,s=Object.assign({info:"blue",warn:"orange",error:"red",log:"green",debug:"green"},o);function u(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var o=e[0],s=e[1],u=e[2],d=e[3],l=c(),f={prefix:l,msg:s,data:u,desc:l+s};n&&n(f);var p=m[d]>=i;a(p)&&console.log("%c "+f.desc,"color: "+o+";",f.data),t&&t(f,p)}function c(){return"function"==typeof r?r():r||""}return{log:function(e,n){u(s.log,e,n,"log")},info:function(e,n){u(s.info,e,n,"info")},warn:function(e,n){u(s.warn,e,n,"warn")},error:function(e,n){u(s.error,e,n,"error")},debug:function(e,n){u(s.error,e,n,"debug")}}}({level:null!==A?A:m.info,onAfter:function(e,n){n&&null!=window.hyExt&&window.hyExt.logger.info(e.desc+" "+function(e){try{return JSON.stringify(e)}catch(e){return"stringify error"}}(e.data))},prefix:function(){return"web-sdk-core * date:"+(void 0===e&&(e=new Date),g(e.getHours())+":"+g(e.getMinutes())+":"+g(e.getSeconds())+" extName:")+w().extName+" extUuid:"+y()+" sessionId:"+S+" - ";var e},enableLog:function(e){return e}});var k,T,x=location.pathname.split("/"),P=x.slice(1,x.length-1),C=location.protocol+"//"+location.host+"/"+P.join("/")+"/",M=C+"view.html",E=window.__debug,F="service",O="view",L=window.__packageExtConfig,B={path:L?L.entryPagePath:"index",query:{},referrerInfo:{},scene:1001},D="onTaskProgressUpdate",H="onTaskHeadersReceived",W="miniGame",N="hyfile://",V="hyfile://",R=(k=v(location.href).query,T=w(),I.info("forceUsePatchApi",{fromQuery:k.forceUsePatchApi,fromLocal:T.forceUsePatchApi}),null!=k.forceUsePatchApi?"1"===k.forceUsePatchApi:null!=T.forceUsePatchApi&&T.forceUsePatchApi),j=function(){function e(e){this.sync=!1,this.events=new i,this.el=e,this.isReady=!1}return e.prototype.getWindow=function(){return this.el.contentWindow},e.prototype.getBridge=function(){},e.prototype.emitSync=function(e){for(var n,t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.sync=!0,(n=this.events).emit.apply(n,l([e],t)),this.sync=!1},e}(),G={onViewDOMContentLoaded:"onViewDOMContentLoaded",onInjectHTMLCallback:"onInjectHTMLCallback"},U={};var q=function(e){function n(n){return e.call(this,n)||this}return s(n,e),n.prototype.updateSrc=function(e){this.el.src=e},n.prototype.sendToSerivce=function(e,n,t){I.debug("%c "+e,{data:n,webviewId:t}),this.getBridge().subscribeHandler(e,n,t)},n.prototype.loadSubBundle=function(e,n){return c(this,void 0,void 0,(function(){var t=this;return d(this,(function(r){return[2,new Promise((function(r){if(!0!==U[e]){var o=t.getWindow();null!=o&&(t.events.once(G.onInjectHTMLCallback,(function(){r()})),o.injectHtml(o.document.body,{content:'<script charset="utf-8" src="'+n+'"><\/script>'}),U[e]=!0)}}))]}))}))},n.prototype.invokeCallbackHandler=function(e,n,t){I.debug("%c "+(t||"API")+" call callback",{cbId:e,data:n}),this.getBridge().invokeCallbackHandler(e,n)},n.prototype.getBridge=function(){return this.getWindow().ServiceJSBridge},n}(j),K="webview-service",$=new Map;function z(e){var n=$.get(e);if(n)return n;var t=document.getElementById(e);if(null!=t){var r=new(e===K?q:En)(t);return $.set(e,r),r}throw new Error("获取IframeManager失败, id: "+e)}function X(){return z("webview-first-view")}function Q(){return z(K)}function Y(e,n,t){Ln.stack.forEach((function(r){null!=r.webviewId&&function(e,n){return 1===e.length&&e[0]===n.webviewId||e.indexOf(n.webviewId)>-1}(t,r)&&(r.isReady?r.sendToView(e,n):console.error("shouldn't exctute"))}))}function Z(e,n,t){z(K).sendToSerivce(e,n,t)}function J(e,n){var t,r=null===(t=Ln.currPage)||void 0===t?void 0:t.children;if(Array.isArray(r)&&r.length>0){var o=r[0];o&&o.isWebView&&o.postMessageToWebView({eventName:e,type:"subscribeHandler",params:n})}}var ee=null;function ne(){if(null==ee)throw new Error("AdapterTarget is not set yet.");return ee}var te="custom_event_";var re=o((function(e,n){
|
21
21
|
/*!
|
22
22
|
* howler.js v2.2.4
|
23
23
|
* howlerjs.com
|
@@ -39,7 +39,7 @@
|
|
39
39
|
*
|
40
40
|
* MIT License
|
41
41
|
*/
|
42
|
-
function(){var e;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return n="number"!=typeof n?s[1]:n,t="number"!=typeof t?s[2]:t,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof e?s:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=(e=Howl.prototype.init,function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}),Howl.prototype.stereo=function(e,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(e,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof e)return r._stereo;r._stereo=e,r._pos=[e,0,0]}for(var i=r._getSoundIds(t),a=0;a<i.length;a++){var s=r._soundById(i[a]);if(s){if("number"!=typeof e)return s._stereo;s._stereo=e,s._pos=[e,0,0],s._node&&(s._pannerAttr.panningModel="equalpower",s._panner&&s._panner.pan||n(s,o),"spatial"===o?void 0!==s._panner.positionX?(s._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),s._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),s._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):s._panner.setPosition(e,0,0):s._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),r._emit("stereo",s._id)}}return r},Howl.prototype.pos=function(e,t,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"pos",action:function(){i.pos(e,t,r,o)}}),i;if(t="number"!=typeof t?0:t,r="number"!=typeof r?-.5:r,void 0===o){if("number"!=typeof e)return i._pos;i._pos=[e,t,r]}for(var a=i._getSoundIds(o),s=0;s<a.length;s++){var u=i._soundById(a[s]);if(u){if("number"!=typeof e)return u._pos;u._pos=[e,t,r],u._node&&(u._panner&&!u._panner.pan||n(u,"spatial"),void 0!==u._panner.positionX?(u._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(t,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setPosition(e,t,r)),i._emit("pos",u._id)}}return i},Howl.prototype.orientation=function(e,t,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"orientation",action:function(){i.orientation(e,t,r,o)}}),i;if(t="number"!=typeof t?i._orientation[1]:t,r="number"!=typeof r?i._orientation[2]:r,void 0===o){if("number"!=typeof e)return i._orientation;i._orientation=[e,t,r]}for(var a=i._getSoundIds(o),s=0;s<a.length;s++){var u=i._soundById(a[s]);if(u){if("number"!=typeof e)return u._orientation;u._orientation=[e,t,r],u._node&&(u._panner||(u._pos||(u._pos=i._pos||[0,0,-.5]),n(u,"spatial")),void 0!==u._panner.orientationX?(u._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(t,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setOrientation(e,t,r)),i._emit("orientation",u._id)}}return i},Howl.prototype.pannerAttr=function(){var e,t,r,o=this,i=arguments;if(!o._webAudio)return o;if(0===i.length)return o._pannerAttr;if(1===i.length){if("object"!=typeof i[0])return(r=o._soundById(parseInt(i[0],10)))?r._pannerAttr:o._pannerAttr;e=i[0],void 0===t&&(e.pannerAttr||(e.pannerAttr={coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}),o._pannerAttr={coneInnerAngle:void 0!==e.pannerAttr.coneInnerAngle?e.pannerAttr.coneInnerAngle:o._coneInnerAngle,coneOuterAngle:void 0!==e.pannerAttr.coneOuterAngle?e.pannerAttr.coneOuterAngle:o._coneOuterAngle,coneOuterGain:void 0!==e.pannerAttr.coneOuterGain?e.pannerAttr.coneOuterGain:o._coneOuterGain,distanceModel:void 0!==e.pannerAttr.distanceModel?e.pannerAttr.distanceModel:o._distanceModel,maxDistance:void 0!==e.pannerAttr.maxDistance?e.pannerAttr.maxDistance:o._maxDistance,refDistance:void 0!==e.pannerAttr.refDistance?e.pannerAttr.refDistance:o._refDistance,rolloffFactor:void 0!==e.pannerAttr.rolloffFactor?e.pannerAttr.rolloffFactor:o._rolloffFactor,panningModel:void 0!==e.pannerAttr.panningModel?e.pannerAttr.panningModel:o._panningModel})}else 2===i.length&&(e=i[0],t=parseInt(i[1],10));for(var a=o._getSoundIds(t),s=0;s<a.length;s++)if(r=o._soundById(a[s])){var u=r._pannerAttr;u={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:u.coneOuterAngle,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:u.coneOuterGain,distanceModel:void 0!==e.distanceModel?e.distanceModel:u.distanceModel,maxDistance:void 0!==e.maxDistance?e.maxDistance:u.maxDistance,refDistance:void 0!==e.refDistance?e.refDistance:u.refDistance,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:u.rolloffFactor,panningModel:void 0!==e.panningModel?e.panningModel:u.panningModel};var c=r._panner;c||(r._pos||(r._pos=o._pos||[0,0,-.5]),n(r,"spatial"),c=r._panner),c.coneInnerAngle=u.coneInnerAngle,c.coneOuterAngle=u.coneOuterAngle,c.coneOuterGain=u.coneOuterGain,c.distanceModel=u.distanceModel,c.maxDistance=u.maxDistance,c.refDistance=u.refDistance,c.rolloffFactor=u.rolloffFactor,c.panningModel=u.panningModel}return o},Sound.prototype.init=function(e){return function(){var n=this,t=n._parent;n._orientation=t._orientation,n._stereo=t._stereo,n._pos=t._pos,n._pannerAttr=t._pannerAttr,e.call(this),n._stereo?t.stereo(n._stereo):n._pos&&t.pos(n._pos[0],n._pos[1],n._pos[2],n._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var n=this,t=n._parent;return n._orientation=t._orientation,n._stereo=t._stereo,n._pos=t._pos,n._pannerAttr=t._pannerAttr,n._stereo?t.stereo(n._stereo):n._pos?t.pos(n._pos[0],n._pos[1],n._pos[2],n._id):n._panner&&(n._panner.disconnect(0),n._panner=void 0,t._refreshBuffer(n)),e.call(this)}}(Sound.prototype.reset);var n=function(e,n){"spatial"===(n=n||"spatial")?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,void 0!==e._panner.positionX?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),void 0!==e._panner.orientationX?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}}()}));function oe(e,n,t){z(K).invokeCallbackHandler(e,n,t)}function ie(e,n,t){var r,o=null===(r=Cn.currPage)||void 0===r?void 0:r.children;if(Array.isArray(o)&&o.length>0){var i=o[0];i&&i.isWebView&&i.postMessageToWebView({callbackId:e,type:"webInvokeCallbackHandler",params:n})}}var ae={},se={};function ue(e,n){var t=ae[e],r=se[e];return null!=t?""!=n.src&&r!=n.src?(t.unload(),delete ae[e],delete se[e],ue(e,n)):t:(se[e]=n.src,ae[e]=function(e,n){var t=new re.Howl({autoplay:e.autoplay,loop:e.loop,src:e.src,rate:e.playbackRate,onend:function(){Z(le,{innerAudioContextId:n,method:de.onEnded,data:{}})},onplay:function(){Z(le,{innerAudioContextId:n,method:de.onPlay,data:{buffered:0,currentTime:0,duration:0}})},onpause:function(e){Z(le,{innerAudioContextId:e,method:de.onPause,data:{}})},onstop:function(){Z(le,{innerAudioContextId:n,method:de.onStop,data:{}})},onseek:function(){Z(le,{innerAudioContextId:n,method:de.onSeeked,data:{}})},onplayerror:function(e,n){Z(le,{innerAudioContextId:e,method:de.onError,data:{errMsg:"播放失败 :"+n,errCode:-1}})},onloaderror:function(e,n){Z(le,{innerAudioContextId:e,method:de.onError,data:{errMsg:"播放失败 :"+n,errCode:10002}})},onrate:function(e){console.log("audio进度改变")},onload:function(){Z(le,{innerAudioContextId:n,method:de.onCanplay,data:{}})}});return t}(n,e))}function ce(e,n,t){var r=ae[n];if(null==r){var o=e+":fail 无法找到innerAudioContextId:"+n+"对应的audio实例";throw oe(t,{errMsg:o}),new Error(o)}return r}re.Howler.autoSuspend=!1;var de={onCanplay:"onCanplay",onEnded:"onEnded",onError:"onError",onPause:"onPause",onPlay:"onPlay",onSeeked:"onSeeked",onSeeking:"onSeeking",onStop:"onStop",onTimeUpdate:"onTimeUpdate",onWaiting:"onWaiting"},le="onInnerAudio";var fe={innerAudio:function(e,n){var t,r=e.method,o=e.data,i=e.innerAudioContextId;switch(r){case"create":break;case"play":(t=ue(i,o)).loop(o.loop),t.volume(o.volume),o.isPlayMethod&&t.play();break;case"stop":ce(r,i,n).stop();break;case"seek":(t=ce(r,i,n)).seek(o.position);break;case"pause":ce(r,i,n).pause();break;case"destroy":ce(r,i,n).unload();break;default:throw new Error("无法处理音频method:"+r)}return{errMsg:"innerAudio:ok"}}};function pe(e){return/^http(s?)\:\/\//.test(e)}function ve(e,n,t){var r=new XMLHttpRequest,o=!0;if(null!=n.sync&&(o=!n.sync),null!=n.responseType&&(r.responseType=n.responseType),r.open("GET",e,o),null!=n.header)for(var i in n.header)r.setRequestHeader(i,n.header[i]);r.onload=function(e){t(null,r.response,{e:e,xhr:r})},r.onerror=function(e){t(new Error("request settings failed!"),null,{e:e,xhr:r})},r.send(null)}var he={readFileSync:function(e){var n,t=e.filePath;if(t.startsWith(N))return{data:null,errMsg:"readFileSync:fail not support local file."};t=pe(t=(n=t).endsWith(".wasm")?n+".txt":n)?t:M+t;var r=null,o=null;return ve(t,{sync:!0},(function(e,n){r=n,o=e})),null!=r?{data:r,errMsg:"readFileSync:ok"}:null!=o?{data:null,errMsg:"readFileSync:fail "+o.message}:{data:null,errMsg:"readFileSync:fail"}},readFile:function(e,n){var t=e.filePath,r="base64"===e.encoding,o=pe(t)?t:M+t;t.startsWith(N)?oe(n,{errMsg:"readFile:fail not support local file: "+t}):ve(o,{responseType:r?"arraybuffer":""},(function(e,t){oe(n,null==e?{data:r?h(t):t,errMsg:"readFile:ok"}:{errMsg:"readFile:fail "+e.message})}))},access:function(){return{errMsg:"access:ok"}},rename:function(){return{errMsg:"rename:ok"}},mkdirSync:function(){return{errMsg:"mkdirSync:ok"}},writeFile:function(){return{errMsg:"writeFile:ok"}},writeFileSync:function(e){return e.filePath,e.data,{errMsg:"writeFileSync:ok"}},unlink:function(e,n){return e.filePath,{errMsg:"unlink:ok"}},downloadFile:function(e,n){var t=e.url,r=e.timeout,o=void 0===r?6e3:r;e.taskId,e.header,e.filePath,_(o,function(e){var n=e.url,t=e.callbackId;return e.filePath,e.header,c(this,void 0,void 0,(function(){return d(this,(function(e){return Z(H,{cookies:[],progress:100,totalBytesExpectedToWrite:100,totalBytesWritten:100}),Z(D,{cookies:[],header:{}}),oe(t,{filePath:n,tempFilePath:n,profile:[],statusCode:200,errMsg:"downloadFile:ok"}),[2]}))}))}({url:t,callbackId:n}),(function(e){oe(n,{errMsg:"downloadFile:fail timeout in "+e+"ms."})}))},copyFile:function(e,n){return e.srcPath,e.destPath,oe(n,{errMsg:"copyFile:ok fake subpport."},"copyFile")}};function _e(e){return ne().invokeHandler({callbackId:e.callbackId||-1,apiName:e.apiName,params:e.params,from:"service"})}var me,ge,we,ye=R?he:(me=he,ge={readFileSync:{onMobile:be},readFile:{onMobile:be},access:{onMobile:be},rename:{onCallBefore:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e.shift();return t&&t.fatNewPath&&(t.newPath=t.fatNewPath,delete t.fatNewPath),t&&e.unshift(t),e}},downloadFile:{onCallBefore:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0];if(null!=t){var r=t.header;if(r&&r.Referer)throw new Error("header不能设置Referer字段");t.source="miniGame"}return e}}},we=ge||{},Object.keys(me).reduce((function(e,n){var t=me[n];return e[n]=function(){for(var e,r,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var a=p(),s=we[n],u={callNativeApi:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _e({apiName:n,params:e[0],callbackId:e[1]})},callPatchApi:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.apply(void 0,e)}};try{return s&&"function"==typeof s.onCallBefore&&(o=(e=s.onCallBefore).call.apply(e,l([u],o))),a?s&&"function"==typeof s.onMobile?(r=s.onMobile).call.apply(r,l([u],o)):u.callNativeApi.apply(u,o):u.callPatchApi.apply(u,o)}catch(e){return{errMsg:n+":fail error occured in polyfill api, "+e.message}}},e}),{}));function be(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0],r=t.filePath||t.path,o=this;return r.startsWith(V)?o.callNativeApi.apply(o,e):o.callPatchApi.apply(o,e)}var Se=new(function(){function e(){this.reportedEventType=new Set(["ErrorType"])}return Object.defineProperty(e.prototype,"sentry",{get:function(){return window.Sentry},enumerable:!1,configurable:!0}),e.prototype.captureException=function(e,n){var t=this.sentry;if(null!=t){var r=n.event_desc;delete n.event_desc,t.captureException(function(e,n){var t=new Error,r=e.charAt(0).toUpperCase()+e.slice(1),o=function(e){try{return JSON.parse(e)}catch(n){return e}}(n);"string"==typeof o?(t.stack=o,t.message=o):(t.message=r+": "+o.msg,t.stack=o.stack);return t}(e,r))}else console.log("Sentry is not ready yet.")},e.prototype.captureLoadGameEntryError=function(e){Se.captureException("LoadGameEntryError",{event_desc:"load game entry bundle fail: \n"+e.message+"\n"+e.stack})},e}()),Ae=null;function Ie(){if(null==Ae)throw new Error("WxConfig is not ready.");return Ae}function ke(e){var n=Ie(),t=n.windows.pages;return null!=t&&t[e]?Object.assign({},n.window,t[e]):null}var Te=new i;function xe(){Te.on("NavigatorBarTools:onMore",(function(){yn.showToast({title:"暂未实现该功能"})})),Te.on("NavigatorBarTools:onClose",(function(){var e=ne();null!=e&&e.invokeHandler({callbackId:-1,apiName:"exitMiniProgram",params:{},from:"service"})})),Te.on("NavigatorBar:onBack",(function(){Ne.navigateBack({delta:1}),console.log("onBack")})),Te.on("TabBar:change",(function(e){var n,t,r;Z("onTabItemTap",{index:e.index,pagePath:e.item.pagePath,text:e.item.text}),Ne.switchTab({url:e.item.pagePath},-1),n=e.item.pagePath,t={},null!=(r=ke(n))&&(t.windowConfig=r),Te.emit("tabItemChanged",t)})),Te.on("invokeCallbackHandler",(function(e){oe(e.callbackId,e.data)})),Te.on("dispatchServiceEvent",(function(e){Z(e.event,e.payload)}))}function Pe(e){void 0!==window.__initWebFrame&&window.__initWebFrame(e,Te)}var Me={getGlobalVariables:function(e){return"_launchOption"===e.variable?{_launchOption:B}:null},onWindowResize:function(){},offWindowResize:function(){},reportApmMonitor:function(e){var n=e.eventName,t=e.payload,r=e.eventType;e.timestamp,Se.reportedEventType.has(r)?Se.captureException(n,t):"LogReport"===r&&t.event},addPerformance:function(e){},initReady:function(){},updateAppData:function(){},injectHtmlCallback:function(e,n,t){"service"===t&&Q().events.emit(G.onInjectHTMLCallback)},pageScrollTo:function(e,n){var t=e.scrollTop;e.duration;var r=Cn.currPage.getWindow();return null==r||r.scrollTo({top:t,behavior:"smooth"}),{errMsg:"pageScrollTo:ok"}},getMenuButtonBoundingClientRect:function(e,n){Te.emit("getMenuButtonBoundingClientRect",e,n)},getAccountInfoSync:function(){var e=window.__extInfo;return{data:{miniProgram:u(u({},e),{appId:null==e?void 0:e.extUuid,envVersion:null==e?void 0:e.envVersion,version:"",forceUsePatchApi:R}),plugin:{appId:"",version:""}}}},jssdkConfig:function(e,n){var t=e.jsApiList,r=[];if((void 0===t?[]:t).forEach((function(e){null==yn[e]&&r.push(e)})),!(r.length>0))return ie(n,{errMsg:"jssdkConfig:ok"});ie(n,{errMsg:"jssdkConfig:fail "+r.join(",")+" 未实现."})}},Ce={hideToast:function(e){return Te.emit("hideToast",e),{errMsg:"hideToast:ok"}},showToast:function(e){return Te.emit("showToast",e),{errMsg:"showToast:ok"}},showLoading:function(e){return Te.emit("showLoading",e),{errMsg:"showLoading:ok"}},hideLoading:function(e){return Te.emit("hideLoading",e),{errMsg:"hideLoading:ok"}},showModal:function(e,n){Te.emit("showModal",e,n)},showActionSheet:function(e,n){Te.emit("showActionSheet",e,n)}},Ee={showGameKeyboard:function(e){return p()?_e({apiName:"showGameKeyboard",params:e}):Te.emit("showKeyboard",e),{}},hideGameKeyboard:function(e){return p()||Te.emit("hideKeyboard",e),{}},updateGameKeyboard:function(e){return p()||Te.emit("updateKeyboard",e),{}},showKeyboard:function(e){return p()?_e({apiName:"showGameKeyboard",params:e}):Te.emit("showKeyboard",e),{}},hideKeyboard:function(e){return Te.emit("hideKeyboard",e),{}},updateKeyboard:function(e){return Te.emit("updateKeyboard",e),{}}};function Fe(e,n){if(e===W)return'<script charset="utf-8" src="'+n.moduleName+'game.js"><\/script>';if("miniProgram"===e)return n.content;throw Error("unsupported projectType: "+e)}var Oe=function(e){function n(n){return e.call(this,u(u({},n),{projectType:W}))||this}return s(n,e),n.prototype.injectScript=function(){var e=z(K).getWindow();e.injectHtml(e.document.body,{content:Fe(this.projectType,{moduleName:this.moduleName})})},n.prototype.getEntry=function(){return e=this.projectType,n={moduleName:this.moduleName},e===W?n.moduleName+"game.js":"";var e,n},n}(function(){function e(e){this.taskId=e.taskId,this.moduleName=e.moduleName,this.projectType=e.projectType,this.status="none"}return e.prototype.notifyProgressUpdate=function(e,n){Z("onLoadSubPackageTaskStateChange",u({moduleName:this.moduleName,state:e,taskId:this.taskId},n))},e.prototype.injectScript=function(){},e.prototype.getEntry=function(){},e.prototype.load=function(e,n){return c(this,void 0,void 0,(function(){return d(this,(function(e){return this.notifyProgressUpdate("progressUpdate",{progress:0}),this.notifyProgressUpdate("progressUpdate",{progress:50}),this.injectScript(),this.notifyProgressUpdate("progressUpdate",{progress:100}),[2]}))}))},e}()),Le=0,Be={},He={createLoadSubPackageTask:function(e,n){var t=e.moduleName,r=Be[t];if(r&&"success"===r.status)return{errMsg:"createLoadSubPackageTask:fail sub package already loaded."};++Le;var o=String(Le);return r=new Oe({taskId:o,moduleName:t}),Q().events.once(G.onInjectHTMLCallback,(function(){r.status="success",r.notifyProgressUpdate("success",{entryPath:r.getEntry()})})),Be[t]=r,r.load(o,n),{errMsg:"createLoadSubPackageTask:ok",loadTaskId:Le}}},De={showNavigationBarLoading:function(){return Te.emit("showNavigationBarLoading"),{errMsg:"showNavigationBarLoading:ok"}},setNavigationBarTitle:function(e){return Te.emit("setNavigationBarTitle",e),{errMsg:"setNavigationBarTitle:ok"}},setNavigationBarColor:function(e){return Te.emit("setNavigationBarColor",e),{errMsg:"setNavigationBarColor:ok"}},hideNavigationBarLoading:function(){return Te.emit("hideNavigationBarLoading"),{errMsg:"hideNavigationBarLoading:ok"}},hideHomeButton:function(){}};function We(e,n){var t,r=function(e){e=e.replace(/\.html$/,"");var n=Ie(),t=n.subpackages;if(Array.isArray(t)&&t.length>0)return t.find((function(n){return n.pageFullPath.includes(e)}));return null}(e);null==r||(t=r.root,U[t])?n():function(e,n){var t=z(K);t.events.once(G.onInjectHTMLCallback,n),t.loadSubBundle(e.root,e.packageName+".js")}(r,n)}var Ne={navigateTo:function(e,n){var t=e.url;if(Cn.stack.length>10)return{errMsg:"navigateTo:fail 已到达页面栈上限:10。"};var r=v(t),o=r.path,i=r.query;return We(o,(function(){var e=Cn.go(o);Q().events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:o,openType:"navigateTo",options:void 0,pipMode:"",query:i,webviewId:e.webviewId},e.webviewId)}))})),{errMsg:"navigateTo:ok"}},navigateBack:function(e){var n=e.delta;try{Cn.back(n)}catch(e){return{errMsg:"navigateBack:fail "+e.message}}var t=Cn.currPage;return Z("onAppRoute",{path:t.pagePath,openType:"navigateBack",options:{delta:n},pipMode:"",query:void 0,webviewId:t.webviewId},t.webviewId),{errMsg:"navigateBack:ok"}},reLaunch:function(e,n){var t=e.url,r=v(t),o=r.path,i=r.query;We(o,(function(){Cn.reLaunch(t);var e=Cn.currPage;Q().events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:o,openType:"reLaunch",options:void 0,pipMode:"",query:i,webviewId:e.webviewId},e.webviewId),oe(n,{errMsg:"reLaunch:ok"})}))}))},redirectTo:function(e,n){var t=v(e.url),r=t.path,o=t.query;We(r,(function(){try{Cn.redirectTo(r)}catch(e){return void oe(n,{errMsg:"redirectTo:fail "+e.message})}var e=Cn.currPage;Q().events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:r,openType:"redirectTo",options:void 0,pipMode:"",query:o,webviewId:e.webviewId},e.webviewId),oe(n,{errMsg:"redirectTo:ok"})}))}))},switchTab:function(e,n){var t=v(e.url),r=t.path,o=t.query;We(r,(function(){try{Cn.switch(r)}catch(e){return void oe(n,{errMsg:"switchTab:fail "+e.message})}var e=Cn.currPage;e.isReady?(Z("onAppRoute",{path:r,openType:"switchTab",options:void 0,pipMode:"",query:o,webviewId:e.webviewId},e.webviewId),oe(n,{errMsg:"switchTab:ok"})):Q().events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:r,openType:"switchTab",options:void 0,pipMode:"",query:o,webviewId:e.webviewId},e.webviewId),oe(n,{errMsg:"switchTab:ok"})}))}))}};function Ve(e){setTimeout(e,16)}function Re(e){var n=y();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return n+"-"+e}function je(e){var n=y();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return e.replace(new RegExp("^"+n+"-"),"")}function Ge(e){return Number((e/1024).toFixed(2))}var Ue={getStorageSync:function(e){return{data:localStorage.getItem(Re(e.key))||null}},getStorage:function(e,n){Ve((function(){oe(n,{data:Ue.getStorageSync(e)})}))},setStorageSync:function(e){return localStorage.setItem(Re(e.key),e.data),{errMsg:"setStorageSync:ok"}},setStorage:function(e,n){Ve((function(){localStorage.setItem(e.key,e.data),oe(n,{errMsg:"setStorage:ok"})}))},removeStorageSync:function(e){return localStorage.removeItem(Re(e.key)),{errMsg:"removeStorageSync:ok"}},removeStorage:function(e,n){Ve((function(){localStorage.removeItem(Re(e.key)),oe(n,{errMsg:"removeStorage:ok"})}))},clearStorageSync:function(){return localStorage.clear(),{errMsg:"clearStorageSync:ok"}},clearStorage:function(e,n){Ve((function(){localStorage.clear(),oe(n,{errMsg:"clearStorage:ok"})}))},getStorageInfoSync:function(){var e=function(){var e=0,n=[];for(var t in localStorage)Object.prototype.hasOwnProperty.call(localStorage,t)&&(e+=localStorage[t].length,n.push(je(t)));return{size:e,keys:n}}(),n=e.size;return{keys:e.keys,currentSize:Ge(n),limitSize:Ge(10485760)}},getStorageInfo:function(e,n){Ve((function(){oe(n,u(u({},Ue.getStorageInfoSync()),{errMsg:"getStorageInfo:ok"}))}))}};function qe(){var e=f();return("Android"===e||"IOS"===e)&&window.matchMedia("(orientation: portrait)").matches?"portrait":"landscape"}function Ke(){var e,n,t,r=null===(e=Cn.currPage)||void 0===e?void 0:e.getWindow();if(null!=r){var o=r.document;return(null===(n=o.documentElement)||void 0===n?void 0:n.scrollTop)||(null===(t=o.body)||void 0===t?void 0:t.scrollTop)||0}return 0}function $e(){return u(u({patch:!0},(e=window.innerWidth||375,n=window.innerHeight||375,t=f().toLocaleLowerCase().includes("window")?0:50,r=window.devicePixelRatio||2,{screenWidth:e,screenHeight:n,statusBarHeight:t,devicePixelRatio:r,pixelRatio:r,windowHeight:n,windowWidth:e,safeArea:{height:n-t,widows:e,top:t,left:0,right:0}})),{scrollY:Ke()});var e,n,t,r}var ze={onMemoryWarning:function(){console.warn("The onMemoryWarning api is not implement.")},showShareMenu:function(){console.warn("The showShareMenu api is not implement.")},getSystemInfoSync:function(){var e,n=Xe(),t=qe(),r=f(),o=(e=w().extType||"").startsWith("app_")?f().toLowerCase():e.startsWith("pc_")?"pc":"web";return I.info("getSystemInfoSync",{windowInfo:n,deviceOrientation:t,system:r,platform:o}),u({deviceOrientation:t,SDKVersion:"1.0.0",appVersion:"12.1.0",batteryLevel:98,benchmarkLevel:1,bluetoothEnabled:!1,brand:"huya",cameraAuthorized:!1,deviceId:"none",enableDebug:!1,fontSizeSetting:15,frameworkVersion:"1.0.0",inHUYA:!0,language:"zh_CN",locationAuthorized:!1,locationEnabled:!1,microphoneAuthorized:!0,mode:"default",model:"none",notificationAuthorized:!0,platform:o,system:r,theme:void 0,version:"8.0.28 "},n)},getWindowInfo:function(){return Xe()},getSetting:function(){return{authSetting:{"scope.userInfo":!0},subscriptionsSetting:{},miniprogramAuthSetting:{"scope.userInfo":!0}}},getNetworkType:function(){return{networkType:"wifi",signalStrength:100,hasSystemProxy:!1}}};function Xe(){return p()&&"web_hd_inner"!==(w().extType||"")?function(e){b()?(e.screenWidth=e.windowWidth||window.innerWidth||e.screenWidth,e.screenHeight=e.windowHeight||window.innerHeight||e.screenHeight):(e.screenWidth=e.windowWidth||window.innerWidth,e.screenHeight=e.windowHeight||window.innerHeight);return e}(_e({apiName:"getWindowInfo",params:{}})):$e()}var Qe={showTabBar:function(e){return Te.emit("showTabBar",e),{errMsg:"showTabBar:ok"}},hideTabBar:function(e){return Te.emit("hideTabBar",e),{errMsg:"hideTabBar:ok"}},setTabBarStyle:function(e){return Te.emit("setTabBarStyle",e),{errMsg:"setTabBarStyle:ok"}},setTabBarItem:function(e){return Te.emit("setTabBarItem",e),{errMsg:"setTabBarItem:ok"}},setTabBarBadge:function(e){return Te.emit("setTabBarBadge",e),{errMsg:"setTabBarBadge:ok"}},removeTabBarBadge:function(e){return Te.emit("removeTabBarBadge",e),{errMsg:"removeTabBarBadge:ok"}},hideTabBarRedDot:function(e){return Te.emit("hideTabBarRedDot",e),{errMsg:"hideTabBarRedDot:ok"}},showTabBarRedDot:function(e){return Te.emit("showTabBarRedDot",e),{errMsg:"showTabBarRedDot:ok"}}},Ye="insertHTMLWebView",Ze="onWebviewLoad",Je={insertHTMLWebView:function(e,n,t,r){Cn.initNextWebView(Cn.currPage,e.src,e.src).el.addEventListener("load",(function(){Z(Ze,{webviewId:r},r),J(te+"pageonshow",{})})),Z(Ye,e,r)},invokeMiniProgramAPI:function(e,n){console.log(e,n);var t=e.name,r=e.arg,o=yn[t];null!=o&&o(r,n)},postMessage:function(e,n){Z("onBindMessage",e,Cn.currPage.webviewId),ie(n,{errMsg:"postMessage:ok"})},canGoBack:function(e,n){ie(n,{errMsg:"canGoBack:fail default to fail"})},canNavigateBack:function(e,n){var t=!1;Cn.allPages.length>1&&(t=!0),ie(n,{errMsg:"canNavigateBack:"+(t?"ok":"fail")})}},en={},nn="onAd";function tn(e){var n=e.type,t=e.adUnitId,r=en[t];if(null!=r)return r;if("rewardedVideo"===n)r=function(e){var n=e.adUnitId,t=_e({apiName:"createRewardedVideoAd",params:{adUnitId:n}});return t.onLoad((function(e){Z(nn,{method:"onLoad",adUnitId:n,data:e})})),t.onClose((function(e){Z(nn,{method:"onClose",adUnitId:n,data:e})})),t.onError((function(e){Z(nn,{method:"onError",adUnitId:n,data:e})})),t}(e);return null!=r&&(en[t]=r),r}var rn={ad:function(e,n){return c(void 0,void 0,void 0,(function(){var t,r,o,i;return d(this,(function(a){switch(a.label){case 0:if(t=e.method,e.adUnitId,r=e.type,null==(o=tn(e)))return oe(n,{errMsg:"ad:fail 获取"+r+"广告实例失败"}),[2];a.label=1;case 1:switch(a.trys.push([1,12,,13]),t){case"load":return[3,2];case"destroy":return[3,4];case"show":return[3,6];case"hide":return[3,8]}return[3,10];case 2:return[4,o.load()];case 3:return a.sent(),[3,11];case 4:return[4,o.destroy()];case 5:return a.sent(),[3,11];case 6:return[4,o.show()];case 7:return a.sent(),[3,11];case 8:return[4,o.hide()];case 9:return a.sent(),[3,11];case 10:throw new Error("unsupported method: "+t);case 11:return oe(n,{errMsg:"ad:ok"}),[3,13];case 12:return i=a.sent(),oe(n,{errMsg:"ad:fail adInstance."+t+" call fail, "+(i.mssage||"unknown")}),[3,13];case 13:return[2]}}))}))}},on={appDataChange:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):(!function(e){var n=u({},e.data),t=ke(n.options.path);t&&(n.windowConfig=t),n.pages=Cn.allPages,Te.emit("appDataChange",n)}(n),Y(o,n,r))},__updateAppData:function(e){var n,t,r;n={},t=Cn.currPage.pagePath.replace(/\.html$/,""),null!=(r=ke(t))&&(n.windowConfig=r),n.pages=Cn.allPages,n.currPage=t,Te.emit("updateAppData",n)}};var an={canvasInsert:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},canvasRemove:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},CANVAS_EVENT_V2:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},onCanvasPreloadImage:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},onCanvasGetImageData:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},onCanvasPutImageData:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},canvasActionsChanged:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},invokeCanvasToDataUrl:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},invokeCanvasPutImageData:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},invokeCanvasGetImageData:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},getImageBase64:function(e){var n=e.params;e.from,e.webviewIds;var t,r=e.event,o=e.webviewId,i=n.src;ve(/^https?:\/\//.test(t=i)||/^hyfile:\/\//.test(t)?t:M+t,{responseType:"arraybuffer"},(function(e,n){if(null!=e)return"";var t=h(n),a=function(e){var n,t=e.split("/"),r=null===(n=t[t.length-1])||void 0===n?void 0:n.split("."),o=r[0],i=r[1];if(null==i||""==i)throw new Error("url:"+e+"格式错误,无法获取文件信息");return{filename:o,ext:i}}(i);Y(r,{src:i,data:"data:image/"+a.ext+";base64,"+t},[o])}))}};function sn(e,n){e.message=n+" stack: "+(null==e?void 0:e.message),Te.emit("closeLaunchMask"),yn.showToast({title:"加载游戏脚本超时"}),I.error("load game.js error",e.message),Se.captureLoadGameEntryError(e)}var un={gameServiceReady:function(){!function(e){c(this,void 0,void 0,(function(){var n,t,r,o;return d(this,(function(i){switch(i.label){case 0:if(n=window.__deviceOrientation,t=qe(),r="string"==typeof n&&n.includes("landscape"),!("landscape"!==t&&r&&p()&&b()))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,_(5e3,new Promise((function(e){var n=ne();_e({apiName:"setDeviceOrientation",params:{value:"landscape"}}),n.$events.once("onDeviceOrientationChange",(function(n){"landscape"===n.value&&e(!0)}))})))];case 2:return i.sent(),e(),[3,4];case 3:return o=i.sent(),e(o),[3,4];case 4:return[3,6];case 5:e(),i.label=6;case 6:return[2]}}))}))}((function(e){null==e?Ve((function(){I.log("load game.js"),function(){c(this,void 0,void 0,(function(){function e(){return c(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,Q().loadSubBundle("","game.js")];case 1:return e.sent(),Te.emit("closeLaunchMask"),[2]}}))}))}return d(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,_(18e3,e())];case 1:return n.sent(),[3,3];case 2:return sn(n.sent(),"entry"),[3,3];case 3:return[2]}}))}))}()})):sn(e,"deviceOrientation")}))},gameConfigUpdate:function(e){var n=e.params;Pe({windowInfo:yn.getWindowInfo(),wxConfig:n})}},cn=new(function(){function e(){this.reportedFirstScreenTime=!1}return e.prototype.reportFirstScreenTime=function(e){if(!this.reportedFirstScreenTime){var n=window.performanceInfo;null!=n&&(n.firstScreenTime=e),this.reportedFirstScreenTime=!0}},e}()),dn=new(function(){function e(){this.inited=!1,this.__startTime=Date.now(),this.isServiceReady=!1,this.isViewReady=!1,this.showedFirstPage=!1}return Object.defineProperty(e.prototype,"allReady",{get:function(){return this.isViewReady&&this.isServiceReady},enumerable:!1,configurable:!0}),e.prototype.init=function(e){this.inited||(this.inited=!0,this.initIframes(),I.info("initLauncher "+e+" consume: "+(Date.now()-this.__startTime)+"ms"))},e.prototype.initIframes=function(){var e=Q(),n=X();e.updateSrc("./service.html"),n.updateSrc("first")},e.prototype.handleServiceStart=function(e){var n=e.params;Ae=n,Pe({wxConfig:n,windowInfo:yn.getWindowInfo()}),Te.emit("serviceStart",n)},e.prototype.handleServiceReady=function(e){var n=this,t=Q();if(!t.isReady){this.root=e.params.root,this.firstWebviewId=e.webviewIds[0],this.isServiceReady=!0;var r=this.firstWebviewId;t.events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:n.root,openType:"appLaunch",options:void 0,pipMode:"",query:void 0,webviewId:n.firstWebviewId},n.firstWebviewId)})),Z("onServiceReadyDone",u(u({},B),{webviewId:r}),r),t.isReady=!0,this.launchPageShow()}},e.prototype.showPage=function(){var e=Cn.currPage;null!=e&&(e.isReady=!0,e.injectScript(),e.show(),this.showedFirstPage||(this.showedFirstPage=!0))},e.prototype.handleViewReady=function(){this.isViewReady=!0,this.showedFirstPage?this.showPage():this.launchPageShow()},e.prototype.handleViewDOMContentLoaded=function(e){var n=e.from,t=Q();n===O&&(Z("DOMContentLoaded",{},Cn.currPage.webviewId),t.events.emit(G.onViewDOMContentLoaded)),Te.emit("closeLaunchMask")},e.prototype.launchPageShow=function(){if(this.allReady){!function(e,n){var t=function(e){var n=e.tabBar;return null==n||0===(n.list||[]).length?[e.root]:n.list.map((function(e){return e.pagePath}))}(e);Cn.initFirstPage(t,e.root,n)}(Ie(),X()),Cn.initSlotWebviewId(this.firstWebviewId),this.showPage();var e=Date.now(),n=e-this.__startTime;cn.reportFirstScreenTime(e),I.info("init page consume time: "+n+"ms")}},e}()),ln={serviceStart:function(e){dn.handleServiceStart(e)},onLaunchCalled:function(e){},serviceReady:function(e){dn.handleServiceReady(e)},DOMContentLoaded:function(e){dn.handleViewDOMContentLoaded(e)},viewReady:function(){dn.handleViewReady()},DOMReady:function(){}},fn={info:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},log:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},warn:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},error:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},initLogs:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},clearLogs:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},onViewLogEvent:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)}},pn={INVOKE_METHOD:function(e){var n=e.params,t=e.from,r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},pageonshow:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;t===O?console.error("not implement for "+t):Y(o,n,r)},pageonhide:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;t===O?console.error("not implement for "+t):(Y(o,n,r),J(o,n))},requestLoadFontFace:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;t===O?console.error("not implement for "+t):Y(o,n,r)},requestLoadGlobalFontFaces:function(e){var n=e.params,t=e.from,r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},responseLoadGlobalFontFaces:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;t===O?console.error("not implement for "+t):Y(o,n,r)}};function vn(e){return"string"==typeof e?JSON.parse(e):e}function hn(e){return JSON.parse(JSON.stringify(e))}var _n={SPECIAL_PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},setKeyboardValue:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},vdSync:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event,i=e.webviewId;t===O?Z(o,hn(n),i):Y(o,hn(n),r)},vdSyncBatch:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event,i=e.webviewId;t===O?Z(o,hn(n),i):Y(o,hn(n),r)}},mn={videoPlayerInsertFinish:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},videoActionChanged:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)}},gn={openTypeEvent:function(e){var n=e.event,t=e.params,r=e.from,o=e.webviewId;"view"===r&&Z(n,t,o)},openTypeEventCallback:function(e){var n=e.event,t=e.params,r=e.from,o=e.webviewIds;"service"===r&&Y(n,t,o)}},wn=u(u(u(u(u(u(u(u(u({},un),ln),an),on),fn),pn),_n),mn),gn),yn=u(u(u(u(u(u(u(u(u(u(u(u(u({},Me),ye),He),Ne),Ce),Ue),ze),De),Qe),Je),fe),Ee),rn);function bn(e){var n,t=e.replace(te,""),r=wn[t];if(null==r){var o=/^video_(.*)_actionChanged$/.test(n=t)?"videoActionChanged":/^canvas(.*)actionsChanged$/.test(n)?"canvasActionsChanged":/^invokeCanvasToDataUrl_(.*)$/.test(n)?"invokeCanvasToDataUrl":/^onCanvasToDataUrl_(.*)$/.test(n)?"onCanvasToDataUrl":/^invokeCanvasPutImageData_(.*)$/.test(n)?"invokeCanvasPutImageData":/^onCanvasPutImageData_(.*)$/.test(n)?"onCanvasPutImageData":/^invokeCanvasGetImageData_(.*)$/.test(n)?"invokeCanvasGetImageData":/^onCanvasGetImageData_(.*)$/.test(n)?"onCanvasGetImageData":n;return{handler:wn[o]||null,formatedEvent:o}}return{handler:r,formatedEvent:t}}var Sn={invokeHandler:function(e){I.debug("invokeHander",e);var n=e.C,t=e.from,r=e.paramsString,o=e.webviewId,i=e.callbackId,a=vn(r),s=yn[n];if(null!=s){var u=s(a,i,t,o);return u&&u instanceof Promise?void 0:u}var c=ne();if(null!=c)return c.invokeHandler({apiName:n,params:a,callbackId:i,from:t})},publishHandler:function(e){I.debug("publishHandler",e);var n=e.event,t=e.from,r=e.paramsString,o=e.webviewId,i=e.webviewIds,a=bn(n),s=a.handler,u=a.formatedEvent,c=vn(r);if(null!=s)s({event:n,params:c,from:t,webviewId:o,webviewIds:F===t&&i?vn(i):void 0});else{var d=ne();null!=d&&d.publishHandler({formatedEvent:u,event:n,params:c,from:t})}},webInvokeHandler:function(e){E&&console.log("webInvokeHander",e),ie(e.callbackId,vn(e.paramsString))},webPublishHandler:function(e){E&&console.log("webPublishHandler",e),J(e.event,vn(e.paramsString))}};var An=[],In=function(e){An.push(e.el.src)},kn=function(e){An.pop()},Tn=function(){function e(){this.block=!1,this.queue=[]}return e.prototype.collect=function(e){var n=this;this.block?this.queue.push(e):(this.block=!0,this.queue.push(e),this.timer=setTimeout((function(){n.block=!1,clearTimeout(n.timer),n.comsume()})))},e.prototype.comsume=function(){var e=this.queue;if(this.queue=[],1===e.length)e[0]();else for(var n=0;n<e.length;n++)e[n]()},e}();var xn=function(e){function n(n){var t=e.call(this,n)||this;return t.webviewId=null,t.pagePath="",t.wrapper=null,t.isDestoryed=!1,t.active=!1,t.__isWebView=!1,t.tickQueue=new Tn,t}return s(n,e),Object.defineProperty(n.prototype,"isWebView",{get:function(){return this.__isWebView},set:function(e){this.__isWebView=e,e?In(this):kn(this)},enumerable:!1,configurable:!0}),n.prototype.appendContainer=function(){var e=this.el;e.className="webview",e.setAttribute("frameborder","0"),this.hide();var n=document.getElementById("webview-container");this.wrapper=n,null!=n&&n.appendChild(e)},n.prototype.show=function(){var e=this.el;e.style.zIndex="2",e.style.opacity="1",this.active=!0,Pn(this,"show")},n.prototype.hide=function(){var e=this.el;e.style.zIndex="1",e.style.opacity="0",this.active=!1,Pn(this,"hide")},n.prototype.updateWebviewId=function(e){this.webviewId=e,this.updateId()},n.prototype.updateId=function(){this.el.id="webview-"+this.webviewId},n.prototype.updateSrc=function(e,n){void 0===n&&(n=C),this.el.src=n,this.pagePath=e},n.prototype.updatePagePath=function(e){this.pagePath=e},n.prototype.injectScript=function(){var e=this.getWindow();if(null!=e&&""!=this.pagePath){var n=this.pagePath.replace(/\.html$/g,""),t=function(e){var n=e.pagePath;return"\n <script>\n var __path__ = '"+e.path+"';\n document.title = __path__;\n document.dispatchEvent(new CustomEvent(\"generateFuncReady\", {\n detail: {\n generateFunc: $gfc('"+n+".wxml') || $gfc('"+n+".hyml')\n }\n }))\n <\/script> \n "}({pagePath:"./"+n,path:n});e.injectHtml(e.document.body,{content:t})}},n.prototype.getBridge=function(){return this.getWindow().FinChatJSBridge},n.prototype.sendToView=function(e,n){var t=this;this.sync?(I.debug("%c "+e,{data:n,webviewId:this.webviewId}),this.getBridge().subscribeHandler(e,n,this.webviewId)):this.tickQueue.collect((function(){I.debug("%c "+e,{data:n,webviewId:t.webviewId}),t.getBridge().subscribeHandler(e,n,t.webviewId)}))},n.prototype.postMessageToWebView=function(e){var n;I.debug("%c postMessageToWebView",e),null===(n=this.el.contentWindow)||void 0===n||n.postMessage(e,"*")},n.prototype.destory=function(){null!==this.wrapper&&this.wrapper.removeChild(this.el),this.el=null,this.wrapper=null,this.isDestoryed=!0,this.active=!1,this.isWebView=!1,Pn(this,"destory")},n}(j);function Pn(e,n){e.isVHost&&e.children&&e.children.length>0&&e.children.forEach((function(e){e[n]()}))}function Mn(e,n){return e._slots.findIndex((function(e){return e===n.replace(/\.html$/,"")}))}var Cn=new(function(){function e(){this._slotStack=[],this._extraStack=[],this._slots=[],this._webviewId=0,this.rootIndex=0}return Object.defineProperty(e.prototype,"pagePath",{get:function(){var e;return(null===(e=this.currPage)||void 0===e?void 0:e.pagePath)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.stack[this.stack.length-2]||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.stack[this.stack.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stack",{get:function(){var e=this._slotStack[this.rootIndex];return null==e?[]:l([e],this._extraStack)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allPages",{get:function(){var e=this._slotStack[this.rootIndex];return null==e?[]:l([e],this._extraStack.slice(0,this._extraStack.length-1))},enumerable:!1,configurable:!0}),e.prototype.popExtraStack=function(){var e=this._extraStack,n=e.pop(),t=e.pop();return n&&e.push(n),t},e.prototype.resetExtraStack=function(){if(0!==this._extraStack.length){var e=this.top;this._extraStack.slice(0,this._extraStack.length-1).forEach((function(e){e.destory()})),this._extraStack=[e]}},e.prototype.initFirstPage=function(e,n,t){if(!Array.isArray(e)||0===e.length)throw new Error("slots must exist.");var r=Mn(this,n);r>-1&&(this.rootIndex=r),this._slots=e;for(var o=0;o<e.length;o++){var i=void 0;if(t&&o===this.rootIndex)i=t;else{var a=document.createElement("iframe");(i=new xn(a)).appendContainer()}i&&this._slotStack.push(i)}var s=this._slotStack[this.rootIndex];t?s.updatePagePath(n):s.updateSrc(n),this.initEmptyPage()},e.prototype.initEmptyPage=function(){var e=document.createElement("iframe"),n=new xn(e);n.appendContainer(),this._extraStack.push(n)},e.prototype.initNextPage=function(e,n){var t=this.currPage,r=this.top;return t.hide(),r.updateSrc(e,n),r.updateWebviewId(this._webviewId++),this.initEmptyPage(),r},e.prototype.initNextWebView=function(e,n,t){var r=this.initNextPage(n,t),o=this._extraStack.findIndex((function(e){return e.pagePath===n}));return o>-1&&this._extraStack.splice(o,1),e.children=[r],e.isVHost=!0,r.el.setAttribute("sandbox","allow-same-origin allow-scripts"),r.isWebView=!0,r.show(),r},e.prototype.initSlotWebviewId=function(e){this._webviewId=e,this._slotStack[this.rootIndex].updateWebviewId(this._webviewId++)},e.prototype.reinitPages=function(e){var n=this._slotStack,t=this._extraStack;n.forEach((function(e){e.destory()})),t.forEach((function(e){e.destory()})),this._slotStack=[],this._extraStack=[],this.initFirstPage(this._slots,e),this.currPage.updateWebviewId(this._webviewId++)},e.prototype.reLaunch=function(e){this.reinitPages(e)},e.prototype.redirectTo=function(e){if(Mn(this,e)>-1)throw new Error("不允许跳转到 tabbar 页面:"+e);var n=this._extraStack;if(n.length>1){var t=n.pop();n.pop().destory(),t.updateSrc(e),t.updateWebviewId(this._webviewId++),n.push(t),this.initEmptyPage()}else{null==(t=n.pop())||t.destory(),this._slotStack.forEach((function(e){e.destory()})),this.reinitPages(e)}},e.prototype.switch=function(e,n){n=null!=n?n:Mn(this,e);var t=this._slotStack,r=t[n];if(null==r)throw new Error("switchTab url is invalid: "+e);return this.resetExtraStack(),t.forEach((function(e){e.isReady&&e.hide()})),this.rootIndex=n,r.isReady?r.show():(r.updateWebviewId(this._webviewId++),r.updateSrc(e)),r},e.prototype.go=function(e){var n=Mn(this,e);return n>-1?this.switch(e,n):this.initNextPage(e)},e.prototype.back=function(e){var n,t=this._extraStack.slice(),r=t.pop(),o=t.length;if(e<=0)throw new Error("delta 不能 <= 0");if(o<e)throw new Error("delta 不能超过总栈长度:"+(o+1));var i=o-e,a=t.slice(0,i);(t.slice(i,o).forEach((function(e){e.destory()})),a.length>0)?a[a.length-1].show():null===(n=this._slotStack[this.rootIndex])||void 0===n||n.show();r&&a.push(r),this._extraStack=a},e}()),En=function(){function e(){this._invokeServiceCallbackHandler=oe,this._dispatchViewEvent=Y,this._dispatchServiceEvent=Z,this.$events=new i,this._getCurrentPage=function(){return Cn.currPage},this._getAllPages=function(){return Cn.allPages}}return e.prototype.init=function(){ee=this},e}(),Fn=o((function(e,n){
|
42
|
+
function(){var e;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return n="number"!=typeof n?s[1]:n,t="number"!=typeof t?s[2]:t,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof e?s:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=(e=Howl.prototype.init,function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}),Howl.prototype.stereo=function(e,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(e,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof e)return r._stereo;r._stereo=e,r._pos=[e,0,0]}for(var i=r._getSoundIds(t),a=0;a<i.length;a++){var s=r._soundById(i[a]);if(s){if("number"!=typeof e)return s._stereo;s._stereo=e,s._pos=[e,0,0],s._node&&(s._pannerAttr.panningModel="equalpower",s._panner&&s._panner.pan||n(s,o),"spatial"===o?void 0!==s._panner.positionX?(s._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),s._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),s._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):s._panner.setPosition(e,0,0):s._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),r._emit("stereo",s._id)}}return r},Howl.prototype.pos=function(e,t,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"pos",action:function(){i.pos(e,t,r,o)}}),i;if(t="number"!=typeof t?0:t,r="number"!=typeof r?-.5:r,void 0===o){if("number"!=typeof e)return i._pos;i._pos=[e,t,r]}for(var a=i._getSoundIds(o),s=0;s<a.length;s++){var u=i._soundById(a[s]);if(u){if("number"!=typeof e)return u._pos;u._pos=[e,t,r],u._node&&(u._panner&&!u._panner.pan||n(u,"spatial"),void 0!==u._panner.positionX?(u._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(t,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setPosition(e,t,r)),i._emit("pos",u._id)}}return i},Howl.prototype.orientation=function(e,t,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"orientation",action:function(){i.orientation(e,t,r,o)}}),i;if(t="number"!=typeof t?i._orientation[1]:t,r="number"!=typeof r?i._orientation[2]:r,void 0===o){if("number"!=typeof e)return i._orientation;i._orientation=[e,t,r]}for(var a=i._getSoundIds(o),s=0;s<a.length;s++){var u=i._soundById(a[s]);if(u){if("number"!=typeof e)return u._orientation;u._orientation=[e,t,r],u._node&&(u._panner||(u._pos||(u._pos=i._pos||[0,0,-.5]),n(u,"spatial")),void 0!==u._panner.orientationX?(u._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(t,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setOrientation(e,t,r)),i._emit("orientation",u._id)}}return i},Howl.prototype.pannerAttr=function(){var e,t,r,o=this,i=arguments;if(!o._webAudio)return o;if(0===i.length)return o._pannerAttr;if(1===i.length){if("object"!=typeof i[0])return(r=o._soundById(parseInt(i[0],10)))?r._pannerAttr:o._pannerAttr;e=i[0],void 0===t&&(e.pannerAttr||(e.pannerAttr={coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}),o._pannerAttr={coneInnerAngle:void 0!==e.pannerAttr.coneInnerAngle?e.pannerAttr.coneInnerAngle:o._coneInnerAngle,coneOuterAngle:void 0!==e.pannerAttr.coneOuterAngle?e.pannerAttr.coneOuterAngle:o._coneOuterAngle,coneOuterGain:void 0!==e.pannerAttr.coneOuterGain?e.pannerAttr.coneOuterGain:o._coneOuterGain,distanceModel:void 0!==e.pannerAttr.distanceModel?e.pannerAttr.distanceModel:o._distanceModel,maxDistance:void 0!==e.pannerAttr.maxDistance?e.pannerAttr.maxDistance:o._maxDistance,refDistance:void 0!==e.pannerAttr.refDistance?e.pannerAttr.refDistance:o._refDistance,rolloffFactor:void 0!==e.pannerAttr.rolloffFactor?e.pannerAttr.rolloffFactor:o._rolloffFactor,panningModel:void 0!==e.pannerAttr.panningModel?e.pannerAttr.panningModel:o._panningModel})}else 2===i.length&&(e=i[0],t=parseInt(i[1],10));for(var a=o._getSoundIds(t),s=0;s<a.length;s++)if(r=o._soundById(a[s])){var u=r._pannerAttr;u={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:u.coneOuterAngle,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:u.coneOuterGain,distanceModel:void 0!==e.distanceModel?e.distanceModel:u.distanceModel,maxDistance:void 0!==e.maxDistance?e.maxDistance:u.maxDistance,refDistance:void 0!==e.refDistance?e.refDistance:u.refDistance,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:u.rolloffFactor,panningModel:void 0!==e.panningModel?e.panningModel:u.panningModel};var c=r._panner;c||(r._pos||(r._pos=o._pos||[0,0,-.5]),n(r,"spatial"),c=r._panner),c.coneInnerAngle=u.coneInnerAngle,c.coneOuterAngle=u.coneOuterAngle,c.coneOuterGain=u.coneOuterGain,c.distanceModel=u.distanceModel,c.maxDistance=u.maxDistance,c.refDistance=u.refDistance,c.rolloffFactor=u.rolloffFactor,c.panningModel=u.panningModel}return o},Sound.prototype.init=function(e){return function(){var n=this,t=n._parent;n._orientation=t._orientation,n._stereo=t._stereo,n._pos=t._pos,n._pannerAttr=t._pannerAttr,e.call(this),n._stereo?t.stereo(n._stereo):n._pos&&t.pos(n._pos[0],n._pos[1],n._pos[2],n._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var n=this,t=n._parent;return n._orientation=t._orientation,n._stereo=t._stereo,n._pos=t._pos,n._pannerAttr=t._pannerAttr,n._stereo?t.stereo(n._stereo):n._pos?t.pos(n._pos[0],n._pos[1],n._pos[2],n._id):n._panner&&(n._panner.disconnect(0),n._panner=void 0,t._refreshBuffer(n)),e.call(this)}}(Sound.prototype.reset);var n=function(e,n){"spatial"===(n=n||"spatial")?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,void 0!==e._panner.positionX?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),void 0!==e._panner.orientationX?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}}()}));function oe(e,n,t){z(K).invokeCallbackHandler(e,n,t)}function ie(e,n,t){var r,o=null===(r=Ln.currPage)||void 0===r?void 0:r.children;if(Array.isArray(o)&&o.length>0){var i=o[0];i&&i.isWebView&&i.postMessageToWebView({callbackId:e,type:"webInvokeCallbackHandler",params:n})}}var ae={},se={};function ue(e,n){var t=ae[e],r=se[e];return null!=t?""!=n.src&&r!=n.src?(t.unload(),delete ae[e],delete se[e],ue(e,n)):t:(se[e]=n.src,ae[e]=function(e,n){var t=new re.Howl({autoplay:e.autoplay,loop:e.loop,src:e.src,rate:e.playbackRate,onend:function(){Z(le,{innerAudioContextId:n,method:de.onEnded,data:{}})},onplay:function(){Z(le,{innerAudioContextId:n,method:de.onPlay,data:{buffered:0,currentTime:0,duration:0}})},onpause:function(e){Z(le,{innerAudioContextId:e,method:de.onPause,data:{}})},onstop:function(){Z(le,{innerAudioContextId:n,method:de.onStop,data:{}})},onseek:function(){Z(le,{innerAudioContextId:n,method:de.onSeeked,data:{}})},onplayerror:function(e,n){Z(le,{innerAudioContextId:e,method:de.onError,data:{errMsg:"播放失败 :"+n,errCode:-1}})},onloaderror:function(e,n){Z(le,{innerAudioContextId:e,method:de.onError,data:{errMsg:"播放失败 :"+n,errCode:10002}})},onrate:function(e){console.log("audio进度改变")},onload:function(){Z(le,{innerAudioContextId:n,method:de.onCanplay,data:{}})}});return t}(n,e))}function ce(e,n,t){var r=ae[n];if(null==r){var o=e+":fail 无法找到innerAudioContextId:"+n+"对应的audio实例";throw oe(t,{errMsg:o}),new Error(o)}return r}re.Howler.autoSuspend=!1;var de={onCanplay:"onCanplay",onEnded:"onEnded",onError:"onError",onPause:"onPause",onPlay:"onPlay",onSeeked:"onSeeked",onSeeking:"onSeeking",onStop:"onStop",onTimeUpdate:"onTimeUpdate",onWaiting:"onWaiting"},le="onInnerAudio";var fe={innerAudio:function(e,n){var t,r=e.method,o=e.data,i=e.innerAudioContextId;switch(r){case"create":break;case"play":(t=ue(i,o)).loop(o.loop),t.volume(o.volume),o.isPlayMethod&&t.play();break;case"stop":ce(r,i,n).stop();break;case"seek":(t=ce(r,i,n)).seek(o.position);break;case"pause":ce(r,i,n).pause();break;case"destroy":ce(r,i,n).unload();break;default:throw new Error("无法处理音频method:"+r)}return{errMsg:"innerAudio:ok"}}};function pe(e){return/^http(s?)\:\/\//.test(e)}function ve(e,n,t){var r=new XMLHttpRequest,o=!0;if(null!=n.sync&&(o=!n.sync),null!=n.responseType&&(r.responseType=n.responseType),r.open("GET",e,o),null!=n.header)for(var i in n.header)r.setRequestHeader(i,n.header[i]);r.onload=function(e){t(null,r.response,{e:e,xhr:r})},r.onerror=function(e){t(new Error("request settings failed!"),null,{e:e,xhr:r})},r.send(null)}var he={readFileSync:function(e){var n,t=e.filePath;if(t.startsWith(N))return{data:null,errMsg:"readFileSync:fail not support local file."};t=pe(t=(n=t).endsWith(".wasm")?n+".txt":n)?t:C+t;var r=null,o=null;return ve(t,{sync:!0},(function(e,n){r=n,o=e})),null!=r?{data:r,errMsg:"readFileSync:ok"}:null!=o?{data:null,errMsg:"readFileSync:fail "+o.message}:{data:null,errMsg:"readFileSync:fail"}},readFile:function(e,n){var t=e.filePath,r="base64"===e.encoding,o=pe(t)?t:C+t;t.startsWith(N)?oe(n,{errMsg:"readFile:fail not support local file: "+t}):ve(o,{responseType:r?"arraybuffer":""},(function(e,t){oe(n,null==e?{data:r?h(t):t,errMsg:"readFile:ok"}:{errMsg:"readFile:fail "+e.message})}))},access:function(){return{errMsg:"access:ok"}},rename:function(){return{errMsg:"rename:ok"}},mkdirSync:function(){return{errMsg:"mkdirSync:ok"}},writeFile:function(){return{errMsg:"writeFile:ok"}},writeFileSync:function(e){return e.filePath,e.data,{errMsg:"writeFileSync:ok"}},unlink:function(e,n){return e.filePath,{errMsg:"unlink:ok"}},downloadFile:function(e,n){var t=e.url,r=e.timeout,o=void 0===r?6e3:r;e.taskId,e.header,e.filePath,_(o,function(e){var n=e.url,t=e.callbackId;return e.filePath,e.header,c(this,void 0,void 0,(function(){return d(this,(function(e){return Z(D,{cookies:[],progress:100,totalBytesExpectedToWrite:100,totalBytesWritten:100}),Z(H,{cookies:[],header:{}}),oe(t,{filePath:n,tempFilePath:n,profile:[],statusCode:200,errMsg:"downloadFile:ok"}),[2]}))}))}({url:t,callbackId:n}),(function(e){oe(n,{errMsg:"downloadFile:fail timeout in "+e+"ms."})}))},copyFile:function(e,n){return e.srcPath,e.destPath,oe(n,{errMsg:"copyFile:ok fake subpport."},"copyFile")}};function _e(e){return ne().invokeHandler({callbackId:e.callbackId||-1,apiName:e.apiName,params:e.params,from:"service"})}var me,ge,we,ye=R?he:(me=he,ge={readFileSync:{onMobile:be},readFile:{onMobile:be},access:{onMobile:be},rename:{onCallBefore:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e.shift();return t&&t.fatNewPath&&(t.newPath=t.fatNewPath,delete t.fatNewPath),t&&e.unshift(t),e}},downloadFile:{onCallBefore:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0];if(null!=t){var r=t.header;if(r&&r.Referer)throw new Error("header不能设置Referer字段");t.source="miniGame"}return e}}},we=ge||{},Object.keys(me).reduce((function(e,n){var t=me[n];return e[n]=function(){for(var e,r,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var a=p(),s=we[n],u={callNativeApi:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _e({apiName:n,params:e[0],callbackId:e[1]})},callPatchApi:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.apply(void 0,e)}};try{return s&&"function"==typeof s.onCallBefore&&(o=(e=s.onCallBefore).call.apply(e,l([u],o))),a?s&&"function"==typeof s.onMobile?(r=s.onMobile).call.apply(r,l([u],o)):u.callNativeApi.apply(u,o):u.callPatchApi.apply(u,o)}catch(e){return{errMsg:n+":fail error occured in polyfill api, "+e.message}}},e}),{}));function be(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0],r=t.filePath||t.path,o=this;return r.startsWith(V)?o.callNativeApi.apply(o,e):o.callPatchApi.apply(o,e)}var Se=new(function(){function e(){this.reportedEventType=new Set(["ErrorType"])}return Object.defineProperty(e.prototype,"sentry",{get:function(){return window.Sentry},enumerable:!1,configurable:!0}),e.prototype.captureException=function(e,n){var t=this.sentry;if(null!=t){var r=n.event_desc;delete n.event_desc,t.captureException(function(e,n){var t=new Error,r=e.charAt(0).toUpperCase()+e.slice(1),o=function(e){try{return JSON.parse(e)}catch(n){return e}}(n);"string"==typeof o?(t.stack=o,t.message=o):(t.message=r+": "+o.msg,t.stack=o.stack);return t}(e,r))}else console.log("Sentry is not ready yet.")},e.prototype.captureLoadGameEntryError=function(e){Se.captureException("LoadGameEntryError",{event_desc:"load game entry bundle fail: \n"+e.message+"\n"+e.stack})},e}()),Ae=null;function Ie(){if(null==Ae)throw new Error("WxConfig is not ready.");return Ae}function ke(e){var n=Ie(),t=n.windows.pages;return null!=t&&t[e]?Object.assign({},n.window,t[e]):null}var Te=new i;function xe(){Te.on("NavigatorBarTools:onMore",(function(){In.showToast({title:"暂未实现该功能"})})),Te.on("NavigatorBarTools:onClose",(function(){var e=ne();null!=e&&e.invokeHandler({callbackId:-1,apiName:"exitMiniProgram",params:{},from:"service"})})),Te.on("NavigatorBar:onBack",(function(){Ne.navigateBack({delta:1}),console.log("onBack")})),Te.on("TabBar:change",(function(e){var n,t,r;Z("onTabItemTap",{index:e.index,pagePath:e.item.pagePath,text:e.item.text}),Ne.switchTab({url:e.item.pagePath},-1),n=e.item.pagePath,t={},null!=(r=ke(n))&&(t.windowConfig=r),Te.emit("tabItemChanged",t)})),Te.on("invokeCallbackHandler",(function(e){oe(e.callbackId,e.data)})),Te.on("dispatchServiceEvent",(function(e){Z(e.event,e.payload)}))}function Pe(e){void 0!==window.__initWebFrame&&window.__initWebFrame(e,Te)}var Ce={getGlobalVariables:function(e){return"_launchOption"===e.variable?{_launchOption:B}:null},onWindowResize:function(){},offWindowResize:function(){},reportApmMonitor:function(e){var n=e.eventName,t=e.payload,r=e.eventType;e.timestamp,Se.reportedEventType.has(r)?Se.captureException(n,t):"LogReport"===r&&t.event},addPerformance:function(e){},initReady:function(){},updateAppData:function(){},injectHtmlCallback:function(e,n,t){"service"===t&&Q().events.emit(G.onInjectHTMLCallback)},pageScrollTo:function(e,n){var t=e.scrollTop;e.duration;var r=Ln.currPage.getWindow();return null==r||r.scrollTo({top:t,behavior:"smooth"}),{errMsg:"pageScrollTo:ok"}},getMenuButtonBoundingClientRect:function(e,n){Te.emit("getMenuButtonBoundingClientRect",e,n)},getAccountInfoSync:function(){var e=window.__extInfo;return{data:{miniProgram:u(u({},e),{appId:null==e?void 0:e.extUuid,envVersion:null==e?void 0:e.envVersion,version:"",forceUsePatchApi:R}),plugin:{appId:"",version:""}}}},jssdkConfig:function(e,n){var t=e.jsApiList,r=[];if((void 0===t?[]:t).forEach((function(e){null==In[e]&&r.push(e)})),!(r.length>0))return ie(n,{errMsg:"jssdkConfig:ok"});ie(n,{errMsg:"jssdkConfig:fail "+r.join(",")+" 未实现."})}},Me={hideToast:function(e){return Te.emit("hideToast",e),{errMsg:"hideToast:ok"}},showToast:function(e){return Te.emit("showToast",e),{errMsg:"showToast:ok"}},showLoading:function(e){return Te.emit("showLoading",e),{errMsg:"showLoading:ok"}},hideLoading:function(e){return Te.emit("hideLoading",e),{errMsg:"hideLoading:ok"}},showModal:function(e,n){Te.emit("showModal",e,n)},showActionSheet:function(e,n){Te.emit("showActionSheet",e,n)}},Ee={showGameKeyboard:function(e){return p()?_e({apiName:"showGameKeyboard",params:e}):Te.emit("showKeyboard",e),{}},hideGameKeyboard:function(e){return p()||Te.emit("hideKeyboard",e),{}},updateGameKeyboard:function(e){return p()||Te.emit("updateKeyboard",e),{}},showKeyboard:function(e){return p()?_e({apiName:"showGameKeyboard",params:e}):Te.emit("showKeyboard",e),{}},hideKeyboard:function(e){return Te.emit("hideKeyboard",e),{}},updateKeyboard:function(e){return Te.emit("updateKeyboard",e),{}}};function Fe(e,n){if(e===W)return'<script charset="utf-8" src="'+n.moduleName+'game.js"><\/script>';if("miniProgram"===e)return n.content;throw Error("unsupported projectType: "+e)}var Oe=function(e){function n(n){return e.call(this,u(u({},n),{projectType:W}))||this}return s(n,e),n.prototype.injectScript=function(){var e=z(K).getWindow();e.injectHtml(e.document.body,{content:Fe(this.projectType,{moduleName:this.moduleName})})},n.prototype.getEntry=function(){return e=this.projectType,n={moduleName:this.moduleName},e===W?n.moduleName+"game.js":"";var e,n},n}(function(){function e(e){this.taskId=e.taskId,this.moduleName=e.moduleName,this.projectType=e.projectType,this.status="none"}return e.prototype.notifyProgressUpdate=function(e,n){Z("onLoadSubPackageTaskStateChange",u({moduleName:this.moduleName,state:e,taskId:this.taskId},n))},e.prototype.injectScript=function(){},e.prototype.getEntry=function(){},e.prototype.load=function(e,n){return c(this,void 0,void 0,(function(){return d(this,(function(e){return this.notifyProgressUpdate("progressUpdate",{progress:0}),this.notifyProgressUpdate("progressUpdate",{progress:50}),this.injectScript(),this.notifyProgressUpdate("progressUpdate",{progress:100}),[2]}))}))},e}()),Le=0,Be={},De={createLoadSubPackageTask:function(e,n){var t=e.moduleName,r=Be[t];if(r&&"success"===r.status)return{errMsg:"createLoadSubPackageTask:fail sub package already loaded."};++Le;var o=String(Le);return r=new Oe({taskId:o,moduleName:t}),Q().events.once(G.onInjectHTMLCallback,(function(){r.status="success",r.notifyProgressUpdate("success",{entryPath:r.getEntry()})})),Be[t]=r,r.load(o,n),{errMsg:"createLoadSubPackageTask:ok",loadTaskId:Le}}},He={showNavigationBarLoading:function(){return Te.emit("showNavigationBarLoading"),{errMsg:"showNavigationBarLoading:ok"}},setNavigationBarTitle:function(e){return Te.emit("setNavigationBarTitle",e),{errMsg:"setNavigationBarTitle:ok"}},setNavigationBarColor:function(e){return Te.emit("setNavigationBarColor",e),{errMsg:"setNavigationBarColor:ok"}},hideNavigationBarLoading:function(){return Te.emit("hideNavigationBarLoading"),{errMsg:"hideNavigationBarLoading:ok"}},hideHomeButton:function(){}};function We(e,n){var t,r=function(e){e=e.replace(/\.html$/,"");var n=Ie(),t=n.subpackages;if(Array.isArray(t)&&t.length>0)return t.find((function(n){return n.pageFullPath.includes(e)}));return null}(e);null==r||(t=r.root,U[t])?n():function(e,n){var t=z(K);t.events.once(G.onInjectHTMLCallback,n),t.loadSubBundle(e.root,e.packageName+".js")}(r,n)}var Ne={navigateTo:function(e,n){var t=e.url;if(Ln.stack.length>10)return{errMsg:"navigateTo:fail 已到达页面栈上限:10。"};var r=v(t),o=r.path,i=r.query;return We(o,(function(){var e=Ln.go(o);Q().events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:o,openType:"navigateTo",options:void 0,pipMode:"",query:i,webviewId:e.webviewId},e.webviewId)}))})),{errMsg:"navigateTo:ok"}},navigateBack:function(e){var n=e.delta;try{Ln.back(n)}catch(e){return{errMsg:"navigateBack:fail "+e.message}}var t=Ln.currPage;return Z("onAppRoute",{path:t.pagePath,openType:"navigateBack",options:{delta:n},pipMode:"",query:void 0,webviewId:t.webviewId},t.webviewId),{errMsg:"navigateBack:ok"}},reLaunch:function(e,n){var t=e.url,r=v(t),o=r.path,i=r.query;We(o,(function(){Ln.reLaunch(t);var e=Ln.currPage;Q().events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:o,openType:"reLaunch",options:void 0,pipMode:"",query:i,webviewId:e.webviewId},e.webviewId),oe(n,{errMsg:"reLaunch:ok"})}))}))},redirectTo:function(e,n){var t=v(e.url),r=t.path,o=t.query;We(r,(function(){try{Ln.redirectTo(r)}catch(e){return void oe(n,{errMsg:"redirectTo:fail "+e.message})}var e=Ln.currPage;Q().events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:r,openType:"redirectTo",options:void 0,pipMode:"",query:o,webviewId:e.webviewId},e.webviewId),oe(n,{errMsg:"redirectTo:ok"})}))}))},switchTab:function(e,n){var t=v(e.url),r=t.path,o=t.query;We(r,(function(){try{Ln.switch(r)}catch(e){return void oe(n,{errMsg:"switchTab:fail "+e.message})}var e=Ln.currPage;e.isReady?(Z("onAppRoute",{path:r,openType:"switchTab",options:void 0,pipMode:"",query:o,webviewId:e.webviewId},e.webviewId),oe(n,{errMsg:"switchTab:ok"})):Q().events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:r,openType:"switchTab",options:void 0,pipMode:"",query:o,webviewId:e.webviewId},e.webviewId),oe(n,{errMsg:"switchTab:ok"})}))}))}};function Ve(e){setTimeout(e,16)}function Re(e){var n=y();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return n+"-"+e}function je(e){var n=y();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return e.replace(new RegExp("^"+n+"-"),"")}function Ge(e){return Number((e/1024).toFixed(2))}var Ue={getStorageSync:function(e){return{data:localStorage.getItem(Re(e.key))||null}},getStorage:function(e,n){Ve((function(){oe(n,{data:Ue.getStorageSync(e)})}))},setStorageSync:function(e){return localStorage.setItem(Re(e.key),e.data),{errMsg:"setStorageSync:ok"}},setStorage:function(e,n){Ve((function(){localStorage.setItem(e.key,e.data),oe(n,{errMsg:"setStorage:ok"})}))},removeStorageSync:function(e){return localStorage.removeItem(Re(e.key)),{errMsg:"removeStorageSync:ok"}},removeStorage:function(e,n){Ve((function(){localStorage.removeItem(Re(e.key)),oe(n,{errMsg:"removeStorage:ok"})}))},clearStorageSync:function(){return localStorage.clear(),{errMsg:"clearStorageSync:ok"}},clearStorage:function(e,n){Ve((function(){localStorage.clear(),oe(n,{errMsg:"clearStorage:ok"})}))},getStorageInfoSync:function(){var e=function(){var e=0,n=[];for(var t in localStorage)Object.prototype.hasOwnProperty.call(localStorage,t)&&(e+=localStorage[t].length,n.push(je(t)));return{size:e,keys:n}}(),n=e.size;return{keys:e.keys,currentSize:Ge(n),limitSize:Ge(10485760)}},getStorageInfo:function(e,n){Ve((function(){oe(n,u(u({},Ue.getStorageInfoSync()),{errMsg:"getStorageInfo:ok"}))}))}};function qe(){var e=f();return("Android"===e||"IOS"===e)&&window.matchMedia("(orientation: portrait)").matches?"portrait":"landscape"}function Ke(){var e,n,t,r=null===(e=Ln.currPage)||void 0===e?void 0:e.getWindow();if(null!=r){var o=r.document;return(null===(n=o.documentElement)||void 0===n?void 0:n.scrollTop)||(null===(t=o.body)||void 0===t?void 0:t.scrollTop)||0}return 0}function $e(){return u(u({patch:!0},(e=window.innerWidth||375,n=window.innerHeight||375,t=f().toLocaleLowerCase().includes("window")?0:50,r=window.devicePixelRatio||2,{screenWidth:e,screenHeight:n,statusBarHeight:t,devicePixelRatio:r,pixelRatio:r,windowHeight:n,windowWidth:e,safeArea:{height:n-t,widows:e,top:t,left:0,right:0}})),{scrollY:Ke()});var e,n,t,r}var ze={onMemoryWarning:function(){console.warn("The onMemoryWarning api is not implement.")},showShareMenu:function(){console.warn("The showShareMenu api is not implement.")},getSystemInfoSync:function(){var e,n=Xe(),t=qe(),r=f(),o=(e=w().extType||"").startsWith("app_")?f().toLowerCase():e.startsWith("pc_")?"pc":"web";return I.info("getSystemInfoSync",{windowInfo:n,deviceOrientation:t,system:r,platform:o}),u({deviceOrientation:t,SDKVersion:"1.0.0",appVersion:"12.1.0",batteryLevel:98,benchmarkLevel:1,bluetoothEnabled:!1,brand:"huya",cameraAuthorized:!1,deviceId:"none",enableDebug:!1,fontSizeSetting:15,frameworkVersion:"1.0.0",inHUYA:!0,language:"zh_CN",locationAuthorized:!1,locationEnabled:!1,microphoneAuthorized:!0,mode:"default",model:"none",notificationAuthorized:!0,platform:o,system:r,theme:void 0,version:"8.0.28 "},n)},getWindowInfo:function(){return Xe()},getSetting:function(){return{authSetting:{"scope.userInfo":!0},subscriptionsSetting:{},miniprogramAuthSetting:{"scope.userInfo":!0}}},getNetworkType:function(){return{networkType:"wifi",signalStrength:100,hasSystemProxy:!1}}};function Xe(){return p()&&"web_hd_inner"!==(w().extType||"")?function(e){b()?(e.screenWidth=e.windowWidth||window.innerWidth||e.screenWidth,e.screenHeight=e.windowHeight||window.innerHeight||e.screenHeight):(e.screenWidth=e.windowWidth||window.innerWidth,e.screenHeight=e.windowHeight||window.innerHeight);return e}(_e({apiName:"getWindowInfo",params:{}})):$e()}var Qe={showTabBar:function(e){return Te.emit("showTabBar",e),{errMsg:"showTabBar:ok"}},hideTabBar:function(e){return Te.emit("hideTabBar",e),{errMsg:"hideTabBar:ok"}},setTabBarStyle:function(e){return Te.emit("setTabBarStyle",e),{errMsg:"setTabBarStyle:ok"}},setTabBarItem:function(e){return Te.emit("setTabBarItem",e),{errMsg:"setTabBarItem:ok"}},setTabBarBadge:function(e){return Te.emit("setTabBarBadge",e),{errMsg:"setTabBarBadge:ok"}},removeTabBarBadge:function(e){return Te.emit("removeTabBarBadge",e),{errMsg:"removeTabBarBadge:ok"}},hideTabBarRedDot:function(e){return Te.emit("hideTabBarRedDot",e),{errMsg:"hideTabBarRedDot:ok"}},showTabBarRedDot:function(e){return Te.emit("showTabBarRedDot",e),{errMsg:"showTabBarRedDot:ok"}}},Ye="insertHTMLWebView",Ze="onWebviewLoad",Je={insertHTMLWebView:function(e,n,t,r){Ln.initNextWebView(Ln.currPage,e.src,e.src).el.addEventListener("load",(function(){Z(Ze,{webviewId:r},r),J(te+"pageonshow",{})})),Z(Ye,e,r)},invokeMiniProgramAPI:function(e,n){console.log(e,n);var t=e.name,r=e.arg,o=In[t];null!=o&&o(r,n)},postMessage:function(e,n){Z("onBindMessage",e,Ln.currPage.webviewId),ie(n,{errMsg:"postMessage:ok"})},canGoBack:function(e,n){ie(n,{errMsg:"canGoBack:fail default to fail"})},canNavigateBack:function(e,n){var t=!1;Ln.allPages.length>1&&(t=!0),ie(n,{errMsg:"canNavigateBack:"+(t?"ok":"fail")})}},en={},nn="onAd";function tn(e){var n=e.type,t=e.adUnitId,r=en[t];if(null!=r)return r;if("rewardedVideo"===n)r=function(e){var n=e.adUnitId,t=_e({apiName:"createRewardedVideoAd",params:{adUnitId:n}});return t.onLoad((function(e){Z(nn,{method:"onLoad",adUnitId:n,data:e})})),t.onClose((function(e){Z(nn,{method:"onClose",adUnitId:n,data:e})})),t.onError((function(e){Z(nn,{method:"onError",adUnitId:n,data:e})})),t}(e);return null!=r&&(en[t]=r),r}var rn={ad:function(e,n){return c(void 0,void 0,void 0,(function(){var t,r,o,i;return d(this,(function(a){switch(a.label){case 0:if(t=e.method,e.adUnitId,r=e.type,null==(o=tn(e)))return oe(n,{errMsg:"ad:fail 获取"+r+"广告实例失败"}),[2];a.label=1;case 1:switch(a.trys.push([1,12,,13]),t){case"load":return[3,2];case"destroy":return[3,4];case"show":return[3,6];case"hide":return[3,8]}return[3,10];case 2:return[4,o.load()];case 3:return a.sent(),[3,11];case 4:return[4,o.destroy()];case 5:return a.sent(),[3,11];case 6:return[4,o.show()];case 7:return a.sent(),[3,11];case 8:return[4,o.hide()];case 9:return a.sent(),[3,11];case 10:throw new Error("unsupported method: "+t);case 11:return oe(n,{errMsg:"ad:ok"}),[3,13];case 12:return i=a.sent(),oe(n,{errMsg:"ad:fail adInstance."+t+" call fail, "+(i.mssage||"unknown")}),[3,13];case 13:return[2]}}))}))}},on="revue_clipboard",an="";function sn(e,n){return c(this,void 0,void 0,(function(){return d(this,(function(t){try{!function(e){if(!document.hasFocus())throw new Error("Failed to execute 'writeText' on 'Clipboard': Document is not focused.");var n=document.getElementById(on);if(null==n&&((n=document.createElement("textarea")).style.opacity="0",n.id=on,document.body.appendChild(n)),n)try{var t=n;an=t.textContent=e,t.select(),document.execCommand("copy"),document.body.removeChild(n)}catch(e){throw document.body.removeChild(n),e}}(e.data),oe(n,{errMsg:"setClipboardData:ok"})}catch(e){oe(n,{errMsg:"setClipboardData:fail "+e.message})}return[2]}))}))}var un={setClipboardData:function(e,n){sn(e,n)},getClipboardData:function(e,n){!function(e){c(this,void 0,void 0,(function(){return d(this,(function(n){try{oe(e,{errMsg:"getClipboardData:ok",data:an})}catch(n){oe(e,{errMsg:"getClipboardData:fail "+n.message})}return[2]}))}))}(n)}},cn={appDataChange:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):(!function(e){var n=u({},e.data),t=ke(n.options.path);t&&(n.windowConfig=t),n.pages=Ln.allPages,Te.emit("appDataChange",n)}(n),Y(o,n,r))},__updateAppData:function(e){var n,t,r;n={},t=Ln.currPage.pagePath.replace(/\.html$/,""),null!=(r=ke(t))&&(n.windowConfig=r),n.pages=Ln.allPages,n.currPage=t,Te.emit("updateAppData",n)}};var dn={canvasInsert:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},canvasRemove:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},CANVAS_EVENT_V2:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},onCanvasPreloadImage:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},onCanvasGetImageData:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},onCanvasPutImageData:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},canvasActionsChanged:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},invokeCanvasToDataUrl:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},invokeCanvasPutImageData:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},invokeCanvasGetImageData:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},getImageBase64:function(e){var n=e.params;e.from,e.webviewIds;var t,r=e.event,o=e.webviewId,i=n.src;ve(/^https?:\/\//.test(t=i)||/^hyfile:\/\//.test(t)?t:C+t,{responseType:"arraybuffer"},(function(e,n){if(null!=e)return"";var t=h(n),a=function(e){var n,t=e.split("/"),r=null===(n=t[t.length-1])||void 0===n?void 0:n.split("."),o=r[0],i=r[1];if(null==i||""==i)throw new Error("url:"+e+"格式错误,无法获取文件信息");return{filename:o,ext:i}}(i);Y(r,{src:i,data:"data:image/"+a.ext+";base64,"+t},[o])}))}};function ln(e,n){e.message=n+" stack: "+(null==e?void 0:e.message),Te.emit("closeLaunchMask"),In.showToast({title:"加载游戏脚本超时"}),I.error("load game.js error",e.message),Se.captureLoadGameEntryError(e)}var fn={gameServiceReady:function(){!function(e){c(this,void 0,void 0,(function(){var n,t,r,o;return d(this,(function(i){switch(i.label){case 0:if(n=window.__deviceOrientation,t=qe(),r="string"==typeof n&&n.includes("landscape"),!("landscape"!==t&&r&&p()&&b()))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,_(5e3,new Promise((function(e){var n=ne();_e({apiName:"setDeviceOrientation",params:{value:"landscape"}}),n.$events.once("onDeviceOrientationChange",(function(n){"landscape"===n.value&&e(!0)}))})))];case 2:return i.sent(),e(),[3,4];case 3:return o=i.sent(),e(o),[3,4];case 4:return[3,6];case 5:e(),i.label=6;case 6:return[2]}}))}))}((function(e){null==e?Ve((function(){I.log("load game.js"),function(){c(this,void 0,void 0,(function(){function e(){return c(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,Q().loadSubBundle("","game.js")];case 1:return e.sent(),Te.emit("closeLaunchMask"),[2]}}))}))}return d(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,_(18e3,e())];case 1:return n.sent(),[3,3];case 2:return ln(n.sent(),"entry"),[3,3];case 3:return[2]}}))}))}()})):ln(e,"deviceOrientation")}))},gameConfigUpdate:function(e){var n=e.params;Pe({windowInfo:In.getWindowInfo(),wxConfig:n})}},pn=new(function(){function e(){this.reportedFirstScreenTime=!1}return e.prototype.reportFirstScreenTime=function(e){if(!this.reportedFirstScreenTime){var n=window.performanceInfo;null!=n&&(n.firstScreenTime=e),this.reportedFirstScreenTime=!0}},e}()),vn=new(function(){function e(){this.inited=!1,this.__startTime=Date.now(),this.isServiceReady=!1,this.isViewReady=!1,this.showedFirstPage=!1}return Object.defineProperty(e.prototype,"allReady",{get:function(){return this.isViewReady&&this.isServiceReady},enumerable:!1,configurable:!0}),e.prototype.init=function(e){this.inited||(this.inited=!0,this.initIframes(),I.info("initLauncher "+e+" consume: "+(Date.now()-this.__startTime)+"ms"))},e.prototype.initIframes=function(){var e=Q(),n=X();e.updateSrc("./service.html"),n.updateSrc("first")},e.prototype.handleServiceStart=function(e){var n=e.params;Ae=n,Pe({wxConfig:n,windowInfo:In.getWindowInfo()}),Te.emit("serviceStart",n)},e.prototype.handleServiceReady=function(e){var n=this,t=Q();if(!t.isReady){this.root=e.params.root,this.firstWebviewId=e.webviewIds[0],this.isServiceReady=!0;var r=this.firstWebviewId;t.events.once(G.onViewDOMContentLoaded,(function(){Z("onAppRoute",{path:n.root,openType:"appLaunch",options:void 0,pipMode:"",query:void 0,webviewId:n.firstWebviewId},n.firstWebviewId)})),Z("onServiceReadyDone",u(u({},B),{webviewId:r}),r),t.isReady=!0,this.launchPageShow()}},e.prototype.showPage=function(){var e=Ln.currPage;null!=e&&(e.isReady=!0,e.injectScript(),e.show(),this.showedFirstPage||(this.showedFirstPage=!0))},e.prototype.handleViewReady=function(){this.isViewReady=!0,this.showedFirstPage?this.showPage():this.launchPageShow()},e.prototype.handleViewDOMContentLoaded=function(e){var n=e.from,t=Q();n===O&&(Z("DOMContentLoaded",{},Ln.currPage.webviewId),t.events.emit(G.onViewDOMContentLoaded)),Te.emit("closeLaunchMask")},e.prototype.launchPageShow=function(){if(this.allReady){!function(e,n){var t=function(e){var n=e.tabBar;return null==n||0===(n.list||[]).length?[e.root]:n.list.map((function(e){return e.pagePath}))}(e);Ln.initFirstPage(t,e.root,n)}(Ie(),X()),Ln.initSlotWebviewId(this.firstWebviewId),this.showPage();var e=Date.now(),n=e-this.__startTime;pn.reportFirstScreenTime(e),I.info("init page consume time: "+n+"ms")}},e}()),hn={serviceStart:function(e){vn.handleServiceStart(e)},onLaunchCalled:function(e){},serviceReady:function(e){vn.handleServiceReady(e)},DOMContentLoaded:function(e){vn.handleViewDOMContentLoaded(e)},viewReady:function(){vn.handleViewReady()},DOMReady:function(){}},_n={info:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},log:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},warn:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},error:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},initLogs:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},clearLogs:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},onViewLogEvent:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)}},mn={INVOKE_METHOD:function(e){var n=e.params,t=e.from,r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},pageonshow:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;t===O?console.error("not implement for "+t):Y(o,n,r)},pageonhide:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;t===O?console.error("not implement for "+t):(Y(o,n,r),J(o,n))},requestLoadFontFace:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;t===O?console.error("not implement for "+t):Y(o,n,r)},requestLoadGlobalFontFaces:function(e){var n=e.params,t=e.from,r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},responseLoadGlobalFontFaces:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;t===O?console.error("not implement for "+t):Y(o,n,r)}};function gn(e){return"string"==typeof e?JSON.parse(e):e}function wn(e){return JSON.parse(JSON.stringify(e))}var yn={SPECIAL_PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},setKeyboardValue:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)},PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},vdSync:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event,i=e.webviewId;t===O?Z(o,wn(n),i):Y(o,wn(n),r)},vdSyncBatch:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event,i=e.webviewId;t===O?Z(o,wn(n),i):Y(o,wn(n),r)}},bn={videoPlayerInsertFinish:function(e){var n=e.params,t=e.from;e.webviewIds;var r=e.event,o=e.webviewId;t===O?Z(r,n,o):console.error("not implement for "+t)},videoActionChanged:function(e){var n=e.params,t=e.from,r=e.webviewIds,o=e.event;e.webviewId,t===O?console.error("not implement for "+t):Y(o,n,r)}},Sn={openTypeEvent:function(e){var n=e.event,t=e.params,r=e.from,o=e.webviewId;"view"===r&&Z(n,t,o)},openTypeEventCallback:function(e){var n=e.event,t=e.params,r=e.from,o=e.webviewIds;"service"===r&&Y(n,t,o)}},An=u(u(u(u(u(u(u(u(u({},fn),hn),dn),cn),_n),mn),yn),bn),Sn),In=u(u(u(u(u(u(u(u(u(u(u(u(u(u({},Ce),ye),De),Ne),Me),Ue),ze),He),Qe),Je),fe),Ee),rn),un);function kn(e){var n,t=e.replace(te,""),r=An[t];if(null==r){var o=/^video_(.*)_actionChanged$/.test(n=t)?"videoActionChanged":/^canvas(.*)actionsChanged$/.test(n)?"canvasActionsChanged":/^invokeCanvasToDataUrl_(.*)$/.test(n)?"invokeCanvasToDataUrl":/^onCanvasToDataUrl_(.*)$/.test(n)?"onCanvasToDataUrl":/^invokeCanvasPutImageData_(.*)$/.test(n)?"invokeCanvasPutImageData":/^onCanvasPutImageData_(.*)$/.test(n)?"onCanvasPutImageData":/^invokeCanvasGetImageData_(.*)$/.test(n)?"invokeCanvasGetImageData":/^onCanvasGetImageData_(.*)$/.test(n)?"onCanvasGetImageData":n;return{handler:An[o]||null,formatedEvent:o}}return{handler:r,formatedEvent:t}}var Tn={invokeHandler:function(e){I.debug("invokeHander",e);var n=e.C,t=e.from,r=e.paramsString,o=e.webviewId,i=e.callbackId,a=gn(r),s=In[n];if(null!=s){var u=s(a,i,t,o);return u&&u instanceof Promise?void 0:u}var c=ne();if(null!=c)return c.invokeHandler({apiName:n,params:a,callbackId:i,from:t})},publishHandler:function(e){I.debug("publishHandler",e);var n=e.event,t=e.from,r=e.paramsString,o=e.webviewId,i=e.webviewIds,a=kn(n),s=a.handler,u=a.formatedEvent,c=gn(r);if(null!=s)s({event:n,params:c,from:t,webviewId:o,webviewIds:F===t&&i?gn(i):void 0});else{var d=ne();null!=d&&d.publishHandler({formatedEvent:u,event:n,params:c,from:t})}},webInvokeHandler:function(e){E&&console.log("webInvokeHander",e),ie(e.callbackId,gn(e.paramsString))},webPublishHandler:function(e){E&&console.log("webPublishHandler",e),J(e.event,gn(e.paramsString))}};var xn=[],Pn=function(e){xn.push(e.el.src)},Cn=function(e){xn.pop()},Mn=function(){function e(){this.block=!1,this.queue=[]}return e.prototype.collect=function(e){var n=this;this.block?this.queue.push(e):(this.block=!0,this.queue.push(e),this.timer=setTimeout((function(){n.block=!1,clearTimeout(n.timer),n.comsume()})))},e.prototype.comsume=function(){var e=this.queue;if(this.queue=[],1===e.length)e[0]();else for(var n=0;n<e.length;n++)e[n]()},e}();var En=function(e){function n(n){var t=e.call(this,n)||this;return t.webviewId=null,t.pagePath="",t.wrapper=null,t.isDestoryed=!1,t.active=!1,t.__isWebView=!1,t.tickQueue=new Mn,t}return s(n,e),Object.defineProperty(n.prototype,"isWebView",{get:function(){return this.__isWebView},set:function(e){this.__isWebView=e,e?Pn(this):Cn(this)},enumerable:!1,configurable:!0}),n.prototype.appendContainer=function(){var e=this.el;e.className="webview",e.setAttribute("frameborder","0"),this.hide();var n=document.getElementById("webview-container");this.wrapper=n,null!=n&&n.appendChild(e)},n.prototype.show=function(){var e=this.el;e.style.zIndex="2",e.style.opacity="1",this.active=!0,Fn(this,"show")},n.prototype.hide=function(){var e=this.el;e.style.zIndex="1",e.style.opacity="0",this.active=!1,Fn(this,"hide")},n.prototype.updateWebviewId=function(e){this.webviewId=e,this.updateId()},n.prototype.updateId=function(){this.el.id="webview-"+this.webviewId},n.prototype.updateSrc=function(e,n){void 0===n&&(n=M),this.el.src=n,this.pagePath=e},n.prototype.updatePagePath=function(e){this.pagePath=e},n.prototype.injectScript=function(){var e=this.getWindow();if(null!=e&&""!=this.pagePath){var n=this.pagePath.replace(/\.html$/g,""),t=function(e){var n=e.pagePath;return"\n <script>\n var __path__ = '"+e.path+"';\n document.title = __path__;\n document.dispatchEvent(new CustomEvent(\"generateFuncReady\", {\n detail: {\n generateFunc: $gfc('"+n+".wxml') || $gfc('"+n+".hyml')\n }\n }))\n <\/script> \n "}({pagePath:"./"+n,path:n});e.injectHtml(e.document.body,{content:t})}},n.prototype.getBridge=function(){return this.getWindow().FinChatJSBridge},n.prototype.sendToView=function(e,n){var t=this;this.sync?(I.debug("%c "+e,{data:n,webviewId:this.webviewId}),this.getBridge().subscribeHandler(e,n,this.webviewId)):this.tickQueue.collect((function(){I.debug("%c "+e,{data:n,webviewId:t.webviewId}),t.getBridge().subscribeHandler(e,n,t.webviewId)}))},n.prototype.postMessageToWebView=function(e){var n;I.debug("%c postMessageToWebView",e),null===(n=this.el.contentWindow)||void 0===n||n.postMessage(e,"*")},n.prototype.destory=function(){null!==this.wrapper&&this.wrapper.removeChild(this.el),this.el=null,this.wrapper=null,this.isDestoryed=!0,this.active=!1,this.isWebView=!1,Fn(this,"destory")},n}(j);function Fn(e,n){e.isVHost&&e.children&&e.children.length>0&&e.children.forEach((function(e){e[n]()}))}function On(e,n){return e._slots.findIndex((function(e){return e===n.replace(/\.html$/,"")}))}var Ln=new(function(){function e(){this._slotStack=[],this._extraStack=[],this._slots=[],this._webviewId=0,this.rootIndex=0}return Object.defineProperty(e.prototype,"pagePath",{get:function(){var e;return(null===(e=this.currPage)||void 0===e?void 0:e.pagePath)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.stack[this.stack.length-2]||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.stack[this.stack.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stack",{get:function(){var e=this._slotStack[this.rootIndex];return null==e?[]:l([e],this._extraStack)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allPages",{get:function(){var e=this._slotStack[this.rootIndex];return null==e?[]:l([e],this._extraStack.slice(0,this._extraStack.length-1))},enumerable:!1,configurable:!0}),e.prototype.popExtraStack=function(){var e=this._extraStack,n=e.pop(),t=e.pop();return n&&e.push(n),t},e.prototype.resetExtraStack=function(){if(0!==this._extraStack.length){var e=this.top;this._extraStack.slice(0,this._extraStack.length-1).forEach((function(e){e.destory()})),this._extraStack=[e]}},e.prototype.initFirstPage=function(e,n,t){if(!Array.isArray(e)||0===e.length)throw new Error("slots must exist.");var r=On(this,n);r>-1&&(this.rootIndex=r),this._slots=e;for(var o=0;o<e.length;o++){var i=void 0;if(t&&o===this.rootIndex)i=t;else{var a=document.createElement("iframe");(i=new En(a)).appendContainer()}i&&this._slotStack.push(i)}var s=this._slotStack[this.rootIndex];t?s.updatePagePath(n):s.updateSrc(n),this.initEmptyPage()},e.prototype.initEmptyPage=function(){var e=document.createElement("iframe"),n=new En(e);n.appendContainer(),this._extraStack.push(n)},e.prototype.initNextPage=function(e,n){var t=this.currPage,r=this.top;return t.hide(),r.updateSrc(e,n),r.updateWebviewId(this._webviewId++),this.initEmptyPage(),r},e.prototype.initNextWebView=function(e,n,t){var r=this.initNextPage(n,t),o=this._extraStack.findIndex((function(e){return e.pagePath===n}));return o>-1&&this._extraStack.splice(o,1),e.children=[r],e.isVHost=!0,r.el.setAttribute("sandbox","allow-same-origin allow-scripts"),r.isWebView=!0,r.show(),r},e.prototype.initSlotWebviewId=function(e){this._webviewId=e,this._slotStack[this.rootIndex].updateWebviewId(this._webviewId++)},e.prototype.reinitPages=function(e){var n=this._slotStack,t=this._extraStack;n.forEach((function(e){e.destory()})),t.forEach((function(e){e.destory()})),this._slotStack=[],this._extraStack=[],this.initFirstPage(this._slots,e),this.currPage.updateWebviewId(this._webviewId++)},e.prototype.reLaunch=function(e){this.reinitPages(e)},e.prototype.redirectTo=function(e){if(On(this,e)>-1)throw new Error("不允许跳转到 tabbar 页面:"+e);var n=this._extraStack;if(n.length>1){var t=n.pop();n.pop().destory(),t.updateSrc(e),t.updateWebviewId(this._webviewId++),n.push(t),this.initEmptyPage()}else{null==(t=n.pop())||t.destory(),this._slotStack.forEach((function(e){e.destory()})),this.reinitPages(e)}},e.prototype.switch=function(e,n){n=null!=n?n:On(this,e);var t=this._slotStack,r=t[n];if(null==r)throw new Error("switchTab url is invalid: "+e);return this.resetExtraStack(),t.forEach((function(e){e.isReady&&e.hide()})),this.rootIndex=n,r.isReady?r.show():(r.updateWebviewId(this._webviewId++),r.updateSrc(e)),r},e.prototype.go=function(e){var n=On(this,e);return n>-1?this.switch(e,n):this.initNextPage(e)},e.prototype.back=function(e){var n,t=this._extraStack.slice(),r=t.pop(),o=t.length;if(e<=0)throw new Error("delta 不能 <= 0");if(o<e)throw new Error("delta 不能超过总栈长度:"+(o+1));var i=o-e,a=t.slice(0,i);(t.slice(i,o).forEach((function(e){e.destory()})),a.length>0)?a[a.length-1].show():null===(n=this._slotStack[this.rootIndex])||void 0===n||n.show();r&&a.push(r),this._extraStack=a},e}()),Bn=function(){function e(){this._invokeServiceCallbackHandler=oe,this._dispatchViewEvent=Y,this._dispatchServiceEvent=Z,this.$events=new i,this._getCurrentPage=function(){return Ln.currPage},this._getAllPages=function(){return Ln.allPages}}return e.prototype.init=function(){ee=this},e}(),Dn=o((function(e,n){
|
43
43
|
/*!
|
44
44
|
* @revues/hyext-adapter
|
45
45
|
* (c) 2024-2024 Alex
|
@@ -60,4 +60,4 @@ function(){var e;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._ori
|
|
60
60
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
61
61
|
PERFORMANCE OF THIS SOFTWARE.
|
62
62
|
***************************************************************************** */
|
63
|
-
var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},t(e,n)},r=function(){return r=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},r.apply(this,arguments)};function o(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}u((r=r.apply(e,n||[])).next())}))}function i(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var a=function(){function e(){this._queue=[],this._queue=[]}return e.prototype.regist=function(e){this._queue.push(e)},e.prototype.start=function(e){this._queue.forEach((function(n){try{n.call(null,e)}catch(e){}}))},e}(),s=new a,u=[];function c(e){u.length>0&&(u.forEach((function(n){var t=e[n.method];t&&t.apply(e,n.args)})),u=[])}var d=function(){function e(){}return e.init=function(e){this.logger=e},e.log=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(c(this.logger),(e=this.logger).log.apply(e,n)):u.push({method:"log",args:n})},e.info=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(c(this.logger),(e=this.logger).info.apply(e,n)):u.push({method:"info",args:n})},e.warn=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(c(this.logger),(e=this.logger).warn.apply(e,n)):u.push({method:"warn",args:n})},e.error=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(c(this.logger),(e=this.logger).error.apply(e,n)):u.push({method:"error",args:n})},e}();function l(e,n){return function(e,n){var t=e,r=0;if(t){for(;r<n.length;){if(!(t=t[n[r]]))return;r++}return t}}(e,n.split("."))}function f(e){return e&&"function"==typeof e.then}function p(e){var n=e.SDK,t=e.path;return function(e){var n=e.fun,t=e.genFun,r=e.sync,o=e.onCall,i=e.onSucc,a=e.onFail,s=e.onComplete;return function(){for(var e=[],u=0;u<arguments.length;u++)e[u]=arguments[u];var c=("object"==typeof e[0]?e[0]:{})||{},d=c.success,l=c.fail,p=c.complete,v=function(){s&&s(),p&&p()},h=function(e){return i&&i(e),d&&d(e),e},_=function(e){var n=a&&a(e)||e;return l&&l(n),n},m=function(){o&&o(e);var r=t&&t()||n;if(!r)throw new Error("polyfill caller is undefined");return r.apply(null,e)};if(r)try{var g=h(m());return v(),g}catch(e){var w=_(e);throw v(),w}return new Promise((function(e,n){try{var t=m();f(t)?t.then((function(n){return e(h(n))})).catch((function(e){return n(_(e))})).finally(v):(e(h(t)),v())}catch(e){n(_(e)),v()}}))}}({genFun:function(){var e=l(n,t);if(!e)throw new Error("SDK."+t+" is undefined");return e},sync:e.sync,onCall:e.onCall,onSucc:e.onSucc,onFail:e.onFail,onComplete:e.onComplete})}function v(e,n,t){return Object.defineProperty(e,n,{enumerable:!0,configurable:!1,writable:!0,value:t})}var h,_=function(e){var n=e.SDK,t=e.onFail,r=e.onCall,o=e.onSucc,i={},a=function(e,a){e&&e.length&&e.forEach((function(e){var s=e.split(".").pop();if(s)switch(a){case"consts":var u=l(n,e);u&&v(i,s,u);break;case"async":case"sync":var c=p({SDK:n,sync:"sync"===a,path:e,onCall:function(n){return r&&r(n,s,e)},onSucc:function(n){return o&&o(n,s,e)},onFail:function(n){return t&&t(n,s,e)}});v(i,s,c)}}))};return a(e.constants,"consts"),a(e.methods,"async"),a(e.syncMethods,"sync"),d.log("[hyext adapter] polyfillSDK",i),i}({SDK:hyExt,constants:["consts"],methods:["request","panel.disposal","context.login","context.checkSession","device.setOrientation","device.onOrientationChange","device.offOrientationChange","ad.createAd","ad.loadAd","ad.showAd","ad.destroyAd","ad.onAdMessage","ad.offAdMessage","context.requestPayment","fs.downloadFile","fs.access","fs.appendFile","fs.close","fs.copyFile","fs.getFileInfo","fs.getSavedFileList","fs.mkdir","fs.open","fs.read","fs.readCompressedFile","fs.readdir","fs.readFile","fs.readZipEntry","fs.unzip","fs.removeSavedFile","fs.rename","fs.rmdir","fs.saveFile","fs.stat","fs.truncate","fs.unlink","fs.write","fs.writeFile","fs.fstat","fs.ftruncate","ui.showNativeInputBar","advance.getCurrentUserInfo","onEnterForeground","onLeaveForeground","onAppear","onDisappear","device.lockOrientation","ui.showKeyboard","ui.hideKeyboard","ui.updateKeyboard","ui.onKeyboardInput","ui.onKeyboardConfirm","ui.onKeyboardComplete","ui.onKeyboardHeightChange"],syncMethods:["device.getWindowInfo","fs.accessSync","fs.appendFileSync","fs.closeSync","fs.copyFileSync","fs.mkdirSync","fs.openSync","fs.readSync","fs.readCompressedFileSync","fs.readdirSync","fs.readFileSync","fs.renameSync","fs.rmdirSync","fs.saveFileSync","fs.statSync","fs.truncateSync","fs.unlinkSync","fs.writeSync","fs.writeFileSync","fs.fstatSync","fs.ftruncateSync"],onCall:function(e,n,t){d.log("[Polyfill] call "+t+" start:",e)},onSucc:function(e,n,t){d.log("[Polyfill] call "+t+" succ:",e)},onFail:function(e,n,t){d.info("[Polyfill] call "+t+" fail:",e)}});!function(e){e.onLoad="onLoad",e.onClose="onClose",e.onError="onError"}(h||(h={}));var m=new(function(){function e(){this.events={},this.invoked=!1}return e.prototype.invoke=function(){var e=this;this.invoked||(_.onAdMessage({callback:function(n){var t=n.instanceId,r=n.eventName,o=n.res;e.emit(t,r,o)}}),this.invoked=!0)},e.prototype.clear=function(){_.offAdMessage(),Object.values(this.events).forEach((function(e){return e.removeAllListeners()})),this.events={},this.invoked=!1},e.prototype.create=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.createAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.show=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.showAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.load=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.loadAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.destroy=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.destroyAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.emit=function(e,n,t){this.events[e]&&n&&this.events[e].emit(n,t)},e.prototype.on=function(e,t,r){this.events[e]||(this.events[e]=new n.EventEmitter),this.events[e].on(t,r)},e.prototype.off=function(e,n,t){this.events[e]&&(n?t?this.events[e].off(n,t):this.events[e].removeAllListeners(n):this.events[e].removeAllListeners())},e}()),g=function(){function e(e){var n,t,r;m.invoke(),this._getInstance=(n=function(){return m.create(e)},r=!1,function(){for(var e=this,a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];return r?t:(r=!0,t=o(e,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,n.apply(void 0,a)];case 1:return[2,e.sent()];case 2:throw e.sent();case 3:return[2]}}))})))})}return e.prototype.show=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,[2,m.show({instanceId:e})]}}))}))},e.prototype.load=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,[2,m.load({instanceId:e})]}}))}))},e.prototype.destroy=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,m.off(e),[2,m.destroy({instanceId:e})]}}))}))},e.prototype.onLoad=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onLoad,e)})).catch((function(e){}))},e.prototype.onClose=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onClose,e)})).catch((function(e){}))},e.prototype.onError=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onError,e)})).catch((function(e){}))},e.prototype.offLoad=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onLoad,e)})).catch((function(e){}))},e.prototype.offClose=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onClose,e)})).catch((function(e){}))},e.prototype.offError=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onError,e)})).catch((function(e){}))},e}(),w=new(function(){function e(){this.isLandscape=!1}return e.prototype.changeOrientation=function(e){this.isLandscape=e},e.prototype.getWindowInfo=function(){try{var e=_.getWindowInfo();return d.info("getWindowInfo sync",e),e}catch(e){var n=Object.assign({safeArea:{left:0,right:0,top:0,bottom:0,width:0,height:0}},_.consts||{});return this.isLandscape?r(r({},n),{screenWidth:n.screenHeight,screenHeight:n.screenWidth,windowWidth:n.windowHeight,windowHeight:n.windowWidth,isLandscape:!0}):(n.isLandscape=!1,d.info("getWindowInfo consts",n),n)}},e}());s.regist((function(e){var n,t=e.emitter;n=window.navigator.userAgent.toLowerCase(),(/(iphone|ipad)/.test(n)||/android/.test(n))&&(d.log("[hyext adapter] device init"),_.onOrientationChange({callback:function(e){t({event:"onDeviceOrientationChange",data:e}),w.changeOrientation("landscape"===e.value)}}))}));var y={fn:function(e){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n=e.defaultValue,e.maxLength,e.multiple,e.confirmHold,e.confirmType,[4,_.showNativeInputBar({text:n,btnText:"确认"})];case 1:return[2,t.sent()]}}))}))},onAfterSuccess:function(e,n){e._dispatchServiceEvent("onKeyboardInput",{value:n.text}),"mask"===n.from?e._dispatchServiceEvent("onKeyboardComplete",{value:n.text}):e._dispatchServiceEvent("onKeyboardConfirm",{value:n.text})}},b=function(){return o(void 0,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,_.getCurrentUserInfo()];case 1:return[2,{userInfo:{nickName:(e=n.sent()).name,avatarUrl:e.avatarUrl},rawData:"",signature:"",encryptedData:"",iv:"",cloudID:""}]}}))}))},S={webapi_getuserinfo:function(e){return b()}};s.regist((function(e){var n=e.emitter;d.log("[hyext adapter] app event init"),_.onEnterForeground((function(){n({event:"onAppEnterForeground",data:{}})})),_.onAppear((function(){n({event:"onAppShow",data:{}})})),_.onDisappear((function(){n({event:"onAppHide",data:{}})}))}));var A,I=Object.freeze({__proto__:null,createRewardedVideoAd:function(e){return new g(e)},createInterstitialAd:function(e){return new g(e)},setDeviceOrientation:function(e){var n=e||{},t=n.value,r=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(n,["value"]);return r.orientation=t,_.setOrientation(r)},onDeviceOrientationChange:function(e){return _.onOrientationChange({callback:e})},offDeviceOrientationChange:function(e){return _.offOrientationChange()},getWindowInfo:function(){return w.getWindowInfo()},downloadFile:function(e){return o(this,void 0,void 0,(function(){var n,t,r,o,a;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),console.time("downloadFile url:"+e.url+",耗时:"),[4,_.downloadFile(e)];case 1:return n=i.sent(),console.timeEnd("downloadFile url:"+e.url+",耗时:"),r=(t=n||{}).tempFilePath,(o=t.filePath)||r?[2,{profile:{},statusCode:200,tempFilePath:r,filePath:o}]:[2,n];case 2:throw a=i.sent(),console.timeEnd("downloadFile url:"+e.url+"error:"+a.message),a;case 3:return[2]}}))}))},access:function(e){return _.access(e)},accessSync:function(e){return _.accessSync(e)},appendFile:function(e){return _.appendFile(e)},appendFileSync:function(e){return _.appendFileSync(e)},close:function(e){return _.close(e)},closeSync:function(e){return _.closeSync(e)},copyFile:function(e){return _.copyFile(e)},copyFileSync:function(e){return _.copyFileSync(e)},getFileInfo:function(e){return _.getFileInfo(e)},getSavedFileList:function(){return _.getSavedFileList()},mkdir:function(e){return _.mkdir(e)},mkdirSync:function(e){return _.mkdirSync(e)},open:function(e){return _.open(e)},openSync:function(e){return{data:_.openSync(e).fd}},read:function(e){return o(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,_.read(e)];case 1:return(n=t.sent()).arrayBuffer=n.originData,[2,n]}}))}))},readSync:function(e){var n=_.readSync(e);return n.arrayBuffer=n.originData,{data:n}},readCompressedFile:function(e){return o(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,_.readCompressedFile(e)];case 1:return[2,{data:(n=t.sent()).originData||n.data}]}}))}))},readCompressedFileSync:function(e){var n=_.readCompressedFileSync(e);return{data:n.originData||n.data}},readdir:function(e){return _.readdir(e)},readdirSync:function(e){return{data:_.readdirSync(e).files}},readFile:function(e){return o(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,_.readFile(e)];case 1:return(n=t.sent()).data=n.originData||n.data,[2,n]}}))}))},readFileSync:function(e){var n=_.readFileSync(e);return{data:n.originData||n.data}},readZipEntry:function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.readZipEntry(e)];case 1:return[2,n.sent()]}}))}))},unzip:function(e){return _.unzip(e)},removeSavedFile:function(e){return _.removeSavedFile(e)},rename:function(e){return _.rename(e)},renameSync:function(e){return _.renameSync(e)},rmdir:function(e){return _.rmdir(e)},rmdirSync:function(e){return _.rmdirSync(e)},saveFile:function(e){return _.saveFile(e)},saveFileSync:function(e){return{data:_.saveFileSync(e).savedFilePath}},stat:function(e){return _.stat(e)},statSync:function(e){return{data:_.statSync(e).stats}},truncate:function(e){return _.truncate(e)},truncateSync:function(e){return _.truncateSync(e)},unlink:function(e){return _.unlink(e)},unlinkSync:function(e){return _.unlinkSync(e)},write:function(e){return _.write(e)},writeSync:function(e){return{data:_.writeSync(e).bytesWritten}},writeFile:function(e){return _.writeFile(e)},writeFileSync:function(e){return _.writeFileSync(e)},fstat:function(e){return _.fstat(e)},fstatSync:function(e){return{data:_.fstatSync(e).stats}},ftruncate:function(e){return _.ftruncate(e)},ftruncateSync:function(e){return _.ftruncateSync(e)},exitMiniProgram:function(e){return _.disposal(e)},showGameKeyboard:y,hideGameKeyboard:function(){},updateGameKeyboard:function(e){},login:function(e){return _.login(e)},checkSession:function(e){return _.checkSession(e)},request:function(e){var n=e.data,t=e.dataType,r=e.header,o=e.method,i=e.url;return _.request({url:i,method:o,data:n,dataType:t,header:r})},getUserProfile:b,operateWXData:function(e){return o(this,void 0,void 0,(function(){var n,t,r,o;return i(this,(function(i){switch(i.label){case 0:return n=e.data,t=n.api_name,r=n.data,null==(o=S[t])?[3,2]:[4,o(r)];case 1:return[2,i.sent()];case 2:throw new Error("operateWXData:fail sdk not support "+t+" api.")}}))}))}}),k=(A={},function(e){var n=A[e];return null!=n?n:(n=function(e){var n=l(I,e);return n||_[e]||void 0}(e),A[e]=n)}),T=["enablePullDownRefresh","disablePullDownRefresh"];function x(e){var n=e.CoreAdapter,o=e.logger,i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,e),n.prototype.init=function(){var n=this;e.prototype.init.call(this),function(e,n){s.start(e),d.init(n)}({emitter:function(e){var t=e.event,r=e.data;o.debug("[hyext adapter] emit "+t,r),n._dispatchServiceEvent(t,r),n.$events.emit(t,r)}},o)},n.prototype.invokeHandler=function(e){var n=this,t=e.apiName,i=e.params,a=e.callbackId;if(!(T.indexOf(t)>-1)){o.debug("[hyext adapter] hyext call "+t,i);var s=function(e,n,t,o){try{var i=k(n);if(!i)throw new Error("The SDK API of "+n+" is not support yet.");var a=("function"==typeof i?i:i.fn).apply(null,t);if(!f(a))return a;a.then((function(t){o(r(r({},t||{}),{errMsg:n+":ok"})),i.onAfterSuccess&&i.onAfterSuccess(e,t)})).catch((function(t){t&&t.isCancel?(o({errMsg:n+":cancel"}),i.onAfterCancel&&i.onAfterCancel(e,t)):(o({errMsg:n+":fail "+t.message}),i.onAfterFail&&i.onAfterFail(e,t))}))}catch(e){return{errMsg:n+":fail "+e.message}}}(this,t,[i],(function(e){return o.debug("[hyext adapter] hyext callback "+t,e),n._invokeServiceCallbackHandler(a,e,t)}));return null!=s&&o.debug("[hyext adapter] hyext sync response "+t,s),s}},n.prototype.publishHandler=function(e){e.event,e.params,e.from,e.formatedEvent},n}(n);(new i).init()}window.__initAdapter=x,e.init=x,Object.defineProperty(e,"__esModule",{value:!0})}(n,t.default)}));function On(e){"miniProgram"===w().projectType&&dn.init(e)}window.addEventListener("message",(function(e){var n=e.data;if("object"==typeof n&&null!==n)switch(n.type){case"publish":Z(n.event,JSON.parse(n.paramsString));break;case"invoke":return Sn.invokeHandler(n)}})),window.addEventListener("resize",(function(){Z("onWindowResize",{size:{windowWidth:window.innerWidth,windowHeight:window.innerHeight}})})),window.FinChatJSCore=Sn,Fn.init({CoreAdapter:En,logger:I}),window.addEventListener("DOMContentLoaded",(function(){var e;e={windowInfo:yn.getWindowInfo(),extInfo:w()},void 0!==window.__initWebFrameOnContentLoad&&(xe(),window.__initWebFrameOnContentLoad(e,Te),b()&&ne().$events.on("onDeviceOrientationChange",(function(e){Te.emit("onDeviceOrientationChange",e)})))})),window.__preloadSuccess&&On("__preloadSuccess"),window.__handlePreloadLinkAllLoaded=function(){On("preloadReady")},window.addEventListener("load",(function(){On("windowLoadReady")}))}));
|
63
|
+
var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},t(e,n)},r=function(){return r=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},r.apply(this,arguments)};function o(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}u((r=r.apply(e,n||[])).next())}))}function i(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var a=function(){function e(){this._queue=[],this._queue=[]}return e.prototype.regist=function(e){this._queue.push(e)},e.prototype.start=function(e){this._queue.forEach((function(n){try{n.call(null,e)}catch(e){}}))},e}(),s=new a,u=[];function c(e){u.length>0&&(u.forEach((function(n){var t=e[n.method];t&&t.apply(e,n.args)})),u=[])}var d=function(){function e(){}return e.init=function(e){this.logger=e},e.log=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(c(this.logger),(e=this.logger).log.apply(e,n)):u.push({method:"log",args:n})},e.info=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(c(this.logger),(e=this.logger).info.apply(e,n)):u.push({method:"info",args:n})},e.warn=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(c(this.logger),(e=this.logger).warn.apply(e,n)):u.push({method:"warn",args:n})},e.error=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(c(this.logger),(e=this.logger).error.apply(e,n)):u.push({method:"error",args:n})},e}();function l(e,n){return function(e,n){var t=e,r=0;if(t){for(;r<n.length;){if(!(t=t[n[r]]))return;r++}return t}}(e,n.split("."))}function f(e){return e&&"function"==typeof e.then}function p(e){var n=e.SDK,t=e.path;return function(e){var n=e.fun,t=e.genFun,r=e.sync,o=e.onCall,i=e.onSucc,a=e.onFail,s=e.onComplete;return function(){for(var e=[],u=0;u<arguments.length;u++)e[u]=arguments[u];var c=("object"==typeof e[0]?e[0]:{})||{},d=c.success,l=c.fail,p=c.complete,v=function(){s&&s(),p&&p()},h=function(e){return i&&i(e),d&&d(e),e},_=function(e){var n=a&&a(e)||e;return l&&l(n),n},m=function(){o&&o(e);var r=t&&t()||n;if(!r)throw new Error("polyfill caller is undefined");return r.apply(null,e)};if(r)try{var g=h(m());return v(),g}catch(e){var w=_(e);throw v(),w}return new Promise((function(e,n){try{var t=m();f(t)?t.then((function(n){return e(h(n))})).catch((function(e){return n(_(e))})).finally(v):(e(h(t)),v())}catch(e){n(_(e)),v()}}))}}({genFun:function(){var e=l(n,t);if(!e)throw new Error("SDK."+t+" is undefined");return e},sync:e.sync,onCall:e.onCall,onSucc:e.onSucc,onFail:e.onFail,onComplete:e.onComplete})}function v(e,n,t){return Object.defineProperty(e,n,{enumerable:!0,configurable:!1,writable:!0,value:t})}var h,_=function(e){var n=e.SDK,t=e.onFail,r=e.onCall,o=e.onSucc,i={},a=function(e,a){e&&e.length&&e.forEach((function(e){var s=e.split(".").pop();if(s)switch(a){case"consts":var u=l(n,e);u&&v(i,s,u);break;case"async":case"sync":var c=p({SDK:n,sync:"sync"===a,path:e,onCall:function(n){return r&&r(n,s,e)},onSucc:function(n){return o&&o(n,s,e)},onFail:function(n){return t&&t(n,s,e)}});v(i,s,c)}}))};return a(e.constants,"consts"),a(e.methods,"async"),a(e.syncMethods,"sync"),d.log("[hyext adapter] polyfillSDK",i),i}({SDK:hyExt,constants:["consts"],methods:["request","panel.disposal","context.login","context.checkSession","device.setOrientation","device.onOrientationChange","device.offOrientationChange","ad.createAd","ad.loadAd","ad.showAd","ad.destroyAd","ad.onAdMessage","ad.offAdMessage","context.requestPayment","fs.downloadFile","fs.access","fs.appendFile","fs.close","fs.copyFile","fs.getFileInfo","fs.getSavedFileList","fs.mkdir","fs.open","fs.read","fs.readCompressedFile","fs.readdir","fs.readFile","fs.readZipEntry","fs.unzip","fs.removeSavedFile","fs.rename","fs.rmdir","fs.saveFile","fs.stat","fs.truncate","fs.unlink","fs.write","fs.writeFile","fs.fstat","fs.ftruncate","ui.showNativeInputBar","advance.getCurrentUserInfo","onEnterForeground","onLeaveForeground","onAppear","onDisappear","device.lockOrientation","ui.showKeyboard","ui.hideKeyboard","ui.updateKeyboard","ui.onKeyboardInput","ui.onKeyboardConfirm","ui.onKeyboardComplete","ui.onKeyboardHeightChange"],syncMethods:["device.getWindowInfo","fs.accessSync","fs.appendFileSync","fs.closeSync","fs.copyFileSync","fs.mkdirSync","fs.openSync","fs.readSync","fs.readCompressedFileSync","fs.readdirSync","fs.readFileSync","fs.renameSync","fs.rmdirSync","fs.saveFileSync","fs.statSync","fs.truncateSync","fs.unlinkSync","fs.writeSync","fs.writeFileSync","fs.fstatSync","fs.ftruncateSync"],onCall:function(e,n,t){d.log("[Polyfill] call "+t+" start:",e)},onSucc:function(e,n,t){d.log("[Polyfill] call "+t+" succ:",e)},onFail:function(e,n,t){d.info("[Polyfill] call "+t+" fail:",e)}});!function(e){e.onLoad="onLoad",e.onClose="onClose",e.onError="onError"}(h||(h={}));var m=new(function(){function e(){this.events={},this.invoked=!1}return e.prototype.invoke=function(){var e=this;this.invoked||(_.onAdMessage({callback:function(n){var t=n.instanceId,r=n.eventName,o=n.res;e.emit(t,r,o)}}),this.invoked=!0)},e.prototype.clear=function(){_.offAdMessage(),Object.values(this.events).forEach((function(e){return e.removeAllListeners()})),this.events={},this.invoked=!1},e.prototype.create=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.createAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.show=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.showAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.load=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.loadAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.destroy=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.destroyAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.emit=function(e,n,t){this.events[e]&&n&&this.events[e].emit(n,t)},e.prototype.on=function(e,t,r){this.events[e]||(this.events[e]=new n.EventEmitter),this.events[e].on(t,r)},e.prototype.off=function(e,n,t){this.events[e]&&(n?t?this.events[e].off(n,t):this.events[e].removeAllListeners(n):this.events[e].removeAllListeners())},e}()),g=function(){function e(e){var n,t,r;m.invoke(),this._getInstance=(n=function(){return m.create(e)},r=!1,function(){for(var e=this,a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];return r?t:(r=!0,t=o(e,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,n.apply(void 0,a)];case 1:return[2,e.sent()];case 2:throw e.sent();case 3:return[2]}}))})))})}return e.prototype.show=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,[2,m.show({instanceId:e})]}}))}))},e.prototype.load=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,[2,m.load({instanceId:e})]}}))}))},e.prototype.destroy=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,m.off(e),[2,m.destroy({instanceId:e})]}}))}))},e.prototype.onLoad=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onLoad,e)})).catch((function(e){}))},e.prototype.onClose=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onClose,e)})).catch((function(e){}))},e.prototype.onError=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onError,e)})).catch((function(e){}))},e.prototype.offLoad=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onLoad,e)})).catch((function(e){}))},e.prototype.offClose=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onClose,e)})).catch((function(e){}))},e.prototype.offError=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onError,e)})).catch((function(e){}))},e}(),w=new(function(){function e(){this.isLandscape=!1}return e.prototype.changeOrientation=function(e){this.isLandscape=e},e.prototype.getWindowInfo=function(){try{var e=_.getWindowInfo();return d.info("getWindowInfo sync",e),e}catch(e){var n=Object.assign({safeArea:{left:0,right:0,top:0,bottom:0,width:0,height:0}},_.consts||{});return this.isLandscape?r(r({},n),{screenWidth:n.screenHeight,screenHeight:n.screenWidth,windowWidth:n.windowHeight,windowHeight:n.windowWidth,isLandscape:!0}):(n.isLandscape=!1,d.info("getWindowInfo consts",n),n)}},e}());s.regist((function(e){var n,t=e.emitter;n=window.navigator.userAgent.toLowerCase(),(/(iphone|ipad)/.test(n)||/android/.test(n))&&(d.log("[hyext adapter] device init"),_.onOrientationChange({callback:function(e){t({event:"onDeviceOrientationChange",data:e}),w.changeOrientation("landscape"===e.value)}}))}));var y={fn:function(e){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n=e.defaultValue,e.maxLength,e.multiple,e.confirmHold,e.confirmType,[4,_.showNativeInputBar({text:n,btnText:"确认"})];case 1:return[2,t.sent()]}}))}))},onAfterSuccess:function(e,n){e._dispatchServiceEvent("onKeyboardInput",{value:n.text}),"mask"===n.from?e._dispatchServiceEvent("onKeyboardComplete",{value:n.text}):e._dispatchServiceEvent("onKeyboardConfirm",{value:n.text})}},b=function(){return o(void 0,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,_.getCurrentUserInfo()];case 1:return[2,{userInfo:{nickName:(e=n.sent()).name,avatarUrl:e.avatarUrl},rawData:"",signature:"",encryptedData:"",iv:"",cloudID:""}]}}))}))},S={webapi_getuserinfo:function(e){return b()}};s.regist((function(e){var n=e.emitter;d.log("[hyext adapter] app event init"),_.onEnterForeground((function(){n({event:"onAppEnterForeground",data:{}})})),_.onAppear((function(){n({event:"onAppShow",data:{}})})),_.onDisappear((function(){n({event:"onAppHide",data:{}})}))}));var A,I=Object.freeze({__proto__:null,createRewardedVideoAd:function(e){return new g(e)},createInterstitialAd:function(e){return new g(e)},setDeviceOrientation:function(e){var n=e||{},t=n.value,r=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(n,["value"]);return r.orientation=t,_.setOrientation(r)},onDeviceOrientationChange:function(e){return _.onOrientationChange({callback:e})},offDeviceOrientationChange:function(e){return _.offOrientationChange()},getWindowInfo:function(){return w.getWindowInfo()},downloadFile:function(e){return o(this,void 0,void 0,(function(){var n,t,r,o,a;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),console.time("downloadFile url:"+e.url+",耗时:"),[4,_.downloadFile(e)];case 1:return n=i.sent(),console.timeEnd("downloadFile url:"+e.url+",耗时:"),r=(t=n||{}).tempFilePath,(o=t.filePath)||r?[2,{profile:{},statusCode:200,tempFilePath:r,filePath:o}]:[2,n];case 2:throw a=i.sent(),console.timeEnd("downloadFile url:"+e.url+"error:"+a.message),a;case 3:return[2]}}))}))},access:function(e){return _.access(e)},accessSync:function(e){return _.accessSync(e)},appendFile:function(e){return _.appendFile(e)},appendFileSync:function(e){return _.appendFileSync(e)},close:function(e){return _.close(e)},closeSync:function(e){return _.closeSync(e)},copyFile:function(e){return _.copyFile(e)},copyFileSync:function(e){return _.copyFileSync(e)},getFileInfo:function(e){return _.getFileInfo(e)},getSavedFileList:function(){return _.getSavedFileList()},mkdir:function(e){return _.mkdir(e)},mkdirSync:function(e){return _.mkdirSync(e)},open:function(e){return _.open(e)},openSync:function(e){return{data:_.openSync(e).fd}},read:function(e){return o(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,_.read(e)];case 1:return(n=t.sent()).arrayBuffer=n.originData,[2,n]}}))}))},readSync:function(e){var n=_.readSync(e);return n.arrayBuffer=n.originData,{data:n}},readCompressedFile:function(e){return o(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,_.readCompressedFile(e)];case 1:return[2,{data:(n=t.sent()).originData||n.data}]}}))}))},readCompressedFileSync:function(e){var n=_.readCompressedFileSync(e);return{data:n.originData||n.data}},readdir:function(e){return _.readdir(e)},readdirSync:function(e){return{data:_.readdirSync(e).files}},readFile:function(e){return o(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,_.readFile(e)];case 1:return(n=t.sent()).data=n.originData||n.data,[2,n]}}))}))},readFileSync:function(e){var n=_.readFileSync(e);return{data:n.originData||n.data}},readZipEntry:function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,_.readZipEntry(e)];case 1:return[2,n.sent()]}}))}))},unzip:function(e){return _.unzip(e)},removeSavedFile:function(e){return _.removeSavedFile(e)},rename:function(e){return _.rename(e)},renameSync:function(e){return _.renameSync(e)},rmdir:function(e){return _.rmdir(e)},rmdirSync:function(e){return _.rmdirSync(e)},saveFile:function(e){return _.saveFile(e)},saveFileSync:function(e){return{data:_.saveFileSync(e).savedFilePath}},stat:function(e){return _.stat(e)},statSync:function(e){return{data:_.statSync(e).stats}},truncate:function(e){return _.truncate(e)},truncateSync:function(e){return _.truncateSync(e)},unlink:function(e){return _.unlink(e)},unlinkSync:function(e){return _.unlinkSync(e)},write:function(e){return _.write(e)},writeSync:function(e){return{data:_.writeSync(e).bytesWritten}},writeFile:function(e){return _.writeFile(e)},writeFileSync:function(e){return _.writeFileSync(e)},fstat:function(e){return _.fstat(e)},fstatSync:function(e){return{data:_.fstatSync(e).stats}},ftruncate:function(e){return _.ftruncate(e)},ftruncateSync:function(e){return _.ftruncateSync(e)},exitMiniProgram:function(e){return _.disposal(e)},showGameKeyboard:y,hideGameKeyboard:function(){},updateGameKeyboard:function(e){},login:function(e){return _.login(e)},checkSession:function(e){return _.checkSession(e)},request:function(e){var n=e.data,t=e.dataType,r=e.header,o=e.method,i=e.url;return _.request({url:i,method:o,data:n,dataType:t,header:r})},getUserProfile:b,operateWXData:function(e){return o(this,void 0,void 0,(function(){var n,t,r,o;return i(this,(function(i){switch(i.label){case 0:return n=e.data,t=n.api_name,r=n.data,null==(o=S[t])?[3,2]:[4,o(r)];case 1:return[2,i.sent()];case 2:throw new Error("operateWXData:fail sdk not support "+t+" api.")}}))}))}}),k=(A={},function(e){var n=A[e];return null!=n?n:(n=function(e){var n=l(I,e);return n||_[e]||void 0}(e),A[e]=n)}),T=["enablePullDownRefresh","disablePullDownRefresh"];function x(e){var n=e.CoreAdapter,o=e.logger,i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,e),n.prototype.init=function(){var n=this;e.prototype.init.call(this),function(e,n){s.start(e),d.init(n)}({emitter:function(e){var t=e.event,r=e.data;o.debug("[hyext adapter] emit "+t,r),n._dispatchServiceEvent(t,r),n.$events.emit(t,r)}},o)},n.prototype.invokeHandler=function(e){var n=this,t=e.apiName,i=e.params,a=e.callbackId;if(!(T.indexOf(t)>-1)){o.debug("[hyext adapter] hyext call "+t,i);var s=function(e,n,t,o){try{var i=k(n);if(!i)throw new Error("The SDK API of "+n+" is not support yet.");var a=("function"==typeof i?i:i.fn).apply(null,t);if(!f(a))return a;a.then((function(t){o(r(r({},t||{}),{errMsg:n+":ok"})),i.onAfterSuccess&&i.onAfterSuccess(e,t)})).catch((function(t){t&&t.isCancel?(o({errMsg:n+":cancel"}),i.onAfterCancel&&i.onAfterCancel(e,t)):(o({errMsg:n+":fail "+t.message}),i.onAfterFail&&i.onAfterFail(e,t))}))}catch(e){return{errMsg:n+":fail "+e.message}}}(this,t,[i],(function(e){return o.debug("[hyext adapter] hyext callback "+t,e),n._invokeServiceCallbackHandler(a,e,t)}));return null!=s&&o.debug("[hyext adapter] hyext sync response "+t,s),s}},n.prototype.publishHandler=function(e){e.event,e.params,e.from,e.formatedEvent},n}(n);(new i).init()}window.__initAdapter=x,e.init=x,Object.defineProperty(e,"__esModule",{value:!0})}(n,t.default)}));function Hn(e){"miniProgram"===w().projectType&&vn.init(e)}window.addEventListener("message",(function(e){var n=e.data;if("object"==typeof n&&null!==n)switch(n.type){case"publish":Z(n.event,JSON.parse(n.paramsString));break;case"invoke":return Tn.invokeHandler(n)}})),window.addEventListener("resize",(function(){Z("onWindowResize",{size:{windowWidth:window.innerWidth,windowHeight:window.innerHeight}})})),window.FinChatJSCore=Tn,Dn.init({CoreAdapter:Bn,logger:I}),window.addEventListener("DOMContentLoaded",(function(){var e;e={windowInfo:In.getWindowInfo(),extInfo:w()},void 0!==window.__initWebFrameOnContentLoad&&(xe(),window.__initWebFrameOnContentLoad(e,Te),b()&&ne().$events.on("onDeviceOrientationChange",(function(e){Te.emit("onDeviceOrientationChange",e)})))})),window.__preloadSuccess&&Hn("__preloadSuccess"),window.__handlePreloadLinkAllLoaded=function(){Hn("preloadReady")},window.addEventListener("load",(function(){Hn("windowLoadReady")}))}));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@revues/web-sdk-core",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.3",
|
4
4
|
"description": "> TODO: description",
|
5
5
|
"author": "loler",
|
6
6
|
"homepage": "",
|
@@ -23,12 +23,12 @@
|
|
23
23
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@revues/hyext-adapter": "1.3.
|
26
|
+
"@revues/hyext-adapter": "1.3.3",
|
27
27
|
"eventemitter3": "^5.0.1",
|
28
28
|
"howler": "^2.2.4"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
31
|
"@types/howler": "^2.2.11"
|
32
32
|
},
|
33
|
-
"gitHead": "
|
33
|
+
"gitHead": "c3a925d35fe691af5bcd01e35985e17d7878abd8"
|
34
34
|
}
|