var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

import Device from './../Device';
import BridgeBase from './base';
import BridgeBrowser from './browser';
import BridgeWeixin from './wx';
import BridgeDinghuo from './dinghuo';
import BridgeWaiqin from './wq';
import BridgeWaiqinCordova from './cordova';

var Bridge = {};
if (Device.platform === 'wechat' || Device.platform === 'wework' || Device.platform === 'miniprogram') {
  Bridge = _extends({}, BridgeBase, BridgeWeixin);
} else if (Device.platform === 'dinghuo') {
  Bridge = _extends({}, BridgeBase, BridgeDinghuo);
} else if (Device.platform === 'waiqin') {
  Bridge = _extends({}, BridgeBase, BridgeWaiqinCordova);
} else if (Device.platform === 'wq') {
  Bridge = _extends({}, BridgeBase, BridgeWaiqin);
} else {
  Bridge = _extends({}, BridgeBase, BridgeBrowser);
}

// 防止绑定事件时this指向window, 所以全局加一个变量用于存储this
window._bridge_self = Bridge;

export default Bridge;