"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackJsonp_bos-platform"] = self["webpackJsonp_bos-platform"] || []).push([[2328],{

/***/ "./src/plugin/mobile/feishu/plugin.js":
/*!********************************************!*\
  !*** ./src/plugin/mobile/feishu/plugin.js ***!
  \********************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"../../node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"../../node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"../../node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"../../node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.array.is-array.js */ \"../../node_modules/core-js/modules/es.array.is-array.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"../../node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"../../node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-string.js */ \"../../node_modules/core-js/modules/es.date.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"../../node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.object.define-property.js */ \"../../node_modules/core-js/modules/es.object.define-property.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"../../node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"../../node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"../../node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"../../node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.weak-map.js */ \"../../node_modules/core-js/modules/es.weak-map.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"../../node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports[\"default\"] = main;\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"../../node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"../../node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"../../node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"../../node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"../../node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.starts-with.js */ \"../../node_modules/core-js/modules/es.string.starts-with.js\");\nvar _clientEnv = __webpack_require__(/*! @/plugin/clientEnv.js */ \"./src/plugin/clientEnv.js\");\nvar _const = __webpack_require__(/*! ../../const */ \"./src/plugin/const.js\");\nvar _PluginManager = __webpack_require__(/*! @/plugin/PluginManager.js */ \"./src/plugin/PluginManager.js\");\nvar _promiseUtil = __webpack_require__(/*! @/api/promiseUtil */ \"./src/api/promiseUtil.js\");\nvar _global = _interopRequireWildcard(__webpack_require__(/*! @/global */ \"./src/global/index.js\"));\nvar _intlApi = __webpack_require__(/*! @/i18n/intlApi */ \"./src/i18n/intlApi.js\");\nvar _PluginManager2 = __webpack_require__(/*! @/plugin/PluginManager */ \"./src/plugin/PluginManager.js\");\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != _typeof(e) && \"function\" != typeof e) return { \"default\": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n[\"default\"] = e, t && t.set(e, n), n; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction main(_ref, callback) {\n  var loadjs = _ref.loadjs;\n  _global[\"default\"][_global.KD_PLUGIN] = {\n    // 获取语言接口不依赖飞书的Api，可以往前提。避免飞书SDK未加载，主程序已经运行获取不到真实的语言\n    getDevicedLang: getBaseApi().getDevicedLang\n  };\n  loadjs('https://lf1-cdn-tos.bytegoofy.com/goofy/lark/op/h5-js-sdk-1.5.23.js', {\n    success: function success() {\n      console.log('飞书SDK已经加载');\n      (0, _PluginManager2.loadDynamicPlugin)(getBaseApi()); // 把插件api挂载在全局指定的插件名上\n      callback && callback(true); // 插件安装完，回调\n      (0, _promiseUtil.getRootConfigPromise)().then(function (config) {\n        (0, _clientEnv.getAppTrdAuthData)(_const.FEI_SHU).then(function (authData) {\n          if ((0, _clientEnv.isAuthSuccess)(authData)) {\n            var data = authData.data;\n            setConfig(data);\n          } else if (_global[\"default\"][_global.KD_PLUGIN]) {\n            console.error(\"\\u9274\\u6743\\u5931\\u8D25\\uFF0CgetAppTrdAuthData.do\\u63A5\\u53E3\\u8FD4\\u56DE\\u6570\\u636E\\uFF1A\".concat(JSON.stringify(authData)));\n            _global[\"default\"][_global.KD_PLUGIN][_const.AUTH_RESULT] = authData;\n            _global[\"default\"][_global.KD_PLUGIN][_const.AUTH_API_WHITE_LIST] = ['previewImage', 'scanQRCode', 'setClipboardData', 'getLocation'];\n          }\n        });\n      });\n    },\n    error: function error() {\n      console.error('飞书SDK加载失败');\n      callback && callback(false);\n    }\n  });\n}\nfunction getBaseApi() {\n  // 不需要鉴权即可调用的接口\n  var baseApi = {\n    // 关闭轻应用\n    closeWebView: function closeWebView() {\n      window.tt.closeWindow({\n        success: function success(res) {\n          console.log(JSON.stringify(res));\n          (0, _PluginManager.releaseResource)();\n        },\n        fail: function fail(res) {\n          console.error(\"closeWindow fail: \".concat(JSON.stringify(res)));\n        }\n      });\n    },\n    // 设置导航栏标题，飞书网页应用没有设置导航栏标题的接口\n    setWebViewTitle: function setWebViewTitle(title) {\n      console.log('setWebViewTitle 接口调用成功');\n      document.title = title;\n    },\n    // 获取设备语言，飞书没有获取设备语言的接口，所以直接从UA中获取\n    getDevicedLang: function getDevicedLang(data, callback) {\n      console.log('getDevicedLang 接口调用成功');\n      var userAgent = window.navigator.userAgent;\n      var langMsg = userAgent.split(' ').find(function (item) {\n        return item.startsWith('LarkLocale');\n      }) || 'LarkLocale/zh_CN';\n      // 简体中文：LarkLocale/zh_CN 繁体中文(中国香港)：LarkLocale/zh_HK 繁体中文(中国台湾)：LarkLocale/zh_TW 英文：LarkLocale/en_US\n      // const lang = langMsg.indexOf('zh') > -1 ? 'zh_CN' : 'en_US'\n      var lang = '';\n      if (langMsg.includes('zh_TW') || langMsg.includes('zh_HK')) {\n        lang = 'zh_TW';\n      } else if (langMsg.includes('zh')) {\n        lang = 'zh_CN';\n      } else {\n        lang = (0, _intlApi.getLanguage)(langMsg);\n      }\n      var args = {\n        success: true,\n        data: lang\n      };\n      callback(args);\n    }\n  };\n  return baseApi;\n}\nfunction getPermissionPlugin() {\n  // 需要鉴权成功才能调用的接口\n  var permissionPlugin = {\n    // 旋转界面，飞书暂不支持该接口\n    // rotateUI: () => {\n    // },\n    //\n    // 预览图片\n    previewImage: function previewImage(data, callback) {\n      var current = data.current,\n        urls = data.urls;\n      window.tt.previewImage({\n        urls: urls,\n        current: current,\n        success: function success(res) {\n          console.log(JSON.stringify(res));\n        },\n        fail: function fail(res) {\n          console.error(\"previewImage fail: \".concat(JSON.stringify(res)));\n        }\n      });\n    },\n    // 拍照或从手机相册中选择图片(接口返回的数据是一个本地路径，而不是base64格式的图片)\n    // selectPic: (data, callback) => {\n    //   const type = data ? data.type : ''\n    //   const sourceType = type ? [type] : ['album', 'camera']\n    //   window.tt.chooseImage({\n    //     sourceType: sourceType, // PC端无效\n    //     count: 1,\n    //     sizeType: ['original', 'compressed'], // 默认开启压缩，但可手动选择原图\n    //     cameraDevice: 'back',\n    //     isSaveToAlbum: '0',\n    //     success (res) {\n    //       console.log(res.tempFilePaths, res.tempFiles)\n    //     },\n    //     fail (res) {\n    //       console.log('chooseImage 调用失败')\n    //     }\n    //   })\n    // },\n    // 扫码\n    scanQRCode: function scanQRCode(data, callback) {\n      window.tt.scanCode({\n        scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],\n        barCodeInput: true,\n        success: function success(res) {\n          console.log(JSON.stringify(res));\n          var args = {\n            success: true,\n            data: {\n              qrcode_str: res.result\n            }\n          };\n          callback(args);\n        },\n        fail: function fail(res) {\n          console.error(\"scanCode fail: \".concat(JSON.stringify(res)));\n        }\n      });\n    },\n    // 轻应用关闭前，释放服务器对应的资源(不支持返回和关闭按钮的监听)\n    // releasePageBeforeClose: (data, callback) => {\n    // },\n    // 设置剪切板内容\n    setClipboardData: function setClipboardData(data, callback) {\n      window.tt.setClipboardData({\n        data: data,\n        success: function success(res) {\n          console.log(JSON.stringify(res));\n        },\n        fail: function fail(res) {\n          console.error(\"setClipboardData fail: \".concat(JSON.stringify(res)));\n        }\n      });\n    },\n    // 获取当前定位\n    getLocation: function getLocation() {\n      var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n      var callback = arguments.length > 1 ? arguments[1] : undefined;\n      var type = data && data.type ? data.type : 'gcj02';\n      window.tt.getLocation({\n        type: type,\n        // 默认为gcj02坐标\n        timeout: 5,\n        cacheTimeout: 30,\n        accuracy: 'best',\n        success: function success(res) {\n          console.log(JSON.stringify(res));\n          var args = {\n            success: true,\n            data: res\n          };\n          callback(args);\n        },\n        fail: function fail(res) {\n          console.error(\"getLocation fail: \".concat(JSON.stringify(res)));\n        }\n      });\n      // 接口调用成功返回的数据格式\n      // {\n      //   \"authorizationAccuracy\": \"full\",\n      //   \"latitude\": 30.48318898654514,\n      //   \"errMsg\": \"getLocation:ok\",\n      //   \"longitude\": 120.03518184678819,\n      //   \"accuracy\": 148,\n      //   \"horizontalAccuracy\": 148,\n      //   \"verticalAccuracy\": 13.574329376220703,\n      //   \"timestamp\": 1637490791204\n      // }\n    }\n  };\n  return permissionPlugin;\n}\nfunction setConfig(data) {\n  var _ref2 = (data === null || data === void 0 ? void 0 : data.config) || {},\n    appId = _ref2.appId,\n    timestamp = _ref2.timestamp,\n    nonce = _ref2.nonce,\n    signature = _ref2.signature;\n  var clientApiList = window.clientApiList || [];\n  var jsApiList = ['tt.previewImage', 'tt.scanCode', 'tt.setClipboardData', 'tt.getLocation'].concat(_toConsumableArray(clientApiList));\n  // 调用config接口进行鉴权\n  window.h5sdk.config({\n    appId: appId,\n    timestamp: timestamp,\n    nonceStr: nonce,\n    signature: signature,\n    jsApiList: jsApiList,\n    // 鉴权成功回调\n    onSuccess: function onSuccess(res) {\n      console.log(\"config success: \".concat(JSON.stringify(res)));\n      (0, _PluginManager2.loadDynamicPlugin)(getPermissionPlugin());\n    },\n    // 鉴权失败回调\n    onFail: function onFail(err) {\n      console.error(\"config failed: \".concat(JSON.stringify(err)));\n    }\n  });\n}\n\n//# sourceURL=webpack://bos-platform/./src/plugin/mobile/feishu/plugin.js?");

/***/ })

}]);