import {OrientationObserver,orientationChangeEvent}from'@scandit/web-datacapture-core/build/js/private/OrientationObserver.js';import {ScanditHTMLElement,debounce,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var i=class i extends ScanditHTMLElement{constructor(){super();this.orientationObserver=new OrientationObserver;this.onOrientationChangeHandler=debounce(this.onOrientationChange.bind(this),50);let e=this.attachShadow({mode:"open"});e.append(i.createStyleElement().cloneNode(true));let t=document.createElement("div");t.id="root",t.innerHTML=html`
      <div class="wrapper">
        <div class="main">
          <slot name="backdrop"></slot>
          <slot name="card-list"></slot>
        </div>
        <div class="bottom-container">
          <slot name="bottom-button"></slot>
        </div>
      </div>
    `,e.append(t);}get cardListContainer(){return this.querySelector('[slot="card-list"]')}get main(){var e;return (e=this.shadowRoot)==null?void 0:e.querySelector(".main")}static create(){return document.createElement(i.tag)}static register(){defineCustomElements({[i.tag]:i});}addButtons(e){var t;(t=this.cardListContainer)==null||t.append(...e);}static createStyleElement(){return css`:host{inset:0;overflow:hidden;position:absolute;z-index:1}:host #root{--padding:1rem;box-sizing:border-box;display:flex;flex-direction:column;gap:.5rem;height:100%;justify-content:space-between;margin:0 auto;max-width:960px;padding:calc(var(--padding))}.main{display:flex;flex-direction:column;height:100%;overflow:hidden}:host .main ::slotted([slot=card-list]){margin-top:auto!important}.wrapper{display:flex;flex-direction:column;gap:.5rem;height:100%;justify-content:flex-end}.bottom-container{align-items:center;display:flex;justify-content:center}@media (orientation:landscape){.wrapper{flex:0 70%;height:100%;margin:0 auto}:host #root{flex-direction:row}}`}connectedCallback(){this.orientationObserver.addEventListener(orientationChangeEvent,this.onOrientationChangeHandler),this.orientationObserver.register();}disconnectedCallback(){this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(orientationChangeEvent,this.onOrientationChangeHandler);}onOrientationChange(e){var t,n,a,o,r;(t=this.main)==null||t.style.setProperty("height","100%"),(o=this.cardListContainer)==null||o.updateHeight((a=(n=this.main)==null?void 0:n.getBoundingClientRect().height)!=null?a:0),(r=this.main)==null||r.style.setProperty("height","unset");}};i.tag="scandit-label-capture-validation-flow-layout";var l=i;export{l as a};