@swaiot/jssdk
Version:
a jssdk for coocaa system
16 lines (14 loc) • 93.5 kB
JavaScript
// /* eslint-disable */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var e=function(o,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])})(o,n)};function o(o,n){function t(){this.constructor=o}e(o,n),o.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var n=function(){return(n=Object.assign||function(e){for(var o,n=1,t=arguments.length;n<t;n++)for(var l in o=arguments[n])Object.prototype.hasOwnProperty.call(o,l)&&(e[l]=o[l]);return e}).apply(this,arguments)},t=function(){var e=function(e,o){var n,t,l,i=o.map((function(e){return"[object object]"===Object.prototype.toString.call(e).toLowerCase()?JSON.stringify(e):e}));null===(l=null===(t=null===(n=window.webkit)||void 0===n?void 0:n.messageHandlers)||void 0===t?void 0:t.console)||void 0===l||l.postMessage("["+e+"] "+i)};return{debug:function(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];for(var t=[],l=o.length;l--;)t[l]=o[l];e("debug",t)},log:function(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];for(var t=[],l=o.length;l--;)t[l]=o[l];e("log",t)},info:function(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];for(var t=[],l=o.length;l--;)t[l]=o[l];e("info",t)},warn:function(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];for(var t=[],l=o.length;l--;)t[l]=o[l];e("warn",t)},error:function(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];for(var t=[],l=o.length;l--;)t[l]=o[l];e("error",t)}}};function l(e){return Object.prototype.toString.call(e).slice(8,-1)}var i={A:"Array",D:"Date",N:"Number",S:"String",F:"Function",O:"Object",B:"Boolean"};function c(e,o){for(var n=[],t=2;t<arguments.length;t++)n[t-2]=arguments[t];for(var c,u=null,a=[].slice.call(arguments,2),r=0;r<e.length;++r){var f=e.charAt(r),p=f.toUpperCase(),d=a[r];if("*"!=f&&(c=l(d),(null!=d||f!=p)&&c!=i[p])){u="Expected "+i[p];break}}if(u)throw u="Wrong type for parameter of "+o+": "+(u+=", but got "+c+"."),s().log(u),TypeError(u)}function s(){return{log:function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t().log(e),console.log.apply(console,e)}}}var u={},a=Math.floor(2e9*Math.random()),r=s();function f(e,o,n,t){var l,i,c,s=e+o+a++,f="string"==typeof n?n:JSON.stringify(n);u[s]=t,r.log("call2Native: callbackId="+s+", action="+o+",args="+f);var p={callbackId:s,moduleName:e,action:o,params:f};return r.log("call2Native: params="+JSON.stringify(p)),null===(c=null===(i=null===(l=null===window||void 0===window?void 0:window.webkit)||void 0===l?void 0:l.messageHandlers)||void 0===i?void 0:i.call2Native)||void 0===c||c.postMessage(p),s}function p(e,o,n,t){var l,i=e+o+a++,c="string"==typeof n?n:JSON.stringify(n);u[i]=t,r.log("call2Native: callbackId="+i+", action="+o+",args="+c);var s={id:i,moduleName:e,action:o,params:c},f=JSON.stringify(s);return r.log("call2Native: params="+f),null===(l=null===window||void 0===window?void 0:window.sw)||void 0===l||l.call2Native(f),i}function d(e,o){void 0===o&&(o="default");var n=o+a++;return u[n]=e,n}function v(e){u[e]?delete u[e]:r.log("callback cannot be found!")}function y(e,o){try{var n=void 0;if("object"==typeof o)r.log("callbackFromNative, callbackId="+e+",payloadMessage[object] = "+JSON.stringify(o)),n=o;else{if("string"!=typeof o)throw"payloadMessage type error";r.log("callbackFromNative, callbackId="+e+",payloadMessage[string] = "+o),n=JSON.parse(o)}var t=u[e];t?(r.log("callbackFromNative, callback = "+JSON.stringify(t)),n.methodName?(r.log("callback, methodName="+n.methodName+", res="+JSON.stringify(n.res)),t[n.methodName]&&t[n.methodName].apply(null,["string"==typeof n.res?JSON.parse(n.res):n.res])):r.log("methodName cannot be found"),t.keepCallback||delete u[e]):r.log("callback cannot be found!")}catch(n){var l=void 0;l="object"==typeof o?"Error in "+JSON.stringify(o)+" callbackId: "+e+" : "+n:"Error in "+o+" callbackId: "+e+" : "+n,r&&r.log&&r.log(l)}}var g,m=function(){function e(){var e;this.module=null===(e=null===window||void 0===window?void 0:window.sw)||void 0===e?void 0:e.require("account")}return e.getModule=function(){return null==this.instance&&(this.instance=new e),e.instance},e.prototype.getAccountInfo=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getAccountInfo: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"account");null===(o=this.module)||void 0===o||o.getAccountInfo(n)},e.prototype.getAccessToken=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getAccessToken: ok",data:{accessToken:o.token}})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"account");null===(o=this.module)||void 0===o||o.getAccessToken(n)},e.prototype.isLogin=function(e){var o;console.log("Android isLogin Impl");var n=d({success:function(o){var n="true"===o.isLogin||!0===o.isLogin;"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"isLogin: ok",data:{isLogin:n}})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"account");null===(o=this.module)||void 0===o||o.isLogin(n)},e.prototype.startLogin=function(e){var o,n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"startLogin: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"account");null===(o=this.module)||void 0===o||o.startLogin(n)},e.prototype.addAccountChangedListener=function(e){var o;c("of","addAccountChangedListener",e,e.onReceive);var n=d({success:function(o){console.log("addAccountChangedListener success = "+o),"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"addAccountChangedListener: ok",listenerId:o.listenerId})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},onReceive:function(o){console.log("addAccountChangedListener onReceive = "+JSON.stringify(o)),e.onReceive(o)},keepCallback:!0},"account");null===(o=this.module)||void 0===o||o.addAccountChangedListener(n)},e.prototype.removeAccountChangedListener=function(e){var o;c("os","removeAccountChangedListener",e,e.listenerId);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"removeAccountChangedListener: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"account"),t=JSON.stringify({listenerId:e.listenerId});null===(o=this.module)||void 0===o||o.removeAccountChangedListener(n,t),v(e.listenerId)},e.prototype.updateAccessToken=function(e){var o;c("os","updateAccessToken",e,e.accessToken);var n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"updateAccessToken: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"account");null===(o=this.module)||void 0===o||o.updateAccessToken(n,JSON.stringify({accessToken:e.accessToken}))},e.prototype.addFavorite=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"addFavorite: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"account");null===(o=this.module)||void 0===o||o.addFavorite(n)},e}(),k=function(){function e(){var e;this.PROTO_VERSION="0",this.module=null===(e=null===window||void 0===window?void 0:window.sw)||void 0===e?void 0:e.require("channel"),this.extras={}}return e.getModule=function(){return null==this.instance&&(this.instance=new e),e.instance},e.prototype.isLAN=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"isLAN: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"channel");null===(o=this.module)||void 0===o||o.isLAN(n)},e.prototype.getConnectDeviceInfo=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getConnectDeviceInfo: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"channel");null===(o=this.module)||void 0===o||o.getConnectDeviceInfo(n)},e.prototype.getBindCode=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getBindCode: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"channel");null===(o=this.module)||void 0===o||o.getBindCode(n)},e.prototype.getSpaceId=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getSpaceId: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"channel");null===(o=this.module)||void 0===o||o.getSpaceId(n)},e.prototype.startConnectDevice=function(e){var o,n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"startConnectDevice: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"channel");null===(o=this.module)||void 0===o||o.startConnectDevice(n)},e.prototype.startConnectWiFi=function(e){var o,n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"startConnectWiFi: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"channel");null===(o=this.module)||void 0===o||o.startConnectWiFi(n)},e.prototype.sendMsg=function(e){var o;c("os","sendMsg",e,e.content);var n,t={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendMsg: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},l=void 0!==e.type?e.type:"CTR";n=e.target?e.target:"ss-clientID-runtime-h5-channel";var i=d(t,"channel");null===(o=this.module)||void 0===o||o.sendCommonMsg(i,n,e.content,l,this.makeExtras(e)),t.success({})},e.prototype.sendBroadcast=function(e){var o;c("os","sendBroadcast",e,e.content);var n,t={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendBroadcast: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1};n=e.target?e.target:"ss-clientID-runtime-h5-channel";var l=d(t,"channel");null===(o=this.module)||void 0===o||o.sendBroadcast(l,n,e.content)},e.prototype.updateStatus=function(e){var o;c("oss","updateStatus",e,e.title,e.type);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"updateStatus: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"channel"),t=JSON.stringify({type:e.type,version:"0",values:JSON.stringify({playCmd:"play",mediaTitle:e.title,pagetype:e.type})});null===(o=this.module)||void 0===o||o.sendStatusBroadcast(n,"ss-clientID-SmartScreen",t)},e.prototype.sendVideoMsg=function(e){var o,n,t;c("os","sendVideoMsg",e,e.type);var l={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendVideoMsg: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1};if("online"===e.type){c("oso","sendVideoMsg",e,e.albumId,e.userInfo);var i="0";void 0!==e.childId&&(i=""+e.childId);var s={account_source:"1",child_id:i,id:e.albumId,needParse:!1,need_history:!0,read_history:!0,simple_detail:"1",user_info:JSON.stringify(e.userInfo),vid:""};e.vid?s.vid=e.vid:s.vid=void 0;var u={cmd:"ONLINE_VIDEO",type:"MEDIA",param:JSON.stringify(s)},a=d(l,"channel");null===(o=this.module)||void 0===o||o.sendCommonMsg(a,"ss-clientID-movie",JSON.stringify(u),"TEXT",this.makeExtras({protoVersion:"0"}))}else if("live"===e.type){c("osa","sendVideoMsg",e,e.url,e.urlList);a=d(l,"channel");var r={cmd:"",type:"CUSTOM_EVENT",param:JSON.stringify({type:"live",cmd:"play",param:e.url,extra:JSON.stringify(e.urlList)})},f={cmd:"",type:"CUSTOM_EVENT",param:JSON.stringify({type:"live",cmd:"mediaTitle",param:e.title||""})};null===(n=this.module)||void 0===n||n.sendLiveMsg(a,"ss-clientID-UniversalMediaPlayer",JSON.stringify(r),JSON.stringify(f))}else if("local"===e.type){c("os","sendVideoMsg",e,e.url);var p={extra:{response:JSON.stringify({cmd:"PLAY",type:"LOCAL_MEDIA",param:JSON.stringify({name:"string"==typeof e.title?e.title:""})})}};a=d(l,"channel");null===(t=this.module)||void 0===t||t.sendCommonMsg(a,"ss-clientID-UniversalMediaPlayer",e.url,"VIDEO",this.makeExtras(p))}},e.prototype.sendAudioMsg=function(e){var o;c("os","sendAudioMsg",e,e.url);var n={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendAudioMsg: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t={extra:{response:JSON.stringify({cmd:"PLAY",type:"LOCAL_MEDIA",param:JSON.stringify({url:e.url,name:"string"==typeof e.title?e.title:""})})}},l=d(n,"channel");null===(o=this.module)||void 0===o||o.sendCommonMsg(l,"ss-clientID-UniversalMediaPlayer",e.url,"AUDIO",this.makeExtras(t))},e.prototype.sendDocMsg=function(e){var o;c("os","sendDocMsg",e,e.url);var n={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendDocMsg: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t={extra:{response:JSON.stringify({cmd:"PLAY",type:"LOCAL_MEDIA",param:JSON.stringify({url:e.url,name:"string"==typeof e.title?e.title:""})})}},l=d(n,"channel");null===(o=this.module)||void 0===o||o.sendCommonMsg(l,"ss-clientID-UniversalMediaPlayer",e.url,"DOC",this.makeExtras(t))},e.prototype.sendImageMsg=function(e){var o;c("os","sendImageMsg",e,e.url);var n={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendImageMsg: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t={extra:{response:JSON.stringify({cmd:"PLAY",type:"LOCAL_MEDIA",param:JSON.stringify({name:"string"==typeof e.title?e.title:""})})}},l=d(n,"channel");null===(o=this.module)||void 0===o||o.sendCommonMsg(l,"ss-clientID-UniversalMediaPlayer",e.url,"IMAGE",this.makeExtras(t))},e.prototype.sendBrowserMsg=function(e){var o;c("os","sendBrowserMsg",e,e.url);var n={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendBrowserMsg: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t=d(n,"channel"),l="",i="";e.name&&(l=""+e.name),e.flag&&(i=""+e.flag);var s={do:"launcher_browser",url:e.url,name:l,flag:i,pageType:void 0!==e.pageId&&e.pageId?""+e.pageId:""},u=this.makeExtras({log_castType:void 0!==e.pageId&&e.pageId?"swaiotos.runtime.h5.app$"+e.pageId:"",log_appScreenURI:e.url,open_id:void 0!==e.openId&&e.openId?""+e.openId:""});null===(o=this.module)||void 0===o||o.sendCommonMsg(t,"ss-clientID-runtime-h5-channel",JSON.stringify(s),"TEXT",u),n.success({})},e.prototype.sendKeyMsg=function(e){var o,n={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendKeyMsg: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t={key:e.key},l=d(n,"channel");null===(o=this.module)||void 0===o||o.sendKeyMsg(l,JSON.stringify(t))},e.prototype.sendSSEMsg=function(e){var o;c("oss","sendSSEMsg",e,e.target,e.content);var n={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendSSEMsg: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1};e.target,e.content;var t=d(n,"channel");null===(o=this.module)||void 0===o||o.sendSSEMsg(t,e.target,e.content)},e.prototype.addMsgReceiveListener=function(e){var o;c("of","addMsgReceiveListener",e,e.onReceive);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"addMsgReceiveListener: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},onReceive:function(o){e.onReceive(o)},keepCallback:!0},"channel");null===(o=this.module)||void 0===o||o.addMsgReceiveListener(n)},e.prototype.addStatusReceiveListener=function(e){var o;c("of","addStatusReceiveListener",e,e.onReceive);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"addStatusReceiveListener: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},onReceive:function(o){e.onReceive(o)},keepCallback:!0},"channel");null===(o=this.module)||void 0===o||o.addStatusReceiveListener(n)},e.prototype.enableTransferMessage=function(e){var o;c("oss","enableTransferMessage",e,e.clientId,e.enable);var n={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"sendMsg: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t={clientId:e.clientId,enable:e.enable},l=d(n,"channel");null===(o=this.module)||void 0===o||o.enableTransferMessage(l,JSON.stringify(t))},e.prototype.removeMsgReceiveListener=function(e){var o;c("os","removeMsgReceiveListener",e,e.listenerId);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"removeMsgReceiveListener: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"channel"),t=JSON.stringify({listenerId:e.listenerId});null===(o=this.module)||void 0===o||o.removeMsgReceiveListener(n,t),v(e.listenerId)},e.prototype.removeStatusReceiveListener=function(e){var o;c("os","removeStatusReceiveListener",e,e.listenerId);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"removeStatusReceiveListener: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"channel"),t=JSON.stringify({listenerId:e.listenerId});null===(o=this.module)||void 0===o||o.removeStatusReceiveListener(n,t),v(e.listenerId)},e.prototype.makeExtras=function(e){var o,n=e&&void 0!==e.protoVersion?e.protoVersion:this.PROTO_VERSION;if(this.extras.protoVersion=n,e&&void 0!==e.log_castType&&(this.extras.log_castType=e.log_castType),e&&void 0!==e.log_appScreenURI&&(this.extras.log_appScreenURI=e.log_appScreenURI),e&&void 0!==e.open_id&&(this.extras.open_id=e.open_id),e&&e.extra&&"object"==typeof e.extra)for(var t in o=JSON.parse(JSON.stringify(this.extras)),e.extra)o[t]=e.extra[t];else o=this.extras;return JSON.stringify(o)},e}(),M=function(){},h=function(){},b=function(e){function n(o){var n=e.call(this)||this;return n.socket=o,n}return o(n,e),n.prototype.sendText=function(e){this.socket.sendText(e)},n.prototype.getRemoteAddress=function(){return this.socket.getRemoteAddress()},n}(function(){function e(){}return e.prototype.on=function(e){this.mCallback=e},e.prototype.dispatchMessage=function(e){null!=this.mCallback&&this.mCallback.onMessage(e)},e}()),C=function(e){function n(o){var n=e.call(this)||this;return n.sockets=new Map,n.server=o,n}return o(n,e),n.prototype.listen=function(e,o){var n=this;null==this.callback&&(console.log("listen:"+e),this.callback=o,this.callbackId=d({keepCallback:!0,onOpen:function(e){var o=e.socket,t=n.server.getSocket(o);if(null!=t){var l=n.getSocket(t);null==l&&(l=new b(t),n.putSocket(t,l)),n.callback.onOpen(l)}},onClose:function(e){var o=e.socket,t=e.code,l=e.reason,i=e.remote,c=n.server.getSocket(o);if(null!=c){var s=n.getSocket(c);null!=s&&(n.removeSocket(c),n.callback.onClose(s,t,l,i))}},onError:function(e){var o=e.socket,t=e.ex,l=n.server.getSocket(o);if(null!=l){var i=n.getSocket(l);null!=i&&n.callback.onError(i,t)}},onStart:function(e){console.log("onStart "+e);var o=e.address;n.callback.onStart(o)},onMessage:function(e){var o=e.socket,t=e.message,l=n.server.getSocket(o);if(null!=l){var i=n.getSocket(l);null!=i&&i.dispatchMessage(t)}}}),this.server.setCallback(this.callbackId),e>0?this.server.listen(e):this.server.listen())},n.prototype.close=function(){this.callback=null,v(this.callbackId),this.server.close()},n.prototype.getSocket=function(e){return this.sockets.get(e)},n.prototype.putSocket=function(e,o){this.sockets.set(e,o)},n.prototype.removeSocket=function(e){this.sockets.delete(e)},n}(h),w=function(e){function n(){var o,n=e.call(this)||this;return n.module=null===(o=null===window||void 0===window?void 0:window.sw)||void 0===o?void 0:o.require("websocket"),n}return o(n,e),n.getModule=function(){return null==this.instance&&(this.instance=new n),this.instance},n.prototype.createServer=function(){var e=this.module.createServer();return new C(e)},n.instance=null,n}(M),S=function(){function e(){var e,o,n;null===(n=null===(o=null===(e=null===window||void 0===window?void 0:window.webkit)||void 0===e?void 0:e.messageHandlers)||void 0===o?void 0:o.requireModule)||void 0===n||n.postMessage("hardware")}return e.getModule=function(){return null==this.instance&&(this.instance=new e),e.instance},e.prototype.addDeviceMotionListener=function(e){c("of","addDeviceMotionListener",e,e.onReceive),f("hardware","addDeviceMotionListener",{},{success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"addDeviceMotionListener: ok",listenerId:o.listenerId})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},onReceive:function(o){e.onReceive(o)},keepCallback:!0})},e.prototype.removeDeviceMotionListener=function(e){c("os","removeDeviceMotionListener",e,e.listenerId);var o={success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"removeDeviceMotionListener: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1};f("hardware","removeDeviceMotionListener",{listenerId:e.listenerId},o),v(e.listenerId)},e}(),I=function(){function e(){var e;this.module=null===(e=null===window||void 0===window?void 0:window.sw)||void 0===e?void 0:e.require("storage")}return e.getModule=function(){return null==this.instance&&(this.instance=new e),e.instance},e.prototype.getStorage=function(e){var o;c("os","getStorage",e,e.key);var n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getStorage: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"storage");null===(o=this.module)||void 0===o||o.getStorage(n,JSON.stringify({key:e.key}))},e.prototype.setStorage=function(e){var o;c("oss","setStorage",e,e.key,e.data);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"setStorage: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"storage");null===(o=this.module)||void 0===o||o.setStorage(n,JSON.stringify({key:e.key,data:e.data}))},e.prototype.removeStorage=function(e){var o;c("os","removeStorage",e,e.key);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"removeStorage: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"storage");null===(o=this.module)||void 0===o||o.removeStorage(n,JSON.stringify({key:e.key}))},e.prototype.getStorageInfo=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getStorageInfo: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"storage");null===(o=this.module)||void 0===o||o.getStorageInfo(n,JSON.stringify({}))},e.prototype.clearStorage=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"clearStorage: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"storage");null===(o=this.module)||void 0===o||o.clearStorage(n,JSON.stringify({}))},e}(),L=function(){function e(){var e;this.module=null===(e=null===window||void 0===window?void 0:window.sw)||void 0===e?void 0:e.require("navigator")}return e.getModule=function(){return null==this.instance&&(this.instance=new e,this.controlBarChangedListenerId=null),e.instance},e.prototype.setNavigationBarTitle=function(e){var o;c("os","setNavigationBarTitle",e,e.title);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"setNavigationBarTitle: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"navigator"),t=JSON.stringify({title:e.title,subTitle:e.subTitle||"",alpha:e.alpha||1});null===(o=this.module)||void 0===o||o.setNavigationBarTitle(n,t)},e.prototype.setDarkMode=function(e){var o;c("ob","setDarkMode",e,e.darkMode);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"setDarkMode: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"navigator"),t=JSON.stringify({darkMode:e.darkMode});null===(o=this.module)||void 0===o||o.setDarkMode(n,t)},e.prototype.setNavigationBarStyle=function(e){var o;c("o","setNavigationBarStyle",e);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"setNavigationBarStyle: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"navigator"),t={};void 0!==e.back&&"null"!=e.back&&(t.backButtonVisible=e.back,t.back=e.back),void 0!==e.title&&"null"!=e.title&&(t.title=""+e.title),void 0!==e.subTitle&&"null"!=e.subTitle&&(t.subTitle=""+e.subTitle),void 0!==e.backgroundColor&&"null"!=e.backgroundColor&&(t.backgroundColor=""+e.backgroundColor),void 0!==e.darkMode&&"null"!=e.darkMode&&(t.darkMode=e.darkMode),void 0!==e.alpha&&"null"!=e.alpha&&(t.alpha=e.alpha),void 0!==e.backButtonIcon&&"null"!=e.backButtonIcon&&(t.backButtonIcon=""+e.backButtonIcon),void 0!==e.backButtonVisible&&"null"!=e.backButtonVisible&&(t.backButtonVisible=e.backButtonVisible),null===(o=this.module)||void 0===o||o.setNavigationBarStyle(n,JSON.stringify(t))},e.prototype.setControlBarStyle=function(e){var o;c("o","setControlBarStyle",e);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"setControlBarStyle: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"navigator"),t={};"boolean"==typeof e.display?t.display=e.display:"string"==typeof e.display&&"false"==e.display?t.display=!1:t.display=!0,null===(o=this.module)||void 0===o||o.setControlBarStyle(n,JSON.stringify(t))},e.prototype.setMenuButtonStyle=function(e){var o;c("o","setMenuButtonStyle",e);var n=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"setMenuButtonStyle: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"navigator"),t={};"boolean"==typeof e.display?t.display=e.display:"string"==typeof e.display&&"false"==e.display?t.display=!1:t.display=!0,null===(o=this.module)||void 0===o||o.setMenuButtonStyle(n,JSON.stringify(t))},e.prototype.addBackButtonOnClickListener=function(e){throw new Error("Method not implemented.")},e.prototype.removeBackButtonOnClickListener=function(e){throw new Error("Method not implemented.")},e.prototype.addShareButtonOnClickListener=function(e){throw new Error("Method not implemented.")},e.prototype.removeShareButtonOnClickListener=function(e){throw new Error("Method not implemented.")},e.prototype.addControlBarChangedListener=function(o){var n;c("of","addControlBarChangedListener",o,o.onReceive);var t=d({success:function(e){console.log("addControlBarChangedListener success = "+e),"function"==typeof(null==o?void 0:o.success)&&(null==o||o.success({errMsg:"addControlBarChangedListener: ok",listenerId:e.listenerId})),"function"==typeof(null==o?void 0:o.complete)&&o.complete()},fail:function(e){"function"==typeof(null==o?void 0:o.fail)&&(null==o||o.fail({errMsg:e})),"function"==typeof(null==o?void 0:o.complete)&&o.complete()},onReceive:function(e){console.log("addControlBarChangedListener onReceive = "+JSON.stringify(e)),o.onReceive(e)},keepCallback:!0},"navigator");e.controlBarChangedListenerId=t,null===(n=this.module)||void 0===n||n.addControlBarChangedListener(t)},e.prototype.removeControlBarChangedListener=function(o){var n;c("o","removeControlBarChangedListener",o);var t=d({success:function(){"function"==typeof(null==o?void 0:o.success)&&(null==o||o.success({errMsg:"removeControlBarChangedListener: ok"})),"function"==typeof(null==o?void 0:o.complete)&&o.complete()},fail:function(e){"function"==typeof(null==o?void 0:o.fail)&&(null==o||o.fail({errMsg:e})),"function"==typeof(null==o?void 0:o.complete)&&o.complete()},keepCallback:!1},"navigator");null===(n=this.module)||void 0===n||n.removeControlBarChangedListener(t),e.controlBarChangedListenerId&&(v(e.controlBarChangedListenerId),e.controlBarChangedListenerId=null)},e}(),N=function(){function e(){var e;this.module=null===(e=null===window||void 0===window?void 0:window.sw)||void 0===e?void 0:e.require("device")}return e.getModule=function(){return null==this.instance&&(this.instance=new e),e.instance},e.prototype.scanQrcode=function(e){var o;c("o","scanQrcode",e);var n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"scanQrcode: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"device");null===(o=this.module)||void 0===o||o.scanQrcode(n)},e.prototype.vibrateDevice=function(e){var o;c("o","scanQrcode",e);var n={success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"scanQrcode: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t={ms:"number"==typeof e.ms?e.ms:"string"==typeof e.ms?Number(e.ms):200,swing:"number"==typeof e.swing?e.swing:"string"==typeof e.swing?Number(e.swing):-1},l=d(n,"device");null===(o=this.module)||void 0===o||o.vibrateDevice(l,JSON.stringify(t))},e.prototype.enableDeviceQrcode=function(e){var o;c("os","enableDeviceQrcode",e,e.enable);var n,t=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"enableDeviceQrcode: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"device");n=void 0!==e.enable&&""!=e.enable?e.enable:"false",null===(o=this.module)||void 0===o||o.enableDeviceQrcode(t,n)},e.prototype.getDeviceQrcodeString=function(e){var o,n,t=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getDeviceQrcodeString: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"device");n=void 0!==e.url&&""!=e.url?""+e.url:"",null===(o=this.module)||void 0===o||o.getDeviceQrcodeString(t,n)},e.prototype.addQrcodeChangedListener=function(e){var o;c("of","addQrcodeChangedListener",e,e.onReceive);var n=d({success:function(o){console.log("addQrcodeChangedListener success = "+o),"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"addQrcodeChangedListener: ok",listenerId:o.listenerId})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},onReceive:function(o){console.log("addQrcodeChangedListener onReceive = "+JSON.stringify(o)),e.onReceive(o)},keepCallback:!0},"device");null===(o=this.module)||void 0===o||o.addQrcodeChangedListener(n)},e.prototype.removeQrcodeChangedListener=function(e){var o;c("os","removeQrcodeChangedListener",e,e.listenerId);var n,t=d({success:function(){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"removeQrcodeChangedListener: ok"})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"device");n=void 0!==e.listenerId&&""!=e.listenerId?""+e.listenerId:"",null===(o=this.module)||void 0===o||o.removeQrcodeChangedListener(t,n),v(e.listenerId)},e}(),O=function(){function e(){var e;console.log("before window?.sw?.requireModule('system')"),this.module=null===(e=null===window||void 0===window?void 0:window.sw)||void 0===e?void 0:e.require("system"),console.log("after window?.sw?.requireModule('system')")}return e.getModule=function(){return null==this.instance&&(this.instance=new e),e.instance},e.prototype.getSystemInfo=function(e){var o;c("o","getSystemInfo",e);var n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getSystemInfo: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"system");null===(o=this.module)||void 0===o||o.getSystemInfo(n)},e.prototype.getDeviceInfo=function(e){var o;c("o","getDeviceInfo",e);var n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getDeviceInfo: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"system");null===(o=this.module)||void 0===o||o.getDeviceInfo(n)},e.prototype.startPage=function(e){var o;c("oss","startPage",e,e.mode,e.value);var n={success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"startPage: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t=e.type?e.type:"activity",l=e.packageName?e.packageName:"",i=void 0!==e.versionCode?""+e.versionCode:"0",s="{}";"object"==typeof e.params?s=JSON.stringify(e.params):"string"==typeof e.params&&""!=e.params&&(s=e.params);var u=e.data?e.data:"",a={type:t,mode:e.mode,value:e.value,packageName:l,versionCode:i,params:s,data:u},r=d(n,"system");null===(o=this.module)||void 0===o||o.startPage(r,JSON.stringify(a))},e.prototype.exitPage=function(e){var o,n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"exitPage: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"system");null===(o=this.module)||void 0===o||o.exitPage(n)},e.prototype.startWechatApplet=function(e){var o;c("os","startWechatApplet",e,e.id);var n={success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"startWechatApplet: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t={id:e.id?e.id:"",path:e.path?e.path:""},l=d(n,"system");null===(o=this.module)||void 0===o||o.startWechatApplet(l,JSON.stringify(t))},e.prototype.startAppStorePage=function(e){var o;c("o","startAppStorePage",e);var n={success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"startAppStorePage: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t=e.pkgName?e.pkgName:"",l={url:e.url?e.url:"",pkgName:t},i=d(n,"system");null===(o=this.module)||void 0===o||o.startAppStorePage(i,JSON.stringify(l))},e.prototype.startBrowser=function(e){var o;c("os","startBrowser",e,e.url);var n={success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"startBrowser: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t={url:e.url},l=d(n,"system");null===(o=this.module)||void 0===o||o.startBrowser(l,JSON.stringify(t))},e.prototype.startToast=function(e){throw new Error("Method not implemented.")},e.prototype.logDataCollection=function(e){var o;c("os","logDataCollection",e,e.eventName);var n,t={success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"logDataCollection: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1};n="object"==typeof e.eventParams?JSON.stringify(e.eventParams):""+e.eventParams;var l={productId:e.productId,eventName:e.eventName,eventParams:n},i=d(t,"system");null===(o=this.module)||void 0===o||o.logDataCollection(i,JSON.stringify(l))},e.prototype.getProperties=function(e){throw new Error("Method not implemented.")},e.prototype.getAppInfo=function(e){var o;c("o","getAppInfo",e);var n={success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getAppInfo: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},t=e.pkgName?e.pkgName:"",l={scheme:e.scheme?e.scheme:"",pkgName:t},i=d(n,"system");null===(o=this.module)||void 0===o||o.getAppInfo(i,JSON.stringify(l))},e.prototype.getMemInfo=function(e){throw new Error("Method not implemented.")},e.prototype.getLocation=function(e){throw new Error("Method not implemented.")},e.prototype.addLifecycleListener=function(e){var o;c("of","addLifecycleListener",e,e.onReceive);var n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"addLifecycleListener: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},onReceive:function(o){e.onReceive(o)},keepCallback:!0},"system");null===(o=this.module)||void 0===o||o.addLifecycleListener(n,JSON.stringify({}))},e.prototype.removeLifecycleListener=function(e){var o;c("o","removeLifecycleListener",e);var n=d({success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"removeLifecycleListener: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1},"system");null===(o=this.module)||void 0===o||o.removeLifecycleListener(n,JSON.stringify({}))},e}(),A=function(){function e(){var e;this.module=null===(e=null===window||void 0===window?void 0:window.sw)||void 0===e?void 0:e.require("payment")}return e.getModule=function(){return null==this.instance&&(this.instance=new e),e.instance},e.prototype.placeOrder=function(e){var o,n,t={success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"placeOrder: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1};n="object"==typeof e.orderParams?JSON.stringify(e.orderParams):""+e.orderParams;var l=d(t,"payment");null===(o=this.module)||void 0===o||o.placeOrder(l,n)},e.prototype.startPay=function(e){var o,n,t={success:function(o){var n=!1;if(o){var t=void 0;(t="string"==typeof o?JSON.parse(o):o).status&&"success"==t.status&&(n=!0)}1==n?("function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"startPay: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()):("function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:"startPay:fail",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete())},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1};n="object"==typeof e.orderParams?JSON.stringify(e.orderParams):""+e.orderParams;var l=d(t,"payment");null===(o=this.module)||void 0===o||o.startPay(l,n)},e}(),B=function(){function e(){}return e.getInstance=function(){return null==this.instance&&(this.instance=new e),e.instance},e.prototype.requireModule=function(e){var o;switch(console.log("AndroidFactory requireModule "+e),e){case"account":o=m.getModule();break;case"channel":o=k.getModule();break;case"websocket":o=w.getModule();break;case"hardware":o=S.getModule();break;case"storage":o=I.getModule();break;case"navigator":o=L.getModule();break;case"device":o=N.getModule();break;case"system":o=O.getModule();break;case"payment":o=A.getModule();break;default:throw new Error("Module not found.")}return o},e}(),D=function(){function e(){var e,o,n;null===(n=null===(o=null===(e=null===window||void 0===window?void 0:window.webkit)||void 0===e?void 0:e.messageHandlers)||void 0===o?void 0:o.requireModule)||void 0===n||n.postMessage("system")}return e.getModule=function(){return null==this.instance&&(this.instance=new e),e.instance},e.prototype.getSystemInfo=function(e){c("o","getSystemInfo",e),f("system","getSystemInfo",{},{success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getSystemInfo: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({errMsg:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},keepCallback:!1})},e.prototype.getDeviceInfo=function(e){c("o","getDeviceInfo",e),f("system","getDeviceInfo",{},{success:function(o){"function"==typeof(null==e?void 0:e.success)&&(null==e||e.success({errMsg:"getDeviceInfo: ok",data:o})),"function"==typeof(null==e?void 0:e.complete)&&e.complete()},fail:function(o){"function"==typeof(null==e?void 0:e.fail)&&(null==e||e.fail({er