
                (function() {
                    var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined';
                    var __module = nodeEnv ? module : {exports:{}};
                    var __filename = 'preview-scripts/assets/Script/lq_base/util/lq_base_util.js';
                    var __require = nodeEnv ? function (request) {
                        return cc.require(request);
                    } : function (request) {
                        return __quick_compile_project__.require(request, __filename);
                    };
                    function __define (exports, require, module) {
                        if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"use strict";
cc._RF.push(module, 'cd21fuTZY5LOoiXtN66R7wx', 'lq_base_util');
// Script/lq_base/util/lq_base_util.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LQBaseUtil = void 0;
var lq_platform_util_1 = require("./lq_platform_util");
var lq_const_1 = require("../data/lq_const");
var view = cc.view;
var LQBaseUtil = /** @class */ (function () {
    function LQBaseUtil() {
    }
    // public static readonly unit_arr = ['K', 'M', 'B', 'T'];
    LQBaseUtil.has_value = function (arr, v) {
        var has = false;
        for (var i = 0; i < arr.length; i++) {
            if (arr[i] === v) {
                has = true;
                break;
            }
        }
        return has;
    };
    LQBaseUtil.get_value_by_duration = function (percent, timeline) {
        if (timeline.length === 0) {
            return 1;
        }
        var end_index = -1;
        for (var i = 1; i < timeline.length; i++) {
            if (timeline[i].x > percent) {
                end_index = i;
                break;
            }
        }
        if (end_index === -1) {
            return timeline[timeline.length - 1].y;
        }
        var start_index = end_index - 1;
        return timeline[start_index].y + (timeline[end_index].y - timeline[start_index].y) * ((percent - timeline[start_index].x) / (timeline[end_index].x - timeline[start_index].x));
    };
    LQBaseUtil.number_to_counting = function (num) {
        if (num < 1000) {
            return num + '';
        }
        else if (num < 1000000) {
            return Math.floor(num / 1000) + 'K';
        }
        else if (num < 1000000000) {
            return Math.floor(num / 1000000) + 'M';
        }
        else if (num < 1000000000000) {
            return Math.floor(num / 1000000000) + 'B';
        }
        else if (num < 1000000000000000) {
            return Math.floor(num / 1000000000000) + 'T';
        }
        return Math.floor(num / 1000000000000) + 'T';
    };
    LQBaseUtil.number_to_time = function (time) {
        var t = Math.floor(time / (60 * 60));
        time = time - t * 60 * 60;
        var hour = t.toString();
        var min = Math.floor(time / 60).toString();
        var sec = (time % 60).toString();
        if (hour.length === 1) {
            hour = '0' + hour;
        }
        if (min.length === 1) {
            min = '0' + min;
        }
        if (sec.length === 1) {
            sec = '0' + sec;
        }
        return [hour, min, sec];
    };
    LQBaseUtil.set_normal_angle = function (angle) {
        while (angle > 360) {
            angle -= 360;
        }
        while (angle < 0) {
            angle += 360;
        }
        return angle;
    };
    LQBaseUtil.compare_version = function (v1, v2) {
        var v1_arr = v1.split('.');
        var v2_arr = v2.split('.');
        var len = Math.max(v1_arr.length, v2_arr.length);
        while (v1_arr.length < len) {
            v1_arr.push('0');
        }
        while (v2_arr.length < len) {
            v2_arr.push('0');
        }
        for (var i = 0; i < len; i++) {
            var num1 = parseInt(v1_arr[i]);
            var num2 = parseInt(v2_arr[i]);
            if (num1 > num2) {
                return 1;
            }
            else if (num1 < num2) {
                return -1;
            }
        }
        return 0;
    };
    LQBaseUtil.is_today = function (date) {
        var d1 = new Date();
        var d2;
        if (date && date !== '') {
            d2 = new Date(date);
        }
        else {
            d2 = new Date();
            d2.setDate(d2.getDate() - 1);
        }
        return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();
    };
    LQBaseUtil.is_safe_area = function () {
        var cb = function (width, height) {
            return (width === 2280 && height === 1080) || (width === 1792 && height === 828) || (width === 2436 && height === 1125) || (width === 2688 && height === 1242);
        };
        switch (lq_platform_util_1.LQPlatformUtil.get_platform()) {
            case lq_const_1.LQPlatformType.baidu:
                var sys_info_swan = swan.getSystemInfoSync();
                return cb(sys_info_swan.pixelRatio * sys_info_swan.screenWidth, sys_info_swan.pixelRatio * sys_info_swan.screenHeight);
            case lq_const_1.LQPlatformType.qq:
                var sys_info_qq = qq.getSystemInfoSync();
                return cb(sys_info_qq.pixelRatio * sys_info_qq.screenWidth, sys_info_qq.pixelRatio * sys_info_qq.screenHeight);
            case lq_const_1.LQPlatformType.tt:
                var sys_info_tt = tt.getSystemInfoSync();
                return cb(sys_info_tt.pixelRatio * sys_info_tt.screenWidth, sys_info_tt.pixelRatio * sys_info_tt.screenHeight);
            case lq_const_1.LQPlatformType.oppo:
            case lq_const_1.LQPlatformType.vivo:
                var sys_info_vivo = qg.getSystemInfoSync();
                return cb(sys_info_vivo.pixelRatio * sys_info_vivo.screenWidth, sys_info_vivo.pixelRatio * sys_info_vivo.screenHeight);
            case lq_const_1.LQPlatformType.wx:
                var sys_info_wx = wx.getSystemInfoSync();
                return cb(sys_info_wx.pixelRatio * sys_info_wx.screenWidth, sys_info_wx.pixelRatio * sys_info_wx.screenHeight);
            case lq_const_1.LQPlatformType.android:
                break;
            case lq_const_1.LQPlatformType.ios:
                var size = view.getFrameSize();
                return cb(size.width, size.height);
        }
        return false;
    };
    LQBaseUtil.deep_clone = function (obj) {
        if (typeof obj !== 'object') {
            return obj;
        }
        var new_obj = (obj instanceof Array ? [] : {});
        for (var key in obj) {
            if (typeof obj[key] === 'object') {
                new_obj[key] = this.deep_clone(obj[key]);
            }
            else {
                new_obj[key] = obj[key];
            }
        }
        return new_obj;
    };
    return LQBaseUtil;
}());
exports.LQBaseUtil = LQBaseUtil;

cc._RF.pop();
                    }
                    if (nodeEnv) {
                        __define(__module.exports, __require, __module);
                    }
                    else {
                        __quick_compile_project__.registerModuleFunc(__filename, function () {
                            __define(__module.exports, __require, __module);
                        });
                    }
                })();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 16232 characters]