import { _ as _applyDecoratedDescriptor, a as _initializerDefineProperty, b as _defineProperty } from '../_rollupPluginBabelHelpers-9wjJaosZ.js';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { on } from '@ember/modifier';
import { action } from '@ember/object';
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
import setBodyClass from 'ember-set-body-class/helpers/set-body-class';
import { eq } from 'ember-truth-helpers';
import classNames from '../helpers/class-names.js';

var _class, _descriptor;
let EuiOverlayMaskComponent = setComponentTemplate(precompileTemplate(`
    {{(setBodyClass "euiBody-hasOverlayMask")}}
    {{#in-element this.destinationElement insertBefore=null}}
      <div
        class={{classNames
          "euiOverlayMask"
          (unless
            (eq @headerZindexLocation "below")
            "euiOverlayMask--aboveHeader"
            "euiOverlayMask--belowHeader"
          )
        }}
        {{didInsert this.setOverlayMaskNode}}
        {{! template-lint-disable }}
        {{on "click" this.onClick}}
        ...attributes
      >
        {{yield}}
      </div>
    {{/in-element}}
  `, {
  strictMode: true,
  scope: () => ({
    setBodyClass,
    classNames,
    eq,
    didInsert,
    on
  })
}), (_class = class EuiOverlayMaskComponent extends Component {
  constructor(...args) {
    super(...args);
    _initializerDefineProperty(this, "overlayMaskNode", _descriptor, this);
    _defineProperty(this, "destinationElement", document.body);
  }
  onClick(e) {
    if (e.target === this.overlayMaskNode) {
      this.args.onClick?.(e);
    }
  }
  setOverlayMaskNode(node) {
    this.overlayMaskNode = node;
  }
  willDestroy() {
    super.willDestroy();
    this.overlayMaskNode = undefined;
  }
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "overlayMaskNode", [tracked], {
  configurable: true,
  enumerable: true,
  writable: true,
  initializer: null
}), _applyDecoratedDescriptor(_class.prototype, "onClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onClick"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "setOverlayMaskNode", [action], Object.getOwnPropertyDescriptor(_class.prototype, "setOverlayMaskNode"), _class.prototype)), _class));

export { EuiOverlayMaskComponent as default };
//# sourceMappingURL=eui-overlay-mask.js.map
