import Taro, { createSelectorQuery } from "@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'
};
export var getRectById = function(id) {
    return new Promise(function(resolve, reject) {
        if (Taro.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 = createSelectorQuery();
            query.select("#".concat(id)).boundingClientRect().exec(function(rect) {
                if (rect[0]) {
                    resolve(rect[0]);
                } else {
                    reject();
                }
            });
        }
    });
};
