{"size": 1445, "ext": "js", "max_stars_repo_path": "lib/clickOutsideRef.js", "max_stars_repo_name": "kalambo/tools", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/clickOutsideRef.js", "max_issues_repo_name": "kalambo/tools", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/clickOutsideRef.js", "max_forks_repo_name": "kalambo/tools", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 34.4047619048, "max_line_length": 78, "alphanum_fraction": 0.5287197232}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (onClickOutside) {
    var elem;
    var stopClick = false;
    var downListener = function (e) {
        if (!(elem && (elem === e.target || elem.contains(e.target)))) {
            if (onClickOutside()) {
                e.stopPropagation();
                stopClick = true;
            }
        }
    };
    var upListener = function (e) {
        if (stopClick) {
            e.stopPropagation();
            setTimeout(function () { return (stopClick = false); });
        }
    };
    var clickListener = function (e) {
        if (stopClick) {
            e.stopPropagation();
            setTimeout(function () { return (stopClick = false); });
        }
    };
    return Object.assign(function (e) {
        elem = e;
        if (typeof document !== 'undefined') {
            if (elem) {
                document.addEventListener('mousedown', downListener, true);
                document.addEventListener('mouseup', upListener, true);
                document.addEventListener('click', clickListener, true);
            }
            else {
                document.removeEventListener('mousedown', downListener, true);
                document.removeEventListener('mouseup', upListener, true);
                document.removeEventListener('click', clickListener, true);
            }
        }
    }, { noCache: true });
});
