"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports.default=openLink;var _invoker=_interopRequireWildcard(require("./invoker")),_version=_interopRequireDefault(require("./version")),_compareVersion=_interopRequireDefault(require("./utils/compareVersion"));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,r=new WeakMap;return(_getRequireWildcardCache=function(e){return e?r:n})(e)}function _interopRequireWildcard(e,n){if(!n&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=_getRequireWildcardCache(n);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in e)if("default"!==t&&Object.prototype.hasOwnProperty.call(e,t)){var u=i?Object.getOwnPropertyDescriptor(e,t):null;u&&(u.get||u.set)?Object.defineProperty(o,t,u):o[t]=e[t]}return o.default=e,r&&r.set(e,o),o}function openLinkHandler(e,n){var r=n.resolve,o=n.reject,i=n.context,t=n.containerType,u=n.appType,a=n.platformType;(0,_version.default)().then((function(n){var p=n.version,l=-1!==(0,_compareVersion.default)(p,"1.6.2");if(t){var s=function(e){_invoker.default.handleBridgeResponse(e,r,o)},d=function(e){_invoker.default.handleBridgeResponse(e,r,o)};u===_invoker.API_INVOKER_TYPE.MINI_APP?i&&i({m:l?"taurus.common.openLink":"taurus.common.pushWindow",args:e,onSuccess:s,onFail:d}):a===_invoker.PLATFORM_TYPE_ENUM.ANDROID?i&&i(s,d,"taurus.common",l?"openLink":"pushWindow",e):a===_invoker.PLATFORM_TYPE_ENUM.IOS&&i.callHandler(l?"taurus.common.openLink":"taurus.common.pushWindow",Object.assign({},e),(function(e){_invoker.default.handleBridgeResponse(e,r,o)}))}else i&&i.call(l?"openLink":"pushWindow",e,(function(e){_invoker.default.handleBridgeResponse(e,r,o)}))}))}function openLink(e){return _invoker.default.invoke("openLink",e)}_invoker.default.registerAPI("openLink",{mini:openLinkHandler,mobile:openLinkHandler,pc:function(e,n){window.dingtalk.platform.invokeAPI(n.msgId,"biz.util.openLink",e)}}),openLink.version={android:"1.2.0",ios:"1.2.0",pc:"1.2.0"},module.exports=exports.default,module.exports.default=exports.default;