'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-7a477838.js');
const randomIdGenerator_util = require('./randomIdGenerator.util-e7f4b6de.js');
const detectClickOutside_util = require('./detectClickOutside.util-3e764eb3.js');
require('./detectClosest.util-85b3507b.js');

const UtilDetectClickOutside = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.afOnClickOutside = index.createEvent(this, "afOnClickOutside", 7);
        this.afOnClickInside = index.createEvent(this, "afOnClickInside", 7);
        this.afDataIdentifier = randomIdGenerator_util.randomIdGenerator('data-digi-util-detect-click-outside');
    }
    componentWillLoad() {
        this.$el.setAttribute(this.afDataIdentifier, '');
    }
    clickHandler(e) {
        const target = e.target;
        const selector = `[${this.afDataIdentifier}]`;
        if (detectClickOutside_util.detectClickOutside(target, selector)) {
            this.afOnClickOutside.emit(e);
        }
        else {
            this.afOnClickInside.emit(e);
        }
    }
    render() {
        return index.h("slot", { key: '47d24cdbd95d6fc0319eb35bc2d77a5ce04f015e' });
    }
    get $el() { return index.getElement(this); }
};

exports.digi_util_detect_click_outside = UtilDetectClickOutside;
