      var ua = navigator.userAgent;
        return /Safari/.test(ua) && !/Chrome/.test(ua);
    }

    // Check if requestIdleCallback is not available or if the browser is Safari
    if (!('requestIdleCallback' in window) || isSafari()) {
        window.requestIdleCallback = function (callback, options) {
            const timeout = options && options.timeout ? options.timeout : 50;
            const start = Date.now();

            return setTimeout(() => {
                callback({
                    d