"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "getRectById", {
    enumerable: true,
    get: function() {
        return getRectById;
    }
});
var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
var _taro = /*#__PURE__*/ _interop_require_wildcard._(require("@tarojs/taro"));
var ENV_TYPE = {
    WEAPP: 'WEAPP',
    SWAN: 'SWAN',
    ALIPAY: 'ALIPAY',
    TT: 'TT',
    QQ: 'QQ',
    JD: 'JD',
    WEB: 'WEB',
    RN: 'RN',
    HARMONY: 'HARMONY',
    QUICKAPP: 'QUICKAPP'
};
var getRectById = function getRectById(id) {
    return new Promise(function(resolve, reject) {
        if (_taro.default.getEnv() === ENV_TYPE.WEB) {
            var t = document ? document.querySelector("#".concat(id)) : '';
            if (t) {
                resolve(t === null || t === void 0 ? void 0 : t.getBoundingClientRect());
            }
            reject();
        } else {
            var query = (0, _taro.createSelectorQuery)();
            query.select("#".concat(id)).boundingClientRect().exec(function(rect) {
                if (rect[0]) {
                    resolve(rect[0]);
                } else {
                    reject();
                }
            });
        }
    });
};
