{{!-- Elements that exist deep within the document tree are given an implicitly lower z-index
      value than elements that aren't as deep in the tree; this has the effect of hiding our
      ember-popper behind less-nested elements. Due to the way z-indexing works, we cannot simply
      add a higher z-index value to our ember-popper. To avoid this issue, we render the element
      on the document body, giving it the highest default z-index value. --}}
{{#if this.renderInPlace}}
  {{!-- Add a wrapper around the yielded block so we have something for the Popper to target --}}
  <div id={{@id}} class={{@class}} hidden={{this.hidden}} role={{@ariaRole}}
       {{did-insert (action 'didInsertPopperElement')}}
       {{will-destroy (action 'willDestroyPopperElement')}}
       {{did-update (action 'didUpdatePopperSettings') this.eventsEnabled this.modifiers this.onCreate this.onUpdate this.placement this.popperTarget this.renderInPlace}}
       ...attributes>
    {{yield (hash
      disableEventListeners=(action 'disableEventListeners')
      enableEventListeners=(action 'enableEventListeners')
      scheduleUpdate=(action 'scheduleUpdate')
      update=(action 'update')
    )}}
  </div>
{{else}}
  {{#in-element this._popperContainer insertBefore=null}}
    <div id={{@id}} class={{@class}} hidden={{this.hidden}} role={{@ariaRole}}
         {{did-insert (action 'didInsertPopperElement')}}
         {{will-destroy (action 'willDestroyPopperElement')}}
         {{did-update (action 'didUpdatePopperSettings') this.eventsEnabled this.modifiers this.onCreate this.onUpdate this.placement this.popperTarget this.renderInPlace}}
         ...attributes>
      {{yield (hash
        disableEventListeners=(action 'disableEventListeners')
        enableEventListeners=(action 'enableEventListeners')
        scheduleUpdate=(action 'scheduleUpdate')
        update=(action 'update')
      )}}
    </div>
  {{/in-element}}
{{/if}}
