"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var sdk_1=require("./sdk"),sdk_2=require("./sdk");exports.ENV_ENUM=sdk_2.ENV_ENUM,exports.APP_TYPE=sdk_2.APP_TYPE;var dingtalk_javascript_env_1=require("./packages/dingtalk-javascript-env"),EDdWeexEnv;!function(e){e.singlePage="singlePage",e.miniApp="miniApp",e.miniWidget="miniWidget"}(EDdWeexEnv||(EDdWeexEnv={})),exports.getUA=function(){var e="";try{"undefined"!=typeof navigator&&(e=navigator&&(navigator.userAgent||navigator.swuserAgent)||"")}catch(i){e=""}return e},exports.getENV=function(){var e=exports.getUA(),i=/DingTalk/i.test(e)||dingtalk_javascript_env_1.default.isDingTalk,a=/iPhone|iPad|iPod|iOS/i.test(e)&&i||dingtalk_javascript_env_1.default.isWeexiOS,t=/Android/i.test(e)&&i||dingtalk_javascript_env_1.default.isWeexAndroid,n=/Nebula/i.test(e)&&i||"object"==typeof dd&&"function"==typeof dd.dtBridge,d=/dd-web/i.test(e),r=sdk_1.APP_TYPE.WEB;if(d)r=sdk_1.APP_TYPE.WEBVIEW_IN_MINIAPP;else if(n)r=sdk_1.APP_TYPE.MINI_APP;else if(dingtalk_javascript_env_1.default.isWeexiOS||dingtalk_javascript_env_1.default.isWeexAndroid)try{var s=weex.config.ddWeexEnv;r=s===EDdWeexEnv.miniWidget?sdk_1.APP_TYPE.WEEX_WIDGET:sdk_1.APP_TYPE.WEEX}catch(e){r=sdk_1.APP_TYPE.WEEX}var _,E="*",o=e.match(/AliApp\(\w+\/([a-zA-Z0-9.-]+)\)/);null===o&&(o=e.match(/DingTalk\/([a-zA-Z0-9.-]+)/));var g;o&&o[1]&&(g=o[1]);var v="";if("undefined"!=typeof name&&(v=name),v)try{var P=JSON.parse(v);P.hostVersion&&(g=P.hostVersion),E=P.language||navigator.language||"*",_=P.containerId}catch(e){}var p,l=!!_;return p=a?sdk_1.ENV_ENUM.ios:t?sdk_1.ENV_ENUM.android:l?sdk_1.ENV_ENUM.pc:sdk_1.ENV_ENUM.notInDingTalk,{platform:p,version:g,appType:r,language:E}};