"use strict";
/**
 * 云存储/云函数相关
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTempFileURL = exports.getCloudInstance = void 0;
var tslib_1 = require("tslib");
// cloudbase._useDefaultAdapter();
// const tcb = cloudbase.init({
//   env: 'hole-2ggmiaj108259587',
// });
// export default app;
// import cloudbase from '@cloudbase/js-sdk';
// cloudbase._useDefaultAdapter();
// const tcb = cloudbase.init({
//   env: 'hole-2ggmiaj108259587',
// });
// export function getNativeCloudInstance() {
//   return tcb;
// }
function getCloudInstance() {
    var _a, _b;
    return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
        var tcb;
        return (0, tslib_1.__generator)(this, function (_c) {
            switch (_c.label) {
                case 0: return [4 /*yield*/, ((_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.getCloudInstance())];
                case 1:
                    tcb = _c.sent();
                    return [2 /*return*/, tcb];
            }
        });
    });
}
exports.getCloudInstance = getCloudInstance;
/**
 * 获取单个临时链接
 * 单个cos文件，返回字符串
 * 多个cos文件，返回 {fileID: src} 这样的对象
 */
function getTempFileURL(data) {
    var _a, _b, _c, _d;
    return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
        return (0, tslib_1.__generator)(this, function (_e) {
            switch (_e.label) {
                case 0:
                    if (!((_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.getTempFileURL)) return [3 /*break*/, 2];
                    return [4 /*yield*/, ((_d = (_c = window === null || window === void 0 ? void 0 : window.app) === null || _c === void 0 ? void 0 : _c.cloud) === null || _d === void 0 ? void 0 : _d.getTempFileURL(data))];
                case 1: return [2 /*return*/, _e.sent()];
                case 2: return [2 /*return*/];
            }
        });
    });
}
exports.getTempFileURL = getTempFileURL;
//# sourceMappingURL=tcb.js.map